@decocms/mesh 1.4.4 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-B6rEUVLf.js → AlertCircle-BIlMffS8.js} +1 -1
- package/dist/client/assets/{ArrowLeft-DC_Ebc-m.js → ArrowLeft-CJ-eKoid.js} +1 -1
- package/dist/client/assets/{ChevronDown-rNVX3ifZ.js → ChevronDown-atiP0m-F.js} +1 -1
- package/dist/client/assets/{Clock-DS2iGkSJ.js → Clock-BD2gknBV.js} +1 -1
- package/dist/client/assets/{Code01-CoFYqM8q.js → Code01-BEefaaXC.js} +1 -1
- package/dist/client/assets/{Copy01-CCVZH6f1.js → Copy01-DhXqtugg.js} +1 -1
- package/dist/client/assets/{CpuChip02-DwHhz9CA.js → CpuChip02-BtgBI59l.js} +1 -1
- package/dist/client/assets/{DotsVertical-8kkJJG9R.js → DotsVertical-roys0n6e.js} +1 -1
- package/dist/client/assets/{File06-DxUGl7Wc.js → File06-MlW8n69V.js} +1 -1
- package/dist/client/assets/{FlipBackward-D9qJVjU9.js → FlipBackward-BSnTMMYy.js} +1 -1
- package/dist/client/assets/{GitBranch01-DLNdjhEu.js → GitBranch01-CEvRlFly.js} +1 -1
- package/dist/client/assets/{Grid01-BTunGha4.js → Grid01-CkwdbRed.js} +1 -1
- package/dist/client/assets/{Inbox01-BoV8p7IN.js → Inbox01-D66dNA_K.js} +1 -1
- package/dist/client/assets/{Key01-Bqzm5f6K.js → Key01-BXlD7hmS.js} +1 -1
- package/dist/client/assets/{LinkExternal01-WcFL8RpQ.js → LinkExternal01-O4xnNCff.js} +1 -1
- package/dist/client/assets/{Loading01-B0vdyVbH.js → Loading01-EiDV-2FW.js} +1 -1
- package/dist/client/assets/{Lock01-B0PVK-yI.js → Lock01-DpRDCI3P.js} +1 -1
- package/dist/client/assets/{Play-KfJ8X6ky.js → Play-FKw7EqPO.js} +1 -1
- package/dist/client/assets/{Plus-nu8-Nz8b.js → Plus-CwB-Rc8B.js} +1 -1
- package/dist/client/assets/{SearchMd-BFumDfkS.js → SearchMd-C6P9P1wF.js} +1 -1
- package/dist/client/assets/{Terminal-CDIp_seB.js → Terminal-Dv6w41J8.js} +1 -1
- package/dist/client/assets/{Trash01-1tKgR7uh.js → Trash01-Ctk7srex.js} +1 -1
- package/dist/client/assets/{X-hEo9Za23.js → X-Da4xsL05.js} +1 -1
- package/dist/client/assets/{XClose-BIthQxae.js → XClose-OUZ04LEo.js} +1 -1
- package/dist/client/assets/{alert-dialog-_VCwcCen.js → alert-dialog-D6UjYOUP.js} +1 -1
- package/dist/client/assets/{auth-BpfHzPVh.js → auth-CZR9mNdb.js} +1 -1
- package/dist/client/assets/{auth-catchall-D-D94naG.js → auth-catchall-BZWl_BRK.js} +1 -1
- package/dist/client/assets/{avatar-DHKqC-IM.js → avatar-BHE7lL4M.js} +1 -1
- package/dist/client/assets/{badge-Dkhmn9Qj.js → badge-B-u7R38I.js} +1 -1
- package/dist/client/assets/{button-BSXU4L7C.js → button-B13xcF6W.js} +1 -1
- package/dist/client/assets/{card-CXFRieEW.js → card-7VW-xSd-.js} +1 -1
- package/dist/client/assets/{checkbox-C-t_-9ku.js → checkbox-BMd2Z-WT.js} +1 -1
- package/dist/client/assets/{collection-detail-P20CfY5q.js → collection-detail-7eGCexqR.js} +3 -3
- package/dist/client/assets/{collection-display-button-BAoFTB4b.js → collection-display-button-D4VM0KQx.js} +1 -1
- package/dist/client/assets/{collection-header-B--7sWbR.js → collection-header-od14k6u3.js} +1 -1
- package/dist/client/assets/{collection-page-B71dz4fa.js → collection-page-BNuNM--s.js} +1 -1
- package/dist/client/assets/{collection-search-CrC01K4Z.js → collection-search-LnYLnFH8.js} +1 -1
- package/dist/client/assets/{collection-tab-dwp9LGxi.js → collection-tab-bg_gmLyh.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CFoaxah9.js → collection-table-wrapper-B0AFEn1d.js} +1 -1
- package/dist/client/assets/{connection-card-eAyda1Mu.js → connection-card-r2tH19aR.js} +1 -1
- package/dist/client/assets/{connection-detail-Bn-jl6HG.js → connection-detail-Dm1s8Dj2.js} +1 -1
- package/dist/client/assets/connections-CWHukeOK.js +1 -0
- package/dist/client/assets/constants-CN4QOiqe.js +1 -0
- package/dist/client/assets/{core-C9AbX0ks.js → core-BqWxized.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DhHOFwW5.js → create-organization-dialog-CjneLhKn.js} +1 -1
- package/dist/client/assets/{dialog-Cj2udzC-.js → dialog-DoN4ORnY.js} +1 -1
- package/dist/client/assets/{dropdown-menu-ClBJUvd8.js → dropdown-menu-uXj8nKiT.js} +1 -1
- package/dist/client/assets/{empty-state-CYnIzDhF.js → empty-state-N07FE0YG.js} +1 -1
- package/dist/client/assets/{env-vars-editor-nU4IPD2j.js → env-vars-editor-B7JL_p-V.js} +1 -1
- package/dist/client/assets/{error-boundary-D5hb-PLt.js → error-boundary-Ce0_dLsG.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BWB54H7f.js → extract-connection-data-CeT4F9gU.js} +1 -1
- package/dist/client/assets/{form-Dn7fy5O5.js → form-BQIYj24w.js} +1 -1
- package/dist/client/assets/{formatDistanceToNow-km7E2wF1.js → formatDistanceToNow-CArtWgcP.js} +1 -1
- package/dist/client/assets/gateway-detail-VCb3jL84.js +1 -0
- package/dist/client/assets/gateways-9p2LLkTK.js +1 -0
- package/dist/client/assets/{home-dep1g9Zf.js → home-DgfprghT.js} +1 -1
- package/dist/client/assets/{index-gqIvEQSH.js → index-CVgkE3Gv.js} +2 -2
- package/dist/client/assets/{index-tz4gB72W.js → index-DEMNtulg.js} +2 -2
- package/dist/client/assets/{index-DX5d9vx1.js → index-DcMa5gDs.js} +1 -1
- package/dist/client/assets/{index-CcNvI65p.js → index-DcvTq0xJ.js} +1 -1
- package/dist/client/assets/{input-Cb7MaM0d.js → input-YdP8mwrf.js} +1 -1
- package/dist/client/assets/json-Bz08jZIq.js +1 -0
- package/dist/client/assets/{json-syntax-highlighter-CCgbux_M.js → json-syntax-highlighter-Bif-CDya.js} +2 -2
- package/dist/client/assets/{layout-DtfNegCp.js → layout-BNxxrCBw.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-CaGtIE-R.js → lazy-highlighter-C0vzyJy5.js} +1 -1
- package/dist/client/assets/{localstorage-keys-DIkWdWYS.js → localstorage-keys-DwKN3_Ky.js} +1 -1
- package/dist/client/assets/{login-DSSk45pi.js → login-UWyl_cxx.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BOAcAnr_.js → mcp-oauth-Dqr97r2H.js} +1 -1
- package/dist/client/assets/{members-D4I8qlnr.js → members-C3UV37Kw.js} +1 -1
- package/dist/client/assets/{monitoring-CvcerPLg.js → monitoring-Ds52TSSS.js} +2 -2
- package/dist/client/assets/{oauth-callback-CY5bCrs6.js → oauth-callback-D4M9mHyH.js} +1 -1
- package/dist/client/assets/{page-Du4118GJ.js → page-B7ia0_lh.js} +2 -2
- package/dist/client/assets/{pin-to-sidebar-button-CwlJToUG.js → pin-to-sidebar-button-BKotT_Nc.js} +1 -1
- package/dist/client/assets/{popover-BPqLZ76M.js → popover-7jr0PuXV.js} +1 -1
- package/dist/client/assets/prism-light-CHE2alug.js +1 -0
- package/dist/client/assets/resizable-qkPSJ31g.js +1 -0
- package/dist/client/assets/{resource-tabs-CmUpRVKA.js → resource-tabs-qR3NhTLd.js} +1 -1
- package/dist/client/assets/{responsive-select-DwsIwS1V.js → responsive-select-CJQwNPPj.js} +1 -1
- package/dist/client/assets/{select-HGITgxwS.js → select-L_OjJ9sW.js} +1 -1
- package/dist/client/assets/{settings-sSoOIGWg.js → settings-BapAo6i2.js} +1 -1
- package/dist/client/assets/shell-layout-DqUuQ9gz.js +19 -0
- package/dist/client/assets/{spinner-BUVePO6d.js → spinner-CAJeeq5B.js} +1 -1
- package/dist/client/assets/{store-H6vucsd1.js → store-DTMoxgob.js} +1 -1
- package/dist/client/assets/{store-app-detail-aULJzMOJ.js → store-app-detail-CbGg2GlI.js} +1 -1
- package/dist/client/assets/{switch-BwTlw9qL.js → switch-DlwEQXd2.js} +1 -1
- package/dist/client/assets/{textarea-BAs6HmBZ.js → textarea-IOVeLZOt.js} +1 -1
- package/dist/client/assets/{thread-history-popover-DbEl1KJu.js → thread-history-popover-COjpShBU.js} +3 -3
- package/dist/client/assets/{tools-list-thZyoBrU.js → tools-list-l6xtSgWR.js} +1 -1
- package/dist/client/assets/{tooltip-Bzy1O5cq.js → tooltip-C7B84lYF.js} +1 -1
- package/dist/client/assets/{types-BVTsq_OW.js → types-BmKCUQAI.js} +1 -1
- package/dist/client/assets/{use-binding-jUI3xZmp.js → use-binding-Ce8NG0MO.js} +1 -1
- package/dist/client/assets/{use-connection-DRZbGk_A.js → use-connection-D-LWel3A.js} +1 -1
- package/dist/client/assets/{use-connection-resources-B3tDNT6E.js → use-connection-resources-CJzk5_Wj.js} +1 -1
- package/dist/client/assets/{use-gateway-CUxuCVmJ.js → use-gateway-eXp_1iQc.js} +1 -1
- package/dist/client/assets/{use-list-state-CkGBL95Z.js → use-list-state-CmxR0QRn.js} +1 -1
- package/dist/client/assets/{use-mcp-CMt9Wy3X.js → use-mcp-Cmlg9h6L.js} +1 -1
- package/dist/client/assets/{use-members-cyA2aC2q.js → use-members-Drex2zGi.js} +1 -1
- package/dist/client/assets/{use-mobile-B8xlavN6.js → use-mobile-B-R7B7Hp.js} +1 -1
- package/dist/client/assets/{use-organization-settings-C7IdFOTo.js → use-organization-settings-B_G_DBCR.js} +1 -1
- package/dist/client/assets/{use-tool-call-CsOSZ1pI.js → use-tool-call-BN3WED_Z.js} +1 -1
- package/dist/client/assets/useQuery-DLJrS2VC.js +1 -0
- package/dist/client/assets/{useSuspenseInfiniteQuery-DqCwXIKB.js → useSuspenseInfiniteQuery-DFaXtjFO.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-COcukfhX.js → view-mode-toggle-BpRlpgBn.js} +1 -1
- package/dist/client/assets/workflow-CBeu3WB4.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +114 -114
- package/dist/server/migrate.js +71 -71
- package/dist/server/server.js +109 -109
- package/package.json +1 -1
- package/dist/client/assets/connections-CDl5cKXc.js +0 -1
- package/dist/client/assets/constants-C-5m3xCJ.js +0 -1
- package/dist/client/assets/gateway-detail-BEimKnAa.js +0 -1
- package/dist/client/assets/gateways-1GR6BIbg.js +0 -1
- package/dist/client/assets/json-CevIphLA.js +0 -1
- package/dist/client/assets/prism-light-bnbWF_0X.js +0 -1
- package/dist/client/assets/resizable-Ck5ltOjh.js +0 -1
- package/dist/client/assets/shell-layout-BCUXUEeW.js +0 -19
- package/dist/client/assets/useQuery-Bl78N6vT.js +0 -1
- package/dist/client/assets/workflow-CaCjE8aO.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aj as Qe,r as E,v as np,w as Eo,c as R,j as m,g as qi,y as rp,i as sp,d as xr,b as op,t as ru,F as X,Q as ip,ak as No,al as su,a5 as lp,a4 as ap,am as cp,H as Ui,an as ou,ao as up,B as Rn,E as He,$ as Ki,ap as dp,z as qs,aq as fp,Z as Ji,ar as hp,as as pp,at as mp,au as Gi,av as gp,aw as iu,a1 as yp,ax as xp,L as bp,ay as kp,az as wp,af as lu}from"./index-tz4gB72W.js";import{U as Sn,f as au,d as Xi,c as Ze,b as Yi,I as Us,u as vp,n as Sp}from"./use-connection-DRZbGk_A.js";import{E as Qi}from"./SearchMd-BFumDfkS.js";import{E as cu}from"./error-boundary-D5hb-PLt.js";import{P as Zi}from"./pin-to-sidebar-button-CwlJToUG.js";import{B as me,c as Y}from"./button-BSXU4L7C.js";import{F as To,a as Cp,b as el,d as tl}from"./form-Dn7fy5O5.js";import{I as nl}from"./input-Cb7MaM0d.js";import{T as ui}from"./textarea-BAs6HmBZ.js";import{b as $t,T as _t,a as zt,c as Bt,i as rl,d as Ep}from"./tooltip-Bzy1O5cq.js";import{i as uu}from"./FlipBackward-D9qJVjU9.js";import{a as du,V as sl,b as Ks}from"./layout-DtfNegCp.js";import{i as Np}from"./AlertCircle-B6rEUVLf.js";import{s as Tp}from"./Clock-DS2iGkSJ.js";import{i as Mp,n as Op}from"./Code01-CoFYqM8q.js";import{a as Ap}from"./Copy01-CCVZH6f1.js";import{i as or}from"./Loading01-B0vdyVbH.js";import{i as ol}from"./Play-KfJ8X6ky.js";import{s as il,i as Ip}from"./XClose-BIthQxae.js";import{u as Rp,O as jp,M as Dp,F as Pp,v as Lp}from"./index-gqIvEQSH.js";import{u as ll}from"./use-mcp-CMt9Wy3X.js";import{J as $p}from"./json-syntax-highlighter-CCgbux_M.js";import{E as _p}from"./empty-state-CYnIzDhF.js";import{D as zp,u as Bp}from"./use-binding-jUI3xZmp.js";import{u as Fp}from"./use-gateway-CUxuCVmJ.js";import{S as jn}from"./spinner-BUVePO6d.js";import{G as Vp,b as Hp,R as ca,a as Wp}from"./resizable-Ck5ltOjh.js";import{V as qp}from"./view-mode-toggle-COcukfhX.js";import{i as Up}from"./GitBranch01-DLNdjhEu.js";import{i as Kp}from"./responsive-select-DwsIwS1V.js";import{a as al,b as cl}from"./use-tool-call-CsOSZ1pI.js";import{D as Jp,a as Gp,b as Xp,f as Yp,c as Qp,d as Zp}from"./dialog-Cj2udzC-.js";import"./index-DX5d9vx1.js";import{s as ul}from"./Plus-nu8-Nz8b.js";import{b as em,D as tm,a as nm,c as ua}from"./dropdown-menu-ClBJUvd8.js";import{B as dn}from"./badge-Dkhmn9Qj.js";import{i as fu}from"./X-hEo9Za23.js";import"./use-organization-settings-C7IdFOTo.js";import"./ArrowLeft-DC_Ebc-m.js";import"./mcp-oauth-BOAcAnr_.js";import"./auth-BpfHzPVh.js";import"./env-vars-editor-nU4IPD2j.js";import"./Trash01-1tKgR7uh.js";import"./File06-DxUGl7Wc.js";import"./Key01-Bqzm5f6K.js";import"./select-HGITgxwS.js";import"./ChevronDown-rNVX3ifZ.js";import"./Terminal-CDIp_seB.js";import"./CpuChip02-DwHhz9CA.js";import"./formatDistanceToNow-km7E2wF1.js";import"./constants-C-5m3xCJ.js";import"./registry-utils-ulDDT0d8.js";import"./extract-connection-data-BWB54H7f.js";import"./generate-id-Dyweu44Y.js";import"./index-CcNvI65p.js";import"./useQuery-Bl78N6vT.js";import"./use-mobile-B8xlavN6.js";const hu=Qe("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const pu=Qe("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const mu=Qe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const gu=Qe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const rm=Qe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const sm=Qe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const yu=Qe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const xu=Qe("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const bu=Qe("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const ku=Qe("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),dl=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));dl.displayName="AlertOctagon";const wu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M20.5 8v8.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.22 21 17.38 21 15.7 21H8.3c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3.5 18.72 3.5 17.88 3.5 16.2V8m.1-5h16.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C22 3.76 22 4.04 22 4.6v1.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C21.24 8 20.96 8 20.4 8H3.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C2 7.24 2 6.96 2 6.4V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C2.76 3 3.04 3 3.6 3Zm6 8.5h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 12.26 16 12.54 16 13.1v.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437c-.214.109-.494.109-1.054.109H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 14.74 8 14.46 8 13.9v-.8c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 11.5 9.04 11.5 9.6 11.5Z"}));wu.displayName="Box";const vu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));vu.displayName="ClockFastForward";const Su=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));Su.displayName="Code02";const Wr=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M6.8 3h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C10 19.48 10 18.92 10 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C8.48 3 7.92 3 6.8 3Zm11 0h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C14 4.52 14 5.08 14 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C15.52 21 16.08 21 17.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3Z"}));Wr.displayName="Columns01";const Cu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M4 4v1.4c0 3.36 0 5.04.654 6.324a6 6 0 0 0 2.622 2.622C8.56 15 10.24 15 13.6 15H20m0 0-5-5m5 5-5 5"}));Cu.displayName="CornerDownRight";const Eu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M21 5c0 1.657-4.03 3-9 3S3 6.657 3 5m18 0c0-1.657-4.03-3-9-3S3 3.343 3 5m18 0v14c0 1.66-4 3-9 3s-9-1.34-9-3V5m18 7c0 1.66-4 3-9 3s-9-1.34-9-3"}));Eu.displayName="Database01";const Nu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"m13 22-3-3m0 0 3-3m-3 3h5a7 7 0 0 0 3-13.326M6 18.326A7 7 0 0 1 9 5h5m0 0-3-3m3 3-3 3"}));Nu.displayName="Repeat03";const fl=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M15 8H8.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C7 7.24 7 6.96 7 6.4V3m10 18v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));fl.displayName="Save02";const Tu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M15.631 7.631c-.396-.396-.594-.594-.668-.822a1 1 0 0 1 0-.618c.074-.228.272-.426.668-.822L18.47 2.53a6 6 0 0 0-8.3 6.895c.12.49.179.734.168.888a.849.849 0 0 1-.11.392c-.07.138-.207.274-.48.547L3.5 17.5a2.121 2.121 0 0 0 3 3l6.248-6.248c.273-.273.41-.41.547-.48a.849.849 0 0 1 .392-.11c.154-.011.399.049.888.168a6 6 0 0 0 6.895-8.3l-2.84 2.84c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668l-.738-.738Z"}));Tu.displayName="Tool01";const{getOwnPropertyNames:om,getOwnPropertySymbols:im}=Object,{hasOwnProperty:lm}=Object.prototype;function Mo(t,e){return function(r,s,o){return t(r,s,o)&&e(r,s,o)}}function Mr(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:o}=s,i=o.get(n),l=o.get(r);if(i&&l)return i===r&&l===n;o.set(n,r),o.set(r,n);const a=t(n,r,s);return o.delete(n),o.delete(r),a}}function am(t){return t?.[Symbol.toStringTag]}function da(t){return om(t).concat(im(t))}const cm=Object.hasOwn||((t,e)=>lm.call(t,e));function Yt(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const um="__v",dm="__o",fm="_owner",{getOwnPropertyDescriptor:fa,keys:ha}=Object;function hm(t,e){return t.byteLength===e.byteLength&&Yr(new Uint8Array(t),new Uint8Array(e))}function pm(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function mm(t,e){return t.byteLength===e.byteLength&&Yr(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function gm(t,e){return Yt(t.getTime(),e.getTime())}function ym(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function xm(t,e){return t===e}function pa(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=t.entries();let i,l,a=0;for(;(i=o.next())&&!i.done;){const c=e.entries();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(s[d]){d++;continue}const f=i.value,h=l.value;if(n.equals(f[0],h[0],a,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){u=s[d]=!0;break}d++}if(!u)return!1;a++}return!0}const bm=Yt;function km(t,e,n){const r=ha(t);let s=r.length;if(ha(e).length!==s)return!1;for(;s-- >0;)if(!Mu(t,e,n,r[s]))return!1;return!0}function Bn(t,e,n){const r=da(t);let s=r.length;if(da(e).length!==s)return!1;let o,i,l;for(;s-- >0;)if(o=r[s],!Mu(t,e,n,o)||(i=fa(t,o),l=fa(e,o),(i||l)&&(!i||!l||i.configurable!==l.configurable||i.enumerable!==l.enumerable||i.writable!==l.writable)))return!1;return!0}function wm(t,e){return Yt(t.valueOf(),e.valueOf())}function vm(t,e){return t.source===e.source&&t.flags===e.flags}function ma(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=t.values();let i,l;for(;(i=o.next())&&!i.done;){const a=e.values();let c=!1,u=0;for(;(l=a.next())&&!l.done;){if(!s[u]&&n.equals(i.value,l.value,i.value,l.value,t,e,n)){c=s[u]=!0;break}u++}if(!c)return!1}return!0}function Yr(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function Sm(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Mu(t,e,n,r){return(r===fm||r===dm||r===um)&&(t.$$typeof||e.$$typeof)?!0:cm(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const Cm="[object ArrayBuffer]",Em="[object Arguments]",Nm="[object Boolean]",Tm="[object DataView]",Mm="[object Date]",Om="[object Error]",Am="[object Map]",Im="[object Number]",Rm="[object Object]",jm="[object RegExp]",Dm="[object Set]",Pm="[object String]",Lm={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},$m="[object URL]",_m=Object.prototype.toString;function zm({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(y,x,b){if(y===x)return!0;if(y==null||x==null)return!1;const k=typeof y;if(k!==typeof x)return!1;if(k!=="object")return k==="number"?l(y,x,b):k==="function"?o(y,x,b):!1;const C=y.constructor;if(C!==x.constructor)return!1;if(C===Object)return a(y,x,b);if(Array.isArray(y))return e(y,x,b);if(C===Date)return r(y,x,b);if(C===RegExp)return u(y,x,b);if(C===Map)return i(y,x,b);if(C===Set)return d(y,x,b);const w=_m.call(y);if(w===Mm)return r(y,x,b);if(w===jm)return u(y,x,b);if(w===Am)return i(y,x,b);if(w===Dm)return d(y,x,b);if(w===Rm)return typeof y.then!="function"&&typeof x.then!="function"&&a(y,x,b);if(w===$m)return h(y,x,b);if(w===Om)return s(y,x,b);if(w===Em)return a(y,x,b);if(Lm[w])return f(y,x,b);if(w===Cm)return t(y,x,b);if(w===Tm)return n(y,x,b);if(w===Nm||w===Im||w===Pm)return c(y,x,b);if(p){let S=p[w];if(!S){const v=am(y);v&&(S=p[v])}if(S)return S(y,x,b)}return!1}}function Bm({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:hm,areArraysEqual:n?Bn:pm,areDataViewsEqual:mm,areDatesEqual:gm,areErrorsEqual:ym,areFunctionsEqual:xm,areMapsEqual:n?Mo(pa,Bn):pa,areNumbersEqual:bm,areObjectsEqual:n?Bn:km,arePrimitiveWrappersEqual:wm,areRegExpsEqual:vm,areSetsEqual:n?Mo(ma,Bn):ma,areTypedArraysEqual:n?Mo(Yr,Bn):Yr,areUrlsEqual:Sm,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=Mr(r.areArraysEqual),o=Mr(r.areMapsEqual),i=Mr(r.areObjectsEqual),l=Mr(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:i,areSetsEqual:l})}return r}function Fm(t){return function(e,n,r,s,o,i,l){return t(e,n,l)}}function Vm({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(l,a){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(l,a,{cache:c,equals:r,meta:u,strict:s})};if(t)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const o={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,a){return e(l,a,o)}}const Hm=Mt();Mt({strict:!0});Mt({circular:!0});Mt({circular:!0,strict:!0});Mt({createInternalComparator:()=>Yt});Mt({strict:!0,createInternalComparator:()=>Yt});Mt({circular:!0,createInternalComparator:()=>Yt});Mt({circular:!0,createInternalComparator:()=>Yt,strict:!0});function Mt(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,o=Bm(t),i=zm(o),l=n?n(i):Fm(i);return Vm({circular:e,comparator:i,createState:r,equals:l,strict:s})}np({title:Eo().min(1),description:Eo().nullable(),body:Eo()});function Oo(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Wm(){const t=window.location.pathname.split("/").filter(Boolean),e=t.findIndex(r=>r==="mcps"),n=e>=0?t[e+1]:void 0;return n?decodeURIComponent(n):void 0}function qm(t){const e=R.c(13),{form:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=r):r=e[0];let s;e[1]!==n.control?(s=m.jsxs("div",{className:"flex flex-col gap-4",children:[r,m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[m.jsx(To,{control:n.control,name:"title",render:Jm}),m.jsx(To,{control:n.control,name:"description",render:Km})]})]}),e[1]=n.control,e[2]=s):s=e[2];let o,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),i=m.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=o,e[4]=i):(o=e[3],i=e[4]);let l;e[5]!==n.control?(l=m.jsxs("div",{className:"flex flex-col gap-2",children:[o,i,m.jsx(To,{control:n.control,name:"body",render:Um})]}),e[5]=n.control,e[6]=l):l=e[6];let a;e[7]!==s||e[8]!==l?(a=m.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[s,l]}),e[7]=s,e[8]=l,e[9]=a):a=e[9];let c;return e[10]!==n||e[11]!==a?(c=m.jsx(Cp,{...n,children:a}),e[10]=n,e[11]=a,e[12]=c):c=e[12],c}function Um(t){const{field:e}=t;return m.jsx(el,{children:m.jsx(tl,{children:m.jsx(ui,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Km(t){const{field:e}=t;return m.jsxs(el,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),m.jsx(tl,{children:m.jsx(nl,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Jm(t){const{field:e}=t;return m.jsxs(el,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),m.jsx(tl,{children:m.jsx(nl,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Gm(t){const e=R.c(51),{providerId:n,promptId:r,onBack:s}=t,i=qi().location.href,l=n||Sn;let a;e[0]!==l?(a=Ze(l),e[0]=l,e[1]=a):a=e[1];const c=a,u=au(n,"PROMPT",r,c),d=Xi(n,"PROMPT",c),f=d.update.isPending;let h;e[2]!==u?(h=u?{title:u.title,description:u.description??null,body:Oo(u)}:void 0,e[2]=u,e[3]=h):h=e[3];let p;e[4]!==h?(p={values:h},e[4]=h,e[5]=p):p=e[5];const g=rp(p);let y;e[6]!==g||e[7]!==u?(y=()=>{u&&g.reset({title:u.title,description:u.description??null,body:Oo(u)})},e[6]=g,e[7]=u,e[8]=y):y=e[8];const x=y;let b;e[9]!==d.update||e[10]!==g||e[11]!==r?(b=g.handleSubmit(async K=>{const ie=await d.update.mutateAsync({id:r,data:{title:K.title,description:K.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:K.body}}]}});g.reset({title:ie.title,description:ie.description??null,body:Oo(ie)})}),e[9]=d.update,e[10]=g,e[11]=r,e[12]=b):b=e[12];const k=b;if(!u){let K;return e[13]===Symbol.for("react.memo_cache_sentinel")?(K=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(Qi,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[13]=K):K=e[13],K}let C;e[14]!==u.title?(C=m.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:u.title}),e[14]=u.title,e[15]=C):C=e[15];let w;e[16]!==u.description?(w=u.description?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),m.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:u.description})]}):null,e[16]=u.description,e[17]=w):w=e[17];let S;e[18]!==C||e[19]!==w?(S=m.jsx(du,{children:m.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[C,w]})}),e[18]=C,e[19]=w,e[20]=S):S=e[20];let v;e[21]!==u.title||e[22]!==i?(v=m.jsx(Zi,{title:u.title,url:i,icon:"description"}),e[21]=u.title,e[22]=i,e[23]=v):v=e[23];const M=!g.formState.isDirty||f;let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=m.jsx(uu,{size:14}),e[24]=T):T=e[24];let I;e[25]!==x||e[26]!==M?(I=m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:M,onClick:x,"aria-label":"Cancel",children:T})})}),e[25]=x,e[26]=M,e[27]=I):I=e[27];let D;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=m.jsx(_t,{side:"bottom",children:"Cancel"}),e[28]=D):D=e[28];let $;e[29]!==I?($=m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[I,D]})}),e[29]=I,e[30]=$):$=e[30];const V=!g.formState.isDirty||f;let F;e[31]!==k?(F=()=>{k()},e[31]=k,e[32]=F):F=e[32];let P;e[33]===Symbol.for("react.memo_cache_sentinel")?(P=m.jsx(fl,{size:14}),e[33]=P):P=e[33];let N;e[34]!==V||e[35]!==F?(N=m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:V,onClick:F,"aria-label":"Save",children:P})})}),e[34]=V,e[35]=F,e[36]=N):N=e[36];let _;e[37]===Symbol.for("react.memo_cache_sentinel")?(_=m.jsx(_t,{side:"bottom",children:"Save"}),e[37]=_):_=e[37];let L;e[38]!==N?(L=m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[N,_]})}),e[38]=N,e[39]=L):L=e[39];let J;e[40]!==v||e[41]!==$||e[42]!==L?(J=m.jsxs(sl,{children:[v,$,L]}),e[40]=v,e[41]=$,e[42]=L,e[43]=J):J=e[43];let Z;e[44]!==g?(Z=m.jsx("div",{className:"h-full",children:m.jsx(qm,{form:g})}),e[44]=g,e[45]=Z):Z=e[45];let U;return e[46]!==s||e[47]!==J||e[48]!==Z||e[49]!==S?(U=m.jsxs(Ks,{onBack:s,children:[S,J,Z]}),e[46]=s,e[47]=J,e[48]=Z,e[49]=S,e[50]=U):U=e[50],U}function Xm(t){const e=R.c(5),{itemId:n,onBack:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=Wm()??Sn,e[0]=s):s=e[0];const o=s;if(!o||o===Sn){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(Qi,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=l):l=e[1],l}let i;return e[2]!==n||e[3]!==r?(i=m.jsx(cu,{children:m.jsx(E.Suspense,{fallback:null,children:m.jsx(Gm,{providerId:o,promptId:n,onBack:r})})}),e[2]=n,e[3]=r,e[4]=i):i=e[4],i}const Ym=sp("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function Qm(t){const e=R.c(10);let n,r,s;e[0]!==t?({className:n,variant:s,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=s):(n=e[1],r=e[2],s=e[3]);let o;e[4]!==n||e[5]!==s?(o=Y(Ym({variant:s}),n),e[4]=n,e[5]=s,e[6]=o):o=e[6];let i;return e[7]!==r||e[8]!==o?(i=m.jsx("div",{"data-slot":"alert",role:"alert",className:o,...r}),e[7]=r,e[8]=o,e[9]=i):i=e[9],i}function Zm(t){const e=R.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let s;e[3]!==n?(s=Y("line-clamp-1 min-h-4 font-medium tracking-tight",n),e[3]=n,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}function eg(t){const e=R.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let s;e[3]!==n?(s=Y("text-muted-foreground leading-relaxed",n),e[3]=n,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}const tg=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function ng(t){const e=R.c(13),{toolName:n,connectionId:r,onBack:s}=t,o=`/mcp/${r}`;let i;e[0]!==o?(i=new URL(o,window.location.origin),e[0]=o,e[1]=i):i=e[1];const l=i;let a;e[2]!==r?(a={connectionId:r},e[2]=r,e[3]=a):a=e[3];const c=Rp(a);if(!c.isAuthenticated){let f;return e[4]!==c.supportsOAuth||e[5]!==s?(f=m.jsx("div",{className:"flex h-full items-center justify-center",children:c.supportsOAuth?m.jsx(jp,{onAuthenticate:()=>s(),buttonText:"Go back to authenticate"}):m.jsx(Dp,{hasReadme:!1})}),e[4]=c.supportsOAuth,e[5]=s,e[6]=f):f=e[6],f}const u=`${r}:${n}`;let d;return e[7]!==r||e[8]!==l||e[9]!==s||e[10]!==u||e[11]!==n?(d=m.jsx(rg,{toolName:n,connectionId:r,mcpProxyUrl:l,onBack:s},u),e[7]=r,e[8]=l,e[9]=s,e[10]=u,e[11]=n,e[12]=d):d=e[12],d}function rg({toolName:t,connectionId:e,mcpProxyUrl:n,onBack:r}){const o=qi().location.href,{replayId:i}=op({strict:!1}),l=(()=>{if(!i)return null;const N=`replay-${i}`,_=sessionStorage.getItem(N);if(!_)return null;sessionStorage.removeItem(N);try{return JSON.parse(_)}catch{return null}})(),a=(()=>{if(!l)return null;const N={};for(const[_,L]of Object.entries(l))L!==null&&typeof L=="object"?N[_]=JSON.stringify(L,null,2):N[_]=L;return N})(),[c,u]=E.useState(a??{}),[d,f]=E.useState(l?JSON.stringify(l,null,2):"{}"),[h,p]=E.useState(null),[g,y]=E.useState(null),[x,b]=E.useState(!1),[k,C]=E.useState(null),w=Yi(e),S=ll({url:n.href});E.useEffect(()=>{S.error&&console.error("MCP Error:",S.error)},[S.error]);const v=S.tools?.find(N=>N.name===t),M=v?.inputSchema?.properties,T=M?Object.keys(M):[],I=T.length>0,D={};if(I&&v?.inputSchema?.properties)for(const N of T)D[N]=v.inputSchema.required?.includes(N)?"":void 0;const $=N=>Object.prototype.hasOwnProperty.call(c,N),V=async()=>{b(!0),y(null),p(null),C(null);const N=performance.now(),_=Ze(e);try{const L=I?{...D,...c}:(()=>{const ee=d.trim();if(!ee)return{};const G=JSON.parse(ee);if(G&&typeof G=="object")return G;throw new Error("Raw JSON input must be an object.")})();I&&v?.inputSchema?.properties&&Object.entries(v.inputSchema.properties).forEach(([ee,G])=>{if((G.type==="object"||G.type==="array")&&typeof L[ee]=="string")try{L[ee]=JSON.parse(L[ee])}catch{}});const J=await _(t,L),Z=performance.now(),U=Math.round(Z-N);p(J);const K=JSON.stringify(J),ie=new TextEncoder().encode(K).length;C({duration:`${U}ms`,bytes:`${ie} bytes`,tokens:`~${Math.ceil(ie/4)} tokens`,cost:"$0.0000"})}catch(L){const J=L instanceof Error?L.message:String(L);y(J||"Unknown error occurred");const Z=performance.now();C({duration:`${Math.round(Z-N)}ms`})}finally{b(!1)}},F=(N,_)=>{u(L=>({...L,[N]:_}))},P=()=>{p(null),y(null),C(null)};return m.jsxs(Ks,{onBack:r,children:[m.jsx(sl,{children:m.jsx(Zi,{title:v?.name??tg(t),url:o,icon:"build"})}),m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[m.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:m.jsxs("div",{className:"flex-1 overflow-auto",children:[m.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(Us,{icon:w?.icon||null,name:w?.title||t,size:"sm",className:"shadow-sm shrink-0"}),m.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:t}),m.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[S.state==="ready"?m.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):S.state==="connecting"?m.jsx(or,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):m.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),m.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:S.state.replace("_"," ")})]})]}),m.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:v?.description||"No description available"})]})}),m.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),v?.inputSchema?.required&&v.inputSchema.required.length>0&&m.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),m.jsx("div",{className:"space-y-4",children:I&&v?.inputSchema?.properties?Object.entries(v.inputSchema.properties).map(([N,_])=>m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[N,v.inputSchema?.required?.includes(N)&&m.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),m.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:_.type})]}),_.description&&m.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:_.description}),_.type==="object"||_.type==="array"?m.jsx(ui,{className:"font-mono text-xs",value:$(N)?c[N]??"":D[N]??"",onChange:L=>F(N,L.target.value),placeholder:`Enter ${N} as JSON...`,rows:3}):m.jsx(nl,{value:$(N)?c[N]??"":D[N]??"",onChange:L=>F(N,L.target.value),placeholder:`Enter ${N}...`})]},N)):v?.inputSchema&&!I?m.jsxs("div",{className:"space-y-2",children:[m.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),m.jsx(ui,{className:"font-mono text-xs min-h-[120px]",value:d,onChange:N=>f(N.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):m.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:m.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[m.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),k&&m.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Tp,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.duration})]}),k.tokens&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(wu,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.tokens})]}),k.bytes&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Eu,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.bytes})]}),k.cost&&m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx("span",{className:"font-mono text-foreground",children:k.cost})})]})]}),m.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:m.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[m.jsx(me,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:V,disabled:x,children:x?m.jsxs(m.Fragment,{children:[m.jsx(or,{size:14,className:"animate-spin"}),"Executing..."]}):m.jsxs(m.Fragment,{children:[m.jsx(ol,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),m.jsx(zt,{children:m.jsxs(Bt,{children:[m.jsx($t,{asChild:!0,children:m.jsx(me,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:P,disabled:!h&&!g,children:m.jsx(il,{size:14})})}),m.jsx(_t,{children:m.jsx("p",{children:"Clear results"})})]})})]})}),g&&m.jsx("div",{className:"px-6 py-4 bg-background",children:m.jsx(Qm,{variant:"destructive",children:m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Np,{className:"h-4 w-4"}),m.jsx(Zm,{className:"mb-0",children:"Execution Failed"})]}),m.jsx(eg,{className:"text-xs text-destructive",children:g})]})})}),m.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:h?m.jsxs(m.Fragment,{children:[m.jsx($p,{jsonString:JSON.stringify(h,null,2),padding:"1.5rem"}),m.jsx(me,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(h,null,2)),ru.success("Copied to clipboard")},children:m.jsx(Ap,{className:"h-3.5 w-3.5"})})]}):m.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[m.jsx(Mp,{className:"h-12 w-12 mb-3 opacity-40"}),m.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function sg(t){const e=R.c(7),{itemId:n,onBack:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},e[0]=s):s=e[0];const i=xr(s).connectionId??Sn;if(!Yi(i)){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[m.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsx(or,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let c;return e[3]!==i||e[4]!==r||e[5]!==n?(c=m.jsx(E.Suspense,{fallback:a,children:m.jsx(ng,{toolName:n,connectionId:i,onBack:r})}),e[3]=i,e[4]=r,e[5]=n,e[6]=c):c=e[6],c}const ga=t=>{let e;const n=new Set,r=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),n.forEach(h=>h(e,f))}},s=()=>e,l={setState:r,getState:s,getInitialState:()=>a,subscribe:c=>(n.add(c),()=>n.delete(c))},a=e=t(r,s,l);return l},hl=(t=>t?ga(t):ga),og=t=>t;function di(t,e=og){const n=X.useSyncExternalStore(t.subscribe,X.useCallback(()=>e(t.getState()),[t,e]),X.useCallback(()=>e(t.getInitialState()),[t,e]));return X.useDebugValue(n),n}const ig=t=>{const e=hl(t),n=r=>di(e,r);return Object.assign(n,e),n},lg=(t=>ig);function Ou(t,e){let n;try{n=t()}catch{return}return{getItem:s=>{var o;const i=a=>a===null?null:JSON.parse(a,void 0),l=(o=n.getItem(s))!=null?o:null;return l instanceof Promise?l.then(i):i(l)},setItem:(s,o)=>n.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>n.removeItem(s)}}const fi=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return fi(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return fi(r)(n)}}}},ag=(t,e)=>(n,r,s)=>{let o={storage:Ou(()=>localStorage),partialize:g=>g,version:0,merge:(g,y)=>({...y,...g}),...e},i=!1;const l=new Set,a=new Set;let c=o.storage;if(!c)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...g)},r,s);const u=()=>{const g=o.partialize({...r()});return c.setItem(o.name,{state:g,version:o.version})},d=s.setState;s.setState=(g,y)=>(d(g,y),u());const f=t((...g)=>(n(...g),u()),r,s);s.getInitialState=()=>f;let h;const p=()=>{var g,y;if(!c)return;i=!1,l.forEach(b=>{var k;return b((k=r())!=null?k:f)});const x=((y=o.onRehydrateStorage)==null?void 0:y.call(o,(g=r())!=null?g:f))||void 0;return fi(c.getItem.bind(c))(o.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==o.version){if(o.migrate){const k=o.migrate(b.state,b.version);return k instanceof Promise?k.then(C=>[!0,C]):[!0,k]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var k;const[C,w]=b;if(h=o.merge(w,(k=r())!=null?k:f),n(h,!0),C)return u()}).then(()=>{x?.(h,void 0),h=r(),i=!0,a.forEach(b=>b(h))}).catch(b=>{x?.(void 0,b)})};return s.persist={setOptions:g=>{o={...o,...g},g.storage&&(c=g.storage)},clearStorage:()=>{c?.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>p(),hasHydrated:()=>i,onHydrate:g=>(l.add(g),()=>{l.delete(g)}),onFinishHydration:g=>(a.add(g),()=>{a.delete(g)})},o.skipHydration||p(),h||f},Au=ag,{useSyncExternalStoreWithSelector:cg}=ip,ug=t=>t;function dg(t,e=ug,n){const r=cg(t.subscribe,t.getState,t.getInitialState,e,n);return X.useDebugValue(r),r}const ya=t=>Symbol.iterator in t,xa=t=>"entries"in t,ba=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),r=e instanceof Map?e:new Map(e.entries());if(n.size!==r.size)return!1;for(const[s,o]of n)if(!r.has(s)||!Object.is(o,r.get(s)))return!1;return!0},fg=(t,e)=>{const n=t[Symbol.iterator](),r=e[Symbol.iterator]();let s=n.next(),o=r.next();for(;!s.done&&!o.done;){if(!Object.is(s.value,o.value))return!1;s=n.next(),o=r.next()}return!!s.done&&!!o.done};function hg(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:ya(t)&&ya(e)?xa(t)&&xa(e)?ba(t,e):fg(t,e):ba({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function pg(t,e="Output"){if(!t)return`interface ${e} {}`;function n(o){if(!o||typeof o!="object")return"unknown";const i=o.type;if(Array.isArray(i))return i.map(l=>r(l)).join(" | ");switch(i){case"string":return o.enum?o.enum.map(l=>`"${l}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const l=o.items;return l?`${n(l)}[]`:"unknown[]"}case"object":return s(o);default:return o.anyOf?o.anyOf.map(n).join(" | "):o.oneOf?o.oneOf.map(n).join(" | "):o.allOf?o.allOf.map(n).join(" & "):"unknown"}}function r(o){switch(o){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function s(o){const i=o.properties;if(!i)return"Record<string, unknown>";const l=new Set(o.required||[]);return`{
|
|
1
|
+
import{aj as Qe,r as E,v as np,w as Eo,c as R,j as m,g as qi,y as rp,i as sp,d as xr,b as op,t as ru,F as X,Q as ip,ak as No,al as su,a5 as lp,a4 as ap,am as cp,H as Ui,an as ou,ao as up,B as Rn,E as He,$ as Ki,ap as dp,z as qs,aq as fp,Z as Ji,ar as hp,as as pp,at as mp,au as Gi,av as gp,aw as iu,a1 as yp,ax as xp,L as bp,ay as kp,az as wp,af as lu}from"./index-DEMNtulg.js";import{U as Sn,f as au,d as Xi,c as Ze,b as Yi,I as Us,u as vp,n as Sp}from"./use-connection-D-LWel3A.js";import{E as Qi}from"./SearchMd-C6P9P1wF.js";import{E as cu}from"./error-boundary-Ce0_dLsG.js";import{P as Zi}from"./pin-to-sidebar-button-BKotT_Nc.js";import{B as me,c as Y}from"./button-B13xcF6W.js";import{F as To,a as Cp,b as el,d as tl}from"./form-BQIYj24w.js";import{I as nl}from"./input-YdP8mwrf.js";import{T as ui}from"./textarea-IOVeLZOt.js";import{b as $t,T as _t,a as zt,c as Bt,i as rl,d as Ep}from"./tooltip-C7B84lYF.js";import{i as uu}from"./FlipBackward-BSnTMMYy.js";import{a as du,V as sl,b as Ks}from"./layout-BNxxrCBw.js";import{i as Np}from"./AlertCircle-BIlMffS8.js";import{s as Tp}from"./Clock-BD2gknBV.js";import{i as Mp,n as Op}from"./Code01-BEefaaXC.js";import{a as Ap}from"./Copy01-DhXqtugg.js";import{i as or}from"./Loading01-EiDV-2FW.js";import{i as ol}from"./Play-FKw7EqPO.js";import{s as il,i as Ip}from"./XClose-OUZ04LEo.js";import{u as Rp,O as jp,M as Dp,F as Pp,v as Lp}from"./index-CVgkE3Gv.js";import{u as ll}from"./use-mcp-Cmlg9h6L.js";import{J as $p}from"./json-syntax-highlighter-Bif-CDya.js";import{E as _p}from"./empty-state-N07FE0YG.js";import{D as zp,u as Bp}from"./use-binding-Ce8NG0MO.js";import{u as Fp}from"./use-gateway-eXp_1iQc.js";import{S as jn}from"./spinner-CAJeeq5B.js";import{G as Vp,b as Hp,R as ca,a as Wp}from"./resizable-qkPSJ31g.js";import{V as qp}from"./view-mode-toggle-BpRlpgBn.js";import{i as Up}from"./GitBranch01-CEvRlFly.js";import{i as Kp}from"./responsive-select-CJQwNPPj.js";import{a as al,b as cl}from"./use-tool-call-BN3WED_Z.js";import{D as Jp,a as Gp,b as Xp,f as Yp,c as Qp,d as Zp}from"./dialog-DoN4ORnY.js";import"./index-DcMa5gDs.js";import{s as ul}from"./Plus-CwB-Rc8B.js";import{b as em,D as tm,a as nm,c as ua}from"./dropdown-menu-uXj8nKiT.js";import{B as dn}from"./badge-B-u7R38I.js";import{i as fu}from"./X-Da4xsL05.js";import"./use-organization-settings-B_G_DBCR.js";import"./ArrowLeft-CJ-eKoid.js";import"./mcp-oauth-Dqr97r2H.js";import"./auth-CZR9mNdb.js";import"./env-vars-editor-B7JL_p-V.js";import"./Trash01-Ctk7srex.js";import"./File06-MlW8n69V.js";import"./Key01-BXlD7hmS.js";import"./select-L_OjJ9sW.js";import"./ChevronDown-atiP0m-F.js";import"./Terminal-Dv6w41J8.js";import"./CpuChip02-BtgBI59l.js";import"./formatDistanceToNow-CArtWgcP.js";import"./constants-CN4QOiqe.js";import"./registry-utils-ulDDT0d8.js";import"./extract-connection-data-CeT4F9gU.js";import"./generate-id-Dyweu44Y.js";import"./index-DcvTq0xJ.js";import"./useQuery-DLJrS2VC.js";import"./use-mobile-B-R7B7Hp.js";const hu=Qe("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const pu=Qe("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const mu=Qe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const gu=Qe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const rm=Qe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const sm=Qe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const yu=Qe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const xu=Qe("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const bu=Qe("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const ku=Qe("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),dl=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));dl.displayName="AlertOctagon";const wu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M20.5 8v8.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.22 21 17.38 21 15.7 21H8.3c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3.5 18.72 3.5 17.88 3.5 16.2V8m.1-5h16.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C22 3.76 22 4.04 22 4.6v1.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C21.24 8 20.96 8 20.4 8H3.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C2 7.24 2 6.96 2 6.4V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C2.76 3 3.04 3 3.6 3Zm6 8.5h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 12.26 16 12.54 16 13.1v.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437c-.214.109-.494.109-1.054.109H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 14.74 8 14.46 8 13.9v-.8c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 11.5 9.04 11.5 9.6 11.5Z"}));wu.displayName="Box";const vu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));vu.displayName="ClockFastForward";const Su=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));Su.displayName="Code02";const Wr=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M6.8 3h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C10 19.48 10 18.92 10 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C8.48 3 7.92 3 6.8 3Zm11 0h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C14 4.52 14 5.08 14 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C15.52 21 16.08 21 17.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3Z"}));Wr.displayName="Columns01";const Cu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M4 4v1.4c0 3.36 0 5.04.654 6.324a6 6 0 0 0 2.622 2.622C8.56 15 10.24 15 13.6 15H20m0 0-5-5m5 5-5 5"}));Cu.displayName="CornerDownRight";const Eu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M21 5c0 1.657-4.03 3-9 3S3 6.657 3 5m18 0c0-1.657-4.03-3-9-3S3 3.343 3 5m18 0v14c0 1.66-4 3-9 3s-9-1.34-9-3V5m18 7c0 1.66-4 3-9 3s-9-1.34-9-3"}));Eu.displayName="Database01";const Nu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"m13 22-3-3m0 0 3-3m-3 3h5a7 7 0 0 0 3-13.326M6 18.326A7 7 0 0 1 9 5h5m0 0-3-3m3 3-3 3"}));Nu.displayName="Repeat03";const fl=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M15 8H8.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C7 7.24 7 6.96 7 6.4V3m10 18v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));fl.displayName="Save02";const Tu=({size:t=24,color:e="currentColor",...n})=>E.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},E.createElement("path",{d:"M15.631 7.631c-.396-.396-.594-.594-.668-.822a1 1 0 0 1 0-.618c.074-.228.272-.426.668-.822L18.47 2.53a6 6 0 0 0-8.3 6.895c.12.49.179.734.168.888a.849.849 0 0 1-.11.392c-.07.138-.207.274-.48.547L3.5 17.5a2.121 2.121 0 0 0 3 3l6.248-6.248c.273-.273.41-.41.547-.48a.849.849 0 0 1 .392-.11c.154-.011.399.049.888.168a6 6 0 0 0 6.895-8.3l-2.84 2.84c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668l-.738-.738Z"}));Tu.displayName="Tool01";const{getOwnPropertyNames:om,getOwnPropertySymbols:im}=Object,{hasOwnProperty:lm}=Object.prototype;function Mo(t,e){return function(r,s,o){return t(r,s,o)&&e(r,s,o)}}function Mr(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:o}=s,i=o.get(n),l=o.get(r);if(i&&l)return i===r&&l===n;o.set(n,r),o.set(r,n);const a=t(n,r,s);return o.delete(n),o.delete(r),a}}function am(t){return t?.[Symbol.toStringTag]}function da(t){return om(t).concat(im(t))}const cm=Object.hasOwn||((t,e)=>lm.call(t,e));function Yt(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const um="__v",dm="__o",fm="_owner",{getOwnPropertyDescriptor:fa,keys:ha}=Object;function hm(t,e){return t.byteLength===e.byteLength&&Yr(new Uint8Array(t),new Uint8Array(e))}function pm(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function mm(t,e){return t.byteLength===e.byteLength&&Yr(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function gm(t,e){return Yt(t.getTime(),e.getTime())}function ym(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function xm(t,e){return t===e}function pa(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=t.entries();let i,l,a=0;for(;(i=o.next())&&!i.done;){const c=e.entries();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(s[d]){d++;continue}const f=i.value,h=l.value;if(n.equals(f[0],h[0],a,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){u=s[d]=!0;break}d++}if(!u)return!1;a++}return!0}const bm=Yt;function km(t,e,n){const r=ha(t);let s=r.length;if(ha(e).length!==s)return!1;for(;s-- >0;)if(!Mu(t,e,n,r[s]))return!1;return!0}function Bn(t,e,n){const r=da(t);let s=r.length;if(da(e).length!==s)return!1;let o,i,l;for(;s-- >0;)if(o=r[s],!Mu(t,e,n,o)||(i=fa(t,o),l=fa(e,o),(i||l)&&(!i||!l||i.configurable!==l.configurable||i.enumerable!==l.enumerable||i.writable!==l.writable)))return!1;return!0}function wm(t,e){return Yt(t.valueOf(),e.valueOf())}function vm(t,e){return t.source===e.source&&t.flags===e.flags}function ma(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=t.values();let i,l;for(;(i=o.next())&&!i.done;){const a=e.values();let c=!1,u=0;for(;(l=a.next())&&!l.done;){if(!s[u]&&n.equals(i.value,l.value,i.value,l.value,t,e,n)){c=s[u]=!0;break}u++}if(!c)return!1}return!0}function Yr(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function Sm(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Mu(t,e,n,r){return(r===fm||r===dm||r===um)&&(t.$$typeof||e.$$typeof)?!0:cm(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const Cm="[object ArrayBuffer]",Em="[object Arguments]",Nm="[object Boolean]",Tm="[object DataView]",Mm="[object Date]",Om="[object Error]",Am="[object Map]",Im="[object Number]",Rm="[object Object]",jm="[object RegExp]",Dm="[object Set]",Pm="[object String]",Lm={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},$m="[object URL]",_m=Object.prototype.toString;function zm({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(y,x,b){if(y===x)return!0;if(y==null||x==null)return!1;const k=typeof y;if(k!==typeof x)return!1;if(k!=="object")return k==="number"?l(y,x,b):k==="function"?o(y,x,b):!1;const C=y.constructor;if(C!==x.constructor)return!1;if(C===Object)return a(y,x,b);if(Array.isArray(y))return e(y,x,b);if(C===Date)return r(y,x,b);if(C===RegExp)return u(y,x,b);if(C===Map)return i(y,x,b);if(C===Set)return d(y,x,b);const w=_m.call(y);if(w===Mm)return r(y,x,b);if(w===jm)return u(y,x,b);if(w===Am)return i(y,x,b);if(w===Dm)return d(y,x,b);if(w===Rm)return typeof y.then!="function"&&typeof x.then!="function"&&a(y,x,b);if(w===$m)return h(y,x,b);if(w===Om)return s(y,x,b);if(w===Em)return a(y,x,b);if(Lm[w])return f(y,x,b);if(w===Cm)return t(y,x,b);if(w===Tm)return n(y,x,b);if(w===Nm||w===Im||w===Pm)return c(y,x,b);if(p){let S=p[w];if(!S){const v=am(y);v&&(S=p[v])}if(S)return S(y,x,b)}return!1}}function Bm({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:hm,areArraysEqual:n?Bn:pm,areDataViewsEqual:mm,areDatesEqual:gm,areErrorsEqual:ym,areFunctionsEqual:xm,areMapsEqual:n?Mo(pa,Bn):pa,areNumbersEqual:bm,areObjectsEqual:n?Bn:km,arePrimitiveWrappersEqual:wm,areRegExpsEqual:vm,areSetsEqual:n?Mo(ma,Bn):ma,areTypedArraysEqual:n?Mo(Yr,Bn):Yr,areUrlsEqual:Sm,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=Mr(r.areArraysEqual),o=Mr(r.areMapsEqual),i=Mr(r.areObjectsEqual),l=Mr(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:i,areSetsEqual:l})}return r}function Fm(t){return function(e,n,r,s,o,i,l){return t(e,n,l)}}function Vm({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(l,a){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(l,a,{cache:c,equals:r,meta:u,strict:s})};if(t)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const o={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,a){return e(l,a,o)}}const Hm=Mt();Mt({strict:!0});Mt({circular:!0});Mt({circular:!0,strict:!0});Mt({createInternalComparator:()=>Yt});Mt({strict:!0,createInternalComparator:()=>Yt});Mt({circular:!0,createInternalComparator:()=>Yt});Mt({circular:!0,createInternalComparator:()=>Yt,strict:!0});function Mt(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,o=Bm(t),i=zm(o),l=n?n(i):Fm(i);return Vm({circular:e,comparator:i,createState:r,equals:l,strict:s})}np({title:Eo().min(1),description:Eo().nullable(),body:Eo()});function Oo(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Wm(){const t=window.location.pathname.split("/").filter(Boolean),e=t.findIndex(r=>r==="mcps"),n=e>=0?t[e+1]:void 0;return n?decodeURIComponent(n):void 0}function qm(t){const e=R.c(13),{form:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=r):r=e[0];let s;e[1]!==n.control?(s=m.jsxs("div",{className:"flex flex-col gap-4",children:[r,m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[m.jsx(To,{control:n.control,name:"title",render:Jm}),m.jsx(To,{control:n.control,name:"description",render:Km})]})]}),e[1]=n.control,e[2]=s):s=e[2];let o,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),i=m.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=o,e[4]=i):(o=e[3],i=e[4]);let l;e[5]!==n.control?(l=m.jsxs("div",{className:"flex flex-col gap-2",children:[o,i,m.jsx(To,{control:n.control,name:"body",render:Um})]}),e[5]=n.control,e[6]=l):l=e[6];let a;e[7]!==s||e[8]!==l?(a=m.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[s,l]}),e[7]=s,e[8]=l,e[9]=a):a=e[9];let c;return e[10]!==n||e[11]!==a?(c=m.jsx(Cp,{...n,children:a}),e[10]=n,e[11]=a,e[12]=c):c=e[12],c}function Um(t){const{field:e}=t;return m.jsx(el,{children:m.jsx(tl,{children:m.jsx(ui,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Km(t){const{field:e}=t;return m.jsxs(el,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),m.jsx(tl,{children:m.jsx(nl,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Jm(t){const{field:e}=t;return m.jsxs(el,{children:[m.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),m.jsx(tl,{children:m.jsx(nl,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Gm(t){const e=R.c(51),{providerId:n,promptId:r,onBack:s}=t,i=qi().location.href,l=n||Sn;let a;e[0]!==l?(a=Ze(l),e[0]=l,e[1]=a):a=e[1];const c=a,u=au(n,"PROMPT",r,c),d=Xi(n,"PROMPT",c),f=d.update.isPending;let h;e[2]!==u?(h=u?{title:u.title,description:u.description??null,body:Oo(u)}:void 0,e[2]=u,e[3]=h):h=e[3];let p;e[4]!==h?(p={values:h},e[4]=h,e[5]=p):p=e[5];const g=rp(p);let y;e[6]!==g||e[7]!==u?(y=()=>{u&&g.reset({title:u.title,description:u.description??null,body:Oo(u)})},e[6]=g,e[7]=u,e[8]=y):y=e[8];const x=y;let b;e[9]!==d.update||e[10]!==g||e[11]!==r?(b=g.handleSubmit(async K=>{const ie=await d.update.mutateAsync({id:r,data:{title:K.title,description:K.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:K.body}}]}});g.reset({title:ie.title,description:ie.description??null,body:Oo(ie)})}),e[9]=d.update,e[10]=g,e[11]=r,e[12]=b):b=e[12];const k=b;if(!u){let K;return e[13]===Symbol.for("react.memo_cache_sentinel")?(K=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(Qi,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[13]=K):K=e[13],K}let C;e[14]!==u.title?(C=m.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:u.title}),e[14]=u.title,e[15]=C):C=e[15];let w;e[16]!==u.description?(w=u.description?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),m.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:u.description})]}):null,e[16]=u.description,e[17]=w):w=e[17];let S;e[18]!==C||e[19]!==w?(S=m.jsx(du,{children:m.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[C,w]})}),e[18]=C,e[19]=w,e[20]=S):S=e[20];let v;e[21]!==u.title||e[22]!==i?(v=m.jsx(Zi,{title:u.title,url:i,icon:"description"}),e[21]=u.title,e[22]=i,e[23]=v):v=e[23];const M=!g.formState.isDirty||f;let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=m.jsx(uu,{size:14}),e[24]=T):T=e[24];let I;e[25]!==x||e[26]!==M?(I=m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:M,onClick:x,"aria-label":"Cancel",children:T})})}),e[25]=x,e[26]=M,e[27]=I):I=e[27];let D;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=m.jsx(_t,{side:"bottom",children:"Cancel"}),e[28]=D):D=e[28];let $;e[29]!==I?($=m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[I,D]})}),e[29]=I,e[30]=$):$=e[30];const V=!g.formState.isDirty||f;let F;e[31]!==k?(F=()=>{k()},e[31]=k,e[32]=F):F=e[32];let P;e[33]===Symbol.for("react.memo_cache_sentinel")?(P=m.jsx(fl,{size:14}),e[33]=P):P=e[33];let N;e[34]!==V||e[35]!==F?(N=m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:V,onClick:F,"aria-label":"Save",children:P})})}),e[34]=V,e[35]=F,e[36]=N):N=e[36];let _;e[37]===Symbol.for("react.memo_cache_sentinel")?(_=m.jsx(_t,{side:"bottom",children:"Save"}),e[37]=_):_=e[37];let L;e[38]!==N?(L=m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[N,_]})}),e[38]=N,e[39]=L):L=e[39];let J;e[40]!==v||e[41]!==$||e[42]!==L?(J=m.jsxs(sl,{children:[v,$,L]}),e[40]=v,e[41]=$,e[42]=L,e[43]=J):J=e[43];let Z;e[44]!==g?(Z=m.jsx("div",{className:"h-full",children:m.jsx(qm,{form:g})}),e[44]=g,e[45]=Z):Z=e[45];let U;return e[46]!==s||e[47]!==J||e[48]!==Z||e[49]!==S?(U=m.jsxs(Ks,{onBack:s,children:[S,J,Z]}),e[46]=s,e[47]=J,e[48]=Z,e[49]=S,e[50]=U):U=e[50],U}function Xm(t){const e=R.c(5),{itemId:n,onBack:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=Wm()??Sn,e[0]=s):s=e[0];const o=s;if(!o||o===Sn){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=m.jsx("div",{className:"flex h-full w-full bg-background",children:m.jsx(Qi,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=l):l=e[1],l}let i;return e[2]!==n||e[3]!==r?(i=m.jsx(cu,{children:m.jsx(E.Suspense,{fallback:null,children:m.jsx(Gm,{providerId:o,promptId:n,onBack:r})})}),e[2]=n,e[3]=r,e[4]=i):i=e[4],i}const Ym=sp("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function Qm(t){const e=R.c(10);let n,r,s;e[0]!==t?({className:n,variant:s,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=s):(n=e[1],r=e[2],s=e[3]);let o;e[4]!==n||e[5]!==s?(o=Y(Ym({variant:s}),n),e[4]=n,e[5]=s,e[6]=o):o=e[6];let i;return e[7]!==r||e[8]!==o?(i=m.jsx("div",{"data-slot":"alert",role:"alert",className:o,...r}),e[7]=r,e[8]=o,e[9]=i):i=e[9],i}function Zm(t){const e=R.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let s;e[3]!==n?(s=Y("line-clamp-1 min-h-4 font-medium tracking-tight",n),e[3]=n,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}function eg(t){const e=R.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let s;e[3]!==n?(s=Y("text-muted-foreground leading-relaxed",n),e[3]=n,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}const tg=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function ng(t){const e=R.c(13),{toolName:n,connectionId:r,onBack:s}=t,o=`/mcp/${r}`;let i;e[0]!==o?(i=new URL(o,window.location.origin),e[0]=o,e[1]=i):i=e[1];const l=i;let a;e[2]!==r?(a={connectionId:r},e[2]=r,e[3]=a):a=e[3];const c=Rp(a);if(!c.isAuthenticated){let f;return e[4]!==c.supportsOAuth||e[5]!==s?(f=m.jsx("div",{className:"flex h-full items-center justify-center",children:c.supportsOAuth?m.jsx(jp,{onAuthenticate:()=>s(),buttonText:"Go back to authenticate"}):m.jsx(Dp,{hasReadme:!1})}),e[4]=c.supportsOAuth,e[5]=s,e[6]=f):f=e[6],f}const u=`${r}:${n}`;let d;return e[7]!==r||e[8]!==l||e[9]!==s||e[10]!==u||e[11]!==n?(d=m.jsx(rg,{toolName:n,connectionId:r,mcpProxyUrl:l,onBack:s},u),e[7]=r,e[8]=l,e[9]=s,e[10]=u,e[11]=n,e[12]=d):d=e[12],d}function rg({toolName:t,connectionId:e,mcpProxyUrl:n,onBack:r}){const o=qi().location.href,{replayId:i}=op({strict:!1}),l=(()=>{if(!i)return null;const N=`replay-${i}`,_=sessionStorage.getItem(N);if(!_)return null;sessionStorage.removeItem(N);try{return JSON.parse(_)}catch{return null}})(),a=(()=>{if(!l)return null;const N={};for(const[_,L]of Object.entries(l))L!==null&&typeof L=="object"?N[_]=JSON.stringify(L,null,2):N[_]=L;return N})(),[c,u]=E.useState(a??{}),[d,f]=E.useState(l?JSON.stringify(l,null,2):"{}"),[h,p]=E.useState(null),[g,y]=E.useState(null),[x,b]=E.useState(!1),[k,C]=E.useState(null),w=Yi(e),S=ll({url:n.href});E.useEffect(()=>{S.error&&console.error("MCP Error:",S.error)},[S.error]);const v=S.tools?.find(N=>N.name===t),M=v?.inputSchema?.properties,T=M?Object.keys(M):[],I=T.length>0,D={};if(I&&v?.inputSchema?.properties)for(const N of T)D[N]=v.inputSchema.required?.includes(N)?"":void 0;const $=N=>Object.prototype.hasOwnProperty.call(c,N),V=async()=>{b(!0),y(null),p(null),C(null);const N=performance.now(),_=Ze(e);try{const L=I?{...D,...c}:(()=>{const ee=d.trim();if(!ee)return{};const G=JSON.parse(ee);if(G&&typeof G=="object")return G;throw new Error("Raw JSON input must be an object.")})();I&&v?.inputSchema?.properties&&Object.entries(v.inputSchema.properties).forEach(([ee,G])=>{if((G.type==="object"||G.type==="array")&&typeof L[ee]=="string")try{L[ee]=JSON.parse(L[ee])}catch{}});const J=await _(t,L),Z=performance.now(),U=Math.round(Z-N);p(J);const K=JSON.stringify(J),ie=new TextEncoder().encode(K).length;C({duration:`${U}ms`,bytes:`${ie} bytes`,tokens:`~${Math.ceil(ie/4)} tokens`,cost:"$0.0000"})}catch(L){const J=L instanceof Error?L.message:String(L);y(J||"Unknown error occurred");const Z=performance.now();C({duration:`${Math.round(Z-N)}ms`})}finally{b(!1)}},F=(N,_)=>{u(L=>({...L,[N]:_}))},P=()=>{p(null),y(null),C(null)};return m.jsxs(Ks,{onBack:r,children:[m.jsx(sl,{children:m.jsx(Zi,{title:v?.name??tg(t),url:o,icon:"build"})}),m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[m.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:m.jsxs("div",{className:"flex-1 overflow-auto",children:[m.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(Us,{icon:w?.icon||null,name:w?.title||t,size:"sm",className:"shadow-sm shrink-0"}),m.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:t}),m.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[S.state==="ready"?m.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):S.state==="connecting"?m.jsx(or,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):m.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),m.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:S.state.replace("_"," ")})]})]}),m.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:v?.description||"No description available"})]})}),m.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),v?.inputSchema?.required&&v.inputSchema.required.length>0&&m.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),m.jsx("div",{className:"space-y-4",children:I&&v?.inputSchema?.properties?Object.entries(v.inputSchema.properties).map(([N,_])=>m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[N,v.inputSchema?.required?.includes(N)&&m.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),m.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:_.type})]}),_.description&&m.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:_.description}),_.type==="object"||_.type==="array"?m.jsx(ui,{className:"font-mono text-xs",value:$(N)?c[N]??"":D[N]??"",onChange:L=>F(N,L.target.value),placeholder:`Enter ${N} as JSON...`,rows:3}):m.jsx(nl,{value:$(N)?c[N]??"":D[N]??"",onChange:L=>F(N,L.target.value),placeholder:`Enter ${N}...`})]},N)):v?.inputSchema&&!I?m.jsxs("div",{className:"space-y-2",children:[m.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),m.jsx(ui,{className:"font-mono text-xs min-h-[120px]",value:d,onChange:N=>f(N.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):m.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:m.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[m.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),k&&m.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Tp,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.duration})]}),k.tokens&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(wu,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.tokens})]}),k.bytes&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Eu,{className:"h-3 w-3 text-muted-foreground"}),m.jsx("span",{className:"font-mono text-foreground",children:k.bytes})]}),k.cost&&m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx("span",{className:"font-mono text-foreground",children:k.cost})})]})]}),m.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:m.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[m.jsx(me,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:V,disabled:x,children:x?m.jsxs(m.Fragment,{children:[m.jsx(or,{size:14,className:"animate-spin"}),"Executing..."]}):m.jsxs(m.Fragment,{children:[m.jsx(ol,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),m.jsx(zt,{children:m.jsxs(Bt,{children:[m.jsx($t,{asChild:!0,children:m.jsx(me,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:P,disabled:!h&&!g,children:m.jsx(il,{size:14})})}),m.jsx(_t,{children:m.jsx("p",{children:"Clear results"})})]})})]})}),g&&m.jsx("div",{className:"px-6 py-4 bg-background",children:m.jsx(Qm,{variant:"destructive",children:m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Np,{className:"h-4 w-4"}),m.jsx(Zm,{className:"mb-0",children:"Execution Failed"})]}),m.jsx(eg,{className:"text-xs text-destructive",children:g})]})})}),m.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:h?m.jsxs(m.Fragment,{children:[m.jsx($p,{jsonString:JSON.stringify(h,null,2),padding:"1.5rem"}),m.jsx(me,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(h,null,2)),ru.success("Copied to clipboard")},children:m.jsx(Ap,{className:"h-3.5 w-3.5"})})]}):m.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[m.jsx(Mp,{className:"h-12 w-12 mb-3 opacity-40"}),m.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function sg(t){const e=R.c(7),{itemId:n,onBack:r}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},e[0]=s):s=e[0];const i=xr(s).connectionId??Sn;if(!Yi(i)){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[m.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsx(or,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let c;return e[3]!==i||e[4]!==r||e[5]!==n?(c=m.jsx(E.Suspense,{fallback:a,children:m.jsx(ng,{toolName:n,connectionId:i,onBack:r})}),e[3]=i,e[4]=r,e[5]=n,e[6]=c):c=e[6],c}const ga=t=>{let e;const n=new Set,r=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),n.forEach(h=>h(e,f))}},s=()=>e,l={setState:r,getState:s,getInitialState:()=>a,subscribe:c=>(n.add(c),()=>n.delete(c))},a=e=t(r,s,l);return l},hl=(t=>t?ga(t):ga),og=t=>t;function di(t,e=og){const n=X.useSyncExternalStore(t.subscribe,X.useCallback(()=>e(t.getState()),[t,e]),X.useCallback(()=>e(t.getInitialState()),[t,e]));return X.useDebugValue(n),n}const ig=t=>{const e=hl(t),n=r=>di(e,r);return Object.assign(n,e),n},lg=(t=>ig);function Ou(t,e){let n;try{n=t()}catch{return}return{getItem:s=>{var o;const i=a=>a===null?null:JSON.parse(a,void 0),l=(o=n.getItem(s))!=null?o:null;return l instanceof Promise?l.then(i):i(l)},setItem:(s,o)=>n.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>n.removeItem(s)}}const fi=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return fi(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return fi(r)(n)}}}},ag=(t,e)=>(n,r,s)=>{let o={storage:Ou(()=>localStorage),partialize:g=>g,version:0,merge:(g,y)=>({...y,...g}),...e},i=!1;const l=new Set,a=new Set;let c=o.storage;if(!c)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...g)},r,s);const u=()=>{const g=o.partialize({...r()});return c.setItem(o.name,{state:g,version:o.version})},d=s.setState;s.setState=(g,y)=>(d(g,y),u());const f=t((...g)=>(n(...g),u()),r,s);s.getInitialState=()=>f;let h;const p=()=>{var g,y;if(!c)return;i=!1,l.forEach(b=>{var k;return b((k=r())!=null?k:f)});const x=((y=o.onRehydrateStorage)==null?void 0:y.call(o,(g=r())!=null?g:f))||void 0;return fi(c.getItem.bind(c))(o.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==o.version){if(o.migrate){const k=o.migrate(b.state,b.version);return k instanceof Promise?k.then(C=>[!0,C]):[!0,k]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var k;const[C,w]=b;if(h=o.merge(w,(k=r())!=null?k:f),n(h,!0),C)return u()}).then(()=>{x?.(h,void 0),h=r(),i=!0,a.forEach(b=>b(h))}).catch(b=>{x?.(void 0,b)})};return s.persist={setOptions:g=>{o={...o,...g},g.storage&&(c=g.storage)},clearStorage:()=>{c?.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>p(),hasHydrated:()=>i,onHydrate:g=>(l.add(g),()=>{l.delete(g)}),onFinishHydration:g=>(a.add(g),()=>{a.delete(g)})},o.skipHydration||p(),h||f},Au=ag,{useSyncExternalStoreWithSelector:cg}=ip,ug=t=>t;function dg(t,e=ug,n){const r=cg(t.subscribe,t.getState,t.getInitialState,e,n);return X.useDebugValue(r),r}const ya=t=>Symbol.iterator in t,xa=t=>"entries"in t,ba=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),r=e instanceof Map?e:new Map(e.entries());if(n.size!==r.size)return!1;for(const[s,o]of n)if(!r.has(s)||!Object.is(o,r.get(s)))return!1;return!0},fg=(t,e)=>{const n=t[Symbol.iterator](),r=e[Symbol.iterator]();let s=n.next(),o=r.next();for(;!s.done&&!o.done;){if(!Object.is(s.value,o.value))return!1;s=n.next(),o=r.next()}return!!s.done&&!!o.done};function hg(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:ya(t)&&ya(e)?xa(t)&&xa(e)?ba(t,e):fg(t,e):ba({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function pg(t,e="Output"){if(!t)return`interface ${e} {}`;function n(o){if(!o||typeof o!="object")return"unknown";const i=o.type;if(Array.isArray(i))return i.map(l=>r(l)).join(" | ");switch(i){case"string":return o.enum?o.enum.map(l=>`"${l}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const l=o.items;return l?`${n(l)}[]`:"unknown[]"}case"object":return s(o);default:return o.anyOf?o.anyOf.map(n).join(" | "):o.oneOf?o.oneOf.map(n).join(" | "):o.allOf?o.allOf.map(n).join(" & "):"unknown"}}function r(o){switch(o){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function s(o){const i=o.properties;if(!i)return"Record<string, unknown>";const l=new Set(o.required||[]);return`{
|
|
2
2
|
${Object.entries(i).map(([c,u])=>{const d=l.has(c)?"":"?";return`${u.description?` /** ${u.description} */
|
|
3
3
|
`:""} ${c}${d}: ${n(u)};`}).join(`
|
|
4
4
|
`)}
|
|
@@ -22,7 +22,7 @@ type __ExpandRecursively<T> = T extends (...args: infer A) => infer R
|
|
|
22
22
|
: T;
|
|
23
23
|
type __InferredOutput = __ExpandRecursively<Awaited<ReturnType<typeof __default>>>;
|
|
24
24
|
declare const __outputValue: __InferredOutput;
|
|
25
|
-
`;e.setValue(s);const o=e.findMatches("__outputValue",!1,!1,!1,null,!1);if(!o||o.length===0)return e.setValue(n),null;const i=o[0];if(!i)return e.setValue(n),null;const l={lineNumber:i.range.startLineNumber,column:i.range.startColumn+1};try{const c=await(await Gs.init()).languages.typescript.getTypeScriptWorker();if(!c)return e.setValue(n),null;const u=await c(e.uri);await new Promise(h=>setTimeout(h,100));const d=e.getOffsetAt(l),f=await u.getQuickInfoAtPosition(e.uri.toString(),d);if(e.setValue(n),f){const p=f.displayParts.map(y=>y.text).join("").replace(/^const __outputValue:\s*/,"");return bn(p)}else return null}catch(a){return e.setValue(n),console.error("Error getting return type:",a),null}}function bn(t){if(t=t.trim(),t==="string")return{type:"string"};if(t==="number")return{type:"number"};if(t==="boolean")return{type:"boolean"};if(t==="null")return{type:"null"};if(t==="undefined")return{type:"null"};if(t==="unknown"||t==="any")return{};if(t==="never")return{not:{}};if(t.endsWith("[]")){const r=t.slice(0,-2);return{type:"array",items:bn(r)}}const e=t.match(/^Array<(.+)>$/);if(e&&e[1])return{type:"array",items:bn(e[1])};const n=t.match(/^Record<(.+),\s*(.+)>$/);if(n&&n[2])return{type:"object",additionalProperties:bn(n[2].trim())};if(t.includes("|")){const r=D1(t);if(r.length>1)return r.every(o=>/^["']/.test(o.trim()))?{type:"string",enum:r.map(o=>o.trim().replace(/^["']|["']$/g,""))}:{anyOf:r.map(o=>bn(o.trim()))}}return/^["'].*["']$/.test(t)?{type:"string",const:t.slice(1,-1)}:/^-?\d+(\.\d+)?$/.test(t)?{type:"number",const:parseFloat(t)}:t.startsWith("{")&&t.endsWith("}")?P1(t):{description:`TypeScript type: ${t}`}}function D1(t){const e=[];let n=0,r="";for(let s=0;s<t.length;s++){const o=t[s];if(o==="{"||o==="<"||o==="("||o==="[")n++;else if(o==="}"||o===">"||o===")"||o==="]")n--;else if(o==="|"&&n===0){e.push(r.trim()),r="";continue}r+=o}return r.trim()&&e.push(r.trim()),e}function P1(t){const e=t.slice(1,-1).trim();if(!e)return{type:"object",properties:{}};const n={},r=[];let s=0,o="";for(let l=0;l<e.length;l++){const a=e[l];if(a==="{"||a==="<"||a==="("||a==="[")s++;else if(a==="}"||a===">"||a===")"||a==="]")s--;else if(a===";"&&s===0){o.trim()&&Na(o.trim(),n,r),o="";continue}o+=a}o.trim()&&Na(o.trim(),n,r);const i={type:"object",properties:n};return r.length>0&&(i.required=r),i}function Na(t,e,n){const r=t.match(/^(\w+)(\?)?:\s*(.+)$/s);if(r){const s=r[1],o=r[2],i=r[3];s&&i&&(e[s]=bn(i.trim()),o||n.push(s))}}class L1 extends E.Component{constructor(e){super(e),this.state={hasError:!1,mountKey:0}}static getDerivedStateFromError(e){if(e.message?.includes("InstantiationService has been disposed"))return{hasError:!0};throw e}componentDidCatch(e){e.message?.includes("InstantiationService has been disposed")&&this.setState(n=>({hasError:!1,mountKey:n.mountKey+1}))}render(){return this.state.hasError?m.jsx("div",{className:"flex items-center justify-center h-full w-full bg-[#1e1e1e] text-gray-400",children:m.jsx(jn,{size:"sm"})}):E.cloneElement(this.props.children,{mountKey:this.state.mountKey})}}let Ir=null;const $1=async()=>{if(Ir)return Ir;const[t,e,n]=await Promise.all([No(()=>import("./standalone-Cva4pL7v.js"),[]),No(()=>import("./typescript-Ca_eWjgL.js"),[]),No(()=>import("./estree-CwOGYdhi.js"),[])]);return Ir={format:t.format,plugins:[e.default,n.default]},Ir};Gs.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});const _1={parser:"typescript",semi:!0,singleQuote:!1,tabWidth:2,trailingComma:"es5",printWidth:80},Ta={fontSize:13,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,foldingStrategy:"auto",tabSize:2,wordWrap:"on",folding:!0,bracketPairColorization:{enabled:!0},formatOnPaste:!0,formatOnType:!0,suggestOnTriggerCharacters:!0,quickSuggestions:{other:!0,comments:!1,strings:!0},parameterHints:{enabled:!0},inlineSuggest:{enabled:!0},autoClosingBrackets:"always",autoClosingQuotes:"always",autoSurround:"languageDefined",padding:{top:12,bottom:12},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8},theme:"light"},z1=m.jsx("div",{className:"flex items-center justify-center h-full w-full text-gray-400",children:m.jsx(jn,{size:"sm"})}),B1=E.memo(function({code:e,onChange:n,onSave:r,readOnly:s=!1,height:o=300,language:i="typescript",foldOnMount:l=!1,mountKey:a=0}){const c=E.useRef(null),u=E.useRef(null),d=E.useRef(r);d.current=r;const f=E.useRef(i);f.current=i;const h=E.useId(),p=`${h}-${a}`,g=i==="typescript"?`file:///workflow-${h.replace(/:/g,"-")}-${a}.tsx`:void 0,y=s?{...Ta,readOnly:!0}:Ta,x=async k=>{const C=k.getModel();if(!C){console.warn("No model found");return}const w=C.getValue();if(f.current==="json"){try{const v=JSON.parse(w),M=JSON.stringify(v,null,2);if(M!==w){const T=C.getFullModelRange();k.executeEdits("json-format",[{range:T,text:M}])}}catch(v){console.error("JSON formatting failed:",v)}return}try{const{format:v,plugins:M}=await $1(),T=await v(w,{..._1,plugins:M});if(T!==w){const I=C.getFullModelRange();k.executeEdits("prettier",[{range:I,text:T}])}}catch(v){console.error("Prettier formatting failed:",v)}},b=async(k,C)=>{c.current=k,l&&u.current&&(u.current.style.visibility="hidden",await k.getAction("editor.foldLevel2")?.run(),u.current.style.visibility="visible"),i==="typescript"&&(C.languages.typescript.typescriptDefaults.setCompilerOptions({target:C.languages.typescript.ScriptTarget.ESNext,module:C.languages.typescript.ModuleKind.ESNext,moduleResolution:C.languages.typescript.ModuleResolutionKind.NodeJs,allowNonTsExtensions:!0,allowJs:!0,strict:!1,noEmit:!0,esModuleInterop:!0,jsx:C.languages.typescript.JsxEmit.React,allowSyntheticDefaultImports:!0}),C.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1})),k.addCommand(C.KeyMod.CtrlCmd|C.KeyCode.KeyS,async()=>{await x(k);const w=await j1(k),S=k.getValue();console.log({value:S,returnType:w}),d.current?.(S,w)})};return m.jsx("div",{ref:u,className:"h-full",children:m.jsx(R1,{height:o,language:i,value:e,path:g,onChange:n,onMount:b,loading:z1,options:y},p)})}),Xs=E.memo(function(e){const n=R.c(2);let r;return n[0]!==e?(r=m.jsx(L1,{children:m.jsx(B1,{...e})}),n[0]=e,n[1]=r):r=n[1],r});function $n(){const t=R.c(2),e=vp();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const r=Bp(n);if(!r||r.length===0||!r[0])throw new Error("No workflow connection found");return r[0]}const Ma=[1,1e3,2e3,3e3,5e3,1e4];function vr(t){const e=R.c(15),n=$n();let r;e[0]!==n.id?(r=Ze(n.id),e[0]=n.id,e[1]=r):r=e[1];const s=r,o=E.useRef(0);let i;e[2]!==t?(i={id:t},e[2]=t,e[3]=i):i=e[3];const l=!!t;let a;e[4]!==t?(a=t?p=>{const g=p.state?.data?.item?.status;if(g==="running"||g==="enqueued"){const y=Ma[o.current]??1;return o.current=(o.current+1)%Ma.length,y}return o.current=0,!1}:!1,e[4]=t,e[5]=a):a=e[5];let c;e[6]!==n.id||e[7]!==i||e[8]!==l||e[9]!==a||e[10]!==s?(c={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolInputParams:i,scope:n.id,enabled:l,refetchInterval:a},e[6]=n.id,e[7]=i,e[8]=l,e[9]=a,e[10]=s,e[11]=c):c=e[11];const{data:u,isLoading:d}=al(c),f=u?.item;let h;return e[12]!==d||e[13]!==f?(h={item:f,isLoading:d},e[12]=d,e[13]=f,e[14]=h):h=e[14],h}function F1(t,e){const n=R.c(14),r=$n();let s;n[0]!==r.id?(s=Ze(r.id),n[0]=r.id,n[1]=s):s=n[1];const o=s;let i;n[2]!==t||n[3]!==e?(i={executionId:t,stepId:e},n[2]=t,n[3]=e,n[4]=i):i=n[4];const l=!!t&&!!e;let a;n[5]!==r.id||n[6]!==i||n[7]!==l||n[8]!==o?(a={toolCaller:o,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolInputParams:i,scope:r.id,enabled:l},n[5]=r.id,n[6]=i,n[7]=l,n[8]=o,n[9]=a):a=n[9];const{data:c,isLoading:u}=al(a),d=c?.output,f=c?.error;let h;return n[10]!==u||n[11]!==d||n[12]!==f?(h={output:d,error:f,isLoading:u},n[10]=u,n[11]=d,n[12]=f,n[13]=h):h=n[13],h}function V1(){const t=R.c(19),e=$n(),n=Pn();let r;t[0]!==e.id?(r=Ze(e.id),t[0]=e.id,t[1]=r):r=t[1];const s=r;let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=["workflow"],t[2]=o):o=t[2];let i;t[3]!==n.id?(i={field:o,operator:"eq",value:n.id},t[3]=n.id,t[4]=i):i=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=[{field:["created_at"],direction:"desc"}],t[5]=l):l=t[5];let a;t[6]!==i?(a={where:i,orderBy:l,limit:100},t[6]=i,t[7]=a):a=t[7];const c=`${e.id}-executions-${n.id}`,u=!!n.id;let d;t[8]!==a||t[9]!==c||t[10]!==u||t[11]!==s?(d={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_LIST",toolInputParams:a,scope:c,enabled:u,staleTime:5e3},t[8]=a,t[9]=c,t[10]=u,t[11]=s,t[12]=d):d=t[12];const{data:f,isLoading:h,refetch:p}=al(d),g=f;let y;t[13]!==g?.items?(y=g?.items??[],t[13]=g?.items,t[14]=y):y=t[14];let x;return t[15]!==h||t[16]!==p||t[17]!==y?(x={executions:y,isLoading:h,refetch:p},t[15]=h,t[16]=p,t[17]=y,t[18]=x):x=t[18],x}function Fu(t){const e=[];function n(r){if(typeof r=="string"){const s=r.match(/@input(?:\.(\w+(?:\.\w+)*))?/g);if(s)for(const o of s)if(o==="@input")e.push("__entire_input__");else{const i=o.replace("@input.","");e.push(i)}}else Array.isArray(r)?r.forEach(n):typeof r=="object"&&r!==null&&Object.values(r).forEach(n)}return n(t),[...new Set(e)]}function H1(t){const e=[];for(const n of t){const r=Fu(n.input);e.push(...r)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function W1(t){for(const e of t)if(Fu(e.input).includes("__entire_input__"))return!0;return!1}function q1(t){const e=H1(t);if(e.length===0)return W1(t)?{type:"object",additionalProperties:!0,description:"Workflow input data"}:null;const n={},r=[];for(const s of e){const o=s.split(".");if(o.length===1)n[s]={type:"string",description:`Input field: ${s}`},r.push(s);else{const i=o[0];i&&!n[i]&&(n[i]={type:"object",description:`Input object: ${i}`,additionalProperties:!0},r.push(i))}}return{type:"object",properties:n,required:r,description:"Workflow execution input"}}function U1(){const t=R.c(2),e=Pn();let n;return t[0]!==e.steps?(n=q1(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function K1(){const t=R.c(14),{id:e}=$n(),{setTrackingExecutionId:n}=Me();let r;t[0]!==e?(r=Ze(e),t[0]=e,t[1]=r):r=t[1];const s=r,o=Pn(),i=Ln(),l=U1();let a;t[2]!==s?(a={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_CREATE"},t[2]=s,t[3]=a):a=t[3];const{mutateAsync:c,isPending:u}=cl(a);let d;t[4]!==i||t[5]!==n||t[6]!==c||t[7]!==o?(d=async g=>{const y=g===void 0?{}:g;if(!i)throw new Error("Please select a gateway before running the workflow");const x=Date.now(),b=await c({steps:o.steps,input:y,gateway_id:i,start_at_epoch_ms:x,workflow_collection_id:o.id,timeout_ms:3e4}),k=b.id??b.structuredContent.id;return n(k),k},t[4]=i,t[5]=n,t[6]=c,t[7]=o,t[8]=d):d=t[8];const f=d,h=l!==null;let p;return t[9]!==f||t[10]!==l||t[11]!==u||t[12]!==h?(p={handleRunWorkflow:f,isPending:u,requiresInput:h,inputSchema:l},t[9]=f,t[10]=l,t[11]=u,t[12]=h,t[13]=p):p=t[13],p}function J1(){const t=R.c(9),{id:e}=$n();let n;t[0]!==e?(n=Ze(e),t[0]=e,t[1]=n):n=t[1];const r=n;let s;t[2]!==r?(s={toolCaller:r,toolName:"CANCEL_EXECUTION"},t[2]=r,t[3]=s):s=t[3];const{mutateAsync:o,isPending:i}=cl(s);let l;t[4]!==o?(l=async u=>await o({executionId:u}),t[4]=o,t[5]=l):l=t[5];const a=l;let c;return t[6]!==a||t[7]!==i?(c={handleCancelWorkflow:a,isCancelling:i},t[6]=a,t[7]=i,t[8]=c):c=t[8],c}function G1(){const t=R.c(9),{id:e}=$n();let n;t[0]!==e?(n=Ze(e),t[0]=e,t[1]=n):n=t[1];const r=n;let s;t[2]!==r?(s={toolCaller:r,toolName:"RESUME_EXECUTION"},t[2]=r,t[3]=s):s=t[3];const{mutateAsync:o,isPending:i}=cl(s);let l;t[4]!==o?(l=async u=>(await o({executionId:u})).success,t[4]=o,t[5]=l):l=t[5];const a=l;let c;return t[6]!==a||t[7]!==i?(c={handleResumeWorkflow:a,isResuming:i},t[6]=a,t[7]=i,t[8]=c):c=t[8],c}function X1(){const t=R.c(3),e=we(),{item:n}=vr(e);let r;return t[0]!==n||t[1]!==e?(r=e&&n?(()=>{const o={};return n?.input&&(o.input=n.input),o})():void 0,t[0]=n,t[1]=e,t[2]=r):r=t[2],r}function Y1(t,e,n,r){if(!e)return[...t].sort(r);const s=n(e);return[...t].sort((o,i)=>{const l=n(o),a=n(i);return l===s?-1:a===s?1:r?r(o,i):0})}const pl=lg()(Au(t=>({viewMode:"visual",setViewMode:e=>t({viewMode:e}),showExecutionsList:!1,setShowExecutionsList:e=>t({showExecutionsList:e}),toggleExecutionsList:()=>t(e=>({showExecutionsList:!e.showExecutionsList}))}),{name:"workflow-view-mode"})),Vu=E.createContext([]);function Hu(){return E.useContext(Vu)}function xe(t){this.content=t}xe.prototype={constructor:xe,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),o=r.content.slice();return s==-1?o.push(n||t,e):(o[s+1]=e,n&&(o[s]=n)),new xe(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new xe(n)},addToStart:function(t,e){return new xe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new xe(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),o=r.find(t);return s.splice(o==-1?s.length:o,0,e,n),new xe(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=xe.from(t),t.size?new xe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=xe.from(t),t.size?new xe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=xe.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};xe.from=function(t){if(t instanceof xe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new xe(e)};function Wu(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),o=e.child(r);if(s==o){n+=s.nodeSize;continue}if(!s.sameMarkup(o))return n;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)n++;return n}if(s.content.size||o.content.size){let i=Wu(s.content,o.content,n+1);if(i!=null)return i}n+=s.nodeSize}}function qu(t,e,n,r){for(let s=t.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:n,b:r};let i=t.child(--s),l=e.child(--o),a=i.nodeSize;if(i==l){n-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:n,b:r};if(i.isText&&i.text!=l.text){let c=0,u=Math.min(i.text.length,l.text.length);for(;c<u&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(i.content.size||l.content.size){let c=qu(i.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class O{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,o){for(let i=0,l=0;l<n;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,s+l,o||null,i)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let o="",i=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new O(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let o=0,i=0;i<n;o++){let l=this.content[o],a=i+l.nodeSize;a>e&&((i<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,n-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,n-i-1))),r.push(l),s+=l.nodeSize),i=a}return new O(r,s)}cutByIndex(e,n){return e==n?O.empty:e==0&&n==this.content.length?this:new O(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new O(s,o)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return Wu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return qu(this,e,n,r)}findIndex(e){if(e==0)return Rr(0,e);if(e==this.size)return Rr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),o=r+s.nodeSize;if(o>=e)return o==e?Rr(n+1,o):Rr(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return O.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let n,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(n||(n=e.slice(0,s)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new O(n||e,r)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const Po={index:0,offset:0};function Rr(t,e){return Po.index=t,Po.offset=e,Po}function Zr(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Zr(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Zr(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let te=class hi{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return hi.none;if(e instanceof hi)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};te.none=[];class es extends Error{}class j{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ku(this.content,e+this.openStart,n);return r&&new j(r,this.openStart,this.openEnd)}removeBetween(e,n){return new j(Uu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return j.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new j(O.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)s++;return new j(e,r,s)}}j.empty=new j(O.empty,0,0);function Uu(t,e,n){let{index:r,offset:s}=t.findIndex(e),o=t.maybeChild(r),{index:i,offset:l}=t.findIndex(n);if(s==e||o.isText){if(l!=n&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Uu(o.content,e-s-1,n-s-1)))}function Ku(t,e,n,r){let{index:s,offset:o}=t.findIndex(e),i=t.maybeChild(s);if(o==e||i.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Ku(i.content,e-o-1,n,i);return l&&t.replaceChild(s,i.copy(l))}function Q1(t,e,n){if(n.openStart>t.depth)throw new es("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new es("Inconsistent open depths");return Ju(t,e,n,0)}function Ju(t,e,n,r){let s=t.index(r),o=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let i=Ju(t,e,n,r+1);return o.copy(o.content.replaceChild(s,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let i=t.parent,l=i.content;return Vt(i,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=Z1(n,t);return Vt(o,Xu(t,i,l,e,r))}else return Vt(o,ts(t,e,r))}function Gu(t,e){if(!e.type.compatibleContent(t.type))throw new es("Cannot join "+e.type.name+" onto "+t.type.name)}function pi(t,e,n){let r=t.node(n);return Gu(r,e.node(n)),r}function Ft(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Gn(t,e,n,r){let s=(e||t).node(n),o=0,i=e?e.index(n):s.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Ft(t.nodeAfter,r),o++));for(let l=o;l<i;l++)Ft(s.child(l),r);e&&e.depth==n&&e.textOffset&&Ft(e.nodeBefore,r)}function Vt(t,e){return t.type.checkContent(e),t.copy(e)}function Xu(t,e,n,r,s){let o=t.depth>s&&pi(t,e,s+1),i=r.depth>s&&pi(n,r,s+1),l=[];return Gn(null,t,s,l),o&&i&&e.index(s)==n.index(s)?(Gu(o,i),Ft(Vt(o,Xu(t,e,n,r,s+1)),l)):(o&&Ft(Vt(o,ts(t,e,s+1)),l),Gn(e,n,s,l),i&&Ft(Vt(i,ts(n,r,s+1)),l)),Gn(r,null,s,l),new O(l)}function ts(t,e,n){let r=[];if(Gn(null,t,n,r),t.depth>n){let s=pi(t,e,n+1);Ft(Vt(s,ts(t,e,n+1)),r)}return Gn(e,null,n,r),new O(r)}function Z1(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)s=e.node(o).copy(O.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class lr{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return te.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let l=r;r=s,s=l}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ns(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,o=n;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(o),c=o-a;if(r.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;o=c-1,s+=a+1}return new lr(n,r,o)}static resolveCached(e,n){let r=Oa.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==n)return i}else Oa.set(e,r=new e0);let s=r.elts[r.i]=lr.resolve(e,n);return r.i=(r.i+1)%t0,s}}class e0{constructor(){this.elts=[],this.i=0}}const t0=12,Oa=new WeakMap;class ns{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const n0=Object.create(null);class ze{constructor(e,n,r,s=te.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||O.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Zr(this.attrs,n||e.defaultAttrs||n0)&&te.sameSet(this.marks,r||te.none)}copy(e=null){return e==this.content?this:new ze(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ze(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return j.empty;let s=this.resolve(e),o=this.resolve(n),i=r?0:s.sharedDepth(n),l=s.start(i),c=s.node(i).content.cut(s.pos-l,o.pos-l);return new j(c,s.depth-i,o.depth-i)}replace(e,n,r){return Q1(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return lr.resolveCached(this,e)}resolveNoCache(e){return lr.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Yu(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=O.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),l=i&&i.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=s;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,n);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=te.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!te.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=O.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}ze.prototype.text=void 0;class rs extends ze{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Yu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new rs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new rs(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Yu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ut{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new r0(e,n);if(r.next==null)return Ut.empty;let s=Qu(r);r.next&&r.err("Unexpected trailing text");let o=u0(c0(s));return d0(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let o=n;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function o(i,l){let a=i.matchFragment(e,r);if(a&&(!n||a.validEnd))return O.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=o(d,l.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:l,next:a}=o.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
|
|
25
|
+
`;e.setValue(s);const o=e.findMatches("__outputValue",!1,!1,!1,null,!1);if(!o||o.length===0)return e.setValue(n),null;const i=o[0];if(!i)return e.setValue(n),null;const l={lineNumber:i.range.startLineNumber,column:i.range.startColumn+1};try{const c=await(await Gs.init()).languages.typescript.getTypeScriptWorker();if(!c)return e.setValue(n),null;const u=await c(e.uri);await new Promise(h=>setTimeout(h,100));const d=e.getOffsetAt(l),f=await u.getQuickInfoAtPosition(e.uri.toString(),d);if(e.setValue(n),f){const p=f.displayParts.map(y=>y.text).join("").replace(/^const __outputValue:\s*/,"");return bn(p)}else return null}catch(a){return e.setValue(n),console.error("Error getting return type:",a),null}}function bn(t){if(t=t.trim(),t==="string")return{type:"string"};if(t==="number")return{type:"number"};if(t==="boolean")return{type:"boolean"};if(t==="null")return{type:"null"};if(t==="undefined")return{type:"null"};if(t==="unknown"||t==="any")return{};if(t==="never")return{not:{}};if(t.endsWith("[]")){const r=t.slice(0,-2);return{type:"array",items:bn(r)}}const e=t.match(/^Array<(.+)>$/);if(e&&e[1])return{type:"array",items:bn(e[1])};const n=t.match(/^Record<(.+),\s*(.+)>$/);if(n&&n[2])return{type:"object",additionalProperties:bn(n[2].trim())};if(t.includes("|")){const r=D1(t);if(r.length>1)return r.every(o=>/^["']/.test(o.trim()))?{type:"string",enum:r.map(o=>o.trim().replace(/^["']|["']$/g,""))}:{anyOf:r.map(o=>bn(o.trim()))}}return/^["'].*["']$/.test(t)?{type:"string",const:t.slice(1,-1)}:/^-?\d+(\.\d+)?$/.test(t)?{type:"number",const:parseFloat(t)}:t.startsWith("{")&&t.endsWith("}")?P1(t):{description:`TypeScript type: ${t}`}}function D1(t){const e=[];let n=0,r="";for(let s=0;s<t.length;s++){const o=t[s];if(o==="{"||o==="<"||o==="("||o==="[")n++;else if(o==="}"||o===">"||o===")"||o==="]")n--;else if(o==="|"&&n===0){e.push(r.trim()),r="";continue}r+=o}return r.trim()&&e.push(r.trim()),e}function P1(t){const e=t.slice(1,-1).trim();if(!e)return{type:"object",properties:{}};const n={},r=[];let s=0,o="";for(let l=0;l<e.length;l++){const a=e[l];if(a==="{"||a==="<"||a==="("||a==="[")s++;else if(a==="}"||a===">"||a===")"||a==="]")s--;else if(a===";"&&s===0){o.trim()&&Na(o.trim(),n,r),o="";continue}o+=a}o.trim()&&Na(o.trim(),n,r);const i={type:"object",properties:n};return r.length>0&&(i.required=r),i}function Na(t,e,n){const r=t.match(/^(\w+)(\?)?:\s*(.+)$/s);if(r){const s=r[1],o=r[2],i=r[3];s&&i&&(e[s]=bn(i.trim()),o||n.push(s))}}class L1 extends E.Component{constructor(e){super(e),this.state={hasError:!1,mountKey:0}}static getDerivedStateFromError(e){if(e.message?.includes("InstantiationService has been disposed"))return{hasError:!0};throw e}componentDidCatch(e){e.message?.includes("InstantiationService has been disposed")&&this.setState(n=>({hasError:!1,mountKey:n.mountKey+1}))}render(){return this.state.hasError?m.jsx("div",{className:"flex items-center justify-center h-full w-full bg-[#1e1e1e] text-gray-400",children:m.jsx(jn,{size:"sm"})}):E.cloneElement(this.props.children,{mountKey:this.state.mountKey})}}let Ir=null;const $1=async()=>{if(Ir)return Ir;const[t,e,n]=await Promise.all([No(()=>import("./standalone-Cva4pL7v.js"),[]),No(()=>import("./typescript-Ca_eWjgL.js"),[]),No(()=>import("./estree-CwOGYdhi.js"),[])]);return Ir={format:t.format,plugins:[e.default,n.default]},Ir};Gs.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});const _1={parser:"typescript",semi:!0,singleQuote:!1,tabWidth:2,trailingComma:"es5",printWidth:80},Ta={fontSize:13,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,foldingStrategy:"auto",tabSize:2,wordWrap:"on",folding:!0,bracketPairColorization:{enabled:!0},formatOnPaste:!0,formatOnType:!0,suggestOnTriggerCharacters:!0,quickSuggestions:{other:!0,comments:!1,strings:!0},parameterHints:{enabled:!0},inlineSuggest:{enabled:!0},autoClosingBrackets:"always",autoClosingQuotes:"always",autoSurround:"languageDefined",padding:{top:12,bottom:12},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8},theme:"light"},z1=m.jsx("div",{className:"flex items-center justify-center h-full w-full text-gray-400",children:m.jsx(jn,{size:"sm"})}),B1=E.memo(function({code:e,onChange:n,onSave:r,readOnly:s=!1,height:o=300,language:i="typescript",foldOnMount:l=!1,mountKey:a=0}){const c=E.useRef(null),u=E.useRef(null),d=E.useRef(r);d.current=r;const f=E.useRef(i);f.current=i;const h=E.useId(),p=`${h}-${a}`,g=i==="typescript"?`file:///workflow-${h.replace(/:/g,"-")}-${a}.tsx`:void 0,y=s?{...Ta,readOnly:!0}:Ta,x=async k=>{const C=k.getModel();if(!C){console.warn("No model found");return}const w=C.getValue();if(f.current==="json"){try{const v=JSON.parse(w),M=JSON.stringify(v,null,2);if(M!==w){const T=C.getFullModelRange();k.executeEdits("json-format",[{range:T,text:M}])}}catch(v){console.error("JSON formatting failed:",v)}return}try{const{format:v,plugins:M}=await $1(),T=await v(w,{..._1,plugins:M});if(T!==w){const I=C.getFullModelRange();k.executeEdits("prettier",[{range:I,text:T}])}}catch(v){console.error("Prettier formatting failed:",v)}},b=async(k,C)=>{c.current=k,l&&u.current&&(u.current.style.visibility="hidden",await k.getAction("editor.foldLevel2")?.run(),u.current.style.visibility="visible"),i==="typescript"&&(C.languages.typescript.typescriptDefaults.setCompilerOptions({target:C.languages.typescript.ScriptTarget.ESNext,module:C.languages.typescript.ModuleKind.ESNext,moduleResolution:C.languages.typescript.ModuleResolutionKind.NodeJs,allowNonTsExtensions:!0,allowJs:!0,strict:!1,noEmit:!0,esModuleInterop:!0,jsx:C.languages.typescript.JsxEmit.React,allowSyntheticDefaultImports:!0}),C.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1})),k.addCommand(C.KeyMod.CtrlCmd|C.KeyCode.KeyS,async()=>{await x(k);const w=await j1(k),S=k.getValue();console.log({value:S,returnType:w}),d.current?.(S,w)})};return m.jsx("div",{ref:u,className:"h-full",children:m.jsx(R1,{height:o,language:i,value:e,path:g,onChange:n,onMount:b,loading:z1,options:y},p)})}),Xs=E.memo(function(e){const n=R.c(2);let r;return n[0]!==e?(r=m.jsx(L1,{children:m.jsx(B1,{...e})}),n[0]=e,n[1]=r):r=n[1],r});function $n(){const t=R.c(2),e=vp();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const r=Bp(n);if(!r||r.length===0||!r[0])throw new Error("No workflow connection found");return r[0]}const Ma=[1,1e3,2e3,3e3,5e3,1e4];function vr(t){const e=R.c(15),n=$n();let r;e[0]!==n.id?(r=Ze(n.id),e[0]=n.id,e[1]=r):r=e[1];const s=r,o=E.useRef(0);let i;e[2]!==t?(i={id:t},e[2]=t,e[3]=i):i=e[3];const l=!!t;let a;e[4]!==t?(a=t?p=>{const g=p.state?.data?.item?.status;if(g==="running"||g==="enqueued"){const y=Ma[o.current]??1;return o.current=(o.current+1)%Ma.length,y}return o.current=0,!1}:!1,e[4]=t,e[5]=a):a=e[5];let c;e[6]!==n.id||e[7]!==i||e[8]!==l||e[9]!==a||e[10]!==s?(c={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolInputParams:i,scope:n.id,enabled:l,refetchInterval:a},e[6]=n.id,e[7]=i,e[8]=l,e[9]=a,e[10]=s,e[11]=c):c=e[11];const{data:u,isLoading:d}=al(c),f=u?.item;let h;return e[12]!==d||e[13]!==f?(h={item:f,isLoading:d},e[12]=d,e[13]=f,e[14]=h):h=e[14],h}function F1(t,e){const n=R.c(14),r=$n();let s;n[0]!==r.id?(s=Ze(r.id),n[0]=r.id,n[1]=s):s=n[1];const o=s;let i;n[2]!==t||n[3]!==e?(i={executionId:t,stepId:e},n[2]=t,n[3]=e,n[4]=i):i=n[4];const l=!!t&&!!e;let a;n[5]!==r.id||n[6]!==i||n[7]!==l||n[8]!==o?(a={toolCaller:o,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolInputParams:i,scope:r.id,enabled:l},n[5]=r.id,n[6]=i,n[7]=l,n[8]=o,n[9]=a):a=n[9];const{data:c,isLoading:u}=al(a),d=c?.output,f=c?.error;let h;return n[10]!==u||n[11]!==d||n[12]!==f?(h={output:d,error:f,isLoading:u},n[10]=u,n[11]=d,n[12]=f,n[13]=h):h=n[13],h}function V1(){const t=R.c(19),e=$n(),n=Pn();let r;t[0]!==e.id?(r=Ze(e.id),t[0]=e.id,t[1]=r):r=t[1];const s=r;let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=["workflow"],t[2]=o):o=t[2];let i;t[3]!==n.id?(i={field:o,operator:"eq",value:n.id},t[3]=n.id,t[4]=i):i=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=[{field:["created_at"],direction:"desc"}],t[5]=l):l=t[5];let a;t[6]!==i?(a={where:i,orderBy:l,limit:100},t[6]=i,t[7]=a):a=t[7];const c=`${e.id}-executions-${n.id}`,u=!!n.id;let d;t[8]!==a||t[9]!==c||t[10]!==u||t[11]!==s?(d={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_LIST",toolInputParams:a,scope:c,enabled:u,staleTime:5e3},t[8]=a,t[9]=c,t[10]=u,t[11]=s,t[12]=d):d=t[12];const{data:f,isLoading:h,refetch:p}=al(d),g=f;let y;t[13]!==g?.items?(y=g?.items??[],t[13]=g?.items,t[14]=y):y=t[14];let x;return t[15]!==h||t[16]!==p||t[17]!==y?(x={executions:y,isLoading:h,refetch:p},t[15]=h,t[16]=p,t[17]=y,t[18]=x):x=t[18],x}function Fu(t){const e=[];function n(r){if(typeof r=="string"){const s=r.match(/@input(?:\.(\w+(?:\.\w+)*))?/g);if(s)for(const o of s)if(o==="@input")e.push("__entire_input__");else{const i=o.replace("@input.","");e.push(i)}}else Array.isArray(r)?r.forEach(n):typeof r=="object"&&r!==null&&Object.values(r).forEach(n)}return n(t),[...new Set(e)]}function H1(t){const e=[];for(const n of t){const r=Fu(n.input);e.push(...r)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function W1(t){for(const e of t)if(Fu(e.input).includes("__entire_input__"))return!0;return!1}function q1(t){const e=H1(t);if(e.length===0)return W1(t)?{type:"object",additionalProperties:!0,description:"Workflow input data"}:null;const n={},r=[];for(const s of e){const o=s.split(".");if(o.length===1)n[s]={type:"string",description:`Input field: ${s}`},r.push(s);else{const i=o[0];i&&!n[i]&&(n[i]={type:"object",description:`Input object: ${i}`,additionalProperties:!0},r.push(i))}}return{type:"object",properties:n,required:r,description:"Workflow execution input"}}function U1(){const t=R.c(2),e=Pn();let n;return t[0]!==e.steps?(n=q1(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function K1(){const t=R.c(14),{id:e}=$n(),{setTrackingExecutionId:n}=Me();let r;t[0]!==e?(r=Ze(e),t[0]=e,t[1]=r):r=t[1];const s=r,o=Pn(),i=Ln(),l=U1();let a;t[2]!==s?(a={toolCaller:s,toolName:"COLLECTION_WORKFLOW_EXECUTION_CREATE"},t[2]=s,t[3]=a):a=t[3];const{mutateAsync:c,isPending:u}=cl(a);let d;t[4]!==i||t[5]!==n||t[6]!==c||t[7]!==o?(d=async g=>{const y=g===void 0?{}:g;if(!i)throw new Error("Please select a Hub before running the workflow");const x=Date.now(),b=await c({steps:o.steps,input:y,gateway_id:i,start_at_epoch_ms:x,workflow_collection_id:o.id,timeout_ms:3e4}),k=b.id??b.structuredContent.id;return n(k),k},t[4]=i,t[5]=n,t[6]=c,t[7]=o,t[8]=d):d=t[8];const f=d,h=l!==null;let p;return t[9]!==f||t[10]!==l||t[11]!==u||t[12]!==h?(p={handleRunWorkflow:f,isPending:u,requiresInput:h,inputSchema:l},t[9]=f,t[10]=l,t[11]=u,t[12]=h,t[13]=p):p=t[13],p}function J1(){const t=R.c(9),{id:e}=$n();let n;t[0]!==e?(n=Ze(e),t[0]=e,t[1]=n):n=t[1];const r=n;let s;t[2]!==r?(s={toolCaller:r,toolName:"CANCEL_EXECUTION"},t[2]=r,t[3]=s):s=t[3];const{mutateAsync:o,isPending:i}=cl(s);let l;t[4]!==o?(l=async u=>await o({executionId:u}),t[4]=o,t[5]=l):l=t[5];const a=l;let c;return t[6]!==a||t[7]!==i?(c={handleCancelWorkflow:a,isCancelling:i},t[6]=a,t[7]=i,t[8]=c):c=t[8],c}function G1(){const t=R.c(9),{id:e}=$n();let n;t[0]!==e?(n=Ze(e),t[0]=e,t[1]=n):n=t[1];const r=n;let s;t[2]!==r?(s={toolCaller:r,toolName:"RESUME_EXECUTION"},t[2]=r,t[3]=s):s=t[3];const{mutateAsync:o,isPending:i}=cl(s);let l;t[4]!==o?(l=async u=>(await o({executionId:u})).success,t[4]=o,t[5]=l):l=t[5];const a=l;let c;return t[6]!==a||t[7]!==i?(c={handleResumeWorkflow:a,isResuming:i},t[6]=a,t[7]=i,t[8]=c):c=t[8],c}function X1(){const t=R.c(3),e=we(),{item:n}=vr(e);let r;return t[0]!==n||t[1]!==e?(r=e&&n?(()=>{const o={};return n?.input&&(o.input=n.input),o})():void 0,t[0]=n,t[1]=e,t[2]=r):r=t[2],r}function Y1(t,e,n,r){if(!e)return[...t].sort(r);const s=n(e);return[...t].sort((o,i)=>{const l=n(o),a=n(i);return l===s?-1:a===s?1:r?r(o,i):0})}const pl=lg()(Au(t=>({viewMode:"visual",setViewMode:e=>t({viewMode:e}),showExecutionsList:!1,setShowExecutionsList:e=>t({showExecutionsList:e}),toggleExecutionsList:()=>t(e=>({showExecutionsList:!e.showExecutionsList}))}),{name:"workflow-view-mode"})),Vu=E.createContext([]);function Hu(){return E.useContext(Vu)}function xe(t){this.content=t}xe.prototype={constructor:xe,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),o=r.content.slice();return s==-1?o.push(n||t,e):(o[s+1]=e,n&&(o[s]=n)),new xe(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new xe(n)},addToStart:function(t,e){return new xe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new xe(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),o=r.find(t);return s.splice(o==-1?s.length:o,0,e,n),new xe(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=xe.from(t),t.size?new xe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=xe.from(t),t.size?new xe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=xe.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};xe.from=function(t){if(t instanceof xe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new xe(e)};function Wu(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),o=e.child(r);if(s==o){n+=s.nodeSize;continue}if(!s.sameMarkup(o))return n;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)n++;return n}if(s.content.size||o.content.size){let i=Wu(s.content,o.content,n+1);if(i!=null)return i}n+=s.nodeSize}}function qu(t,e,n,r){for(let s=t.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:n,b:r};let i=t.child(--s),l=e.child(--o),a=i.nodeSize;if(i==l){n-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:n,b:r};if(i.isText&&i.text!=l.text){let c=0,u=Math.min(i.text.length,l.text.length);for(;c<u&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(i.content.size||l.content.size){let c=qu(i.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class O{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,o){for(let i=0,l=0;l<n;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,s+l,o||null,i)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let o="",i=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new O(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let o=0,i=0;i<n;o++){let l=this.content[o],a=i+l.nodeSize;a>e&&((i<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,n-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,n-i-1))),r.push(l),s+=l.nodeSize),i=a}return new O(r,s)}cutByIndex(e,n){return e==n?O.empty:e==0&&n==this.content.length?this:new O(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new O(s,o)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return Wu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return qu(this,e,n,r)}findIndex(e){if(e==0)return Rr(0,e);if(e==this.size)return Rr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),o=r+s.nodeSize;if(o>=e)return o==e?Rr(n+1,o):Rr(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return O.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let n,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(n||(n=e.slice(0,s)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new O(n||e,r)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const Po={index:0,offset:0};function Rr(t,e){return Po.index=t,Po.offset=e,Po}function Zr(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Zr(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Zr(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let te=class hi{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return hi.none;if(e instanceof hi)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};te.none=[];class es extends Error{}class j{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ku(this.content,e+this.openStart,n);return r&&new j(r,this.openStart,this.openEnd)}removeBetween(e,n){return new j(Uu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return j.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new j(O.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)s++;return new j(e,r,s)}}j.empty=new j(O.empty,0,0);function Uu(t,e,n){let{index:r,offset:s}=t.findIndex(e),o=t.maybeChild(r),{index:i,offset:l}=t.findIndex(n);if(s==e||o.isText){if(l!=n&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Uu(o.content,e-s-1,n-s-1)))}function Ku(t,e,n,r){let{index:s,offset:o}=t.findIndex(e),i=t.maybeChild(s);if(o==e||i.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Ku(i.content,e-o-1,n,i);return l&&t.replaceChild(s,i.copy(l))}function Q1(t,e,n){if(n.openStart>t.depth)throw new es("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new es("Inconsistent open depths");return Ju(t,e,n,0)}function Ju(t,e,n,r){let s=t.index(r),o=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let i=Ju(t,e,n,r+1);return o.copy(o.content.replaceChild(s,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let i=t.parent,l=i.content;return Vt(i,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=Z1(n,t);return Vt(o,Xu(t,i,l,e,r))}else return Vt(o,ts(t,e,r))}function Gu(t,e){if(!e.type.compatibleContent(t.type))throw new es("Cannot join "+e.type.name+" onto "+t.type.name)}function pi(t,e,n){let r=t.node(n);return Gu(r,e.node(n)),r}function Ft(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Gn(t,e,n,r){let s=(e||t).node(n),o=0,i=e?e.index(n):s.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Ft(t.nodeAfter,r),o++));for(let l=o;l<i;l++)Ft(s.child(l),r);e&&e.depth==n&&e.textOffset&&Ft(e.nodeBefore,r)}function Vt(t,e){return t.type.checkContent(e),t.copy(e)}function Xu(t,e,n,r,s){let o=t.depth>s&&pi(t,e,s+1),i=r.depth>s&&pi(n,r,s+1),l=[];return Gn(null,t,s,l),o&&i&&e.index(s)==n.index(s)?(Gu(o,i),Ft(Vt(o,Xu(t,e,n,r,s+1)),l)):(o&&Ft(Vt(o,ts(t,e,s+1)),l),Gn(e,n,s,l),i&&Ft(Vt(i,ts(n,r,s+1)),l)),Gn(r,null,s,l),new O(l)}function ts(t,e,n){let r=[];if(Gn(null,t,n,r),t.depth>n){let s=pi(t,e,n+1);Ft(Vt(s,ts(t,e,n+1)),r)}return Gn(e,null,n,r),new O(r)}function Z1(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)s=e.node(o).copy(O.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class lr{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return te.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let l=r;r=s,s=l}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ns(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,o=n;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(o),c=o-a;if(r.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;o=c-1,s+=a+1}return new lr(n,r,o)}static resolveCached(e,n){let r=Oa.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==n)return i}else Oa.set(e,r=new e0);let s=r.elts[r.i]=lr.resolve(e,n);return r.i=(r.i+1)%t0,s}}class e0{constructor(){this.elts=[],this.i=0}}const t0=12,Oa=new WeakMap;class ns{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const n0=Object.create(null);class ze{constructor(e,n,r,s=te.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||O.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Zr(this.attrs,n||e.defaultAttrs||n0)&&te.sameSet(this.marks,r||te.none)}copy(e=null){return e==this.content?this:new ze(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ze(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return j.empty;let s=this.resolve(e),o=this.resolve(n),i=r?0:s.sharedDepth(n),l=s.start(i),c=s.node(i).content.cut(s.pos-l,o.pos-l);return new j(c,s.depth-i,o.depth-i)}replace(e,n,r){return Q1(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return lr.resolveCached(this,e)}resolveNoCache(e){return lr.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Yu(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=O.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),l=i&&i.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=s;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,n);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=te.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!te.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=O.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}ze.prototype.text=void 0;class rs extends ze{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Yu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new rs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new rs(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Yu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ut{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new r0(e,n);if(r.next==null)return Ut.empty;let s=Qu(r);r.next&&r.err("Unexpected trailing text");let o=u0(c0(s));return d0(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let o=n;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function o(i,l){let a=i.matchFragment(e,r);if(a&&(!n||a.validEnd))return O.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=o(d,l.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:l,next:a}=o.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
|
|
26
26
|
`)}}Ut.empty=new Ut(!0);class r0{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Qu(t){let e=[];do e.push(s0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function s0(t){let e=[];do e.push(o0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function o0(t){let e=a0(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=i0(t,e);else break;return e}function Aa(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function i0(t,e){let n=Aa(t),r=n;return t.eat(",")&&(t.next!="}"?r=Aa(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function l0(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let o in n){let i=n[o];i.isInGroup(e)&&s.push(i)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function a0(t){if(t.eat("(")){let e=Qu(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=l0(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function c0(t){let e=[[]];return s(o(t,0),n()),e;function n(){return e.push([])-1}function r(i,l,a){let c={term:a,to:l};return e[i].push(c),c}function s(i,l){i.forEach(a=>a.to=l)}function o(i,l){if(i.type=="choice")return i.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(i.type=="seq")for(let a=0;;a++){let c=o(i.exprs[a],l);if(a==i.exprs.length-1)return c;s(c,l=n())}else if(i.type=="star"){let a=n();return r(l,a),s(o(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=n();return s(o(i.expr,l),a),s(o(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(o(i.expr,l));if(i.type=="range"){let a=l;for(let c=0;c<i.min;c++){let u=n();s(o(i.expr,a),u),a=u}if(i.max==-1)s(o(i.expr,a),a);else for(let c=i.min;c<i.max;c++){let u=n();r(a,u),s(o(i.expr,a),u),a=u}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function Zu(t,e){return e-t}function Ia(t,e){let n=[];return r(e),n.sort(Zu);function r(s){let o=t[s];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(s);for(let i=0;i<o.length;i++){let{term:l,to:a}=o[i];!l&&n.indexOf(a)==-1&&r(a)}}}function u0(t){let e=Object.create(null);return n(Ia(t,0));function n(r){let s=[];r.forEach(i=>{t[i].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);Ia(t,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new Ut(r.indexOf(t.length-1)>-1);for(let i=0;i<s.length;i++){let l=s[i][1].sort(Zu);o.next.push({type:s[i][0],next:e[l.join(",")]||n(l)})}return o}}function d0(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],o=!s.validEnd,i=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];i.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ed(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function td(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let o=t[r];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function nd(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let o=t[s];o.validate&&o.validate(e[s])}}function rd(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new h0(t,r,e[r]);return n}let Ra=class sd{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=rd(e,r.attrs),this.defaultAttrs=ed(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ut.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:td(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ze(this,this.computeAttrs(e),O.from(n),te.setFrom(r))}createChecked(e=null,n,r){return n=O.from(n),this.checkContent(n),new ze(this,this.computeAttrs(e),n,te.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=O.from(n),n.size){let i=this.contentMatch.fillBefore(n);if(!i)return null;n=i.append(n)}let s=this.contentMatch.matchFragment(n),o=s&&s.fillBefore(O.empty,!0);return o?new ze(this,e,n.append(o),te.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){nd(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:te.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,i)=>r[o]=new sd(o,n,i));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function f0(t,e,n){let r=n.split("|");return s=>{let o=s===null?"null":typeof s;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class h0{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?f0(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ys{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=rd(e,s.attrs),this.excluded=null;let o=ed(this.attrs);this.instance=o?new te(this,o):null}create(e=null){return!e&&this.instance?this.instance:new te(this,td(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((o,i)=>r[o]=new Ys(o,s++,n,i)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){nd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class od{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=xe.from(e.nodes),n.marks=xe.from(e.marks||{}),this.nodes=Ra.compile(this.spec.nodes,this),this.marks=Ys.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],i=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[i]||(r[i]=Ut.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?ja(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],i=o.spec.excludes;o.excluded=i==null?[o]:i==""?[]:ja(this,i.split(" "))}this.nodeFromJSON=s=>ze.fromJSON(this,s),this.markFromJSON=s=>te.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ra){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new rs(r,r.defaultAttrs,e,te.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function ja(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],o=t.marks[s],i=o;if(o)n.push(o);else for(let l in t.marks){let a=t.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&n.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function p0(t){return t.tag!=null}function m0(t){return t.style!=null}class vt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(p0(s))this.tags.push(s);else if(m0(s)){let o=/[^=]*/.exec(s.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=e.nodes[s.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new Pa(this,n,!1);return r.addAll(e,te.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Pa(this,n,!0);return r.addAll(e,te.none,n.from,n.to),j.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(x0(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let i=o.getAttrs(e);if(i===!1)continue;o.attrs=i||void 0}return o}}}matchStyle(e,n,r,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let i=this.styles[o],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(i.getAttrs){let a=i.getAttrs(n);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let n=[];function r(s){let o=s.priority==null?50:s.priority,i=0;for(;i<n.length;i++){let l=n[i];if((l.priority==null?50:l.priority)<o)break}n.splice(i,0,s)}for(let s in e.marks){let o=e.marks[s].spec.parseDOM;o&&o.forEach(i=>{r(i=La(i)),i.mark||i.ignore||i.clearMark||(i.mark=s)})}for(let s in e.nodes){let o=e.nodes[s].spec.parseDOM;o&&o.forEach(i=>{r(i=La(i)),i.node||i.ignore||i.mark||(i.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new vt(e,vt.schemaRules(e)))}}const id={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},g0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ld={ol:!0,ul:!0},ar=1,mi=2,Xn=4;function Da(t,e,n){return e!=null?(e?ar:0)|(e==="full"?mi:0):t&&t.whitespace=="pre"?ar|mi:n&~Xn}class jr{constructor(e,n,r,s,o,i){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=i,this.content=[],this.activeMarks=te.none,this.match=o||(i&Xn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(O.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ar)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let n=O.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(O.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!id.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Pa{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,o,i=Da(null,n.preserveWhitespace,0)|(r?Xn:0);s?o=new jr(s.type,s.attrs,te.none,!0,n.topMatch||s.type.contentMatch,i):r?o=new jr(null,null,te.none,!0,null,i):o=new jr(e.schema.topNodeType,null,te.none,!0,null,i),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,o=s.options&mi?"full":this.localPreserveWS||(s.options&ar)>0,{schema:i}=this.parser;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
|
|
27
27
|
`);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(i.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(i.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),l;ld.hasOwnProperty(i)&&this.parser.normalizeLists&&y0(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:g0.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(id.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
28
28
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],i=r.getPropertyValue(o);if(i)for(let l=void 0;;){let a=this.parser.matchStyle(o,i,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,s){let o,i;if(n.node)if(i=this.parser.schema.nodes[n.node],i.isLeaf)this.insertNode(i.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(i,n.attrs||null,r,n.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}o&&this.sync(l)&&this.open--}addAll(e,n,r,s){let o=r||0;for(let i=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];i!=l;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,n);this.findAtPoint(e,o)}findPlace(e,n,r){let s,o;for(let i=this.open,l=0;i>=0;i--){let a=this.nodes[i],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,o=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)n=this.enterInner(s[i],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=te.none;for(let l of s.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):$a(l.type,e.type))&&(i=l.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,n,r,s){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,s)),o}enterInner(e,n,r,s=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let l=Da(e,o,i.options);i.options&Xn&&i.content.length==0&&(l|=Xn);let a=te.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):$a(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new jr(e,n,a,s,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ar)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(s?0:1),i=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=o;a--)if(i(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return i(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function y0(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ld.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function x0(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function La(t){let e={};for(let n in t)e[n]=t[n];return e}function $a(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let o=[],i=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||o.indexOf(u)<0&&i(u))return!0}};if(i(s.contentMatch))return!0}}class Qt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Lo(n).createDocumentFragment());let s=r,o=[];return e.forEach(i=>{if(o.length||i.marks.length){let l=0,a=0;for(;l<o.length&&a<i.marks.length;){let c=i.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)s=o.pop()[1];for(;a<i.marks.length;){let c=i.marks[a++],u=this.serializeMark(c,i.isInline,n);u&&(o.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(i,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:s}=qr(Lo(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let o=this.serializeMark(e.marks[s],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&qr(Lo(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return qr(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Qt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=_a(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return _a(e.marks)}}function _a(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Lo(t){return t.document||window.document}const za=new WeakMap;function b0(t){let e=za.get(t);return e===void 0&&za.set(t,e=k0(t)),e}function k0(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function qr(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=b0(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let i=s.indexOf(" ");i>0&&(n=s.slice(0,i),s=s.slice(i+1));let l,a=n?t.createElementNS(n,s):t.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=qr(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const ad=65535,cd=Math.pow(2,16);function w0(t,e){return t+e*cd}function Ba(t){return t&ad}function v0(t){return(t-(t&ad))/cd}const ud=1,dd=2,Ur=4,fd=8;class gi{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&fd)>0}get deletedBefore(){return(this.delInfo&(ud|Ur))>0}get deletedAfter(){return(this.delInfo&(dd|Ur))>0}get deletedAcross(){return(this.delInfo&Ur)>0}}class je{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&je.empty)return je.empty}recover(e){let n=0,r=Ba(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+v0(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+o],u=this.ranges[l+i],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+s+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:w0(l/3,e-a),g=e==a?dd:e==d?ud:Ur;return(n<0?e!=a:e!=d)&&(g|=fd),new gi(h,g,p)}s+=u-c}return r?e+s:new gi(e+s,0,null)}touches(e,n){let r=0,s=Ba(n),o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+i]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let i=this.ranges[s],l=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[s+n],u=this.ranges[s+r];e(l,l+c,a,a+u),o+=u-c}}invert(){return new je(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?je.empty:new je(e<0?[0,-e,0]:[0,0,e])}}je.empty=new je([]);class cr{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new cr(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new cr;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let o=this.from;o<this.to;o++){let i=this._maps[o],l=i.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new gi(e,s,null)}}const $o=Object.create(null);class Ee{getMap(){return je.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=$o[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in $o)throw new RangeError("Duplicate use of step JSON ID "+e);return $o[e]=n,n.prototype.jsonID=e,n}}class de{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new de(e,null)}static fail(e){return new de(null,e)}static fromReplace(e,n,r,s){try{return de.ok(e.replace(n,r,s))}catch(o){if(o instanceof es)return de.fail(o.message);throw o}}}function ml(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let o=t.child(s);o.content.size&&(o=o.copy(ml(o.content,e,o))),o.isInline&&(o=e(o,n,s)),r.push(o)}return O.fromArray(r)}class xt extends Ee{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),o=new j(ml(n.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),s),n.openStart,n.openEnd);return de.fromReplace(e,this.from,this.to,o)}invert(){return new qe(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new xt(n.pos,r.pos,this.mark)}merge(e){return e instanceof xt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new xt(n.from,n.to,e.markFromJSON(n.mark))}}Ee.jsonID("addMark",xt);class qe extends Ee{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new j(ml(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return de.fromReplace(e,this.from,this.to,r)}invert(){return new xt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new qe(n.pos,r.pos,this.mark)}merge(e){return e instanceof qe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qe(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qe(n.from,n.to,e.markFromJSON(n.mark))}}Ee.jsonID("removeMark",qe);class bt extends Ee{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return de.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return de.fromReplace(e,this.pos,this.pos+1,new j(O.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new bt(this.pos,n.marks[s]);return new bt(this.pos,this.mark)}}return new Kt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new bt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new bt(n.pos,e.markFromJSON(n.mark))}}Ee.jsonID("addNodeMark",bt);class Kt extends Ee{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return de.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return de.fromReplace(e,this.pos,this.pos+1,new j(O.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new bt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Kt(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Kt(n.pos,e.markFromJSON(n.mark))}}Ee.jsonID("removeNodeMark",Kt);class he extends Ee{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&yi(e,this.from,this.to)?de.fail("Structure replace would overwrite content"):de.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new je([this.from,this.to-this.from,this.slice.size])}invert(e){return new he(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new he(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof he)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?j.empty:new j(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new he(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?j.empty:new j(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new he(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new he(n.from,n.to,j.fromJSON(e,n.slice),!!n.structure)}}Ee.jsonID("replace",he);class ge extends Ee{constructor(e,n,r,s,o,i,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=o,this.insert=i,this.structure=l}apply(e){if(this.structure&&(yi(e,this.from,this.gapFrom)||yi(e,this.gapTo,this.to)))return de.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return de.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?de.fromReplace(e,this.from,this.to,r):de.fail("Content does not fit in gap")}getMap(){return new je([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new ge(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||o>r.pos?null:new ge(n.pos,r.pos,s,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ge(n.from,n.to,n.gapFrom,n.gapTo,j.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ee.jsonID("replaceAround",ge);function yi(t,e,n){let r=t.resolve(e),s=n-e,o=r.depth;for(;s>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,s--;if(s>0){let i=r.node(o).maybeChild(r.indexAfter(o));for(;s>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,s--}}return!1}function S0(t,e,n,r){let s=[],o=[],i,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(i&&i.to==f&&i.mark.eq(d[g])?i.to=h:s.push(i=new qe(f,h,d[g])));l&&l.to==f?l.to=h:o.push(l=new xt(f,h,r))}}),s.forEach(a=>t.step(a)),o.forEach(a=>t.step(a))}function C0(t,e,n,r){let s=[],o=0;t.doc.nodesBetween(e,n,(i,l)=>{if(!i.isInline)return;o++;let a=null;if(r instanceof Ys){let c=i.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let c=Math.min(l+i.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let p=s[h];p.step==o-1&&d.eq(s[h].style)&&(f=p)}f?(f.to=c,f.step=o):s.push({style:d,from:Math.max(l,e),to:c,step:o})}}}),s.forEach(i=>t.step(new qe(i.from,i.to,i.style)))}function gl(t,e,n,r=n.contentMatch,s=!0){let o=t.doc.nodeAt(e),i=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)i.push(new he(l,u,j.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new qe(l,u,c.marks[f]));if(s&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new j(O.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new he(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(O.empty,!0);t.replace(l,l,new j(a,0,0))}for(let a=i.length-1;a>=0;a--)t.step(i[a])}function E0(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function _n(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,o=0;;--r){let i=t.$from.node(r),l=t.$from.index(r)+s,a=t.$to.indexAfter(r)-o;if(r<t.depth&&i.canReplace(l,a,n))return r;if(r==0||i.type.spec.isolating||!E0(i,l,a))break;l&&(s=1),a<i.childCount&&(o=1)}return null}function N0(t,e,n){let{$from:r,$to:s,depth:o}=e,i=r.before(o+1),l=s.after(o+1),a=i,c=l,u=O.empty,d=0;for(let p=o,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=O.from(r.node(p).copy(u)),d++):a--;let f=O.empty,h=0;for(let p=o,g=!1;p>n;p--)g||s.after(p+1)<s.end(p)?(g=!0,f=O.from(s.node(p).copy(f)),h++):c++;t.step(new ge(a,c,i,l,new j(u.append(f),d,h),u.size-d,!0))}function yl(t,e,n=null,r=t){let s=T0(t,e),o=s&&M0(r,e);return o?s.map(Fa).concat({type:e,attrs:n}).concat(o.map(Fa)):null}function Fa(t){return{type:t,attrs:null}}function T0(t,e){let{parent:n,startIndex:r,endIndex:s}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let i=o.length?o[0]:e;return n.canReplaceWith(r,s,i)?o:null}function M0(t,e){let{parent:n,startIndex:r,endIndex:s}=t,o=n.child(r),i=e.contentMatch.findWrapping(o.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:i}function O0(t,e,n){let r=O.empty;for(let i=n.length-1;i>=0;i--){if(r.size){let l=n[i].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=O.from(n[i].type.create(n[i].attrs,r))}let s=e.start,o=e.end;t.step(new ge(s,o,s,o,new j(r,0,0),n.length,!0))}function A0(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(i,l)=>{let a=typeof s=="function"?s(i):s;if(i.isTextblock&&!i.hasMarkup(r,a)&&I0(t.doc,t.mapping.slice(o).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&pd(t,i,l,o),gl(t,t.mapping.slice(o).map(l,1),r,void 0,c===null);let u=t.mapping.slice(o),d=u.map(l,1),f=u.map(l+i.nodeSize,1);return t.step(new ge(d,f,d+1,f-1,new j(O.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&hd(t,i,l,o),!1}})}function hd(t,e,n,r){e.forEach((s,o)=>{if(s.isText){let i,l=/\r?\n|\r/g;for(;i=l.exec(s.text);){let a=t.mapping.slice(r).map(n+1+o+i.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function pd(t,e,n,r){e.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let i=t.mapping.slice(r).map(n+1+o);t.replaceWith(i,i+1,e.type.schema.text(`
|
|
@@ -161,7 +161,7 @@ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:
|
|
|
161
161
|
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(`
|
|
162
162
|
`),[o,i]=vv(s);if(o.length===0)return;const l=bh(o,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=o[0])==null?void 0:r.number)||1,items:l,raw:s.slice(0,i).join(`
|
|
163
163
|
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Cv,this.editor.getAttributes(Gc)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=In({find:Xc,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=In({find:Xc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Gc)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Ev=/^\s*(\[([( |x])?\])\s$/,Nv=Ie.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",se(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Vl(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(t),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const g=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...g?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{s.setAttribute(d,f)}),s.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,o.append(l,i),s.append(o,a),Object.entries(e).forEach(([d,f])=>{s.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:s,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;s.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);const f=r.extensionManager.attributes,h=On(d,f),p=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return u.forEach(y=>{p.has(y)||(y in g?s.setAttribute(y,g[y]):s.removeAttribute(y))}),Object.entries(h).forEach(([y,x])=>{x==null?y in g?s.setAttribute(y,g[y]):s.removeAttribute(y):s.setAttribute(y,x)}),u=p,!0}}}},addInputRules(){return[In({find:Ev,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Tv=Ie.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",se(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
164
|
-
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=o=>{const i=Ri(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return i?[{type:"taskList",raw:i.raw,items:i.items}]:n.blockTokens(o)},s=Ri(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ue.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(dh.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(fh.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(xh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(kh.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Nv.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Tv.configure(this.options.taskList)),t}});var Mv=Ie.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",se(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ov=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Av=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Iv=Zt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",se(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[An({find:Ov,type:this.type})]},addPasteRules(){return[Xt({find:Av,type:this.type})]}}),Rv=Ie.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),jv=Zt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",se(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Dv(t={}){return new oe({view(e){return new Pv(e,t)}})}class Pv{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,l=o.height/s.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!o){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=gd(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ae extends q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ae.valid(r)?new ae(r):q.near(r)}content(){return j.empty}eq(e){return e instanceof ae&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ae(e.resolve(n.pos))}getBookmark(){return new Zl(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Lv(e)||!$v(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ae.valid(e))return e;let s=e.pos,o=null;for(let i=e.depth;;i--){let l=e.node(i);if(n>0?e.indexAfter(i)<l.childCount:e.index(i)>0){o=l.child(n>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;s+=n;let a=e.doc.resolve(s);if(ae.valid(a))return a}for(;;){let i=n>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!B.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*n),r=!1;continue e}break}o=i,s+=n;let l=e.doc.resolve(s);if(ae.valid(l))return l}return null}}}ae.prototype.visible=!1;ae.findFrom=ae.findGapCursorFrom;q.jsonID("gapcursor",ae);class Zl{constructor(e){this.pos=e}map(e){return new Zl(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ae.valid(n)?new ae(n):q.near(n)}}function wh(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Lv(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||wh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function $v(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||wh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function _v(){return new oe({props:{decorations:Vv,createSelectionBetween(t,e,n){return e.pos==n.pos&&ae.valid(n)?new ae(n):null},handleClick:Bv,handleKeyDown:zv,handleDOMEvents:{beforeinput:Fv}}})}const zv=xf({ArrowLeft:Hr("horiz",-1),ArrowRight:Hr("horiz",1),ArrowUp:Hr("vert",-1),ArrowDown:Hr("vert",1)});function Hr(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,o){let i=r.selection,l=e>0?i.$to:i.$from,a=i.empty;if(i instanceof H){if(!o.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ae.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new ae(c))),!0):!1}}function Bv(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ae.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&B.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ae(r))),!0)}function Fv(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ae))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=O.empty;for(let i=r.length-1;i>=0;i--)s=O.from(r[i].createAndFill(null,s));let o=t.state.tr.replace(n.pos,n.pos,new j(s,0,0));return o.setSelection(H.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function Vv(t){if(!(t.selection instanceof ae))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",re.create(t.doc,[Se.widget(t.selection.head,e,{key:"gapcursor"})])}var Fs=200,ye=function(){};ye.prototype.append=function(e){return e.length?(e=ye.from(e),!this.length&&e||e.length<Fs&&this.leafAppend(e)||this.length<Fs&&e.leafPrepend(this)||this.appendInner(e)):this};ye.prototype.prepend=function(e){return e.length?ye.from(e).append(this):this};ye.prototype.appendInner=function(e){return new Hv(this,e)};ye.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ye.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ye.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ye.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};ye.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(o,i){return s.push(e(o,i))},n,r),s};ye.from=function(e){return e instanceof ye?e:e&&e.length?new vh(e):ye.empty};var vh=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,i,l){for(var a=o;a<i;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,l){for(var a=o-1;a>=i;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Fs)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Fs)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(ye);ye.empty=new vh([]);var Hv=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,o,i){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(o,l),i)===!1||o>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,o)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,i){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(o,l)-l,i+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(s,l),o,i)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(r,s):r>=o?this.right.slice(r-o,s-o):this.left.slice(r,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ye);const Wv=500;class We{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,o;n&&(s=this.remapping(r,this.items.length),o=s.maps.length);let i=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),o=s.maps.length),o--,u.push(d);return}if(s){u.push(new dt(d.map));let h=d.step.map(s.slice(o)),p;h&&i.maybeStep(h).doc&&(p=i.mapping.maps[i.mapping.maps.length-1],c.push(new dt(p,void 0,void 0,c.length+u.length))),o--,p&&s.appendMap(p,o)}else i.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(o)):d.selection,a=new We(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,n,r,s){let o=[],i=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new dt(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?o.pop():l=l.slice(0,l.length-1)),o.push(f),n&&(i++,n=void 0),s||(a=f)}let c=i-r.depth;return c>Uv&&(l=qv(l,c),i-=c),new We(l.append(o),i)}remapping(e,n){let r=new cr;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,i)},e,n),r}addMaps(e){return this.eventCount==0?this:new We(this.items.append(e.map(n=>new dt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),o=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=n;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;i=Math.min(i,h);let p=o.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(o.slice(a+1,h));y&&l++,r.push(new dt(p,g,y))}else r.push(new dt(p))},s);let c=[];for(let f=n;f<i;f++)c.push(new dt(o.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new We(u,l);return d.emptyItemCount()>Wv&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],o=0;return this.items.forEach((i,l)=>{if(l>=e)s.push(i),i.selection&&o++;else if(i.step){let a=i.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=i.selection&&i.selection.map(n.slice(r));u&&o++;let d=new dt(c.invert(),a,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else i.map&&r--},this.items.length,0),new We(ye.from(s.reverse()),o)}}We.empty=new We(ye.empty,0);function qv(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}let dt=class Sh{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Sh(n.getMap().invert(),n,this.selection)}}};class mt{constructor(e,n,r,s,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const Uv=20;function Kv(t,e,n,r){let s=n.getMeta(qt),o;if(s)return s.historyState;n.getMeta(Xv)&&(t=new mt(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(qt))return i.getMeta(qt).redo?new mt(t.done.addTransform(n,void 0,r,Gr(e)),t.undone,Yc(n.mapping.maps),t.prevTime,t.prevComposition):new mt(t.done,t.undone.addTransform(n,void 0,r,Gr(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!i&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Jv(n,t.prevRanges)),c=i?oi(t.prevRanges,n.mapping):Yc(n.mapping.maps);return new mt(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Gr(e)),We.empty,c,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new mt(t.done.rebased(n,o),t.undone.rebased(n,o),oi(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new mt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),oi(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Jv(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&s>=e[o]&&(n=!0)}),n}function Yc(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,o,i)=>e.push(o,i));return e}function oi(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),o=e.map(t[r+1],-1);s<=o&&n.push(s,o)}return n}function Gv(t,e,n){let r=Gr(e),s=qt.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let i=o.selection.resolve(o.transform.doc),l=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),s,r),a=new mt(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(qt,{redo:n,historyState:a})}let ii=!1,Qc=null;function Gr(t){let e=t.plugins;if(Qc!=e){ii=!1,Qc=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ii=!0;break}}return ii}const qt=new ce("history"),Xv=new ce("closeHistory");function Yv(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new oe({key:qt,state:{init(){return new mt(We.empty,We.empty,null,0,-1)},apply(e,n,r){return Kv(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?Eh:r=="historyRedo"?Nh:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function Ch(t,e){return(n,r)=>{let s=qt.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let o=Gv(s,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const Eh=Ch(!1,!0),Nh=Ch(!0,!0);ue.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new oe({key:new ce("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const i=o-s,l=0,a=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=r||s>r&&o>r&&o<=s)return!0;if(s>r&&o>r&&o>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Qv=ue.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Dv(this.options)]}});ue.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new oe({key:new ce("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,o=[];if(!n||!r)return re.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;i+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(Se.node(c,c+a.nodeSize,{class:this.options.className}))}),re.create(t,o)}}})]}});var Zv=ue.create({name:"gapCursor",addProseMirrorPlugins(){return[_v()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Q(z(t,"allowGapCursor",n)))!=null?e:null}}});ue.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new oe({key:new ce("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!n)return null;const o=this.editor.isEmpty;return t.descendants((i,l)=>{const a=r>=l&&r<=l+i.nodeSize,c=!i.isLeaf&&ao(i);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const d=Se.node(l,l+i.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:l,hasAnchor:a}):this.options.placeholder});s.push(d)}return this.options.includeChildren}),re.create(t,s)}}})]}});ue.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new oe({key:new ce("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Df(n.selection)||t.view.dragging?null:re.create(n.doc,[Se.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Zc({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var eS=ue.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ce(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new oe({key:e,appendTransaction:(s,o,i)=>{const{doc:l,tr:a,schema:c}=i,u=e.getState(i),d=l.content.size,f=c.nodes[n];if(u)return a.insert(d,f.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!Zc({node:i,types:r})},apply:(s,o)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return o;const i=s.doc.lastChild;return!Zc({node:i,types:r})}}})]}}),tS=ue.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Eh(t,e),redo:()=>({state:t,dispatch:e})=>Nh(t,e)}},addProseMirrorPlugins(){return[Yv(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),nS=ue.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(Ow.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Cw.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(dh.configure(this.options.bulletList)),this.options.code!==!1&&s.push(Rw.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(Pw.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(Lw.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(Qv.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(Zv.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push($w.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(_w.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(tS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(zw.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(Ww.configure(this.options.italic)),this.options.listItem!==!1&&s.push(fh.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(xh.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(mv.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(kh.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Mv.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(Iv.configure(this.options.strike)),this.options.text!==!1&&s.push(Rv.configure(this.options.text)),this.options.underline!==!1&&s.push(jv.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(eS.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),rS=nS;function sS(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:i,$position:l}=t,a=r&&!s,c=Gk(n),u=new RegExp(`\\s${c}$`),d=i?"^":"",f=s?"":c,h=a?new RegExp(`${d}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${d}(?:^)?${c}[^\\s${f}]*`,"gm"),p=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!p)return null;const g=l.pos-p.length,y=Array.from(p.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const x=y.input.slice(Math.max(0,y.index-1),y.index),b=new RegExp(`^[${o?.join("")}\0]?$`).test(x);if(o!==null&&!b)return null;const k=g+y.index;let C=k+y[0].length;return a&&u.test(p.slice(C-1,C+1))&&(y[0]+=" ",C+=1),k<l.pos&&C>=l.pos?{range:{from:k,to:C},query:y[0].slice(n.length),text:y[0]}:null}var oS=new ce("suggestion");function iS({pluginKey:t=oS,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:o=[" "],startOfLine:i=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:c="",decorationEmptyClass:u="is-empty",command:d=()=>null,items:f=()=>[],render:h=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=sS,shouldShow:y}){let x;const b=h?.(),k=()=>{const v=e.state.selection.$anchor.pos,M=e.view.coordsAtPos(v),{top:T,right:I,bottom:D,left:$}=M;try{return new DOMRect($,T,I-$,D-T)}catch{return null}},C=(v,M)=>M?()=>{const T=t.getState(e.state),I=T?.decorationId,D=v.dom.querySelector(`[data-decoration-id="${I}"]`);return D?.getBoundingClientRect()||null}:k;function w(v,M){var T;try{const D=t.getState(v.state),$=D?.decorationId?v.dom.querySelector(`[data-decoration-id="${D.decorationId}"]`):null,V={editor:e,range:D?.range||{from:0,to:0},query:D?.query||null,text:D?.text||null,items:[],command:F=>d({editor:e,range:D?.range||{from:0,to:0},props:F}),decorationNode:$,clientRect:C(v,$)};(T=b?.onExit)==null||T.call(b,V)}catch{}const I=v.state.tr.setMeta(M,{exit:!0});v.dispatch(I)}const S=new oe({key:t,view(){return{update:async(v,M)=>{var T,I,D,$,V,F,P;const N=(T=this.key)==null?void 0:T.getState(M),_=(I=this.key)==null?void 0:I.getState(v.state),L=N.active&&_.active&&N.range.from!==_.range.from,J=!N.active&&_.active,Z=N.active&&!_.active,U=!J&&!Z&&N.query!==_.query,K=J||L&&U,ie=U||L,ee=Z||L&&U;if(!K&&!ie&&!ee)return;const G=ee&&!K?N:_,Ve=v.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);x={editor:e,range:G.range,query:G.query,text:G.text,items:[],command:ct=>d({editor:e,range:G.range,props:ct}),decorationNode:Ve,clientRect:C(v,Ve)},K&&((D=b?.onBeforeStart)==null||D.call(b,x)),ie&&(($=b?.onBeforeUpdate)==null||$.call(b,x)),(ie||K)&&(x.items=await f({editor:e,query:G.query})),ee&&((V=b?.onExit)==null||V.call(b,x)),ie&&((F=b?.onUpdate)==null||F.call(b,x)),K&&((P=b?.onStart)==null||P.call(b,x))},destroy:()=>{var v;x&&((v=b?.onExit)==null||v.call(b,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(v,M,T,I){const{isEditable:D}=e,{composing:$}=e.view,{selection:V}=v,{empty:F,from:P}=V,N={...M},_=v.getMeta(t);if(_&&_.exit)return N.active=!1,N.decorationId=null,N.range={from:0,to:0},N.query=null,N.text=null,N;if(N.composing=$,D&&(F||e.view.composing)){(P<M.range.from||P>M.range.to)&&!$&&!M.composing&&(N.active=!1);const L=g({char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:i,$position:V.$from}),J=`id_${Math.floor(Math.random()*4294967295)}`;L&&p({editor:e,state:I,range:L.range,isActive:M.active})&&(!y||y({editor:e,range:L.range,query:L.query,text:L.text,transaction:v}))?(N.active=!0,N.decorationId=M.decorationId?M.decorationId:J,N.range=L.range,N.query=L.query,N.text=L.text):N.active=!1}else N.active=!1;return N.active||(N.decorationId=null,N.range={from:0,to:0},N.query=null,N.text=null),N}},props:{handleKeyDown(v,M){var T,I,D,$;const{active:V,range:F}=S.getState(v.state);if(!V)return!1;if(M.key==="Escape"||M.key==="Esc"){const N=S.getState(v.state),_=(T=x?.decorationNode)!=null?T:null,L=_??(N?.decorationId?v.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null);if(((I=b?.onKeyDown)==null?void 0:I.call(b,{view:v,event:M,range:N.range}))||!1)return!0;const Z={editor:e,range:N.range,query:N.query,text:N.text,items:[],command:U=>d({editor:e,range:N.range,props:U}),decorationNode:L,clientRect:L?()=>L.getBoundingClientRect()||null:null};return(D=b?.onExit)==null||D.call(b,Z),w(v,t),!0}return(($=b?.onKeyDown)==null?void 0:$.call(b,{view:v,event:M,range:F}))||!1},decorations(v){const{active:M,range:T,decorationId:I,query:D}=S.getState(v);if(!M)return null;const $=!D?.length,V=[a];return $&&V.push(u),re.create(v.doc,[Se.inline(T.from,T.to,{nodeName:l,class:V.join(" "),"data-decoration-id":I,"data-decoration-content":c})])}}});return S}function lS({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const s=new ce;return{editor:t,char:r,pluginKey:s,command:({editor:o,range:i,props:l})=>{var a,c,u;const d=o.view.state.selection.$to.nodeAfter;(a=d?.text)!=null&&a.startsWith(" ")&&(i.to+=1),o.chain().focus().insertContentAt(i,[{type:n,attrs:{...l,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(u=(c=o.view.dom.ownerDocument.defaultView)==null?void 0:c.getSelection())==null||u.collapseToEnd()},allow:({state:o,range:i})=>{const l=o.doc.resolve(i.from),a=o.schema.nodes[n];return!!l.parent.type.contentMatch.matchType(a)},...e}}function Th(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>lS({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function eu(t,e){const n=Th(t),r=n.find(s=>s.char===e);return r||(n.length?n[0]:null)}var aS=Ie.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e?.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,s;return["span",se(this.HTMLAttributes,t.HTMLAttributes),`${(r=n?.char)!=null?r:"@"}${(s=e.attrs.label)!=null?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=eu(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",se({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=se({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof s=="string"?["span",se({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...Yf({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,o,i]=r,l=o??i;e[s==="char"?"mentionSuggestionChar":s]=l,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:eu(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:s,anchor:o}=r;if(!s)return!1;let i=new ze,l=0;return e.doc.nodesBetween(o-1,o,(a,c)=>{if(a.type.name===this.name)return n=!0,i=a,l=c,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":i.attrs.mentionSuggestionChar,l,l+i.nodeSize),n})}},addProseMirrorPlugins(){return Th(this).map(iS)}}),cS=aS,li,ho="HoverCard",[Mh]=Ui(ho,[ou]),po=ou(),[uS,mo]=Mh(ho),Oh=t=>{const{__scopeHoverCard:e,children:n,open:r,defaultOpen:s,onOpenChange:o,openDelay:i=700,closeDelay:l=300}=t,a=po(e),c=E.useRef(0),u=E.useRef(0),d=E.useRef(!1),f=E.useRef(!1),[h,p]=qs({prop:r,defaultProp:s??!1,onChange:o,caller:ho}),g=E.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>p(!0),i)},[i,p]),y=E.useCallback(()=>{clearTimeout(c.current),!d.current&&!f.current&&(u.current=window.setTimeout(()=>p(!1),l))},[l,p]),x=E.useCallback(()=>p(!1),[p]);return E.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),m.jsx(uS,{scope:e,open:h,onOpenChange:p,onOpen:g,onClose:y,onDismiss:x,hasSelectionRef:d,isPointerDownOnContentRef:f,children:m.jsx(fp,{...a,children:n})})};Oh.displayName=ho;var Ah="HoverCardTrigger",Ih=E.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,s=mo(Ah,n),o=po(n);return m.jsx(up,{asChild:!0,...o,children:m.jsx(Rn.a,{"data-state":s.open?"open":"closed",...r,ref:e,onPointerEnter:He(t.onPointerEnter,Hs(s.onOpen)),onPointerLeave:He(t.onPointerLeave,Hs(s.onClose)),onFocus:He(t.onFocus,s.onOpen),onBlur:He(t.onBlur,s.onClose),onTouchStart:He(t.onTouchStart,i=>i.preventDefault())})})});Ih.displayName=Ah;var ea="HoverCardPortal",[dS,fS]=Mh(ea,{forceMount:void 0}),Rh=t=>{const{__scopeHoverCard:e,forceMount:n,children:r,container:s}=t,o=mo(ea,e);return m.jsx(dS,{scope:e,forceMount:n,children:m.jsx(Ki,{present:n||o.open,children:m.jsx(dp,{asChild:!0,container:s,children:r})})})};Rh.displayName=ea;var Vs="HoverCardContent",jh=E.forwardRef((t,e)=>{const n=fS(Vs,t.__scopeHoverCard),{forceMount:r=n.forceMount,...s}=t,o=mo(Vs,t.__scopeHoverCard);return m.jsx(Ki,{present:r||o.open,children:m.jsx(hS,{"data-state":o.open?"open":"closed",...s,onPointerEnter:He(t.onPointerEnter,Hs(o.onOpen)),onPointerLeave:He(t.onPointerLeave,Hs(o.onClose)),ref:e})})});jh.displayName=Vs;var hS=E.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,...l}=t,a=mo(Vs,n),c=po(n),u=E.useRef(null),d=Ji(e,u),[f,h]=E.useState(!1);return E.useEffect(()=>{if(f){const p=document.body;return li=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=li,p.style.webkitUserSelect=li}}},[f]),E.useEffect(()=>{if(u.current){const p=()=>{h(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),E.useEffect(()=>{u.current&&gS(u.current).forEach(g=>g.setAttribute("tabindex","-1"))}),m.jsx(hp,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:i,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:He(o,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:m.jsx(pp,{...c,...l,onPointerDown:He(l.onPointerDown,p=>{p.currentTarget.contains(p.target)&&h(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:d,style:{...l.style,userSelect:f?"text":void 0,WebkitUserSelect:f?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),pS="HoverCardArrow",mS=E.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,s=po(n);return m.jsx(mp,{...s,...r,ref:e})});mS.displayName=pS;function Hs(t){return e=>e.pointerType==="touch"?void 0:t()}function gS(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var yS=Oh,xS=Ih,bS=Rh,kS=jh;function wS(t){const e=R.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=m.jsx(yS,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=r):r=e[3],r}function vS(t){const e=R.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=m.jsx(xS,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function SS(t){const e=R.c(12);let n,r,s,o;e[0]!==t?({className:n,align:s,sideOffset:o,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=o):(n=e[1],r=e[2],s=e[3],o=e[4]);const i=s===void 0?"center":s,l=o===void 0?4:o;let a;e[5]!==n?(a=Y("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",n),e[5]=n,e[6]=a):a=e[6];let c;return e[7]!==i||e[8]!==r||e[9]!==l||e[10]!==a?(c=m.jsx(bS,{"data-slot":"hover-card-portal",children:m.jsx(kS,{"data-slot":"hover-card-content",align:i,sideOffset:l,className:a,...r})}),e[7]=i,e[8]=r,e[9]=l,e[10]=a,e[11]=c):c=e[11],c}const Dh=E.createContext(void 0);function CS(t,e){const n=e.split("."),r=n[0];if(!r)return;let s=t[r];for(let o=1;o<n.length&&s!==void 0;o++){const i=n[o];if(i)if(typeof s=="object"&&s!==null)s=s[i];else return}return s}function ES(t){const e=R.c(20),{node:n}=t,r=E.useContext(Dh),s=n.attrs.id??"",o=r!==void 0;let i;if(e[0]!==o||e[1]!==s||e[2]!==r){const g=o?CS(r,s):void 0;i=g!==void 0?typeof g=="object"?JSON.stringify(g,null,2):String(g):void 0,e[0]=o,e[1]=s,e[2]=r,e[3]=i}else i=e[3];const l=i;let a;e[4]!==s?(a=m.jsxs("span",{className:"bg-primary/20 text-primary px-1 rounded font-medium cursor-pointer",children:["@",s]}),e[4]=s,e[5]=a):a=e[5];const c=a;if(!o||l===void 0){let g;return e[6]!==c?(g=m.jsx(Lc,{as:"span",children:c}),e[6]=c,e[7]=g):g=e[7],g}let u;e[8]!==c?(u=m.jsx(vS,{asChild:!0,children:c}),e[8]=c,e[9]=u):u=e[9];let d;e[10]!==s?(d=m.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["@",s]}),e[10]=s,e[11]=d):d=e[11];let f;e[12]!==l?(f=m.jsx("pre",{className:"text-xs font-mono bg-muted/50 p-2 rounded overflow-auto max-h-[200px] whitespace-pre-wrap break-all",children:l}),e[12]=l,e[13]=f):f=e[13];let h;e[14]!==d||e[15]!==f?(h=m.jsx(SS,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:m.jsxs("div",{className:"space-y-1.5",children:[d,f]})}),e[14]=d,e[15]=f,e[16]=h):h=e[16];let p;return e[17]!==u||e[18]!==h?(p=m.jsx(Lc,{as:"span",children:m.jsxs(wS,{openDelay:200,children:[u,h]})}),e[17]=u,e[18]=h,e[19]=p):p=e[19],p}function Ph(t){const e=[];function n(r){for(const s of r)s.children?.length||e.push(s),s.children&&n(s.children)}return n(t),e}let Ge=Lh();function Lh(){return hl(()=>({items:[],selectedIndex:0,command:null}))}function tu(t,e){Ge.setState({items:t,command:e,selectedIndex:0})}function NS(){const{items:t,selectedIndex:e}=Ge.getState();t.length&&Ge.setState({selectedIndex:(e-1+t.length)%t.length})}function TS(){const{items:t,selectedIndex:e}=Ge.getState();t.length&&Ge.setState({selectedIndex:(e+1)%t.length})}function $h(){const{items:t,selectedIndex:e,command:n}=Ge.getState(),r=t[e];return r?(n?.(r),!0):!1}function nu(){Ge=Lh()}function MS(){const t=R.c(7),e=di(Ge,AS),n=di(Ge,OS);if(!e.length)return null;let r;if(t[0]!==e||t[1]!==n){let o;t[3]!==n?(o=(i,l)=>m.jsx("button",{type:"button",onClick:()=>{Ge.setState({selectedIndex:l}),$h()},className:Y("flex items-center w-full text-left px-3 py-1.5 text-sm rounded-md transition-colors",l===n?"bg-accent text-accent-foreground":"hover:bg-muted"),children:i.label},i.id),t[3]=n,t[4]=o):o=t[4],r=e.map(o),t[0]=e,t[1]=n,t[2]=r}else r=t[2];let s;return t[5]!==r?(s=m.jsx("div",{className:"bg-popover border border-border rounded-lg shadow-lg overflow-hidden min-w-[180px]",children:m.jsx("div",{className:"p-1",children:r})}),t[5]=r,t[6]=s):s=t[6],s}function OS(t){return t.selectedIndex}function AS(t){return t.items}function IS(){let t=null,e=null;return{onStart:n=>{tu(n.items,n.command),t=new th(MS,{editor:n.editor}),e=document.createElement("div"),e.style.cssText="position:absolute;z-index:9999";const r=n.clientRect?.();r&&(e.style.top=`${r.bottom+window.scrollY+4}px`,e.style.left=`${r.left+window.scrollX}px`),e.appendChild(t.element),document.body.appendChild(e)},onUpdate:n=>{tu(n.items,n.command);const r=n.clientRect?.();r&&e&&(e.style.top=`${r.bottom+window.scrollY+4}px`,e.style.left=`${r.left+window.scrollX}px`)},onKeyDown:({event:n})=>n.key==="Escape"?(e?.remove(),t?.destroy(),nu(),!0):n.key==="ArrowUp"?(NS(),!0):n.key==="ArrowDown"?(TS(),!0):n.key==="Enter"?$h():!1,onExit:()=>{e?.remove(),t?.destroy(),nu()}}}const ai=/@([\w.]+)/g;function RS(t,e){if(!t)return null;const n=Ph(e),r=new Map(n.map(a=>[a.id,a]));if(!ai.test(t))return t;ai.lastIndex=0;const o=[];let i=0,l;for(;(l=ai.exec(t))!==null;){const a=l[1]??"",c=l.index;c>i&&o.push({type:"text",text:t.slice(i,c)});const u=r.get(a);u?o.push({type:"mention",attrs:{id:u.id,label:u.label}}):o.push({type:"text",text:l[0]}),i=c+l[0].length}return i<t.length&&o.push({type:"text",text:t.slice(i)}),{type:"doc",content:[{type:"paragraph",content:o.length>0?o:void 0}]}}function ta(t){const e=R.c(31),{mentions:n,value:r,onChange:s,placeholder:o,className:i,readOnly:l}=t,a=X1();let c;e[0]!==n||e[1]!==r?(c=RS(r,n),e[0]=n,e[1]=r,e[2]=c):c=e[2];const u=c,d=a!==void 0,f=!l;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=rS.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=h):h=e[3];let p;if(e[4]!==n||e[5]!==d){let T;e[7]!==n?(T=I=>{const{query:D}=I;return Ph(n).filter(V=>V.label.toLowerCase().includes(D.toLowerCase())||V.id.toLowerCase().includes(D.toLowerCase()))},e[7]=n,e[8]=T):T=e[8],p=cS.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:LS,renderHTML:PS,suggestion:{items:T,render:IS,command:DS}}).extend(d?{addNodeView(){return vw(ES)}}:{}),e[4]=n,e[5]=d,e[6]=p}else p=e[6];let g;e[9]!==p?(g=[h,p],e[9]=p,e[10]=g):g=e[10];const y=o??"";let x;e[11]!==y?(x={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full min-h-[20px]","data-placeholder":y},handleKeyDown:jS},e[11]=y,e[12]=x):x=e[12];let b;e[13]!==s?(b=T=>{const{editor:I}=T;return s?.(I.getText().trim())},e[13]=s,e[14]=b):b=e[14];let k;e[15]!==u||e[16]!==f||e[17]!==g||e[18]!==x||e[19]!==b?(k={content:u,editable:f,extensions:g,editorProps:x,onUpdate:b},e[15]=u,e[16]=f,e[17]=g,e[18]=x,e[19]=b,e[20]=k):k=e[20];const C=mw(k);let w;e[21]!==i?(w=Y("rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",i),e[21]=i,e[22]=w):w=e[22];let S;e[23]!==C?(S=m.jsx(aw,{editor:C}),e[23]=C,e[24]=S):S=e[24];let v;e[25]!==w||e[26]!==S?(v=m.jsx("div",{className:w,children:S}),e[25]=w,e[26]=S,e[27]=v):v=e[27];const M=v;if(a!==void 0){let T;return e[28]!==M||e[29]!==a?(T=m.jsx(Dh.Provider,{value:a,children:M}),e[28]=M,e[29]=a,e[30]=T):T=e[30],T}return M}function jS(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function DS(t){const{editor:e,range:n,props:r}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:r}]).run()}function PS(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function LS(t){const{node:e}=t;return`@${e.attrs.id}`}function $S(t){const e=R.c(8),{value:n,onChange:r,placeholder:s,readonly:o}=t,i=Hu(),l=n??"";let a;e[0]!==r?(a=d=>r(d),e[0]=r,e[1]=a):a=e[1];const c=s||"Enter value...";let u;return e[2]!==i||e[3]!==o||e[4]!==l||e[5]!==a||e[6]!==c?(u=m.jsx(ta,{mentions:i,value:l,onChange:a,placeholder:c,readOnly:o}),e[2]=i,e[3]=o,e[4]=l,e[5]=a,e[6]=c,e[7]=u):u=e[7],u}function _S(t){const e=R.c(8),{value:n,onChange:r,placeholder:s,readonly:o}=t,i=Hu(),l=n??"";let a;e[0]!==r?(a=d=>r(d),e[0]=r,e[1]=a):a=e[1];const c=s||"Enter value...";let u;return e[2]!==i||e[3]!==o||e[4]!==l||e[5]!==a||e[6]!==c?(u=m.jsx(ta,{mentions:i,value:l,onChange:a,placeholder:c,readOnly:o,className:"min-h-[80px]"}),e[2]=i,e[3]=o,e[4]=l,e[5]=a,e[6]=c,e[7]=u):u=e[7],u}function zS(t){const e=R.c(8),{value:n,onChange:r,readonly:s,id:o}=t,i=n??"";let l;e[0]!==r?(l=u=>r(u.target.value===""?void 0:Number(u.target.value)),e[0]=r,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=Y("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),e[2]=a):a=e[2];let c;return e[3]!==o||e[4]!==s||e[5]!==i||e[6]!==l?(c=m.jsx("input",{id:o,type:"number",value:i,onChange:l,disabled:s,className:a}),e[3]=o,e[4]=s,e[5]=i,e[6]=l,e[7]=c):c=e[7],c}function BS(t){const e=R.c(13),{value:n,onChange:r,readonly:s,id:o,label:i}=t,l=n??!1;let a;e[0]!==r?(a=f=>r(f.target.checked),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==o||e[3]!==s||e[4]!==l||e[5]!==a?(c=m.jsx("input",{id:o,type:"checkbox",checked:l,onChange:a,disabled:s,className:"h-4 w-4 rounded border-input"}),e[2]=o,e[3]=s,e[4]=l,e[5]=a,e[6]=c):c=e[6];let u;e[7]!==i?(u=m.jsx("span",{className:"text-sm",children:i}),e[7]=i,e[8]=u):u=e[8];let d;return e[9]!==o||e[10]!==c||e[11]!==u?(d=m.jsxs("label",{htmlFor:o,className:"flex items-center gap-2 cursor-pointer",children:[c,u]}),e[9]=o,e[10]=c,e[11]=u,e[12]=d):d=e[12],d}function FS(t){const e=R.c(14),{value:n,onChange:r,readonly:s,id:o,options:i}=t;let l;e[0]!==i.enumOptions?(l=i.enumOptions??[],e[0]=i.enumOptions,e[1]=l):l=e[1];const a=l,c=n??"";let u;e[2]!==r?(u=g=>r(g.target.value),e[2]=r,e[3]=u):u=e[3];let d,f;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=Y("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),f=m.jsx("option",{value:"",children:"Select..."}),e[4]=d,e[5]=f):(d=e[4],f=e[5]);let h;e[6]!==a?(h=a.map(VS),e[6]=a,e[7]=h):h=e[7];let p;return e[8]!==o||e[9]!==s||e[10]!==c||e[11]!==u||e[12]!==h?(p=m.jsxs("select",{id:o,value:c,onChange:u,disabled:s,className:d,children:[f,h]}),e[8]=o,e[9]=s,e[10]=c,e[11]=u,e[12]=h,e[13]=p):p=e[13],p}function VS(t){return m.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const HS={TextWidget:$S,TextareaWidget:_S,NumberWidget:zS,CheckboxWidget:BS,SelectWidget:FS};function WS(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:ku,color:"text-blue-500"};case"number":case"integer":return{Icon:xu,color:"text-blue-500"};case"array":return{Icon:pu,color:"text-purple-500"};case"object":return{Icon:hu,color:"text-orange-500"};case"boolean":return{Icon:bu,color:"text-pink-500"};case"null":return{Icon:Gi,color:"text-gray-500"};default:return{Icon:yu,color:"text-muted-foreground"}}}function qS(t){const e=R.c(36),{id:n,label:r,required:s,description:o,children:i,schema:l,hidden:a}=t;if(a){let w;return e[0]!==i?(w=m.jsx("div",{className:"hidden",children:i}),e[0]=i,e[1]=w):w=e[1],w}if(n==="root"){let w;return e[2]!==i?(w=m.jsx("div",{className:"space-y-4",children:i}),e[2]=i,e[3]=w):w=e[3],w}const c=Array.isArray(l.type)?l.type[0]:l.type??"string";let u,d,f,h,p,g,y;if(e[4]!==n||e[5]!==r||e[6]!==s||e[7]!==c){const{Icon:w,color:S}=WS(c);y="space-y-2",h="flex items-center gap-2",e[15]!==n||e[16]!==r?(p=m.jsx("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:r}),e[15]=n,e[16]=r,e[17]=p):p=e[17],e[18]!==s?(g=s&&m.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=s,e[19]=g):g=e[19],u=w,d=14,f=Y(S,"ml-auto"),e[4]=n,e[5]=r,e[6]=s,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h,e[12]=p,e[13]=g,e[14]=y}else u=e[8],d=e[9],f=e[10],h=e[11],p=e[12],g=e[13],y=e[14];let x;e[20]!==u||e[21]!==d||e[22]!==f?(x=m.jsx(u,{size:d,className:f}),e[20]=u,e[21]=d,e[22]=f,e[23]=x):x=e[23];let b;e[24]!==h||e[25]!==p||e[26]!==g||e[27]!==x?(b=m.jsxs("div",{className:h,children:[p,g,x]}),e[24]=h,e[25]=p,e[26]=g,e[27]=x,e[28]=b):b=e[28];let k;e[29]!==o?(k=o&&m.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:o}),e[29]=o,e[30]=k):k=e[30];let C;return e[31]!==i||e[32]!==y||e[33]!==b||e[34]!==k?(C=m.jsxs("div",{className:y,children:[b,k,i]}),e[31]=i,e[32]=y,e[33]=b,e[34]=k,e[35]=C):C=e[35],C}function US(t){const e=R.c(8),{properties:n,title:r}=t;if(!r||r==="Root"){let l;e[0]!==n?(l=n.map(JS),e[0]=n,e[1]=l):l=e[1];let a;return e[2]!==l?(a=m.jsx("div",{className:"space-y-4",children:l}),e[2]=l,e[3]=a):a=e[3],a}let o;e[4]!==n?(o=n.map(KS),e[4]=n,e[5]=o):o=e[5];let i;return e[6]!==o?(i=m.jsx("div",{className:"pl-4 border-l-2 border-border/50 space-y-4",children:o}),e[6]=o,e[7]=i):i=e[7],i}function KS(t){return m.jsx("div",{children:t.content},t.name)}function JS(t){return m.jsx("div",{children:t.content},t.name)}function GS(t){const e=R.c(11),{items:n,canAdd:r,onAddClick:s,title:o}=t;let i;e[0]!==n?(i=n.map(XS),e[0]=n,e[1]=i):i=e[1];let l;e[2]!==i?(l=m.jsx("div",{className:"space-y-2",children:i}),e[2]=i,e[3]=l):l=e[3];let a;e[4]!==r||e[5]!==s||e[6]!==o?(a=r&&m.jsxs(me,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:s,children:["+ Add ",o||"item"]}),e[4]=r,e[5]=s,e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==l||e[9]!==a?(c=m.jsxs("div",{className:"space-y-2",children:[l,a]}),e[8]=l,e[9]=a,e[10]=c):c=e[10],c}function XS(t){return m.jsx("div",{className:"flex gap-2 items-start",children:m.jsx("div",{className:"flex-1",children:t})},t.key||t.index)}function YS(){return null}function QS(){return null}const ZS={FieldTemplate:qS,ObjectFieldTemplate:US,ArrayFieldTemplate:GS,UnsupportedFieldTemplate:YS,ErrorListTemplate:QS};function e2(t){const e=R.c(6),{inputSchema:n,inputParams:r,mentions:s}=t;if(!n?.properties||!r)return null;let o;e[0]!==s?(o=(a,c,u)=>{const d=typeof c=="object"&&c!==null?JSON.stringify(c,null,2):String(c??""),f=Array.isArray(u.type)?u.type.join(" | "):u.type??"string";return m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),m.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:f})]}),u.description&&m.jsx("div",{className:"text-xs text-muted-foreground",children:u.description}),m.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:m.jsx(ta,{mentions:s,value:d,readOnly:!0,className:"border-0 bg-transparent p-0"})})]},a)},e[0]=s,e[1]=o):o=e[1];const i=o;let l;return e[2]!==r||e[3]!==n.properties||e[4]!==i?(l=m.jsx("div",{className:"space-y-4",children:Object.entries(n.properties).map(a=>{const[c,u]=a,d=r[c];return i(c,d,u)})}),e[2]=r,e[3]=n.properties,e[4]=i,e[5]=l):l=e[5],l}function _h({inputSchema:t,inputParams:e,setInputParams:n,handleInputChange:r,mentions:s,readOnly:o}){const i=s??[];if(!t)return m.jsx("div",{className:"text-sm text-muted-foreground italic",children:"No arguments defined in schema."});if(o)return m.jsx(e2,{inputSchema:t,inputParams:e,mentions:i});const l=t,a=E.useRef(e??{}),c=u=>{const d=u.formData??{},f=a.current;if(n?.(d),r){for(const[h,p]of Object.entries(d))f[h]!==p&&r(h,p);for(const h of Object.keys(f))h in d||r(h,void 0)}a.current=d};return m.jsx(Vu.Provider,{value:i,children:m.jsx(Pp,{schema:l,formData:e,onChange:c,validator:Lp,widgets:HS,templates:ZS,readonly:o,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:m.jsx(m.Fragment,{})})})}function t2(t){const e=R.c(33),{open:n,onOpenChange:r,inputSchema:s,onSubmit:o,isPending:i}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];const[a,c]=E.useState(l);let u;e[1]!==a||e[2]!==r||e[3]!==o?(u=async()=>{await o(a),r(!1),c({})},e[1]=a,e[2]=r,e[3]=o,e[4]=u):u=e[4];const d=u;let f;e[5]!==r?(f=M=>{M||c({}),r(M)},e[5]=r,e[6]=f):f=e[6];const h=f;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsxs(Jp,{children:[m.jsx(Gp,{children:"Workflow Input"}),m.jsx(Xp,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[8]=g):g=e[8];let y;e[9]!==a||e[10]!==s?(y=m.jsx("div",{className:"py-4",children:m.jsx(_h,{inputSchema:s,inputParams:a,setInputParams:c,mentions:g})}),e[9]=a,e[10]=s,e[11]=y):y=e[11];let x;e[12]!==h?(x=()=>h(!1),e[12]=h,e[13]=x):x=e[13];let b;e[14]!==i||e[15]!==x?(b=m.jsx(me,{variant:"outline",onClick:x,disabled:i,children:"Cancel"}),e[14]=i,e[15]=x,e[16]=b):b=e[16];let k;e[17]!==i?(k=i?m.jsx(jn,{size:"xs"}):m.jsx(ol,{size:14}),e[17]=i,e[18]=k):k=e[18];let C;e[19]!==d||e[20]!==i||e[21]!==k?(C=m.jsxs(me,{onClick:d,disabled:i,className:"gap-2",children:[k,"Run Workflow"]}),e[19]=d,e[20]=i,e[21]=k,e[22]=C):C=e[22];let w;e[23]!==C||e[24]!==b?(w=m.jsxs(Yp,{children:[b,C]}),e[23]=C,e[24]=b,e[25]=w):w=e[25];let S;e[26]!==w||e[27]!==y?(S=m.jsxs(Qp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,y,w]}),e[26]=w,e[27]=y,e[28]=S):S=e[28];let v;return e[29]!==h||e[30]!==n||e[31]!==S?(v=m.jsx(Zp,{open:n,onOpenChange:h,children:S}),e[29]=h,e[30]=n,e[31]=S,e[32]=v):v=e[32],v}function n2(t){const e=R.c(26),{title:n,description:r,onSave:s}=t,i=qi().location.href,{viewMode:l,setViewMode:a,showExecutionsList:c,toggleExecutionsList:u}=pl(),{resetToOriginalWorkflow:d,setSelectedGatewayId:f}=Me(),h=ju(),p=Ln(),g=we();let y;e[0]!==n?(y=m.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=y):y=e[1];let x;e[2]!==r?(x=r?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),m.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:r})]}):null,e[2]=r,e[3]=x):x=e[3];let b;e[4]!==y||e[5]!==x?(b=m.jsx(du,{children:m.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,x]})}),e[4]=y,e[5]=x,e[6]=b):b=e[6];let k;e[7]!==h||e[8]!==s||e[9]!==d||e[10]!==p||e[11]!==f||e[12]!==a||e[13]!==c||e[14]!==n||e[15]!==u||e[16]!==g||e[17]!==i||e[18]!==l?(k=!g&&m.jsxs(m.Fragment,{children:[m.jsx(Zi,{title:n,url:i,icon:"workflow"}),m.jsx(E.Suspense,{fallback:m.jsx(jn,{size:"xs"}),children:m.jsx(Vp,{selectedGatewayId:p??void 0,onGatewayChange:f,variant:"bordered",placeholder:"Select gateway"})}),m.jsx(qp,{value:l,onValueChange:a,size:"sm",options:[{value:"visual",icon:m.jsx(Up,{})},{value:"code",icon:m.jsx(Su,{})}]}),m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:d,disabled:!h,"aria-label":"Reset changes",children:m.jsx(uu,{size:14})})})}),m.jsx(_t,{side:"bottom",children:"Reset changes"})]})}),m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:s,disabled:!h,"aria-label":"Save workflow",children:m.jsx(fl,{size:14})})})}),m.jsx(_t,{side:"bottom",children:"Save workflow"})]})}),m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:c?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:u,"aria-label":c?"Hide runs":"Show runs",children:m.jsx(vu,{size:14})})})}),m.jsx(_t,{side:"bottom",children:c?"Hide runs":"Show runs"})]})})]}),e[7]=h,e[8]=s,e[9]=d,e[10]=p,e[11]=f,e[12]=a,e[13]=c,e[14]=n,e[15]=u,e[16]=g,e[17]=i,e[18]=l,e[19]=k):k=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=m.jsx(o2,{}),e[20]=C):C=e[20];let w;e[21]!==k?(w=m.jsxs(sl,{children:[k,C]}),e[21]=k,e[22]=w):w=e[22];let S;return e[23]!==b||e[24]!==w?(S=m.jsxs(m.Fragment,{children:[b,w]}),e[23]=b,e[24]=w,e[25]=S):S=e[25],S}function r2(){const t=we(),{item:e}=vr(t);return e?.completed_at_epoch_ms!=null}function s2(){const t=we(),{item:e}=vr(t);return e?.status==="cancelled"}function o2(){const t=R.c(57),e=ju(),n=r2(),r=s2(),s=we(),o=Ln(),{handleRunWorkflow:i,isPending:l,requiresInput:a,inputSchema:c}=K1(),u=kr(),[d,f]=E.useState(!1),{handleCancelWorkflow:h,isCancelling:p}=J1(),{handleResumeWorkflow:g,isResuming:y}=G1(),x=s&&!n;let b;t[0]!==u?(b=u.some(i2),t[0]=u,t[1]=b):b=t[1];const k=b,C=!o,w=e||k||C||l||p,S=x||l;let v;t[2]!==k||t[3]!==C||t[4]!==e||t[5]!==r||t[6]!==S?(v=()=>r?"Workflow is currently cancelled":S?"Workflow is currently running":e?"Save your changes before running":C?"Select a gateway first":k?"Add at least one step to the workflow":null,t[2]=k,t[3]=C,t[4]=e,t[5]=r,t[6]=S,t[7]=v):v=t[7];const T=v();let I;t[8]!==h||t[9]!==g||t[10]!==i||t[11]!==c||t[12]!==r||t[13]!==S||t[14]!==a||t[15]!==s?(I=async()=>{if(a&&c){f(!0);return}if(r&&s){await g(s);return}if(S&&s){await h(s);return}await i({})},t[8]=h,t[9]=g,t[10]=i,t[11]=c,t[12]=r,t[13]=S,t[14]=a,t[15]=s,t[16]=I):I=t[16];const D=I;let $;t[17]!==i?($=async Ve=>{await i(Ve)},t[17]=i,t[18]=$):$=t[18];const V=$,F=r?"Resume":s?n?"Replay":"Running...":a?"Run with input...":"Run workflow",P=!x&&"bg-primary text-primary-foreground hover:bg-primary/90";let N;t[19]!==P?(N=Y("gap-2 h-7 px-3",P),t[19]=P,t[20]=N):N=t[20];let _;t[21]!==p||t[22]!==r||t[23]!==l||t[24]!==y||t[25]!==x?(_=(!x&&!l&&!p&&!y||r)&&m.jsx(ol,{size:14}),t[21]=p,t[22]=r,t[23]=l,t[24]=y,t[25]=x,t[26]=_):_=t[26];let L;t[27]!==p||t[28]!==r||t[29]!==l||t[30]!==y||t[31]!==x?(L=x&&!l&&!p&&!y&&!r&&m.jsx(Kp,{size:14}),t[27]=p,t[28]=r,t[29]=l,t[30]=y,t[31]=x,t[32]=L):L=t[32];let J;t[33]!==p||t[34]!==l||t[35]!==y?(J=(l||p||y)&&m.jsx(jn,{size:"xs"}),t[33]=p,t[34]=l,t[35]=y,t[36]=J):J=t[36];let Z;t[37]!==F||t[38]!==D||t[39]!==w||t[40]!==N||t[41]!==_||t[42]!==L||t[43]!==J?(Z=m.jsxs(me,{variant:"default",size:"sm",className:N,disabled:w,onClick:D,children:[_,L,J,F]}),t[37]=F,t[38]=D,t[39]=w,t[40]=N,t[41]=_,t[42]=L,t[43]=J,t[44]=Z):Z=t[44];const U=Z;let K;t[45]!==U||t[46]!==T?(K=T?m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:U})}),m.jsx(_t,{side:"bottom",children:T})]})}):U,t[45]=U,t[46]=T,t[47]=K):K=t[47];const ie=K;let ee;t[48]!==V||t[49]!==c||t[50]!==l||t[51]!==a||t[52]!==d?(ee=a&&c&&m.jsx(t2,{open:d,onOpenChange:f,inputSchema:c,onSubmit:V,isPending:l}),t[48]=V,t[49]=c,t[50]=l,t[51]=a,t[52]=d,t[53]=ee):ee=t[53];let G;return t[54]!==ie||t[55]!==ee?(G=m.jsxs(m.Fragment,{children:[ie,ee]}),t[54]=ie,t[55]=ee,t[56]=G):G=t[56],G}function i2(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function l2(){const t=R.c(17),e=we(),n=kr(),{item:r}=vr(e);if(!e||!r)return;let s;if(t[0]!==r.completed_steps?.error||t[1]!==r.completed_steps?.success||t[2]!==r.status||t[3]!==n){s={};let o;t[5]!==r.completed_steps?.success?(o=r.completed_steps?.success??[],t[5]=r.completed_steps?.success,t[6]=o):o=t[6];let i;t[7]!==o?(i=new Set(o),t[7]=o,t[8]=i):i=t[8];const l=i;let a;t[9]!==r.completed_steps?.error?(a=r.completed_steps?.error??[],t[9]=r.completed_steps?.error,t[10]=a):a=t[10];let c;t[11]!==a?(c=new Set(a),t[11]=a,t[12]=c):c=t[12];const u=c;let d;t[13]!==u||t[14]!==n||t[15]!==l?(d=-1,n.forEach((f,h)=>{(l.has(f.name)||u.has(f.name))&&(d=h)}),t[13]=u,t[14]=n,t[15]=l,t[16]=d):d=t[16],n.forEach((f,h)=>{let p="pending";u.has(f.name)?p="error":l.has(f.name)?p="success":r.status==="running"&&h===d+1&&(p="running"),s[f.name]={status:p,output:void 0,error:void 0,stepIndex:h}}),t[0]=r.completed_steps?.error,t[1]=r.completed_steps?.success,t[2]=r.status,t[3]=n,t[4]=s}else s=t[4];return s}function a2(t){const e=R.c(119),{step:n,index:r,isSelected:s,executionStatus:o,isSkipped:i,isLastStep:l,onSelect:a,onDelete:c,onDuplicate:u}=t,d=we(),{item:f}=vr(d),h=f?.completed_at_epoch_ms;let p;e[0]!==f?.completed_steps?.success||e[1]!==n.name?(p=f?.completed_steps?.success?.includes(n.name)??!1,e[0]=f?.completed_steps?.success,e[1]=n.name,e[2]=p):p=e[2];const g=p;let y;e[3]!==f?.completed_steps?.error||e[4]!==n.name?(y=f?.completed_steps?.error?.includes(n.name)??!1,e[3]=f?.completed_steps?.error,e[4]=n.name,e[5]=y):y=e[5];const x=y,b="toolName"in n.action,k=b&&"connectionId"in n.action?n.action.connectionId:null,w=!!(b&&"toolName"in n.action?n.action.toolName:null);let S,v,M,T,I,D,$,V,F,P,N;if(e[6]!==k||e[7]!==o||e[8]!==w||e[9]!==r||e[10]!==g||e[11]!==x||e[12]!==l||e[13]!==s||e[14]!==i||e[15]!==b||e[16]!==c||e[17]!==u||e[18]!==a||e[19]!==n||e[20]!==d){const U=b2(n);S=g?"success":x?"error":o?.status;const K=o!==void 0,ie=S==="success"||S==="error";let ee=U.length>0?60:12;(S==="success"||S==="error")&&(ee=ee+32);let G,Ve,ct;if(e[32]!==s||e[33]!==i||e[34]!==a||e[35]!==S){const zn=d2(S);let Tr;e[44]!==S?(Tr=f2(S),e[44]=S,e[45]=Tr):Tr=e[45],G=Tr;const wo=s&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",vo=S==="running"&&"bg-accent/50",So=i&&"opacity-50";e[46]!==wo||e[47]!==vo||e[48]!==So?(V=Y("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",wo,vo,So),e[46]=wo,e[47]=vo,e[48]=So,e[49]=V):V=e[49],F=a,P="button",N=0,e[50]!==a?(v=Co=>{(Co.key==="Enter"||Co.key===" ")&&(Co.preventDefault(),a())},e[50]=a,e[51]=v):v=e[51],ct="w-5 flex flex-col items-center justify-center shrink-0 pt-3",Ve=Y("text-xs font-mono opacity-75 h-8 flex items-center",zn),e[32]=s,e[33]=i,e[34]=a,e[35]=S,e[36]=G,e[37]=v,e[38]=Ve,e[39]=ct,e[40]=V,e[41]=F,e[42]=P,e[43]=N}else G=e[36],v=e[37],Ve=e[38],ct=e[39],V=e[40],F=e[41],P=e[42],N=e[43];const bo=r+1;let en;e[52]!==Ve||e[53]!==bo?(en=m.jsxs("span",{className:Ve,children:[bo,"."]}),e[52]=Ve,e[53]=bo,e[54]=en):en=e[54],e[55]!==ct||e[56]!==en?(M=m.jsx("div",{className:ct,children:en}),e[55]=ct,e[56]=en,e[57]=M):M=e[57];let tn;e[58]!==G||e[59]!==r?(tn=r>0?m.jsx(ci,{height:12,color:G}):m.jsx("div",{className:"h-3"}),e[58]=G,e[59]=r,e[60]=tn):tn=e[60];let nn;e[61]!==k||e[62]!==w||e[63]!==b||e[64]!==n.name?(nn=m.jsx(y2,{connectionId:k,isToolStep:b,hasToolSelected:w,stepName:n.name}),e[61]=k,e[62]=w,e[63]=b,e[64]=n.name,e[65]=nn):nn=e[65];let rn;e[66]!==G||e[67]!==ie||e[68]!==S?(rn=ie&&m.jsxs(m.Fragment,{children:[m.jsx(ci,{height:8,color:G}),m.jsx(h2,{status:S})]}),e[66]=G,e[67]=ie,e[68]=S,e[69]=rn):rn=e[69];let sn;e[70]!==G||e[71]!==ee||e[72]!==l||e[73]!==d?(sn=l&&d?null:m.jsx(ci,{height:ee,color:G}),e[70]=G,e[71]=ee,e[72]=l,e[73]=d,e[74]=sn):sn=e[74],e[75]!==tn||e[76]!==nn||e[77]!==rn||e[78]!==sn?(T=m.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[tn,nn,rn,sn]}),e[75]=tn,e[76]=nn,e[77]=rn,e[78]=sn,e[79]=T):T=e[79],I="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3";const ko=w?"font-medium text-foreground":"text-foreground";let on;e[80]!==ko?(on=Y("text-sm truncate flex-1",ko),e[80]=ko,e[81]=on):on=e[81];let ln;e[82]!==n?(ln=x2(n),e[82]=n,e[83]=ln):ln=e[83];let an;e[84]!==on||e[85]!==ln?(an=m.jsx("span",{className:on,children:ln}),e[84]=on,e[85]=ln,e[86]=an):an=e[86];let cn;e[87]!==K||e[88]!==S?(cn=K&&m.jsx(p2,{status:S}),e[87]=K,e[88]=S,e[89]=cn):cn=e[89];let un;e[90]!==K||e[91]!==c||e[92]!==u?(un=!K&&m.jsxs(em,{children:[m.jsx(tm,{asChild:!0,children:m.jsx(me,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:u2,children:m.jsx(Ip,{size:14})})}),m.jsxs(nm,{align:"end",children:[m.jsxs(ua,{onClick:zn=>{zn.stopPropagation(),u()},children:[m.jsx(sm,{size:14}),"Duplicate"]}),m.jsxs(ua,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:zn=>{zn.stopPropagation(),c()},children:[m.jsx(gp,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[90]=K,e[91]=c,e[92]=u,e[93]=un):un=e[93],e[94]!==an||e[95]!==cn||e[96]!==un?(D=m.jsxs("div",{className:"flex items-center h-8",children:[an,cn,un]}),e[94]=an,e[95]=cn,e[96]=un,e[97]=D):D=e[97],$=U.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1.5",children:U.map(c2)}),e[6]=k,e[7]=o,e[8]=w,e[9]=r,e[10]=g,e[11]=x,e[12]=l,e[13]=s,e[14]=i,e[15]=b,e[16]=c,e[17]=u,e[18]=a,e[19]=n,e[20]=d,e[21]=S,e[22]=v,e[23]=M,e[24]=T,e[25]=I,e[26]=D,e[27]=$,e[28]=V,e[29]=F,e[30]=P,e[31]=N}else S=e[21],v=e[22],M=e[23],T=e[24],I=e[25],D=e[26],$=e[27],V=e[28],F=e[29],P=e[30],N=e[31];let _;e[98]!==h||e[99]!==S?(_=S==="success"&&m.jsx(m2,{completedAtEpochMs:h}),e[98]=h,e[99]=S,e[100]=_):_=e[100];let L;e[101]!==o?.error||e[102]!==S?(L=S==="error"&&m.jsx(g2,{error:o?.error}),e[101]=o?.error,e[102]=S,e[103]=L):L=e[103];let J;e[104]!==_||e[105]!==L||e[106]!==I||e[107]!==D||e[108]!==$?(J=m.jsxs("div",{className:I,children:[D,$,_,L]}),e[104]=_,e[105]=L,e[106]=I,e[107]=D,e[108]=$,e[109]=J):J=e[109];let Z;return e[110]!==v||e[111]!==M||e[112]!==T||e[113]!==J||e[114]!==V||e[115]!==F||e[116]!==P||e[117]!==N?(Z=m.jsxs("div",{className:V,onClick:F,role:P,tabIndex:N,onKeyDown:v,children:[M,T,J]}),e[110]=v,e[111]=M,e[112]=T,e[113]=J,e[114]=V,e[115]=F,e[116]=P,e[117]=N,e[118]=Z):Z=e[118],Z}function c2(t){return m.jsx("span",{className:"px-1.5 py-1 text-xs text-muted-foreground bg-background border border-border rounded-lg",children:t},t)}function u2(t){return t.stopPropagation()}function d2(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function f2(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function h2(t){const e=R.c(2),{status:n}=t;if(n==="success"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-4 rounded bg-success flex items-center justify-center",children:m.jsx(rl,{size:8,className:"text-success-foreground"})}),e[0]=r):r=e[0],r}if(n==="error"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-4 rounded bg-destructive flex items-center justify-center",children:m.jsx(il,{size:8,className:"text-destructive-foreground"})}),e[1]=r):r=e[1],r}return null}function p2(t){const e=R.c(3),{status:n}=t;if(n==="success"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(rl,{size:11,className:"text-success"})}),e[0]=r):r=e[0],r}if(n==="error"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(il,{size:11,className:"text-destructive"})}),e[1]=r):r=e[1],r}if(n==="running"){let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(or,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=r):r=e[2],r}return null}function m2(t){const e=R.c(8),{completedAtEpochMs:n}=t;let r,s;if(e[0]!==n){const a=n!=null?new Date(n):null;r=a?a.toISOString().split("T")[0]:null,s=a?a.toTimeString().split(" ")[0]:null,e[0]=n,e[1]=r,e[2]=s}else r=e[1],s=e[2];const o=s;let i;e[3]!==r||e[4]!==o?(i=r&&o&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Op,{size:16,className:"text-success"}),m.jsx("span",{className:"text-xs text-success",children:r}),m.jsx("span",{className:"text-xs text-success",children:o})]}),e[3]=r,e[4]=o,e[5]=i):i=e[5];let l;return e[6]!==i?(l=m.jsx("div",{className:"inline-flex items-center gap-3 px-1.5 py-1 bg-success-foreground rounded-lg w-fit",children:i}),e[6]=i,e[7]=l):l=e[7],l}function g2(t){const e=R.c(3),{error:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx(dl,{size:16,className:"text-destructive"}),e[0]=r):r=e[0];const s=n||"Execution failed";let o;return e[1]!==s?(o=m.jsxs("div",{className:"inline-flex items-center gap-1.5 px-1.5 py-1 bg-destructive-foreground rounded-lg w-fit",children:[r,m.jsx("span",{className:"text-xs text-destructive",children:s})]}),e[1]=s,e[2]=o):o=e[2],o}function y2(t){const e=R.c(5),{connectionId:n,isToolStep:r,hasToolSelected:s,stepName:o}=t,i=Yi(n??"");if(r&&s&&i?.icon){let a;return e[0]!==i.icon||e[1]!==o?(a=m.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center overflow-hidden",children:m.jsx(Us,{icon:i.icon,name:o,size:"xs",className:"border-0 rounded-none"})}),e[0]=i.icon,e[1]=o,e[2]=a):a=e[2],a}let l;return e[3]!==r?(l=m.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center",children:r?m.jsx(Tu,{size:16,className:"text-muted-foreground"}):m.jsx(rm,{size:16,className:"text-muted-foreground"})}),e[3]=r,e[4]=l):l=e[4],l}function ci(t){const e=R.c(7),{height:n,color:r}=t,s=r===void 0?"bg-border":r;let o;e[0]!==s?(o=Y("w-px",s),e[0]=s,e[1]=o):o=e[1];let i;e[2]!==n?(i={height:n},e[2]=n,e[3]=i):i=e[3];let l;return e[4]!==o||e[5]!==i?(l=m.jsx("div",{className:o,style:i}),e[4]=o,e[5]=i,e[6]=l):l=e[6],l}function x2(t){return t.name?t.name:"toolName"in t.action&&t.action.toolName?t.action.toolName:"code"in t.action?t.name||"Code Step":"Select tool..."}function b2(t){const e=t.outputSchema;if(!e||typeof e!="object")return[];const n=e.properties;return!n||typeof n!="object"?[]:Object.keys(n).slice(0,5)}function k2(t){const e=R.c(32),{className:n}=t,r=kr(),s=Ru(),o=l2(),{setCurrentStepName:i,deleteStep:l,duplicateStep:a}=Me(),c=we();let u;e[0]!==o||e[1]!==r?(u=o?r.findIndex(k=>o[k.name]?.status==="error"):-1,e[0]=o,e[1]=r,e[2]=u):u=e[2];const d=u;let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=m.jsx("div",{children:"Loading..."}),e[3]=f):f=e[3];let h;e[4]!==n?(h=Y("h-full flex flex-col p-8 overflow-auto",n),e[4]=n,e[5]=h):h=e[5];let p;if(e[6]!==s||e[7]!==l||e[8]!==a||e[9]!==d||e[10]!==i||e[11]!==o||e[12]!==r){let k;e[14]!==s||e[15]!==l||e[16]!==a||e[17]!==d||e[18]!==i||e[19]!==o||e[20]!==r.length?(k=(C,w)=>{const S=o?.[C.name],v=d!==-1&&w>d&&S?.status==="pending",M=w===r.length-1;return m.jsx(a2,{step:C,index:w,isSelected:C.name===s,executionStatus:S,isSkipped:v,isLastStep:M,onSelect:()=>i(C.name),onDelete:()=>l(C.name),onDuplicate:()=>a(C.name)},C.name)},e[14]=s,e[15]=l,e[16]=a,e[17]=d,e[18]=i,e[19]=o,e[20]=r.length,e[21]=k):k=e[21],p=r.map(k),e[6]=s,e[7]=l,e[8]=a,e[9]=d,e[10]=i,e[11]=o,e[12]=r,e[13]=p}else p=e[13];let g;e[22]!==p?(g=m.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=g):g=e[23];let y;e[24]!==c?(y=c?null:m.jsx(w2,{}),e[24]=c,e[25]=y):y=e[25];let x;e[26]!==g||e[27]!==y?(x=m.jsxs("div",{className:"w-full -space-y-1",children:[g,y]}),e[26]=g,e[27]=y,e[28]=x):x=e[28];let b;return e[29]!==h||e[30]!==x?(b=m.jsx(E.Suspense,{fallback:f,children:m.jsx("div",{className:h,children:x})}),e[29]=h,e[30]=x,e[31]=b):b=e[31],b}function w2(){const t=R.c(8),{addToolStep:e}=Me();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=m.jsx("div",{className:"w-5 shrink-0"}),t[0]=n):n=t[0];let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"w-px h-3 bg-border"}),t[1]=r):r=t[1];let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx(ul,{size:14}),t[2]=s):s=t[2];let o;t[3]!==e?(o=m.jsx(me,{variant:"outline",size:"icon",className:"size-8 rounded-lg",onClick:e,children:s}),t[3]=e,t[4]=o):o=t[4];let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx("div",{className:"w-px h-8",style:{backgroundImage:"repeating-linear-gradient(180deg, var(--border), var(--border) 4px, transparent 4px, transparent 8px)",backgroundPosition:"left top",backgroundRepeat:"repeat-y",backgroundSize:"2px 100%"}}),t[5]=i):i=t[5];let l;return t[6]!==o?(l=m.jsxs("div",{className:"flex gap-2 items-start px-4 pb-3",children:[n,m.jsxs("div",{className:"flex flex-col border-1 border-transparent items-center shrink-0",children:[r,o,i]})]}),t[6]=o,t[7]=l):l=t[7],l}function v2(){const t=R.c(5),e=Ln();let n;t[0]!==e?(n=e?new URL(`/mcp/gateway/${e}`,window.location.origin).href:"",t[0]=e,t[1]=n):n=t[1];const r=n,s=!!e;let o;return t[2]!==r||t[3]!==s?(o={url:r,enabled:s},t[2]=r,t[3]=s,t[4]=o):o=t[4],ll(o)}function S2(t){const e=R.c(7),{className:n}=t;if(!Ln()){let o;e[0]!==n?(o=Y("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=o):o=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground p-4 text-center",children:"Select a gateway to see available tools"}),e[2]=i):i=e[2];let l;return e[3]!==o?(l=m.jsx("div",{className:o,children:i}),e[3]=o,e[4]=l):l=e[4],l}let s;return e[5]!==n?(s=m.jsx(C2,{className:n}),e[5]=n,e[6]=s):s=e[6],s}function C2(t){const e=R.c(38),{className:n}=t,{tools:r,isLoading:s,error:o}=v2(),i=br(),{updateStep:l}=Me(),c=i&&"toolName"in i.action&&"toolName"in i.action?i.action.toolName:null;let u;if(e[0]!==c||e[1]!==r){let w;e[3]!==c?(w=S=>S.name===c,e[3]=c,e[4]=w):w=e[4],u=r.find(w),e[0]=c,e[1]=r,e[2]=u}else u=e[2];const f=Y1(r,u??null,N2,E2);let h;e[5]!==i||e[6]!==l?(h=w=>{i&&l(i.name,{action:{...i.action,toolName:w.name},outputSchema:w.outputSchema??{}})},e[5]=i,e[6]=l,e[7]=h):h=e[7];const p=h;if(s){let w;e[8]!==n?(w=Y("flex flex-col h-full bg-sidebar",n),e[8]=n,e[9]=w):w=e[9];let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=m.jsx("div",{className:"flex-1 flex items-center justify-center",children:m.jsx(jn,{size:"sm"})}),e[10]=S):S=e[10];let v;return e[11]!==w?(v=m.jsx("div",{className:w,children:S}),e[11]=w,e[12]=v):v=e[12],v}if(o){let w;e[13]!==n?(w=Y("flex flex-col h-full bg-sidebar",n),e[13]=n,e[14]=w):w=e[14];let S;e[15]!==o.message?(S=m.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-destructive p-4 text-center",children:["Failed to load tools: ",o.message]}),e[15]=o.message,e[16]=S):S=e[16];let v;return e[17]!==w||e[18]!==S?(v=m.jsx("div",{className:w,children:S}),e[17]=w,e[18]=S,e[19]=v):v=e[19],v}let g;e[20]!==n?(g=Y("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=g):g=e[21];let y;e[22]===Symbol.for("react.memo_cache_sentinel")?(y=m.jsx("span",{className:"text-base font-medium text-foreground",children:"Select tool"}),e[22]=y):y=e[22];let x;e[23]!==r.length?(x=m.jsx("div",{className:"flex items-start border-b border-border",children:m.jsxs("div",{className:"flex-1 flex items-center h-12 px-5",children:[y,m.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["(",r.length,")"]})]})}),e[23]=r.length,e[24]=x):x=e[24];let b;if(e[25]!==p||e[26]!==f||e[27]!==c){let w;e[29]!==p||e[30]!==c?(w=S=>m.jsx(T2,{icon:null,title:S.name,description:S.description,isSelected:S.name===c,onClick:()=>p(S)},S.name),e[29]=p,e[30]=c,e[31]=w):w=e[31],b=f.map(w),e[25]=p,e[26]=f,e[27]=c,e[28]=b}else b=e[28];let k;e[32]!==b?(k=m.jsx("div",{className:"flex-1 overflow-auto",children:b}),e[32]=b,e[33]=k):k=e[33];let C;return e[34]!==g||e[35]!==x||e[36]!==k?(C=m.jsxs("div",{className:g,children:[x,k]}),e[34]=g,e[35]=x,e[36]=k,e[37]=C):C=e[37],C}function E2(t,e){return t.name.localeCompare(e.name)}function N2(t){return t.name}function T2(t){const e=R.c(20),{icon:n,title:r,description:s,isSelected:o,onClick:i}=t,l=o&&"bg-muted/50";let a;e[0]!==l?(a=Y("flex items-start gap-2.5 min-h-14 px-5 py-4 cursor-pointer transition-colors","hover:bg-muted/50",l),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==i?(c=g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),i())},e[2]=i,e[3]=c):c=e[3];let u;e[4]!==n||e[5]!==r?(u=m.jsx(Us,{icon:n,name:r,size:"xs",className:"shadow-sm mt-0.5"}),e[4]=n,e[5]=r,e[6]=u):u=e[6];let d;e[7]!==r?(d=m.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:r}),e[7]=r,e[8]=d):d=e[8];let f;e[9]!==s?(f=s&&m.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:s}),e[9]=s,e[10]=f):f=e[10];let h;e[11]!==d||e[12]!==f?(h=m.jsxs("div",{className:"flex-1 min-w-0",children:[d,f]}),e[11]=d,e[12]=f,e[13]=h):h=e[13];let p;return e[14]!==i||e[15]!==a||e[16]!==c||e[17]!==u||e[18]!==h?(p=m.jsxs("div",{className:a,onClick:i,role:"button",tabIndex:0,onKeyDown:c,children:[u,h]}),e[14]=i,e[15]=a,e[16]=c,e[17]=u,e[18]=h,e[19]=p):p=e[19],p}var go="Collapsible",[M2,zh]=Ui(go),[O2,na]=M2(go),Bh=E.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...l}=t,[a,c]=qs({prop:r,defaultProp:s??!1,onChange:i,caller:go});return m.jsx(O2,{scope:n,disabled:o,contentId:iu(),open:a,onOpenToggle:E.useCallback(()=>c(u=>!u),[c]),children:m.jsx(Rn.div,{"data-state":sa(a),"data-disabled":o?"":void 0,...l,ref:e})})});Bh.displayName=go;var Fh="CollapsibleTrigger",Vh=E.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=na(Fh,n);return m.jsx(Rn.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":sa(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:He(t.onClick,s.onOpenToggle)})});Vh.displayName=Fh;var ra="CollapsibleContent",Hh=E.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=na(ra,t.__scopeCollapsible);return m.jsx(Ki,{present:n||s.open,children:({present:o})=>m.jsx(A2,{...r,ref:e,present:o})})});Hh.displayName=ra;var A2=E.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=t,i=na(ra,n),[l,a]=E.useState(r),c=E.useRef(null),u=Ji(e,c),d=E.useRef(0),f=d.current,h=E.useRef(0),p=h.current,g=i.open||l,y=E.useRef(g),x=E.useRef(void 0);return E.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),yp(()=>{const b=c.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const k=b.getBoundingClientRect();d.current=k.height,h.current=k.width,y.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),a(r)}},[i.open,r]),m.jsx(Rn.div,{"data-state":sa(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...o,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...t.style},children:g&&s})});function sa(t){return t?"open":"closed"}var I2=Bh,R2=Vh,j2=Hh,Ue="Accordion",D2=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[oa,P2,L2]=xp(Ue),[yo]=Ui(Ue,[L2,zh]),ia=zh(),Wh=X.forwardRef((t,e)=>{const{type:n,...r}=t,s=r,o=r;return m.jsx(oa.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?m.jsx(B2,{...o,ref:e}):m.jsx(z2,{...s,ref:e})})});Wh.displayName=Ue;var[qh,$2]=yo(Ue),[Uh,_2]=yo(Ue,{collapsible:!1}),z2=X.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:o=!1,...i}=t,[l,a]=qs({prop:n,defaultProp:r??"",onChange:s,caller:Ue});return m.jsx(qh,{scope:t.__scopeAccordion,value:X.useMemo(()=>l?[l]:[],[l]),onItemOpen:a,onItemClose:X.useCallback(()=>o&&a(""),[o,a]),children:m.jsx(Uh,{scope:t.__scopeAccordion,collapsible:o,children:m.jsx(Kh,{...i,ref:e})})})}),B2=X.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...o}=t,[i,l]=qs({prop:n,defaultProp:r??[],onChange:s,caller:Ue}),a=X.useCallback(u=>l((d=[])=>[...d,u]),[l]),c=X.useCallback(u=>l((d=[])=>d.filter(f=>f!==u)),[l]);return m.jsx(qh,{scope:t.__scopeAccordion,value:i,onItemOpen:a,onItemClose:c,children:m.jsx(Uh,{scope:t.__scopeAccordion,collapsible:!0,children:m.jsx(Kh,{...o,ref:e})})})}),[F2,xo]=yo(Ue),Kh=X.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:o="vertical",...i}=t,l=X.useRef(null),a=Ji(l,e),c=P2(n),d=bp(s)==="ltr",f=He(t.onKeyDown,h=>{if(!D2.includes(h.key))return;const p=h.target,g=c().filter(M=>!M.ref.current?.disabled),y=g.findIndex(M=>M.ref.current===p),x=g.length;if(y===-1)return;h.preventDefault();let b=y;const k=0,C=x-1,w=()=>{b=y+1,b>C&&(b=k)},S=()=>{b=y-1,b<k&&(b=C)};switch(h.key){case"Home":b=k;break;case"End":b=C;break;case"ArrowRight":o==="horizontal"&&(d?w():S());break;case"ArrowDown":o==="vertical"&&w();break;case"ArrowLeft":o==="horizontal"&&(d?S():w());break;case"ArrowUp":o==="vertical"&&S();break}const v=b%x;g[v].ref.current?.focus()});return m.jsx(F2,{scope:n,disabled:r,direction:s,orientation:o,children:m.jsx(oa.Slot,{scope:n,children:m.jsx(Rn.div,{...i,"data-orientation":o,ref:a,onKeyDown:r?void 0:f})})})}),Ws="AccordionItem",[V2,la]=yo(Ws),Jh=X.forwardRef((t,e)=>{const{__scopeAccordion:n,value:r,...s}=t,o=xo(Ws,n),i=$2(Ws,n),l=ia(n),a=iu(),c=r&&i.value.includes(r)||!1,u=o.disabled||t.disabled;return m.jsx(V2,{scope:n,open:c,disabled:u,triggerId:a,children:m.jsx(I2,{"data-orientation":o.orientation,"data-state":ep(c),...l,...s,ref:e,disabled:u,open:c,onOpenChange:d=>{d?i.onItemOpen(r):i.onItemClose(r)}})})});Jh.displayName=Ws;var Gh="AccordionHeader",Xh=X.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=xo(Ue,n),o=la(Gh,n);return m.jsx(Rn.h3,{"data-orientation":s.orientation,"data-state":ep(o.open),"data-disabled":o.disabled?"":void 0,...r,ref:e})});Xh.displayName=Gh;var Wi="AccordionTrigger",Yh=X.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=xo(Ue,n),o=la(Wi,n),i=_2(Wi,n),l=ia(n);return m.jsx(oa.ItemSlot,{scope:n,children:m.jsx(R2,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...l,...r,ref:e})})});Yh.displayName=Wi;var Qh="AccordionContent",Zh=X.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=xo(Ue,n),o=la(Qh,n),i=ia(n);return m.jsx(j2,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...i,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});Zh.displayName=Qh;function ep(t){return t?"open":"closed"}var H2=Wh,W2=Jh,q2=Xh,U2=Yh,K2=Zh;function J2(t){const e=R.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=m.jsx(H2,{"data-slot":"accordion",...n}),e[2]=n,e[3]=r):r=e[3],r}function G2(t){const e=R.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let s;e[3]!==n?(s=Y("border-b last:border-b-0",n),e[3]=n,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx(W2,{"data-slot":"accordion-item",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}function X2(t){const e=R.c(11);let n,r,s;e[0]!==t?({className:r,children:n,...s}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=s):(n=e[1],r=e[2],s=e[3]);let o;e[4]!==r?(o=Y("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium transition-all outline-none hover:bg-accent/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-90",r),e[4]=r,e[5]=o):o=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx(Ep,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200"}),e[6]=i):i=e[6];let l;return e[7]!==n||e[8]!==s||e[9]!==o?(l=m.jsx(q2,{className:"flex",children:m.jsxs(U2,{"data-slot":"accordion-trigger",className:o,...s,children:[n,i]})}),e[7]=n,e[8]=s,e[9]=o,e[10]=l):l=e[10],l}function Y2(t){const e=R.c(12);let n,r,s;e[0]!==t?({className:r,children:n,...s}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=s):(n=e[1],r=e[2],s=e[3]);let o;e[4]!==r?(o=Y("pt-0 pb-4",r),e[4]=r,e[5]=o):o=e[5];let i;e[6]!==n||e[7]!==o?(i=m.jsx("div",{className:o,children:n}),e[6]=n,e[7]=o,e[8]=i):i=e[8];let l;return e[9]!==s||e[10]!==i?(l=m.jsx(K2,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...s,children:i}),e[9]=s,e[10]=i,e[11]=l):l=e[11],l}var Q2=(t,e,n,r,s,o,i,l)=>{let a=document.documentElement,c=["light","dark"];function u(h){(Array.isArray(t)?t:[t]).forEach(p=>{let g=p==="class",y=g&&o?s.map(x=>o[x]||x):s;g?(a.classList.remove(...y),a.classList.add(o&&o[h]?o[h]:h)):a.setAttribute(p,h)}),d(h)}function d(h){l&&c.includes(h)&&(a.style.colorScheme=h)}function f(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)u(r);else try{let h=localStorage.getItem(e)||n,p=i&&h==="system"?f():h;u(p)}catch{}};E.createContext(void 0);E.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:o,value:i,themes:l,nonce:a,scriptProps:c})=>{let u=JSON.stringify([n,e,o,t,l,i,r,s]).slice(1,-1);return E.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?a:"",dangerouslySetInnerHTML:{__html:`(${Q2.toString()})(${u})`}})});function Z2(t){const{updateStep:e}=Me(),r=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:s}=aa(r??"");t&&r&&s?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:s.outputSchema})})}function eC(t){const e=R.c(25),{className:n}=t,r=br(),{appendStep:s}=Me();if(Z2(r),!r){let f;e[0]!==n?(f=Y("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=f):f=e[1];let h;e[2]!==s?(h=()=>{s({type:"tool"})},e[2]=s,e[3]=h):h=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(ul,{size:14}),e[4]=p):p=e[4];let g;e[5]!==h?(g=m.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground gap-2 flex-col",children:["Select or create a step to configure",m.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:h,children:p})]}),e[5]=h,e[6]=g):g=e[6];let y;return e[7]!==f||e[8]!==g?(y=m.jsx("div",{className:f,children:g}),e[7]=f,e[8]=g,e[9]=y):y=e[9],y}let o;e[10]!==n?(o=Y("flex flex-col h-full bg-sidebar overflow-hidden",n),e[10]=n,e[11]=o):o=e[11];let i,l,a,c,u;e[12]!==r?(i=m.jsx(tC,{step:r}),l=m.jsx(rC,{step:r}),a=m.jsx(sC,{step:r}),c=m.jsx(aC,{step:r}),u=m.jsx(cC,{step:r}),e[12]=r,e[13]=i,e[14]=l,e[15]=a,e[16]=c,e[17]=u):(i=e[13],l=e[14],a=e[15],c=e[16],u=e[17]);let d;return e[18]!==o||e[19]!==i||e[20]!==l||e[21]!==a||e[22]!==c||e[23]!==u?(d=m.jsxs("div",{className:o,children:[i,l,a,c,u]}),e[18]=o,e[19]=i,e[20]=l,e[21]=a,e[22]=c,e[23]=u,e[24]=d):d=e[24],d}function tC(t){const e=R.c(15),{step:n}=t,s="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,o=we(),i=s??"";let l;e[0]!==i?(l=m.jsx(Us,{icon:null,name:i,size:"xs",className:"shadow-sm"}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s?(a=m.jsx("span",{className:"text-base font-medium text-foreground truncate flex-1",children:s}),e[2]=s,e[3]=a):a=e[3];let c;e[4]!==o?(c=o?null:m.jsx(nC,{}),e[4]=o,e[5]=c):c=e[5];let u;e[6]!==l||e[7]!==a||e[8]!==c?(u=m.jsxs("div",{className:"flex items-center gap-2",children:[l,a,c]}),e[6]=l,e[7]=a,e[8]=c,e[9]=u):u=e[9];let d;e[10]!==n.description?(d=n.description&&m.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[10]=n.description,e[11]=d):d=e[11];let f;return e[12]!==u||e[13]!==d?(f=m.jsxs("div",{className:"border-b border-border p-5 shrink-0 flex flex-col gap-2",children:[u,d]}),e[12]=u,e[13]=d,e[14]=f):f=e[14],f}function nC(){const t=R.c(9),e=br(),{updateStep:n,startReplacingTool:r}=Me(),s=we(),i=e&&"toolName"in e.action?e.action.toolName:null;let l;t[0]!==e||t[1]!==r||t[2]!==i||t[3]!==s||t[4]!==n?(l=()=>{if(e){if(s){ru.error("You cannot replace a tool while a workflow is executing.");return}i&&r(i),n(e.name,{action:{...e.action,toolName:""}})}},t[0]=e,t[1]=r,t[2]=i,t[3]=s,t[4]=n,t[5]=l):l=t[5];const a=l;let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c=m.jsx(Nu,{size:14}),t[6]=c):c=t[6];let u;return t[7]!==a?(u=m.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:a,title:"Replace tool",children:c}),t[7]=a,t[8]=u):u=t[8],u}function aa(t){const e=R.c(13),n=Ln();let r;e[0]!==n?(r=n?new URL(`/mcp/gateway/${n}`,window.location.origin).href:"",e[0]=n,e[1]=r):r=e[1];const s=r,o=!!n;let i;e[2]!==s||e[3]!==o?(i={url:s,enabled:o},e[2]=s,e[3]=o,e[4]=i):i=e[4];const l=ll(i);let a;e[5]!==l.tools||e[6]!==t?(a=l.tools?.find(h=>h.name===t),e[5]=l.tools,e[6]=t,e[7]=a):a=e[7];const c=a,u=l.state==="connecting",d=l.state==="ready";let f;return e[8]!==l.error||e[9]!==u||e[10]!==d||e[11]!==c?(f={tool:c,isLoading:u,isReady:d,error:l.error},e[8]=l.error,e[9]=u,e[10]=d,e[11]=c,e[12]=f):f=e[12],f}function rC(t){const e=R.c(13),{step:n}=t,{updateStep:r}=Me(),o="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,i=we(),{tool:l}=aa(o??"");if(!l||!l.inputSchema)return null;let a;e[0]!==n.name||e[1]!==r?(a=x=>{r(n.name,{input:x})},e[0]=n.name,e[1]=r,e[2]=a):a=e[2];const c=a,u=i?"output":"input";let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=m.jsx(X2,{className:"px-5 py-5",children:m.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[3]=d):d=e[3];const f=l.inputSchema,h=n.input;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[4]=p):p=e[4];let g;e[5]!==c||e[6]!==n.name||e[7]!==f||e[8]!==h?(g=m.jsxs(G2,{value:"input",className:"border-b-0",children:[d,m.jsx(Y2,{className:"px-5 pt-2",children:m.jsx(_h,{inputSchema:f,inputParams:h,setInputParams:c,mentions:p},n.name)})]}),e[5]=c,e[6]=n.name,e[7]=f,e[8]=h,e[9]=g):g=e[9];let y;return e[10]!==u||e[11]!==g?(y=m.jsx(J2,{type:"single",collapsible:!0,defaultValue:u,className:"border-b border-border shrink-0",children:g}),e[10]=u,e[11]=g,e[12]=y):y=e[12],y}function sC(t){const e=R.c(24),{step:n}=t,r=n.outputSchema,[s,o]=E.useState(!1),i=we(),{output:l,error:a}=F1(i,n.name);let c;e[0]!==a||e[1]!==l?(c=l||(a?{error:a}:null),e[0]=a,e[1]=l,e[2]=c):c=e[2];const u=c,d=r&&typeof r=="object"?r.properties:void 0;let f;e[3]!==d?(f=d?Object.entries(d):[],e[3]=d,e[4]=f):f=e[4];const h=f,p=s?"flex-1 min-h-0 overflow-hidden":"shrink-0";let g;e[5]!==p?(g=Y("flex flex-col border-b border-border",p),e[5]=p,e[6]=g):g=e[6];let y;e[7]!==s?(y=()=>o(!s),e[7]=s,e[8]=y):y=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=m.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Output"}),e[9]=x):x=e[9];let b;e[10]!==s?(b=m.jsxs("div",{className:"flex items-center justify-between",children:[x,s?m.jsx(gu,{size:14,className:"text-muted-foreground"}):m.jsx(mu,{size:14,className:"text-muted-foreground"})]}),e[10]=s,e[11]=b):b=e[11];let k;e[12]!==y||e[13]!==b?(k=m.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:y,children:b}),e[12]=y,e[13]=b,e[14]=k):k=e[14];let C;e[15]!==u||e[16]!==s||e[17]!==h||e[18]!==i?(C=s&&m.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:[i?m.jsx(Xs,{code:JSON.stringify(u,null,2),language:"json",height:"100%",readOnly:!0}):null,!i&&h.map(oC)]}),e[15]=u,e[16]=s,e[17]=h,e[18]=i,e[19]=C):C=e[19];let w;return e[20]!==g||e[21]!==k||e[22]!==C?(w=m.jsxs("div",{className:g,children:[k,C]}),e[20]=g,e[21]=k,e[22]=C,e[23]=w):w=e[23],w}function oC(t){const[e,n]=t;return m.jsx(lC,{name:e,schema:n},e)}function iC(t){switch(t){case"string":return{Icon:ku,color:"text-blue-500"};case"number":case"integer":return{Icon:xu,color:"text-blue-500"};case"array":return{Icon:pu,color:"text-purple-500"};case"object":return{Icon:hu,color:"text-orange-500"};case"boolean":return{Icon:bu,color:"text-pink-500"};case"null":return{Icon:Gi,color:"text-gray-500"};default:return{Icon:yu,color:"text-muted-foreground"}}}function lC(t){const e=R.c(28),{name:n,schema:r}=t,s=br(),o=r.type??"unknown";let i,l,a,c,u;if(e[0]!==o){const{Icon:C,color:w}=iC(o);u="flex items-center gap-2",c="flex-1 flex items-center gap-2",i=C,l=14,a=Y(w),e[0]=o,e[1]=i,e[2]=l,e[3]=a,e[4]=c,e[5]=u}else i=e[1],l=e[2],a=e[3],c=e[4],u=e[5];let d;e[6]!==i||e[7]!==l||e[8]!==a?(d=m.jsx(i,{size:l,className:a}),e[6]=i,e[7]=l,e[8]=a,e[9]=d):d=e[9];let f;e[10]!==n?(f=m.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[10]=n,e[11]=f):f=e[11];let h;e[12]!==c||e[13]!==d||e[14]!==f?(h=m.jsxs("div",{className:c,children:[d,f]}),e[12]=c,e[13]=d,e[14]=f,e[15]=h):h=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(Cu,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const g=s?.name;let y;e[17]!==g?(y=m.jsxs("span",{className:"text-muted-foreground",children:[g,"."]}),e[17]=g,e[18]=y):y=e[18];let x;e[19]!==n?(x=m.jsx("div",{className:"bg-blue-500/10 text-blue-500 px-1 py-0.5 rounded",children:n}),e[19]=n,e[20]=x):x=e[20];let b;e[21]!==y||e[22]!==x?(b=m.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p,y,x]}),e[21]=y,e[22]=x,e[23]=b):b=e[23];let k;return e[24]!==b||e[25]!==u||e[26]!==h?(k=m.jsxs("div",{className:u,children:[h,b]}),e[24]=b,e[25]=u,e[26]=h,e[27]=k):k=e[27],k}function aC(t){const e=R.c(29),{step:n}=t,{updateStep:r}=Me(),s=we(),o="toolName"in n.action,i=o&&"toolName"in n.action?n.action.toolName:null,{tool:l}=aa(i??""),a=o&&"transformCode"in n.action?n.action.transformCode??null:null,c=!!a;let u;e[0]!==l?(u=()=>{if(!l?.outputSchema)return`interface Input {
|
|
164
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=o=>{const i=Ri(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return i?[{type:"taskList",raw:i.raw,items:i.items}]:n.blockTokens(o)},s=Ri(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ue.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(dh.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(fh.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(xh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(kh.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Nv.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Tv.configure(this.options.taskList)),t}});var Mv=Ie.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",se(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ov=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Av=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Iv=Zt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",se(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[An({find:Ov,type:this.type})]},addPasteRules(){return[Xt({find:Av,type:this.type})]}}),Rv=Ie.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),jv=Zt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",se(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Dv(t={}){return new oe({view(e){return new Pv(e,t)}})}class Pv{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,l=o.height/s.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!o){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=gd(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ae extends q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ae.valid(r)?new ae(r):q.near(r)}content(){return j.empty}eq(e){return e instanceof ae&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ae(e.resolve(n.pos))}getBookmark(){return new Zl(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Lv(e)||!$v(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ae.valid(e))return e;let s=e.pos,o=null;for(let i=e.depth;;i--){let l=e.node(i);if(n>0?e.indexAfter(i)<l.childCount:e.index(i)>0){o=l.child(n>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;s+=n;let a=e.doc.resolve(s);if(ae.valid(a))return a}for(;;){let i=n>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!B.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*n),r=!1;continue e}break}o=i,s+=n;let l=e.doc.resolve(s);if(ae.valid(l))return l}return null}}}ae.prototype.visible=!1;ae.findFrom=ae.findGapCursorFrom;q.jsonID("gapcursor",ae);class Zl{constructor(e){this.pos=e}map(e){return new Zl(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ae.valid(n)?new ae(n):q.near(n)}}function wh(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Lv(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||wh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function $v(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||wh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function _v(){return new oe({props:{decorations:Vv,createSelectionBetween(t,e,n){return e.pos==n.pos&&ae.valid(n)?new ae(n):null},handleClick:Bv,handleKeyDown:zv,handleDOMEvents:{beforeinput:Fv}}})}const zv=xf({ArrowLeft:Hr("horiz",-1),ArrowRight:Hr("horiz",1),ArrowUp:Hr("vert",-1),ArrowDown:Hr("vert",1)});function Hr(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,o){let i=r.selection,l=e>0?i.$to:i.$from,a=i.empty;if(i instanceof H){if(!o.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ae.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new ae(c))),!0):!1}}function Bv(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ae.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&B.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ae(r))),!0)}function Fv(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ae))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=O.empty;for(let i=r.length-1;i>=0;i--)s=O.from(r[i].createAndFill(null,s));let o=t.state.tr.replace(n.pos,n.pos,new j(s,0,0));return o.setSelection(H.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function Vv(t){if(!(t.selection instanceof ae))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",re.create(t.doc,[Se.widget(t.selection.head,e,{key:"gapcursor"})])}var Fs=200,ye=function(){};ye.prototype.append=function(e){return e.length?(e=ye.from(e),!this.length&&e||e.length<Fs&&this.leafAppend(e)||this.length<Fs&&e.leafPrepend(this)||this.appendInner(e)):this};ye.prototype.prepend=function(e){return e.length?ye.from(e).append(this):this};ye.prototype.appendInner=function(e){return new Hv(this,e)};ye.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ye.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ye.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ye.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};ye.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(o,i){return s.push(e(o,i))},n,r),s};ye.from=function(e){return e instanceof ye?e:e&&e.length?new vh(e):ye.empty};var vh=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,i,l){for(var a=o;a<i;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,l){for(var a=o-1;a>=i;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Fs)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Fs)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(ye);ye.empty=new vh([]);var Hv=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,o,i){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(o,l),i)===!1||o>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,o)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,i){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(o,l)-l,i+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(s,l),o,i)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(r,s):r>=o?this.right.slice(r-o,s-o):this.left.slice(r,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ye);const Wv=500;class We{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,o;n&&(s=this.remapping(r,this.items.length),o=s.maps.length);let i=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),o=s.maps.length),o--,u.push(d);return}if(s){u.push(new dt(d.map));let h=d.step.map(s.slice(o)),p;h&&i.maybeStep(h).doc&&(p=i.mapping.maps[i.mapping.maps.length-1],c.push(new dt(p,void 0,void 0,c.length+u.length))),o--,p&&s.appendMap(p,o)}else i.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(o)):d.selection,a=new We(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,n,r,s){let o=[],i=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new dt(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?o.pop():l=l.slice(0,l.length-1)),o.push(f),n&&(i++,n=void 0),s||(a=f)}let c=i-r.depth;return c>Uv&&(l=qv(l,c),i-=c),new We(l.append(o),i)}remapping(e,n){let r=new cr;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,i)},e,n),r}addMaps(e){return this.eventCount==0?this:new We(this.items.append(e.map(n=>new dt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),o=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=n;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;i=Math.min(i,h);let p=o.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(o.slice(a+1,h));y&&l++,r.push(new dt(p,g,y))}else r.push(new dt(p))},s);let c=[];for(let f=n;f<i;f++)c.push(new dt(o.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new We(u,l);return d.emptyItemCount()>Wv&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],o=0;return this.items.forEach((i,l)=>{if(l>=e)s.push(i),i.selection&&o++;else if(i.step){let a=i.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=i.selection&&i.selection.map(n.slice(r));u&&o++;let d=new dt(c.invert(),a,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else i.map&&r--},this.items.length,0),new We(ye.from(s.reverse()),o)}}We.empty=new We(ye.empty,0);function qv(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}let dt=class Sh{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Sh(n.getMap().invert(),n,this.selection)}}};class mt{constructor(e,n,r,s,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const Uv=20;function Kv(t,e,n,r){let s=n.getMeta(qt),o;if(s)return s.historyState;n.getMeta(Xv)&&(t=new mt(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(qt))return i.getMeta(qt).redo?new mt(t.done.addTransform(n,void 0,r,Gr(e)),t.undone,Yc(n.mapping.maps),t.prevTime,t.prevComposition):new mt(t.done,t.undone.addTransform(n,void 0,r,Gr(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!i&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Jv(n,t.prevRanges)),c=i?oi(t.prevRanges,n.mapping):Yc(n.mapping.maps);return new mt(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Gr(e)),We.empty,c,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new mt(t.done.rebased(n,o),t.undone.rebased(n,o),oi(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new mt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),oi(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Jv(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&s>=e[o]&&(n=!0)}),n}function Yc(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,o,i)=>e.push(o,i));return e}function oi(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),o=e.map(t[r+1],-1);s<=o&&n.push(s,o)}return n}function Gv(t,e,n){let r=Gr(e),s=qt.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let i=o.selection.resolve(o.transform.doc),l=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),s,r),a=new mt(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(qt,{redo:n,historyState:a})}let ii=!1,Qc=null;function Gr(t){let e=t.plugins;if(Qc!=e){ii=!1,Qc=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ii=!0;break}}return ii}const qt=new ce("history"),Xv=new ce("closeHistory");function Yv(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new oe({key:qt,state:{init(){return new mt(We.empty,We.empty,null,0,-1)},apply(e,n,r){return Kv(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?Eh:r=="historyRedo"?Nh:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function Ch(t,e){return(n,r)=>{let s=qt.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let o=Gv(s,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const Eh=Ch(!1,!0),Nh=Ch(!0,!0);ue.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new oe({key:new ce("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const i=o-s,l=0,a=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=r||s>r&&o>r&&o<=s)return!0;if(s>r&&o>r&&o>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Qv=ue.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Dv(this.options)]}});ue.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new oe({key:new ce("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,o=[];if(!n||!r)return re.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;i+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(Se.node(c,c+a.nodeSize,{class:this.options.className}))}),re.create(t,o)}}})]}});var Zv=ue.create({name:"gapCursor",addProseMirrorPlugins(){return[_v()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Q(z(t,"allowGapCursor",n)))!=null?e:null}}});ue.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new oe({key:new ce("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!n)return null;const o=this.editor.isEmpty;return t.descendants((i,l)=>{const a=r>=l&&r<=l+i.nodeSize,c=!i.isLeaf&&ao(i);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const d=Se.node(l,l+i.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:l,hasAnchor:a}):this.options.placeholder});s.push(d)}return this.options.includeChildren}),re.create(t,s)}}})]}});ue.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new oe({key:new ce("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Df(n.selection)||t.view.dragging?null:re.create(n.doc,[Se.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Zc({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var eS=ue.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ce(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new oe({key:e,appendTransaction:(s,o,i)=>{const{doc:l,tr:a,schema:c}=i,u=e.getState(i),d=l.content.size,f=c.nodes[n];if(u)return a.insert(d,f.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!Zc({node:i,types:r})},apply:(s,o)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return o;const i=s.doc.lastChild;return!Zc({node:i,types:r})}}})]}}),tS=ue.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Eh(t,e),redo:()=>({state:t,dispatch:e})=>Nh(t,e)}},addProseMirrorPlugins(){return[Yv(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),nS=ue.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(Ow.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Cw.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(dh.configure(this.options.bulletList)),this.options.code!==!1&&s.push(Rw.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(Pw.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(Lw.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(Qv.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(Zv.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push($w.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(_w.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(tS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(zw.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(Ww.configure(this.options.italic)),this.options.listItem!==!1&&s.push(fh.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(xh.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(mv.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(kh.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Mv.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(Iv.configure(this.options.strike)),this.options.text!==!1&&s.push(Rv.configure(this.options.text)),this.options.underline!==!1&&s.push(jv.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(eS.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),rS=nS;function sS(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:i,$position:l}=t,a=r&&!s,c=Gk(n),u=new RegExp(`\\s${c}$`),d=i?"^":"",f=s?"":c,h=a?new RegExp(`${d}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${d}(?:^)?${c}[^\\s${f}]*`,"gm"),p=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!p)return null;const g=l.pos-p.length,y=Array.from(p.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const x=y.input.slice(Math.max(0,y.index-1),y.index),b=new RegExp(`^[${o?.join("")}\0]?$`).test(x);if(o!==null&&!b)return null;const k=g+y.index;let C=k+y[0].length;return a&&u.test(p.slice(C-1,C+1))&&(y[0]+=" ",C+=1),k<l.pos&&C>=l.pos?{range:{from:k,to:C},query:y[0].slice(n.length),text:y[0]}:null}var oS=new ce("suggestion");function iS({pluginKey:t=oS,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:o=[" "],startOfLine:i=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:c="",decorationEmptyClass:u="is-empty",command:d=()=>null,items:f=()=>[],render:h=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=sS,shouldShow:y}){let x;const b=h?.(),k=()=>{const v=e.state.selection.$anchor.pos,M=e.view.coordsAtPos(v),{top:T,right:I,bottom:D,left:$}=M;try{return new DOMRect($,T,I-$,D-T)}catch{return null}},C=(v,M)=>M?()=>{const T=t.getState(e.state),I=T?.decorationId,D=v.dom.querySelector(`[data-decoration-id="${I}"]`);return D?.getBoundingClientRect()||null}:k;function w(v,M){var T;try{const D=t.getState(v.state),$=D?.decorationId?v.dom.querySelector(`[data-decoration-id="${D.decorationId}"]`):null,V={editor:e,range:D?.range||{from:0,to:0},query:D?.query||null,text:D?.text||null,items:[],command:F=>d({editor:e,range:D?.range||{from:0,to:0},props:F}),decorationNode:$,clientRect:C(v,$)};(T=b?.onExit)==null||T.call(b,V)}catch{}const I=v.state.tr.setMeta(M,{exit:!0});v.dispatch(I)}const S=new oe({key:t,view(){return{update:async(v,M)=>{var T,I,D,$,V,F,P;const N=(T=this.key)==null?void 0:T.getState(M),_=(I=this.key)==null?void 0:I.getState(v.state),L=N.active&&_.active&&N.range.from!==_.range.from,J=!N.active&&_.active,Z=N.active&&!_.active,U=!J&&!Z&&N.query!==_.query,K=J||L&&U,ie=U||L,ee=Z||L&&U;if(!K&&!ie&&!ee)return;const G=ee&&!K?N:_,Ve=v.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);x={editor:e,range:G.range,query:G.query,text:G.text,items:[],command:ct=>d({editor:e,range:G.range,props:ct}),decorationNode:Ve,clientRect:C(v,Ve)},K&&((D=b?.onBeforeStart)==null||D.call(b,x)),ie&&(($=b?.onBeforeUpdate)==null||$.call(b,x)),(ie||K)&&(x.items=await f({editor:e,query:G.query})),ee&&((V=b?.onExit)==null||V.call(b,x)),ie&&((F=b?.onUpdate)==null||F.call(b,x)),K&&((P=b?.onStart)==null||P.call(b,x))},destroy:()=>{var v;x&&((v=b?.onExit)==null||v.call(b,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(v,M,T,I){const{isEditable:D}=e,{composing:$}=e.view,{selection:V}=v,{empty:F,from:P}=V,N={...M},_=v.getMeta(t);if(_&&_.exit)return N.active=!1,N.decorationId=null,N.range={from:0,to:0},N.query=null,N.text=null,N;if(N.composing=$,D&&(F||e.view.composing)){(P<M.range.from||P>M.range.to)&&!$&&!M.composing&&(N.active=!1);const L=g({char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:i,$position:V.$from}),J=`id_${Math.floor(Math.random()*4294967295)}`;L&&p({editor:e,state:I,range:L.range,isActive:M.active})&&(!y||y({editor:e,range:L.range,query:L.query,text:L.text,transaction:v}))?(N.active=!0,N.decorationId=M.decorationId?M.decorationId:J,N.range=L.range,N.query=L.query,N.text=L.text):N.active=!1}else N.active=!1;return N.active||(N.decorationId=null,N.range={from:0,to:0},N.query=null,N.text=null),N}},props:{handleKeyDown(v,M){var T,I,D,$;const{active:V,range:F}=S.getState(v.state);if(!V)return!1;if(M.key==="Escape"||M.key==="Esc"){const N=S.getState(v.state),_=(T=x?.decorationNode)!=null?T:null,L=_??(N?.decorationId?v.dom.querySelector(`[data-decoration-id="${N.decorationId}"]`):null);if(((I=b?.onKeyDown)==null?void 0:I.call(b,{view:v,event:M,range:N.range}))||!1)return!0;const Z={editor:e,range:N.range,query:N.query,text:N.text,items:[],command:U=>d({editor:e,range:N.range,props:U}),decorationNode:L,clientRect:L?()=>L.getBoundingClientRect()||null:null};return(D=b?.onExit)==null||D.call(b,Z),w(v,t),!0}return(($=b?.onKeyDown)==null?void 0:$.call(b,{view:v,event:M,range:F}))||!1},decorations(v){const{active:M,range:T,decorationId:I,query:D}=S.getState(v);if(!M)return null;const $=!D?.length,V=[a];return $&&V.push(u),re.create(v.doc,[Se.inline(T.from,T.to,{nodeName:l,class:V.join(" "),"data-decoration-id":I,"data-decoration-content":c})])}}});return S}function lS({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const s=new ce;return{editor:t,char:r,pluginKey:s,command:({editor:o,range:i,props:l})=>{var a,c,u;const d=o.view.state.selection.$to.nodeAfter;(a=d?.text)!=null&&a.startsWith(" ")&&(i.to+=1),o.chain().focus().insertContentAt(i,[{type:n,attrs:{...l,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(u=(c=o.view.dom.ownerDocument.defaultView)==null?void 0:c.getSelection())==null||u.collapseToEnd()},allow:({state:o,range:i})=>{const l=o.doc.resolve(i.from),a=o.schema.nodes[n];return!!l.parent.type.contentMatch.matchType(a)},...e}}function Th(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>lS({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function eu(t,e){const n=Th(t),r=n.find(s=>s.char===e);return r||(n.length?n[0]:null)}var aS=Ie.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e?.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,s;return["span",se(this.HTMLAttributes,t.HTMLAttributes),`${(r=n?.char)!=null?r:"@"}${(s=e.attrs.label)!=null?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=eu(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",se({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=se({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof s=="string"?["span",se({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...Yf({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,o,i]=r,l=o??i;e[s==="char"?"mentionSuggestionChar":s]=l,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:eu(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:s,anchor:o}=r;if(!s)return!1;let i=new ze,l=0;return e.doc.nodesBetween(o-1,o,(a,c)=>{if(a.type.name===this.name)return n=!0,i=a,l=c,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":i.attrs.mentionSuggestionChar,l,l+i.nodeSize),n})}},addProseMirrorPlugins(){return Th(this).map(iS)}}),cS=aS,li,ho="HoverCard",[Mh]=Ui(ho,[ou]),po=ou(),[uS,mo]=Mh(ho),Oh=t=>{const{__scopeHoverCard:e,children:n,open:r,defaultOpen:s,onOpenChange:o,openDelay:i=700,closeDelay:l=300}=t,a=po(e),c=E.useRef(0),u=E.useRef(0),d=E.useRef(!1),f=E.useRef(!1),[h,p]=qs({prop:r,defaultProp:s??!1,onChange:o,caller:ho}),g=E.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>p(!0),i)},[i,p]),y=E.useCallback(()=>{clearTimeout(c.current),!d.current&&!f.current&&(u.current=window.setTimeout(()=>p(!1),l))},[l,p]),x=E.useCallback(()=>p(!1),[p]);return E.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),m.jsx(uS,{scope:e,open:h,onOpenChange:p,onOpen:g,onClose:y,onDismiss:x,hasSelectionRef:d,isPointerDownOnContentRef:f,children:m.jsx(fp,{...a,children:n})})};Oh.displayName=ho;var Ah="HoverCardTrigger",Ih=E.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,s=mo(Ah,n),o=po(n);return m.jsx(up,{asChild:!0,...o,children:m.jsx(Rn.a,{"data-state":s.open?"open":"closed",...r,ref:e,onPointerEnter:He(t.onPointerEnter,Hs(s.onOpen)),onPointerLeave:He(t.onPointerLeave,Hs(s.onClose)),onFocus:He(t.onFocus,s.onOpen),onBlur:He(t.onBlur,s.onClose),onTouchStart:He(t.onTouchStart,i=>i.preventDefault())})})});Ih.displayName=Ah;var ea="HoverCardPortal",[dS,fS]=Mh(ea,{forceMount:void 0}),Rh=t=>{const{__scopeHoverCard:e,forceMount:n,children:r,container:s}=t,o=mo(ea,e);return m.jsx(dS,{scope:e,forceMount:n,children:m.jsx(Ki,{present:n||o.open,children:m.jsx(dp,{asChild:!0,container:s,children:r})})})};Rh.displayName=ea;var Vs="HoverCardContent",jh=E.forwardRef((t,e)=>{const n=fS(Vs,t.__scopeHoverCard),{forceMount:r=n.forceMount,...s}=t,o=mo(Vs,t.__scopeHoverCard);return m.jsx(Ki,{present:r||o.open,children:m.jsx(hS,{"data-state":o.open?"open":"closed",...s,onPointerEnter:He(t.onPointerEnter,Hs(o.onOpen)),onPointerLeave:He(t.onPointerLeave,Hs(o.onClose)),ref:e})})});jh.displayName=Vs;var hS=E.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,...l}=t,a=mo(Vs,n),c=po(n),u=E.useRef(null),d=Ji(e,u),[f,h]=E.useState(!1);return E.useEffect(()=>{if(f){const p=document.body;return li=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=li,p.style.webkitUserSelect=li}}},[f]),E.useEffect(()=>{if(u.current){const p=()=>{h(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),E.useEffect(()=>{u.current&&gS(u.current).forEach(g=>g.setAttribute("tabindex","-1"))}),m.jsx(hp,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:i,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:He(o,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:m.jsx(pp,{...c,...l,onPointerDown:He(l.onPointerDown,p=>{p.currentTarget.contains(p.target)&&h(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:d,style:{...l.style,userSelect:f?"text":void 0,WebkitUserSelect:f?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),pS="HoverCardArrow",mS=E.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,s=po(n);return m.jsx(mp,{...s,...r,ref:e})});mS.displayName=pS;function Hs(t){return e=>e.pointerType==="touch"?void 0:t()}function gS(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var yS=Oh,xS=Ih,bS=Rh,kS=jh;function wS(t){const e=R.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=m.jsx(yS,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=r):r=e[3],r}function vS(t){const e=R.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=m.jsx(xS,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function SS(t){const e=R.c(12);let n,r,s,o;e[0]!==t?({className:n,align:s,sideOffset:o,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=o):(n=e[1],r=e[2],s=e[3],o=e[4]);const i=s===void 0?"center":s,l=o===void 0?4:o;let a;e[5]!==n?(a=Y("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",n),e[5]=n,e[6]=a):a=e[6];let c;return e[7]!==i||e[8]!==r||e[9]!==l||e[10]!==a?(c=m.jsx(bS,{"data-slot":"hover-card-portal",children:m.jsx(kS,{"data-slot":"hover-card-content",align:i,sideOffset:l,className:a,...r})}),e[7]=i,e[8]=r,e[9]=l,e[10]=a,e[11]=c):c=e[11],c}const Dh=E.createContext(void 0);function CS(t,e){const n=e.split("."),r=n[0];if(!r)return;let s=t[r];for(let o=1;o<n.length&&s!==void 0;o++){const i=n[o];if(i)if(typeof s=="object"&&s!==null)s=s[i];else return}return s}function ES(t){const e=R.c(20),{node:n}=t,r=E.useContext(Dh),s=n.attrs.id??"",o=r!==void 0;let i;if(e[0]!==o||e[1]!==s||e[2]!==r){const g=o?CS(r,s):void 0;i=g!==void 0?typeof g=="object"?JSON.stringify(g,null,2):String(g):void 0,e[0]=o,e[1]=s,e[2]=r,e[3]=i}else i=e[3];const l=i;let a;e[4]!==s?(a=m.jsxs("span",{className:"bg-primary/20 text-primary px-1 rounded font-medium cursor-pointer",children:["@",s]}),e[4]=s,e[5]=a):a=e[5];const c=a;if(!o||l===void 0){let g;return e[6]!==c?(g=m.jsx(Lc,{as:"span",children:c}),e[6]=c,e[7]=g):g=e[7],g}let u;e[8]!==c?(u=m.jsx(vS,{asChild:!0,children:c}),e[8]=c,e[9]=u):u=e[9];let d;e[10]!==s?(d=m.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["@",s]}),e[10]=s,e[11]=d):d=e[11];let f;e[12]!==l?(f=m.jsx("pre",{className:"text-xs font-mono bg-muted/50 p-2 rounded overflow-auto max-h-[200px] whitespace-pre-wrap break-all",children:l}),e[12]=l,e[13]=f):f=e[13];let h;e[14]!==d||e[15]!==f?(h=m.jsx(SS,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:m.jsxs("div",{className:"space-y-1.5",children:[d,f]})}),e[14]=d,e[15]=f,e[16]=h):h=e[16];let p;return e[17]!==u||e[18]!==h?(p=m.jsx(Lc,{as:"span",children:m.jsxs(wS,{openDelay:200,children:[u,h]})}),e[17]=u,e[18]=h,e[19]=p):p=e[19],p}function Ph(t){const e=[];function n(r){for(const s of r)s.children?.length||e.push(s),s.children&&n(s.children)}return n(t),e}let Ge=Lh();function Lh(){return hl(()=>({items:[],selectedIndex:0,command:null}))}function tu(t,e){Ge.setState({items:t,command:e,selectedIndex:0})}function NS(){const{items:t,selectedIndex:e}=Ge.getState();t.length&&Ge.setState({selectedIndex:(e-1+t.length)%t.length})}function TS(){const{items:t,selectedIndex:e}=Ge.getState();t.length&&Ge.setState({selectedIndex:(e+1)%t.length})}function $h(){const{items:t,selectedIndex:e,command:n}=Ge.getState(),r=t[e];return r?(n?.(r),!0):!1}function nu(){Ge=Lh()}function MS(){const t=R.c(7),e=di(Ge,AS),n=di(Ge,OS);if(!e.length)return null;let r;if(t[0]!==e||t[1]!==n){let o;t[3]!==n?(o=(i,l)=>m.jsx("button",{type:"button",onClick:()=>{Ge.setState({selectedIndex:l}),$h()},className:Y("flex items-center w-full text-left px-3 py-1.5 text-sm rounded-md transition-colors",l===n?"bg-accent text-accent-foreground":"hover:bg-muted"),children:i.label},i.id),t[3]=n,t[4]=o):o=t[4],r=e.map(o),t[0]=e,t[1]=n,t[2]=r}else r=t[2];let s;return t[5]!==r?(s=m.jsx("div",{className:"bg-popover border border-border rounded-lg shadow-lg overflow-hidden min-w-[180px]",children:m.jsx("div",{className:"p-1",children:r})}),t[5]=r,t[6]=s):s=t[6],s}function OS(t){return t.selectedIndex}function AS(t){return t.items}function IS(){let t=null,e=null;return{onStart:n=>{tu(n.items,n.command),t=new th(MS,{editor:n.editor}),e=document.createElement("div"),e.style.cssText="position:absolute;z-index:9999";const r=n.clientRect?.();r&&(e.style.top=`${r.bottom+window.scrollY+4}px`,e.style.left=`${r.left+window.scrollX}px`),e.appendChild(t.element),document.body.appendChild(e)},onUpdate:n=>{tu(n.items,n.command);const r=n.clientRect?.();r&&e&&(e.style.top=`${r.bottom+window.scrollY+4}px`,e.style.left=`${r.left+window.scrollX}px`)},onKeyDown:({event:n})=>n.key==="Escape"?(e?.remove(),t?.destroy(),nu(),!0):n.key==="ArrowUp"?(NS(),!0):n.key==="ArrowDown"?(TS(),!0):n.key==="Enter"?$h():!1,onExit:()=>{e?.remove(),t?.destroy(),nu()}}}const ai=/@([\w.]+)/g;function RS(t,e){if(!t)return null;const n=Ph(e),r=new Map(n.map(a=>[a.id,a]));if(!ai.test(t))return t;ai.lastIndex=0;const o=[];let i=0,l;for(;(l=ai.exec(t))!==null;){const a=l[1]??"",c=l.index;c>i&&o.push({type:"text",text:t.slice(i,c)});const u=r.get(a);u?o.push({type:"mention",attrs:{id:u.id,label:u.label}}):o.push({type:"text",text:l[0]}),i=c+l[0].length}return i<t.length&&o.push({type:"text",text:t.slice(i)}),{type:"doc",content:[{type:"paragraph",content:o.length>0?o:void 0}]}}function ta(t){const e=R.c(31),{mentions:n,value:r,onChange:s,placeholder:o,className:i,readOnly:l}=t,a=X1();let c;e[0]!==n||e[1]!==r?(c=RS(r,n),e[0]=n,e[1]=r,e[2]=c):c=e[2];const u=c,d=a!==void 0,f=!l;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=rS.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=h):h=e[3];let p;if(e[4]!==n||e[5]!==d){let T;e[7]!==n?(T=I=>{const{query:D}=I;return Ph(n).filter(V=>V.label.toLowerCase().includes(D.toLowerCase())||V.id.toLowerCase().includes(D.toLowerCase()))},e[7]=n,e[8]=T):T=e[8],p=cS.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:LS,renderHTML:PS,suggestion:{items:T,render:IS,command:DS}}).extend(d?{addNodeView(){return vw(ES)}}:{}),e[4]=n,e[5]=d,e[6]=p}else p=e[6];let g;e[9]!==p?(g=[h,p],e[9]=p,e[10]=g):g=e[10];const y=o??"";let x;e[11]!==y?(x={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full min-h-[20px]","data-placeholder":y},handleKeyDown:jS},e[11]=y,e[12]=x):x=e[12];let b;e[13]!==s?(b=T=>{const{editor:I}=T;return s?.(I.getText().trim())},e[13]=s,e[14]=b):b=e[14];let k;e[15]!==u||e[16]!==f||e[17]!==g||e[18]!==x||e[19]!==b?(k={content:u,editable:f,extensions:g,editorProps:x,onUpdate:b},e[15]=u,e[16]=f,e[17]=g,e[18]=x,e[19]=b,e[20]=k):k=e[20];const C=mw(k);let w;e[21]!==i?(w=Y("rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",i),e[21]=i,e[22]=w):w=e[22];let S;e[23]!==C?(S=m.jsx(aw,{editor:C}),e[23]=C,e[24]=S):S=e[24];let v;e[25]!==w||e[26]!==S?(v=m.jsx("div",{className:w,children:S}),e[25]=w,e[26]=S,e[27]=v):v=e[27];const M=v;if(a!==void 0){let T;return e[28]!==M||e[29]!==a?(T=m.jsx(Dh.Provider,{value:a,children:M}),e[28]=M,e[29]=a,e[30]=T):T=e[30],T}return M}function jS(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function DS(t){const{editor:e,range:n,props:r}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:r}]).run()}function PS(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function LS(t){const{node:e}=t;return`@${e.attrs.id}`}function $S(t){const e=R.c(8),{value:n,onChange:r,placeholder:s,readonly:o}=t,i=Hu(),l=n??"";let a;e[0]!==r?(a=d=>r(d),e[0]=r,e[1]=a):a=e[1];const c=s||"Enter value...";let u;return e[2]!==i||e[3]!==o||e[4]!==l||e[5]!==a||e[6]!==c?(u=m.jsx(ta,{mentions:i,value:l,onChange:a,placeholder:c,readOnly:o}),e[2]=i,e[3]=o,e[4]=l,e[5]=a,e[6]=c,e[7]=u):u=e[7],u}function _S(t){const e=R.c(8),{value:n,onChange:r,placeholder:s,readonly:o}=t,i=Hu(),l=n??"";let a;e[0]!==r?(a=d=>r(d),e[0]=r,e[1]=a):a=e[1];const c=s||"Enter value...";let u;return e[2]!==i||e[3]!==o||e[4]!==l||e[5]!==a||e[6]!==c?(u=m.jsx(ta,{mentions:i,value:l,onChange:a,placeholder:c,readOnly:o,className:"min-h-[80px]"}),e[2]=i,e[3]=o,e[4]=l,e[5]=a,e[6]=c,e[7]=u):u=e[7],u}function zS(t){const e=R.c(8),{value:n,onChange:r,readonly:s,id:o}=t,i=n??"";let l;e[0]!==r?(l=u=>r(u.target.value===""?void 0:Number(u.target.value)),e[0]=r,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=Y("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),e[2]=a):a=e[2];let c;return e[3]!==o||e[4]!==s||e[5]!==i||e[6]!==l?(c=m.jsx("input",{id:o,type:"number",value:i,onChange:l,disabled:s,className:a}),e[3]=o,e[4]=s,e[5]=i,e[6]=l,e[7]=c):c=e[7],c}function BS(t){const e=R.c(13),{value:n,onChange:r,readonly:s,id:o,label:i}=t,l=n??!1;let a;e[0]!==r?(a=f=>r(f.target.checked),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==o||e[3]!==s||e[4]!==l||e[5]!==a?(c=m.jsx("input",{id:o,type:"checkbox",checked:l,onChange:a,disabled:s,className:"h-4 w-4 rounded border-input"}),e[2]=o,e[3]=s,e[4]=l,e[5]=a,e[6]=c):c=e[6];let u;e[7]!==i?(u=m.jsx("span",{className:"text-sm",children:i}),e[7]=i,e[8]=u):u=e[8];let d;return e[9]!==o||e[10]!==c||e[11]!==u?(d=m.jsxs("label",{htmlFor:o,className:"flex items-center gap-2 cursor-pointer",children:[c,u]}),e[9]=o,e[10]=c,e[11]=u,e[12]=d):d=e[12],d}function FS(t){const e=R.c(14),{value:n,onChange:r,readonly:s,id:o,options:i}=t;let l;e[0]!==i.enumOptions?(l=i.enumOptions??[],e[0]=i.enumOptions,e[1]=l):l=e[1];const a=l,c=n??"";let u;e[2]!==r?(u=g=>r(g.target.value),e[2]=r,e[3]=u):u=e[3];let d,f;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=Y("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),f=m.jsx("option",{value:"",children:"Select..."}),e[4]=d,e[5]=f):(d=e[4],f=e[5]);let h;e[6]!==a?(h=a.map(VS),e[6]=a,e[7]=h):h=e[7];let p;return e[8]!==o||e[9]!==s||e[10]!==c||e[11]!==u||e[12]!==h?(p=m.jsxs("select",{id:o,value:c,onChange:u,disabled:s,className:d,children:[f,h]}),e[8]=o,e[9]=s,e[10]=c,e[11]=u,e[12]=h,e[13]=p):p=e[13],p}function VS(t){return m.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const HS={TextWidget:$S,TextareaWidget:_S,NumberWidget:zS,CheckboxWidget:BS,SelectWidget:FS};function WS(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:ku,color:"text-blue-500"};case"number":case"integer":return{Icon:xu,color:"text-blue-500"};case"array":return{Icon:pu,color:"text-purple-500"};case"object":return{Icon:hu,color:"text-orange-500"};case"boolean":return{Icon:bu,color:"text-pink-500"};case"null":return{Icon:Gi,color:"text-gray-500"};default:return{Icon:yu,color:"text-muted-foreground"}}}function qS(t){const e=R.c(36),{id:n,label:r,required:s,description:o,children:i,schema:l,hidden:a}=t;if(a){let w;return e[0]!==i?(w=m.jsx("div",{className:"hidden",children:i}),e[0]=i,e[1]=w):w=e[1],w}if(n==="root"){let w;return e[2]!==i?(w=m.jsx("div",{className:"space-y-4",children:i}),e[2]=i,e[3]=w):w=e[3],w}const c=Array.isArray(l.type)?l.type[0]:l.type??"string";let u,d,f,h,p,g,y;if(e[4]!==n||e[5]!==r||e[6]!==s||e[7]!==c){const{Icon:w,color:S}=WS(c);y="space-y-2",h="flex items-center gap-2",e[15]!==n||e[16]!==r?(p=m.jsx("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:r}),e[15]=n,e[16]=r,e[17]=p):p=e[17],e[18]!==s?(g=s&&m.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=s,e[19]=g):g=e[19],u=w,d=14,f=Y(S,"ml-auto"),e[4]=n,e[5]=r,e[6]=s,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h,e[12]=p,e[13]=g,e[14]=y}else u=e[8],d=e[9],f=e[10],h=e[11],p=e[12],g=e[13],y=e[14];let x;e[20]!==u||e[21]!==d||e[22]!==f?(x=m.jsx(u,{size:d,className:f}),e[20]=u,e[21]=d,e[22]=f,e[23]=x):x=e[23];let b;e[24]!==h||e[25]!==p||e[26]!==g||e[27]!==x?(b=m.jsxs("div",{className:h,children:[p,g,x]}),e[24]=h,e[25]=p,e[26]=g,e[27]=x,e[28]=b):b=e[28];let k;e[29]!==o?(k=o&&m.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:o}),e[29]=o,e[30]=k):k=e[30];let C;return e[31]!==i||e[32]!==y||e[33]!==b||e[34]!==k?(C=m.jsxs("div",{className:y,children:[b,k,i]}),e[31]=i,e[32]=y,e[33]=b,e[34]=k,e[35]=C):C=e[35],C}function US(t){const e=R.c(8),{properties:n,title:r}=t;if(!r||r==="Root"){let l;e[0]!==n?(l=n.map(JS),e[0]=n,e[1]=l):l=e[1];let a;return e[2]!==l?(a=m.jsx("div",{className:"space-y-4",children:l}),e[2]=l,e[3]=a):a=e[3],a}let o;e[4]!==n?(o=n.map(KS),e[4]=n,e[5]=o):o=e[5];let i;return e[6]!==o?(i=m.jsx("div",{className:"pl-4 border-l-2 border-border/50 space-y-4",children:o}),e[6]=o,e[7]=i):i=e[7],i}function KS(t){return m.jsx("div",{children:t.content},t.name)}function JS(t){return m.jsx("div",{children:t.content},t.name)}function GS(t){const e=R.c(11),{items:n,canAdd:r,onAddClick:s,title:o}=t;let i;e[0]!==n?(i=n.map(XS),e[0]=n,e[1]=i):i=e[1];let l;e[2]!==i?(l=m.jsx("div",{className:"space-y-2",children:i}),e[2]=i,e[3]=l):l=e[3];let a;e[4]!==r||e[5]!==s||e[6]!==o?(a=r&&m.jsxs(me,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:s,children:["+ Add ",o||"item"]}),e[4]=r,e[5]=s,e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==l||e[9]!==a?(c=m.jsxs("div",{className:"space-y-2",children:[l,a]}),e[8]=l,e[9]=a,e[10]=c):c=e[10],c}function XS(t){return m.jsx("div",{className:"flex gap-2 items-start",children:m.jsx("div",{className:"flex-1",children:t})},t.key||t.index)}function YS(){return null}function QS(){return null}const ZS={FieldTemplate:qS,ObjectFieldTemplate:US,ArrayFieldTemplate:GS,UnsupportedFieldTemplate:YS,ErrorListTemplate:QS};function e2(t){const e=R.c(6),{inputSchema:n,inputParams:r,mentions:s}=t;if(!n?.properties||!r)return null;let o;e[0]!==s?(o=(a,c,u)=>{const d=typeof c=="object"&&c!==null?JSON.stringify(c,null,2):String(c??""),f=Array.isArray(u.type)?u.type.join(" | "):u.type??"string";return m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),m.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:f})]}),u.description&&m.jsx("div",{className:"text-xs text-muted-foreground",children:u.description}),m.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:m.jsx(ta,{mentions:s,value:d,readOnly:!0,className:"border-0 bg-transparent p-0"})})]},a)},e[0]=s,e[1]=o):o=e[1];const i=o;let l;return e[2]!==r||e[3]!==n.properties||e[4]!==i?(l=m.jsx("div",{className:"space-y-4",children:Object.entries(n.properties).map(a=>{const[c,u]=a,d=r[c];return i(c,d,u)})}),e[2]=r,e[3]=n.properties,e[4]=i,e[5]=l):l=e[5],l}function _h({inputSchema:t,inputParams:e,setInputParams:n,handleInputChange:r,mentions:s,readOnly:o}){const i=s??[];if(!t)return m.jsx("div",{className:"text-sm text-muted-foreground italic",children:"No arguments defined in schema."});if(o)return m.jsx(e2,{inputSchema:t,inputParams:e,mentions:i});const l=t,a=E.useRef(e??{}),c=u=>{const d=u.formData??{},f=a.current;if(n?.(d),r){for(const[h,p]of Object.entries(d))f[h]!==p&&r(h,p);for(const h of Object.keys(f))h in d||r(h,void 0)}a.current=d};return m.jsx(Vu.Provider,{value:i,children:m.jsx(Pp,{schema:l,formData:e,onChange:c,validator:Lp,widgets:HS,templates:ZS,readonly:o,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:m.jsx(m.Fragment,{})})})}function t2(t){const e=R.c(33),{open:n,onOpenChange:r,inputSchema:s,onSubmit:o,isPending:i}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];const[a,c]=E.useState(l);let u;e[1]!==a||e[2]!==r||e[3]!==o?(u=async()=>{await o(a),r(!1),c({})},e[1]=a,e[2]=r,e[3]=o,e[4]=u):u=e[4];const d=u;let f;e[5]!==r?(f=M=>{M||c({}),r(M)},e[5]=r,e[6]=f):f=e[6];const h=f;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsxs(Jp,{children:[m.jsx(Gp,{children:"Workflow Input"}),m.jsx(Xp,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[8]=g):g=e[8];let y;e[9]!==a||e[10]!==s?(y=m.jsx("div",{className:"py-4",children:m.jsx(_h,{inputSchema:s,inputParams:a,setInputParams:c,mentions:g})}),e[9]=a,e[10]=s,e[11]=y):y=e[11];let x;e[12]!==h?(x=()=>h(!1),e[12]=h,e[13]=x):x=e[13];let b;e[14]!==i||e[15]!==x?(b=m.jsx(me,{variant:"outline",onClick:x,disabled:i,children:"Cancel"}),e[14]=i,e[15]=x,e[16]=b):b=e[16];let k;e[17]!==i?(k=i?m.jsx(jn,{size:"xs"}):m.jsx(ol,{size:14}),e[17]=i,e[18]=k):k=e[18];let C;e[19]!==d||e[20]!==i||e[21]!==k?(C=m.jsxs(me,{onClick:d,disabled:i,className:"gap-2",children:[k,"Run Workflow"]}),e[19]=d,e[20]=i,e[21]=k,e[22]=C):C=e[22];let w;e[23]!==C||e[24]!==b?(w=m.jsxs(Yp,{children:[b,C]}),e[23]=C,e[24]=b,e[25]=w):w=e[25];let S;e[26]!==w||e[27]!==y?(S=m.jsxs(Qp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,y,w]}),e[26]=w,e[27]=y,e[28]=S):S=e[28];let v;return e[29]!==h||e[30]!==n||e[31]!==S?(v=m.jsx(Zp,{open:n,onOpenChange:h,children:S}),e[29]=h,e[30]=n,e[31]=S,e[32]=v):v=e[32],v}function n2(t){const e=R.c(26),{title:n,description:r,onSave:s}=t,i=qi().location.href,{viewMode:l,setViewMode:a,showExecutionsList:c,toggleExecutionsList:u}=pl(),{resetToOriginalWorkflow:d,setSelectedGatewayId:f}=Me(),h=ju(),p=Ln(),g=we();let y;e[0]!==n?(y=m.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=y):y=e[1];let x;e[2]!==r?(x=r?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),m.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:r})]}):null,e[2]=r,e[3]=x):x=e[3];let b;e[4]!==y||e[5]!==x?(b=m.jsx(du,{children:m.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,x]})}),e[4]=y,e[5]=x,e[6]=b):b=e[6];let k;e[7]!==h||e[8]!==s||e[9]!==d||e[10]!==p||e[11]!==f||e[12]!==a||e[13]!==c||e[14]!==n||e[15]!==u||e[16]!==g||e[17]!==i||e[18]!==l?(k=!g&&m.jsxs(m.Fragment,{children:[m.jsx(Zi,{title:n,url:i,icon:"workflow"}),m.jsx(E.Suspense,{fallback:m.jsx(jn,{size:"xs"}),children:m.jsx(Vp,{selectedGatewayId:p??void 0,onGatewayChange:f,variant:"bordered",placeholder:"Select Hub"})}),m.jsx(qp,{value:l,onValueChange:a,size:"sm",options:[{value:"visual",icon:m.jsx(Up,{})},{value:"code",icon:m.jsx(Su,{})}]}),m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:d,disabled:!h,"aria-label":"Reset changes",children:m.jsx(uu,{size:14})})})}),m.jsx(_t,{side:"bottom",children:"Reset changes"})]})}),m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:s,disabled:!h,"aria-label":"Save workflow",children:m.jsx(fl,{size:14})})})}),m.jsx(_t,{side:"bottom",children:"Save workflow"})]})}),m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:m.jsx(me,{variant:c?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:u,"aria-label":c?"Hide runs":"Show runs",children:m.jsx(vu,{size:14})})})}),m.jsx(_t,{side:"bottom",children:c?"Hide runs":"Show runs"})]})})]}),e[7]=h,e[8]=s,e[9]=d,e[10]=p,e[11]=f,e[12]=a,e[13]=c,e[14]=n,e[15]=u,e[16]=g,e[17]=i,e[18]=l,e[19]=k):k=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=m.jsx(o2,{}),e[20]=C):C=e[20];let w;e[21]!==k?(w=m.jsxs(sl,{children:[k,C]}),e[21]=k,e[22]=w):w=e[22];let S;return e[23]!==b||e[24]!==w?(S=m.jsxs(m.Fragment,{children:[b,w]}),e[23]=b,e[24]=w,e[25]=S):S=e[25],S}function r2(){const t=we(),{item:e}=vr(t);return e?.completed_at_epoch_ms!=null}function s2(){const t=we(),{item:e}=vr(t);return e?.status==="cancelled"}function o2(){const t=R.c(57),e=ju(),n=r2(),r=s2(),s=we(),o=Ln(),{handleRunWorkflow:i,isPending:l,requiresInput:a,inputSchema:c}=K1(),u=kr(),[d,f]=E.useState(!1),{handleCancelWorkflow:h,isCancelling:p}=J1(),{handleResumeWorkflow:g,isResuming:y}=G1(),x=s&&!n;let b;t[0]!==u?(b=u.some(i2),t[0]=u,t[1]=b):b=t[1];const k=b,C=!o,w=e||k||C||l||p,S=x||l;let v;t[2]!==k||t[3]!==C||t[4]!==e||t[5]!==r||t[6]!==S?(v=()=>r?"Workflow is currently cancelled":S?"Workflow is currently running":e?"Save your changes before running":C?"Select a Hub first":k?"Add at least one step to the workflow":null,t[2]=k,t[3]=C,t[4]=e,t[5]=r,t[6]=S,t[7]=v):v=t[7];const T=v();let I;t[8]!==h||t[9]!==g||t[10]!==i||t[11]!==c||t[12]!==r||t[13]!==S||t[14]!==a||t[15]!==s?(I=async()=>{if(a&&c){f(!0);return}if(r&&s){await g(s);return}if(S&&s){await h(s);return}await i({})},t[8]=h,t[9]=g,t[10]=i,t[11]=c,t[12]=r,t[13]=S,t[14]=a,t[15]=s,t[16]=I):I=t[16];const D=I;let $;t[17]!==i?($=async Ve=>{await i(Ve)},t[17]=i,t[18]=$):$=t[18];const V=$,F=r?"Resume":s?n?"Replay":"Running...":a?"Run with input...":"Run workflow",P=!x&&"bg-primary text-primary-foreground hover:bg-primary/90";let N;t[19]!==P?(N=Y("gap-2 h-7 px-3",P),t[19]=P,t[20]=N):N=t[20];let _;t[21]!==p||t[22]!==r||t[23]!==l||t[24]!==y||t[25]!==x?(_=(!x&&!l&&!p&&!y||r)&&m.jsx(ol,{size:14}),t[21]=p,t[22]=r,t[23]=l,t[24]=y,t[25]=x,t[26]=_):_=t[26];let L;t[27]!==p||t[28]!==r||t[29]!==l||t[30]!==y||t[31]!==x?(L=x&&!l&&!p&&!y&&!r&&m.jsx(Kp,{size:14}),t[27]=p,t[28]=r,t[29]=l,t[30]=y,t[31]=x,t[32]=L):L=t[32];let J;t[33]!==p||t[34]!==l||t[35]!==y?(J=(l||p||y)&&m.jsx(jn,{size:"xs"}),t[33]=p,t[34]=l,t[35]=y,t[36]=J):J=t[36];let Z;t[37]!==F||t[38]!==D||t[39]!==w||t[40]!==N||t[41]!==_||t[42]!==L||t[43]!==J?(Z=m.jsxs(me,{variant:"default",size:"sm",className:N,disabled:w,onClick:D,children:[_,L,J,F]}),t[37]=F,t[38]=D,t[39]=w,t[40]=N,t[41]=_,t[42]=L,t[43]=J,t[44]=Z):Z=t[44];const U=Z;let K;t[45]!==U||t[46]!==T?(K=T?m.jsx(zt,{children:m.jsxs(Bt,{delayDuration:0,children:[m.jsx($t,{asChild:!0,children:m.jsx("span",{className:"inline-block",children:U})}),m.jsx(_t,{side:"bottom",children:T})]})}):U,t[45]=U,t[46]=T,t[47]=K):K=t[47];const ie=K;let ee;t[48]!==V||t[49]!==c||t[50]!==l||t[51]!==a||t[52]!==d?(ee=a&&c&&m.jsx(t2,{open:d,onOpenChange:f,inputSchema:c,onSubmit:V,isPending:l}),t[48]=V,t[49]=c,t[50]=l,t[51]=a,t[52]=d,t[53]=ee):ee=t[53];let G;return t[54]!==ie||t[55]!==ee?(G=m.jsxs(m.Fragment,{children:[ie,ee]}),t[54]=ie,t[55]=ee,t[56]=G):G=t[56],G}function i2(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function l2(){const t=R.c(17),e=we(),n=kr(),{item:r}=vr(e);if(!e||!r)return;let s;if(t[0]!==r.completed_steps?.error||t[1]!==r.completed_steps?.success||t[2]!==r.status||t[3]!==n){s={};let o;t[5]!==r.completed_steps?.success?(o=r.completed_steps?.success??[],t[5]=r.completed_steps?.success,t[6]=o):o=t[6];let i;t[7]!==o?(i=new Set(o),t[7]=o,t[8]=i):i=t[8];const l=i;let a;t[9]!==r.completed_steps?.error?(a=r.completed_steps?.error??[],t[9]=r.completed_steps?.error,t[10]=a):a=t[10];let c;t[11]!==a?(c=new Set(a),t[11]=a,t[12]=c):c=t[12];const u=c;let d;t[13]!==u||t[14]!==n||t[15]!==l?(d=-1,n.forEach((f,h)=>{(l.has(f.name)||u.has(f.name))&&(d=h)}),t[13]=u,t[14]=n,t[15]=l,t[16]=d):d=t[16],n.forEach((f,h)=>{let p="pending";u.has(f.name)?p="error":l.has(f.name)?p="success":r.status==="running"&&h===d+1&&(p="running"),s[f.name]={status:p,output:void 0,error:void 0,stepIndex:h}}),t[0]=r.completed_steps?.error,t[1]=r.completed_steps?.success,t[2]=r.status,t[3]=n,t[4]=s}else s=t[4];return s}function a2(t){const e=R.c(119),{step:n,index:r,isSelected:s,executionStatus:o,isSkipped:i,isLastStep:l,onSelect:a,onDelete:c,onDuplicate:u}=t,d=we(),{item:f}=vr(d),h=f?.completed_at_epoch_ms;let p;e[0]!==f?.completed_steps?.success||e[1]!==n.name?(p=f?.completed_steps?.success?.includes(n.name)??!1,e[0]=f?.completed_steps?.success,e[1]=n.name,e[2]=p):p=e[2];const g=p;let y;e[3]!==f?.completed_steps?.error||e[4]!==n.name?(y=f?.completed_steps?.error?.includes(n.name)??!1,e[3]=f?.completed_steps?.error,e[4]=n.name,e[5]=y):y=e[5];const x=y,b="toolName"in n.action,k=b&&"connectionId"in n.action?n.action.connectionId:null,w=!!(b&&"toolName"in n.action?n.action.toolName:null);let S,v,M,T,I,D,$,V,F,P,N;if(e[6]!==k||e[7]!==o||e[8]!==w||e[9]!==r||e[10]!==g||e[11]!==x||e[12]!==l||e[13]!==s||e[14]!==i||e[15]!==b||e[16]!==c||e[17]!==u||e[18]!==a||e[19]!==n||e[20]!==d){const U=b2(n);S=g?"success":x?"error":o?.status;const K=o!==void 0,ie=S==="success"||S==="error";let ee=U.length>0?60:12;(S==="success"||S==="error")&&(ee=ee+32);let G,Ve,ct;if(e[32]!==s||e[33]!==i||e[34]!==a||e[35]!==S){const zn=d2(S);let Tr;e[44]!==S?(Tr=f2(S),e[44]=S,e[45]=Tr):Tr=e[45],G=Tr;const wo=s&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",vo=S==="running"&&"bg-accent/50",So=i&&"opacity-50";e[46]!==wo||e[47]!==vo||e[48]!==So?(V=Y("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",wo,vo,So),e[46]=wo,e[47]=vo,e[48]=So,e[49]=V):V=e[49],F=a,P="button",N=0,e[50]!==a?(v=Co=>{(Co.key==="Enter"||Co.key===" ")&&(Co.preventDefault(),a())},e[50]=a,e[51]=v):v=e[51],ct="w-5 flex flex-col items-center justify-center shrink-0 pt-3",Ve=Y("text-xs font-mono opacity-75 h-8 flex items-center",zn),e[32]=s,e[33]=i,e[34]=a,e[35]=S,e[36]=G,e[37]=v,e[38]=Ve,e[39]=ct,e[40]=V,e[41]=F,e[42]=P,e[43]=N}else G=e[36],v=e[37],Ve=e[38],ct=e[39],V=e[40],F=e[41],P=e[42],N=e[43];const bo=r+1;let en;e[52]!==Ve||e[53]!==bo?(en=m.jsxs("span",{className:Ve,children:[bo,"."]}),e[52]=Ve,e[53]=bo,e[54]=en):en=e[54],e[55]!==ct||e[56]!==en?(M=m.jsx("div",{className:ct,children:en}),e[55]=ct,e[56]=en,e[57]=M):M=e[57];let tn;e[58]!==G||e[59]!==r?(tn=r>0?m.jsx(ci,{height:12,color:G}):m.jsx("div",{className:"h-3"}),e[58]=G,e[59]=r,e[60]=tn):tn=e[60];let nn;e[61]!==k||e[62]!==w||e[63]!==b||e[64]!==n.name?(nn=m.jsx(y2,{connectionId:k,isToolStep:b,hasToolSelected:w,stepName:n.name}),e[61]=k,e[62]=w,e[63]=b,e[64]=n.name,e[65]=nn):nn=e[65];let rn;e[66]!==G||e[67]!==ie||e[68]!==S?(rn=ie&&m.jsxs(m.Fragment,{children:[m.jsx(ci,{height:8,color:G}),m.jsx(h2,{status:S})]}),e[66]=G,e[67]=ie,e[68]=S,e[69]=rn):rn=e[69];let sn;e[70]!==G||e[71]!==ee||e[72]!==l||e[73]!==d?(sn=l&&d?null:m.jsx(ci,{height:ee,color:G}),e[70]=G,e[71]=ee,e[72]=l,e[73]=d,e[74]=sn):sn=e[74],e[75]!==tn||e[76]!==nn||e[77]!==rn||e[78]!==sn?(T=m.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[tn,nn,rn,sn]}),e[75]=tn,e[76]=nn,e[77]=rn,e[78]=sn,e[79]=T):T=e[79],I="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3";const ko=w?"font-medium text-foreground":"text-foreground";let on;e[80]!==ko?(on=Y("text-sm truncate flex-1",ko),e[80]=ko,e[81]=on):on=e[81];let ln;e[82]!==n?(ln=x2(n),e[82]=n,e[83]=ln):ln=e[83];let an;e[84]!==on||e[85]!==ln?(an=m.jsx("span",{className:on,children:ln}),e[84]=on,e[85]=ln,e[86]=an):an=e[86];let cn;e[87]!==K||e[88]!==S?(cn=K&&m.jsx(p2,{status:S}),e[87]=K,e[88]=S,e[89]=cn):cn=e[89];let un;e[90]!==K||e[91]!==c||e[92]!==u?(un=!K&&m.jsxs(em,{children:[m.jsx(tm,{asChild:!0,children:m.jsx(me,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:u2,children:m.jsx(Ip,{size:14})})}),m.jsxs(nm,{align:"end",children:[m.jsxs(ua,{onClick:zn=>{zn.stopPropagation(),u()},children:[m.jsx(sm,{size:14}),"Duplicate"]}),m.jsxs(ua,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:zn=>{zn.stopPropagation(),c()},children:[m.jsx(gp,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[90]=K,e[91]=c,e[92]=u,e[93]=un):un=e[93],e[94]!==an||e[95]!==cn||e[96]!==un?(D=m.jsxs("div",{className:"flex items-center h-8",children:[an,cn,un]}),e[94]=an,e[95]=cn,e[96]=un,e[97]=D):D=e[97],$=U.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1.5",children:U.map(c2)}),e[6]=k,e[7]=o,e[8]=w,e[9]=r,e[10]=g,e[11]=x,e[12]=l,e[13]=s,e[14]=i,e[15]=b,e[16]=c,e[17]=u,e[18]=a,e[19]=n,e[20]=d,e[21]=S,e[22]=v,e[23]=M,e[24]=T,e[25]=I,e[26]=D,e[27]=$,e[28]=V,e[29]=F,e[30]=P,e[31]=N}else S=e[21],v=e[22],M=e[23],T=e[24],I=e[25],D=e[26],$=e[27],V=e[28],F=e[29],P=e[30],N=e[31];let _;e[98]!==h||e[99]!==S?(_=S==="success"&&m.jsx(m2,{completedAtEpochMs:h}),e[98]=h,e[99]=S,e[100]=_):_=e[100];let L;e[101]!==o?.error||e[102]!==S?(L=S==="error"&&m.jsx(g2,{error:o?.error}),e[101]=o?.error,e[102]=S,e[103]=L):L=e[103];let J;e[104]!==_||e[105]!==L||e[106]!==I||e[107]!==D||e[108]!==$?(J=m.jsxs("div",{className:I,children:[D,$,_,L]}),e[104]=_,e[105]=L,e[106]=I,e[107]=D,e[108]=$,e[109]=J):J=e[109];let Z;return e[110]!==v||e[111]!==M||e[112]!==T||e[113]!==J||e[114]!==V||e[115]!==F||e[116]!==P||e[117]!==N?(Z=m.jsxs("div",{className:V,onClick:F,role:P,tabIndex:N,onKeyDown:v,children:[M,T,J]}),e[110]=v,e[111]=M,e[112]=T,e[113]=J,e[114]=V,e[115]=F,e[116]=P,e[117]=N,e[118]=Z):Z=e[118],Z}function c2(t){return m.jsx("span",{className:"px-1.5 py-1 text-xs text-muted-foreground bg-background border border-border rounded-lg",children:t},t)}function u2(t){return t.stopPropagation()}function d2(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function f2(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function h2(t){const e=R.c(2),{status:n}=t;if(n==="success"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-4 rounded bg-success flex items-center justify-center",children:m.jsx(rl,{size:8,className:"text-success-foreground"})}),e[0]=r):r=e[0],r}if(n==="error"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-4 rounded bg-destructive flex items-center justify-center",children:m.jsx(il,{size:8,className:"text-destructive-foreground"})}),e[1]=r):r=e[1],r}return null}function p2(t){const e=R.c(3),{status:n}=t;if(n==="success"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(rl,{size:11,className:"text-success"})}),e[0]=r):r=e[0],r}if(n==="error"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(il,{size:11,className:"text-destructive"})}),e[1]=r):r=e[1],r}if(n==="running"){let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"size-7 flex items-center justify-center",children:m.jsx(or,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=r):r=e[2],r}return null}function m2(t){const e=R.c(8),{completedAtEpochMs:n}=t;let r,s;if(e[0]!==n){const a=n!=null?new Date(n):null;r=a?a.toISOString().split("T")[0]:null,s=a?a.toTimeString().split(" ")[0]:null,e[0]=n,e[1]=r,e[2]=s}else r=e[1],s=e[2];const o=s;let i;e[3]!==r||e[4]!==o?(i=r&&o&&m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Op,{size:16,className:"text-success"}),m.jsx("span",{className:"text-xs text-success",children:r}),m.jsx("span",{className:"text-xs text-success",children:o})]}),e[3]=r,e[4]=o,e[5]=i):i=e[5];let l;return e[6]!==i?(l=m.jsx("div",{className:"inline-flex items-center gap-3 px-1.5 py-1 bg-success-foreground rounded-lg w-fit",children:i}),e[6]=i,e[7]=l):l=e[7],l}function g2(t){const e=R.c(3),{error:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx(dl,{size:16,className:"text-destructive"}),e[0]=r):r=e[0];const s=n||"Execution failed";let o;return e[1]!==s?(o=m.jsxs("div",{className:"inline-flex items-center gap-1.5 px-1.5 py-1 bg-destructive-foreground rounded-lg w-fit",children:[r,m.jsx("span",{className:"text-xs text-destructive",children:s})]}),e[1]=s,e[2]=o):o=e[2],o}function y2(t){const e=R.c(5),{connectionId:n,isToolStep:r,hasToolSelected:s,stepName:o}=t,i=Yi(n??"");if(r&&s&&i?.icon){let a;return e[0]!==i.icon||e[1]!==o?(a=m.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center overflow-hidden",children:m.jsx(Us,{icon:i.icon,name:o,size:"xs",className:"border-0 rounded-none"})}),e[0]=i.icon,e[1]=o,e[2]=a):a=e[2],a}let l;return e[3]!==r?(l=m.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center",children:r?m.jsx(Tu,{size:16,className:"text-muted-foreground"}):m.jsx(rm,{size:16,className:"text-muted-foreground"})}),e[3]=r,e[4]=l):l=e[4],l}function ci(t){const e=R.c(7),{height:n,color:r}=t,s=r===void 0?"bg-border":r;let o;e[0]!==s?(o=Y("w-px",s),e[0]=s,e[1]=o):o=e[1];let i;e[2]!==n?(i={height:n},e[2]=n,e[3]=i):i=e[3];let l;return e[4]!==o||e[5]!==i?(l=m.jsx("div",{className:o,style:i}),e[4]=o,e[5]=i,e[6]=l):l=e[6],l}function x2(t){return t.name?t.name:"toolName"in t.action&&t.action.toolName?t.action.toolName:"code"in t.action?t.name||"Code Step":"Select tool..."}function b2(t){const e=t.outputSchema;if(!e||typeof e!="object")return[];const n=e.properties;return!n||typeof n!="object"?[]:Object.keys(n).slice(0,5)}function k2(t){const e=R.c(32),{className:n}=t,r=kr(),s=Ru(),o=l2(),{setCurrentStepName:i,deleteStep:l,duplicateStep:a}=Me(),c=we();let u;e[0]!==o||e[1]!==r?(u=o?r.findIndex(k=>o[k.name]?.status==="error"):-1,e[0]=o,e[1]=r,e[2]=u):u=e[2];const d=u;let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=m.jsx("div",{children:"Loading..."}),e[3]=f):f=e[3];let h;e[4]!==n?(h=Y("h-full flex flex-col p-8 overflow-auto",n),e[4]=n,e[5]=h):h=e[5];let p;if(e[6]!==s||e[7]!==l||e[8]!==a||e[9]!==d||e[10]!==i||e[11]!==o||e[12]!==r){let k;e[14]!==s||e[15]!==l||e[16]!==a||e[17]!==d||e[18]!==i||e[19]!==o||e[20]!==r.length?(k=(C,w)=>{const S=o?.[C.name],v=d!==-1&&w>d&&S?.status==="pending",M=w===r.length-1;return m.jsx(a2,{step:C,index:w,isSelected:C.name===s,executionStatus:S,isSkipped:v,isLastStep:M,onSelect:()=>i(C.name),onDelete:()=>l(C.name),onDuplicate:()=>a(C.name)},C.name)},e[14]=s,e[15]=l,e[16]=a,e[17]=d,e[18]=i,e[19]=o,e[20]=r.length,e[21]=k):k=e[21],p=r.map(k),e[6]=s,e[7]=l,e[8]=a,e[9]=d,e[10]=i,e[11]=o,e[12]=r,e[13]=p}else p=e[13];let g;e[22]!==p?(g=m.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=g):g=e[23];let y;e[24]!==c?(y=c?null:m.jsx(w2,{}),e[24]=c,e[25]=y):y=e[25];let x;e[26]!==g||e[27]!==y?(x=m.jsxs("div",{className:"w-full -space-y-1",children:[g,y]}),e[26]=g,e[27]=y,e[28]=x):x=e[28];let b;return e[29]!==h||e[30]!==x?(b=m.jsx(E.Suspense,{fallback:f,children:m.jsx("div",{className:h,children:x})}),e[29]=h,e[30]=x,e[31]=b):b=e[31],b}function w2(){const t=R.c(8),{addToolStep:e}=Me();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=m.jsx("div",{className:"w-5 shrink-0"}),t[0]=n):n=t[0];let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"w-px h-3 bg-border"}),t[1]=r):r=t[1];let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx(ul,{size:14}),t[2]=s):s=t[2];let o;t[3]!==e?(o=m.jsx(me,{variant:"outline",size:"icon",className:"size-8 rounded-lg",onClick:e,children:s}),t[3]=e,t[4]=o):o=t[4];let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx("div",{className:"w-px h-8",style:{backgroundImage:"repeating-linear-gradient(180deg, var(--border), var(--border) 4px, transparent 4px, transparent 8px)",backgroundPosition:"left top",backgroundRepeat:"repeat-y",backgroundSize:"2px 100%"}}),t[5]=i):i=t[5];let l;return t[6]!==o?(l=m.jsxs("div",{className:"flex gap-2 items-start px-4 pb-3",children:[n,m.jsxs("div",{className:"flex flex-col border-1 border-transparent items-center shrink-0",children:[r,o,i]})]}),t[6]=o,t[7]=l):l=t[7],l}function v2(){const t=R.c(5),e=Ln();let n;t[0]!==e?(n=e?new URL(`/mcp/gateway/${e}`,window.location.origin).href:"",t[0]=e,t[1]=n):n=t[1];const r=n,s=!!e;let o;return t[2]!==r||t[3]!==s?(o={url:r,enabled:s},t[2]=r,t[3]=s,t[4]=o):o=t[4],ll(o)}function S2(t){const e=R.c(7),{className:n}=t;if(!Ln()){let o;e[0]!==n?(o=Y("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=o):o=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground p-4 text-center",children:"Select a gateway to see available tools"}),e[2]=i):i=e[2];let l;return e[3]!==o?(l=m.jsx("div",{className:o,children:i}),e[3]=o,e[4]=l):l=e[4],l}let s;return e[5]!==n?(s=m.jsx(C2,{className:n}),e[5]=n,e[6]=s):s=e[6],s}function C2(t){const e=R.c(38),{className:n}=t,{tools:r,isLoading:s,error:o}=v2(),i=br(),{updateStep:l}=Me(),c=i&&"toolName"in i.action&&"toolName"in i.action?i.action.toolName:null;let u;if(e[0]!==c||e[1]!==r){let w;e[3]!==c?(w=S=>S.name===c,e[3]=c,e[4]=w):w=e[4],u=r.find(w),e[0]=c,e[1]=r,e[2]=u}else u=e[2];const f=Y1(r,u??null,N2,E2);let h;e[5]!==i||e[6]!==l?(h=w=>{i&&l(i.name,{action:{...i.action,toolName:w.name},outputSchema:w.outputSchema??{}})},e[5]=i,e[6]=l,e[7]=h):h=e[7];const p=h;if(s){let w;e[8]!==n?(w=Y("flex flex-col h-full bg-sidebar",n),e[8]=n,e[9]=w):w=e[9];let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=m.jsx("div",{className:"flex-1 flex items-center justify-center",children:m.jsx(jn,{size:"sm"})}),e[10]=S):S=e[10];let v;return e[11]!==w?(v=m.jsx("div",{className:w,children:S}),e[11]=w,e[12]=v):v=e[12],v}if(o){let w;e[13]!==n?(w=Y("flex flex-col h-full bg-sidebar",n),e[13]=n,e[14]=w):w=e[14];let S;e[15]!==o.message?(S=m.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-destructive p-4 text-center",children:["Failed to load tools: ",o.message]}),e[15]=o.message,e[16]=S):S=e[16];let v;return e[17]!==w||e[18]!==S?(v=m.jsx("div",{className:w,children:S}),e[17]=w,e[18]=S,e[19]=v):v=e[19],v}let g;e[20]!==n?(g=Y("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=g):g=e[21];let y;e[22]===Symbol.for("react.memo_cache_sentinel")?(y=m.jsx("span",{className:"text-base font-medium text-foreground",children:"Select tool"}),e[22]=y):y=e[22];let x;e[23]!==r.length?(x=m.jsx("div",{className:"flex items-start border-b border-border",children:m.jsxs("div",{className:"flex-1 flex items-center h-12 px-5",children:[y,m.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["(",r.length,")"]})]})}),e[23]=r.length,e[24]=x):x=e[24];let b;if(e[25]!==p||e[26]!==f||e[27]!==c){let w;e[29]!==p||e[30]!==c?(w=S=>m.jsx(T2,{icon:null,title:S.name,description:S.description,isSelected:S.name===c,onClick:()=>p(S)},S.name),e[29]=p,e[30]=c,e[31]=w):w=e[31],b=f.map(w),e[25]=p,e[26]=f,e[27]=c,e[28]=b}else b=e[28];let k;e[32]!==b?(k=m.jsx("div",{className:"flex-1 overflow-auto",children:b}),e[32]=b,e[33]=k):k=e[33];let C;return e[34]!==g||e[35]!==x||e[36]!==k?(C=m.jsxs("div",{className:g,children:[x,k]}),e[34]=g,e[35]=x,e[36]=k,e[37]=C):C=e[37],C}function E2(t,e){return t.name.localeCompare(e.name)}function N2(t){return t.name}function T2(t){const e=R.c(20),{icon:n,title:r,description:s,isSelected:o,onClick:i}=t,l=o&&"bg-muted/50";let a;e[0]!==l?(a=Y("flex items-start gap-2.5 min-h-14 px-5 py-4 cursor-pointer transition-colors","hover:bg-muted/50",l),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==i?(c=g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),i())},e[2]=i,e[3]=c):c=e[3];let u;e[4]!==n||e[5]!==r?(u=m.jsx(Us,{icon:n,name:r,size:"xs",className:"shadow-sm mt-0.5"}),e[4]=n,e[5]=r,e[6]=u):u=e[6];let d;e[7]!==r?(d=m.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:r}),e[7]=r,e[8]=d):d=e[8];let f;e[9]!==s?(f=s&&m.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:s}),e[9]=s,e[10]=f):f=e[10];let h;e[11]!==d||e[12]!==f?(h=m.jsxs("div",{className:"flex-1 min-w-0",children:[d,f]}),e[11]=d,e[12]=f,e[13]=h):h=e[13];let p;return e[14]!==i||e[15]!==a||e[16]!==c||e[17]!==u||e[18]!==h?(p=m.jsxs("div",{className:a,onClick:i,role:"button",tabIndex:0,onKeyDown:c,children:[u,h]}),e[14]=i,e[15]=a,e[16]=c,e[17]=u,e[18]=h,e[19]=p):p=e[19],p}var go="Collapsible",[M2,zh]=Ui(go),[O2,na]=M2(go),Bh=E.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...l}=t,[a,c]=qs({prop:r,defaultProp:s??!1,onChange:i,caller:go});return m.jsx(O2,{scope:n,disabled:o,contentId:iu(),open:a,onOpenToggle:E.useCallback(()=>c(u=>!u),[c]),children:m.jsx(Rn.div,{"data-state":sa(a),"data-disabled":o?"":void 0,...l,ref:e})})});Bh.displayName=go;var Fh="CollapsibleTrigger",Vh=E.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=na(Fh,n);return m.jsx(Rn.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":sa(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:He(t.onClick,s.onOpenToggle)})});Vh.displayName=Fh;var ra="CollapsibleContent",Hh=E.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=na(ra,t.__scopeCollapsible);return m.jsx(Ki,{present:n||s.open,children:({present:o})=>m.jsx(A2,{...r,ref:e,present:o})})});Hh.displayName=ra;var A2=E.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=t,i=na(ra,n),[l,a]=E.useState(r),c=E.useRef(null),u=Ji(e,c),d=E.useRef(0),f=d.current,h=E.useRef(0),p=h.current,g=i.open||l,y=E.useRef(g),x=E.useRef(void 0);return E.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),yp(()=>{const b=c.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const k=b.getBoundingClientRect();d.current=k.height,h.current=k.width,y.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),a(r)}},[i.open,r]),m.jsx(Rn.div,{"data-state":sa(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...o,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...t.style},children:g&&s})});function sa(t){return t?"open":"closed"}var I2=Bh,R2=Vh,j2=Hh,Ue="Accordion",D2=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[oa,P2,L2]=xp(Ue),[yo]=Ui(Ue,[L2,zh]),ia=zh(),Wh=X.forwardRef((t,e)=>{const{type:n,...r}=t,s=r,o=r;return m.jsx(oa.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?m.jsx(B2,{...o,ref:e}):m.jsx(z2,{...s,ref:e})})});Wh.displayName=Ue;var[qh,$2]=yo(Ue),[Uh,_2]=yo(Ue,{collapsible:!1}),z2=X.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:o=!1,...i}=t,[l,a]=qs({prop:n,defaultProp:r??"",onChange:s,caller:Ue});return m.jsx(qh,{scope:t.__scopeAccordion,value:X.useMemo(()=>l?[l]:[],[l]),onItemOpen:a,onItemClose:X.useCallback(()=>o&&a(""),[o,a]),children:m.jsx(Uh,{scope:t.__scopeAccordion,collapsible:o,children:m.jsx(Kh,{...i,ref:e})})})}),B2=X.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...o}=t,[i,l]=qs({prop:n,defaultProp:r??[],onChange:s,caller:Ue}),a=X.useCallback(u=>l((d=[])=>[...d,u]),[l]),c=X.useCallback(u=>l((d=[])=>d.filter(f=>f!==u)),[l]);return m.jsx(qh,{scope:t.__scopeAccordion,value:i,onItemOpen:a,onItemClose:c,children:m.jsx(Uh,{scope:t.__scopeAccordion,collapsible:!0,children:m.jsx(Kh,{...o,ref:e})})})}),[F2,xo]=yo(Ue),Kh=X.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:o="vertical",...i}=t,l=X.useRef(null),a=Ji(l,e),c=P2(n),d=bp(s)==="ltr",f=He(t.onKeyDown,h=>{if(!D2.includes(h.key))return;const p=h.target,g=c().filter(M=>!M.ref.current?.disabled),y=g.findIndex(M=>M.ref.current===p),x=g.length;if(y===-1)return;h.preventDefault();let b=y;const k=0,C=x-1,w=()=>{b=y+1,b>C&&(b=k)},S=()=>{b=y-1,b<k&&(b=C)};switch(h.key){case"Home":b=k;break;case"End":b=C;break;case"ArrowRight":o==="horizontal"&&(d?w():S());break;case"ArrowDown":o==="vertical"&&w();break;case"ArrowLeft":o==="horizontal"&&(d?S():w());break;case"ArrowUp":o==="vertical"&&S();break}const v=b%x;g[v].ref.current?.focus()});return m.jsx(F2,{scope:n,disabled:r,direction:s,orientation:o,children:m.jsx(oa.Slot,{scope:n,children:m.jsx(Rn.div,{...i,"data-orientation":o,ref:a,onKeyDown:r?void 0:f})})})}),Ws="AccordionItem",[V2,la]=yo(Ws),Jh=X.forwardRef((t,e)=>{const{__scopeAccordion:n,value:r,...s}=t,o=xo(Ws,n),i=$2(Ws,n),l=ia(n),a=iu(),c=r&&i.value.includes(r)||!1,u=o.disabled||t.disabled;return m.jsx(V2,{scope:n,open:c,disabled:u,triggerId:a,children:m.jsx(I2,{"data-orientation":o.orientation,"data-state":ep(c),...l,...s,ref:e,disabled:u,open:c,onOpenChange:d=>{d?i.onItemOpen(r):i.onItemClose(r)}})})});Jh.displayName=Ws;var Gh="AccordionHeader",Xh=X.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=xo(Ue,n),o=la(Gh,n);return m.jsx(Rn.h3,{"data-orientation":s.orientation,"data-state":ep(o.open),"data-disabled":o.disabled?"":void 0,...r,ref:e})});Xh.displayName=Gh;var Wi="AccordionTrigger",Yh=X.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=xo(Ue,n),o=la(Wi,n),i=_2(Wi,n),l=ia(n);return m.jsx(oa.ItemSlot,{scope:n,children:m.jsx(R2,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...l,...r,ref:e})})});Yh.displayName=Wi;var Qh="AccordionContent",Zh=X.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=xo(Ue,n),o=la(Qh,n),i=ia(n);return m.jsx(j2,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...i,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});Zh.displayName=Qh;function ep(t){return t?"open":"closed"}var H2=Wh,W2=Jh,q2=Xh,U2=Yh,K2=Zh;function J2(t){const e=R.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=m.jsx(H2,{"data-slot":"accordion",...n}),e[2]=n,e[3]=r):r=e[3],r}function G2(t){const e=R.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let s;e[3]!==n?(s=Y("border-b last:border-b-0",n),e[3]=n,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=m.jsx(W2,{"data-slot":"accordion-item",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}function X2(t){const e=R.c(11);let n,r,s;e[0]!==t?({className:r,children:n,...s}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=s):(n=e[1],r=e[2],s=e[3]);let o;e[4]!==r?(o=Y("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium transition-all outline-none hover:bg-accent/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-90",r),e[4]=r,e[5]=o):o=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx(Ep,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200"}),e[6]=i):i=e[6];let l;return e[7]!==n||e[8]!==s||e[9]!==o?(l=m.jsx(q2,{className:"flex",children:m.jsxs(U2,{"data-slot":"accordion-trigger",className:o,...s,children:[n,i]})}),e[7]=n,e[8]=s,e[9]=o,e[10]=l):l=e[10],l}function Y2(t){const e=R.c(12);let n,r,s;e[0]!==t?({className:r,children:n,...s}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=s):(n=e[1],r=e[2],s=e[3]);let o;e[4]!==r?(o=Y("pt-0 pb-4",r),e[4]=r,e[5]=o):o=e[5];let i;e[6]!==n||e[7]!==o?(i=m.jsx("div",{className:o,children:n}),e[6]=n,e[7]=o,e[8]=i):i=e[8];let l;return e[9]!==s||e[10]!==i?(l=m.jsx(K2,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...s,children:i}),e[9]=s,e[10]=i,e[11]=l):l=e[11],l}var Q2=(t,e,n,r,s,o,i,l)=>{let a=document.documentElement,c=["light","dark"];function u(h){(Array.isArray(t)?t:[t]).forEach(p=>{let g=p==="class",y=g&&o?s.map(x=>o[x]||x):s;g?(a.classList.remove(...y),a.classList.add(o&&o[h]?o[h]:h)):a.setAttribute(p,h)}),d(h)}function d(h){l&&c.includes(h)&&(a.style.colorScheme=h)}function f(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)u(r);else try{let h=localStorage.getItem(e)||n,p=i&&h==="system"?f():h;u(p)}catch{}};E.createContext(void 0);E.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:o,value:i,themes:l,nonce:a,scriptProps:c})=>{let u=JSON.stringify([n,e,o,t,l,i,r,s]).slice(1,-1);return E.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?a:"",dangerouslySetInnerHTML:{__html:`(${Q2.toString()})(${u})`}})});function Z2(t){const{updateStep:e}=Me(),r=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:s}=aa(r??"");t&&r&&s?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:s.outputSchema})})}function eC(t){const e=R.c(25),{className:n}=t,r=br(),{appendStep:s}=Me();if(Z2(r),!r){let f;e[0]!==n?(f=Y("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=f):f=e[1];let h;e[2]!==s?(h=()=>{s({type:"tool"})},e[2]=s,e[3]=h):h=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(ul,{size:14}),e[4]=p):p=e[4];let g;e[5]!==h?(g=m.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground gap-2 flex-col",children:["Select or create a step to configure",m.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:h,children:p})]}),e[5]=h,e[6]=g):g=e[6];let y;return e[7]!==f||e[8]!==g?(y=m.jsx("div",{className:f,children:g}),e[7]=f,e[8]=g,e[9]=y):y=e[9],y}let o;e[10]!==n?(o=Y("flex flex-col h-full bg-sidebar overflow-hidden",n),e[10]=n,e[11]=o):o=e[11];let i,l,a,c,u;e[12]!==r?(i=m.jsx(tC,{step:r}),l=m.jsx(rC,{step:r}),a=m.jsx(sC,{step:r}),c=m.jsx(aC,{step:r}),u=m.jsx(cC,{step:r}),e[12]=r,e[13]=i,e[14]=l,e[15]=a,e[16]=c,e[17]=u):(i=e[13],l=e[14],a=e[15],c=e[16],u=e[17]);let d;return e[18]!==o||e[19]!==i||e[20]!==l||e[21]!==a||e[22]!==c||e[23]!==u?(d=m.jsxs("div",{className:o,children:[i,l,a,c,u]}),e[18]=o,e[19]=i,e[20]=l,e[21]=a,e[22]=c,e[23]=u,e[24]=d):d=e[24],d}function tC(t){const e=R.c(15),{step:n}=t,s="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,o=we(),i=s??"";let l;e[0]!==i?(l=m.jsx(Us,{icon:null,name:i,size:"xs",className:"shadow-sm"}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s?(a=m.jsx("span",{className:"text-base font-medium text-foreground truncate flex-1",children:s}),e[2]=s,e[3]=a):a=e[3];let c;e[4]!==o?(c=o?null:m.jsx(nC,{}),e[4]=o,e[5]=c):c=e[5];let u;e[6]!==l||e[7]!==a||e[8]!==c?(u=m.jsxs("div",{className:"flex items-center gap-2",children:[l,a,c]}),e[6]=l,e[7]=a,e[8]=c,e[9]=u):u=e[9];let d;e[10]!==n.description?(d=n.description&&m.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[10]=n.description,e[11]=d):d=e[11];let f;return e[12]!==u||e[13]!==d?(f=m.jsxs("div",{className:"border-b border-border p-5 shrink-0 flex flex-col gap-2",children:[u,d]}),e[12]=u,e[13]=d,e[14]=f):f=e[14],f}function nC(){const t=R.c(9),e=br(),{updateStep:n,startReplacingTool:r}=Me(),s=we(),i=e&&"toolName"in e.action?e.action.toolName:null;let l;t[0]!==e||t[1]!==r||t[2]!==i||t[3]!==s||t[4]!==n?(l=()=>{if(e){if(s){ru.error("You cannot replace a tool while a workflow is executing.");return}i&&r(i),n(e.name,{action:{...e.action,toolName:""}})}},t[0]=e,t[1]=r,t[2]=i,t[3]=s,t[4]=n,t[5]=l):l=t[5];const a=l;let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c=m.jsx(Nu,{size:14}),t[6]=c):c=t[6];let u;return t[7]!==a?(u=m.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:a,title:"Replace tool",children:c}),t[7]=a,t[8]=u):u=t[8],u}function aa(t){const e=R.c(13),n=Ln();let r;e[0]!==n?(r=n?new URL(`/mcp/gateway/${n}`,window.location.origin).href:"",e[0]=n,e[1]=r):r=e[1];const s=r,o=!!n;let i;e[2]!==s||e[3]!==o?(i={url:s,enabled:o},e[2]=s,e[3]=o,e[4]=i):i=e[4];const l=ll(i);let a;e[5]!==l.tools||e[6]!==t?(a=l.tools?.find(h=>h.name===t),e[5]=l.tools,e[6]=t,e[7]=a):a=e[7];const c=a,u=l.state==="connecting",d=l.state==="ready";let f;return e[8]!==l.error||e[9]!==u||e[10]!==d||e[11]!==c?(f={tool:c,isLoading:u,isReady:d,error:l.error},e[8]=l.error,e[9]=u,e[10]=d,e[11]=c,e[12]=f):f=e[12],f}function rC(t){const e=R.c(13),{step:n}=t,{updateStep:r}=Me(),o="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,i=we(),{tool:l}=aa(o??"");if(!l||!l.inputSchema)return null;let a;e[0]!==n.name||e[1]!==r?(a=x=>{r(n.name,{input:x})},e[0]=n.name,e[1]=r,e[2]=a):a=e[2];const c=a,u=i?"output":"input";let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=m.jsx(X2,{className:"px-5 py-5",children:m.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[3]=d):d=e[3];const f=l.inputSchema,h=n.input;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[4]=p):p=e[4];let g;e[5]!==c||e[6]!==n.name||e[7]!==f||e[8]!==h?(g=m.jsxs(G2,{value:"input",className:"border-b-0",children:[d,m.jsx(Y2,{className:"px-5 pt-2",children:m.jsx(_h,{inputSchema:f,inputParams:h,setInputParams:c,mentions:p},n.name)})]}),e[5]=c,e[6]=n.name,e[7]=f,e[8]=h,e[9]=g):g=e[9];let y;return e[10]!==u||e[11]!==g?(y=m.jsx(J2,{type:"single",collapsible:!0,defaultValue:u,className:"border-b border-border shrink-0",children:g}),e[10]=u,e[11]=g,e[12]=y):y=e[12],y}function sC(t){const e=R.c(24),{step:n}=t,r=n.outputSchema,[s,o]=E.useState(!1),i=we(),{output:l,error:a}=F1(i,n.name);let c;e[0]!==a||e[1]!==l?(c=l||(a?{error:a}:null),e[0]=a,e[1]=l,e[2]=c):c=e[2];const u=c,d=r&&typeof r=="object"?r.properties:void 0;let f;e[3]!==d?(f=d?Object.entries(d):[],e[3]=d,e[4]=f):f=e[4];const h=f,p=s?"flex-1 min-h-0 overflow-hidden":"shrink-0";let g;e[5]!==p?(g=Y("flex flex-col border-b border-border",p),e[5]=p,e[6]=g):g=e[6];let y;e[7]!==s?(y=()=>o(!s),e[7]=s,e[8]=y):y=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=m.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Output"}),e[9]=x):x=e[9];let b;e[10]!==s?(b=m.jsxs("div",{className:"flex items-center justify-between",children:[x,s?m.jsx(gu,{size:14,className:"text-muted-foreground"}):m.jsx(mu,{size:14,className:"text-muted-foreground"})]}),e[10]=s,e[11]=b):b=e[11];let k;e[12]!==y||e[13]!==b?(k=m.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:y,children:b}),e[12]=y,e[13]=b,e[14]=k):k=e[14];let C;e[15]!==u||e[16]!==s||e[17]!==h||e[18]!==i?(C=s&&m.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:[i?m.jsx(Xs,{code:JSON.stringify(u,null,2),language:"json",height:"100%",readOnly:!0}):null,!i&&h.map(oC)]}),e[15]=u,e[16]=s,e[17]=h,e[18]=i,e[19]=C):C=e[19];let w;return e[20]!==g||e[21]!==k||e[22]!==C?(w=m.jsxs("div",{className:g,children:[k,C]}),e[20]=g,e[21]=k,e[22]=C,e[23]=w):w=e[23],w}function oC(t){const[e,n]=t;return m.jsx(lC,{name:e,schema:n},e)}function iC(t){switch(t){case"string":return{Icon:ku,color:"text-blue-500"};case"number":case"integer":return{Icon:xu,color:"text-blue-500"};case"array":return{Icon:pu,color:"text-purple-500"};case"object":return{Icon:hu,color:"text-orange-500"};case"boolean":return{Icon:bu,color:"text-pink-500"};case"null":return{Icon:Gi,color:"text-gray-500"};default:return{Icon:yu,color:"text-muted-foreground"}}}function lC(t){const e=R.c(28),{name:n,schema:r}=t,s=br(),o=r.type??"unknown";let i,l,a,c,u;if(e[0]!==o){const{Icon:C,color:w}=iC(o);u="flex items-center gap-2",c="flex-1 flex items-center gap-2",i=C,l=14,a=Y(w),e[0]=o,e[1]=i,e[2]=l,e[3]=a,e[4]=c,e[5]=u}else i=e[1],l=e[2],a=e[3],c=e[4],u=e[5];let d;e[6]!==i||e[7]!==l||e[8]!==a?(d=m.jsx(i,{size:l,className:a}),e[6]=i,e[7]=l,e[8]=a,e[9]=d):d=e[9];let f;e[10]!==n?(f=m.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[10]=n,e[11]=f):f=e[11];let h;e[12]!==c||e[13]!==d||e[14]!==f?(h=m.jsxs("div",{className:c,children:[d,f]}),e[12]=c,e[13]=d,e[14]=f,e[15]=h):h=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(Cu,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const g=s?.name;let y;e[17]!==g?(y=m.jsxs("span",{className:"text-muted-foreground",children:[g,"."]}),e[17]=g,e[18]=y):y=e[18];let x;e[19]!==n?(x=m.jsx("div",{className:"bg-blue-500/10 text-blue-500 px-1 py-0.5 rounded",children:n}),e[19]=n,e[20]=x):x=e[20];let b;e[21]!==y||e[22]!==x?(b=m.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p,y,x]}),e[21]=y,e[22]=x,e[23]=b):b=e[23];let k;return e[24]!==b||e[25]!==u||e[26]!==h?(k=m.jsxs("div",{className:u,children:[h,b]}),e[24]=b,e[25]=u,e[26]=h,e[27]=k):k=e[27],k}function aC(t){const e=R.c(29),{step:n}=t,{updateStep:r}=Me(),s=we(),o="toolName"in n.action,i=o&&"toolName"in n.action?n.action.toolName:null,{tool:l}=aa(i??""),a=o&&"transformCode"in n.action?n.action.transformCode??null:null,c=!!a;let u;e[0]!==l?(u=()=>{if(!l?.outputSchema)return`interface Input {
|
|
165
165
|
// Tool output schema not available
|
|
166
166
|
}`;const M=l.outputSchema,T=M.properties;return T?`interface Input {
|
|
167
167
|
${Object.entries(T).map(D=>{const[$,V]=D,F=Xr(V),P=!M.required?.includes($);return` ${$}${P?"?":""}: ${F};`}).join(`
|