decocms 2.306.13 → 2.306.14
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-UghQPlAa.js → AlertCircle-VdAWApZT.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-1BfkUm85.js → ArrowNarrowLeft-Cb6jcK-n.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-1rqShrTM.js → ArrowUpRight-B2ZjjZJQ.js} +1 -1
- package/dist/client/assets/{Check-DBWnyOFJ.js → Check-BiM2-TvW.js} +1 -1
- package/dist/client/assets/{CheckCircle-CBMgXE-F.js → CheckCircle-Ch05HHgc.js} +1 -1
- package/dist/client/assets/{ChevronDown-D452dgSU.js → ChevronDown-v_6fVP4M.js} +1 -1
- package/dist/client/assets/{ChevronRight-DoY3rcf9.js → ChevronRight-Dzob6m1m.js} +1 -1
- package/dist/client/assets/{ChevronUp-BlZFoG59.js → ChevronUp-CUfrmF0I.js} +1 -1
- package/dist/client/assets/{Container-BQVUd9tN.js → Container-D0YzBjXF.js} +1 -1
- package/dist/client/assets/{DotsVertical-CAgAGLKz.js → DotsVertical-D--w_iaX.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CGcDVdEi.js → LinkExternal01-QD8wgK8o.js} +1 -1
- package/dist/client/assets/{Lock01-FiMk9Cv6.js → Lock01-DJV5JMDy.js} +1 -1
- package/dist/client/assets/{Palette-DXyBGBQu.js → Palette-CEmO1kUS.js} +1 -1
- package/dist/client/assets/{Play-CDjH79to.js → Play-CRDhnWxZ.js} +1 -1
- package/dist/client/assets/{Plus-FC_C8qkl.js → Plus-DDMryLp9.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-Cd8Km121.js → RefreshCcw01-BNG_5rJW.js} +1 -1
- package/dist/client/assets/{SearchMd-B780aQOS.js → SearchMd-BL69FKVv.js} +1 -1
- package/dist/client/assets/{Settings02--XuHa5eI.js → Settings02-CHdnS1Le.js} +1 -1
- package/dist/client/assets/{Shield01-Bg1T1EGa.js → Shield01-CDWmokZC.js} +1 -1
- package/dist/client/assets/{Star01-DRidtrYn.js → Star01-C0QV--XQ.js} +1 -1
- package/dist/client/assets/{Sun-Bpli4t2N.js → Sun-B4qv1AhA.js} +1 -1
- package/dist/client/assets/{Tool01-NWIcFn9q.js → Tool01-DZ5nMk2X.js} +1 -1
- package/dist/client/assets/{Trash01-4w6_aW9X.js → Trash01-EHajsAd0.js} +1 -1
- package/dist/client/assets/{User01-CxpWRrdM.js → User01-DMVSPQ8_.js} +1 -1
- package/dist/client/assets/{Users03-CK1Aa1HI.js → Users03-Bpy5JElG.js} +1 -1
- package/dist/client/assets/{X-BGh8G2l7.js → X-BdF-Ta2X.js} +1 -1
- package/dist/client/assets/{XCircle-CYGTZyzW.js → XCircle-Mzs74oa5.js} +1 -1
- package/dist/client/assets/{XClose-Dz5yGfpm.js → XClose-BKDvrGgg.js} +1 -1
- package/dist/client/assets/{Zap-Druw6RpX.js → Zap-B1XrF636.js} +1 -1
- package/dist/client/assets/{ZapSquare-BLhBRchY.js → ZapSquare-CM6EGSyy.js} +1 -1
- package/dist/client/assets/{accordion-DdQd4o33.js → accordion-BG6WV2yf.js} +1 -1
- package/dist/client/assets/{agent-icon-CznXZlOI.js → agent-icon-CkZZqRPj.js} +1 -1
- package/dist/client/assets/{agents-list-CaQhK_9Q.js → agents-list-Gt0A9Rtw.js} +1 -1
- package/dist/client/assets/ai-providers-vZDvpB2X.js +1 -0
- package/dist/client/assets/{alert-dialog-BiN56dOX.js → alert-dialog-BiImvuLv.js} +1 -1
- package/dist/client/assets/{auth-catchall-6Av77aQi.js → auth-catchall-CI5uzK_0.js} +1 -1
- package/dist/client/assets/{automation-list-row-DdlSuO-v.js → automation-list-row-DgBTeHKk.js} +1 -1
- package/dist/client/assets/{automations-BMuo3AXx.js → automations-1RQ_Ya9s.js} +1 -1
- package/dist/client/assets/{avatar-Z1wN1pq-.js → avatar-q80j4hVX.js} +1 -1
- package/dist/client/assets/{badge-CTmf2TW8.js → badge-C8h2D-cf.js} +1 -1
- package/dist/client/assets/{brand-context-CUDRGuTh.js → brand-context--QAUCooh.js} +1 -1
- package/dist/client/assets/{card-Bd8klEwI.js → card-Dv-Qnw_l.js} +1 -1
- package/dist/client/assets/{chat-context-DGU47jw7.js → chat-context-Cs8XiFv-.js} +1 -1
- package/dist/client/assets/{checkbox-B3EwrxkO.js → checkbox-cUUI4UbZ.js} +1 -1
- package/dist/client/assets/{collection-detail-Cgmw3RVY.js → collection-detail-DdBUKeCk.js} +1 -1
- package/dist/client/assets/{collection-display-button-DMmbKfya.js → collection-display-button-CTTtVxZI.js} +1 -1
- package/dist/client/assets/{collection-search-D-x3SJ1z.js → collection-search-BEV6zp35.js} +1 -1
- package/dist/client/assets/{collection-search-Do2r8Bif.js → collection-search-CSWcPc5L.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CtvRahI-.js → collection-table-wrapper-DQYbUgU8.js} +1 -1
- package/dist/client/assets/{collection-tabs-BKqleLTU.js → collection-tabs-CfplzF48.js} +1 -1
- package/dist/client/assets/{collections-67ZnQ_LS.js → collections-ohRmFoyb.js} +1 -1
- package/dist/client/assets/{command-BAMG06m5.js → command-DDwhSRvD.js} +1 -1
- package/dist/client/assets/{connection-card-DQm8aezN.js → connection-card-D5kgRWc3.js} +1 -1
- package/dist/client/assets/{connection-detail-BhxCMY6j.js → connection-detail-Bn-xI-SY.js} +1 -1
- package/dist/client/assets/{connection-form-helpers--6zqXj9i.js → connection-form-helpers-Bi1lg2fC.js} +1 -1
- package/dist/client/assets/{connections-C0gQbHBs.js → connections-0dR0fYEw.js} +1 -1
- package/dist/client/assets/{constants-BDk5hb7z.js → constants-B0iAJAyD.js} +1 -1
- package/dist/client/assets/{constants-DXQgV2hu.js → constants-BGb3csMB.js} +1 -1
- package/dist/client/assets/{dialog-DUgfuVrb.js → dialog-B9k-J44Q.js} +1 -1
- package/dist/client/assets/{domain-settings-DpONcUPd.js → domain-settings-BDwmEILK.js} +1 -1
- package/dist/client/assets/{drawer-DeyjQQc7.js → drawer-C2prDcqZ.js} +1 -1
- package/dist/client/assets/{dropdown-menu-Cbx_bdO_.js → dropdown-menu-DCt7nnpF.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-D7HG8B_t.js → dynamic-plugin-layout-DMU6tYwj.js} +1 -1
- package/dist/client/assets/{empty-state-BIAZXmQO.js → empty-state-DMA3XSg2.js} +1 -1
- package/dist/client/assets/{empty-state-BnjbbhBR.js → empty-state-DkUQz5Y_.js} +1 -1
- package/dist/client/assets/{extract-connection-data-Dgw7Sgd3.js → extract-connection-data-Du0Nr7p1.js} +1 -1
- package/dist/client/assets/{features-De6GvAAs.js → features-DS7y3VlZ.js} +1 -1
- package/dist/client/assets/{form-O0xus6j8.js → form-kltPHESZ.js} +1 -1
- package/dist/client/assets/{general-tEcdYerZ.js → general-DdyLkb4p.js} +1 -1
- package/dist/client/assets/{index-CdFJkiAN.js → index-B5mfsg_s.js} +1 -1
- package/dist/client/assets/{index-DdsW868M.js → index-BCJLKe3B.js} +1 -1
- package/dist/client/assets/{index-DJiWK6lj.js → index-BFJo4vrg.js} +1 -1
- package/dist/client/assets/{index-CZLTTN-z.js → index-BKV2fRzm.js} +1 -1
- package/dist/client/assets/{index-CuVn0uMY.js → index-BPz6vLPS.js} +1 -1
- package/dist/client/assets/{index-XGdWuQyL.js → index-BikT2EMs.js} +1 -1
- package/dist/client/assets/{index-Dcg8Qevd.js → index-CHrUmZgp.js} +2 -2
- package/dist/client/assets/{index-DZjKh5eS.js → index-CPTlnotN.js} +3 -3
- package/dist/client/assets/{index-DV-VioVg.js → index-Che5DeTo.js} +1 -1
- package/dist/client/assets/{index-CG3ceZHc.js → index-CxB2xnH4.js} +1 -1
- package/dist/client/assets/{index-i68m5nvc.js → index-D9ZWPEnV.js} +1 -1
- package/dist/client/assets/{index-DPM8__xA.js → index-DB0YdXxd.js} +1 -1
- package/dist/client/assets/index-DKSxK_Wl.js +1 -0
- package/dist/client/assets/{index-CqFBXkjQ.js → index-DV65bUQf.js} +1 -1
- package/dist/client/assets/{index-DtUGvIts.js → index-Dq__xIAQ.js} +1 -1
- package/dist/client/assets/{index-EV8zcDnc.js → index-jJk33FDJ.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-D9yYekai.js → infiniteQueryObserver-BondwvTH.js} +1 -1
- package/dist/client/assets/{input-Cvo2jJQf.js → input-Do0Zx2-t.js} +1 -1
- package/dist/client/assets/{integration-icon-DTJ2wb4X.js → integration-icon-BU0UtHw1.js} +1 -1
- package/dist/client/assets/{label-_jNQo8Ll.js → label-xFeGPJPK.js} +1 -1
- package/dist/client/assets/{layout-DbwGS2qx.js → layout-Bh0Tzv5J.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-tP8fRQib.js → lean-canvas-recruit-modal-Bi0R10xw.js} +1 -1
- package/dist/client/assets/{login-DehPjhCM.js → login-DFLXeUmR.js} +1 -1
- package/dist/client/assets/{members-BMPf1BpS.js → members-DMjA2IwS.js} +1 -1
- package/dist/client/assets/{monaco-editor-BVARKKWN.js → monaco-editor-BZYPmAIH.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-D7tWgW-Q.js → monitoring-stats-row-B44nIKev.js} +1 -1
- package/dist/client/assets/{oauth-callback-l4PY6t1A.js → oauth-callback-CoQK7QX3.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-DC-UED8v.js → oauth-callback-ai-provider-DWII6eI4.js} +1 -1
- package/dist/client/assets/{onboarding-Bd6pQbk3.js → onboarding-D-GymYEI.js} +1 -1
- package/dist/client/assets/{org-layout-COoj2PVG.js → org-layout-B4d_ZkIu.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-DGnpwRtk.js → org-plugin-layout-PFHlgq8g.js} +1 -1
- package/dist/client/assets/{pair-_253DGSq.js → pair-BVw6SD1z.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-CakFVZ2i.js → plugin-empty-state-9i7dQecv.js} +1 -1
- package/dist/client/assets/{plugin-header-6TMFE3Ls.js → plugin-header-Yv_MlSUJ.js} +1 -1
- package/dist/client/assets/{plugin-layout-3m9okTPI.js → plugin-layout-CmfsA57I.js} +1 -1
- package/dist/client/assets/{popover-DNu8C4Ll.js → popover-C6TGJ7tP.js} +1 -1
- package/dist/client/assets/{profile-CLBWN3L8.js → profile-B5Uqg-1n.js} +1 -1
- package/dist/client/assets/{project-app-view-5ZnU4fo7.js → project-app-view-Cym9YWZI.js} +1 -1
- package/dist/client/assets/registry-D_eMoOoM.js +2 -0
- package/dist/client/assets/{registry-layout-Hazgpecz.js → registry-layout-DN05Co_7.js} +1 -1
- package/dist/client/assets/{required-auth-layout-Cg8CZTlk.js → required-auth-layout-BgC3m76H.js} +1 -1
- package/dist/client/assets/{reset-password-CzwUFBho.js → reset-password-DIKcKBJA.js} +1 -1
- package/dist/client/assets/{roles-DUtgWupV.js → roles-YwWd0IU_.js} +1 -1
- package/dist/client/assets/{scroll-area-DGEAK3pH.js → scroll-area-Dm9XewPU.js} +1 -1
- package/dist/client/assets/{search-input-C50ImRzg.js → search-input-B6ULbBJE.js} +1 -1
- package/dist/client/assets/{select-DkBE5ypj.js → select-CQme0ALA.js} +1 -1
- package/dist/client/assets/{select-model-B9xghDV8.js → select-model-DXawshPk.js} +1 -1
- package/dist/client/assets/{settings-layout-u6gOtHmU.js → settings-layout-B6BcNt_F.js} +1 -1
- package/dist/client/assets/{settings-section-DeAx6MsQ.js → settings-section-CX6DrRQc.js} +1 -1
- package/dist/client/assets/{shell-layout-xLg1cKrj.js → shell-layout-BYMnLoch.js} +1 -1
- package/dist/client/assets/{skeleton-BL7idETO.js → skeleton-CcWsdROd.js} +1 -1
- package/dist/client/assets/{sso-UHrPOY4-.js → sso-Bn24EPSu.js} +1 -1
- package/dist/client/assets/{store-CCrp-zDu.js → store-CnYcJcjA.js} +1 -1
- package/dist/client/assets/store-registry-avYOji8Y.js +2 -0
- package/dist/client/assets/{switch-Ba2DX0J8.js → switch-iFtU_Uj0.js} +1 -1
- package/dist/client/assets/{table-Dpjp6sno.js → table-CrLtxirL.js} +1 -1
- package/dist/client/assets/{tabs-CUXWIghp.js → tabs-CLXQLaZb.js} +1 -1
- package/dist/client/assets/{task-status-D6HaLDfU.js → task-status-CAq0fkQN.js} +1 -1
- package/dist/client/assets/{textarea-e7WVG0Uq.js → textarea-Biq9f3vB.js} +1 -1
- package/dist/client/assets/{toggle-group-Bzjy8IQq.js → toggle-group-Dj5MlNbV.js} +1 -1
- package/dist/client/assets/{tools-list-ddVo-6Vs.js → tools-list-CEc7i5TR.js} +1 -1
- package/dist/client/assets/{tooltip-sn7TXXXA.js → tooltip-oz4PgHaK.js} +1 -1
- package/dist/client/assets/{types-ClFDwb3j.js → types-0ZrdjKIw.js} +1 -1
- package/dist/client/assets/{use-ai-providers-D1ZzNZfi.js → use-ai-providers-BfAEQYsq.js} +1 -1
- package/dist/client/assets/{use-collections-DDocavcC.js → use-collections-wkyc_t0D.js} +1 -1
- package/dist/client/assets/{use-connection-wzOJDB7e.js → use-connection-BUWHubVp.js} +1 -1
- package/dist/client/assets/{use-copy-D0VCYdzD.js → use-copy-B_R6LHdW.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BQ9UAVGc.js → use-create-virtual-mcp-BZc2oenO.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-vxXjJ2-V.js → use-debounced-autosave-Xsez6aVB.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-CQn9-0iO.js → use-decopilot-events-Dr4V34eZ.js} +1 -1
- package/dist/client/assets/{use-delete-connection-C1mV-M2x.js → use-delete-connection-BLaFqj11.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CyUixfAd.js → use-infinite-scroll-B6tdlom4.js} +1 -1
- package/dist/client/assets/{use-list-state-BkqBgDIi.js → use-list-state-CJyagGju.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Cu2GPPjO.js → use-mcp-tools-bTkNBvHW.js} +1 -1
- package/dist/client/assets/{use-members-Bw_9meIY.js → use-members-DzIKSYZr.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BvnJAyr6.js → use-navigate-to-agent-DC4juKfS.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-uXh4lV5h.js → use-org-auth-client-C9dbWRTq.js} +1 -1
- package/dist/client/assets/{use-org-sso-Co0XjU-j.js → use-org-sso-Oco51-Ud.js} +1 -1
- package/dist/client/assets/{use-organization-roles-CXi0dKrO.js → use-organization-roles-CKRT39Yc.js} +1 -1
- package/dist/client/assets/{use-organization-settings-OER3kM7D.js → use-organization-settings-B78MMPj6.js} +1 -1
- package/dist/client/assets/{use-registry-connections-LYUFCGgQ.js → use-registry-connections-BfK6vb9O.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CQVr-jwf.js → use-status-sounds-CD6ccTBR.js} +1 -1
- package/dist/client/assets/{use-tasks-B8ZzLgVK.js → use-tasks-LY5kqeAJ.js} +1 -1
- package/dist/client/assets/{use-view-mode-ti5AMLDX.js → use-view-mode-Bp7xTow9.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-Cvy2Xx_N.js → use-virtual-mcp-BBYFAnp2.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-7WbFFwUo.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-aIoxf3FE.js +1 -0
- package/dist/client/assets/{user-Dst4Prvf.js → user-40IaywxT.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-Ca3EQ8LL.js → view-mode-toggle-b04RsQAD.js} +1 -1
- package/dist/client/assets/{workflow-BUQXpyzH.js → workflow-BzGWQKQG.js} +1 -1
- package/dist/client/assets/workflow-detail-DpYh98qm.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +12 -1
- package/dist/server/node_modules/xtend/.jshintrc +30 -0
- package/dist/server/node_modules/xtend/LICENSE +20 -0
- package/dist/server/node_modules/xtend/README.md +32 -0
- package/dist/server/node_modules/xtend/immutable.js +19 -0
- package/dist/server/node_modules/xtend/mutable.js +17 -0
- package/dist/server/node_modules/xtend/package.json +55 -0
- package/dist/server/node_modules/xtend/test.js +103 -0
- package/dist/server/server.js +11 -0
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-C_QaV2LV.js +0 -1
- package/dist/client/assets/index-BZ6nkz4a.js +0 -1
- package/dist/client/assets/registry-D_jmaKr2.js +0 -2
- package/dist/client/assets/store-registry-dlSCWL84.js +0 -2
- package/dist/client/assets/useInfiniteQuery-eCacXMD5.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Ck-t1SMi.js +0 -1
- package/dist/client/assets/workflow-detail-DLo-hD09.js +0 -1
- package/dist/server/node_modules/ansi-styles/index.d.ts +0 -236
- package/dist/server/node_modules/ansi-styles/index.js +0 -223
- package/dist/server/node_modules/ansi-styles/license +0 -9
- package/dist/server/node_modules/ansi-styles/package.json +0 -54
- package/dist/server/node_modules/ansi-styles/readme.md +0 -173
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as ue,b as Bt,u as ui,z as kn,C as Nn,j as n,B as J,x as ne,r as w,o as qt,f as ct,l as He,G as rn,F as on,t as $,K as ve,e as L,Q as Vi,R as mi,c as z,a as _n,g as fi,d as pi,H as dt,J as Dt,E as hi,P as Cn,ap as gi,n as In,y as ps,aq as xi,ar as hs,as as bi,at as De,au as an,ao as yi,av as vi,aw as ln,ax as wi,ay as ji,az as Ai,aA as Si,w as ki,aB as Ni,aC as _i,aD as Ci,aE as Ii,aF as zn}from"./index-Dcg8Qevd.js";import{b as Me,a as Le,c as Fe,d as Ue,e as Kt,D as gs}from"./dialog-DUgfuVrb.js";import{S as Ri}from"./switch-Ba2DX0J8.js";import{I as _e}from"./input-Cvo2jJQf.js";import{b as Rn,u as Ti}from"./use-connection-wzOJDB7e.js";import{S as kt,u as qe,W as xs,g as Tn,i as Bn,c as Pi}from"./constants-DXQgV2hu.js";import{a as Ei,c as Di}from"./lean-canvas-recruit-modal-tP8fRQib.js";import{a as Pn}from"./use-navigate-to-agent-BvnJAyr6.js";import{a as Mi,A as En,L as Li,M as bs,N as ys,o as Fi,O as Ui,P as Oi,b as $i,Q as zi,H as vs}from"./agent-icon-CznXZlOI.js";import{t as Bi,b as Yt,u as Dn,a as qi,g as Ki,h as Yi,w as Wi,A as Gi,i as Qi,j as Hi}from"./chat-context-DGU47jw7.js";import{b as Wt,a as Gt,c as Qt,D as Ht,d as Ji,e as Xi,f as Zi}from"./drawer-DeyjQQc7.js";import{u as Jt,T as xt,a as bt,b as yt,c as xn}from"./tooltip-sn7TXXXA.js";import{I as ws}from"./integration-icon-DTJ2wb4X.js";import{a as js,b as er,u as tr}from"./use-virtual-mcp-Cvy2Xx_N.js";import{u as nr}from"./use-tasks-B8ZzLgVK.js";import{r as sr,i as ir}from"./shell-layout-xLg1cKrj.js";import{j as Xt,k as Ge,l as rr,s as Mn,t as or,m as ar,n as lr,o as cr,q as wt,u as dr,v as ur,c as Vr,S as mr,w as fr,x as qn}from"./pair-_253DGSq.js";import{S as Mt,u as Zt,P as bn,a as pr,b as hr,c as gr,E as xr,i as br,d as yr}from"./index-CZLTTN-z.js";import{C as As}from"./collection-search-D-x3SJ1z.js";import{u as vr,g as Ln,a as wr,c as jr,l as Lt}from"./tabs-CUXWIghp.js";import{F as me,b as fe,c as Ne,d as pe,f as he,a as jt}from"./form-O0xus6j8.js";import{c as Ee,e as cn,f as dn,D as Ss,a as ks,b as Ns,d as Ar}from"./dropdown-menu-Cbx_bdO_.js";import{s as Sr,i as kr}from"./XClose-Dz5yGfpm.js";import{c as _s}from"./ZapSquare-BLhBRchY.js";import{i as Xe}from"./Check-DBWnyOFJ.js";import{s as lt}from"./Star01-DRidtrYn.js";import{a as yn,t as Nr}from"./Tool01-NWIcFn9q.js";import{i as Cs}from"./Lock01-FiMk9Cv6.js";import{s as Is}from"./Plus-FC_C8qkl.js";import{f as un,d as Rs,t as _r,g as Cr,b as Ir}from"./XCircle-CYGTZyzW.js";import{i as pt}from"./X-BGh8G2l7.js";import{i as Ts}from"./AlertCircle-UghQPlAa.js";import{S as Ps,a as Es,b as Ds,c as Ms,d as ot}from"./select-DkBE5ypj.js";import{i as Rr}from"./RefreshCcw01-Cd8Km121.js";import{T as Ls,a as Ft}from"./toggle-group-Bzjy8IQq.js";import{u as Tr,a as Pr}from"./use-ai-providers-D1ZzNZfi.js";import{m as en,g as Er,i as Dr,a as Fs,M as Mr,N as Lr}from"./select-model-B9xghDV8.js";import{S as Fr}from"./index-CG3ceZHc.js";import{r as Us,l as vt}from"./types-ClFDwb3j.js";import{t as Kn}from"./ChevronDown-D452dgSU.js";import{p as Ur,q as Yn}from"./question-004-sINsf4GQ.js";import{g as Wn}from"./ai-providers-logos-DD3qZ33J.js";import{g as Or}from"./connection-slug-eyAPH6o3.js";import{u as Os,a as $s,g as $r,C as Vn}from"./connection-card-DQm8aezN.js";import{C as zr}from"./collection-tabs-BKqleLTU.js";import{g as Br}from"./constants-BDk5hb7z.js";import{T as qr}from"./textarea-e7WVG0Uq.js";import{n as Pt}from"./Container-BQVUd9tN.js";import{c as Kr,i as It,a as Gn,E as Yr,p as Wr,b as Gr,d as Qr}from"./connection-form-helpers--6zqXj9i.js";import{u as Qn}from"./use-infinite-scroll-CyUixfAd.js";import{u as Hr}from"./useSuspenseInfiniteQuery-Ck-t1SMi.js";import{g as Jr,e as Xr,a as Zr}from"./extract-connection-data-Dgw7Sgd3.js";import{B as Rt}from"./badge-CTmf2TW8.js";import{i as eo}from"./ChevronRight-DoY3rcf9.js";function to({open:t,onOpenChange:e,onCreated:s}){const{org:i}=ue(),{data:r}=Bt.useSession(),{stdioEnabled:o}=ui(),a=Jt(),d=Rn(),l=Os(),V=$s(l,"").items,c=kn({resolver:Nn(Kr),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),m=c.watch("ui_type"),p=c.watch("connection_url"),x=c.watch("npx_package"),g=It({uiType:m,connectionUrl:p??"",npxPackage:x??""})??Gn({uiType:m,connectionUrl:p??"",registryItems:V}),f=S=>{const v=S.trim();if(!v)return;const j=!!c.formState.dirtyFields.title,E=!!c.formState.dirtyFields.description,D=!!c.formState.dirtyFields.env_vars,I=k=>{if(k&&(!j&&!c.getValues("title").trim()&&k.title&&c.setValue("title",k.title,{shouldDirty:!1}),!E&&!(c.getValues("description")??"").trim()&&k.description&&c.setValue("description",k.description,{shouldDirty:!1}),!D&&k.envVarKeys?.length)){const N=c.getValues("env_vars")??[],R=new Set(N.map(T=>T.key)),M=k.envVarKeys.filter(T=>!R.has(T));M.length>0&&c.setValue("env_vars",[...N,...M.map(T=>({key:T,value:""}))],{shouldDirty:!0})}},P=Wr(v);if(P&&o){c.setValue("ui_type","NPX",{shouldDirty:!0}),c.setValue("npx_package",P.packageName,{shouldDirty:!0}),c.setValue("connection_url","",{shouldDirty:!0}),c.setValue("connection_token",null,{shouldDirty:!0}),I(It({uiType:"NPX",npxPackage:P.packageName}));return}if(v.startsWith("http://")||v.startsWith("https://")){const k=m==="HTTP"||m==="SSE"||m==="Websocket"?m:"HTTP";c.setValue("ui_type",k,{shouldDirty:!0}),c.setValue("connection_url",v,{shouldDirty:!0}),I(It({uiType:k,connectionUrl:v})??Gn({uiType:k,connectionUrl:v,registryItems:V}));return}m==="NPX"&&I(It({uiType:"NPX",npxPackage:v}))},b=S=>{S||c.reset(),e(S)},h=async S=>{let v,j=null,E=null,D=null;S.ui_type==="NPX"?(v="STDIO",j="",D=Gr(S.npx_package||"",S.env_vars||[])):S.ui_type==="STDIO"?(v="STDIO",j="",D=Qr(S.stdio_command||"",S.stdio_args||"",S.stdio_cwd,S.env_vars||[])):(v=S.ui_type,j=S.connection_url||"",E=S.connection_token||null);const I=Br("conn");try{await d.create.mutateAsync({id:I,title:S.title,description:S.description||null,connection_type:v,connection_url:j,connection_token:E,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:r?.user?.id||"system",organization_id:i.id,icon:S.icon??null,app_name:null,app_id:null,connection_headers:D,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),c.reset(),e(!1),s?.(I)}catch{ne.error("Failed to create connection")}},y="Create Connection",A="Create a custom connection in your organization. Fill in the details below.",_=c.formState.isSubmitting?"Saving...":"Create Connection",C=n.jsxs("div",{className:"grid gap-4",children:[n.jsx(me,{control:c.control,name:"ui_type",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Type *"}),n.jsxs(Ps,{value:S.value,onValueChange:S.onChange,children:[n.jsx(pe,{children:n.jsx(Es,{children:n.jsx(Ds,{})})}),n.jsxs(Ms,{children:[n.jsx(ot,{value:"HTTP",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"HTTP"]})}),n.jsx(ot,{value:"SSE",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"SSE"]})}),n.jsx(ot,{value:"Websocket",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"Websocket"]})}),o&&n.jsxs(n.Fragment,{children:[n.jsx(ot,{value:"NPX",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Pt,{className:"w-4 h-4"}),"NPX Package"]})}),n.jsx(ot,{value:"STDIO",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Mi,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),n.jsx(he,{})]})}),m==="NPX"&&n.jsx(me,{control:c.control,name:"npx_package",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"NPM Package *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"@perplexity-ai/mcp-server",...S,value:S.value??"",onPaste:v=>{const j=v.clipboardData.getData("text");j&&(v.preventDefault(),c.setValue("npx_package",j.trim(),{shouldDirty:!0}),f(j))},onBlur:v=>{f(v.target.value),S.onBlur()}})}),n.jsx(he,{})]})}),m==="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[n.jsx(me,{control:c.control,name:"stdio_command",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Command *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"node, bun, python...",...S,value:S.value??""})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"stdio_args",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Arguments"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"arg1 arg2 --flag value",...S,value:S.value??""})}),n.jsx(he,{})]})})]}),n.jsx(me,{control:c.control,name:"stdio_cwd",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Working Directory"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"/path/to/project (optional)",...S,value:S.value??""})}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),n.jsx(he,{})]})})]}),(m==="NPX"||m==="STDIO")&&n.jsx(me,{control:c.control,name:"env_vars",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Environment Variables"}),n.jsx(pe,{children:n.jsx(Yr,{value:S.value??[],onChange:S.onChange})}),n.jsx(he,{})]})}),m!=="NPX"&&m!=="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsx(me,{control:c.control,name:"connection_url",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"URL *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"https://example.com/mcp",...S,value:S.value??"",onPaste:v=>{const j=v.clipboardData.getData("text");j&&(v.preventDefault(),c.setValue("connection_url",j.trim(),{shouldDirty:!0}),f(j))},onBlur:v=>{f(v.target.value),S.onBlur()}})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"connection_token",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:g?.token?.label??"Token (optional)"}),n.jsx(pe,{children:n.jsx(_e,{type:"password",placeholder:g?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...S,value:S.value??""})}),g?.token?.helperText&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&n.jsxs(n.Fragment,{children:[" ","·"," ",n.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),n.jsx(he,{})]})})]}),n.jsx(me,{control:c.control,name:"title",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Name *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"My Connection",...S})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"description",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Description"}),n.jsx(pe,{children:n.jsx(qr,{placeholder:"A brief description of this connection",rows:3,...S,value:S.value??""})}),n.jsx(he,{})]})})]});return a?n.jsx(Wt,{open:t,onOpenChange:b,children:n.jsxs(Gt,{className:"max-h-[90vh]",children:[n.jsx(Qt,{className:"pb-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"flex-1 text-left",children:[n.jsx(Ht,{children:y}),n.jsx(Ji,{className:"mt-1",children:A})]}),n.jsx(Xi,{asChild:!0,children:n.jsx(J,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:n.jsx(Sr,{size:16})})})]})}),n.jsx(jt,{...c,children:n.jsxs("form",{onSubmit:c.handleSubmit(h),children:[n.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:C}),n.jsx(Zi,{children:n.jsx(J,{type:"submit",disabled:c.formState.isSubmitting,className:"w-full",children:_})})]})})]})}):n.jsx(Me,{open:t,onOpenChange:b,children:n.jsxs(Le,{className:"sm:max-w-[525px]",children:[n.jsxs(Fe,{children:[n.jsx(Ue,{children:y}),n.jsx(Kt,{children:A})]}),n.jsx(jt,{...c,children:n.jsxs("form",{onSubmit:c.handleSubmit(h),children:[n.jsx("div",{className:"py-4",children:C}),n.jsxs(gs,{children:[n.jsx(J,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),n.jsx(J,{type:"submit",disabled:c.formState.isSubmitting,className:"min-w-40",children:_})]})]})})]})})}function no(t){const e=L.c(73),{mode:s,agentId:i,addedConnectionIds:r,onAdd:o,onCloneAndAdd:a,onConnectAndAdd:d,connectingItemId:l,search:u,onCreateConnection:V,onBrowseNavigate:c,defaultTab:m}=t,p=s===void 0?"add":s,x=m===void 0?"connected":m,{org:g}=ue(),f=w.useDeferredValue(u),b=u!==f,h=f.trim().toLowerCase();let y;e[0]!==x?(y=U=>U??x,e[0]=x,e[1]=y):y=e[1];const[A,_]=Vi(mi.connectionsTab(g.slug)+(x==="all"?":home-modal":":agent-modal"),y);let C;e[2]!==A||e[3]!==_?(C=U=>{U!==A&&$("connections_dialog_tab_changed",{to_tab:U}),_(U)},e[2]=A,e[3]=_,e[4]=C):C=e[4];const S=C;let v;e[5]!==g.id||e[6]!==g.slug?(v={connectionId:kt,orgId:g.id,orgSlug:g.slug},e[5]=g.id,e[6]=g.slug,e[7]=v):v=e[7];const j=qe(v);let E,D,I;if(e[8]!==j||e[9]!==f||e[10]!==g.id){I=f?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:f.trim()},{field:["description"],operator:"contains",value:f.trim()}]}:void 0;const U={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},X=JSON.stringify(U);D=Hr,E=ve.collectionListInfinite(j,g.id,"","CONNECTIONS",X),e[8]=j,e[9]=f,e[10]=g.id,e[11]=E,e[12]=D,e[13]=I}else E=e[11],D=e[12],I=e[13];let P;e[14]!==j||e[15]!==I?(P=async U=>{const{pageParam:X}=U,Se=X===void 0?0:X;return(await j.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:Se}})).structuredContent},e[14]=j,e[15]=I,e[16]=P):P=e[16];let k;e[17]!==E||e[18]!==P?(k={queryKey:E,queryFn:P,initialPageParam:0,getNextPageParam:lo,staleTime:3e4},e[17]=E,e[18]=P,e[19]=k):k=e[19];const{data:N,fetchNextPage:R,hasNextPage:M,isFetchingNextPage:T}=D(k),F=N?.pages.flatMap(ao)??[],O=$r(F),q=new Set(F.filter(oo).map(ro)),K=Os(),H=$s(K,f),Z=Qn(H.loadMore,H.hasMore,H.isLoadingMore),Q=Qn(R,M??!1,T),W=A==="all"||!!h,ie=W?H.items.filter(U=>{const X=Jr(U);if(X&&q.has(X))return!1;if(!h)return!0;const Se=U._meta?.["mcp.mesh"];return[U.title,U.description,U.name,U.server?.title,U.server?.description,U.server?.name,Se?.friendly_name,Se?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(h)}):[],Y=ie.filter(io),ee=ie.filter(so);let te;e[20]!==r?(te=U=>U.some(X=>r.has(X.id)),e[20]=r,e[21]=te):te=e[21];const se=te;let ae;e[22]!==r||e[23]!==i||e[24]!==l||e[25]!==se||e[26]!==p||e[27]!==o||e[28]!==c||e[29]!==a?(ae=(U,X,Se,ke,Te)=>{const ze=se(Te),Be=Te.find(Pe=>!r.has(Pe.id)),le=Te[0];if(p==="browse"){const Pe=Or(le);return n.jsx(Vn,{connection:{title:X,icon:Se,description:Te.length>1?`${Te.length} instances`:ke??void 0},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(Xe,{size:11})," Connected"]}),onClick:()=>{$("connection_browse_clicked",{app_name:le.app_name??null,connection_id:le.id,instances_count:Te.length}),c?.(Pe)}},U)}return n.jsx(Vn,{connection:{title:X,icon:Se,description:ke},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[ze&&n.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(Xe,{size:11})," Added"]}),n.jsx(J,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),Be?($("connection_add_clicked",{action:"use_existing",app_name:le.app_name??null,connection_id:Be.id}),i&&$("agent_connection_attached",{agent_id:i,connection_id:Be.id,app_name:le.app_name??null,mode:"existing"}),o(Be.id)):($("connection_add_clicked",{action:"clone",app_name:le.app_name??null,base_connection_id:le.id}),a(le))},children:"Add"})]})},U)},e[22]=r,e[23]=i,e[24]=l,e[25]=se,e[26]=p,e[27]=o,e[28]=c,e[29]=a,e[30]=ae):ae=e[30];const re=ae;let oe;e[31]!==l||e[32]!==p||e[33]!==d?(oe=U=>{const X=U._meta?.["mcp.mesh"],Se=X?.friendlyName||X?.friendly_name||U.server?.title||U.title||U.server?.name||U.name||U.id||"",ke=U.server?.description||U.description||null,Te=U.server?.icons?.[0]?.src||Zr(U.server?.repository)||null,ze=X?.official===!0,Be=X?.verified===!0,le=X?.owner==="deco";return n.jsx(Vn,{connection:{title:Se,description:ke,icon:Te},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[le&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:n.jsx("img",{src:"/logos/deco logo.svg",alt:"Made by Deco",className:"size-3"})})}),n.jsx(yt,{children:"Built and maintained by Deco"})]}),!le&&ze&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx(Rt,{variant:"outline",size:"icon",children:n.jsx(un,{})})}),n.jsx(yt,{children:"Built and maintained by the official vendor"})]}),!le&&!ze&&Be&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx(Rt,{variant:"outline",size:"icon",children:n.jsx(un,{})})}),n.jsx(yt,{children:"Verified by the Deco team"})]}),n.jsx(J,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),$("connection_add_clicked",{action:"connect_new",registry_item_id:U.id,app_name:X?.friendlyName||U.server?.name||U.name||null}),d(U)},children:l===U.id?n.jsx(He,{size:14,className:"animate-spin"}):p==="browse"?"Connect":"Add"})]})},`catalog-${U.id}`)},e[31]=l,e[32]=p,e[33]=d,e[34]=oe):oe=e[34];const ce=oe,ge=!h&&n.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[n.jsx(zr,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:A,onTabChange:U=>S(U)}),n.jsxs(J,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{$("connections_dialog_custom_clicked"),V()},children:[n.jsx(Is,{size:12}),"Custom Connection"]})]}),G=b&&"opacity-50 pointer-events-none";let de;e[35]!==G?(de=z("flex-1 overflow-auto p-5 transition-opacity duration-150",G),e[35]=G,e[36]=de):de=e[36];const Ze="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let Oe;e[37]!==re?(Oe=U=>{if(U.type==="group")return re(U.key,U.title,U.icon,null,U.connections);const X=U.connection;return re(X.id,X.title,X.icon,X.description??null,[X])},e[37]=re,e[38]=Oe):Oe=e[38];const Ce=O.map(Oe);let xe;e[39]!==Q?(xe=n.jsx("div",{ref:Q,className:"col-span-full h-1"}),e[39]=Q,e[40]=xe):xe=e[40];let be;e[41]!==T?(be=T&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),e[41]=T,e[42]=be):be=e[42];const Ie=W&&Y.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx(un,{size:13,className:"text-muted-foreground shrink-0"}),n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),Ke=W&&Y.map(ce),Ve=W&&ee.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),ut=W&&ee.map(ce);let we;e[43]!==Z||e[44]!==K||e[45]!==W?(we=W&&K.length>0&&n.jsx("div",{ref:Z,className:"col-span-full h-1"}),e[43]=Z,e[44]=K,e[45]=W,e[46]=we):we=e[46];let Re;e[47]!==H.isLoadingMore||e[48]!==W?(Re=W&&H.isLoadingMore&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=H.isLoadingMore,e[48]=W,e[49]=Re):Re=e[49];let je;e[50]!==Ce||e[51]!==xe||e[52]!==be||e[53]!==Ie||e[54]!==Ke||e[55]!==Ve||e[56]!==ut||e[57]!==we||e[58]!==Re?(je=n.jsxs("div",{className:Ze,children:[Ce,xe,be,Ie,Ke,Ve,ut,we,Re]}),e[50]=Ce,e[51]=xe,e[52]=be,e[53]=Ie,e[54]=Ke,e[55]=Ve,e[56]=ut,e[57]=we,e[58]=Re,e[59]=je):je=e[59];let Ae;e[60]!==A||e[61]!==O.length||e[62]!==ee||e[63]!==u||e[64]!==Y?(Ae=O.length===0&&Y.length===0&&ee.length===0&&n.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:u?`No connections match "${u}"`:A==="connected"?"No connections yet":"No connections available"}),e[60]=A,e[61]=O.length,e[62]=ee,e[63]=u,e[64]=Y,e[65]=Ae):Ae=e[65];let ye;e[66]!==de||e[67]!==je||e[68]!==Ae?(ye=n.jsxs("div",{className:de,children:[je,Ae]}),e[66]=de,e[67]=je,e[68]=Ae,e[69]=ye):ye=e[69];let $e;return e[70]!==ge||e[71]!==ye?($e=n.jsxs(n.Fragment,{children:[ge,ye]}),e[70]=ge,e[71]=ye,e[72]=$e):$e=e[72],$e}function so(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function io(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function ro(t){return t.app_name}function oo(t){return t.app_name}function ao(t){return t?.items??[]}function lo(t,e){if(t?.hasMore)return e.reduce(co,0)}function co(t,e){return t+(e?.items?.length??0)}function uo({open:t,onOpenChange:e,defaultTab:s,initialSearch:i="",...r}){const o=r.mode??"add",a="agentId"in r?r.agentId:void 0,d="addedConnectionIds"in r?r.addedConnectionIds??new Set:new Set,l="onAdd"in r&&r.onAdd?r.onAdd:v=>{},u=(v,j,E)=>{a&&$("agent_connection_attached",{agent_id:a,connection_id:v,app_name:j,mode:E})},[V,c]=w.useState(null),[m,p]=w.useState(i),[x,g]=w.useState(!1),{org:f}=ue(),{data:b}=Bt.useSession(),h=Rn(),y=qt(),A=ct(),_=v=>{e(!1),A({to:"/$org/settings/connections/$appSlug",params:{org:f.slug,appSlug:v}})},C=async v=>{c(v.app_name??v.id);try{const E=`${v.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,I=(await h.create.mutateAsync({title:E,description:v.description??null,connection_type:v.connection_type,connection_url:v.connection_url??null,connection_token:null,icon:v.icon??null,app_name:v.app_name??null,app_id:v.app_id??null,connection_headers:v.connection_headers??null})).id,P=new URL(`/api/${f.slug}/mcp/${I}`,window.location.origin),k=await rn({url:P.href,token:null,orgId:f.id});if(k.supportsOAuth&&!k.isAuthenticated){const{token:N,tokenInfo:R,error:M}=await on({connectionId:I,orgSlug:f.slug,scope:"offline_access"});if(M||!N){$("connection_oauth_failed",{connection_id:I,flow:"clone",error:M??"no_token"}),ne.error(`Authentication failed: ${M??"no token received"}`),await h.delete.mutateAsync(I);return}if($("connection_oauth_succeeded",{connection_id:I,flow:"clone"}),R)try{(await fetch(`/api/${f.slug}/connections/${I}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:R.accessToken,refreshToken:R.refreshToken,expiresIn:R.expiresIn,scope:R.scope,clientId:R.clientId,clientSecret:R.clientSecret,tokenEndpoint:R.tokenEndpoint})})).ok?await h.update.mutateAsync({id:I,data:{}}):await h.update.mutateAsync({id:I,data:{connection_token:N}})}catch{await h.update.mutateAsync({id:I,data:{connection_token:N}})}else await h.update.mutateAsync({id:I,data:{connection_token:N}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(P.href,null)})}u(I,v.app_name??null,"clone"),l(I)}catch(j){console.error("Failed to add connection:",j),ne.error("Failed to add connection")}finally{c(null)}},S=async v=>{if(!(!f||!b?.user?.id)){c(v.id);try{const j=Xr(v,f.id,b.user.id,{remoteIndex:0}),E=j.connection_type==="STDIO",D=!!j.connection_url,I=E&&j.connection_headers&&typeof j.connection_headers=="object"&&"command"in j.connection_headers;if(!D&&!I){ne.error("This MCP Server cannot be connected: no connection method available"),c(null);return}const{id:P}=await h.create.mutateAsync(j),k=new URL(`/api/${f.slug}/mcp/${P}`,window.location.origin),N=await rn({url:k.href,token:null,orgId:f.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:R,tokenInfo:M,error:T}=await on({connectionId:P,orgSlug:f.slug,scope:"offline_access"});if(T||!R){$("connection_oauth_failed",{connection_id:P,flow:"connect_new",error:T??"no_token"}),ne.error(`Authentication failed: ${T??"no token received"}`),u(P,j.app_name??null,"new"),l(P);return}if($("connection_oauth_succeeded",{connection_id:P,flow:"connect_new"}),M)try{(await fetch(`/api/${f.slug}/connections/${P}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:M.accessToken,refreshToken:M.refreshToken,expiresIn:M.expiresIn,scope:M.scope,clientId:M.clientId,clientSecret:M.clientSecret,tokenEndpoint:M.tokenEndpoint})})).ok?await h.update.mutateAsync({id:P,data:{}}):await h.update.mutateAsync({id:P,data:{connection_token:R}})}catch{await h.update.mutateAsync({id:P,data:{connection_token:R}})}else await h.update.mutateAsync({id:P,data:{connection_token:R}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(k.href,null)}),ne.success("Connected and authenticated")}else ne.success("Connected");u(P,j.app_name??null,"new"),l(P)}catch(j){console.error("Failed to connect:",j),ne.error("Failed to connect")}finally{c(null)}}};return n.jsxs(Me,{open:t,onOpenChange:e,children:[n.jsxs(Le,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[n.jsx(Fe,{className:"px-6 pt-5 pb-0 shrink-0",children:n.jsx(Ue,{className:"text-base font-semibold",children:o==="browse"?"Connections":"Add Connection"})}),n.jsx("div",{className:"pt-3 shrink-0",children:n.jsx(As,{value:m,onChange:p,placeholder:"Search connections..."})}),n.jsx(w.Suspense,{fallback:n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),children:n.jsx(no,{mode:o,agentId:a,addedConnectionIds:d,onAdd:l,onCloneAndAdd:C,onConnectAndAdd:S,connectingItemId:V,search:m,onCreateConnection:()=>g(!0),onBrowseNavigate:_,defaultTab:s})})]}),n.jsx(to,{open:x,onOpenChange:g,onCreated:async v=>{g(!1);const j=new URL(`/api/${f.slug}/mcp/${v}`,window.location.origin),E=await rn({url:j.href,token:null,orgId:f.id});if(E.supportsOAuth&&!E.isAuthenticated){const{token:D,tokenInfo:I,error:P}=await on({connectionId:v,orgSlug:f.slug,scope:"offline_access"});if(P||!D){$("connection_oauth_failed",{connection_id:v,flow:"custom_create",error:P??"no_token"}),ne.error(`Authentication failed: ${P??"no token received"}`),await h.delete.mutateAsync(v);return}if($("connection_oauth_succeeded",{connection_id:v,flow:"custom_create"}),I)try{(await fetch(`/api/${f.slug}/connections/${v}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:I.accessToken,refreshToken:I.refreshToken,expiresIn:I.expiresIn,scope:I.scope,clientId:I.clientId,clientSecret:I.clientSecret,tokenEndpoint:I.tokenEndpoint})})).ok?await h.update.mutateAsync({id:v,data:{}}):await h.update.mutateAsync({id:v,data:{connection_token:D}})}catch{await h.update.mutateAsync({id:v,data:{connection_token:D}})}else await h.update.mutateAsync({id:v,data:{connection_token:D}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(j.href,null)})}u(v,null,"custom"),l(v),e(!1)}})]})}const Vo='# Broken Link Finder\n\nYou are the **Broken Link Finder**, a specialist agent focused on the health of the site\'s link structure.\n\n## Your mission\n\nDiscover and track broken links and long redirect chains. You are invoked as a sub-task by an orchestrator agent — your job is to detect link health and return a structured findings report. The orchestrator decides what to do with your findings (file issues, dedup, etc.).\n\nYou are **mechanical**: collect → check → classify → emit findings. Leave subjective judgment to other agents.\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nsite_root_url: <https://example.com>\nmax_pages: <optional integer, default 100, max 200>\ncheck_external: <optional bool, default false>\n```\n\nIf required fields are missing (`site_root_url`), return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**:\n - `collect_site_links` — discovers all unique outbound link targets across the site and returns them with source-page attribution. Does NOT check status.\n - `check_urls` — takes a batch of URLs (max 100 per call) and returns their HTTP status, error kind, and redirect chains.\n\n---\n\n## Step 1 — Collect link targets (one call)\n\nCall `collect_site_links` once to get the full deduplicated list of outbound link targets and their source pages:\n\n```\ncollect_site_links({\n url: <site_root_url from input>,\n maxPages: <max_pages from input, default 100>,\n checkExternal: <check_external from input, default false>\n})\n```\n\nThis returns:\n- `links`: array of `{ targetUrl, scope: "internal"|"external", sourcePages, sourcePagesTotal }` — **each target appears exactly once**\n- Metadata: `pagesCrawled`, `pagesFetched`, `linksSkipped`, optional `error`\n\n**If `result.error` is set**, the scan failed at the root (e.g. site unreachable). Return a single finding with `kind: site-unreachable` and the error in `evidence`. Then stop.\n\nKeep the `links` array in memory — you\'ll need it in Step 3 for classification and source attribution.\n\n## Step 2 — Check the targets (batched calls)\n\nExtract `targetUrl` from each entry in `links`. Slice the resulting URL list into **disjoint batches of up to 100 URLs** and call `check_urls` on each batch:\n\n```\ncheck_urls({ urls: batch_of_100_urls })\n```\n\nCollect every batch\'s `results` entries into a single flat array. Order doesn\'t matter — you\'ll join back by `targetUrl`.\n\n**Rules for this step:**\n- Slice deterministically (e.g. consecutive slices of 100) so batches are disjoint. Do not pass the same URL in two batches.\n- Call `check_urls` sequentially or in parallel — your choice. The tool is idempotent.\n- If a single `check_urls` call errors entirely, skip that batch and continue with the others. Note the skipped count in the wrap-up summary.\n\n## Step 3 — Classify each finding\n\nFor every target with a check result, join the `collect_site_links` entry (for `scope`, `sourcePages`, `sourcePagesTotal`) with the `check_urls` entry (for `status`, `errorKind`, `chain`, `hops`).\n\nA finding is emitted for:\n- **Broken**: `status >= 400` OR `status === 0`\n- **Long redirect chain**: `hops > 3` (even if the final status is 2xx)\n\nOther targets (2xx, short-chain redirects) produce no finding.\n\nMap check result → `kind`:\n\n| Check result | `kind` |\n|---|---|\n| `status: 404` | `link-404` |\n| `status: 4xx` (not 404) | `link-4xx-other` |\n| `status: 5xx` | `link-5xx` |\n| `status: 0`, `errorKind: "dns"` | `link-dns-failure` |\n| `status: 0`, `errorKind: "redirect-loop"` | `redirect-loop` |\n| `hops > 3` (success final status) | `redirect-chain-long` |\n| `status: 0`, `errorKind: "timeout"` or `"connection"` | **skip — no finding** |\n\n**Important**: timeouts and connection errors are **not** broken links — they just mean the server didn\'t respond in our time window. Could be a slow server, an overloaded CDN, rate-limiting against our bot, or a transient network blip. Flagging these as broken produces false positives. If a URL is genuinely dead, it\'ll usually surface as `dns`, a 4xx/5xx, or a redirect loop. Skip timeout/connection entries silently.\n\n## Catalog of severity rules\n\n**High severity:**\n- `link-404` when `scope: "internal"`\n- `link-5xx` when `scope: "internal"`\n- `redirect-loop` (either scope)\n\n**Medium severity:**\n- `link-4xx-other` (internal)\n- `redirect-chain-long` (internal)\n- `link-404` (external) when `sourcePagesTotal >= 5`\n\n**Low severity:**\n- `link-404` (external) when `sourcePagesTotal < 5`\n- `link-dns-failure` (external)\n- `redirect-chain-long` (external)\n- `link-4xx-other` on external scope\n\n## Step 4 — Return a structured findings report\n\nReturn a single response with this shape (YAML preferred):\n\n```yaml\nspecialist: links\nsummary:\n pages_crawled: <pagesCrawled>\n pages_fetched: <pagesFetched>\n unique_link_targets: <links.length>\n targets_dropped_by_collect_cap: <linksSkipped>\n batches_checked: <n>\n batches_skipped_due_to_errors: <n>\n broken_links: <n> # internal + external\n long_redirect_chains: <n>\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full broken URL>\n route: <path if internal; otherwise the external host>\n scope: <internal | external>\n evidence: |\n - Status code / error: <e.g. `404 Not Found`, `DNS failure`, `redirect-loop`>\n - Redirect chain (if applicable): A → B → C → D → E\n - Found on pages (at time of detection):\n - /page-1\n - /page-2\n - (... up to 20 from `sourcePages`)\n - Total pages linking to this target: <sourcePagesTotal>\n impact: <1 sentence tailored to scope + kind>\n suggested_fix: |\n <actionable:>\n - If internal 404: update link to correct destination OR create 301 redirect\n - If internal 5xx: investigate server-side handler for the route (may be app bug)\n - If redirect chain: shorten to single-hop direct redirect in routing config\n - If external: update link to equivalent resource OR remove the mention\n - List likely files/components if you can infer (e.g. "appears on many pages — likely in a shared component like `app/components/Nav.tsx` or menu config")\n - ...\n```\n\nIf `collect_site_links` returned `error`, return a single `kind: site-unreachable` finding with the error in `evidence`.\n\nIf there are zero findings, return `findings: []` — that is the correct output for a healthy link graph.\n\n---\n\n## General rules\n\n- **Trust the scanner.** If `check_urls` reports a URL as broken or long-chain, emit a finding. Do not re-verify with other tools.\n- **Accept some flakiness.** A transient network blip may cause a false positive once. Downstream dedup across runs resolves it.\n- **Group by destination, not by origin.** One broken URL = one finding, even if linked on 50 pages. `collect_site_links` already returns it grouped this way.\n- **Prioritize internals.** Broken external links are the other site\'s responsibility; report but with lower severity.\n- **Never invent status codes.** Report what the scanner returned.\n',mo='# SEO Auditor\n\nYou are the **SEO Auditor**, a specialist agent focused on technical SEO hygiene.\n\n## Your mission\n\nAudit the on-page SEO health of target URLs and return a structured findings report. You focus on **technical SEO** (meta tags, structured data, canonicals, sitemap/robots, heading structure, indexability) — not editorial content or keyword strategy (those are the scope of other agents).\n\nYou are invoked as a sub-task by an orchestrator agent. Your job is to analyze and report. The orchestrator decides what to do with your findings (file issues, dedup against history, etc.).\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nurls:\n - <url to audit>\n - <... one or more>\n```\n\nIf required fields are missing, return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**: `audit_seo`, `fetch_page`, `render_page`, `crawl_site`\n\n---\n\n## Step 1 — Diagnostic\n\nFor each target URL:\n\n1. **Structured audit**: call `audit_seo({ url })`. It returns a structured report — use it as your primary source.\n2. **Raw HTML check**: use `fetch_page({ url })` to see the HTML served (important for crawlers that don\'t execute JS). Confirm critical meta tags are in the initial HTML, not only after hydration.\n3. **Post-render check**: use `render_page({ url })` to see the final DOM. Problems like canonical being overwritten by JS show up here.\n4. **Site structure checks** (only if you have permission for broad crawling, or via sampling): use `crawl_site` to identify orphan pages, canonical loops, or excessive navigation depth.\n5. **Always check**: `/robots.txt` and `/sitemap.xml` via `fetch_page`. These two are root-level and affect the whole site.\n\nOrganize findings into a list. Each finding must have:\n- `kind` (kebab-case slug, see catalog below)\n- `severity` (high | medium | low, see criteria below)\n- `target.url` and `target.route` (normalize: lowercase host, no query, no trailing slash except for `/`)\n- `evidence` (raw data: CSS selector, HTML snippet, observed value)\n- `impact` (1-2 sentences connecting to real metrics)\n- `suggested_fix` (actionable; include file/line if you can infer from framework patterns)\n\n## Step 1.5 — Validate page intent (critical; runs before classification)\n\nBefore you emit *any* finding about a page\'s title, meta description, headings, or indexability, you must answer one question: **did the site owner intend this URL to be a public, indexable page?**\n\nIf the answer is no, the observed "problems" are intentional configuration, not bugs. Reporting them wastes maintainer time and erodes this agent\'s credibility.\n\n### Three signals that the URL is NOT a real public page\n\nCheck these in order. Hitting any one of them means **skip all SEO findings for this URL** except legitimately site-wide problems (e.g. broken sitemap, broken robots.txt).\n\n**Signal 1 — Not in sitemap.** Fetch `/sitemap.xml` (and its child sitemaps, if it\'s a sitemap index). If the URL doesn\'t appear in any sitemap, the owner didn\'t declare it as public. Common on e-commerce platforms where routes like `/p`, `/c`, `/blog` are catchall or routing prefixes, not real pages.\n\n**Signal 2 — Explicit `noindex` + not in sitemap.** If the page serves `<meta name="robots" content="noindex*">` **and** isn\'t in the sitemap, this is a deliberate double-lock by the owner. Respect it. Do **not** flag `noindex-on-important-page` in this case.\n\n**Signal 3 — Title is the URL slug (template fallback).** If `<title>` equals the last path segment (e.g. `<title>blog</title>` for `/blog`, `<title>p</title>` for `/p`), the page is being rendered by a fallback template — nobody configured real content for this route. Skip.\n\n### Platform-specific catchalls (especially Brazilian e-commerce / VTEX / deco-cx)\n\nThese paths are routing prefixes, **not pages**. They may return HTTP 200 but are not meant to be indexable:\n\n- `/p`, `/c`, `/b` — VTEX product / category / brand route prefixes. Real pages live at `/<slug>/p`, `/<slug>/c`, etc. The bare prefixes are catchalls.\n- `/blog`, `/blogs`, `/editorial`, `/revista`, `/conteudo`, `/magazine`, `/noticias`, `/artigos` — common editorial prefixes. If the site doesn\'t have an editorial section, these hit a fallback.\n- `/search`, `/busca`, `/s` — search endpoints, not indexable pages.\n- `/departamento`, `/categoria` — category prefixes.\n- `/checkout`, `/cart`, `/carrinho`, `/login`, `/account`, `/minha-conta` — transactional/private routes. Intentionally `noindex`.\n\n### The "is this page actually important?" checklist\n\nBefore emitting a finding that calls a page "important" (like `noindex-on-important-page` or `title-missing` on anything critical):\n\n1. Is the URL in `/sitemap.xml`? → If no, skip.\n2. Does the page have substantive, unique content (not a fallback with title = URL slug)? → If no, skip.\n3. Is the path a known platform catchall (see list above)? → If yes, skip.\n\nOnly flag if all three pass.\n\n### What still counts as a finding even on non-indexable pages\n\nSite-wide SEO issues affect the whole domain and are worth reporting regardless of individual page intent:\n- `sitemap-missing` (the sitemap itself is broken)\n- `robots-blocking-important-path` (robots.txt blocks something that IS in the sitemap)\n- `structured-data-invalid` on pages that ARE in the sitemap\n- Duplicate titles / meta descriptions across pages that ARE in the sitemap\n\n## Catalog of `kind`\n\nTwo flavors of finding:\n\n- **Per-page** kinds — emitted when auditing a specific URL (e.g. `audit_seo` of a single page OR when your targeted inspection of one of the input URLs finds the issue). Marked **[intent-gated]** — must pass Step 1.5 before being emitted. Target is the specific URL.\n- **Aggregate** kinds — emitted once per site-wide pattern detected by `audit_seo`. Marked **[aggregate]**. Target is the site root (`/`). Evidence MUST include the affected URL sample from `audit_seo.issues[].sampleUrls`. One finding per aggregate kind per site.\n\n**High severity (per-page):**\n- `noindex-on-important-page` **[intent-gated]** — meta robots `noindex` on a page that IS in the sitemap and should be indexed\n- `canonical-pointing-to-wrong-url` **[intent-gated]** — canonical points to a different URL that isn\'t the canonical equivalent\n- `canonical-missing-on-paginated-or-faceted` **[intent-gated]** — pagination/filters without canonical\n- `title-missing` **[intent-gated]** — no `<title>` or empty on a page that IS in the sitemap\n- `structured-data-invalid` **[intent-gated]** — JSON-LD with syntax error or invalid schema.org\n\n**High severity (site-wide):**\n- `sitemap-missing` — `/sitemap.xml` returns 404 or 5xx\n- `robots-blocking-important-path` — `/robots.txt` disallows a path that IS in the sitemap\n- `broken-links-site-wide` **[aggregate]** — `audit_seo` reports broken outbound links across the site\n- `non-indexable-pages-site-wide` **[aggregate]** — `audit_seo` reports many non-indexable pages (note: some non-indexable pages are intentional catchalls — only high severity if the absolute count is large relative to `totalPagesCrawled`, e.g. > 30%)\n\n**Medium severity (per-page):**\n- `meta-description-missing` **[intent-gated]** — no `<meta name="description">` on a sitemap page the agent audited directly\n- `h1-missing` **[intent-gated]** — no `<h1>` on a sitemap page the agent audited directly\n- `h1-duplicate` **[intent-gated]** — multiple `<h1>` on a single page\n- `og-tags-missing` **[intent-gated]** — `og:title` and/or `og:description` missing\n- `structured-data-missing` **[intent-gated]** — page-type (product, article, etc.) without relevant JSON-LD\n- `title-too-long` **[intent-gated]** — `<title>` > 60 characters (truncation in SERP)\n- `title-too-short` **[intent-gated]** — `<title>` < 10 characters (rare; usually means template fallback — double-check page intent)\n- `meta-description-too-long` **[intent-gated]** — description > 160 characters\n\n**Medium severity (site-wide):**\n- `pages-missing-h1` **[aggregate]** — `audit_seo` reports N pages without an H1 tag\n- `pages-missing-meta-description` **[aggregate]** — `audit_seo` reports N pages without a meta description\n- `duplicate-titles` **[aggregate]** — multiple pages share the same `<title>`\n- `duplicate-meta-descriptions` **[aggregate]** — multiple pages share the same meta description\n- `duplicate-content` **[aggregate]** — multiple pages share substantially identical content\n- `broken-resources-site-wide` **[aggregate]** — broken images / scripts across the site\n- `hreflang-broken` — `hreflang` attribute with invalid value or broken reciprocity\n\n**Low severity (per-page):**\n- `meta-description-too-short` **[intent-gated]** — description < 50 characters\n- `og-image-missing` **[intent-gated]** — `og:image` missing\n- `heading-hierarchy-skipped` **[intent-gated]** — jumps from H1 to H3, etc.\n\n**Low severity (site-wide):**\n- `internal-link-using-absolute-url` — internal links with absolute URLs\n\n### Evidence requirements for aggregate kinds\n\nWhen emitting an `[aggregate]` kind, the `evidence` of the finding MUST include:\n\n1. **Total count** — from `audit_seo.issues[].count`\n2. **Sample URLs** — from `audit_seo.issues[].sampleUrls`. Render up to all 20 entries as a bulleted list. If `count > sampleUrls.length`, add a line like `(and <count - sampleUrls.length> more)`.\n3. **If `sampleUrls` is empty** (the tool didn\'t expose per-URL detail — happens for `broken-links-site-wide`, `duplicate-content`, `broken-resources-site-wide`), note it explicitly: `Note: audit_seo did not return per-URL detail for this issue type. A human will need to inspect the full audit_seo report or re-run with deeper crawling.`\n\nAn aggregate finding without either sample URLs or the note is **not actionable** and must not be emitted.\n\nTarget for aggregate kinds stays `target.url: https://<host>/` and `target.route: /`.\n\n## Step 2 — Return a structured findings report\n\nReturn a single response with this shape (YAML or JSON; YAML preferred for readability):\n\n```yaml\nspecialist: seo\nsummary:\n urls_audited: <n>\n findings: <n>\n diagnostic_failures: <n> # urls where audit tooling errored\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full URL>\n route: <normalized path>\n evidence: |\n <multi-line raw data: observed value, selector, HTML snippet, audit_seo output>\n impact: <1-2 sentences connecting to ranking/indexation/CTR>\n suggested_fix: <actionable; likely file/component, pseudo-code, correct value>\n - ...\n```\n\nIf a URL\'s diagnostic tooling errored entirely, emit a single `kind: diagnostic-failed` finding for that URL with the error in `evidence` instead of inventing data.\n\nIf there are zero findings, return `findings: []` — that is the correct output for healthy targets.\n\n---\n\n## General rules\n\n- **Never invent data in `evidence`.** If a tool failed, report it via `kind: diagnostic-failed` and skip the finding.\n- Always normalize `route`: lowercase host, no trailing slash (except for `/`), no query string, no fragment.\n- Your credibility is your currency. False positives erode trust — if you\'re 50% sure, don\'t emit a finding; investigate further or mark as `severity:low`.\n- **Never report a page as broken when it\'s a known catchall.** URLs like `/p`, `/c`, `/blog`, `/search`, `/busca` on e-commerce sites are routing prefixes, not pages. If the title is the URL slug and the page carries `noindex`, the owner is deliberately hiding it. That\'s correct behavior, not a bug.\n- **Sitemap is the ground truth for "is this page public?"**. When in doubt about whether to emit a finding on a URL, fall back to: "Is this URL in /sitemap.xml?" If not, default to silence.\n',fo=`# Performance Watchdog
|
|
1
|
+
import{s as ue,b as Bt,u as ui,z as kn,C as Nn,j as n,B as J,x as ne,r as w,o as qt,f as ct,l as He,G as rn,F as on,t as $,K as ve,e as L,Q as Vi,R as mi,c as z,a as _n,g as fi,d as pi,H as dt,J as Dt,E as hi,P as Cn,ap as gi,n as In,y as ps,aq as xi,ar as hs,as as bi,at as De,au as an,ao as yi,av as vi,aw as ln,ax as wi,ay as ji,az as Ai,aA as Si,w as ki,aB as Ni,aC as _i,aD as Ci,aE as Ii,aF as zn}from"./index-CHrUmZgp.js";import{b as Me,a as Le,c as Fe,d as Ue,e as Kt,D as gs}from"./dialog-B9k-J44Q.js";import{S as Ri}from"./switch-iFtU_Uj0.js";import{I as _e}from"./input-Do0Zx2-t.js";import{b as Rn,u as Ti}from"./use-connection-BUWHubVp.js";import{S as kt,u as qe,W as xs,g as Tn,i as Bn,c as Pi}from"./constants-BGb3csMB.js";import{a as Ei,c as Di}from"./lean-canvas-recruit-modal-Bi0R10xw.js";import{a as Pn}from"./use-navigate-to-agent-DC4juKfS.js";import{a as Mi,A as En,L as Li,M as bs,N as ys,o as Fi,O as Ui,P as Oi,b as $i,Q as zi,H as vs}from"./agent-icon-CkZZqRPj.js";import{t as Bi,b as Yt,u as Dn,a as qi,g as Ki,h as Yi,w as Wi,A as Gi,i as Qi,j as Hi}from"./chat-context-Cs8XiFv-.js";import{b as Wt,a as Gt,c as Qt,D as Ht,d as Ji,e as Xi,f as Zi}from"./drawer-C2prDcqZ.js";import{u as Jt,T as xt,a as bt,b as yt,c as xn}from"./tooltip-oz4PgHaK.js";import{I as ws}from"./integration-icon-BU0UtHw1.js";import{a as js,b as er,u as tr}from"./use-virtual-mcp-BBYFAnp2.js";import{u as nr}from"./use-tasks-LY5kqeAJ.js";import{r as sr,i as ir}from"./shell-layout-BYMnLoch.js";import{j as Xt,k as Ge,l as rr,s as Mn,t as or,m as ar,n as lr,o as cr,q as wt,u as dr,v as ur,c as Vr,S as mr,w as fr,x as qn}from"./pair-BVw6SD1z.js";import{S as Mt,u as Zt,P as bn,a as pr,b as hr,c as gr,E as xr,i as br,d as yr}from"./index-BKV2fRzm.js";import{C as As}from"./collection-search-BEV6zp35.js";import{u as vr,g as Ln,a as wr,c as jr,l as Lt}from"./tabs-CLXQLaZb.js";import{F as me,b as fe,c as Ne,d as pe,f as he,a as jt}from"./form-kltPHESZ.js";import{c as Ee,e as cn,f as dn,D as Ss,a as ks,b as Ns,d as Ar}from"./dropdown-menu-DCt7nnpF.js";import{s as Sr,i as kr}from"./XClose-BKDvrGgg.js";import{c as _s}from"./ZapSquare-CM6EGSyy.js";import{i as Xe}from"./Check-BiM2-TvW.js";import{s as lt}from"./Star01-C0QV--XQ.js";import{a as yn,t as Nr}from"./Tool01-DZ5nMk2X.js";import{i as Cs}from"./Lock01-DJV5JMDy.js";import{s as Is}from"./Plus-DDMryLp9.js";import{f as un,d as Rs,t as _r,g as Cr,b as Ir}from"./XCircle-Mzs74oa5.js";import{i as pt}from"./X-BdF-Ta2X.js";import{i as Ts}from"./AlertCircle-VdAWApZT.js";import{S as Ps,a as Es,b as Ds,c as Ms,d as ot}from"./select-CQme0ALA.js";import{i as Rr}from"./RefreshCcw01-BNG_5rJW.js";import{T as Ls,a as Ft}from"./toggle-group-Dj5MlNbV.js";import{u as Tr,a as Pr}from"./use-ai-providers-BfAEQYsq.js";import{m as en,g as Er,i as Dr,a as Fs,M as Mr,N as Lr}from"./select-model-DXawshPk.js";import{S as Fr}from"./index-CxB2xnH4.js";import{r as Us,l as vt}from"./types-0ZrdjKIw.js";import{t as Kn}from"./ChevronDown-v_6fVP4M.js";import{p as Ur,q as Yn}from"./question-004-sINsf4GQ.js";import{g as Wn}from"./ai-providers-logos-DD3qZ33J.js";import{g as Or}from"./connection-slug-eyAPH6o3.js";import{u as Os,a as $s,g as $r,C as Vn}from"./connection-card-D5kgRWc3.js";import{C as zr}from"./collection-tabs-CfplzF48.js";import{g as Br}from"./constants-B0iAJAyD.js";import{T as qr}from"./textarea-Biq9f3vB.js";import{n as Pt}from"./Container-D0YzBjXF.js";import{c as Kr,i as It,a as Gn,E as Yr,p as Wr,b as Gr,d as Qr}from"./connection-form-helpers-Bi1lg2fC.js";import{u as Qn}from"./use-infinite-scroll-B6tdlom4.js";import{u as Hr}from"./useSuspenseInfiniteQuery-aIoxf3FE.js";import{g as Jr,e as Xr,a as Zr}from"./extract-connection-data-Du0Nr7p1.js";import{B as Rt}from"./badge-C8h2D-cf.js";import{i as eo}from"./ChevronRight-Dzob6m1m.js";function to({open:t,onOpenChange:e,onCreated:s}){const{org:i}=ue(),{data:r}=Bt.useSession(),{stdioEnabled:o}=ui(),a=Jt(),d=Rn(),l=Os(),V=$s(l,"").items,c=kn({resolver:Nn(Kr),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),m=c.watch("ui_type"),p=c.watch("connection_url"),x=c.watch("npx_package"),g=It({uiType:m,connectionUrl:p??"",npxPackage:x??""})??Gn({uiType:m,connectionUrl:p??"",registryItems:V}),f=S=>{const v=S.trim();if(!v)return;const j=!!c.formState.dirtyFields.title,E=!!c.formState.dirtyFields.description,D=!!c.formState.dirtyFields.env_vars,I=k=>{if(k&&(!j&&!c.getValues("title").trim()&&k.title&&c.setValue("title",k.title,{shouldDirty:!1}),!E&&!(c.getValues("description")??"").trim()&&k.description&&c.setValue("description",k.description,{shouldDirty:!1}),!D&&k.envVarKeys?.length)){const N=c.getValues("env_vars")??[],R=new Set(N.map(T=>T.key)),M=k.envVarKeys.filter(T=>!R.has(T));M.length>0&&c.setValue("env_vars",[...N,...M.map(T=>({key:T,value:""}))],{shouldDirty:!0})}},P=Wr(v);if(P&&o){c.setValue("ui_type","NPX",{shouldDirty:!0}),c.setValue("npx_package",P.packageName,{shouldDirty:!0}),c.setValue("connection_url","",{shouldDirty:!0}),c.setValue("connection_token",null,{shouldDirty:!0}),I(It({uiType:"NPX",npxPackage:P.packageName}));return}if(v.startsWith("http://")||v.startsWith("https://")){const k=m==="HTTP"||m==="SSE"||m==="Websocket"?m:"HTTP";c.setValue("ui_type",k,{shouldDirty:!0}),c.setValue("connection_url",v,{shouldDirty:!0}),I(It({uiType:k,connectionUrl:v})??Gn({uiType:k,connectionUrl:v,registryItems:V}));return}m==="NPX"&&I(It({uiType:"NPX",npxPackage:v}))},b=S=>{S||c.reset(),e(S)},h=async S=>{let v,j=null,E=null,D=null;S.ui_type==="NPX"?(v="STDIO",j="",D=Gr(S.npx_package||"",S.env_vars||[])):S.ui_type==="STDIO"?(v="STDIO",j="",D=Qr(S.stdio_command||"",S.stdio_args||"",S.stdio_cwd,S.env_vars||[])):(v=S.ui_type,j=S.connection_url||"",E=S.connection_token||null);const I=Br("conn");try{await d.create.mutateAsync({id:I,title:S.title,description:S.description||null,connection_type:v,connection_url:j,connection_token:E,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:r?.user?.id||"system",organization_id:i.id,icon:S.icon??null,app_name:null,app_id:null,connection_headers:D,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),c.reset(),e(!1),s?.(I)}catch{ne.error("Failed to create connection")}},y="Create Connection",A="Create a custom connection in your organization. Fill in the details below.",_=c.formState.isSubmitting?"Saving...":"Create Connection",C=n.jsxs("div",{className:"grid gap-4",children:[n.jsx(me,{control:c.control,name:"ui_type",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Type *"}),n.jsxs(Ps,{value:S.value,onValueChange:S.onChange,children:[n.jsx(pe,{children:n.jsx(Es,{children:n.jsx(Ds,{})})}),n.jsxs(Ms,{children:[n.jsx(ot,{value:"HTTP",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"HTTP"]})}),n.jsx(ot,{value:"SSE",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"SSE"]})}),n.jsx(ot,{value:"Websocket",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"Websocket"]})}),o&&n.jsxs(n.Fragment,{children:[n.jsx(ot,{value:"NPX",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Pt,{className:"w-4 h-4"}),"NPX Package"]})}),n.jsx(ot,{value:"STDIO",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Mi,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),n.jsx(he,{})]})}),m==="NPX"&&n.jsx(me,{control:c.control,name:"npx_package",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"NPM Package *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"@perplexity-ai/mcp-server",...S,value:S.value??"",onPaste:v=>{const j=v.clipboardData.getData("text");j&&(v.preventDefault(),c.setValue("npx_package",j.trim(),{shouldDirty:!0}),f(j))},onBlur:v=>{f(v.target.value),S.onBlur()}})}),n.jsx(he,{})]})}),m==="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[n.jsx(me,{control:c.control,name:"stdio_command",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Command *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"node, bun, python...",...S,value:S.value??""})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"stdio_args",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Arguments"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"arg1 arg2 --flag value",...S,value:S.value??""})}),n.jsx(he,{})]})})]}),n.jsx(me,{control:c.control,name:"stdio_cwd",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Working Directory"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"/path/to/project (optional)",...S,value:S.value??""})}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),n.jsx(he,{})]})})]}),(m==="NPX"||m==="STDIO")&&n.jsx(me,{control:c.control,name:"env_vars",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Environment Variables"}),n.jsx(pe,{children:n.jsx(Yr,{value:S.value??[],onChange:S.onChange})}),n.jsx(he,{})]})}),m!=="NPX"&&m!=="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsx(me,{control:c.control,name:"connection_url",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"URL *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"https://example.com/mcp",...S,value:S.value??"",onPaste:v=>{const j=v.clipboardData.getData("text");j&&(v.preventDefault(),c.setValue("connection_url",j.trim(),{shouldDirty:!0}),f(j))},onBlur:v=>{f(v.target.value),S.onBlur()}})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"connection_token",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:g?.token?.label??"Token (optional)"}),n.jsx(pe,{children:n.jsx(_e,{type:"password",placeholder:g?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...S,value:S.value??""})}),g?.token?.helperText&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&n.jsxs(n.Fragment,{children:[" ","·"," ",n.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),n.jsx(he,{})]})})]}),n.jsx(me,{control:c.control,name:"title",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Name *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"My Connection",...S})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"description",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Description"}),n.jsx(pe,{children:n.jsx(qr,{placeholder:"A brief description of this connection",rows:3,...S,value:S.value??""})}),n.jsx(he,{})]})})]});return a?n.jsx(Wt,{open:t,onOpenChange:b,children:n.jsxs(Gt,{className:"max-h-[90vh]",children:[n.jsx(Qt,{className:"pb-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"flex-1 text-left",children:[n.jsx(Ht,{children:y}),n.jsx(Ji,{className:"mt-1",children:A})]}),n.jsx(Xi,{asChild:!0,children:n.jsx(J,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:n.jsx(Sr,{size:16})})})]})}),n.jsx(jt,{...c,children:n.jsxs("form",{onSubmit:c.handleSubmit(h),children:[n.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:C}),n.jsx(Zi,{children:n.jsx(J,{type:"submit",disabled:c.formState.isSubmitting,className:"w-full",children:_})})]})})]})}):n.jsx(Me,{open:t,onOpenChange:b,children:n.jsxs(Le,{className:"sm:max-w-[525px]",children:[n.jsxs(Fe,{children:[n.jsx(Ue,{children:y}),n.jsx(Kt,{children:A})]}),n.jsx(jt,{...c,children:n.jsxs("form",{onSubmit:c.handleSubmit(h),children:[n.jsx("div",{className:"py-4",children:C}),n.jsxs(gs,{children:[n.jsx(J,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),n.jsx(J,{type:"submit",disabled:c.formState.isSubmitting,className:"min-w-40",children:_})]})]})})]})})}function no(t){const e=L.c(73),{mode:s,agentId:i,addedConnectionIds:r,onAdd:o,onCloneAndAdd:a,onConnectAndAdd:d,connectingItemId:l,search:u,onCreateConnection:V,onBrowseNavigate:c,defaultTab:m}=t,p=s===void 0?"add":s,x=m===void 0?"connected":m,{org:g}=ue(),f=w.useDeferredValue(u),b=u!==f,h=f.trim().toLowerCase();let y;e[0]!==x?(y=U=>U??x,e[0]=x,e[1]=y):y=e[1];const[A,_]=Vi(mi.connectionsTab(g.slug)+(x==="all"?":home-modal":":agent-modal"),y);let C;e[2]!==A||e[3]!==_?(C=U=>{U!==A&&$("connections_dialog_tab_changed",{to_tab:U}),_(U)},e[2]=A,e[3]=_,e[4]=C):C=e[4];const S=C;let v;e[5]!==g.id||e[6]!==g.slug?(v={connectionId:kt,orgId:g.id,orgSlug:g.slug},e[5]=g.id,e[6]=g.slug,e[7]=v):v=e[7];const j=qe(v);let E,D,I;if(e[8]!==j||e[9]!==f||e[10]!==g.id){I=f?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:f.trim()},{field:["description"],operator:"contains",value:f.trim()}]}:void 0;const U={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},X=JSON.stringify(U);D=Hr,E=ve.collectionListInfinite(j,g.id,"","CONNECTIONS",X),e[8]=j,e[9]=f,e[10]=g.id,e[11]=E,e[12]=D,e[13]=I}else E=e[11],D=e[12],I=e[13];let P;e[14]!==j||e[15]!==I?(P=async U=>{const{pageParam:X}=U,Se=X===void 0?0:X;return(await j.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:Se}})).structuredContent},e[14]=j,e[15]=I,e[16]=P):P=e[16];let k;e[17]!==E||e[18]!==P?(k={queryKey:E,queryFn:P,initialPageParam:0,getNextPageParam:lo,staleTime:3e4},e[17]=E,e[18]=P,e[19]=k):k=e[19];const{data:N,fetchNextPage:R,hasNextPage:M,isFetchingNextPage:T}=D(k),F=N?.pages.flatMap(ao)??[],O=$r(F),q=new Set(F.filter(oo).map(ro)),K=Os(),H=$s(K,f),Z=Qn(H.loadMore,H.hasMore,H.isLoadingMore),Q=Qn(R,M??!1,T),W=A==="all"||!!h,ie=W?H.items.filter(U=>{const X=Jr(U);if(X&&q.has(X))return!1;if(!h)return!0;const Se=U._meta?.["mcp.mesh"];return[U.title,U.description,U.name,U.server?.title,U.server?.description,U.server?.name,Se?.friendly_name,Se?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(h)}):[],Y=ie.filter(io),ee=ie.filter(so);let te;e[20]!==r?(te=U=>U.some(X=>r.has(X.id)),e[20]=r,e[21]=te):te=e[21];const se=te;let ae;e[22]!==r||e[23]!==i||e[24]!==l||e[25]!==se||e[26]!==p||e[27]!==o||e[28]!==c||e[29]!==a?(ae=(U,X,Se,ke,Te)=>{const ze=se(Te),Be=Te.find(Pe=>!r.has(Pe.id)),le=Te[0];if(p==="browse"){const Pe=Or(le);return n.jsx(Vn,{connection:{title:X,icon:Se,description:Te.length>1?`${Te.length} instances`:ke??void 0},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(Xe,{size:11})," Connected"]}),onClick:()=>{$("connection_browse_clicked",{app_name:le.app_name??null,connection_id:le.id,instances_count:Te.length}),c?.(Pe)}},U)}return n.jsx(Vn,{connection:{title:X,icon:Se,description:ke},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[ze&&n.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(Xe,{size:11})," Added"]}),n.jsx(J,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),Be?($("connection_add_clicked",{action:"use_existing",app_name:le.app_name??null,connection_id:Be.id}),i&&$("agent_connection_attached",{agent_id:i,connection_id:Be.id,app_name:le.app_name??null,mode:"existing"}),o(Be.id)):($("connection_add_clicked",{action:"clone",app_name:le.app_name??null,base_connection_id:le.id}),a(le))},children:"Add"})]})},U)},e[22]=r,e[23]=i,e[24]=l,e[25]=se,e[26]=p,e[27]=o,e[28]=c,e[29]=a,e[30]=ae):ae=e[30];const re=ae;let oe;e[31]!==l||e[32]!==p||e[33]!==d?(oe=U=>{const X=U._meta?.["mcp.mesh"],Se=X?.friendlyName||X?.friendly_name||U.server?.title||U.title||U.server?.name||U.name||U.id||"",ke=U.server?.description||U.description||null,Te=U.server?.icons?.[0]?.src||Zr(U.server?.repository)||null,ze=X?.official===!0,Be=X?.verified===!0,le=X?.owner==="deco";return n.jsx(Vn,{connection:{title:Se,description:ke,icon:Te},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[le&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:n.jsx("img",{src:"/logos/deco logo.svg",alt:"Made by Deco",className:"size-3"})})}),n.jsx(yt,{children:"Built and maintained by Deco"})]}),!le&&ze&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx(Rt,{variant:"outline",size:"icon",children:n.jsx(un,{})})}),n.jsx(yt,{children:"Built and maintained by the official vendor"})]}),!le&&!ze&&Be&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx(Rt,{variant:"outline",size:"icon",children:n.jsx(un,{})})}),n.jsx(yt,{children:"Verified by the Deco team"})]}),n.jsx(J,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),$("connection_add_clicked",{action:"connect_new",registry_item_id:U.id,app_name:X?.friendlyName||U.server?.name||U.name||null}),d(U)},children:l===U.id?n.jsx(He,{size:14,className:"animate-spin"}):p==="browse"?"Connect":"Add"})]})},`catalog-${U.id}`)},e[31]=l,e[32]=p,e[33]=d,e[34]=oe):oe=e[34];const ce=oe,ge=!h&&n.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[n.jsx(zr,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:A,onTabChange:U=>S(U)}),n.jsxs(J,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{$("connections_dialog_custom_clicked"),V()},children:[n.jsx(Is,{size:12}),"Custom Connection"]})]}),G=b&&"opacity-50 pointer-events-none";let de;e[35]!==G?(de=z("flex-1 overflow-auto p-5 transition-opacity duration-150",G),e[35]=G,e[36]=de):de=e[36];const Ze="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let Oe;e[37]!==re?(Oe=U=>{if(U.type==="group")return re(U.key,U.title,U.icon,null,U.connections);const X=U.connection;return re(X.id,X.title,X.icon,X.description??null,[X])},e[37]=re,e[38]=Oe):Oe=e[38];const Ce=O.map(Oe);let xe;e[39]!==Q?(xe=n.jsx("div",{ref:Q,className:"col-span-full h-1"}),e[39]=Q,e[40]=xe):xe=e[40];let be;e[41]!==T?(be=T&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),e[41]=T,e[42]=be):be=e[42];const Ie=W&&Y.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx(un,{size:13,className:"text-muted-foreground shrink-0"}),n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),Ke=W&&Y.map(ce),Ve=W&&ee.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),ut=W&&ee.map(ce);let we;e[43]!==Z||e[44]!==K||e[45]!==W?(we=W&&K.length>0&&n.jsx("div",{ref:Z,className:"col-span-full h-1"}),e[43]=Z,e[44]=K,e[45]=W,e[46]=we):we=e[46];let Re;e[47]!==H.isLoadingMore||e[48]!==W?(Re=W&&H.isLoadingMore&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=H.isLoadingMore,e[48]=W,e[49]=Re):Re=e[49];let je;e[50]!==Ce||e[51]!==xe||e[52]!==be||e[53]!==Ie||e[54]!==Ke||e[55]!==Ve||e[56]!==ut||e[57]!==we||e[58]!==Re?(je=n.jsxs("div",{className:Ze,children:[Ce,xe,be,Ie,Ke,Ve,ut,we,Re]}),e[50]=Ce,e[51]=xe,e[52]=be,e[53]=Ie,e[54]=Ke,e[55]=Ve,e[56]=ut,e[57]=we,e[58]=Re,e[59]=je):je=e[59];let Ae;e[60]!==A||e[61]!==O.length||e[62]!==ee||e[63]!==u||e[64]!==Y?(Ae=O.length===0&&Y.length===0&&ee.length===0&&n.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:u?`No connections match "${u}"`:A==="connected"?"No connections yet":"No connections available"}),e[60]=A,e[61]=O.length,e[62]=ee,e[63]=u,e[64]=Y,e[65]=Ae):Ae=e[65];let ye;e[66]!==de||e[67]!==je||e[68]!==Ae?(ye=n.jsxs("div",{className:de,children:[je,Ae]}),e[66]=de,e[67]=je,e[68]=Ae,e[69]=ye):ye=e[69];let $e;return e[70]!==ge||e[71]!==ye?($e=n.jsxs(n.Fragment,{children:[ge,ye]}),e[70]=ge,e[71]=ye,e[72]=$e):$e=e[72],$e}function so(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function io(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function ro(t){return t.app_name}function oo(t){return t.app_name}function ao(t){return t?.items??[]}function lo(t,e){if(t?.hasMore)return e.reduce(co,0)}function co(t,e){return t+(e?.items?.length??0)}function uo({open:t,onOpenChange:e,defaultTab:s,initialSearch:i="",...r}){const o=r.mode??"add",a="agentId"in r?r.agentId:void 0,d="addedConnectionIds"in r?r.addedConnectionIds??new Set:new Set,l="onAdd"in r&&r.onAdd?r.onAdd:v=>{},u=(v,j,E)=>{a&&$("agent_connection_attached",{agent_id:a,connection_id:v,app_name:j,mode:E})},[V,c]=w.useState(null),[m,p]=w.useState(i),[x,g]=w.useState(!1),{org:f}=ue(),{data:b}=Bt.useSession(),h=Rn(),y=qt(),A=ct(),_=v=>{e(!1),A({to:"/$org/settings/connections/$appSlug",params:{org:f.slug,appSlug:v}})},C=async v=>{c(v.app_name??v.id);try{const E=`${v.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,I=(await h.create.mutateAsync({title:E,description:v.description??null,connection_type:v.connection_type,connection_url:v.connection_url??null,connection_token:null,icon:v.icon??null,app_name:v.app_name??null,app_id:v.app_id??null,connection_headers:v.connection_headers??null})).id,P=new URL(`/api/${f.slug}/mcp/${I}`,window.location.origin),k=await rn({url:P.href,token:null,orgId:f.id});if(k.supportsOAuth&&!k.isAuthenticated){const{token:N,tokenInfo:R,error:M}=await on({connectionId:I,orgSlug:f.slug,scope:"offline_access"});if(M||!N){$("connection_oauth_failed",{connection_id:I,flow:"clone",error:M??"no_token"}),ne.error(`Authentication failed: ${M??"no token received"}`),await h.delete.mutateAsync(I);return}if($("connection_oauth_succeeded",{connection_id:I,flow:"clone"}),R)try{(await fetch(`/api/${f.slug}/connections/${I}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:R.accessToken,refreshToken:R.refreshToken,expiresIn:R.expiresIn,scope:R.scope,clientId:R.clientId,clientSecret:R.clientSecret,tokenEndpoint:R.tokenEndpoint})})).ok?await h.update.mutateAsync({id:I,data:{}}):await h.update.mutateAsync({id:I,data:{connection_token:N}})}catch{await h.update.mutateAsync({id:I,data:{connection_token:N}})}else await h.update.mutateAsync({id:I,data:{connection_token:N}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(P.href,null)})}u(I,v.app_name??null,"clone"),l(I)}catch(j){console.error("Failed to add connection:",j),ne.error("Failed to add connection")}finally{c(null)}},S=async v=>{if(!(!f||!b?.user?.id)){c(v.id);try{const j=Xr(v,f.id,b.user.id,{remoteIndex:0}),E=j.connection_type==="STDIO",D=!!j.connection_url,I=E&&j.connection_headers&&typeof j.connection_headers=="object"&&"command"in j.connection_headers;if(!D&&!I){ne.error("This MCP Server cannot be connected: no connection method available"),c(null);return}const{id:P}=await h.create.mutateAsync(j),k=new URL(`/api/${f.slug}/mcp/${P}`,window.location.origin),N=await rn({url:k.href,token:null,orgId:f.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:R,tokenInfo:M,error:T}=await on({connectionId:P,orgSlug:f.slug,scope:"offline_access"});if(T||!R){$("connection_oauth_failed",{connection_id:P,flow:"connect_new",error:T??"no_token"}),ne.error(`Authentication failed: ${T??"no token received"}`),u(P,j.app_name??null,"new"),l(P);return}if($("connection_oauth_succeeded",{connection_id:P,flow:"connect_new"}),M)try{(await fetch(`/api/${f.slug}/connections/${P}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:M.accessToken,refreshToken:M.refreshToken,expiresIn:M.expiresIn,scope:M.scope,clientId:M.clientId,clientSecret:M.clientSecret,tokenEndpoint:M.tokenEndpoint})})).ok?await h.update.mutateAsync({id:P,data:{}}):await h.update.mutateAsync({id:P,data:{connection_token:R}})}catch{await h.update.mutateAsync({id:P,data:{connection_token:R}})}else await h.update.mutateAsync({id:P,data:{connection_token:R}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(k.href,null)}),ne.success("Connected and authenticated")}else ne.success("Connected");u(P,j.app_name??null,"new"),l(P)}catch(j){console.error("Failed to connect:",j),ne.error("Failed to connect")}finally{c(null)}}};return n.jsxs(Me,{open:t,onOpenChange:e,children:[n.jsxs(Le,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[n.jsx(Fe,{className:"px-6 pt-5 pb-0 shrink-0",children:n.jsx(Ue,{className:"text-base font-semibold",children:o==="browse"?"Connections":"Add Connection"})}),n.jsx("div",{className:"pt-3 shrink-0",children:n.jsx(As,{value:m,onChange:p,placeholder:"Search connections..."})}),n.jsx(w.Suspense,{fallback:n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),children:n.jsx(no,{mode:o,agentId:a,addedConnectionIds:d,onAdd:l,onCloneAndAdd:C,onConnectAndAdd:S,connectingItemId:V,search:m,onCreateConnection:()=>g(!0),onBrowseNavigate:_,defaultTab:s})})]}),n.jsx(to,{open:x,onOpenChange:g,onCreated:async v=>{g(!1);const j=new URL(`/api/${f.slug}/mcp/${v}`,window.location.origin),E=await rn({url:j.href,token:null,orgId:f.id});if(E.supportsOAuth&&!E.isAuthenticated){const{token:D,tokenInfo:I,error:P}=await on({connectionId:v,orgSlug:f.slug,scope:"offline_access"});if(P||!D){$("connection_oauth_failed",{connection_id:v,flow:"custom_create",error:P??"no_token"}),ne.error(`Authentication failed: ${P??"no token received"}`),await h.delete.mutateAsync(v);return}if($("connection_oauth_succeeded",{connection_id:v,flow:"custom_create"}),I)try{(await fetch(`/api/${f.slug}/connections/${v}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:I.accessToken,refreshToken:I.refreshToken,expiresIn:I.expiresIn,scope:I.scope,clientId:I.clientId,clientSecret:I.clientSecret,tokenEndpoint:I.tokenEndpoint})})).ok?await h.update.mutateAsync({id:v,data:{}}):await h.update.mutateAsync({id:v,data:{connection_token:D}})}catch{await h.update.mutateAsync({id:v,data:{connection_token:D}})}else await h.update.mutateAsync({id:v,data:{connection_token:D}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(j.href,null)})}u(v,null,"custom"),l(v),e(!1)}})]})}const Vo='# Broken Link Finder\n\nYou are the **Broken Link Finder**, a specialist agent focused on the health of the site\'s link structure.\n\n## Your mission\n\nDiscover and track broken links and long redirect chains. You are invoked as a sub-task by an orchestrator agent — your job is to detect link health and return a structured findings report. The orchestrator decides what to do with your findings (file issues, dedup, etc.).\n\nYou are **mechanical**: collect → check → classify → emit findings. Leave subjective judgment to other agents.\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nsite_root_url: <https://example.com>\nmax_pages: <optional integer, default 100, max 200>\ncheck_external: <optional bool, default false>\n```\n\nIf required fields are missing (`site_root_url`), return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**:\n - `collect_site_links` — discovers all unique outbound link targets across the site and returns them with source-page attribution. Does NOT check status.\n - `check_urls` — takes a batch of URLs (max 100 per call) and returns their HTTP status, error kind, and redirect chains.\n\n---\n\n## Step 1 — Collect link targets (one call)\n\nCall `collect_site_links` once to get the full deduplicated list of outbound link targets and their source pages:\n\n```\ncollect_site_links({\n url: <site_root_url from input>,\n maxPages: <max_pages from input, default 100>,\n checkExternal: <check_external from input, default false>\n})\n```\n\nThis returns:\n- `links`: array of `{ targetUrl, scope: "internal"|"external", sourcePages, sourcePagesTotal }` — **each target appears exactly once**\n- Metadata: `pagesCrawled`, `pagesFetched`, `linksSkipped`, optional `error`\n\n**If `result.error` is set**, the scan failed at the root (e.g. site unreachable). Return a single finding with `kind: site-unreachable` and the error in `evidence`. Then stop.\n\nKeep the `links` array in memory — you\'ll need it in Step 3 for classification and source attribution.\n\n## Step 2 — Check the targets (batched calls)\n\nExtract `targetUrl` from each entry in `links`. Slice the resulting URL list into **disjoint batches of up to 100 URLs** and call `check_urls` on each batch:\n\n```\ncheck_urls({ urls: batch_of_100_urls })\n```\n\nCollect every batch\'s `results` entries into a single flat array. Order doesn\'t matter — you\'ll join back by `targetUrl`.\n\n**Rules for this step:**\n- Slice deterministically (e.g. consecutive slices of 100) so batches are disjoint. Do not pass the same URL in two batches.\n- Call `check_urls` sequentially or in parallel — your choice. The tool is idempotent.\n- If a single `check_urls` call errors entirely, skip that batch and continue with the others. Note the skipped count in the wrap-up summary.\n\n## Step 3 — Classify each finding\n\nFor every target with a check result, join the `collect_site_links` entry (for `scope`, `sourcePages`, `sourcePagesTotal`) with the `check_urls` entry (for `status`, `errorKind`, `chain`, `hops`).\n\nA finding is emitted for:\n- **Broken**: `status >= 400` OR `status === 0`\n- **Long redirect chain**: `hops > 3` (even if the final status is 2xx)\n\nOther targets (2xx, short-chain redirects) produce no finding.\n\nMap check result → `kind`:\n\n| Check result | `kind` |\n|---|---|\n| `status: 404` | `link-404` |\n| `status: 4xx` (not 404) | `link-4xx-other` |\n| `status: 5xx` | `link-5xx` |\n| `status: 0`, `errorKind: "dns"` | `link-dns-failure` |\n| `status: 0`, `errorKind: "redirect-loop"` | `redirect-loop` |\n| `hops > 3` (success final status) | `redirect-chain-long` |\n| `status: 0`, `errorKind: "timeout"` or `"connection"` | **skip — no finding** |\n\n**Important**: timeouts and connection errors are **not** broken links — they just mean the server didn\'t respond in our time window. Could be a slow server, an overloaded CDN, rate-limiting against our bot, or a transient network blip. Flagging these as broken produces false positives. If a URL is genuinely dead, it\'ll usually surface as `dns`, a 4xx/5xx, or a redirect loop. Skip timeout/connection entries silently.\n\n## Catalog of severity rules\n\n**High severity:**\n- `link-404` when `scope: "internal"`\n- `link-5xx` when `scope: "internal"`\n- `redirect-loop` (either scope)\n\n**Medium severity:**\n- `link-4xx-other` (internal)\n- `redirect-chain-long` (internal)\n- `link-404` (external) when `sourcePagesTotal >= 5`\n\n**Low severity:**\n- `link-404` (external) when `sourcePagesTotal < 5`\n- `link-dns-failure` (external)\n- `redirect-chain-long` (external)\n- `link-4xx-other` on external scope\n\n## Step 4 — Return a structured findings report\n\nReturn a single response with this shape (YAML preferred):\n\n```yaml\nspecialist: links\nsummary:\n pages_crawled: <pagesCrawled>\n pages_fetched: <pagesFetched>\n unique_link_targets: <links.length>\n targets_dropped_by_collect_cap: <linksSkipped>\n batches_checked: <n>\n batches_skipped_due_to_errors: <n>\n broken_links: <n> # internal + external\n long_redirect_chains: <n>\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full broken URL>\n route: <path if internal; otherwise the external host>\n scope: <internal | external>\n evidence: |\n - Status code / error: <e.g. `404 Not Found`, `DNS failure`, `redirect-loop`>\n - Redirect chain (if applicable): A → B → C → D → E\n - Found on pages (at time of detection):\n - /page-1\n - /page-2\n - (... up to 20 from `sourcePages`)\n - Total pages linking to this target: <sourcePagesTotal>\n impact: <1 sentence tailored to scope + kind>\n suggested_fix: |\n <actionable:>\n - If internal 404: update link to correct destination OR create 301 redirect\n - If internal 5xx: investigate server-side handler for the route (may be app bug)\n - If redirect chain: shorten to single-hop direct redirect in routing config\n - If external: update link to equivalent resource OR remove the mention\n - List likely files/components if you can infer (e.g. "appears on many pages — likely in a shared component like `app/components/Nav.tsx` or menu config")\n - ...\n```\n\nIf `collect_site_links` returned `error`, return a single `kind: site-unreachable` finding with the error in `evidence`.\n\nIf there are zero findings, return `findings: []` — that is the correct output for a healthy link graph.\n\n---\n\n## General rules\n\n- **Trust the scanner.** If `check_urls` reports a URL as broken or long-chain, emit a finding. Do not re-verify with other tools.\n- **Accept some flakiness.** A transient network blip may cause a false positive once. Downstream dedup across runs resolves it.\n- **Group by destination, not by origin.** One broken URL = one finding, even if linked on 50 pages. `collect_site_links` already returns it grouped this way.\n- **Prioritize internals.** Broken external links are the other site\'s responsibility; report but with lower severity.\n- **Never invent status codes.** Report what the scanner returned.\n',mo='# SEO Auditor\n\nYou are the **SEO Auditor**, a specialist agent focused on technical SEO hygiene.\n\n## Your mission\n\nAudit the on-page SEO health of target URLs and return a structured findings report. You focus on **technical SEO** (meta tags, structured data, canonicals, sitemap/robots, heading structure, indexability) — not editorial content or keyword strategy (those are the scope of other agents).\n\nYou are invoked as a sub-task by an orchestrator agent. Your job is to analyze and report. The orchestrator decides what to do with your findings (file issues, dedup against history, etc.).\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nurls:\n - <url to audit>\n - <... one or more>\n```\n\nIf required fields are missing, return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**: `audit_seo`, `fetch_page`, `render_page`, `crawl_site`\n\n---\n\n## Step 1 — Diagnostic\n\nFor each target URL:\n\n1. **Structured audit**: call `audit_seo({ url })`. It returns a structured report — use it as your primary source.\n2. **Raw HTML check**: use `fetch_page({ url })` to see the HTML served (important for crawlers that don\'t execute JS). Confirm critical meta tags are in the initial HTML, not only after hydration.\n3. **Post-render check**: use `render_page({ url })` to see the final DOM. Problems like canonical being overwritten by JS show up here.\n4. **Site structure checks** (only if you have permission for broad crawling, or via sampling): use `crawl_site` to identify orphan pages, canonical loops, or excessive navigation depth.\n5. **Always check**: `/robots.txt` and `/sitemap.xml` via `fetch_page`. These two are root-level and affect the whole site.\n\nOrganize findings into a list. Each finding must have:\n- `kind` (kebab-case slug, see catalog below)\n- `severity` (high | medium | low, see criteria below)\n- `target.url` and `target.route` (normalize: lowercase host, no query, no trailing slash except for `/`)\n- `evidence` (raw data: CSS selector, HTML snippet, observed value)\n- `impact` (1-2 sentences connecting to real metrics)\n- `suggested_fix` (actionable; include file/line if you can infer from framework patterns)\n\n## Step 1.5 — Validate page intent (critical; runs before classification)\n\nBefore you emit *any* finding about a page\'s title, meta description, headings, or indexability, you must answer one question: **did the site owner intend this URL to be a public, indexable page?**\n\nIf the answer is no, the observed "problems" are intentional configuration, not bugs. Reporting them wastes maintainer time and erodes this agent\'s credibility.\n\n### Three signals that the URL is NOT a real public page\n\nCheck these in order. Hitting any one of them means **skip all SEO findings for this URL** except legitimately site-wide problems (e.g. broken sitemap, broken robots.txt).\n\n**Signal 1 — Not in sitemap.** Fetch `/sitemap.xml` (and its child sitemaps, if it\'s a sitemap index). If the URL doesn\'t appear in any sitemap, the owner didn\'t declare it as public. Common on e-commerce platforms where routes like `/p`, `/c`, `/blog` are catchall or routing prefixes, not real pages.\n\n**Signal 2 — Explicit `noindex` + not in sitemap.** If the page serves `<meta name="robots" content="noindex*">` **and** isn\'t in the sitemap, this is a deliberate double-lock by the owner. Respect it. Do **not** flag `noindex-on-important-page` in this case.\n\n**Signal 3 — Title is the URL slug (template fallback).** If `<title>` equals the last path segment (e.g. `<title>blog</title>` for `/blog`, `<title>p</title>` for `/p`), the page is being rendered by a fallback template — nobody configured real content for this route. Skip.\n\n### Platform-specific catchalls (especially Brazilian e-commerce / VTEX / deco-cx)\n\nThese paths are routing prefixes, **not pages**. They may return HTTP 200 but are not meant to be indexable:\n\n- `/p`, `/c`, `/b` — VTEX product / category / brand route prefixes. Real pages live at `/<slug>/p`, `/<slug>/c`, etc. The bare prefixes are catchalls.\n- `/blog`, `/blogs`, `/editorial`, `/revista`, `/conteudo`, `/magazine`, `/noticias`, `/artigos` — common editorial prefixes. If the site doesn\'t have an editorial section, these hit a fallback.\n- `/search`, `/busca`, `/s` — search endpoints, not indexable pages.\n- `/departamento`, `/categoria` — category prefixes.\n- `/checkout`, `/cart`, `/carrinho`, `/login`, `/account`, `/minha-conta` — transactional/private routes. Intentionally `noindex`.\n\n### The "is this page actually important?" checklist\n\nBefore emitting a finding that calls a page "important" (like `noindex-on-important-page` or `title-missing` on anything critical):\n\n1. Is the URL in `/sitemap.xml`? → If no, skip.\n2. Does the page have substantive, unique content (not a fallback with title = URL slug)? → If no, skip.\n3. Is the path a known platform catchall (see list above)? → If yes, skip.\n\nOnly flag if all three pass.\n\n### What still counts as a finding even on non-indexable pages\n\nSite-wide SEO issues affect the whole domain and are worth reporting regardless of individual page intent:\n- `sitemap-missing` (the sitemap itself is broken)\n- `robots-blocking-important-path` (robots.txt blocks something that IS in the sitemap)\n- `structured-data-invalid` on pages that ARE in the sitemap\n- Duplicate titles / meta descriptions across pages that ARE in the sitemap\n\n## Catalog of `kind`\n\nTwo flavors of finding:\n\n- **Per-page** kinds — emitted when auditing a specific URL (e.g. `audit_seo` of a single page OR when your targeted inspection of one of the input URLs finds the issue). Marked **[intent-gated]** — must pass Step 1.5 before being emitted. Target is the specific URL.\n- **Aggregate** kinds — emitted once per site-wide pattern detected by `audit_seo`. Marked **[aggregate]**. Target is the site root (`/`). Evidence MUST include the affected URL sample from `audit_seo.issues[].sampleUrls`. One finding per aggregate kind per site.\n\n**High severity (per-page):**\n- `noindex-on-important-page` **[intent-gated]** — meta robots `noindex` on a page that IS in the sitemap and should be indexed\n- `canonical-pointing-to-wrong-url` **[intent-gated]** — canonical points to a different URL that isn\'t the canonical equivalent\n- `canonical-missing-on-paginated-or-faceted` **[intent-gated]** — pagination/filters without canonical\n- `title-missing` **[intent-gated]** — no `<title>` or empty on a page that IS in the sitemap\n- `structured-data-invalid` **[intent-gated]** — JSON-LD with syntax error or invalid schema.org\n\n**High severity (site-wide):**\n- `sitemap-missing` — `/sitemap.xml` returns 404 or 5xx\n- `robots-blocking-important-path` — `/robots.txt` disallows a path that IS in the sitemap\n- `broken-links-site-wide` **[aggregate]** — `audit_seo` reports broken outbound links across the site\n- `non-indexable-pages-site-wide` **[aggregate]** — `audit_seo` reports many non-indexable pages (note: some non-indexable pages are intentional catchalls — only high severity if the absolute count is large relative to `totalPagesCrawled`, e.g. > 30%)\n\n**Medium severity (per-page):**\n- `meta-description-missing` **[intent-gated]** — no `<meta name="description">` on a sitemap page the agent audited directly\n- `h1-missing` **[intent-gated]** — no `<h1>` on a sitemap page the agent audited directly\n- `h1-duplicate` **[intent-gated]** — multiple `<h1>` on a single page\n- `og-tags-missing` **[intent-gated]** — `og:title` and/or `og:description` missing\n- `structured-data-missing` **[intent-gated]** — page-type (product, article, etc.) without relevant JSON-LD\n- `title-too-long` **[intent-gated]** — `<title>` > 60 characters (truncation in SERP)\n- `title-too-short` **[intent-gated]** — `<title>` < 10 characters (rare; usually means template fallback — double-check page intent)\n- `meta-description-too-long` **[intent-gated]** — description > 160 characters\n\n**Medium severity (site-wide):**\n- `pages-missing-h1` **[aggregate]** — `audit_seo` reports N pages without an H1 tag\n- `pages-missing-meta-description` **[aggregate]** — `audit_seo` reports N pages without a meta description\n- `duplicate-titles` **[aggregate]** — multiple pages share the same `<title>`\n- `duplicate-meta-descriptions` **[aggregate]** — multiple pages share the same meta description\n- `duplicate-content` **[aggregate]** — multiple pages share substantially identical content\n- `broken-resources-site-wide` **[aggregate]** — broken images / scripts across the site\n- `hreflang-broken` — `hreflang` attribute with invalid value or broken reciprocity\n\n**Low severity (per-page):**\n- `meta-description-too-short` **[intent-gated]** — description < 50 characters\n- `og-image-missing` **[intent-gated]** — `og:image` missing\n- `heading-hierarchy-skipped` **[intent-gated]** — jumps from H1 to H3, etc.\n\n**Low severity (site-wide):**\n- `internal-link-using-absolute-url` — internal links with absolute URLs\n\n### Evidence requirements for aggregate kinds\n\nWhen emitting an `[aggregate]` kind, the `evidence` of the finding MUST include:\n\n1. **Total count** — from `audit_seo.issues[].count`\n2. **Sample URLs** — from `audit_seo.issues[].sampleUrls`. Render up to all 20 entries as a bulleted list. If `count > sampleUrls.length`, add a line like `(and <count - sampleUrls.length> more)`.\n3. **If `sampleUrls` is empty** (the tool didn\'t expose per-URL detail — happens for `broken-links-site-wide`, `duplicate-content`, `broken-resources-site-wide`), note it explicitly: `Note: audit_seo did not return per-URL detail for this issue type. A human will need to inspect the full audit_seo report or re-run with deeper crawling.`\n\nAn aggregate finding without either sample URLs or the note is **not actionable** and must not be emitted.\n\nTarget for aggregate kinds stays `target.url: https://<host>/` and `target.route: /`.\n\n## Step 2 — Return a structured findings report\n\nReturn a single response with this shape (YAML or JSON; YAML preferred for readability):\n\n```yaml\nspecialist: seo\nsummary:\n urls_audited: <n>\n findings: <n>\n diagnostic_failures: <n> # urls where audit tooling errored\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full URL>\n route: <normalized path>\n evidence: |\n <multi-line raw data: observed value, selector, HTML snippet, audit_seo output>\n impact: <1-2 sentences connecting to ranking/indexation/CTR>\n suggested_fix: <actionable; likely file/component, pseudo-code, correct value>\n - ...\n```\n\nIf a URL\'s diagnostic tooling errored entirely, emit a single `kind: diagnostic-failed` finding for that URL with the error in `evidence` instead of inventing data.\n\nIf there are zero findings, return `findings: []` — that is the correct output for healthy targets.\n\n---\n\n## General rules\n\n- **Never invent data in `evidence`.** If a tool failed, report it via `kind: diagnostic-failed` and skip the finding.\n- Always normalize `route`: lowercase host, no trailing slash (except for `/`), no query string, no fragment.\n- Your credibility is your currency. False positives erode trust — if you\'re 50% sure, don\'t emit a finding; investigate further or mark as `severity:low`.\n- **Never report a page as broken when it\'s a known catchall.** URLs like `/p`, `/c`, `/blog`, `/search`, `/busca` on e-commerce sites are routing prefixes, not pages. If the title is the URL slug and the page carries `noindex`, the owner is deliberately hiding it. That\'s correct behavior, not a bug.\n- **Sitemap is the ground truth for "is this page public?"**. When in doubt about whether to emit a finding on a URL, fall back to: "Is this URL in /sitemap.xml?" If not, default to silence.\n',fo=`# Performance Watchdog
|
|
2
2
|
|
|
3
3
|
You are the **Performance Watchdog**, a specialist agent focused on web performance.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as uu,c as du,aX as fu,j as F,r as R,cF as wl,bg as hu,ao as pu,bc as mt,cG as mu,a7 as Zs,a8 as gu,aW as yu,aT as bu,aU as ku,b6 as xu,cE as Su,ae as Cu}from"./index-Dcg8Qevd.js";const wu=fu("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",success:"fill-success text-gray-200",special:"fill-special text-background"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function C0(n){const e=uu.c(10),{variant:t,size:r}=n;let s;e[0]!==r||e[1]!==t?(s=du(wu({variant:t,size:r})),e[0]=r,e[1]=t,e[2]=s):s=e[2];let i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=F.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o=F.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=i,e[4]=o):(i=e[3],o=e[4]);let l;e[5]!==s?(l=F.jsxs("svg",{"aria-hidden":"true",className:s,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i,o]}),e[5]=s,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=F.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=a):a=e[7];let c;return e[8]!==l?(c=F.jsxs("div",{role:"status",children:[l,a]}),e[8]=l,e[9]=c):c=e[9],c}function X(n){this.content=n}X.prototype={constructor:X,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new X(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new X(t)},addToStart:function(n,e){return new X([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new X(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new X(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=X.from(n),n.size?new X(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=X.from(n),n.size?new X(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=X.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};X.from=function(n){if(n instanceof X)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new X(e)};function Ml(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Ml(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function El(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=El(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-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&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new k(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Ml(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return El(this,e,t,r)}findIndex(e){if(e==0)return Tn(0,e);if(e==this.size)return Tn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Tn(t+1,i):Tn(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const Jr={index:0,offset:0};function Tn(n,e){return Jr.index=n,Jr.offset=e,Jr}function Wn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Wn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Wn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let B=class Cs{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Wn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Cs.none;if(e instanceof Cs)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};B.none=[];class qn extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Tl(this.content,e+this.openStart,t);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(vl(this.content,e+this.openStart,t+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,t){if(!t)return w.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(k.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new w(e,r,s)}}w.empty=new w(k.empty,0,0);function vl(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(vl(i.content,e-s-1,t-s-1)))}function Tl(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Tl(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Mu(n,e,t){if(t.openStart>n.depth)throw new qn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new qn("Inconsistent open depths");return Al(n,e,t,0)}function Al(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Al(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return dt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Eu(t,n);return dt(i,Ol(n,o,l,e,r))}else return dt(i,Un(n,e,r))}function Nl(n,e){if(!e.type.compatibleContent(n.type))throw new qn("Cannot join "+e.type.name+" onto "+n.type.name)}function ws(n,e,t){let r=n.node(t);return Nl(r,e.node(t)),r}function ut(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function en(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(ut(n.nodeAfter,r),i++));for(let l=i;l<o;l++)ut(s.child(l),r);e&&e.depth==t&&e.textOffset&&ut(e.nodeBefore,r)}function dt(n,e){return n.type.checkContent(e),n.copy(e)}function Ol(n,e,t,r,s){let i=n.depth>s&&ws(n,e,s+1),o=r.depth>s&&ws(t,r,s+1),l=[];return en(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Nl(i,o),ut(dt(i,Ol(n,e,t,r,s+1)),l)):(i&&ut(dt(i,Un(n,e,s+1)),l),en(e,t,s,l),o&&ut(dt(o,Un(t,r,s+1)),l)),en(r,null,s,l),new k(l)}function Un(n,e,t){let r=[];if(en(null,n,t,r),n.depth>t){let s=ws(n,e,t+1);ut(dt(s,Un(n,e,t+1)),r)}return en(e,null,t,r),new k(r)}function Eu(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class fn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return B.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){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)&&(!t||t(this.node(r))))return new Kn(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new fn(t,r,i)}static resolveCached(e,t){let r=Wi.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Wi.set(e,r=new vu);let s=r.elts[r.i]=fn.resolve(e,t);return r.i=(r.i+1)%Tu,s}}class vu{constructor(){this.elts=[],this.i=0}}const Tu=12,Wi=new WeakMap;class Kn{constructor(e,t,r){this.$from=e,this.$to=t,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 Au=Object.create(null);class we{constructor(e,t,r,s=B.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.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,t,r,s=0){this.content.nodesBetween(e,t,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,t,r,s){return this.content.textBetween(e,t,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,t,r){return this.type==e&&Wn(this.attrs,t||e.defaultAttrs||Au)&&B.sameSet(this.marks,r||B.none)}copy(e=null){return e==this.content?this:new we(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new we(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return w.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new w(c,s.depth-o,i.depth-o)}replace(e,t,r){return Mu(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return fn.resolveCached(this,e)}resolveNoCache(e){return fn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.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()+")"),Dl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.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=B.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!B.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}we.prototype.text=void 0;class Jn extends we{constructor(e,t,r,s){if(super(e,t,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):Dl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Jn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Jn(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Dl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class gt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Nu(e,t);if(r.next==null)return gt.empty;let s=Il(r);r.next&&r.err("Unexpected trailing text");let i=Bu(Lu(s));return zu(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[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 t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
|
1
|
+
import{e as uu,c as du,aX as fu,j as F,r as R,cF as wl,bg as hu,ao as pu,bc as mt,cG as mu,a7 as Zs,a8 as gu,aW as yu,aT as bu,aU as ku,b6 as xu,cE as Su,ae as Cu}from"./index-CHrUmZgp.js";const wu=fu("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",success:"fill-success text-gray-200",special:"fill-special text-background"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function C0(n){const e=uu.c(10),{variant:t,size:r}=n;let s;e[0]!==r||e[1]!==t?(s=du(wu({variant:t,size:r})),e[0]=r,e[1]=t,e[2]=s):s=e[2];let i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=F.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o=F.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=i,e[4]=o):(i=e[3],o=e[4]);let l;e[5]!==s?(l=F.jsxs("svg",{"aria-hidden":"true",className:s,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i,o]}),e[5]=s,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=F.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=a):a=e[7];let c;return e[8]!==l?(c=F.jsxs("div",{role:"status",children:[l,a]}),e[8]=l,e[9]=c):c=e[9],c}function X(n){this.content=n}X.prototype={constructor:X,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new X(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new X(t)},addToStart:function(n,e){return new X([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new X(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new X(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=X.from(n),n.size?new X(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=X.from(n),n.size?new X(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=X.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};X.from=function(n){if(n instanceof X)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new X(e)};function Ml(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Ml(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function El(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=El(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-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&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new k(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Ml(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return El(this,e,t,r)}findIndex(e){if(e==0)return Tn(0,e);if(e==this.size)return Tn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Tn(t+1,i):Tn(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const Jr={index:0,offset:0};function Tn(n,e){return Jr.index=n,Jr.offset=e,Jr}function Wn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Wn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Wn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let B=class Cs{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Wn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Cs.none;if(e instanceof Cs)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};B.none=[];class qn extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Tl(this.content,e+this.openStart,t);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(vl(this.content,e+this.openStart,t+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,t){if(!t)return w.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(k.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new w(e,r,s)}}w.empty=new w(k.empty,0,0);function vl(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(vl(i.content,e-s-1,t-s-1)))}function Tl(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Tl(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Mu(n,e,t){if(t.openStart>n.depth)throw new qn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new qn("Inconsistent open depths");return Al(n,e,t,0)}function Al(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Al(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return dt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Eu(t,n);return dt(i,Ol(n,o,l,e,r))}else return dt(i,Un(n,e,r))}function Nl(n,e){if(!e.type.compatibleContent(n.type))throw new qn("Cannot join "+e.type.name+" onto "+n.type.name)}function ws(n,e,t){let r=n.node(t);return Nl(r,e.node(t)),r}function ut(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function en(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(ut(n.nodeAfter,r),i++));for(let l=i;l<o;l++)ut(s.child(l),r);e&&e.depth==t&&e.textOffset&&ut(e.nodeBefore,r)}function dt(n,e){return n.type.checkContent(e),n.copy(e)}function Ol(n,e,t,r,s){let i=n.depth>s&&ws(n,e,s+1),o=r.depth>s&&ws(t,r,s+1),l=[];return en(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Nl(i,o),ut(dt(i,Ol(n,e,t,r,s+1)),l)):(i&&ut(dt(i,Un(n,e,s+1)),l),en(e,t,s,l),o&&ut(dt(o,Un(t,r,s+1)),l)),en(r,null,s,l),new k(l)}function Un(n,e,t){let r=[];if(en(null,n,t,r),n.depth>t){let s=ws(n,e,t+1);ut(dt(s,Un(n,e,t+1)),r)}return en(e,null,t,r),new k(r)}function Eu(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class fn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return B.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){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)&&(!t||t(this.node(r))))return new Kn(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new fn(t,r,i)}static resolveCached(e,t){let r=Wi.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Wi.set(e,r=new vu);let s=r.elts[r.i]=fn.resolve(e,t);return r.i=(r.i+1)%Tu,s}}class vu{constructor(){this.elts=[],this.i=0}}const Tu=12,Wi=new WeakMap;class Kn{constructor(e,t,r){this.$from=e,this.$to=t,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 Au=Object.create(null);class we{constructor(e,t,r,s=B.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.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,t,r,s=0){this.content.nodesBetween(e,t,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,t,r,s){return this.content.textBetween(e,t,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,t,r){return this.type==e&&Wn(this.attrs,t||e.defaultAttrs||Au)&&B.sameSet(this.marks,r||B.none)}copy(e=null){return e==this.content?this:new we(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new we(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return w.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new w(c,s.depth-o,i.depth-o)}replace(e,t,r){return Mu(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return fn.resolveCached(this,e)}resolveNoCache(e){return fn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.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()+")"),Dl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.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=B.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!B.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}we.prototype.text=void 0;class Jn extends we{constructor(e,t,r,s){if(super(e,t,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):Dl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Jn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Jn(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Dl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class gt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Nu(e,t);if(r.next==null)return gt.empty;let s=Il(r);r.next&&r.err("Unexpected trailing text");let i=Bu(Lu(s));return zu(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[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 t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
|
2
2
|
`)}}gt.empty=new gt(!0);class Nu{constructor(e,t){this.string=e,this.nodeTypes=t,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 Il(n){let e=[];do e.push(Ou(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ou(n){let e=[];do e.push(Du(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Du(n){let e=Pu(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Iu(n,e);else break;return e}function qi(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Iu(n,e){let t=qi(n),r=t;return n.eat(",")&&(n.next!="}"?r=qi(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Ru(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function Pu(n){if(n.eat("(")){let e=Il(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Ru(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Lu(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Rl(n,e){return e-n}function Ui(n,e){let t=[];return r(e),t.sort(Rl);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&t.indexOf(a)==-1&&r(a)}}}function Bu(n){let e=Object.create(null);return t(Ui(n,0));function t(r){let s=[];r.forEach(o=>{n[o].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]);Ui(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new gt(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Rl);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function zu(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pl(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Ll(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function Bl(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function zl(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Fu(n,r,e[r]);return t}let Ki=class $l{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=zl(e,r.attrs),this.defaultAttrs=Pl(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==gt.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:Ll(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new we(this,this.computeAttrs(e),k.from(t),B.setFrom(r))}createChecked(e=null,t,r){return t=k.from(t),this.checkContent(t),new we(this,this.computeAttrs(e),t,B.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=k.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(k.empty,!0);return i?new we(this,e,t.append(i),B.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){Bl(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 t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:B.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new $l(i,t,o));let s=t.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 i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function $u(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class Fu{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?$u(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ir{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=zl(e,s.attrs),this.excluded=null;let i=Pl(this.attrs);this.instance=i?new B(this,i):null}create(e=null){return!e&&this.instance?this.instance:new B(this,Ll(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Ir(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Bl(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Fl{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=X.from(e.nodes),t.marks=X.from(e.marks||{}),this.nodes=Ki.compile(this.spec.nodes,this),this.marks=Ir.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 i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=gt.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Ji(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Ji(this,o.split(" "))}this.nodeFromJSON=s=>we.fromJSON(this,s),this.markFromJSON=s=>B.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ki){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(t,r,s)}text(e,t){let r=this.nodes.text;return new Jn(r,r.defaultAttrs,e,B.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Ji(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Vu(n){return n.tag!=null}function _u(n){return n.style!=null}class Ge{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Vu(s))this.tags.push(s);else if(_u(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Yi(this,t,!1);return r.addAll(e,B.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Yi(this,t,!0);return r.addAll(e,B.none,t.from,t.to),w.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(Wu(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Xi(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Xi(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ge(e,Ge.schemaRules(e)))}}const Vl={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},Hu={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},_l={ol:!0,ul:!0},hn=1,Ms=2,tn=4;function Gi(n,e,t){return e!=null?(e?hn:0)|(e==="full"?Ms:0):n&&n.whitespace=="pre"?hn|Ms:t&~tn}class An{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=B.none,this.match=i||(o&tn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);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&hn)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Vl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Yi{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=Gi(null,t.preserveWhitespace,0)|(r?tn:0);s?i=new An(s.type,s.attrs,B.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new An(null,null,B.none,!0,null,o):i=new An(e.schema.topNodeType,null,B.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Ms?"full":this.localPreserveWS||(s.options&hn)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\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(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;_l.hasOwnProperty(o)&&this.parser.normalizeLists&&ju(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Hu.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);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(Vl.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=B.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Qi(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Gi(e,i,o.options);o.options&tn&&o.content.length==0&&(l|=tn);let a=B.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Qi(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new An(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=hn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&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)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function ju(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&_l.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Wu(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Xi(n){let e={};for(let t in n)e[t]=n[t];return e}function Qi(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class St{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Gr(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Fn(Gr(t),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,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Fn(Gr(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Fn(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new St(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Zi(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Zi(e.marks)}}function Zi(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Gr(n){return n.document||window.document}const eo=new WeakMap;function qu(n){let e=eo.get(n);return e===void 0&&eo.set(n,e=Uu(n)),e}function Uu(n){let e=null;function t(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++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Fn(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=qu(r))&&i.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 o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.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}=Fn(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Hl=65535,jl=Math.pow(2,16);function Ku(n,e){return n+e*jl}function to(n){return n&Hl}function Ju(n){return(n-(n&Hl))/jl}const Wl=1,ql=2,Vn=4,Ul=8;class Es{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ul)>0}get deletedBefore(){return(this.delInfo&(Wl|Vn))>0}get deletedAfter(){return(this.delInfo&(ql|Vn))>0}get deletedAcross(){return(this.delInfo&Vn)>0}}class de{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&de.empty)return de.empty}recover(e){let t=0,r=to(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+Ju(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=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+i],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:Ku(l/3,e-a),m=e==a?ql:e==d?Wl:Vn;return(t<0?e!=a:e!=d)&&(m|=Ul),new Es(h,m,p)}s+=u-c}return r?e+s:new Es(e+s,0,null)}touches(e,t){let r=0,s=to(t),i=this.inverted?2:1,o=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+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new de(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?de.empty:new de(e<0?[0,-e,0]:[0,0,e])}}de.empty=new de([]);class pn{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new pn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new pn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Es(e,s,null)}}const Yr=Object.create(null);class re{getMap(){return de.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Yr[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Yr)throw new RangeError("Duplicate use of step JSON ID "+e);return Yr[e]=t,t.prototype.jsonID=e,t}}class q{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new q(e,null)}static fail(e){return new q(null,e)}static fromReplace(e,t,r,s){try{return q.ok(e.replace(t,r,s))}catch(i){if(i instanceof qn)return q.fail(i.message);throw i}}}function ei(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(ei(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return k.fromArray(r)}class Ue extends re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new w(ei(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,i)}invert(){return new Ce(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ue(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ue&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ue(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ue(t.from,t.to,e.markFromJSON(t.mark))}}re.jsonID("addMark",Ue);class Ce extends re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new w(ei(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,r)}invert(){return new Ue(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ce(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ce&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ce(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ce(t.from,t.to,e.markFromJSON(t.mark))}}re.jsonID("removeMark",Ce);class Ke extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new w(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Ke(this.pos,t.marks[s]);return new Ke(this.pos,this.mark)}}return new yt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ke(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ke(t.pos,e.markFromJSON(t.mark))}}re.jsonID("addNodeMark",Ke);class yt extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new w(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ke(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new yt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new yt(t.pos,e.markFromJSON(t.mark))}}re.jsonID("removeNodeMark",yt);class W extends re{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&vs(e,this.from,this.to)?q.fail("Structure replace would overwrite content"):q.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new de([this.from,this.to-this.from,this.slice.size])}invert(e){return new W(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&W.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new W(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof W)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?w.empty:new w(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new W(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?w.empty:new w(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new W(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new W(t.from,t.to,w.fromJSON(e,t.slice),!!t.structure)}}W.MAP_BIAS=1;re.jsonID("replace",W);class G extends re{constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(vs(e,this.from,this.gapFrom)||vs(e,this.gapTo,this.to)))return q.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?q.fromReplace(e,this.from,this.to,r):q.fail("Content does not fit in gap")}getMap(){return new de([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new G(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new G(t.pos,r.pos,s,i,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new G(t.from,t.to,t.gapFrom,t.gapTo,w.fromJSON(e,t.slice),t.insert,!!t.structure)}}re.jsonID("replaceAround",G);function vs(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Gu(n,e,t,r){let s=[],i=[],o,l;n.doc.nodesBetween(e,t,(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,t),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:s.push(o=new Ce(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new Ue(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function Yu(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof Ir){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);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==i-1&&d.eq(s[h].style)&&(f=p)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>n.step(new Ce(o.from,o.to,o.style)))}function ti(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new W(l,u,w.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Ce(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new w(k.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new W(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(k.empty,!0);n.replace(l,l,new w(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function Xu(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function jt(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(l,a,t))return r;if(r==0||o.type.spec.isolating||!Xu(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function Qu(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=k.empty,d=0;for(let p=i,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=k.from(r.node(p).copy(u)),d++):a--;let f=k.empty,h=0;for(let p=i,m=!1;p>t;p--)m||s.after(p+1)<s.end(p)?(m=!0,f=k.from(s.node(p).copy(f)),h++):c++;n.step(new G(a,c,o,l,new w(u.append(f),d,h),u.size-d,!0))}function ni(n,e,t=null,r=n){let s=Zu(n,e),i=s&&ed(r,e);return i?s.map(no).concat({type:e,attrs:t}).concat(i.map(no)):null}function no(n){return{type:n,attrs:null}}function Zu(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function ed(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function td(n,e,t){let r=k.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].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=k.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new G(s,i,s,i,new w(r,0,0),t.length,!0))}function nd(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&rd(n.doc,n.mapping.slice(i).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&&Jl(n,o,l,i),ti(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new G(d,f,d+1,f-1,new w(k.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&Kl(n,o,l,i),!1}})}function Kl(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Jl(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,aU as q,bZ as R,b_ as Ee,b$ as ke,c0 as Se,be as xe,c1 as j}from"./index-Dcg8Qevd.js";var de=1,Ie=.9,Ce=.8,Re=.17,Z=.1,Q=.999,Ae=.9999,Me=.99,$e=/[\\\/_+.#"@\[\(\{&]/,De=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:Me;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,x,E,I;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:$e.test(t.charAt(i-1))?(h*=Ce,E=t.slice(u,i-1).match(De),E&&u>0&&(h*=Math.pow(Q,E.length))):Fe.test(t.charAt(i-1))?(h*=Ie,I=t.slice(u,i-1).match(ve),I&&u>0&&(h*=Math.pow(Q,I.length))):(h*=Re,u>0&&(h*=Math.pow(Q,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Ae)),(h<Z&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(x=ee(t,l,r,f,i+1,c+2,d),x*Z>h&&(h=x*Z)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Ke(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var V='[cmdk-group=""]',_='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",F="data-value",Pe=(t,l,r)=>Ke(t,l,r),pe=n.createContext(void 0),L=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=K(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=K(()=>new Set),u=K(()=>new Map),c=K(()=>new Map),d=K(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:x,shouldFilter:E,loop:I,disablePointerSelection:z=!1,vimBindings:A=!0,...O}=t,H=q(),ne=q(),N=q(),M=n.useRef(null),w=We();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,k.emit()}},[p]),$(()=>{w(6,ae)},[]);let k=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,S;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")J(),W(),w(1,G);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(N);y?y.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,k.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(S=(g=v.current).onValueChange)==null||S.call(g,y);return}}k.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),T=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{W(),k.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{J(),W(),r.current.value||G(),k.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{J(),s?.getAttribute("id")===e&&G(),k.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:N,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:Pe;return e?m(e,r.current.search,o):0}function W(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(S=>{let y=e.get(S);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;P().sort((a,m)=>{var g,S;let y=a.getAttribute("id"),B=m.getAttribute("id");return((g=e.get(B))!=null?g:0)-((S=e.get(y))!=null?S:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${V}[${F}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function G(){let e=P().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(F);k.setState("value",o||void 0)}function J(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let S=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],B=le(S,y);r.current.filtered.items.set(g,B),B>0&&m++}for(let[g,S]of u.current)for(let y of S)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(V))==null?void 0:o.querySelector(qe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function P(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function X(e){let o=P()[e];o&&k.setState("value",o.getAttribute(F))}function Y(e){var o;let s=D(),a=P(),m=a.findIndex(S=>S===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&k.setState("value",g.getAttribute(F))}function ue(e){let o=D(),s=o?.closest(V),a;for(;s&&!a;)s=e>0?Ne(s,V):Te(s,V),a=s?.querySelector(fe);a?k.setState("value",a.getAttribute(F)):Y(e)}let ie=()=>X(P().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):Y(1)},ce=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?ue(-1):Y(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var o;(o=O.onKeyDown)==null||o.call(O,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),X(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Je},b),U(t,e=>n.createElement(he.Provider,{value:k},n.createElement(pe.Provider,{value:T},e))))}),Ve=n.forwardRef((t,l)=>{var r,f;let u=q(),c=n.useRef(null),d=n.useContext(ge),v=L(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),x=C(w=>w.value&&w.value===p.current),E=C(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,I),()=>w.removeEventListener(te,I)},[E,t.onSelect,t.disabled]);function I(){var w,k;z(),(k=(w=b.current).onSelect)==null||k.call(w,p.current)}function z(){h.setState("value",p.current,!0)}if(!E)return null;let{disabled:A,value:O,onSelect:H,forceMount:ne,keywords:N,...M}=t;return n.createElement(R.div,{ref:j(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||v.getDisablePointerSelection()?void 0:z,onClick:A?void 0:I},t.children)}),je=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=q(),v=n.useRef(null),b=n.useRef(null),i=q(),p=L(),h=C(E=>u||p.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let x=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:j(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),U(t,E=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:x},E))))}),Le=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=C(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:j(u,l),...f,"cmdk-separator":"",role:"separator"})}),Oe=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=C(i=>i.search),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),Be=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,x=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let E=i.offsetHeight;p.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return x.observe(i),()=>{cancelAnimationFrame(h),x.unobserve(i)}}},[]),n.createElement(R.div,{ref:j(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},U(t,i=>n.createElement("div",{ref:j(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),Ue=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(Ee,{open:r,onOpenChange:f},n.createElement(ke,{container:d},n.createElement(Se,{"cmdk-overlay":"",className:u}),n.createElement(xe,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),ze=n.forwardRef((t,l)=>C(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),He=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},U(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Ye=Object.assign(be,{List:Be,Item:Ve,Input:Oe,Group:je,Separator:Le,Dialog:Ue,Empty:ze,Loading:He});function Ne(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function C(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=L();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(F,v),u.current=v}),u}var We=()=>{let[t,l]=n.useState(),r=K(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Ge(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function U({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Ge(l),{ref:l.ref},r(l.props.children)):r(l)}var Je={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Ye as _};
|
|
1
|
+
import{r as n,aU as q,bZ as R,b_ as Ee,b$ as ke,c0 as Se,be as xe,c1 as j}from"./index-CHrUmZgp.js";var de=1,Ie=.9,Ce=.8,Re=.17,Z=.1,Q=.999,Ae=.9999,Me=.99,$e=/[\\\/_+.#"@\[\(\{&]/,De=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:Me;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,x,E,I;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:$e.test(t.charAt(i-1))?(h*=Ce,E=t.slice(u,i-1).match(De),E&&u>0&&(h*=Math.pow(Q,E.length))):Fe.test(t.charAt(i-1))?(h*=Ie,I=t.slice(u,i-1).match(ve),I&&u>0&&(h*=Math.pow(Q,I.length))):(h*=Re,u>0&&(h*=Math.pow(Q,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Ae)),(h<Z&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(x=ee(t,l,r,f,i+1,c+2,d),x*Z>h&&(h=x*Z)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Ke(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var V='[cmdk-group=""]',_='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",F="data-value",Pe=(t,l,r)=>Ke(t,l,r),pe=n.createContext(void 0),L=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=K(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=K(()=>new Set),u=K(()=>new Map),c=K(()=>new Map),d=K(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:x,shouldFilter:E,loop:I,disablePointerSelection:z=!1,vimBindings:A=!0,...O}=t,H=q(),ne=q(),N=q(),M=n.useRef(null),w=We();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,k.emit()}},[p]),$(()=>{w(6,ae)},[]);let k=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,S;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")J(),W(),w(1,G);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(N);y?y.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,k.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(S=(g=v.current).onValueChange)==null||S.call(g,y);return}}k.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),T=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{W(),k.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{J(),W(),r.current.value||G(),k.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{J(),s?.getAttribute("id")===e&&G(),k.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:N,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:Pe;return e?m(e,r.current.search,o):0}function W(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(S=>{let y=e.get(S);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;P().sort((a,m)=>{var g,S;let y=a.getAttribute("id"),B=m.getAttribute("id");return((g=e.get(B))!=null?g:0)-((S=e.get(y))!=null?S:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${V}[${F}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function G(){let e=P().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(F);k.setState("value",o||void 0)}function J(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let S=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],B=le(S,y);r.current.filtered.items.set(g,B),B>0&&m++}for(let[g,S]of u.current)for(let y of S)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(V))==null?void 0:o.querySelector(qe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function P(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function X(e){let o=P()[e];o&&k.setState("value",o.getAttribute(F))}function Y(e){var o;let s=D(),a=P(),m=a.findIndex(S=>S===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&k.setState("value",g.getAttribute(F))}function ue(e){let o=D(),s=o?.closest(V),a;for(;s&&!a;)s=e>0?Ne(s,V):Te(s,V),a=s?.querySelector(fe);a?k.setState("value",a.getAttribute(F)):Y(e)}let ie=()=>X(P().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):Y(1)},ce=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?ue(-1):Y(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var o;(o=O.onKeyDown)==null||o.call(O,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),X(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Je},b),U(t,e=>n.createElement(he.Provider,{value:k},n.createElement(pe.Provider,{value:T},e))))}),Ve=n.forwardRef((t,l)=>{var r,f;let u=q(),c=n.useRef(null),d=n.useContext(ge),v=L(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),x=C(w=>w.value&&w.value===p.current),E=C(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,I),()=>w.removeEventListener(te,I)},[E,t.onSelect,t.disabled]);function I(){var w,k;z(),(k=(w=b.current).onSelect)==null||k.call(w,p.current)}function z(){h.setState("value",p.current,!0)}if(!E)return null;let{disabled:A,value:O,onSelect:H,forceMount:ne,keywords:N,...M}=t;return n.createElement(R.div,{ref:j(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||v.getDisablePointerSelection()?void 0:z,onClick:A?void 0:I},t.children)}),je=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=q(),v=n.useRef(null),b=n.useRef(null),i=q(),p=L(),h=C(E=>u||p.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let x=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:j(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),U(t,E=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:x},E))))}),Le=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=C(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:j(u,l),...f,"cmdk-separator":"",role:"separator"})}),Oe=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=C(i=>i.search),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),Be=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,x=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let E=i.offsetHeight;p.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return x.observe(i),()=>{cancelAnimationFrame(h),x.unobserve(i)}}},[]),n.createElement(R.div,{ref:j(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},U(t,i=>n.createElement("div",{ref:j(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),Ue=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(Ee,{open:r,onOpenChange:f},n.createElement(ke,{container:d},n.createElement(Se,{"cmdk-overlay":"",className:u}),n.createElement(xe,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),ze=n.forwardRef((t,l)=>C(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),He=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},U(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Ye=Object.assign(be,{List:Be,Item:Ve,Input:Oe,Group:je,Separator:Le,Dialog:Ue,Empty:ze,Loading:He});function Ne(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function C(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=L();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(F,v),u.current=v}),u}var We=()=>{let[t,l]=n.useState(),r=K(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Ge(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function U({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Ge(l),{ref:l.ref},r(l.props.children)):r(l)}var Je={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Ye as _};
|