decocms 4.514.5 → 4.514.6
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/{ActiveShapeUtils-CDpScllU.js → ActiveShapeUtils-DV40gvcg.js} +1 -1
- package/dist/client/assets/{AlertCircle-xI8XX-bi.js → AlertCircle-Ctbquk5a.js} +1 -1
- package/dist/client/assets/{AreaChart-Du66qHXY.js → AreaChart-C_4ebEom.js} +1 -1
- package/dist/client/assets/{ArrowLeft-BKYzlDQY.js → ArrowLeft-DZ0mAFgb.js} +1 -1
- package/dist/client/assets/{ArrowUp-Cq3iZIwL.js → ArrowUp-bYg1aEOe.js} +1 -1
- package/dist/client/assets/{BarChart-BXz-bUtC.js → BarChart-DfTtCBDv.js} +1 -1
- package/dist/client/assets/{Building02-C9KWPxlH.js → Building02-BHIVlbfK.js} +1 -1
- package/dist/client/assets/{CartesianChart-BZmgsxge.js → CartesianChart-uNdbRuTj.js} +1 -1
- package/dist/client/assets/{CategoricalChart-DkwWvFDx.js → CategoricalChart-CRSSpo7X.js} +1 -1
- package/dist/client/assets/{CheckCircle-D30wPP6A.js → CheckCircle-C2ndOEUO.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-CknWVrzo.js → ChevronSelectorVertical-DaUdbCWk.js} +1 -1
- package/dist/client/assets/{ChevronUp-CFN68hLk.js → ChevronUp-C8mqlnDX.js} +1 -1
- package/dist/client/assets/{Copy01-C73PJJxr.js → Copy01-DC8f0fwU.js} +1 -1
- package/dist/client/assets/{CreditCard01-C8DlQ7Ge.js → CreditCard01-P7j8oDkg.js} +1 -1
- package/dist/client/assets/{DotsVertical-BvyfZIer.js → DotsVertical-BvwGTDkC.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-Bhpq3Y0r.js → ErrorBarContext-KwnilJkg.js} +1 -1
- package/dist/client/assets/{Globe04-CVLAzwjm.js → Globe04-D6C-ihBU.js} +1 -1
- package/dist/client/assets/{Image01-DowwsvYG.js → Image01-D7F4wuKx.js} +1 -1
- package/dist/client/assets/{Key01-rbnGMz2E.js → Key01-u4HXXUPa.js} +1 -1
- package/dist/client/assets/{Link01-DRsKyIm5.js → Link01-BoUupQbW.js} +1 -1
- package/dist/client/assets/{LinkBroken01-ZRquEJUl.js → LinkBroken01-BJx0R97x.js} +1 -1
- package/dist/client/assets/{Minus-DPDq6KAA.js → Minus-C1PMcNV0.js} +1 -1
- package/dist/client/assets/{Monitor01-DMME8GIo.js → Monitor01-D3VwU2ni.js} +1 -1
- package/dist/client/assets/{Play-c6bc1b3-.js → Play-DxsFk4r2.js} +1 -1
- package/dist/client/assets/{Plus-xabrshQG.js → Plus-BDveVGJf.js} +1 -1
- package/dist/client/assets/{ReferenceLine-BPq2MnBR.js → ReferenceLine-ILm1GG8J.js} +1 -1
- package/dist/client/assets/{SearchMd-BODiv7c9.js → SearchMd-Cuf45jFP.js} +1 -1
- package/dist/client/assets/{Sector-BraX9V6h.js → Sector-D2xOkxuc.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-DAjyOiiw.js → ShoppingBag01-BMRnsG58.js} +1 -1
- package/dist/client/assets/{Sun-BqmeoxcG.js → Sun-sKGpeIhM.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-CESO3nxl.js → SwitchHorizontal01-CshMTQzi.js} +1 -1
- package/dist/client/assets/{Tool01-BGL2Qt57.js → Tool01-BM29_KWq.js} +1 -1
- package/dist/client/assets/{Trash01-Cf6bGuCZ.js → Trash01-D92WhXf2.js} +1 -1
- package/dist/client/assets/{Upload01-ZLE7vfB9.js → Upload01-BSDy4f7m.js} +1 -1
- package/dist/client/assets/{User01-Cfg0yVvz.js → User01-Cn3JqTjv.js} +1 -1
- package/dist/client/assets/{UserSquare-DJngEPjS.js → UserSquare-Drp4z0v0.js} +1 -1
- package/dist/client/assets/{Users01-vn3EOu8A.js → Users01-Cxbx87gg.js} +1 -1
- package/dist/client/assets/{XClose-CdzjyNb0.js → XClose-dOW_RI9u.js} +1 -1
- package/dist/client/assets/{ZoomOut-B55seUHX.js → ZoomOut-BfQx-fBr.js} +1 -1
- package/dist/client/assets/{access-gate-CgSSvGG3.js → access-gate-BjUA5Gw_.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-O4xCe9BP.js → add-connection-dialog-B0vtW1sl.js} +1 -1
- package/dist/client/assets/{agent-analytics-Biob4Jvo.js → agent-analytics-D74l8HWB.js} +1 -1
- package/dist/client/assets/agent-app-CEBVAZwO.js +1 -0
- package/dist/client/assets/{agent-assets-DpuZ7qUq.js → agent-assets-Bwo-LFkg.js} +1 -1
- package/dist/client/assets/{agent-automation-DBMflQw2.js → agent-automation-Cc45Az0m.js} +1 -1
- package/dist/client/assets/{agent-automations-CHJpber1.js → agent-automations-Du82D3qr.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-CX6V3W-l.js → agent-connect-sources-mK6fw0FS.js} +1 -1
- package/dist/client/assets/agent-deck-BZZHzjdZ.js +1 -0
- package/dist/client/assets/{agent-e2e-rlzvrptO.js → agent-e2e-D6ovLSkg.js} +1 -1
- package/dist/client/assets/{agent-experiments-BzSUejrS.js → agent-experiments-Bf1OqB1m.js} +1 -1
- package/dist/client/assets/agent-file-CzvpBEaK.js +1 -0
- package/dist/client/assets/{agent-hosting-CIblOaW0.js → agent-hosting-6te_9jdz.js} +1 -1
- package/dist/client/assets/{agent-icon-c0hRUHIU.js → agent-icon-U4gZaLOQ.js} +1 -1
- package/dist/client/assets/agent-library-BOSIxUYz.js +1 -0
- package/dist/client/assets/agent-library-file-C0RqJ45T.js +1 -0
- package/dist/client/assets/{agent-monitor-CMU4bHqc.js → agent-monitor-C3Fta9kk.js} +1 -1
- package/dist/client/assets/{agent-overview-C0WObUrB.js → agent-overview-NPCMkyDB.js} +1 -1
- package/dist/client/assets/{agent-releases-CEAPMdCY.js → agent-releases-COSsnWfe.js} +1 -1
- package/dist/client/assets/agent-settings-DDIl5jyz.js +1 -0
- package/dist/client/assets/{agent-site-editor-WHTbnkdB.js → agent-site-editor-DlN_1OE1.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-ByOIwjcy.js +2 -0
- package/dist/client/assets/agent-site-editor-content-DSEuxkJh.js +1 -0
- package/dist/client/assets/agent-site-editor-preview-pw2RBbYs.js +1 -0
- package/dist/client/assets/agent-view-IbmF6KBh.js +1 -0
- package/dist/client/assets/{agent-view-guard-CY0RZ3mz.js → agent-view-guard-Bk4OTT2f.js} +1 -1
- package/dist/client/assets/{agents-list-lrkIUH1p.js → agents-list-B_j46cpj.js} +1 -1
- package/dist/client/assets/{ai-providers-BJRpwnf3.js → ai-providers-Cb4AWs2D.js} +1 -1
- package/dist/client/assets/{alert-J8Wo4iMe.js → alert-B29bfkXd.js} +1 -1
- package/dist/client/assets/{alert-dialog-M8Y0zqSA.js → alert-dialog-CKDHmJ-l.js} +1 -1
- package/dist/client/assets/{analytics-sections-Crtm-SOa.js → analytics-sections-wgH0NLyS.js} +1 -1
- package/dist/client/assets/api-keys-CiMyiLjo.js +1 -0
- package/dist/client/assets/{api-keys-BuJhmHVr.js → api-keys-Xjw7lgqR.js} +1 -1
- package/dist/client/assets/{app-editor-CWO6RLKf.js → app-editor-DgdEdwhZ.js} +1 -1
- package/dist/client/assets/{asset-utils-D4ZYWTsd.js → asset-utils-DrTFUoo_.js} +1 -1
- package/dist/client/assets/{auth-catchall-PMDrOrh4.js → auth-catchall-CIV9IiTJ.js} +1 -1
- package/dist/client/assets/{auth-entry-D45yK4lP.js → auth-entry-ctrK7teX.js} +1 -1
- package/dist/client/assets/{auth-CJCUdDnK.js → auth-hgpoCSIS.js} +1 -1
- package/dist/client/assets/{auth-split-layout-BeoAmW98.js → auth-split-layout-DkyooQGo.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-D7W1mkzH.js → authenticate-and-persist-oauth-jn1R1qId.js} +1 -1
- package/dist/client/assets/{automation-list-row-CO-7cr0O.js → automation-list-row-qFFhCtZo.js} +1 -1
- package/dist/client/assets/{automation-runs-7CDwsw1m.js → automation-runs-C367-v6a.js} +1 -1
- package/dist/client/assets/{automations-DpOWGNx_.js → automations-8JKgpNEK.js} +1 -1
- package/dist/client/assets/{autosend-BiXCzDoT.js → autosend-BZOm698U.js} +1 -1
- package/dist/client/assets/{avatar-CVrfZDpI.js → avatar-RpIBVCkY.js} +1 -1
- package/dist/client/assets/{badge-ByzdbptS.js → badge-Cnnepvq1.js} +1 -1
- package/dist/client/assets/{block-document-EFEgqy7V.js → block-document-baEM6UJG.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-FfAtB7Mh.js → blocks-preview-workspace-context-Ca46yWEV.js} +1 -1
- package/dist/client/assets/{blocks-tab-states-diUqUrAK.js → blocks-tab-states-jGeS9iVz.js} +3 -3
- package/dist/client/assets/{blog-schema-pXyj_uKN.js → blog-schema-CUOOV4a2.js} +1 -1
- package/dist/client/assets/{buckets-EuucCx-Z.js → buckets-p2Fiyc0f.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-0HVt3TgE.js → build-improve-prompt-doc-ClmcYJRa.js} +1 -1
- package/dist/client/assets/{calendar-B3WUDV6V.js → calendar-DqVFnL9A.js} +1 -1
- package/dist/client/assets/{capability-load-error-CaA022rx.js → capability-load-error-DdN4o47w.js} +1 -1
- package/dist/client/assets/{category-editor-16fFMZmU.js → category-editor-Gr46SDP4.js} +1 -1
- package/dist/client/assets/{chart-B6d33H1D.js → chart-B5vy2nis.js} +1 -1
- package/dist/client/assets/{chat-context-BnuwMOfj.js → chat-context-_d3c57p1.js} +1 -1
- package/dist/client/assets/{chat-draft-D3EwPWFD.js → chat-draft-CKcHhXuF.js} +1 -1
- package/dist/client/assets/{checkbox-Dla8kRWj.js → checkbox-CUzk21sc.js} +1 -1
- package/dist/client/assets/{choose-editor-CFsJlwqs.js → choose-editor-BFcNvSv4.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DADJ0ld_.js → cli-auth-success-BolfyrKO.js} +1 -1
- package/dist/client/assets/{client-icons-M2KssD4J.js → client-icons-50FpZDWK.js} +1 -1
- package/dist/client/assets/cms-settings-editor-CxJ3W3GB.js +1 -0
- package/dist/client/assets/{collapsible-BWjY8cOG.js → collapsible-CeBZpglT.js} +1 -1
- package/dist/client/assets/{collection-detail-BVMX_w00.js → collection-detail-BXVqh2XU.js} +1 -1
- package/dist/client/assets/{collection-display-button-DcSGVqBT.js → collection-display-button-El-xnsaW.js} +1 -1
- package/dist/client/assets/{collection-search-C0nHL4Zi.js → collection-search-gW4FCqmq.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BqLbzGMr.js → collection-table-wrapper-CB0t7kAl.js} +1 -1
- package/dist/client/assets/{collection-tabs-DJst1PBn.js → collection-tabs-DIFXv7hR.js} +1 -1
- package/dist/client/assets/{column-rules-C6rmmvcZ.js → column-rules-o-DlIK_-.js} +1 -1
- package/dist/client/assets/{combobox-DJtWtG8e.js → combobox-DlpsfK7m.js} +1 -1
- package/dist/client/assets/{coming-soon-page-CycWyIEs.js → coming-soon-page-ZTZUbFgV.js} +1 -1
- package/dist/client/assets/{command-DQxPvzO0.js → command-C7n5qLsN.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-BaIOrb8k.js → companion-mcps-section-C2rDEgkL.js} +1 -1
- package/dist/client/assets/{config-0dQr8OOs.js → config-BCpfsSBB.js} +1 -1
- package/dist/client/assets/{connect-AQ7wxQDD.js → connect-Du_rXIM1.js} +1 -1
- package/dist/client/assets/{connect-layout-CsBnyYo4.js → connect-layout-DyGwITyt.js} +1 -1
- package/dist/client/assets/{connection-B5x-rxzp.js → connection-Dik4epzq.js} +1 -1
- package/dist/client/assets/{connection-card-CFqu0_G8.js → connection-card-DCnmTKpJ.js} +1 -1
- package/dist/client/assets/{connection-detail-B_xaSLIN.js → connection-detail-CaTyUBlA.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-CouK82td.js → connection-form-helpers-ta2yIvIb.js} +1 -1
- package/dist/client/assets/{connections-CrdtyJFL.js → connections-Dy2qa1bG.js} +1 -1
- package/dist/client/assets/{content-tab-CTbbT9Kp.js → content-tab-YH7YYY48.js} +3 -3
- package/dist/client/assets/{context-DwXA-O6V.js → context-3twD8BEv.js} +1 -1
- package/dist/client/assets/{context-menu-CI-AryjZ.js → context-menu-BUZj1ZG7.js} +1 -1
- package/dist/client/assets/{context-shell-BsFUt-ob.js → context-shell-CWF9i3Vt.js} +3 -3
- package/dist/client/assets/{core.esm-DOdwJCI5.js → core.esm-DNra8pgf.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-CDMsJ1wq.js → create-organization-dialog-BkJvAp86.js} +1 -1
- package/dist/client/assets/{daily-pulse-A6lEoniM.js → daily-pulse-DYjhyf3I.js} +1 -1
- package/dist/client/assets/{discover-JQgSyvWz.js → discover-nnC5Qnas.js} +1 -1
- package/dist/client/assets/{domain-settings-CNG0968P.js → domain-settings-CpxFWOzU.js} +1 -1
- package/dist/client/assets/{drawer-CEiS53oX.js → drawer-ZlYTI3Z6.js} +1 -1
- package/dist/client/assets/{editor-DWhRi1_f.js → editor-BFHySd1K.js} +1 -1
- package/dist/client/assets/{editor-classes-CZOMDDcn.js → editor-classes-DPi5BWR5.js} +1 -1
- package/dist/client/assets/{empty-state-B1xpK558.js → empty-state-Bok1L2hc.js} +1 -1
- package/dist/client/assets/{empty-state-BoFIIv2e.js → empty-state-Cu20Qj3-.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CUvLfXNU.js → extract-connection-data-CNLani4P.js} +1 -1
- package/dist/client/assets/{feature-gate-B9a4dBc0.js → feature-gate-dfnyrtcC.js} +1 -1
- package/dist/client/assets/{feature-paywall-DINMFUUx.js → feature-paywall-D-GfxA1X.js} +1 -1
- package/dist/client/assets/{file-explorer-2Z0Qhvp_.js → file-explorer-DOlx1A5r.js} +1 -1
- package/dist/client/assets/{file-preview-BFXgyqHl.js → file-preview-DSIiiWjA.js} +1 -1
- package/dist/client/assets/{file-share-button-BIOHr9Xv.js → file-share-button-CB7fcIJI.js} +1 -1
- package/dist/client/assets/{file-type-icon-Ez8-DRHg.js → file-type-icon-DPqHd815.js} +1 -1
- package/dist/client/assets/{folder-icon-JgTmBbpC.js → folder-icon-qexQSaYN.js} +1 -1
- package/dist/client/assets/{form-Bdh0vUeg.js → form-Dpwt-9St.js} +1 -1
- package/dist/client/assets/{general-Dvy5SU0P.js → general-DJuGMWNv.js} +1 -1
- package/dist/client/assets/{home-UtAOwZ_a.js → home-D9ErGwHG.js} +1 -1
- package/dist/client/assets/{hosted-publish-feedback-NabikYNC.js → hosted-publish-feedback-9IsLIhi6.js} +1 -1
- package/dist/client/assets/{icon-button-Dg2jSe-y.js → icon-button-CwrVRVUS.js} +1 -1
- package/dist/client/assets/{index-ILRCn1qM.js → index-2uBqLA9S.js} +1 -1
- package/dist/client/assets/{index-CxtzBp5_.js → index-BRzGXE32.js} +1 -1
- package/dist/client/assets/{index-DYLyKNcw.js → index-BWUABroT.js} +1 -1
- package/dist/client/assets/{index-De44zW_k.js → index-BpRXpcv4.js} +1 -1
- package/dist/client/assets/{index-WjQsIrkp.js → index-C9OgV5Vt.js} +1 -1
- package/dist/client/assets/{index-_y92DzgS.js → index-CJu3ft8V.js} +1 -1
- package/dist/client/assets/{index-DcU2uHG-.js → index-CaH7O3hJ.js} +2 -2
- package/dist/client/assets/{index-7svLQYvL.js → index-Cd_jqW-G.js} +1 -1
- package/dist/client/assets/{index-1XeDvVO_.js → index-DJM5MV7l.js} +1 -1
- package/dist/client/assets/{index-DxbCP5B6.js → index-DK4LlU65.js} +1 -1
- package/dist/client/assets/{index-CrgWXxvo.js → index-DLuP-oy3.js} +1 -1
- package/dist/client/assets/{index-DKOhwHAG.js → index-DPulqOQn.js} +1 -1
- package/dist/client/assets/{index-CXeJCI0G.js → index-DUXVtfV1.js} +1 -1
- package/dist/client/assets/{index-DincrG3Y.js → index-DzppA2EQ.js} +1 -1
- package/dist/client/assets/{index-6B342dVL.js → index-TNsA6rsO.js} +1 -1
- package/dist/client/assets/{index-redirect-BHJ13xlS.js → index-redirect-CLzDU0fe.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-P7ZNg4ZF.js → infiniteQueryObserver-u-Zd7Oxq.js} +1 -1
- package/dist/client/assets/{infra-billing-kRHrP-RL.js → infra-billing-DkMlIjvS.js} +1 -1
- package/dist/client/assets/{input-pg_Munw1.js → input-D2sd1bar.js} +3 -3
- package/dist/client/assets/{input-HXHaYrka.js → input-DN6U5jAj.js} +1 -1
- package/dist/client/assets/{integration-icon-aeIvRSnw.js → integration-icon-DCiBepJw.js} +1 -1
- package/dist/client/assets/{jira-icon-CZLCmGol.js → jira-icon-DoiJbCfx.js} +1 -1
- package/dist/client/assets/{label-DDPD5LQh.js → label-Cnc4HQwP.js} +1 -1
- package/dist/client/assets/{layout-DGYUOV2D.js → layout-BVW5q62A.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-B3GKD6WQ.js → legacy-agents-deep-DMfsC9-u.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-BdnJuiDi.js → legacy-main-redirect-mSx9JMxj.js} +1 -1
- package/dist/client/assets/library-BNARKbpY.js +1 -0
- package/dist/client/assets/{login-syjpZA32.js → login-CN9ueiIT.js} +1 -1
- package/dist/client/assets/{markdown-1PeXOKNt.js → markdown-CA3yd3L6.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-DTPlWHGT.js → mcp-app-renderer-Xaw0krD3.js} +1 -1
- package/dist/client/assets/{mcp-oauth-xBzZujQ_.js → mcp-oauth-3Gakbc_U.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DP6VNnFQ.js → mcp-oauth-CxgfM8zh.js} +1 -1
- package/dist/client/assets/{members-uR8n9Rms.js → members-54kLIghY.js} +1 -1
- package/dist/client/assets/{memory-BYqDBVHV.js → memory-CQX6dqQP.js} +1 -1
- package/dist/client/assets/{mini-report-page-D7tpDtif.js → mini-report-page-DCq4FNu-.js} +1 -1
- package/dist/client/assets/{mock-board-BOSDq94-.js → mock-board-CrlDKQvj.js} +3 -3
- package/dist/client/assets/{monaco-editor-e80GuCNv.js → monaco-editor-C7rmyhBT.js} +1 -1
- package/dist/client/assets/monitoring-DX0mWeP-.js +1 -0
- package/dist/client/assets/{monitoring-stats-row-94Mta4Nq.js → monitoring-stats-row-Bhxzz0Gz.js} +1 -1
- package/dist/client/assets/{multi-select-CmbGOwtN.js → multi-select-DtSzZ5RJ.js} +1 -1
- package/dist/client/assets/{mustache-Aw4qvxEW.js → mustache-BxPGtFxk.js} +1 -1
- package/dist/client/assets/{new-project-dialog-ShudNZIG.js → new-project-dialog-DpHJ0D5s.js} +1 -1
- package/dist/client/assets/{oauth-callback-CuZCWVkp.js → oauth-callback-ChXsONZm.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-DQtTsT-Q.js → oauth-callback-ai-provider-BnJfOlsF.js} +1 -1
- package/dist/client/assets/{onboarding-BYvWDC_s.js → onboarding-CuSBfoiA.js} +1 -1
- package/dist/client/assets/{openai-conversation-DgaJVito.js → openai-conversation-B0QRsRtq.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-CKzSSiC-.js → optimistic-project-sidebar-views-Cgq6MsN2.js} +1 -1
- package/dist/client/assets/{order-monitor-day-CIHUt3pK.js → order-monitor-day-BHpHKh9K.js} +1 -1
- package/dist/client/assets/{organization-choice-D_5aYbIz.js → organization-choice-hoXHHizl.js} +1 -1
- package/dist/client/assets/{orgs-CN3Yh6bp.js → orgs-CsgsGgsX.js} +1 -1
- package/dist/client/assets/{page-seo-form-CnjlIIXj.js → page-seo-form-PX_1VQkb.js} +1 -1
- package/dist/client/assets/{pair-Cn70Tm81.js → pair-5gOZrfkD.js} +1 -1
- package/dist/client/assets/plan-BnqYpKp5.js +1 -0
- package/dist/client/assets/{plan-ladder-D5aCNSRy.js → plan-ladder-BydnH1hR.js} +1 -1
- package/dist/client/assets/{popover-CVCbWisj.js → popover-DSRFfUdL.js} +1 -1
- package/dist/client/assets/{post-calendar-Dq_uFQwi.js → post-calendar-D_8Ms9Cq.js} +1 -1
- package/dist/client/assets/{post-editor-DPLEIDHY.js → post-editor-lU8h7ku9.js} +1 -1
- package/dist/client/assets/{preview-content-Bin2hNFJ.js → preview-content-hWNiqB3L.js} +1 -1
- package/dist/client/assets/{preview-dialog-Fls4giAH.js → preview-dialog-HJF1l34b.js} +1 -1
- package/dist/client/assets/{preview-panel-BPPH_1cI.js → preview-panel-PigPEt4W.js} +1 -1
- package/dist/client/assets/{preview-tab-BHT_7Qja.js → preview-tab-B-uX9H3E.js} +3 -3
- package/dist/client/assets/{product-picker-dialog-p0Ic9l9I.js → product-picker-dialog-BUcziHgK.js} +1 -1
- package/dist/client/assets/{profile-BZA6I0p4.js → profile-D-LHzn9e.js} +1 -1
- package/dist/client/assets/{project-app-view-B2uzp3zO.js → project-app-view-CGbP48WX.js} +1 -1
- package/dist/client/assets/{project-apps-v-sauknl.js → project-apps-CajNRGrz.js} +1 -1
- package/dist/client/assets/{project-feed-CxXgvjMu.js → project-feed-uKBIzmIi.js} +1 -1
- package/dist/client/assets/{project-icon-Dy5ndHVf.js → project-icon-njec1yh1.js} +1 -1
- package/dist/client/assets/project-reports-BwZ6fxIs.js +1 -0
- package/dist/client/assets/project-tasks-zYigtiRn.js +1 -0
- package/dist/client/assets/{projects-6tFWscR3.js → projects-OJnagyMB.js} +1 -1
- package/dist/client/assets/{projects-empty-state-B25sfM8y.js → projects-empty-state-C9IhB7We.js} +1 -1
- package/dist/client/assets/{prompts-C8y9cYvX.js → prompts-B590L6x_.js} +1 -1
- package/dist/client/assets/record-editor-BxllIkC_.js +1 -0
- package/dist/client/assets/{redirect-editor-DQhKbdsA.js → redirect-editor-CTLxiYxe.js} +1 -1
- package/dist/client/assets/reports-CJqSx9sD.js +1 -0
- package/dist/client/assets/{reports-DZf5GwgJ.js → reports-DBL7SnEu.js} +1 -1
- package/dist/client/assets/{reports-onboarding-Ba6c9nYx.js → reports-onboarding-Be9p494r.js} +1 -1
- package/dist/client/assets/{reports-tab-aEhqa7te.js → reports-tab-B0M7UKAQ.js} +2 -2
- package/dist/client/assets/{repositories-D_HBag21.js → repositories-BEFfDE3p.js} +1 -1
- package/dist/client/assets/repositories-DceuH_GA.js +1 -0
- package/dist/client/assets/{repository-binding-B-JblZ3B.js → repository-binding-BLgLcT4o.js} +1 -1
- package/dist/client/assets/{repository-import-picker-Aq7ItYog.js → repository-import-picker-lphgZTGu.js} +1 -1
- package/dist/client/assets/{repository-picker-CigkRPj6.js → repository-picker-Dadd-3sc.js} +1 -1
- package/dist/client/assets/{require-capability-fF33BjRE.js → require-capability-D4hkdMxt.js} +1 -1
- package/dist/client/assets/{required-auth-layout-n4GqwjUS.js → required-auth-layout-e3_y0Tns.js} +1 -1
- package/dist/client/assets/{reset-password-FYcr_EOZ.js → reset-password-DPAO5WIu.js} +1 -1
- package/dist/client/assets/{resizable-B1jyEV0m.js → resizable-D4wP3vt7.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-DtNff2Yq.js → resolve-tab-icon-CE5OwNrK.js} +1 -1
- package/dist/client/assets/{review-settings-w0gSi3zN.js → review-settings-BJK_0aY-.js} +1 -1
- package/dist/client/assets/{roles-CD7KBus5.js → roles-CJ569tPn.js} +1 -1
- package/dist/client/assets/{route-P4X0mipC.js → route-Bzf1UEGL.js} +1 -1
- package/dist/client/assets/route-CG_vDQP9.js +1 -0
- package/dist/client/assets/{route-D9eWdPea.js → route-Dfqmjwjm.js} +1 -1
- package/dist/client/assets/{sandbox-lifecycle-context-Cyz-VR-q.js → sandbox-lifecycle-context-v9W7lV1M.js} +1 -1
- package/dist/client/assets/{schema-DTqdooJM.js → schema-BdFq22Hl.js} +1 -1
- package/dist/client/assets/{schema-Jt-SHSRj.js → schema-Cx9ZLa-H.js} +1 -1
- package/dist/client/assets/{scroll-area-DowOzl5a.js → scroll-area-Bnrys5oj.js} +1 -1
- package/dist/client/assets/{search-input-C77c23a_.js → search-input-CXQLMhKZ.js} +1 -1
- package/dist/client/assets/{search-toggle-BqUvwbnO.js → search-toggle-DxUZFRWy.js} +1 -1
- package/dist/client/assets/{secret-ciphertext-CI3Fu2ro.js → secret-ciphertext-DZr2qcb4.js} +1 -1
- package/dist/client/assets/{secret-picker-D6q2PbZG.js → secret-picker-HHgZv9y6.js} +1 -1
- package/dist/client/assets/{secrets-C6FiSzJz.js → secrets-Cm2ZaKef.js} +1 -1
- package/dist/client/assets/{sections-uFSvOb1s.js → sections-DT5ozPKC.js} +1 -1
- package/dist/client/assets/{sections-editor-BgMrH8fq.js → sections-editor-CkId24Js.js} +1 -1
- package/dist/client/assets/{select-B47VUguS.js → select-CSQbGY9x.js} +1 -1
- package/dist/client/assets/{select-model-B0eE99E3.js → select-model-NUb0C_oX.js} +1 -1
- package/dist/client/assets/{seo-editor-C-YMij5b.js → seo-editor-D886xssW.js} +1 -1
- package/dist/client/assets/{separator-tMi_6w_o.js → separator-CjiQChVR.js} +1 -1
- package/dist/client/assets/settings-tab-BmEKDSFe.js +1 -0
- package/dist/client/assets/{sheet-R9Pr50Sb.js → sheet-C-yunzji.js} +1 -1
- package/dist/client/assets/{shell-layout-DNfiem0_.js → shell-layout-vQvYndIW.js} +1 -1
- package/dist/client/assets/site-editor-1ZGqBXbh.js +1 -0
- package/dist/client/assets/{site-editor-toast-L4A-Cxh7.js → site-editor-toast-BtFL0E4q.js} +1 -1
- package/dist/client/assets/{skills-DTPuV4HK.js → skills-9HRxIPqn.js} +1 -1
- package/dist/client/assets/{slider-B9iKqweT.js → slider-DB0IY-tO.js} +1 -1
- package/dist/client/assets/{sortable.esm-7lfZBBX2.js → sortable.esm-C1zl1f3P.js} +1 -1
- package/dist/client/assets/{sso-lvoln_ad.js → sso-PqsQn3xP.js} +1 -1
- package/dist/client/assets/{suggestion-D_Z3LuMt.js → suggestion-Wgq7DDQo.js} +1 -1
- package/dist/client/assets/{switch-BQFbXMA-.js → switch-DYA2xfHU.js} +1 -1
- package/dist/client/assets/{symbol-CIh5AfyD.js → symbol-B8wQ7lKk.js} +1 -1
- package/dist/client/assets/{synced-repos-DQxi8k5O.js → synced-repos-mXhCt1sQ.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-B2rDBqdy.js → tab-icon-glyph-BpaLtZlY.js} +1 -1
- package/dist/client/assets/{table-DuCeyVXY.js → table-BQLxO2Sb.js} +1 -1
- package/dist/client/assets/{tabs-CJ70csAp.js → tabs-2NCCfhSA.js} +1 -1
- package/dist/client/assets/{task-assignee-avatar-vyXzgPAK.js → task-assignee-avatar-FdiZZP36.js} +1 -1
- package/dist/client/assets/{task-board-CSpxMIw7.js → task-board-DRNr9Dsj.js} +1 -1
- package/dist/client/assets/{task-route-CeJ19bNy.js → task-route-BaANwBST.js} +1 -1
- package/dist/client/assets/{task-status-CFz3dyVR.js → task-status-VcYcBtq_.js} +1 -1
- package/dist/client/assets/{taskboard-analytics-CfseXo9_.js → taskboard-analytics-RJkelUr8.js} +1 -1
- package/dist/client/assets/{tasks-C3liOhO2.js → tasks-COZY0QCJ.js} +1 -1
- package/dist/client/assets/tasks-CYZeHeAX.js +1 -0
- package/dist/client/assets/{textarea-BDWvYouR.js → textarea-CxhXyMKI.js} +1 -1
- package/dist/client/assets/{thread-analytics-Bp5Zz9ej.js → thread-analytics-BGQNbVS2.js} +1 -1
- package/dist/client/assets/{thread-intent-DlbBEzNn.js → thread-intent-DKuqiaG7.js} +1 -1
- package/dist/client/assets/{thread-route-DsRsjMOv.js → thread-route-CQ0phZyI.js} +1 -1
- package/dist/client/assets/{thread-route-glK7AgQo.js → thread-route-jNELZX1N.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-BW8H1wdb.js → thread-sheet-body-Cdv_wHnA.js} +1 -1
- package/dist/client/assets/{time-range-picker-Dm5YljWh.js → time-range-picker-DEciYFPf.js} +1 -1
- package/dist/client/assets/{toggle-group-CtPF-F41.js → toggle-group-CtdhsZGp.js} +1 -1
- package/dist/client/assets/{tool-namespace-FeAXQzXg.js → tool-namespace-DTl3so75.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-CTGjpqPD.js → toolbar-icon-button-BPY5dUh9.js} +1 -1
- package/dist/client/assets/{tooltip-BqHx2R4U.js → tooltip-B5RmO6BW.js} +1 -1
- package/dist/client/assets/{tooltipContext-DFq6ns9J.js → tooltipContext-C93Q6WFf.js} +1 -1
- package/dist/client/assets/{track-vnmuUrPF.js → track-BBpplM-4.js} +1 -1
- package/dist/client/assets/{types-Cj3BjtjJ.js → types-Bt5yyj-z.js} +1 -1
- package/dist/client/assets/{url-slug-DfovzTSP.js → url-slug-B41xLFy_.js} +1 -1
- package/dist/client/assets/{usage-stats-DcyLnEOC.js → usage-stats-BkcKNXzu.js} +1 -1
- package/dist/client/assets/{use-ai-providers-DugUJNG4.js → use-ai-providers-D1TJRnIR.js} +1 -1
- package/dist/client/assets/{use-automations-Dhy5bAQi.js → use-automations-B9eI7BBQ.js} +1 -1
- package/dist/client/assets/{use-autosave-BKifxWxQ.js → use-autosave-D3uy94Wi.js} +1 -1
- package/dist/client/assets/{use-chat-layout-state-CqPKeLYn.js → use-chat-layout-state-BNudmQ0u.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CbuQEbGd.js → use-clock-tick-D3FoyBXt.js} +1 -1
- package/dist/client/assets/{use-connect-companion-BBUs22Yl.js → use-connect-companion-BLomLbPK.js} +1 -1
- package/dist/client/assets/{use-connection-Dj54skEw.js → use-connection-BwU_KLSF.js} +1 -1
- package/dist/client/assets/{use-content-sync-D4PHTEJr.js → use-content-sync-BgOMBs5q.js} +1 -1
- package/dist/client/assets/{use-copy-K9rQ1PJH.js → use-copy-d7X6hrKI.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-C4gtrY2f.js → use-create-virtual-mcp-OUIvni0u.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-CEVf4Ifn.js → use-date-fns-locale-BuGEMgXR.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-D0TGgFvB.js → use-debounced-autosave-KHVF-MyQ.js} +1 -1
- package/dist/client/assets/{use-debounced-value-CDunmz6Z.js → use-debounced-value-DJkh4QSx.js} +1 -1
- package/dist/client/assets/{use-deco-credits-orVqTX6I.js → use-deco-credits-Dx8wT8P5.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-TumByBkr.js → use-decopilot-events-AlKmmETJ.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BllZSjRL.js → use-delete-connection-BQjQHz64.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-BBVz6SL_.js → use-deployment-admin-BIA7CHLS.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-6p2QJIdt.js → use-fast-preview-draft-url-5oeXM-kY.js} +1 -1
- package/dist/client/assets/{use-file-configs-BFq_wpSt.js → use-file-configs-tsH4be9V.js} +1 -1
- package/dist/client/assets/{use-inbox-feed--WBiu__i.js → use-inbox-feed-bGge9UaE.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-7dT9x3fg.js → use-infinite-scroll-BO0n6TVn.js} +1 -1
- package/dist/client/assets/{use-join-requests-ilYuD6XT.js → use-join-requests-DqhkfI-R.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-kHysLFoZ.js → use-main-panel-tabs-BrJK-bL3.js} +1 -1
- package/dist/client/assets/{use-main-schema-v8-Dcb6Yskn.js → use-main-schema-v8-CZLsOlEV.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-2A9iou5g.js → use-mcp-auth-status-DmZSbEuf.js} +1 -1
- package/dist/client/assets/{use-mcp-client-ZokR8_74.js → use-mcp-client-MRThuZpK.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-JJb6q8dH.js → use-mcp-prompts-DHm-ZTib.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BwuN38Gh.js → use-mcp-tools-DiCKzhUm.js} +1 -1
- package/dist/client/assets/{use-members-CzSQTDAS.js → use-members-h3MYd8gX.js} +1 -1
- package/dist/client/assets/{use-mobile-BfmJV4wy.js → use-mobile-DCpa1RnA.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-D05JNc-L.js → use-navigate-to-agent-Bt0oZ-ou.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-pmLoKOyH.js → use-open-billing-url-B2NuYLXS.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-fPRUht_a.js → use-org-auth-client-CL0a2tPL.js} +1 -1
- package/dist/client/assets/{use-org-fs-D82Vx4hB.js → use-org-fs-D_4Q985K.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-CD8TZnkH.js → use-org-repo-syncs-CC0BNhdO.js} +1 -1
- package/dist/client/assets/{use-org-sso-ClJ8vn5f.js → use-org-sso-LC63-uuA.js} +1 -1
- package/dist/client/assets/{use-organization-roles-iaQivkLI.js → use-organization-roles-D1Q7317o.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DFkNTsS0.js → use-organization-settings-DhvN44pQ.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-K8ACrPML.js → use-panel-navigate-DoD4Atgz.js} +1 -1
- package/dist/client/assets/{use-project-native-view-presence-DJiBua9F.js → use-project-native-view-presence-DF_1PP5b.js} +1 -1
- package/dist/client/assets/{use-project-scope-CGMALc0e.js → use-project-scope-Cq4vb2Sy.js} +1 -1
- package/dist/client/assets/{use-recent-apps-C1945uiL.js → use-recent-apps-CeIVmzp8.js} +1 -1
- package/dist/client/assets/{use-releases-D15mHXXN.js → use-releases-DQ--CsAF.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-BdbGTuns.js → use-reports-diagnostic-CWir9L_Y.js} +1 -1
- package/dist/client/assets/{use-secrets-DbkATagb.js → use-secrets-D6tUoaJC.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-De54Y3vh.js → use-section-preview-base-Ca45yoz9.js} +1 -1
- package/dist/client/assets/{use-sidebar-collapsed-BqLmDXCH.js → use-sidebar-collapsed-DPHQfMII.js} +1 -1
- package/dist/client/assets/{use-tags-Cn5U7HDa.js → use-tags-DE48pnzl.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-CftsNPjL.js → use-task-board-analytics-DlTk43Uu.js} +1 -1
- package/dist/client/assets/{use-task-board-events-BDk-u9KA.js → use-task-board-events-CSRq29Tm.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-CNMGpOwt.js → use-task-board-item-prs-BsxjjcBf.js} +1 -1
- package/dist/client/assets/{use-task-metadata-0ueqwOxI.js → use-task-metadata-ToXrxOCT.js} +1 -1
- package/dist/client/assets/{use-thread-analytics-CgQGRl3S.js → use-thread-analytics-Bu_i1v9r.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-DLitie4Q.js → use-thread-outputs-jyAHyZHI.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-ZoWXsJcj.js +1 -0
- package/dist/client/assets/{useQueries-BfkCTicr.js → useQueries-CddGJ3VE.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-D2W70ffp.js +1 -0
- package/dist/client/assets/{users-BIkPJzOg.js → users-2guAvf9G.js} +1 -1
- package/dist/client/assets/{utils-Bp3fKbm9.js → utils-DzhKsxx8.js} +1 -1
- package/dist/client/assets/{variant-calendar-BIblXEHb.js → variant-calendar-Bdj0O-mA.js} +1 -1
- package/dist/client/assets/{variant-draft-pointer-fs9iIwvq.js → variant-draft-pointer-_apEPqxm.js} +1 -1
- package/dist/client/assets/{virtual-mcp-CeCtCq_o.js → virtual-mcp-CMZ8dHEU.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-CrLAsZHh.js → watch-sse-pool-DwBbAQ97.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/agent-app-DTwyyqho.js +0 -1
- package/dist/client/assets/agent-deck-DRCJIHES.js +0 -1
- package/dist/client/assets/agent-file-pM3fkLSV.js +0 -1
- package/dist/client/assets/agent-library-BF5T38g7.js +0 -1
- package/dist/client/assets/agent-library-file-BTDXrKvZ.js +0 -1
- package/dist/client/assets/agent-settings-9voN143W.js +0 -1
- package/dist/client/assets/agent-site-editor-code-DxTJ31bR.js +0 -2
- package/dist/client/assets/agent-site-editor-content-B8OXp1G1.js +0 -1
- package/dist/client/assets/agent-site-editor-preview-Bu7A4U4r.js +0 -1
- package/dist/client/assets/agent-view-DW3bjKRU.js +0 -1
- package/dist/client/assets/api-keys-DPclIgvr.js +0 -1
- package/dist/client/assets/cms-settings-editor-Cowvog2q.js +0 -1
- package/dist/client/assets/library-DYD_N6_K.js +0 -1
- package/dist/client/assets/monitoring-CgqK6OeU.js +0 -1
- package/dist/client/assets/plan-ByMMI8KU.js +0 -1
- package/dist/client/assets/project-reports-CZJuTnYB.js +0 -1
- package/dist/client/assets/project-tasks-CGicoIeY.js +0 -1
- package/dist/client/assets/record-editor-Bh04Pm0_.js +0 -1
- package/dist/client/assets/reports-BupQ5Xhd.js +0 -1
- package/dist/client/assets/repositories-CEC-SgTJ.js +0 -1
- package/dist/client/assets/route-Co7AkL50.js +0 -1
- package/dist/client/assets/settings-tab-Cp5pryb2.js +0 -1
- package/dist/client/assets/site-editor-Dsm_SPF7.js +0 -1
- package/dist/client/assets/tasks-DrfrXIxf.js +0 -1
- package/dist/client/assets/useInfiniteQuery-B7za82zu.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-B0JY_wMj.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as P,o as q,m as F,K as m,aV as Ye,aF as Nt,aG as _t,r as U,a as Dt,aw as ce,a2 as xt,au as Rt,b8 as Pt,t as z,j as V}from"./index-DcU2uHG-.js";import{a as We}from"./input-pg_Munw1.js";import{k as $t,M as At,l as le,s as Re}from"./thread-intent-DlbBEzNn.js";import{u as pe,c as Lt}from"./use-main-schema-v8-Dcb6Yskn.js";import{b as te}from"./sandbox-url-D3mC8qhT.js";import{s as Ft}from"./utils-Bp3fKbm9.js";import{a as Ut}from"./repository-binding-B-JblZ3B.js";import{u as Mt}from"./chat-context-BnuwMOfj.js";import{i as jt,u as Bt}from"./index-_y92DzgS.js";import{v as Qt}from"./sandbox-git-api-CRxdlhrN.js";import{e as Vt}from"./backoff-CrEUbyZT.js";const p={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class T extends Error{code;data;constructor(t,n,o){super(n),this.name="ContentProtocolError",this.code=t,this.data=o}toJSON(){return this.data===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,data:this.data}}static from(t){return new T(t.code,t.message,t.data)}}const K="deco-content",ue={major:1},ze=1;async function Ht(e){let t=new Uint8Array(await e.arrayBuffer());if(t[0]===31&&t[1]===139){const n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));t=new Uint8Array(await new Response(n).arrayBuffer())}return JSON.parse(new TextDecoder().decode(t))}const de={major:ue.major,minor:ze},Xe=`the endpoint speaks an older ${K} than this client needs (${de.major}.${de.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function W(e,t,n){const o={reason:t,required:{...de}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new T(p.Unsupported,e,o)}function Ze(e){const t=e??{},{protocol:n,version:o}=t;if(n!==K)throw W(`the endpoint speaks ${JSON.stringify(n)}, not ${K}`,"protocol",t);if(o?.major!==ue.major)throw W(`the endpoint speaks ${K} ${String(o?.major)}.x; this client speaks ${ue.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<ze)throw W(Xe,"outdated",t);return e}function Pe(e,t){return t.code===p.MethodNotFound&&e.startsWith("changes.")?W(Xe,"outdated"):T.from(t)}function ye(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(s)}));let c;try{c=await Ht(a)}catch{throw new T(p.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(c)&&c?.id===null){const l=c?.error;throw l?T.from(l):new T(p.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const r=async(s,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(c.error)throw Pe(s,c.error);return c.result};return{call:r,describe:async()=>Ze(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((l,d)=>({jsonrpc:"2.0",id:i[d],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,d)=>{const u=c.get(l);return u?u.error?{ok:!1,error:Pe(s[d].method,u.error)}:{ok:!0,result:u.result}:{ok:!1,error:new T(p.InternalError,"no response for this call")}})}}}const fe=".json";[...Array.from({length:9},(e,t)=>`COM${t+1}`),...Array.from({length:9},(e,t)=>`LPT${t+1}`)];new TextEncoder;function Gt(e){return`${encodeURIComponent(e)}${fe}`}function et(e){return e.endsWith(fe)?e.slice(0,-fe.length):e}function Eo(e){const t=et(e);try{return decodeURIComponent(t)}catch{return t}}function Kt(e){let t=et(e),n=0;for(;t.includes("%");){let o;try{o=decodeURIComponent(t)}catch{break}if(o===t)break;t=o,n++}return{name:t,passes:n}}function ko(e){return Kt(Gt(e)).name}const $e=20,Ae=5,Le=500;function Se(e){return e instanceof T?e.code===p.MethodNotFound?!0:e.code===p.Unsupported&&e.data?.reason==="outdated":!1}function he(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function qt(e,t,n){const o=m.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(r?{ifNoneMatch:r.revision}:{}),i=he(r,s);if(i)return i;const a=await t.changesList({});return he(void 0,a)}async function Jt(e,t){const n=[];for(let s=0;s<t.length;s+=$e)n.push(t.slice(s,s+$e));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=Ae){const i=await e.batch(n.slice(s,s+Ae).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const c=a.result;Object.assign(o,c.entries),r.push(...c.diagnostics)}}return{entries:o,diagnostics:r}}async function Co(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=Le){const r=t.slice(o,o+Le),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Io(e){return e instanceof T&&e.code===p.Conflict}function tt(e){return e?.kind==="protocol"?e:null}function Oo(e,t,n){const o=P.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=q();let a;o[2]!==e?(a=tt(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&s.enabled!==!1;let d;o[4]!==t?(d=m.contentChanges(t??""),o[4]=t,o[5]=d):d=o[5];let u;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(u=l?()=>qt(i,c.client,t):Ye,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=u):u=o[10];let h;return o[11]!==d||o[12]!==u?(h={queryKey:d,queryFn:u,staleTime:0},o[11]=d,o[12]=u,o[13]=h):h=o[13],F(h)}function To(e,t,n){const o=P.c(14);let r;o[0]!==e?(r=tt(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!s&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?.revision?(l=m.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=l):l=o[6];let d;o[7]!==c||o[8]!==a||o[9]!==s?(d=c?()=>Jt(s.client,a):Ye,o[7]=c,o[8]=a,o[9]=s,o[10]=d):d=o[10];let u;return o[11]!==l||o[12]!==d?(u={queryKey:l,queryFn:d,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=d,o[13]=u):u=o[13],F(u)}function nt(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;const n=t.hostname.toLowerCase();return n==="127.0.0.1"||n==="[::1]"||n==="localhost"}catch{return!1}}function X(e){try{const t=new URL(e);return(t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&(t.hostname="localhost"),t.href}catch{return e}}const ot=Nt({endpoint:_t().max(2048).refine(e=>nt(e)&&new URL(e).pathname==="/rpc").transform(X)});function No(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=ot.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function rt(e){const t=ot.safeParse(e);return t.success?t.data:null}const st="studio:deco-serve-last";function _o(e){try{localStorage.setItem(st,JSON.stringify(e))}catch{}}function Do(){try{const e=localStorage.getItem(st);return e?rt(JSON.parse(e)):null}catch{return null}}function xo(e){try{return new URL(X(e)).host}catch{return e}}function Yt(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Wt="http://localhost:4545/rpc",Ro="npx @decocms/blocks serve",Po="npx @decocms/blocks schema";class Ee extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function zt(e){if(e instanceof Ee)return{reason:"not-deco-serve"};if(!(e instanceof T))return{reason:"not-answering"};switch(e.code){case p.Unauthorized:case p.MethodNotFound:return{reason:"outdated"};case p.Unsupported:return Se(e)?{reason:"outdated"}:{reason:"version-mismatch"};case p.Unavailable:return/^the endpoint answered HTTP/.test(e.message)?{reason:"not-deco-serve"}:{reason:"error",detail:e.message};default:return{reason:"error",detail:e.message}}}function $o(e,t){if(e)return[X(e.endpoint)];const n=[t?.endpoint,Wt].filter(o=>!!o).map(X);return[...new Set(n)]}const it=U.createContext(null);function Xt(e){const t=P.c(27),n=U.useContext(it),o=pe(n?null:e),{data:r}=Dt.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?ce.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[c,l]=Ue(a);let d;t[4]!==i||t[5]!==s||t[6]!==e?(d=i?ce.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=d):d=t[7];const[u,h]=Ue(d);if(n)return n;let b;t[8]!==c||t[9]!==i?(b=i?rt(c):null,t[8]=c,t[9]=i,t[10]=b):b=t[10];const g=b,k=!!g;let C;t[11]!==o||t[12]!==k?(C=Zt(o,k),t[11]=o,t[12]=k,t[13]=C):C=t[13];const{applies:x,undecided:N}=C,_=x?g:null,I=i&&o==="v8"&&typeof u=="string"?u:null;let O;t[14]!==h||t[15]!==l||t[16]!==i?(O=S=>{i&&(l(S),h(S.endpoint))},t[14]=h,t[15]=l,t[16]=i,t[17]=O):O=t[17];let w;t[18]!==l||t[19]!==i?(w=()=>{i&&l(null)},t[18]=l,t[19]=i,t[20]=w):w=t[20];let y;return t[21]!==_||t[22]!==I||t[23]!==O||t[24]!==w||t[25]!==N?(y={connection:_,undecided:N,lastEndpoint:I,set:O,clear:w},t[21]=_,t[22]=I,t[23]=O,t[24]=w,t[25]=N,t[26]=y):y=t[26],y}function Zt(e,t){return t?e==="loading"?{applies:!1,undecided:!0}:{applies:e==="v8"||e==="error",undecided:!1}:{applies:!1,undecided:!1}}function Fe(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function Ue(e){const t=P.c(17),n=q(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?Fe(e):null,a=()=>e?Fe(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:s,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:d}=F(l);let u;t[10]!==e||t[11]!==n||t[12]!==s?(u=k=>{if(e){try{k===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(k))}catch{}n.setQueryData(s,k)}},t[10]=e,t[11]=n,t[12]=s,t[13]=u):u=t[13];const h=u,b=e?d??null:null;let g;return t[14]!==h||t[15]!==b?(g=[b,h],t[14]=h,t[15]=b,t[16]=g):g=t[16],g}function Ao(e){return e.kind==="protocol"||e.kind==="unavailable"}function Lo(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n==="protocol"||n==="unavailable"?!0:n==="pending"?t===!0?!0:void 0:t}function Fo(e,t,n){return t!=="github"||n!=="v8"?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function Uo(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&nt(t)?t:null}function Mo(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function at(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function en(e){if(!e.hasProject)return"legacy";const t=at(e);if(t==="local")return"protocol-local";if(e.serveConnectionUndecided)return"pending";if(t==="sandbox"){const o=e.sandboxSite;return o==="v8"?"protocol-sandbox":o==="v7"?"legacy":o==="error"?e.markedV8?"retrying-sandbox":"legacy":"pending"}if(e.mainSchema==="loading")return"pending";if(e.mainSchema==="error")return"retrying-github";if(e.mainSchema==="v7")return"legacy";const n=e.githubSite;return n==="v8"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":n==="v7"?"legacy":"pending"}function tn(e){return{github:e.mode==="github"&&e.mainSchema==="v8",sandbox:e.mode==="sandbox"&&e.workingTreeReady}}function Me(e){return e.isError||e.errorUpdateCount>0}function nn(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function on(e){if(!e||typeof e!="object")return[];const t=e,n=[];return typeof t.blockKey=="string"&&n.push(t.blockKey),t.writes&&typeof t.writes=="object"&&n.push(...Object.keys(t.writes)),Array.isArray(t.deletes)&&n.push(...t.deletes.filter(o=>typeof o=="string")),n}function ne(e){return{[$t]:e}}class ke extends Error{status=409;constructor(){super("main's schema changed")}}async function Ce(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code===At}function Ie(e,t,n){e.resetQueries({predicate:o=>{const r=o.queryKey;return r[1]!==t||r[2]!==n?!1:r[0]===m.mainSchemaV8(t,n)[0]||r[0]===m.contentBackend()[0]&&r[4]==="github"}})}function ct(e,t,n){return e.getQueryData(m.mainSchemaV8(t,n))}const lt="__noSchema";function rn(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[lt]:!0}}function jo(e){return!!e&&e[lt]===!0}function ut(e){if(!e.ok)return e.error.code===p.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function sn(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const an=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Bo(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:sn(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(an)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:je(n.resolveType).localeCompare(je(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function je(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Be(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=Be(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?Be(s[a],r,n):s[a];return i}return e}function Qo(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class Qe extends Error{}class Ve extends Error{}const dt="site-not-owned";async function cn(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function ln(e,t=r=>fetch(r),n,o){const r=ye({endpoint:e,fetch:async s=>{const i=new Request(s);for(const[c,l]of Object.entries(ne("v8")))i.headers.set(c,l);const a=await t(i);if(await cn(a))throw new Ve;if(await Ce(a))throw n?.(),new ke;return a}});try{const s=await Te(r,le(o)?{schema:o}:void 0);return s.v8Schema?s:null}catch(s){if(s instanceof Ve)return dt;throw s}}const Oe=5e3;function un(e){return new URL(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/rpc`,window.location.origin).href}function dn(e){return new URL(te(e,"rpc"),window.location.origin).href}async function Te(e,t){const[n,o]=await e.batch(t?[{method:"describe"}]:[{method:"describe"},{method:"schema.get"}]);if(!n?.ok)throw n?.error??new Error("no describe");if(n.result?.protocol!==K)throw new Ee;const s=Ze(n.result);if(t)return{client:e,describe:s,hasSchema:t.schema!=null,v8Schema:le(t.schema)};if(!o)throw new Error("no schema.get");if(ut(o))return{client:e,describe:s,hasSchema:!1,v8Schema:!1};if(o.ok){const i=o.result;return{client:e,describe:s,hasSchema:!0,v8Schema:le(i?.schema)}}throw o.error}async function fn(e,t=n=>fetch(n)){const n=ye({endpoint:e,fetch:async o=>{const r=await t(o);if(r.status===404)throw new Qe;return r}});try{const o=await Te(n);return o.v8Schema?o:null}catch(o){if(o instanceof Qe)return null;throw o}}function ft(e,t){const n=P.c(53),{org:o}=xt(),{connection:r,undecided:s}=Xt(e),{runtime:i}=We(e),a=U.useContext(it),c=pe(a?null:e),l=Lt(e),d=at({hasServeConnection:!!r,runtime:i}),u=Mt()?.taskId??null,h=jt(Bt().lifecycle.phase),b=q(),g=tn({mode:d,mainSchema:c,workingTreeReady:h}),k=g.github&&!!o.slug&&!!e&&!!t;let C;n[0]!==t||n[1]!==o.slug||n[2]!==b||n[3]!==e?(C=()=>ln(un({orgSlug:o.slug,virtualMcpId:e,branch:t}),void 0,()=>Ie(b,o.slug,e),ct(b,o.slug,e)?.schema),n[0]=t,n[1]=o.slug,n[2]=b,n[3]=e,n[4]=C):C=n[4];const x=F({queryKey:m.contentBackend(o.slug,e??"",t??"","github"),queryFn:C,enabled:k,staleTime:Number.POSITIVE_INFINITY,...He}),N=g.sandbox&&!!o.slug&&!!e&&!!t;let _;n[5]!==t||n[6]!==o.slug||n[7]!==u||n[8]!==e?(_=async()=>fn(dn({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:u})),n[5]=t,n[6]=o.slug,n[7]=u,n[8]=e,n[9]=_):_=n[9];const I=F({queryKey:m.contentBackend(o.slug,e??"",t??"","sandbox",u??""),queryFn:_,enabled:N,staleTime:Number.POSITIVE_INFINITY,...He}),O=!!r;let w;n[10]!==r?.endpoint||n[11]!==o.slug||n[12]!==e?(w=m.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[10]=r?.endpoint,n[11]=o.slug,n[12]=e,n[13]=w):w=n[13];let y;n[14]!==r?(y=()=>Te(ye({endpoint:r.endpoint})),n[14]=r,n[15]=y):y=n[15];let S;n[16]!==O||n[17]!==w||n[18]!==y?(S={queryKey:w,queryFn:y,enabled:O,staleTime:Number.POSITIVE_INFINITY,retry:mn,retryDelay:gn,refetchInterval:hn},n[16]=O,n[17]=w,n[18]=y,n[19]=S):S=n[19];const v=F(S);let $;n[20]!==r?.endpoint||n[21]!==o.slug||n[22]!==e?($=m.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[20]=r?.endpoint,n[21]=o.slug,n[22]=e,n[23]=$):$=n[23];const A=$;let E;n[24]!==r?.endpoint||n[25]!==o.slug||n[26]!==e?(E=m.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[24]=r?.endpoint,n[25]=o.slug,n[26]=e,n[27]=E):E=n[27];let D;n[28]!==v.data||n[29]!==A||n[30]!==b?(D=async()=>{try{return await v.data.client.describe()}catch(f){const G=f;throw b.invalidateQueries({queryKey:A,exact:!0},{cancelRefetch:!1}),G}},n[28]=v.data,n[29]=A,n[30]=b,n[31]=D):D=n[31];const R=!!v.data&&!a;let M;n[32]!==E||n[33]!==D||n[34]!==R?(M={queryKey:E,queryFn:D,enabled:R,refetchInterval:Oe,retry:!1},n[32]=E,n[33]=D,n[34]=R,n[35]=M):M=n[35];const Q=F(M).data??v.data?.describe,L=en({hasProject:!!e,hasServeConnection:!!r,serveConnectionUndecided:s,runtime:i,mainSchema:c,githubSite:x.data===dt?"not-owned":x.data?"v8":x.data===null?"v7":Me(x)?"error":"loading",sandboxSite:vn({data:I.data,isError:Me(I),workingTreeReady:h}),markedV8:l});if(L==="pending"){let f;return n[36]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending"},n[36]=f):f=n[36],f}if(L==="retrying-github"){let f;return n[37]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending",retrying:"github"},n[37]=f):f=n[37],f}if(L==="retrying-sandbox"){let f;return n[38]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending",retrying:"sandbox"},n[38]=f):f=n[38],f}if(L==="legacy"){let f;return n[39]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"legacy"},n[39]=f):f=n[39],f}if(L==="protocol-github"){const f=x.data;let G;return n[40]!==f?(G=ge("github",f,""),n[40]=f,n[41]=G):G=n[41],G}if(L==="site-not-owned-github"){let f;return n[42]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"unavailable",source:"github",siteNotOwned:!0},n[42]=f):f=n[42],f}if(L==="protocol-sandbox"){let f;return n[43]!==I.data?(f=ge("sandbox",I.data,":sandbox"),n[43]=I.data,n[44]=f):f=n[44],f}if(L==="unavailable-github"){let f;return n[45]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"unavailable",source:"github"},n[45]=f):f=n[45],f}const se=v.error??v.failureReason,ie=r?.endpoint??"";let Y;return n[46]!==Q||n[47]!==v.data||n[48]!==v.failureCount||n[49]!==v.isError||n[50]!==se||n[51]!==ie?(Y=wn({probed:v.data,isError:v.isError,failureCount:v.failureCount,failure:se,describe:Q,endpoint:ie}),n[46]=Q,n[47]=v.data,n[48]=v.failureCount,n[49]=v.isError,n[50]=se,n[51]=ie,n[52]=Y):Y=n[52],Y}function hn(e){return e.state.status==="error"||e.state.data?.v8Schema===!1?Oe:!1}function gn(e){return Yt(e+1)}function mn(e,t){return!(t instanceof T)&&!(t instanceof Ee)}function vn(e){return e.data!==void 0?e.data?"v8":"v7":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const bn=3;function wn(e){if(e.probed?.hasSchema&&!e.probed.v8Schema)return{kind:"unavailable",source:"local",problem:{reason:"not-v8"}};const t=e.probed?ge("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<bn?t:{kind:"unavailable",source:"local",problem:zt(e.failure)}:t??{kind:"pending"}}const He={retry:2,refetchInterval:e=>e.state.status==="error"?Oe:!1};function ge(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema}}function ht(e){const t=P.c(13);let n;t[0]!==e?(n=ce.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=Rt(o,null),i=pe(e);let a;if(t[2]!==i||t[3]!==r||t[4]!==e){const h=e?Re(r):null;a=pn({saved:h,main:i}),t[2]=i,t[3]=r,t[4]=e,t[5]=a}else a=t[5];const c=a;let l,d;t[6]!==s?(l=h=>s(Re(h)),d=()=>s(null),t[6]=s,t[7]=l,t[8]=d):(l=t[7],d=t[8]);let u;return t[9]!==c||t[10]!==l||t[11]!==d?(u={...c,setUrl:l,clear:d},t[9]=c,t[10]=l,t[11]=d,t[12]=u):u=t[12],u}function pn(e){return e.saved?e.main==="v7"?{url:e.saved,undecided:!1}:e.main==="v8"?{url:null,undecided:!1}:{url:null,undecided:!0}:{url:null,undecided:!1}}function yn(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function Ge(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}class Ne extends Error{constructor(t,n,o=[]){super(n),this.blocks=t,this.fields=o,this.name="BlockConflictError"}blocks;fields}function _e(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function oe(e,t,n){return["decofile-write",e,t,n]}function Sn(e,t,n){return{id:oe(e,t,n).join(":")}}function De(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function En(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function kn(e,t,n){e.setQueryData(m.decofileDraft(_e(t)),n)}function Cn(e,t){return e.getQueryData(m.decofileDraft(_e(t)))??null}async function In(e,t){const n=await fetch(De(e),{cache:"no-store",headers:{...ne("v7"),"if-none-match":`"${t}"`}}).catch(()=>null);return n?.status===200||n?.status===409}function Vo(e){const t=P.c(4);let n;t[0]!==e?(n=m.decofileDraft(e?_e(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:On,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r??null}async function On(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Tn(e,t){const n=await fetch(De(t),{cache:"no-store",headers:ne("v7")});if(await Ce(n))throw Ie(e,t.orgSlug,t.virtualMcpId),new ke;if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&kn(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function Ho(e,t){const n=await fetch(De(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new Ne(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return En(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const gt=3e3,Nn=15e3,_n=2*6e4,mt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function Dn(e){return e<_n?gt:Nn}function xn(e,t=mt){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,Dn(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:c,skip:l}=e();if(r||t.hidden()||l?.()){i();return}r=!0;let d;try{d=c()}catch{d=void 0}Promise.resolve(d).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const Ke=()=>0;function Rn(e,t,n=mt){const o=U.useRef(t);o.current=t;const[r]=U.useState(()=>({polling:()=>xn(()=>o.current,n),idle:()=>()=>{}}));U.useSyncExternalStore(e?r.polling:r.idle,Ke,Ke)}function vt(e,t){return te(e,t)}function Pn(e,t){return te(e,"preview-fetch",{path:t})}function Go(e){return vt(e,"preview-invoke")}function Ko(e){return vt(e,"catalog-invoke")}function bt(e){try{const{hostname:t}=new URL(e);return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}function $n(){if(typeof document>"u")return null;const e=Array.from(document.querySelectorAll("iframe"));for(const t of e){const n=t.getAttribute("src");if(n&&bt(n))return n}return null}function An(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??$n();return n&&bt(n)?new URL(t,n).toString():Pn(e,t)}function Ln(e){return An(e,"/.decofile")}function Fn(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function qe(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function Un(e,t){const n=te(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=Fn(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:Ft(s.content)}}async function Mn(e,t){const n=await Un(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function qo(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function jn(e){return Ut(e)?.metadata?.runtime?.path??null}class wt extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function Jo(e){return e instanceof T&&e.code===p.Conflict}function pt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}function Bn(e,t,n){if(t instanceof Ne)return t.message;if(n==="local")return Vn(e,t);if(t instanceof T)switch(t.code){case p.Conflict:return e("siteEditor.save.conflict");case p.ReadOnly:return e("siteEditor.save.readOnly");case p.InvalidBlock:case p.InvalidParams:return e("siteEditor.save.invalid");case p.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function Qn(e,t){if(t==="local"||e instanceof Ne)return null;if(e instanceof T){const n=e.code===p.InvalidBlock||e.code===p.InvalidParams?pt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Vn(e,t){if(t instanceof wt)return e("decoServe.save.serverGone");if(t instanceof T)switch(t.code){case p.Conflict:return e("decoServe.save.conflict");case p.ReadOnly:return e("decoServe.save.readOnly");case p.InvalidBlock:case p.InvalidParams:return e("decoServe.save.invalid",{detail:pt(t)});case p.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Hn(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function Gn(e,t){const[n,o]=U.useState(e),r=U.useRef(null);return e&&!n&&o(!0),U.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=Hn(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const yt={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},Kn=15e3,Z=new Map;function H(e,t){return`${e}/${t}`}function j(e){let t=Z.get(e);return t||(t={state:yt,listeners:new Set,previews:0,timer:null,discardListeners:new Set},Z.set(e,t)),t}function B(e,t){const n=j(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function re(e){e.timer&&clearTimeout(e.timer),e.timer=null}function xe(e){return Z.get(e)?.state??yt}function qn(e,t){const n=j(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Yo(e){const t=j(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(re(t),B(e,{phase:"idle"}))}}function Wo(e){const t=Z.get(e);!t||t.state.phase!=="reloading"||(re(t),B(e,{phase:"idle"}))}function St(e){const t=j(e);re(t),B(e,{phase:"saving",inFlight:t.state.inFlight+1})}function me(e,t){const n=j(e),o=Math.max(0,n.state.inFlight-1);if(o>0){B(e,{inFlight:o});return}if(!t.ok||n.previews===0){B(e,{phase:"idle",inFlight:o});return}Et(e,t.navigates,o)}function Et(e,t,n=0){const o=j(e);re(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&B(e,{phase:"idle"})},Kn),B(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function Jn(e){return e?.kind==="protocol"&&e.source==="github"}async function ve(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:m.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=s?m.protocolDraftRead(o,r,s):null,d=l?JSON.stringify(n.getQueryData(l)??null):null,u=c?[c]:[];if(a&&t.reread&&u.push(n.invalidateQueries({queryKey:m.decofile(a)})),a&&u.push(n.invalidateQueries({queryKey:m.contentChanges(a)})),s&&i.source==="sandbox"&&u.push(n.invalidateQueries({queryKey:Qt(o,r,s)})),Jn(i)&&l&&u.push(n.invalidateQueries({queryKey:l})),await Promise.all(u),t.kind!=="edit"){const g=H(o,r);B(g,{epoch:xe(g).epoch+1})}const h=l?JSON.stringify(n.getQueryData(l)??null):null,b=d!==h;return b&&await new Promise(g=>Pt.schedule(g)),{navigates:b}}async function Yn(e,t){return St(H(e.orgSlug,e.virtualMcpId)),kt(e,t)}async function kt(e,t){const n=H(e.orgSlug,e.virtualMcpId);let o;try{o=await t.write()}catch(s){throw me(n,{ok:!1,navigates:!1}),t.refreshOnError&&ve(e,{kind:t.kind,reread:!0}).catch(()=>{}),s}let r=!1;try{({navigates:r}=await ve(e,t))}catch{}finally{me(n,{ok:!0,navigates:r})}return o}function zo(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=H(o,r),a=new Set(t.blockKeys);for(const d of[...j(i).discardListeners])d(a);St(i);let c=!1;const l=()=>(c=!0,kt(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:oe(o,r,s),scope:Sn(o,r,s),mutationFn:l}).execute(void 0).catch(d=>{throw c||me(i,{ok:!1,navigates:!1}),d}):l()}function Xo(e,t,n){const o=P.c(8);let r;o[0]!==e||o[1]!==t?(r=H(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const c=j(s).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],U.useEffect(i,a)}function Wn(e){const t=H(e.orgSlug,e.virtualMcpId);xe(t).inFlight>0||ve(e,{kind:"external"}).then(({navigates:n})=>{const o=j(t);o.previews>0&&o.state.inFlight===0&&Et(t,n)}).catch(()=>{})}function zn(e,t){const n=P.c(7);let o;n[0]!==e||n[1]!==t?(o=H(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=l=>qn(r,l),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>xe(r),n[5]=r,n[6]=a):a=n[6];const c=a;return U.useSyncExternalStore(i,c,c)}const Xn=500;function Zo(e,t){const{phase:n}=zn(e,t);return Gn(n!=="idle",Xn)}function Zn(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function eo(e,t){return m.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function er(e,t,n){const o=e.getQueryData(m.contentVersions(t));if(!o)return;if(Object.hasOwn(o,n))return o[n];const r=e.getQueryData(m.decofile(t));return r&&Object.hasOwn(r,n)?void 0:null}function Ct(e,t,n){e.setQueryData(m.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function to(e,t){const n=e.getMutationCache().findAll({mutationKey:oe(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>on(o.state.variables)))}function be(e,t){e.resetQueries({queryKey:m.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function ee(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof T);throw t.source==="local"&&s?(be(e,n),new wt(r)):(t.source==="local"&&Se(r)&&be(e,n),r)}}const ae=new Map;function no(e,t,n,o){const r=ae.get(o);if(r)return r;const s=It(e,t,n,o,!0);return ae.set(o,s),s.finally(()=>ae.delete(o))}async function It(e,t,n,o,r){const s=m.decofile(o),i=eo(n,t),a=m.contentRevision(o),c=e.getQueryData(s),l=e.getQueryData(i),d=e.getQueryData(a)??void 0,u=t.source==="github"&&!l?ct(e,n.orgSlug,n.virtualMcpId):void 0,h=u?.isV8&&u.schema&&u.version?u:void 0,b=l??h?.schema,g=h?{...d,schemaVersion:h.version}:d,k=r&&c?g?.revision:void 0,C=r&&b?g?.schemaVersion:void 0,x=m.contentChanges(o),N=e.getQueryData(x),[_,I,O]=await ee(e,t,n,()=>t.client.batch([{method:"blocks.list",params:k?{ifNoneMatch:k}:{}},{method:"schema.get",params:C?{ifNoneMatch:C}:{}},{method:"changes.list",params:N?{ifNoneMatch:N.revision}:{}}]));if(O?.ok){const R=he(N,O.result);R&&e.setQueryData(x,R)}else O&&t.source==="local"&&Se(O.error)&&be(e,n);if(!_?.ok)throw _?.error??new Error("no blocks.list");if(!I)throw new Error("no schema.get");const w=_.result,y=ut(I),S=I.ok&&!y?I.result:null;if(w.notModified&&!c||S?.notModified&&!b)return It(e,t,n,o,!1);const v=w.notModified?new Set:to(e,n),$=w.notModified?c:nn(w.blocks,c,v),A=y?rn():S?S.notModified?b:S.schema:I.error,E=e.getQueryData(a)?.revision,D=E!==void 0&&E!==g?.revision;if(e.setQueryData(a,{revision:D?E:w.notModified?g?.revision:w.revision,schemaVersion:S?S.notModified?g?.schemaVersion:S.version??void 0:void 0}),e.setQueryData(s,$),!w.notModified){const R=m.contentVersions(o),M=e.getQueryData(R),J={...w.versions};for(const Q of v){const L=M?.[Q];L!==void 0?J[Q]=L:delete J[Q]}e.setQueryData(R,J)}return A instanceof T||e.setQueryData(i,A),!D&&!w.notModified&&c&&g?.revision&&w.revision!==g.revision&&Wn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:$,meta:A}}async function tr(e,t,n,o,r,s){return Yn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",write:async()=>{const i=await ee(e,t,n,()=>t.client.blocksApply({set:r.set,delete:r.delete,...s?{ifMatch:s}:{}}));e.setQueryData(m.contentRevision(o),c=>({...c,revision:i.revision}));const a=i.versions??{};return Ct(e,o,a),{revision:i.revision,versions:a}}})}async function nr(e,t,n,o,r){await e.invalidateQueries({queryKey:m.decofile(o)});let s;try{const a=(await ee(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(a&&a.after===null&&a.version!==null)return;s={value:a?.after??null,version:a?.version??null}}catch{const i=await ee(e,t,n,()=>t.client.blocksList({}));if(i.notModified)return;s={value:i.blocks[r]??null,version:i.versions[r]??null}}e.setQueryData(m.decofile(o),i=>{const a={...i};return s.value===null?delete a[r]:a[r]=s.value,a}),Ct(e,o,{[r]:s.version})}function or(e){const t=P.c(11),n=q();let o;t[0]!==e?.branch||t[1]!==e?.orgSlug||t[2]!==e?.virtualMcpId?(o=m.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[0]=e?.branch,t[1]=e?.orgSlug,t[2]=e?.virtualMcpId,t[3]=o):o=t[3];let r;t[4]!==e||t[5]!==n?(r=async()=>{const c=await fetch(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`,{cache:"no-store",headers:ne("v8")});if(await Ce(c))throw Ie(n,e.orgSlug,e.virtualMcpId),new ke;if(!c.ok)throw new Error(`draft pointer read failed: ${c.status}`);return await c.json()},t[4]=e,t[5]=n,t[6]=r):r=t[6];const s=!!e;let i;t[7]!==o||t[8]!==r||t[9]!==s?(i={queryKey:o,queryFn:r,enabled:s,staleTime:Number.POSITIVE_INFINITY},t[7]=o,t[8]=r,t[9]=s,t[10]=i):i=t[10];const{data:a}=F(i);return!e||!a?.draft||!a.version?null:`${a.draft}@${a.version}`}function rr(e){const t=P.c(4);let n;t[0]!==e?(n=m.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:oo,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r?.revision}async function oo(){throw new Error("content revisions are set by reads and writes")}function Je(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function ro(e,t){const n=P.c(6),{url:o}=ht(e?.virtualMcpId),r=ft(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?Je({...e,protocolSuffix:r.cacheKeySuffix}):Je({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function sr(e,t){const n=P.c(39),{url:o,undecided:r}=ht(e?.virtualMcpId),s=!!o,i=ft(e?.virtualMcpId,e?.branch),a=i.kind==="protocol"?i:null,c=ro(e),l=t?.fetchEnabled??!0,d=jn(e?.virtualMcpId),u=We(e?.virtualMcpId).runtime==="cms",h=q();let b;n[0]!==c?(b=m.decofile(c),n[0]=c,n[1]=b):b=n[1];const g=b;let k;n[2]!==e||n[3]!==h||n[4]!==g?(k=()=>{if(!e||h.isMutating({mutationKey:oe(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const v=h.getQueryState(g);return v?.fetchStatus==="fetching"||Date.now()-(v?.dataUpdatedAt??0)<gt/2},n[2]=e,n[3]=h,n[4]=g,n[5]=k):k=n[5];let C;n[6]!==u||n[7]!==s||n[8]!==e||n[9]!==a||n[10]!==h||n[11]!==g?(C=async()=>{if(e){if(!a&&u&&!s){const v=Cn(h,e)?.version;if(v&&!await In(e,v))return}await h.refetchQueries({queryKey:g,exact:!0},{cancelRefetch:!1})}},n[6]=u,n[7]=s,n[8]=e,n[9]=a,n[10]=h,n[11]=g,n[12]=C):C=n[12];let x;n[13]!==k||n[14]!==C?(x={skip:k,read:C},n[13]=k,n[14]=C,n[15]=x):x=n[15],Rn(!!t?.pollWhile&&!!e,x);let N;n[16]!==i.kind||n[17]!==u||n[18]!==l||n[19]!==c||n[20]!==s||n[21]!==o||n[22]!==d||n[23]!==e||n[24]!==a||n[25]!==h?(N=async()=>{if(a)return(await no(h,a,e,c)).blocks;if(i.kind==="unavailable")throw Zn("decofile");if(s){const E=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(ao),D=E?.ok?Ge(await E.text()):null;if(D)return D;const R=new Error("decofile unavailable (local tunnel unreachable)");throw R.status=502,R}if(u)return Tn(h,e);const v=()=>Mn(e,yn(d,".deco/blocks.gen.json"));if(l){const E=await fetch(Ln(e),{cache:"no-store"}).catch(io);if(E?.ok){const M=Ge(await E.text());if(M)return M}const D=await v();if(D.kind==="data")return D.data;const R=new Error(`Failed to fetch decofile: ${E?.status??"network error"}`);throw R.status=qe({liveOk:!!E?.ok,liveStatus:E?.status,committedAbsent:D.kind==="absent"}),R}const $=await v();if($.kind==="data")return $.data;const A=new Error("decofile unavailable (preview down, no committed snapshot)");throw A.status=qe({liveOk:!1,committedAbsent:$.kind==="absent"}),A},n[16]=i.kind,n[17]=u,n[18]=l,n[19]=c,n[20]=s,n[21]=o,n[22]=d,n[23]=e,n[24]=a,n[25]=h,n[26]=N):N=n[26];const _=!!e&&i.kind!=="pending"&&!r,I=a?0:3e4,O=a?.describe.pollIntervalMs,w=a?"always":void 0;let y;n[27]!==u||n[28]!==s||n[29]!==a?(y=(v,$)=>{if(a||u||s)return v<3;const A=$.status;return A!==502&&A!==404&&v<2},n[27]=u,n[28]=s,n[29]=a,n[30]=y):y=n[30];let S;return n[31]!==g||n[32]!==N||n[33]!==_||n[34]!==I||n[35]!==O||n[36]!==w||n[37]!==y?(S={queryKey:g,queryFn:N,enabled:_,staleTime:I,refetchInterval:O,refetchIntervalInBackground:!1,refetchOnWindowFocus:w,retry:y,retryDelay:so},n[31]=g,n[32]=N,n[33]=_,n[34]=I,n[35]=O,n[36]=w,n[37]=y,n[38]=S):S=n[38],F(S)}function so(e){return Vt(5e3,1e3,e,2,0)}function io(){return null}function ao(){return null}const co="site-editor-save",we="site-editor-publish";function lo(e){const t=P.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=V.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=V.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=V.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function Ot(e,t){return t?V.jsx(lo,{label:e("siteEditor.details"),detail:t}):void 0}function ir(e,t,n){z.error(Bn(e,t,n),{id:co,description:Ot(e,Qn(t,n))})}const Tt={action:void 0,duration:void 0};function ar(e,t){z.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Tt,id:we,description:void 0})}function cr(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=Ot(e,o??null);z[i](t,{id:we,description:n&&a?V.jsxs(V.Fragment,{children:[V.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),z.loading(s??e("thread.publishPopover.publishing"),{...Tt,id:we,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function lr(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Ho as $,Yt as A,zt as B,nt as C,Wt as D,lo as E,Te as F,ye as G,Go as H,Pn as I,sr as J,Ao as K,jo as L,jn as M,yn as N,at as O,Uo as P,Fo as Q,H as R,Ro as S,it as T,Yo as U,Wo as V,rr as W,Sn as X,oe as Y,Un as Z,En as _,$o as a,kn as a0,tr as a1,eo as a2,no as a3,Zn as a4,qo as a5,Mn as a6,Ne as a7,Jo as a8,nr as a9,ir as aa,Xo as ab,Lo as ac,Bo as ad,je as ae,Be as af,Qo as ag,Po as ah,An as ai,Mo as aj,Vo as ak,or as al,ne as am,we as an,Tt as ao,cr as ap,Ko as aq,er as ar,Xt as b,ht as c,Ot as d,xo as e,lr as f,ko as g,Eo as h,Gt as i,Yn as j,Ie as k,zo as l,Co as m,Io as n,Se as o,No as p,To as q,Do as r,_o as s,ar as t,ft as u,qt as v,ro as w,zn as x,Oo as y,Zo as z};
|
|
1
|
+
import{c as P,o as q,m as F,K as m,aV as Ye,aF as Nt,aG as _t,r as U,a as Dt,aw as ce,a2 as xt,au as Rt,b8 as Pt,t as z,j as V}from"./index-CaH7O3hJ.js";import{a as We}from"./input-D2sd1bar.js";import{k as $t,M as At,l as le,s as Re}from"./thread-intent-DKuqiaG7.js";import{u as pe,c as Lt}from"./use-main-schema-v8-CZLsOlEV.js";import{b as te}from"./sandbox-url-D3mC8qhT.js";import{s as Ft}from"./utils-DzhKsxx8.js";import{a as Ut}from"./repository-binding-BLgLcT4o.js";import{u as Mt}from"./chat-context-_d3c57p1.js";import{i as jt,u as Bt}from"./index-CJu3ft8V.js";import{v as Qt}from"./sandbox-git-api-CRxdlhrN.js";import{e as Vt}from"./backoff-CrEUbyZT.js";const p={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class T extends Error{code;data;constructor(t,n,o){super(n),this.name="ContentProtocolError",this.code=t,this.data=o}toJSON(){return this.data===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,data:this.data}}static from(t){return new T(t.code,t.message,t.data)}}const K="deco-content",ue={major:1},ze=1;async function Ht(e){let t=new Uint8Array(await e.arrayBuffer());if(t[0]===31&&t[1]===139){const n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));t=new Uint8Array(await new Response(n).arrayBuffer())}return JSON.parse(new TextDecoder().decode(t))}const de={major:ue.major,minor:ze},Xe=`the endpoint speaks an older ${K} than this client needs (${de.major}.${de.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function W(e,t,n){const o={reason:t,required:{...de}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new T(p.Unsupported,e,o)}function Ze(e){const t=e??{},{protocol:n,version:o}=t;if(n!==K)throw W(`the endpoint speaks ${JSON.stringify(n)}, not ${K}`,"protocol",t);if(o?.major!==ue.major)throw W(`the endpoint speaks ${K} ${String(o?.major)}.x; this client speaks ${ue.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<ze)throw W(Xe,"outdated",t);return e}function Pe(e,t){return t.code===p.MethodNotFound&&e.startsWith("changes.")?W(Xe,"outdated"):T.from(t)}function ye(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(s)}));let c;try{c=await Ht(a)}catch{throw new T(p.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(c)&&c?.id===null){const l=c?.error;throw l?T.from(l):new T(p.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const r=async(s,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(c.error)throw Pe(s,c.error);return c.result};return{call:r,describe:async()=>Ze(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((l,d)=>({jsonrpc:"2.0",id:i[d],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,d)=>{const u=c.get(l);return u?u.error?{ok:!1,error:Pe(s[d].method,u.error)}:{ok:!0,result:u.result}:{ok:!1,error:new T(p.InternalError,"no response for this call")}})}}}const fe=".json";[...Array.from({length:9},(e,t)=>`COM${t+1}`),...Array.from({length:9},(e,t)=>`LPT${t+1}`)];new TextEncoder;function Gt(e){return`${encodeURIComponent(e)}${fe}`}function et(e){return e.endsWith(fe)?e.slice(0,-fe.length):e}function Eo(e){const t=et(e);try{return decodeURIComponent(t)}catch{return t}}function Kt(e){let t=et(e),n=0;for(;t.includes("%");){let o;try{o=decodeURIComponent(t)}catch{break}if(o===t)break;t=o,n++}return{name:t,passes:n}}function ko(e){return Kt(Gt(e)).name}const $e=20,Ae=5,Le=500;function Se(e){return e instanceof T?e.code===p.MethodNotFound?!0:e.code===p.Unsupported&&e.data?.reason==="outdated":!1}function he(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function qt(e,t,n){const o=m.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(r?{ifNoneMatch:r.revision}:{}),i=he(r,s);if(i)return i;const a=await t.changesList({});return he(void 0,a)}async function Jt(e,t){const n=[];for(let s=0;s<t.length;s+=$e)n.push(t.slice(s,s+$e));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=Ae){const i=await e.batch(n.slice(s,s+Ae).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const c=a.result;Object.assign(o,c.entries),r.push(...c.diagnostics)}}return{entries:o,diagnostics:r}}async function Co(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=Le){const r=t.slice(o,o+Le),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Io(e){return e instanceof T&&e.code===p.Conflict}function tt(e){return e?.kind==="protocol"?e:null}function Oo(e,t,n){const o=P.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=q();let a;o[2]!==e?(a=tt(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&s.enabled!==!1;let d;o[4]!==t?(d=m.contentChanges(t??""),o[4]=t,o[5]=d):d=o[5];let u;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(u=l?()=>qt(i,c.client,t):Ye,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=u):u=o[10];let h;return o[11]!==d||o[12]!==u?(h={queryKey:d,queryFn:u,staleTime:0},o[11]=d,o[12]=u,o[13]=h):h=o[13],F(h)}function To(e,t,n){const o=P.c(14);let r;o[0]!==e?(r=tt(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!s&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?.revision?(l=m.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=l):l=o[6];let d;o[7]!==c||o[8]!==a||o[9]!==s?(d=c?()=>Jt(s.client,a):Ye,o[7]=c,o[8]=a,o[9]=s,o[10]=d):d=o[10];let u;return o[11]!==l||o[12]!==d?(u={queryKey:l,queryFn:d,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=d,o[13]=u):u=o[13],F(u)}function nt(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;const n=t.hostname.toLowerCase();return n==="127.0.0.1"||n==="[::1]"||n==="localhost"}catch{return!1}}function X(e){try{const t=new URL(e);return(t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&(t.hostname="localhost"),t.href}catch{return e}}const ot=Nt({endpoint:_t().max(2048).refine(e=>nt(e)&&new URL(e).pathname==="/rpc").transform(X)});function No(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=ot.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function rt(e){const t=ot.safeParse(e);return t.success?t.data:null}const st="studio:deco-serve-last";function _o(e){try{localStorage.setItem(st,JSON.stringify(e))}catch{}}function Do(){try{const e=localStorage.getItem(st);return e?rt(JSON.parse(e)):null}catch{return null}}function xo(e){try{return new URL(X(e)).host}catch{return e}}function Yt(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Wt="http://localhost:4545/rpc",Ro="npx @decocms/blocks serve",Po="npx @decocms/blocks schema";class Ee extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function zt(e){if(e instanceof Ee)return{reason:"not-deco-serve"};if(!(e instanceof T))return{reason:"not-answering"};switch(e.code){case p.Unauthorized:case p.MethodNotFound:return{reason:"outdated"};case p.Unsupported:return Se(e)?{reason:"outdated"}:{reason:"version-mismatch"};case p.Unavailable:return/^the endpoint answered HTTP/.test(e.message)?{reason:"not-deco-serve"}:{reason:"error",detail:e.message};default:return{reason:"error",detail:e.message}}}function $o(e,t){if(e)return[X(e.endpoint)];const n=[t?.endpoint,Wt].filter(o=>!!o).map(X);return[...new Set(n)]}const it=U.createContext(null);function Xt(e){const t=P.c(27),n=U.useContext(it),o=pe(n?null:e),{data:r}=Dt.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?ce.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[c,l]=Ue(a);let d;t[4]!==i||t[5]!==s||t[6]!==e?(d=i?ce.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=d):d=t[7];const[u,h]=Ue(d);if(n)return n;let b;t[8]!==c||t[9]!==i?(b=i?rt(c):null,t[8]=c,t[9]=i,t[10]=b):b=t[10];const g=b,k=!!g;let C;t[11]!==o||t[12]!==k?(C=Zt(o,k),t[11]=o,t[12]=k,t[13]=C):C=t[13];const{applies:x,undecided:N}=C,_=x?g:null,I=i&&o==="v8"&&typeof u=="string"?u:null;let O;t[14]!==h||t[15]!==l||t[16]!==i?(O=S=>{i&&(l(S),h(S.endpoint))},t[14]=h,t[15]=l,t[16]=i,t[17]=O):O=t[17];let w;t[18]!==l||t[19]!==i?(w=()=>{i&&l(null)},t[18]=l,t[19]=i,t[20]=w):w=t[20];let y;return t[21]!==_||t[22]!==I||t[23]!==O||t[24]!==w||t[25]!==N?(y={connection:_,undecided:N,lastEndpoint:I,set:O,clear:w},t[21]=_,t[22]=I,t[23]=O,t[24]=w,t[25]=N,t[26]=y):y=t[26],y}function Zt(e,t){return t?e==="loading"?{applies:!1,undecided:!0}:{applies:e==="v8"||e==="error",undecided:!1}:{applies:!1,undecided:!1}}function Fe(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function Ue(e){const t=P.c(17),n=q(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?Fe(e):null,a=()=>e?Fe(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:s,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:d}=F(l);let u;t[10]!==e||t[11]!==n||t[12]!==s?(u=k=>{if(e){try{k===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(k))}catch{}n.setQueryData(s,k)}},t[10]=e,t[11]=n,t[12]=s,t[13]=u):u=t[13];const h=u,b=e?d??null:null;let g;return t[14]!==h||t[15]!==b?(g=[b,h],t[14]=h,t[15]=b,t[16]=g):g=t[16],g}function Ao(e){return e.kind==="protocol"||e.kind==="unavailable"}function Lo(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n==="protocol"||n==="unavailable"?!0:n==="pending"?t===!0?!0:void 0:t}function Fo(e,t,n){return t!=="github"||n!=="v8"?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function Uo(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&nt(t)?t:null}function Mo(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function at(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function en(e){if(!e.hasProject)return"legacy";const t=at(e);if(t==="local")return"protocol-local";if(e.serveConnectionUndecided)return"pending";if(t==="sandbox"){const o=e.sandboxSite;return o==="v8"?"protocol-sandbox":o==="v7"?"legacy":o==="error"?e.markedV8?"retrying-sandbox":"legacy":"pending"}if(e.mainSchema==="loading")return"pending";if(e.mainSchema==="error")return"retrying-github";if(e.mainSchema==="v7")return"legacy";const n=e.githubSite;return n==="v8"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":n==="v7"?"legacy":"pending"}function tn(e){return{github:e.mode==="github"&&e.mainSchema==="v8",sandbox:e.mode==="sandbox"&&e.workingTreeReady}}function Me(e){return e.isError||e.errorUpdateCount>0}function nn(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function on(e){if(!e||typeof e!="object")return[];const t=e,n=[];return typeof t.blockKey=="string"&&n.push(t.blockKey),t.writes&&typeof t.writes=="object"&&n.push(...Object.keys(t.writes)),Array.isArray(t.deletes)&&n.push(...t.deletes.filter(o=>typeof o=="string")),n}function ne(e){return{[$t]:e}}class ke extends Error{status=409;constructor(){super("main's schema changed")}}async function Ce(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code===At}function Ie(e,t,n){e.resetQueries({predicate:o=>{const r=o.queryKey;return r[1]!==t||r[2]!==n?!1:r[0]===m.mainSchemaV8(t,n)[0]||r[0]===m.contentBackend()[0]&&r[4]==="github"}})}function ct(e,t,n){return e.getQueryData(m.mainSchemaV8(t,n))}const lt="__noSchema";function rn(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[lt]:!0}}function jo(e){return!!e&&e[lt]===!0}function ut(e){if(!e.ok)return e.error.code===p.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function sn(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const an=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Bo(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:sn(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(an)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:je(n.resolveType).localeCompare(je(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function je(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Be(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=Be(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?Be(s[a],r,n):s[a];return i}return e}function Qo(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class Qe extends Error{}class Ve extends Error{}const dt="site-not-owned";async function cn(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function ln(e,t=r=>fetch(r),n,o){const r=ye({endpoint:e,fetch:async s=>{const i=new Request(s);for(const[c,l]of Object.entries(ne("v8")))i.headers.set(c,l);const a=await t(i);if(await cn(a))throw new Ve;if(await Ce(a))throw n?.(),new ke;return a}});try{const s=await Te(r,le(o)?{schema:o}:void 0);return s.v8Schema?s:null}catch(s){if(s instanceof Ve)return dt;throw s}}const Oe=5e3;function un(e){return new URL(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/rpc`,window.location.origin).href}function dn(e){return new URL(te(e,"rpc"),window.location.origin).href}async function Te(e,t){const[n,o]=await e.batch(t?[{method:"describe"}]:[{method:"describe"},{method:"schema.get"}]);if(!n?.ok)throw n?.error??new Error("no describe");if(n.result?.protocol!==K)throw new Ee;const s=Ze(n.result);if(t)return{client:e,describe:s,hasSchema:t.schema!=null,v8Schema:le(t.schema)};if(!o)throw new Error("no schema.get");if(ut(o))return{client:e,describe:s,hasSchema:!1,v8Schema:!1};if(o.ok){const i=o.result;return{client:e,describe:s,hasSchema:!0,v8Schema:le(i?.schema)}}throw o.error}async function fn(e,t=n=>fetch(n)){const n=ye({endpoint:e,fetch:async o=>{const r=await t(o);if(r.status===404)throw new Qe;return r}});try{const o=await Te(n);return o.v8Schema?o:null}catch(o){if(o instanceof Qe)return null;throw o}}function ft(e,t){const n=P.c(53),{org:o}=xt(),{connection:r,undecided:s}=Xt(e),{runtime:i}=We(e),a=U.useContext(it),c=pe(a?null:e),l=Lt(e),d=at({hasServeConnection:!!r,runtime:i}),u=Mt()?.taskId??null,h=jt(Bt().lifecycle.phase),b=q(),g=tn({mode:d,mainSchema:c,workingTreeReady:h}),k=g.github&&!!o.slug&&!!e&&!!t;let C;n[0]!==t||n[1]!==o.slug||n[2]!==b||n[3]!==e?(C=()=>ln(un({orgSlug:o.slug,virtualMcpId:e,branch:t}),void 0,()=>Ie(b,o.slug,e),ct(b,o.slug,e)?.schema),n[0]=t,n[1]=o.slug,n[2]=b,n[3]=e,n[4]=C):C=n[4];const x=F({queryKey:m.contentBackend(o.slug,e??"",t??"","github"),queryFn:C,enabled:k,staleTime:Number.POSITIVE_INFINITY,...He}),N=g.sandbox&&!!o.slug&&!!e&&!!t;let _;n[5]!==t||n[6]!==o.slug||n[7]!==u||n[8]!==e?(_=async()=>fn(dn({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:u})),n[5]=t,n[6]=o.slug,n[7]=u,n[8]=e,n[9]=_):_=n[9];const I=F({queryKey:m.contentBackend(o.slug,e??"",t??"","sandbox",u??""),queryFn:_,enabled:N,staleTime:Number.POSITIVE_INFINITY,...He}),O=!!r;let w;n[10]!==r?.endpoint||n[11]!==o.slug||n[12]!==e?(w=m.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[10]=r?.endpoint,n[11]=o.slug,n[12]=e,n[13]=w):w=n[13];let y;n[14]!==r?(y=()=>Te(ye({endpoint:r.endpoint})),n[14]=r,n[15]=y):y=n[15];let S;n[16]!==O||n[17]!==w||n[18]!==y?(S={queryKey:w,queryFn:y,enabled:O,staleTime:Number.POSITIVE_INFINITY,retry:mn,retryDelay:gn,refetchInterval:hn},n[16]=O,n[17]=w,n[18]=y,n[19]=S):S=n[19];const v=F(S);let $;n[20]!==r?.endpoint||n[21]!==o.slug||n[22]!==e?($=m.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[20]=r?.endpoint,n[21]=o.slug,n[22]=e,n[23]=$):$=n[23];const A=$;let E;n[24]!==r?.endpoint||n[25]!==o.slug||n[26]!==e?(E=m.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[24]=r?.endpoint,n[25]=o.slug,n[26]=e,n[27]=E):E=n[27];let D;n[28]!==v.data||n[29]!==A||n[30]!==b?(D=async()=>{try{return await v.data.client.describe()}catch(f){const G=f;throw b.invalidateQueries({queryKey:A,exact:!0},{cancelRefetch:!1}),G}},n[28]=v.data,n[29]=A,n[30]=b,n[31]=D):D=n[31];const R=!!v.data&&!a;let M;n[32]!==E||n[33]!==D||n[34]!==R?(M={queryKey:E,queryFn:D,enabled:R,refetchInterval:Oe,retry:!1},n[32]=E,n[33]=D,n[34]=R,n[35]=M):M=n[35];const Q=F(M).data??v.data?.describe,L=en({hasProject:!!e,hasServeConnection:!!r,serveConnectionUndecided:s,runtime:i,mainSchema:c,githubSite:x.data===dt?"not-owned":x.data?"v8":x.data===null?"v7":Me(x)?"error":"loading",sandboxSite:vn({data:I.data,isError:Me(I),workingTreeReady:h}),markedV8:l});if(L==="pending"){let f;return n[36]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending"},n[36]=f):f=n[36],f}if(L==="retrying-github"){let f;return n[37]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending",retrying:"github"},n[37]=f):f=n[37],f}if(L==="retrying-sandbox"){let f;return n[38]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"pending",retrying:"sandbox"},n[38]=f):f=n[38],f}if(L==="legacy"){let f;return n[39]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"legacy"},n[39]=f):f=n[39],f}if(L==="protocol-github"){const f=x.data;let G;return n[40]!==f?(G=ge("github",f,""),n[40]=f,n[41]=G):G=n[41],G}if(L==="site-not-owned-github"){let f;return n[42]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"unavailable",source:"github",siteNotOwned:!0},n[42]=f):f=n[42],f}if(L==="protocol-sandbox"){let f;return n[43]!==I.data?(f=ge("sandbox",I.data,":sandbox"),n[43]=I.data,n[44]=f):f=n[44],f}if(L==="unavailable-github"){let f;return n[45]===Symbol.for("react.memo_cache_sentinel")?(f={kind:"unavailable",source:"github"},n[45]=f):f=n[45],f}const se=v.error??v.failureReason,ie=r?.endpoint??"";let Y;return n[46]!==Q||n[47]!==v.data||n[48]!==v.failureCount||n[49]!==v.isError||n[50]!==se||n[51]!==ie?(Y=wn({probed:v.data,isError:v.isError,failureCount:v.failureCount,failure:se,describe:Q,endpoint:ie}),n[46]=Q,n[47]=v.data,n[48]=v.failureCount,n[49]=v.isError,n[50]=se,n[51]=ie,n[52]=Y):Y=n[52],Y}function hn(e){return e.state.status==="error"||e.state.data?.v8Schema===!1?Oe:!1}function gn(e){return Yt(e+1)}function mn(e,t){return!(t instanceof T)&&!(t instanceof Ee)}function vn(e){return e.data!==void 0?e.data?"v8":"v7":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const bn=3;function wn(e){if(e.probed?.hasSchema&&!e.probed.v8Schema)return{kind:"unavailable",source:"local",problem:{reason:"not-v8"}};const t=e.probed?ge("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<bn?t:{kind:"unavailable",source:"local",problem:zt(e.failure)}:t??{kind:"pending"}}const He={retry:2,refetchInterval:e=>e.state.status==="error"?Oe:!1};function ge(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema}}function ht(e){const t=P.c(13);let n;t[0]!==e?(n=ce.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=Rt(o,null),i=pe(e);let a;if(t[2]!==i||t[3]!==r||t[4]!==e){const h=e?Re(r):null;a=pn({saved:h,main:i}),t[2]=i,t[3]=r,t[4]=e,t[5]=a}else a=t[5];const c=a;let l,d;t[6]!==s?(l=h=>s(Re(h)),d=()=>s(null),t[6]=s,t[7]=l,t[8]=d):(l=t[7],d=t[8]);let u;return t[9]!==c||t[10]!==l||t[11]!==d?(u={...c,setUrl:l,clear:d},t[9]=c,t[10]=l,t[11]=d,t[12]=u):u=t[12],u}function pn(e){return e.saved?e.main==="v7"?{url:e.saved,undecided:!1}:e.main==="v8"?{url:null,undecided:!1}:{url:null,undecided:!0}:{url:null,undecided:!1}}function yn(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function Ge(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}class Ne extends Error{constructor(t,n,o=[]){super(n),this.blocks=t,this.fields=o,this.name="BlockConflictError"}blocks;fields}function _e(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function oe(e,t,n){return["decofile-write",e,t,n]}function Sn(e,t,n){return{id:oe(e,t,n).join(":")}}function De(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function En(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function kn(e,t,n){e.setQueryData(m.decofileDraft(_e(t)),n)}function Cn(e,t){return e.getQueryData(m.decofileDraft(_e(t)))??null}async function In(e,t){const n=await fetch(De(e),{cache:"no-store",headers:{...ne("v7"),"if-none-match":`"${t}"`}}).catch(()=>null);return n?.status===200||n?.status===409}function Vo(e){const t=P.c(4);let n;t[0]!==e?(n=m.decofileDraft(e?_e(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:On,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r??null}async function On(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Tn(e,t){const n=await fetch(De(t),{cache:"no-store",headers:ne("v7")});if(await Ce(n))throw Ie(e,t.orgSlug,t.virtualMcpId),new ke;if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&kn(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function Ho(e,t){const n=await fetch(De(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new Ne(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return En(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const gt=3e3,Nn=15e3,_n=2*6e4,mt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function Dn(e){return e<_n?gt:Nn}function xn(e,t=mt){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,Dn(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:c,skip:l}=e();if(r||t.hidden()||l?.()){i();return}r=!0;let d;try{d=c()}catch{d=void 0}Promise.resolve(d).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const Ke=()=>0;function Rn(e,t,n=mt){const o=U.useRef(t);o.current=t;const[r]=U.useState(()=>({polling:()=>xn(()=>o.current,n),idle:()=>()=>{}}));U.useSyncExternalStore(e?r.polling:r.idle,Ke,Ke)}function vt(e,t){return te(e,t)}function Pn(e,t){return te(e,"preview-fetch",{path:t})}function Go(e){return vt(e,"preview-invoke")}function Ko(e){return vt(e,"catalog-invoke")}function bt(e){try{const{hostname:t}=new URL(e);return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}function $n(){if(typeof document>"u")return null;const e=Array.from(document.querySelectorAll("iframe"));for(const t of e){const n=t.getAttribute("src");if(n&&bt(n))return n}return null}function An(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??$n();return n&&bt(n)?new URL(t,n).toString():Pn(e,t)}function Ln(e){return An(e,"/.decofile")}function Fn(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function qe(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function Un(e,t){const n=te(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=Fn(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:Ft(s.content)}}async function Mn(e,t){const n=await Un(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function qo(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function jn(e){return Ut(e)?.metadata?.runtime?.path??null}class wt extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function Jo(e){return e instanceof T&&e.code===p.Conflict}function pt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}function Bn(e,t,n){if(t instanceof Ne)return t.message;if(n==="local")return Vn(e,t);if(t instanceof T)switch(t.code){case p.Conflict:return e("siteEditor.save.conflict");case p.ReadOnly:return e("siteEditor.save.readOnly");case p.InvalidBlock:case p.InvalidParams:return e("siteEditor.save.invalid");case p.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function Qn(e,t){if(t==="local"||e instanceof Ne)return null;if(e instanceof T){const n=e.code===p.InvalidBlock||e.code===p.InvalidParams?pt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Vn(e,t){if(t instanceof wt)return e("decoServe.save.serverGone");if(t instanceof T)switch(t.code){case p.Conflict:return e("decoServe.save.conflict");case p.ReadOnly:return e("decoServe.save.readOnly");case p.InvalidBlock:case p.InvalidParams:return e("decoServe.save.invalid",{detail:pt(t)});case p.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Hn(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function Gn(e,t){const[n,o]=U.useState(e),r=U.useRef(null);return e&&!n&&o(!0),U.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=Hn(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const yt={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},Kn=15e3,Z=new Map;function H(e,t){return`${e}/${t}`}function j(e){let t=Z.get(e);return t||(t={state:yt,listeners:new Set,previews:0,timer:null,discardListeners:new Set},Z.set(e,t)),t}function B(e,t){const n=j(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function re(e){e.timer&&clearTimeout(e.timer),e.timer=null}function xe(e){return Z.get(e)?.state??yt}function qn(e,t){const n=j(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Yo(e){const t=j(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(re(t),B(e,{phase:"idle"}))}}function Wo(e){const t=Z.get(e);!t||t.state.phase!=="reloading"||(re(t),B(e,{phase:"idle"}))}function St(e){const t=j(e);re(t),B(e,{phase:"saving",inFlight:t.state.inFlight+1})}function me(e,t){const n=j(e),o=Math.max(0,n.state.inFlight-1);if(o>0){B(e,{inFlight:o});return}if(!t.ok||n.previews===0){B(e,{phase:"idle",inFlight:o});return}Et(e,t.navigates,o)}function Et(e,t,n=0){const o=j(e);re(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&B(e,{phase:"idle"})},Kn),B(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function Jn(e){return e?.kind==="protocol"&&e.source==="github"}async function ve(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:m.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=s?m.protocolDraftRead(o,r,s):null,d=l?JSON.stringify(n.getQueryData(l)??null):null,u=c?[c]:[];if(a&&t.reread&&u.push(n.invalidateQueries({queryKey:m.decofile(a)})),a&&u.push(n.invalidateQueries({queryKey:m.contentChanges(a)})),s&&i.source==="sandbox"&&u.push(n.invalidateQueries({queryKey:Qt(o,r,s)})),Jn(i)&&l&&u.push(n.invalidateQueries({queryKey:l})),await Promise.all(u),t.kind!=="edit"){const g=H(o,r);B(g,{epoch:xe(g).epoch+1})}const h=l?JSON.stringify(n.getQueryData(l)??null):null,b=d!==h;return b&&await new Promise(g=>Pt.schedule(g)),{navigates:b}}async function Yn(e,t){return St(H(e.orgSlug,e.virtualMcpId)),kt(e,t)}async function kt(e,t){const n=H(e.orgSlug,e.virtualMcpId);let o;try{o=await t.write()}catch(s){throw me(n,{ok:!1,navigates:!1}),t.refreshOnError&&ve(e,{kind:t.kind,reread:!0}).catch(()=>{}),s}let r=!1;try{({navigates:r}=await ve(e,t))}catch{}finally{me(n,{ok:!0,navigates:r})}return o}function zo(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=H(o,r),a=new Set(t.blockKeys);for(const d of[...j(i).discardListeners])d(a);St(i);let c=!1;const l=()=>(c=!0,kt(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:oe(o,r,s),scope:Sn(o,r,s),mutationFn:l}).execute(void 0).catch(d=>{throw c||me(i,{ok:!1,navigates:!1}),d}):l()}function Xo(e,t,n){const o=P.c(8);let r;o[0]!==e||o[1]!==t?(r=H(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const c=j(s).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],U.useEffect(i,a)}function Wn(e){const t=H(e.orgSlug,e.virtualMcpId);xe(t).inFlight>0||ve(e,{kind:"external"}).then(({navigates:n})=>{const o=j(t);o.previews>0&&o.state.inFlight===0&&Et(t,n)}).catch(()=>{})}function zn(e,t){const n=P.c(7);let o;n[0]!==e||n[1]!==t?(o=H(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=l=>qn(r,l),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>xe(r),n[5]=r,n[6]=a):a=n[6];const c=a;return U.useSyncExternalStore(i,c,c)}const Xn=500;function Zo(e,t){const{phase:n}=zn(e,t);return Gn(n!=="idle",Xn)}function Zn(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function eo(e,t){return m.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function er(e,t,n){const o=e.getQueryData(m.contentVersions(t));if(!o)return;if(Object.hasOwn(o,n))return o[n];const r=e.getQueryData(m.decofile(t));return r&&Object.hasOwn(r,n)?void 0:null}function Ct(e,t,n){e.setQueryData(m.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function to(e,t){const n=e.getMutationCache().findAll({mutationKey:oe(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>on(o.state.variables)))}function be(e,t){e.resetQueries({queryKey:m.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function ee(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof T);throw t.source==="local"&&s?(be(e,n),new wt(r)):(t.source==="local"&&Se(r)&&be(e,n),r)}}const ae=new Map;function no(e,t,n,o){const r=ae.get(o);if(r)return r;const s=It(e,t,n,o,!0);return ae.set(o,s),s.finally(()=>ae.delete(o))}async function It(e,t,n,o,r){const s=m.decofile(o),i=eo(n,t),a=m.contentRevision(o),c=e.getQueryData(s),l=e.getQueryData(i),d=e.getQueryData(a)??void 0,u=t.source==="github"&&!l?ct(e,n.orgSlug,n.virtualMcpId):void 0,h=u?.isV8&&u.schema&&u.version?u:void 0,b=l??h?.schema,g=h?{...d,schemaVersion:h.version}:d,k=r&&c?g?.revision:void 0,C=r&&b?g?.schemaVersion:void 0,x=m.contentChanges(o),N=e.getQueryData(x),[_,I,O]=await ee(e,t,n,()=>t.client.batch([{method:"blocks.list",params:k?{ifNoneMatch:k}:{}},{method:"schema.get",params:C?{ifNoneMatch:C}:{}},{method:"changes.list",params:N?{ifNoneMatch:N.revision}:{}}]));if(O?.ok){const R=he(N,O.result);R&&e.setQueryData(x,R)}else O&&t.source==="local"&&Se(O.error)&&be(e,n);if(!_?.ok)throw _?.error??new Error("no blocks.list");if(!I)throw new Error("no schema.get");const w=_.result,y=ut(I),S=I.ok&&!y?I.result:null;if(w.notModified&&!c||S?.notModified&&!b)return It(e,t,n,o,!1);const v=w.notModified?new Set:to(e,n),$=w.notModified?c:nn(w.blocks,c,v),A=y?rn():S?S.notModified?b:S.schema:I.error,E=e.getQueryData(a)?.revision,D=E!==void 0&&E!==g?.revision;if(e.setQueryData(a,{revision:D?E:w.notModified?g?.revision:w.revision,schemaVersion:S?S.notModified?g?.schemaVersion:S.version??void 0:void 0}),e.setQueryData(s,$),!w.notModified){const R=m.contentVersions(o),M=e.getQueryData(R),J={...w.versions};for(const Q of v){const L=M?.[Q];L!==void 0?J[Q]=L:delete J[Q]}e.setQueryData(R,J)}return A instanceof T||e.setQueryData(i,A),!D&&!w.notModified&&c&&g?.revision&&w.revision!==g.revision&&Wn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:$,meta:A}}async function tr(e,t,n,o,r,s){return Yn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",write:async()=>{const i=await ee(e,t,n,()=>t.client.blocksApply({set:r.set,delete:r.delete,...s?{ifMatch:s}:{}}));e.setQueryData(m.contentRevision(o),c=>({...c,revision:i.revision}));const a=i.versions??{};return Ct(e,o,a),{revision:i.revision,versions:a}}})}async function nr(e,t,n,o,r){await e.invalidateQueries({queryKey:m.decofile(o)});let s;try{const a=(await ee(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(a&&a.after===null&&a.version!==null)return;s={value:a?.after??null,version:a?.version??null}}catch{const i=await ee(e,t,n,()=>t.client.blocksList({}));if(i.notModified)return;s={value:i.blocks[r]??null,version:i.versions[r]??null}}e.setQueryData(m.decofile(o),i=>{const a={...i};return s.value===null?delete a[r]:a[r]=s.value,a}),Ct(e,o,{[r]:s.version})}function or(e){const t=P.c(11),n=q();let o;t[0]!==e?.branch||t[1]!==e?.orgSlug||t[2]!==e?.virtualMcpId?(o=m.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[0]=e?.branch,t[1]=e?.orgSlug,t[2]=e?.virtualMcpId,t[3]=o):o=t[3];let r;t[4]!==e||t[5]!==n?(r=async()=>{const c=await fetch(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`,{cache:"no-store",headers:ne("v8")});if(await Ce(c))throw Ie(n,e.orgSlug,e.virtualMcpId),new ke;if(!c.ok)throw new Error(`draft pointer read failed: ${c.status}`);return await c.json()},t[4]=e,t[5]=n,t[6]=r):r=t[6];const s=!!e;let i;t[7]!==o||t[8]!==r||t[9]!==s?(i={queryKey:o,queryFn:r,enabled:s,staleTime:Number.POSITIVE_INFINITY},t[7]=o,t[8]=r,t[9]=s,t[10]=i):i=t[10];const{data:a}=F(i);return!e||!a?.draft||!a.version?null:`${a.draft}@${a.version}`}function rr(e){const t=P.c(4);let n;t[0]!==e?(n=m.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:oo,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r?.revision}async function oo(){throw new Error("content revisions are set by reads and writes")}function Je(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function ro(e,t){const n=P.c(6),{url:o}=ht(e?.virtualMcpId),r=ft(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?Je({...e,protocolSuffix:r.cacheKeySuffix}):Je({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function sr(e,t){const n=P.c(39),{url:o,undecided:r}=ht(e?.virtualMcpId),s=!!o,i=ft(e?.virtualMcpId,e?.branch),a=i.kind==="protocol"?i:null,c=ro(e),l=t?.fetchEnabled??!0,d=jn(e?.virtualMcpId),u=We(e?.virtualMcpId).runtime==="cms",h=q();let b;n[0]!==c?(b=m.decofile(c),n[0]=c,n[1]=b):b=n[1];const g=b;let k;n[2]!==e||n[3]!==h||n[4]!==g?(k=()=>{if(!e||h.isMutating({mutationKey:oe(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const v=h.getQueryState(g);return v?.fetchStatus==="fetching"||Date.now()-(v?.dataUpdatedAt??0)<gt/2},n[2]=e,n[3]=h,n[4]=g,n[5]=k):k=n[5];let C;n[6]!==u||n[7]!==s||n[8]!==e||n[9]!==a||n[10]!==h||n[11]!==g?(C=async()=>{if(e){if(!a&&u&&!s){const v=Cn(h,e)?.version;if(v&&!await In(e,v))return}await h.refetchQueries({queryKey:g,exact:!0},{cancelRefetch:!1})}},n[6]=u,n[7]=s,n[8]=e,n[9]=a,n[10]=h,n[11]=g,n[12]=C):C=n[12];let x;n[13]!==k||n[14]!==C?(x={skip:k,read:C},n[13]=k,n[14]=C,n[15]=x):x=n[15],Rn(!!t?.pollWhile&&!!e,x);let N;n[16]!==i.kind||n[17]!==u||n[18]!==l||n[19]!==c||n[20]!==s||n[21]!==o||n[22]!==d||n[23]!==e||n[24]!==a||n[25]!==h?(N=async()=>{if(a)return(await no(h,a,e,c)).blocks;if(i.kind==="unavailable")throw Zn("decofile");if(s){const E=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(ao),D=E?.ok?Ge(await E.text()):null;if(D)return D;const R=new Error("decofile unavailable (local tunnel unreachable)");throw R.status=502,R}if(u)return Tn(h,e);const v=()=>Mn(e,yn(d,".deco/blocks.gen.json"));if(l){const E=await fetch(Ln(e),{cache:"no-store"}).catch(io);if(E?.ok){const M=Ge(await E.text());if(M)return M}const D=await v();if(D.kind==="data")return D.data;const R=new Error(`Failed to fetch decofile: ${E?.status??"network error"}`);throw R.status=qe({liveOk:!!E?.ok,liveStatus:E?.status,committedAbsent:D.kind==="absent"}),R}const $=await v();if($.kind==="data")return $.data;const A=new Error("decofile unavailable (preview down, no committed snapshot)");throw A.status=qe({liveOk:!1,committedAbsent:$.kind==="absent"}),A},n[16]=i.kind,n[17]=u,n[18]=l,n[19]=c,n[20]=s,n[21]=o,n[22]=d,n[23]=e,n[24]=a,n[25]=h,n[26]=N):N=n[26];const _=!!e&&i.kind!=="pending"&&!r,I=a?0:3e4,O=a?.describe.pollIntervalMs,w=a?"always":void 0;let y;n[27]!==u||n[28]!==s||n[29]!==a?(y=(v,$)=>{if(a||u||s)return v<3;const A=$.status;return A!==502&&A!==404&&v<2},n[27]=u,n[28]=s,n[29]=a,n[30]=y):y=n[30];let S;return n[31]!==g||n[32]!==N||n[33]!==_||n[34]!==I||n[35]!==O||n[36]!==w||n[37]!==y?(S={queryKey:g,queryFn:N,enabled:_,staleTime:I,refetchInterval:O,refetchIntervalInBackground:!1,refetchOnWindowFocus:w,retry:y,retryDelay:so},n[31]=g,n[32]=N,n[33]=_,n[34]=I,n[35]=O,n[36]=w,n[37]=y,n[38]=S):S=n[38],F(S)}function so(e){return Vt(5e3,1e3,e,2,0)}function io(){return null}function ao(){return null}const co="site-editor-save",we="site-editor-publish";function lo(e){const t=P.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=V.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=V.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=V.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function Ot(e,t){return t?V.jsx(lo,{label:e("siteEditor.details"),detail:t}):void 0}function ir(e,t,n){z.error(Bn(e,t,n),{id:co,description:Ot(e,Qn(t,n))})}const Tt={action:void 0,duration:void 0};function ar(e,t){z.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Tt,id:we,description:void 0})}function cr(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=Ot(e,o??null);z[i](t,{id:we,description:n&&a?V.jsxs(V.Fragment,{children:[V.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),z.loading(s??e("thread.publishPopover.publishing"),{...Tt,id:we,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function lr(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Ho as $,Yt as A,zt as B,nt as C,Wt as D,lo as E,Te as F,ye as G,Go as H,Pn as I,sr as J,Ao as K,jo as L,jn as M,yn as N,at as O,Uo as P,Fo as Q,H as R,Ro as S,it as T,Yo as U,Wo as V,rr as W,Sn as X,oe as Y,Un as Z,En as _,$o as a,kn as a0,tr as a1,eo as a2,no as a3,Zn as a4,qo as a5,Mn as a6,Ne as a7,Jo as a8,nr as a9,ir as aa,Xo as ab,Lo as ac,Bo as ad,je as ae,Be as af,Qo as ag,Po as ah,An as ai,Mo as aj,Vo as ak,or as al,ne as am,we as an,Tt as ao,cr as ap,Ko as aq,er as ar,Xt as b,ht as c,Ot as d,xo as e,lr as f,ko as g,Eo as h,Gt as i,Yn as j,Ie as k,zo as l,Co as m,Io as n,Se as o,No as p,To as q,Do as r,_o as s,ar as t,ft as u,qt as v,ro as w,zn as x,Oo as y,Zo as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as te,a2 as se,o as ae,r as T,aa as ce,j as t,B as U,n as $,b2 as de,a3 as me,t as D,az as ue,c as ie,l as pe,X as ge,T as fe,V as he,U as xe,K as Q,eZ as je}from"./index-DcU2uHG-.js";import{i as ke}from"./DotsVertical-BvyfZIer.js";import{i as le,a as ve}from"./ZoomOut-B55seUHX.js";import{s as ye}from"./Trash01-Cf6bGuCZ.js";import{i as Se}from"./Upload01-ZLE7vfB9.js";import{S as be}from"./search-input-C77c23a_.js";import{S as we}from"./search-toggle-BqUvwbnO.js";import{f as Ce,e as De,b as Ne,A as Pe,a as Ae,d as Ee,c as Te,g as Me}from"./alert-dialog-M8Y0zqSA.js";import{E as Y}from"./empty-state-B1xpK558.js";import{C as Oe}from"./collection-tabs-DJst1PBn.js";import{p as Ie,S as ze,F as Fe}from"./folder-icon-JgTmBbpC.js";import{h as Re,i as $e,r as _e}from"./use-org-fs-D82Vx4hB.js";import{S as Le,H as Z,f as Be}from"./location-V0VwTJTt.js";import"./SearchMd-BODiv7c9.js";import"./icon-button-Dg2jSe-y.js";import"./tooltip-BqHx2R4U.js";import"./index-WjQsIrkp.js";import"./badge-ByzdbptS.js";import"./markdown-1PeXOKNt.js";import"./use-copy-K9rQ1PJH.js";import"./Copy01-C73PJJxr.js";import"./use-mobile-BfmJV4wy.js";import"./use-panel-navigate-K8ACrPML.js";import"./thread-route-DsRsjMOv.js";import"./use-project-scope-CGMALc0e.js";import"./repository-binding-B-JblZ3B.js";import"./use-mcp-client-ZokR8_74.js";import"./auth-CJCUdDnK.js";import"./file-preview-BFXgyqHl.js";import"./utils-Bp3fKbm9.js";import"./Image01-DowwsvYG.js";import"./editor-DWhRi1_f.js";import"./file-type-icon-Ez8-DRHg.js";import"./useInfiniteQuery-B7za82zu.js";import"./infiniteQueryObserver-P7ZNg4ZF.js";const J=200,Ke=new Set(["node_modules","__pycache__"]);function q(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function He(s){return q(s).split("/").every(e=>!e.startsWith(".")&&!Ke.has(e))}function Qe(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ue(s,e){const l=new Map;for(const r of s){const c=q(r).split("/");c.pop();const a=["skills",e,...c].join("/");l.set(a,[...l.get(a)??[],r])}return l}async function qe(s,e){const r=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(r)throw r.reason}function Ge(s,e){const l=Ie(e),r=`skills/${s}`;return{id:`home/${r}`,name:l.name??s,description:l.description,disableModelInvocation:l.disableModelInvocation,source:"home",volume:Z,path:r,sandboxPath:`${Le}/${Z}/${r}`}}const L="*";function B(s){return s.volume==="home"}function re(s,e){const l=s.indexOf(":");return l===-1?{label:e,glyph:le}:{label:s.slice(l+1),glyph:s.startsWith("repo:")?ue:ve}}function Xe(s){const e=ie.c(48),{entry:l,pending:r,onOpen:c,onDelete:a}=s,o=te(),{org:m}=se();let S;e[0]!==l.source||e[1]!==m.name?(S=re(l.source,m.name),e[0]=l.source,e[1]=m.name,e[2]=S):S=e[2];const{label:M,glyph:O}=S;let I;e[3]!==l?(I=B(l),e[3]=l,e[4]=I):I=e[4];const F=I,z=r?"opacity-60":"hover:bg-accent";let u;e[5]!==z?(u=pe("relative transition-colors group overflow-hidden flex flex-col h-full",z),e[5]=z,e[6]=u):u=e[6];let f;e[7]!==l.name||e[8]!==c||e[9]!==r?(f=!r&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":l.name}),e[7]=l.name,e[8]=c,e[9]=r,e[10]=f):f=e[10];const b=F?"default":"system",N=!F;let w;e[11]!==O||e[12]!==b||e[13]!==N?(w=t.jsx(Fe,{glyph:O,tone:b,readOnly:N,className:"size-8 shrink-0"}),e[11]=O,e[12]=b,e[13]=N,e[14]=w):w=e[14];let h;e[15]!==a||e[16]!==o?(h=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(ge,{children:[t.jsx(fe,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"icon",children:t.jsx(ke,{size:16})})}),t.jsx(he,{align:"end",children:t.jsxs(xe,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(ye,{size:16}),o("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=o,e[17]=h):h=e[17];let x;e[18]!==w||e[19]!==h?(x=t.jsxs("div",{className:"flex items-start justify-between",children:[w,h]}),e[18]=w,e[19]=h,e[20]=x):x=e[20];let j;e[21]!==l.name?(j=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:l.name}),e[21]=l.name,e[22]=j):j=e[22];let C;e[23]!==l.description||e[24]!==o?(C=l.description||o("settings.skills.noDescription"),e[23]=l.description,e[24]=o,e[25]=C):C=e[25];let k;e[26]!==C?(k=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:C}),e[26]=C,e[27]=k):k=e[27];let d;e[28]!==j||e[29]!==k?(d=t.jsxs("div",{className:"flex flex-col gap-1",children:[j,k]}),e[28]=j,e[29]=k,e[30]=d):d=e[30];let v;e[31]!==x||e[32]!==d?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[x,d]}),e[31]=x,e[32]=d,e[33]=v):v=e[33];let p;e[34]!==M||e[35]!==r||e[36]!==o?(p=r?o("settings.skills.importing"):M,e[34]=M,e[35]=r,e[36]=o,e[37]=p):p=e[37];let y;e[38]!==p?(y=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:p})})}),e[38]=p,e[39]=y):y=e[39];let g;e[40]!==v||e[41]!==y?(g=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[v,y]}),e[40]=v,e[41]=y,e[42]=g):g=e[42];let P;return e[43]!==r||e[44]!==g||e[45]!==u||e[46]!==f?(P=t.jsxs(je,{size:"flush","aria-busy":r,className:u,children:[f,g]}),e[43]=r,e[44]=g,e[45]=u,e[46]=f,e[47]=P):P=e[47],P}function ee(s){const e=ie.c(2),{children:l}=s;let r;return e[0]!==l?(r=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:l}),e[0]=l,e[1]=r):r=e[1],r}function Et(){const s=te(),{org:e}=se(),l=Re(),{remove:r,upload:c}=$e("home"),a=ae(),o=T.useRef(null),[m,S]=T.useState(""),M=ce(),[O,I]=T.useState(L),[F,z]=T.useState(!1),[u,f]=T.useState(null),[b,N]=T.useState(null),[w,h]=T.useState(null),x=()=>{a.invalidateQueries({queryKey:Q.slashSkills(e.id)}),a.invalidateQueries({queryKey:Q.orgFsSkills(e.id)})},j=i=>a.setQueryData(Q.slashSkills(e.id),n=>i(n??[]));async function C(i){const n=[...i??[]];if(o.current&&(o.current.value=""),n.length===0)return;const A=n[0]?.webkitRelativePath??"";if(!A){D.error(s("settings.skills.importNeedsFolder"));return}const H=A.split("/")[0]??"",_=n.filter(He),X=_.find(E=>q(E)==="SKILL.md");if(!X){D.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){D.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(J)}));return}const R=Qe(H),W=`skills/${R}`;let V=!1;z(!0);try{if(await _e(e.slug,"home",W)){D.error(s("settings.skills.importSlugTaken",{slug:R}));return}V=!0;const E=Ge(R,await X.text());j(oe=>[E,...oe]),h(E.id),await qe(Ue(_,R),c.mutateAsync),D.success(s("settings.skills.importSuccess",{name:R}))}catch(E){V&&await r.mutateAsync(W).catch(()=>{}),D.error(E instanceof Error?E.message:s("settings.skills.importError"))}finally{h(null),x(),z(!1)}}const k=m.toLowerCase(),d=(l.data??[]).filter(i=>i.name.toLowerCase().includes(k)||(i.description??"").toLowerCase().includes(k)).sort((i,n)=>Number(B(n))-Number(B(i))||i.name.localeCompare(n.name)),v=new Set((l.data??[]).map(i=>i.source)),p=new Map;for(const i of d)p.set(i.source,(p.get(i.source)??0)+1);const y=[{id:L,label:s("settings.skills.filterAll"),count:d.length},...[...v].map(i=>({id:i,label:re(i,e.name).label,count:p.get(i)??0}))],g=v.has(O)?O:L,P=g===L?d:d.filter(i=>i.source===g),K=i=>f(Be(i.volume,i.path)),ne=async()=>{if(!b)return;const{id:i,path:n}=b;N(null),j(A=>A.filter(H=>H.id!==i));try{await r.mutateAsync(n),D.success(s("settings.skills.deleteSuccess"))}catch(A){D.error(A instanceof Error?A.message:s("settings.skills.deleteError"))}finally{x()}},G=t.jsxs(U,{size:"sm",disabled:F,onClick:()=>o.current?.click(),children:[t.jsx(Se,{size:14}),s(F?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs($,{children:[t.jsx($.Content,{children:t.jsx($.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[M?t.jsx($.Actions,{secondary:t.jsx(we,{value:m,onChange:S,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:G}):t.jsx($.Title,{actions:G,children:s("settings.skills.pageTitle")}),t.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3 empty:hidden",children:!M&&t.jsx(be,{value:m,onChange:S,placeholder:s("settings.skills.searchPlaceholder"),className:"w-full md:w-[375px]",onKeyDown:i=>{i.key==="Escape"&&(S(""),i.target.blur())}})}),t.jsx("input",{ref:o,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:i=>{C(i.target.files)}}),y.length>2&&t.jsx(Oe,{placement:"page",tabs:y,activeTab:g,onTabChange:I}),l.isPending?t.jsx("div",{className:"@container",children:t.jsx(ee,{children:Array.from({length:8},(i,n)=>t.jsx(de,{className:"h-[168px] rounded-xl"},n))})}):l.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(me,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:l.error instanceof Error?l.error.message:s("settings.skills.errorDescription"),actions:t.jsx(U,{size:"sm",variant:"outline",onClick:()=>{l.refetch()},children:s("settings.skills.retry")})})}):P.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(le,{size:48,className:"text-muted-foreground"}),title:s(m?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:m?s("settings.skills.noResultsDescription",{search:m}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(ee,{children:P.map(i=>{const n=i.id===w;return t.jsx(Xe,{entry:i,pending:n,onOpen:()=>K(i),onDelete:B(i)&&!n?()=>N(i):void 0},i.id)})})})]})})}),u&&t.jsx(ze,{skillPath:u,onClose:()=>f(null)},u),t.jsx(Ce,{open:b!==null,onOpenChange:i=>!i&&N(null),children:t.jsxs(De,{children:[t.jsxs(Ne,{children:[t.jsx(Pe,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(Ae,{children:s("settings.skills.deleteDialogDescription",{name:b?.name??""})})]}),t.jsxs(Ee,{children:[t.jsx(Te,{children:s("settings.skills.cancel")}),t.jsx(Me,{onClick:ne,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{Et as default};
|
|
1
|
+
import{b as te,a2 as se,o as ae,r as T,aa as ce,j as t,B as U,n as $,b2 as de,a3 as me,t as D,az as ue,c as ie,l as pe,X as ge,T as fe,V as he,U as xe,K as Q,eZ as je}from"./index-CaH7O3hJ.js";import{i as ke}from"./DotsVertical-BvwGTDkC.js";import{i as le,a as ve}from"./ZoomOut-BfQx-fBr.js";import{s as ye}from"./Trash01-D92WhXf2.js";import{i as Se}from"./Upload01-BSDy4f7m.js";import{S as be}from"./search-input-CXQLMhKZ.js";import{S as we}from"./search-toggle-DxUZFRWy.js";import{f as Ce,e as De,b as Ne,A as Pe,a as Ae,d as Ee,c as Te,g as Me}from"./alert-dialog-CKDHmJ-l.js";import{E as Y}from"./empty-state-Bok1L2hc.js";import{C as Oe}from"./collection-tabs-DIFXv7hR.js";import{p as Ie,S as ze,F as Fe}from"./folder-icon-qexQSaYN.js";import{h as Re,i as $e,r as _e}from"./use-org-fs-D_4Q985K.js";import{S as Le,H as Z,f as Be}from"./location-V0VwTJTt.js";import"./SearchMd-Cuf45jFP.js";import"./icon-button-CwrVRVUS.js";import"./tooltip-B5RmO6BW.js";import"./index-C9OgV5Vt.js";import"./badge-Cnnepvq1.js";import"./markdown-CA3yd3L6.js";import"./use-copy-d7X6hrKI.js";import"./Copy01-DC8f0fwU.js";import"./use-mobile-DCpa1RnA.js";import"./use-panel-navigate-DoD4Atgz.js";import"./thread-route-CQ0phZyI.js";import"./use-project-scope-Cq4vb2Sy.js";import"./repository-binding-BLgLcT4o.js";import"./use-mcp-client-MRThuZpK.js";import"./auth-hgpoCSIS.js";import"./file-preview-DSIiiWjA.js";import"./utils-DzhKsxx8.js";import"./Image01-D7F4wuKx.js";import"./editor-BFHySd1K.js";import"./file-type-icon-DPqHd815.js";import"./useInfiniteQuery-ZoWXsJcj.js";import"./infiniteQueryObserver-u-Zd7Oxq.js";const J=200,Ke=new Set(["node_modules","__pycache__"]);function q(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function He(s){return q(s).split("/").every(e=>!e.startsWith(".")&&!Ke.has(e))}function Qe(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ue(s,e){const l=new Map;for(const r of s){const c=q(r).split("/");c.pop();const a=["skills",e,...c].join("/");l.set(a,[...l.get(a)??[],r])}return l}async function qe(s,e){const r=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(r)throw r.reason}function Ge(s,e){const l=Ie(e),r=`skills/${s}`;return{id:`home/${r}`,name:l.name??s,description:l.description,disableModelInvocation:l.disableModelInvocation,source:"home",volume:Z,path:r,sandboxPath:`${Le}/${Z}/${r}`}}const L="*";function B(s){return s.volume==="home"}function re(s,e){const l=s.indexOf(":");return l===-1?{label:e,glyph:le}:{label:s.slice(l+1),glyph:s.startsWith("repo:")?ue:ve}}function Xe(s){const e=ie.c(48),{entry:l,pending:r,onOpen:c,onDelete:a}=s,o=te(),{org:m}=se();let S;e[0]!==l.source||e[1]!==m.name?(S=re(l.source,m.name),e[0]=l.source,e[1]=m.name,e[2]=S):S=e[2];const{label:M,glyph:O}=S;let I;e[3]!==l?(I=B(l),e[3]=l,e[4]=I):I=e[4];const F=I,z=r?"opacity-60":"hover:bg-accent";let u;e[5]!==z?(u=pe("relative transition-colors group overflow-hidden flex flex-col h-full",z),e[5]=z,e[6]=u):u=e[6];let f;e[7]!==l.name||e[8]!==c||e[9]!==r?(f=!r&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":l.name}),e[7]=l.name,e[8]=c,e[9]=r,e[10]=f):f=e[10];const b=F?"default":"system",N=!F;let w;e[11]!==O||e[12]!==b||e[13]!==N?(w=t.jsx(Fe,{glyph:O,tone:b,readOnly:N,className:"size-8 shrink-0"}),e[11]=O,e[12]=b,e[13]=N,e[14]=w):w=e[14];let h;e[15]!==a||e[16]!==o?(h=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(ge,{children:[t.jsx(fe,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"icon",children:t.jsx(ke,{size:16})})}),t.jsx(he,{align:"end",children:t.jsxs(xe,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(ye,{size:16}),o("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=o,e[17]=h):h=e[17];let x;e[18]!==w||e[19]!==h?(x=t.jsxs("div",{className:"flex items-start justify-between",children:[w,h]}),e[18]=w,e[19]=h,e[20]=x):x=e[20];let j;e[21]!==l.name?(j=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:l.name}),e[21]=l.name,e[22]=j):j=e[22];let C;e[23]!==l.description||e[24]!==o?(C=l.description||o("settings.skills.noDescription"),e[23]=l.description,e[24]=o,e[25]=C):C=e[25];let k;e[26]!==C?(k=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:C}),e[26]=C,e[27]=k):k=e[27];let d;e[28]!==j||e[29]!==k?(d=t.jsxs("div",{className:"flex flex-col gap-1",children:[j,k]}),e[28]=j,e[29]=k,e[30]=d):d=e[30];let v;e[31]!==x||e[32]!==d?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[x,d]}),e[31]=x,e[32]=d,e[33]=v):v=e[33];let p;e[34]!==M||e[35]!==r||e[36]!==o?(p=r?o("settings.skills.importing"):M,e[34]=M,e[35]=r,e[36]=o,e[37]=p):p=e[37];let y;e[38]!==p?(y=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:p})})}),e[38]=p,e[39]=y):y=e[39];let g;e[40]!==v||e[41]!==y?(g=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[v,y]}),e[40]=v,e[41]=y,e[42]=g):g=e[42];let P;return e[43]!==r||e[44]!==g||e[45]!==u||e[46]!==f?(P=t.jsxs(je,{size:"flush","aria-busy":r,className:u,children:[f,g]}),e[43]=r,e[44]=g,e[45]=u,e[46]=f,e[47]=P):P=e[47],P}function ee(s){const e=ie.c(2),{children:l}=s;let r;return e[0]!==l?(r=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:l}),e[0]=l,e[1]=r):r=e[1],r}function Et(){const s=te(),{org:e}=se(),l=Re(),{remove:r,upload:c}=$e("home"),a=ae(),o=T.useRef(null),[m,S]=T.useState(""),M=ce(),[O,I]=T.useState(L),[F,z]=T.useState(!1),[u,f]=T.useState(null),[b,N]=T.useState(null),[w,h]=T.useState(null),x=()=>{a.invalidateQueries({queryKey:Q.slashSkills(e.id)}),a.invalidateQueries({queryKey:Q.orgFsSkills(e.id)})},j=i=>a.setQueryData(Q.slashSkills(e.id),n=>i(n??[]));async function C(i){const n=[...i??[]];if(o.current&&(o.current.value=""),n.length===0)return;const A=n[0]?.webkitRelativePath??"";if(!A){D.error(s("settings.skills.importNeedsFolder"));return}const H=A.split("/")[0]??"",_=n.filter(He),X=_.find(E=>q(E)==="SKILL.md");if(!X){D.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){D.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(J)}));return}const R=Qe(H),W=`skills/${R}`;let V=!1;z(!0);try{if(await _e(e.slug,"home",W)){D.error(s("settings.skills.importSlugTaken",{slug:R}));return}V=!0;const E=Ge(R,await X.text());j(oe=>[E,...oe]),h(E.id),await qe(Ue(_,R),c.mutateAsync),D.success(s("settings.skills.importSuccess",{name:R}))}catch(E){V&&await r.mutateAsync(W).catch(()=>{}),D.error(E instanceof Error?E.message:s("settings.skills.importError"))}finally{h(null),x(),z(!1)}}const k=m.toLowerCase(),d=(l.data??[]).filter(i=>i.name.toLowerCase().includes(k)||(i.description??"").toLowerCase().includes(k)).sort((i,n)=>Number(B(n))-Number(B(i))||i.name.localeCompare(n.name)),v=new Set((l.data??[]).map(i=>i.source)),p=new Map;for(const i of d)p.set(i.source,(p.get(i.source)??0)+1);const y=[{id:L,label:s("settings.skills.filterAll"),count:d.length},...[...v].map(i=>({id:i,label:re(i,e.name).label,count:p.get(i)??0}))],g=v.has(O)?O:L,P=g===L?d:d.filter(i=>i.source===g),K=i=>f(Be(i.volume,i.path)),ne=async()=>{if(!b)return;const{id:i,path:n}=b;N(null),j(A=>A.filter(H=>H.id!==i));try{await r.mutateAsync(n),D.success(s("settings.skills.deleteSuccess"))}catch(A){D.error(A instanceof Error?A.message:s("settings.skills.deleteError"))}finally{x()}},G=t.jsxs(U,{size:"sm",disabled:F,onClick:()=>o.current?.click(),children:[t.jsx(Se,{size:14}),s(F?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs($,{children:[t.jsx($.Content,{children:t.jsx($.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[M?t.jsx($.Actions,{secondary:t.jsx(we,{value:m,onChange:S,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:G}):t.jsx($.Title,{actions:G,children:s("settings.skills.pageTitle")}),t.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3 empty:hidden",children:!M&&t.jsx(be,{value:m,onChange:S,placeholder:s("settings.skills.searchPlaceholder"),className:"w-full md:w-[375px]",onKeyDown:i=>{i.key==="Escape"&&(S(""),i.target.blur())}})}),t.jsx("input",{ref:o,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:i=>{C(i.target.files)}}),y.length>2&&t.jsx(Oe,{placement:"page",tabs:y,activeTab:g,onTabChange:I}),l.isPending?t.jsx("div",{className:"@container",children:t.jsx(ee,{children:Array.from({length:8},(i,n)=>t.jsx(de,{className:"h-[168px] rounded-xl"},n))})}):l.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(me,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:l.error instanceof Error?l.error.message:s("settings.skills.errorDescription"),actions:t.jsx(U,{size:"sm",variant:"outline",onClick:()=>{l.refetch()},children:s("settings.skills.retry")})})}):P.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(le,{size:48,className:"text-muted-foreground"}),title:s(m?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:m?s("settings.skills.noResultsDescription",{search:m}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(ee,{children:P.map(i=>{const n=i.id===w;return t.jsx(Xe,{entry:i,pending:n,onOpen:()=>K(i),onDelete:B(i)&&!n?()=>N(i):void 0},i.id)})})})]})})}),u&&t.jsx(ze,{skillPath:u,onClose:()=>f(null)},u),t.jsx(Ce,{open:b!==null,onOpenChange:i=>!i&&N(null),children:t.jsxs(De,{children:[t.jsxs(Ne,{children:[t.jsx(Pe,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(Ae,{children:s("settings.skills.deleteDialogDescription",{name:b?.name??""})})]}),t.jsxs(Ee,{children:[t.jsx(Te,{children:s("settings.skills.cancel")}),t.jsx(Me,{onClick:ne,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{Et as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as A,l as _,j as y}from"./index-
|
|
1
|
+
import{c as A,l as _,j as y}from"./index-CaH7O3hJ.js";import{T as N,R,a as T,b as k}from"./index-DPulqOQn.js";function E(p){const e=A.c(34);let o,t,r,l,n,m,h,a;e[0]!==p?({className:o,defaultValue:t,value:a,min:m,max:h,onPointerDown:l,onKeyDown:r,...n}=p,e[0]=p,e[1]=o,e[2]=t,e[3]=r,e[4]=l,e[5]=n,e[6]=m,e[7]=h,e[8]=a):(o=e[1],t=e[2],r=e[3],l=e[4],n=e[5],m=e[6],h=e[7],a=e[8]);const i=m===void 0?0:m,s=h===void 0?100:h;let g;e[9]!==t||e[10]!==s||e[11]!==i||e[12]!==a?(g=Array.isArray(a)?a:Array.isArray(t)?t:[i,s],e[9]=t,e[10]=s,e[11]=i,e[12]=a,e[13]=g):g=e[13];const j=g;let c;e[14]!==o?(c=_("relative flex w-full touch-none items-center py-2 select-none data-[disabled]:opacity-50 data-[orientation=vertical]:px-2 data-[orientation=vertical]:py-0 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",o),e[14]=o,e[15]=c):c=e[15];let d;e[16]!==l?(d=v=>{v.currentTarget.dataset.pointer="",l?.(v)},e[16]=l,e[17]=d):d=e[17];let u;e[18]!==r?(u=v=>{delete v.currentTarget.dataset.pointer,r?.(v)},e[18]=r,e[19]=u):u=e[19];let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=_("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1"),e[20]=b):b=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=y.jsx(N,{"data-slot":"slider-track",className:b,children:y.jsx(R,{"data-slot":"slider-range",className:_("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),e[21]=w):w=e[21];let f;e[22]!==j.length?(f=Array.from({length:j.length},z),e[22]=j.length,e[23]=f):f=e[23];let x;return e[24]!==t||e[25]!==s||e[26]!==i||e[27]!==n||e[28]!==c||e[29]!==d||e[30]!==u||e[31]!==f||e[32]!==a?(x=y.jsxs(T,{"data-slot":"slider",defaultValue:t,value:a,min:i,max:s,className:c,...n,onPointerDown:d,onKeyDown:u,children:[w,f]}),e[24]=t,e[25]=s,e[26]=i,e[27]=n,e[28]=c,e[29]=d,e[30]=u,e[31]=f,e[32]=a,e[33]=x):x=e[33],x}function z(p,e){return y.jsx(k,{"data-slot":"slider-thumb",className:"relative block size-4 shrink-0 cursor-grab rounded-full bg-white shadow-edge transition-transform duration-150 after:absolute after:-inset-3 after:rounded-full after:content-[''] hover:scale-110 focus-ring in-data-pointer:outline-none! active:scale-110 active:cursor-grabbing disabled:pointer-events-none motion-reduce:transition-none"},e)}export{E as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,e2 as K}from"./index-
|
|
1
|
+
import{r as v,e2 as K}from"./index-CaH7O3hJ.js";import{d as de,e as fe,f as U,g as ge,h as pe,i as be,j as ve,C as Y,k as he,l as y,m as me,n as xe,o as Ie,s as ye}from"./core.esm-DNra8pgf.js";function q(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Re(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function O(e){return e!==null&&e>=0}function Ce(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function we(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=q(t,r,n),o=t[s],c=a[s];return!c||!o?null:{x:c.left-o.left,y:c.top-o.top,scaleX:c.width/o.width,scaleY:c.height/o.height}},L={scaleX:1,scaleY:1},Xe=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:o}=e;const c=(t=a[n])!=null?t:r;if(!c)return null;if(s===n){const u=a[o];return u?{x:0,y:n<o?u.top+u.height-(c.top+c.height):u.top-c.top,...L}:null}const f=De(a,s,n);return s>n&&s<=o?{x:0,y:-c.height-f,...L}:s<n&&s>=o?{x:0,y:c.height+f,...L}:{x:0,y:0,...L}};function De(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const H="Sortable",V=K.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function _e(e){let{children:t,id:n,items:r,strategy:s=B,disabled:a=!1}=e;const{active:o,dragOverlay:c,droppableRects:f,over:u,measureDroppableContainers:i}=de(),l=fe(H,n),d=c.rect!==null,g=v.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),R=o!=null,C=o?g.indexOf(o.id):-1,h=u?g.indexOf(u.id):-1,w=v.useRef(g),x=!Ce(g,w.current),m=h!==-1&&C===-1||x,b=we(a);U(()=>{x&&R&&i(g)},[x,g,R,i]),v.useEffect(()=>{w.current=g},[g]);const D=v.useMemo(()=>({activeIndex:C,containerId:l,disabled:b,disableTransforms:m,items:g,overIndex:h,useDragOverlay:d,sortedRects:Re(g,f),strategy:s}),[C,l,b.draggable,b.droppable,m,g,h,f,d,s]);return K.createElement(V.Provider,{value:D},t)}const Se=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return q(n,r,s).indexOf(t)},Ae=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:o,previousItems:c,previousContainerId:f,transition:u}=e;return!u||!r||c!==a&&s===o?!1:n?!0:o!==s&&t===f},Te={duration:200,easing:"ease"},J="transform",Ee=Y.Transition.toString({property:J,duration:0,easing:"linear"}),Ne={roleDescription:"sortable"};function Oe(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,o]=v.useState(null),c=v.useRef(n);return U(()=>{if(!t&&n!==c.current&&r.current){const f=s.current;if(f){const u=he(r.current,{ignoreTransform:!0}),i={x:f.left-u.left,y:f.top-u.top,scaleX:f.width/u.width,scaleY:f.height/u.height};(i.x||i.y)&&o(i)}}n!==c.current&&(c.current=n)},[t,n,r,s]),v.useEffect(()=>{a&&o(null)},[a]),a}function je(e){let{animateLayoutChanges:t=Ae,attributes:n,disabled:r,data:s,getNewIndex:a=Se,id:o,strategy:c,resizeObserverConfig:f,transition:u=Te}=e;const{items:i,containerId:l,activeIndex:d,disabled:g,disableTransforms:R,sortedRects:C,overIndex:h,useDragOverlay:w,strategy:x}=v.useContext(V),m=Le(r,g),b=i.indexOf(o),D=v.useMemo(()=>({sortable:{containerId:l,index:b,items:i},...s}),[l,s,b,i]),I=v.useMemo(()=>i.slice(i.indexOf(o)),[i,o]),{rect:N,node:z,isOver:W,setNodeRef:P}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:X,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(P,X),S=!!T,_=S&&!R&&O(d)&&O(h),j=!w&&M,F=j&&_?oe:null,ie=_?F??(c??x)({rects:C,activeNodeRect:ee,activeIndex:d,overIndex:h,index:b}):null,E=O(d)&&O(h)?a({id:o,items:i,activeIndex:d,overIndex:h}):b,A=T?.id,p=v.useRef({activeId:A,items:i,newIndex:E,containerId:l}),ce=i!==p.current.items,G=t({active:T,containerId:l,isDragging:M,isSorting:S,id:o,index:b,items:i,newIndex:p.current.newIndex,previousItems:p.current.items,previousContainerId:p.current.containerId,transition:u,wasDragging:p.current.activeId!=null}),$=Oe({disabled:!G,index:b,node:z,rect:N});return v.useEffect(()=>{S&&p.current.newIndex!==E&&(p.current.newIndex=E),l!==p.current.containerId&&(p.current.containerId=l),i!==p.current.items&&(p.current.items=i)},[S,E,l,i]),v.useEffect(()=>{if(A===p.current.activeId)return;if(A!=null&&p.current.activeId==null){p.current.activeId=A;return}const ue=setTimeout(()=>{p.current.activeId=A},50);return()=>clearTimeout(ue)},[A]),{active:T,activeIndex:d,attributes:te,data:D,rect:N,index:b,newIndex:E,items:i,isOver:W,isSorting:S,isDragging:M,listeners:re,node:z,overIndex:h,over:ne,setNodeRef:ae,setActivatorNodeRef:se,setDroppableNodeRef:P,setDraggableNodeRef:X,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(j&&!ve(Z)||!u)&&(S||G))return Y.Transition.toString({...u,property:J})}}function Le(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function k(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ke=[y.Down,y.Right,y.Up,y.Left],Fe=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:a,over:o,scrollableAncestors:c}}=t;if(ke.includes(e.code)){if(e.preventDefault(),!n||!r)return;const f=[];a.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const d=s.get(l.id);if(d)switch(e.code){case y.Down:r.top<d.top&&f.push(l);break;case y.Up:r.top>d.top&&f.push(l);break;case y.Left:r.left>d.left&&f.push(l);break;case y.Right:r.left<d.left&&f.push(l);break}});const u=me({collisionRect:r,droppableRects:s,droppableContainers:f});let i=xe(u,"id");if(i===o?.id&&u.length>1&&(i=u[1].id),i!=null){const l=a.get(n.id),d=a.get(i),g=d?s.get(d.id):null,R=d?.node.current;if(R&&g&&l&&d){const h=Ie(R).some((I,N)=>c[N]!==I),w=Q(l,d),x=Me(l,d),m=h||!w?{x:0,y:0}:{x:x?r.width-g.width:0,y:x?r.height-g.height:0},b={x:g.left,y:g.top};return m.x&&m.y?b:ye(b,m)}}}};function Q(e,t){return!k(e)||!k(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Me(e,t){return!k(e)||!k(t)||!Q(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{_e as S,q as a,B as r,Fe as s,je as u,Xe as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as N,a2 as B,r as v,j as e,n as x,fL as k,er as y,es as E,et as a,g9 as D,B as u,I as d,y as C,t as c,c as z}from"./index-
|
|
1
|
+
import{b as N,a2 as B,r as v,j as e,n as x,fL as k,er as y,es as E,et as a,g9 as D,B as u,I as d,y as C,t as c,c as z}from"./index-CaH7O3hJ.js";import{D as T}from"./domain-settings-CpxFWOzU.js";import{f as O,e as R,b as F,A as q,d as M,c as U,g as $}from"./alert-dialog-CKDHmJ-l.js";import{S as H}from"./switch-DYA2xfHU.js";import{a as G,b as J,c as K,d as Q}from"./use-org-sso-LC63-uuA.js";import{s as V}from"./Trash01-D92WhXf2.js";import{R as W}from"./require-capability-D4hkdMxt.js";import"./badge-Cnnepvq1.js";import"./select-CSQbGY9x.js";import"./index-BdQq_4o_.js";import"./index-C9OgV5Vt.js";import"./ChevronUp-C8mqlnDX.js";import"./access-gate-BjUA5Gw_.js";import"./capability-load-error-DdN4o47w.js";function X(){const s=N(),{org:o}=B(),{data:h,isLoading:I}=G(o.id,o.slug),f=J(o.id,o.slug),S=K(o.id,o.slug),b=Q(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[g,p]=v.useState(!1),[P,j]=v.useState(!1),m=h?.configured&&h.config,n=h?.config,_=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},w=async()=>{if(!i.issuer||!i.clientId||!i.domain){c.error(s("settings.orgSso.requiredFieldsError"));return}if(!m&&!i.clientSecret){c.error(s("settings.orgSso.clientSecretRequiredError"));return}try{await f.mutateAsync({issuer:i.issuer,clientId:i.clientId,clientSecret:i.clientSecret,discoveryEndpoint:i.discoveryEndpoint||void 0,scopes:i.scopes.split(/\s+/).filter(Boolean),domain:i.domain,enforced:n?.enforced??!1}),C(m?"sso_config_updated":"sso_configured",{organization_id:o.id,email_domain:i.domain}),c.success(s("settings.orgSso.configurationSavedSuccess")),p(!1)}catch(t){c.error(t instanceof Error?t.message:s("settings.orgSso.saveSsoConfigError"))}},A=async()=>{try{await S.mutateAsync(),C("sso_config_removed",{organization_id:o.id}),c.success(s("settings.orgSso.configurationRemovedSuccess")),p(!1),j(!1)}catch{c.error(s("settings.orgSso.removeSsoConfigError"))}},L=async t=>{try{await b.mutateAsync(t),C("sso_enforcement_toggled",{organization_id:o.id,enforced:t}),c.success(s(t?"settings.orgSso.enforcementEnabledSuccess":"settings.orgSso.enforcementDisabledSuccess"))}catch{c.error(s("settings.orgSso.toggleEnforcementError"))}};return e.jsxs(x,{children:[e.jsx(x.Content,{children:e.jsx(x.Container,{children:e.jsxs(k,{children:[e.jsx(x.Title,{children:s("settings.orgSso.securityTitle")}),e.jsx(T,{}),I?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[m&&!g&&e.jsx(y,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(E,{children:[e.jsx(a,{title:s("settings.orgSso.providerLabel"),action:e.jsx("span",{className:"font-medium",children:n.issuer})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.clientId})}),e.jsx(a,{title:s("settings.orgSso.domainLabel"),action:e.jsx("span",{className:"font-medium",children:n.domain})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(a,{title:s("settings.orgSso.enforceSsoLabel"),description:s("settings.orgSso.enforceSsoDescription"),action:e.jsx(H,{checked:n.enforced,onCheckedChange:L,disabled:b.isPending})}),e.jsxs(D,{children:[e.jsxs(u,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(V,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(u,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(u,{variant:"outline",size:"sm",onClick:_,children:s("settings.orgSso.editConfigButton")})]})]})}),(!m||g)&&e.jsx(y,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(E,{children:[e.jsx(a,{title:s("settings.orgSso.issuerUrlLabel"),description:s("settings.orgSso.issuerUrlDescription"),action:e.jsx(d,{id:"sso-issuer",placeholder:s("settings.orgSso.issuerUrlPlaceholder"),value:i.issuer,onChange:t=>l(r=>({...r,issuer:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx(d,{id:"sso-client-id",placeholder:s("settings.orgSso.clientIdPlaceholder"),value:i.clientId,onChange:t=>l(r=>({...r,clientId:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientSecretLabel"),description:g&&m?s("settings.orgSso.clientSecretEditDescription"):void 0,action:e.jsx(d,{id:"sso-client-secret",type:"password",placeholder:s("settings.orgSso.clientSecretPlaceholder"),value:i.clientSecret,onChange:t=>l(r=>({...r,clientSecret:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.emailDomainLabel"),description:s("settings.orgSso.emailDomainDescription"),action:e.jsx(d,{id:"sso-domain",placeholder:s("settings.orgSso.emailDomainPlaceholder"),value:i.domain,onChange:t=>l(r=>({...r,domain:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx(d,{id:"sso-scopes",placeholder:s("settings.orgSso.scopesPlaceholder"),value:i.scopes,onChange:t=>l(r=>({...r,scopes:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.discoveryEndpointLabel"),description:s("settings.orgSso.discoveryEndpointDescription"),action:e.jsx(d,{id:"sso-discovery",placeholder:s("settings.orgSso.discoveryEndpointPlaceholder"),value:i.discoveryEndpoint,onChange:t=>l(r=>({...r,discoveryEndpoint:t.target.value})),className:"w-[280px]"})}),e.jsxs(D,{children:[g&&e.jsx(u,{variant:"outline",size:"sm",onClick:()=>p(!1),children:s("settings.orgSso.cancelButton")}),e.jsx(u,{onClick:w,disabled:f.isPending,size:"sm",children:f.isPending?s("settings.orgSso.savingButton"):s(g?"settings.orgSso.updateButton":"settings.orgSso.configureSsoButton")})]})]})})]})]})})}),e.jsx(O,{open:P,onOpenChange:j,children:e.jsxs(R,{children:[e.jsx(F,{children:e.jsx(q,{children:s("settings.orgSso.removeConfirmation")})}),e.jsxs(M,{children:[e.jsx(U,{disabled:S.isPending,children:s("settings.orgSso.cancelButton")}),e.jsx($,{onClick:A,disabled:S.isPending,variant:"destructive",children:s("settings.orgSso.removeButton")})]})]})})]})}function me(){const s=z.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(W,{capability:"org:manage",area:"security",children:e.jsx(X,{})}),s[0]=o):o=s[0],o}export{me as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as Ye,n as ie,o as Qe,D as Ge,v as ze,w as Ze}from"./usage-stats-DcyLnEOC.js";import{r as p,eH as Je,eI as we,eJ as et,eK as j,eL as te,j as I,b5 as tt,eM as nt,eN as ne,eO as ot,eP as rt,eQ as st,eR as it,eS as at,eT as lt,eU as Ce,eV as ct,c as H,R as ut,K as dt,eW as ft,eX as gt,eY as mt,b as pt,l as vt,h as ht}from"./index-DcU2uHG-.js";import{g as bt,d as xt}from"./tool-namespace-FeAXQzXg.js";import{A as yt}from"./agent-icon-c0hRUHIU.js";var Hn=Ye;var Rt=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ae=Rt.join(","),Ie=typeof Element>"u",G=Ie?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,J=!Ie&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n?.ownerDocument},ee=function(e,t){var o;t===void 0&&(t=!0);var r=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),s=r===""||r==="true",i=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ee(e.parentNode));return i},St=function(e){var t,o=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return o===""||o==="true"},Et=function(e,t,o){if(ee(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ae));return t&&G.call(e,ae)&&r.unshift(e),r=r.filter(o),r},le=function(e,t,o){for(var r=[],s=Array.from(e);s.length;){var i=s.shift();if(!ee(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=le(l,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:i,candidates:c})}else{var d=G.call(i,ae);d&&o.filter(i)&&(t||!e.includes(i))&&r.push(i);var u=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),g=!ee(u,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(u&&g){var h=le(u===!0?i.children:u.children,!0,o);o.flatten?r.push.apply(r,h):r.push({scopeParent:i,candidates:h})}else s.unshift.apply(s,i.children)}}return r},Te=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Pe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||St(e))&&!Te(e)?0:e.tabIndex},wt=function(e,t){var o=Pe(e);return o<0&&t&&!Te(e)?0:o},Ct=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ae=function(e){return e.tagName==="INPUT"},It=function(e){return Ae(e)&&e.type==="hidden"},Tt=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return t},Pt=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]},At=function(e){if(!e.name)return!0;var t=e.form||J(e),o=function(a){return t.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(e.name));else try{r=o(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Pt(r,e.form);return!s||s===e},Nt=function(e){return Ae(e)&&e.type==="radio"},Dt=function(e){return Nt(e)&&!At(e)},Mt=function(e){var t,o=e&&J(e),r=(t=o)===null||t===void 0?void 0:t.host,s=!1;if(o&&o!==e){var i,a,l;for(s=!!((i=r)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(r)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&r;){var c,d,u;o=J(r),r=(c=o)===null||c===void 0?void 0:c.host,s=!!((d=r)!==null&&d!==void 0&&(u=d.ownerDocument)!==null&&u!==void 0&&u.contains(r))}}return s},ge=function(e){var t=e.getBoundingClientRect(),o=t.width,r=t.height;return o===0&&r===0},Ot=function(e,t){var o=t.displayCheck,r=t.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var i=G.call(e,"details>summary:first-of-type"),a=i?e.parentElement:e;if(G.call(a,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var l=e;e;){var c=e.parentElement,d=J(e);if(c&&!c.shadowRoot&&r(c)===!0)return ge(e);e.assignedSlot?e=e.assignedSlot:!c&&d!==e.ownerDocument?e=d.host:e=c}e=l}if(Mt(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return ge(e);return!1},Ft=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var o=0;o<t.children.length;o++){var r=t.children.item(o);if(r.tagName==="LEGEND")return G.call(t,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},qt=function(e,t){return!(t.disabled||It(t)||Ot(t,e)||Tt(t)||Ft(t))},me=function(e,t){return!(Dt(t)||Pe(t)<0||!qt(e,t))},$t=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ne=function(e){var t=[],o=[];return e.forEach(function(r,s){var i=!!r.scopeParent,a=i?r.scopeParent:r,l=wt(a,i),c=i?Ne(r.candidates):a;l===0?i?t.push.apply(t,c):t.push(a):o.push({documentOrder:s,tabIndex:l,item:r,isScope:i,content:c})}),o.sort(Ct).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(t)},De=function(e,t){t=t||{};var o;return t.getShadowRoot?o=le([e],t.includeContainer,{filter:me.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:$t}):o=Et(e,t.includeContainer,me.bind(null,t)),Ne(o)};function kt(){return/apple/i.test(navigator.vendor)}const pe="data-floating-ui-focusable";function _t(n){let e=n.activeElement;for(;((t=e)==null||(t=t.shadowRoot)==null?void 0:t.activeElement)!=null;){var t;e=e.shadowRoot.activeElement}return e}function ce(n,e){if(!n||!e)return!1;const t=e.getRootNode==null?void 0:e.getRootNode();if(n.contains(e))return!0;if(t&&Je(t)){let o=e;for(;o;){if(n===o)return!0;o=o.parentNode||o.host}}return!1}function Q(n){return"composedPath"in n?n.composedPath()[0]:n.target}function oe(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function Lt(n){return n.matches("html,body")}function z(n){return n?.ownerDocument||document}function jt(n){return n?n.hasAttribute(pe)?n:n.querySelector("["+pe+"]")||n:null}function Z(n,e,t){return t===void 0&&(t=!0),n.filter(r=>{var s;return r.parentId===e&&(!t||((s=r.context)==null?void 0:s.open))}).flatMap(r=>[r,...Z(n,r.id,t)])}function Kt(n){return"nativeEvent"in n}var Bt=typeof document<"u",Ut=function(){},V=Bt?p.useLayoutEffect:Ut;const Vt={...we},Wt=Vt.useInsertionEffect,Ht=Wt||(n=>n());function W(n){const e=p.useRef(()=>{});return Ht(()=>{e.current=n}),p.useCallback(function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return e.current==null?void 0:e.current(...o)},[])}const Me=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Oe(n,e){const t=De(n,Me()),o=t.length;if(o===0)return;const r=_t(z(n)),s=t.indexOf(r),i=s===-1?e===1?0:o-1:s+e;return t[i]}function Xt(n){return Oe(z(n).body,1)||n}function Yt(n){return Oe(z(n).body,-1)||n}function re(n,e){const t=e||n.currentTarget,o=n.relatedTarget;return!o||!ce(t,o)}function Qt(n){De(n,Me()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function ve(n){n.querySelectorAll("[data-tabindex]").forEach(t=>{const o=t.dataset.tabindex;delete t.dataset.tabindex,o?t.setAttribute("tabindex",o):t.removeAttribute("tabindex")})}const Gt="data-floating-ui-focusable",he="active",be="selected",zt={...we};let xe=!1,Zt=0;const ye=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Zt++;function Jt(){const[n,e]=p.useState(()=>xe?ye():void 0);return V(()=>{n==null&&e(ye())},[]),p.useEffect(()=>{xe=!0},[]),n}const en=zt.useId,ue=en||Jt;function tn(){const n=new Map;return{emit(e,t){var o;(o=n.get(e))==null||o.forEach(r=>r(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var o;(o=n.get(e))==null||o.delete(t)}}}const nn=p.createContext(null),on=p.createContext(null),Fe=()=>{var n;return((n=p.useContext(nn))==null?void 0:n.id)||null},qe=()=>p.useContext(on);function de(n){return"data-floating-ui-"+n}const rn={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Re=p.forwardRef(function(e,t){const[o,r]=p.useState();V(()=>{kt()&&r("button")},[]);const s={ref:t,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[de("focus-guard")]:"",style:rn};return I.jsx("span",{...e,...s})}),sn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},$e=p.createContext(null),Se=de("portal");function an(n){n===void 0&&(n={});const{id:e,root:t}=n,o=ue(),r=cn(),[s,i]=p.useState(null),a=p.useRef(null);return V(()=>()=>{s?.remove(),queueMicrotask(()=>{a.current=null})},[s]),V(()=>{if(!o||a.current)return;const l=e?document.getElementById(e):null;if(!l)return;const c=document.createElement("div");c.id=o,c.setAttribute(Se,""),l.appendChild(c),a.current=c,i(c)},[e,o]),V(()=>{if(t===null||!o||a.current)return;let l=t||r?.portalNode;l&&!it(l)&&(l=l.current),l=l||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,l.appendChild(c));const d=document.createElement("div");d.id=o,d.setAttribute(Se,""),l=c||l,l.appendChild(d),a.current=d,i(d)},[e,t,o,r]),s}function ln(n){const{children:e,id:t,root:o,preserveTabOrder:r=!0}=n,s=an({id:t,root:o}),[i,a]=p.useState(null),l=p.useRef(null),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),g=i?.modal,h=i?.open,y=!!i&&!i.modal&&i.open&&r&&!!(o||s);return p.useEffect(()=>{if(!s||!r||g)return;function m(f){s&&re(f)&&(f.type==="focusin"?ve:Qt)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,r,g]),p.useEffect(()=>{s&&(h||ve(s))},[h,s]),I.jsxs($e.Provider,{value:p.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:u,portalNode:s,setFocusManagerState:a}),[r,s]),children:[y&&s&&I.jsx(Re,{"data-type":"outside",ref:l,onFocus:m=>{if(re(m,s)){var f;(f=d.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Yt(x);b?.focus()}}}),y&&s&&I.jsx("span",{"aria-owns":s.id,style:sn}),s&&tt.createPortal(e,s),y&&s&&I.jsx(Re,{"data-type":"outside",ref:c,onFocus:m=>{if(re(m,s)){var f;(f=u.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Xt(x);b?.focus(),i?.closeOnFocusOut&&i?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const cn=()=>p.useContext($e),un={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ee=n=>{var e,t;return{escapeKey:typeof n=="boolean"?n:(e=n?.escapeKey)!=null?e:!1,outsidePress:typeof n=="boolean"?n:(t=n?.outsidePress)!=null?t:!0}};function fn(n,e){e===void 0&&(e={});const{open:t,onOpenChange:o,elements:r,dataRef:s}=n,{enabled:i=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:d=!1,referencePressEvent:u="pointerdown",ancestorScroll:g=!1,bubbles:h,capture:y}=e,m=qe(),f=W(typeof l=="function"?l:()=>!1),x=typeof l=="function"?f:l,b=p.useRef(!1),{escapeKey:R,outsidePress:v}=Ee(h),{escapeKey:D,outsidePress:C}=Ee(y),O=p.useRef(!1),A=W(S=>{var E;if(!t||!i||!a||S.key!=="Escape"||O.current)return;const P=(E=s.current.floatingContext)==null?void 0:E.nodeId,M=m?Z(m.nodesRef.current,P):[];if(!R&&(S.stopPropagation(),M.length>0)){let w=!0;if(M.forEach(N=>{var q;if((q=N.context)!=null&&q.open&&!N.context.dataRef.current.__escapeKeyBubbles){w=!1;return}}),!w)return}o(!1,Kt(S)?S.nativeEvent:S,"escape-key")}),F=W(S=>{var E;const P=()=>{var M;A(S),(M=Q(S))==null||M.removeEventListener("keydown",P)};(E=Q(S))==null||E.addEventListener("keydown",P)}),T=W(S=>{var E;const P=s.current.insideReactTree;s.current.insideReactTree=!1;const M=b.current;if(b.current=!1,c==="click"&&M||P||typeof x=="function"&&!x(S))return;const w=Q(S),N="["+de("inert")+"]",q=z(r.floating).querySelectorAll(N);let L=j(w)?w:null;for(;L&&!ne(L);){const k=ot(L);if(ne(k)||!j(k))break;L=k}if(q.length&&j(w)&&!Lt(w)&&!ce(w,r.floating)&&Array.from(q).every(k=>!ce(L,k)))return;if(rt(w)&&K){const k=ne(w),B=st(w),Y=/auto|scroll/,Ke=k||Y.test(B.overflowX),Be=k||Y.test(B.overflowY),Ue=Ke&&w.clientWidth>0&&w.scrollWidth>w.clientWidth,Ve=Be&&w.clientHeight>0&&w.scrollHeight>w.clientHeight,We=B.direction==="rtl",He=Ve&&(We?S.offsetX<=w.offsetWidth-w.clientWidth:S.offsetX>w.clientWidth),Xe=Ue&&S.offsetY>w.clientHeight;if(He||Xe)return}const U=(E=s.current.floatingContext)==null?void 0:E.nodeId,X=m&&Z(m.nodesRef.current,U).some(k=>{var B;return oe(S,(B=k.context)==null?void 0:B.elements.floating)});if(oe(S,r.floating)||oe(S,r.domReference)||X)return;const fe=m?Z(m.nodesRef.current,U):[];if(fe.length>0){let k=!0;if(fe.forEach(B=>{var Y;if((Y=B.context)!=null&&Y.open&&!B.context.dataRef.current.__outsidePressBubbles){k=!1;return}}),!k)return}o(!1,S,"outside-press")}),$=W(S=>{var E;const P=()=>{var M;T(S),(M=Q(S))==null||M.removeEventListener(c,P)};(E=Q(S))==null||E.addEventListener(c,P)});p.useEffect(()=>{if(!t||!i)return;s.current.__escapeKeyBubbles=R,s.current.__outsidePressBubbles=v;let S=-1;function E(q){o(!1,q,"ancestor-scroll")}function P(){window.clearTimeout(S),O.current=!0}function M(){S=window.setTimeout(()=>{O.current=!1},nt()?5:0)}const w=z(r.floating);a&&(w.addEventListener("keydown",D?F:A,D),w.addEventListener("compositionstart",P),w.addEventListener("compositionend",M)),x&&w.addEventListener(c,C?$:T,C);let N=[];return g&&(j(r.domReference)&&(N=te(r.domReference)),j(r.floating)&&(N=N.concat(te(r.floating))),!j(r.reference)&&r.reference&&r.reference.contextElement&&(N=N.concat(te(r.reference.contextElement)))),N=N.filter(q=>{var L;return q!==((L=w.defaultView)==null?void 0:L.visualViewport)}),N.forEach(q=>{q.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(w.removeEventListener("keydown",D?F:A,D),w.removeEventListener("compositionstart",P),w.removeEventListener("compositionend",M)),x&&w.removeEventListener(c,C?$:T,C),N.forEach(q=>{q.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,r,a,x,c,t,o,g,i,R,v,A,D,F,T,C,$]),p.useEffect(()=>{s.current.insideReactTree=!1},[s,x,c]);const _=p.useMemo(()=>({onKeyDown:A,...d&&{[un[u]]:S=>{o(!1,S.nativeEvent,"reference-press")},...u!=="click"&&{onClick(S){o(!1,S.nativeEvent,"reference-press")}}}}),[A,o,d,u]),K=p.useMemo(()=>{function S(E){E.button===0&&(b.current=!0)}return{onKeyDown:A,onMouseDown:S,onMouseUp:S,[dn[c]]:()=>{s.current.insideReactTree=!0}}},[A,c,s]);return p.useMemo(()=>i?{reference:_,floating:K}:{},[i,_,K])}function gn(n){const{open:e=!1,onOpenChange:t,elements:o}=n,r=ue(),s=p.useRef({}),[i]=p.useState(()=>tn()),a=Fe()!=null,[l,c]=p.useState(o.reference),d=W((h,y,m)=>{s.current.openEvent=h?y:void 0,i.emit("openchange",{open:h,event:y,reason:m,nested:a}),t?.(h,y,m)}),u=p.useMemo(()=>({setPositionReference:c}),[]),g=p.useMemo(()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference}),[l,o.reference,o.floating]);return p.useMemo(()=>({dataRef:s,open:e,onOpenChange:d,elements:g,events:i,floatingId:r,refs:u}),[e,d,g,i,r,u])}function mn(n){n===void 0&&(n={});const{nodeId:e}=n,t=gn({...n,elements:{reference:null,floating:null,...n.elements}}),o=n.rootContext||t,r=o.elements,[s,i]=p.useState(null),[a,l]=p.useState(null),d=r?.domReference||s,u=p.useRef(null),g=qe();V(()=>{d&&(u.current=d)},[d]);const h=et({...n,elements:{...r,...a&&{reference:a}}}),y=p.useCallback(R=>{const v=j(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;l(v),h.refs.setReference(v)},[h.refs]),m=p.useCallback(R=>{(j(R)||R===null)&&(u.current=R,i(R)),(j(h.refs.reference.current)||h.refs.reference.current===null||R!==null&&!j(R))&&h.refs.setReference(R)},[h.refs]),f=p.useMemo(()=>({...h.refs,setReference:m,setPositionReference:y,domReference:u}),[h.refs,m,y]),x=p.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=p.useMemo(()=>({...h,...o,refs:f,elements:x,nodeId:e}),[h,f,x,e,o]);return V(()=>{o.dataRef.current.floatingContext=b;const R=g?.nodesRef.current.find(v=>v.id===e);R&&(R.context=b)}),p.useMemo(()=>({...h,context:b,refs:f,elements:x}),[h,f,x,b])}function se(n,e,t){const o=new Map,r=t==="item";let s=n;if(r&&n){const{[he]:i,[be]:a,...l}=n;s=l}return{...t==="floating"&&{tabIndex:-1,[Gt]:""},...s,...e.map(i=>{const a=i?i[t]:null;return typeof a=="function"?n?a(n):null:a}).concat(n).reduce((i,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(r&&[he,be].includes(c)))if(c.indexOf("on")===0){if(o.has(c)||o.set(c,[]),typeof d=="function"){var u;(u=o.get(c))==null||u.push(d),i[c]=function(){for(var g,h=arguments.length,y=new Array(h),m=0;m<h;m++)y[m]=arguments[m];return(g=o.get(c))==null?void 0:g.map(f=>f(...y)).find(f=>f!==void 0)}}}else i[c]=d}),i),{})}}function pn(n){n===void 0&&(n=[]);const e=n.map(a=>a?.reference),t=n.map(a=>a?.floating),o=n.map(a=>a?.item),r=p.useCallback(a=>se(a,n,"reference"),e),s=p.useCallback(a=>se(a,n,"floating"),t),i=p.useCallback(a=>se(a,n,"item"),o);return p.useMemo(()=>({getReferenceProps:r,getFloatingProps:s,getItemProps:i}),[r,s,i])}const vn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hn(n,e){var t,o;e===void 0&&(e={});const{open:r,elements:s,floatingId:i}=n,{enabled:a=!0,role:l="dialog"}=e,c=ue(),d=((t=s.domReference)==null?void 0:t.id)||c,u=p.useMemo(()=>{var b;return((b=jt(s.floating))==null?void 0:b.id)||i},[s.floating,i]),g=(o=vn.get(l))!=null?o:l,y=Fe()!=null,m=p.useMemo(()=>g==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:r?u:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":g==="alertdialog"?"dialog":g,"aria-controls":r?u:void 0,...g==="listbox"&&{role:"combobox"},...g==="menu"&&{id:d},...g==="menu"&&y&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[g,u,y,r,d,l]),f=p.useMemo(()=>{const b={id:u,...g&&{role:g}};return g==="tooltip"||l==="label"?b:{...b,...g==="menu"&&{"aria-labelledby":d}}},[g,u,d,l]),x=p.useCallback(b=>{let{active:R,selected:v}=b;const D={role:"option",...R&&{id:u+"-fui-option"}};switch(l){case"select":case"combobox":return{...D,"aria-selected":v}}return{}},[u,l]);return p.useMemo(()=>a?{reference:m,floating:f,item:x}:{},[a,m,f,x])}function bn(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:a}=n,l=o&&!r,c=Ze(t),d=new RegExp(`\\s${c}$`),u=i?"^":"",g=r?"":c,h=l?new RegExp(`${u}${c}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${g}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const m=a.pos-y.length,f=Array.from(y.matchAll(h)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const x=f.input.slice(Math.max(0,f.index-1),f.index),b=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!b)return null;const R=m+f.index;let v=R+f[0].length;return l&&d.test(y.slice(v-1,v+1))&&(f[0]+=" ",v+=1),R<a.pos&&v>=a.pos?{range:{from:R,to:v},query:f[0].slice(t.length),text:f[0]}:null}function xn(n){return n.docChanged?n.steps.some(e=>{const t=e.slice;if(!t?.content)return!1;const o=t.content.textBetween(0,t.content.size,`
|
|
1
|
+
import{t as Ye,n as ie,o as Qe,D as Ge,v as ze,w as Ze}from"./usage-stats-BkcKNXzu.js";import{r as p,eH as Je,eI as we,eJ as et,eK as j,eL as te,j as I,b5 as tt,eM as nt,eN as ne,eO as ot,eP as rt,eQ as st,eR as it,eS as at,eT as lt,eU as Ce,eV as ct,c as H,R as ut,K as dt,eW as ft,eX as gt,eY as mt,b as pt,l as vt,h as ht}from"./index-CaH7O3hJ.js";import{g as bt,d as xt}from"./tool-namespace-DTl3so75.js";import{A as yt}from"./agent-icon-U4gZaLOQ.js";var Hn=Ye;var Rt=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ae=Rt.join(","),Ie=typeof Element>"u",G=Ie?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,J=!Ie&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n?.ownerDocument},ee=function(e,t){var o;t===void 0&&(t=!0);var r=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),s=r===""||r==="true",i=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ee(e.parentNode));return i},St=function(e){var t,o=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return o===""||o==="true"},Et=function(e,t,o){if(ee(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ae));return t&&G.call(e,ae)&&r.unshift(e),r=r.filter(o),r},le=function(e,t,o){for(var r=[],s=Array.from(e);s.length;){var i=s.shift();if(!ee(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=le(l,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:i,candidates:c})}else{var d=G.call(i,ae);d&&o.filter(i)&&(t||!e.includes(i))&&r.push(i);var u=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),g=!ee(u,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(u&&g){var h=le(u===!0?i.children:u.children,!0,o);o.flatten?r.push.apply(r,h):r.push({scopeParent:i,candidates:h})}else s.unshift.apply(s,i.children)}}return r},Te=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Pe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||St(e))&&!Te(e)?0:e.tabIndex},wt=function(e,t){var o=Pe(e);return o<0&&t&&!Te(e)?0:o},Ct=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ae=function(e){return e.tagName==="INPUT"},It=function(e){return Ae(e)&&e.type==="hidden"},Tt=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return t},Pt=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]},At=function(e){if(!e.name)return!0;var t=e.form||J(e),o=function(a){return t.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(e.name));else try{r=o(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Pt(r,e.form);return!s||s===e},Nt=function(e){return Ae(e)&&e.type==="radio"},Dt=function(e){return Nt(e)&&!At(e)},Mt=function(e){var t,o=e&&J(e),r=(t=o)===null||t===void 0?void 0:t.host,s=!1;if(o&&o!==e){var i,a,l;for(s=!!((i=r)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(r)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&r;){var c,d,u;o=J(r),r=(c=o)===null||c===void 0?void 0:c.host,s=!!((d=r)!==null&&d!==void 0&&(u=d.ownerDocument)!==null&&u!==void 0&&u.contains(r))}}return s},ge=function(e){var t=e.getBoundingClientRect(),o=t.width,r=t.height;return o===0&&r===0},Ot=function(e,t){var o=t.displayCheck,r=t.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var i=G.call(e,"details>summary:first-of-type"),a=i?e.parentElement:e;if(G.call(a,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var l=e;e;){var c=e.parentElement,d=J(e);if(c&&!c.shadowRoot&&r(c)===!0)return ge(e);e.assignedSlot?e=e.assignedSlot:!c&&d!==e.ownerDocument?e=d.host:e=c}e=l}if(Mt(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return ge(e);return!1},Ft=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var o=0;o<t.children.length;o++){var r=t.children.item(o);if(r.tagName==="LEGEND")return G.call(t,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},qt=function(e,t){return!(t.disabled||It(t)||Ot(t,e)||Tt(t)||Ft(t))},me=function(e,t){return!(Dt(t)||Pe(t)<0||!qt(e,t))},$t=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ne=function(e){var t=[],o=[];return e.forEach(function(r,s){var i=!!r.scopeParent,a=i?r.scopeParent:r,l=wt(a,i),c=i?Ne(r.candidates):a;l===0?i?t.push.apply(t,c):t.push(a):o.push({documentOrder:s,tabIndex:l,item:r,isScope:i,content:c})}),o.sort(Ct).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(t)},De=function(e,t){t=t||{};var o;return t.getShadowRoot?o=le([e],t.includeContainer,{filter:me.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:$t}):o=Et(e,t.includeContainer,me.bind(null,t)),Ne(o)};function kt(){return/apple/i.test(navigator.vendor)}const pe="data-floating-ui-focusable";function _t(n){let e=n.activeElement;for(;((t=e)==null||(t=t.shadowRoot)==null?void 0:t.activeElement)!=null;){var t;e=e.shadowRoot.activeElement}return e}function ce(n,e){if(!n||!e)return!1;const t=e.getRootNode==null?void 0:e.getRootNode();if(n.contains(e))return!0;if(t&&Je(t)){let o=e;for(;o;){if(n===o)return!0;o=o.parentNode||o.host}}return!1}function Q(n){return"composedPath"in n?n.composedPath()[0]:n.target}function oe(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function Lt(n){return n.matches("html,body")}function z(n){return n?.ownerDocument||document}function jt(n){return n?n.hasAttribute(pe)?n:n.querySelector("["+pe+"]")||n:null}function Z(n,e,t){return t===void 0&&(t=!0),n.filter(r=>{var s;return r.parentId===e&&(!t||((s=r.context)==null?void 0:s.open))}).flatMap(r=>[r,...Z(n,r.id,t)])}function Kt(n){return"nativeEvent"in n}var Bt=typeof document<"u",Ut=function(){},V=Bt?p.useLayoutEffect:Ut;const Vt={...we},Wt=Vt.useInsertionEffect,Ht=Wt||(n=>n());function W(n){const e=p.useRef(()=>{});return Ht(()=>{e.current=n}),p.useCallback(function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return e.current==null?void 0:e.current(...o)},[])}const Me=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Oe(n,e){const t=De(n,Me()),o=t.length;if(o===0)return;const r=_t(z(n)),s=t.indexOf(r),i=s===-1?e===1?0:o-1:s+e;return t[i]}function Xt(n){return Oe(z(n).body,1)||n}function Yt(n){return Oe(z(n).body,-1)||n}function re(n,e){const t=e||n.currentTarget,o=n.relatedTarget;return!o||!ce(t,o)}function Qt(n){De(n,Me()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function ve(n){n.querySelectorAll("[data-tabindex]").forEach(t=>{const o=t.dataset.tabindex;delete t.dataset.tabindex,o?t.setAttribute("tabindex",o):t.removeAttribute("tabindex")})}const Gt="data-floating-ui-focusable",he="active",be="selected",zt={...we};let xe=!1,Zt=0;const ye=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Zt++;function Jt(){const[n,e]=p.useState(()=>xe?ye():void 0);return V(()=>{n==null&&e(ye())},[]),p.useEffect(()=>{xe=!0},[]),n}const en=zt.useId,ue=en||Jt;function tn(){const n=new Map;return{emit(e,t){var o;(o=n.get(e))==null||o.forEach(r=>r(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var o;(o=n.get(e))==null||o.delete(t)}}}const nn=p.createContext(null),on=p.createContext(null),Fe=()=>{var n;return((n=p.useContext(nn))==null?void 0:n.id)||null},qe=()=>p.useContext(on);function de(n){return"data-floating-ui-"+n}const rn={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Re=p.forwardRef(function(e,t){const[o,r]=p.useState();V(()=>{kt()&&r("button")},[]);const s={ref:t,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[de("focus-guard")]:"",style:rn};return I.jsx("span",{...e,...s})}),sn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},$e=p.createContext(null),Se=de("portal");function an(n){n===void 0&&(n={});const{id:e,root:t}=n,o=ue(),r=cn(),[s,i]=p.useState(null),a=p.useRef(null);return V(()=>()=>{s?.remove(),queueMicrotask(()=>{a.current=null})},[s]),V(()=>{if(!o||a.current)return;const l=e?document.getElementById(e):null;if(!l)return;const c=document.createElement("div");c.id=o,c.setAttribute(Se,""),l.appendChild(c),a.current=c,i(c)},[e,o]),V(()=>{if(t===null||!o||a.current)return;let l=t||r?.portalNode;l&&!it(l)&&(l=l.current),l=l||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,l.appendChild(c));const d=document.createElement("div");d.id=o,d.setAttribute(Se,""),l=c||l,l.appendChild(d),a.current=d,i(d)},[e,t,o,r]),s}function ln(n){const{children:e,id:t,root:o,preserveTabOrder:r=!0}=n,s=an({id:t,root:o}),[i,a]=p.useState(null),l=p.useRef(null),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),g=i?.modal,h=i?.open,y=!!i&&!i.modal&&i.open&&r&&!!(o||s);return p.useEffect(()=>{if(!s||!r||g)return;function m(f){s&&re(f)&&(f.type==="focusin"?ve:Qt)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,r,g]),p.useEffect(()=>{s&&(h||ve(s))},[h,s]),I.jsxs($e.Provider,{value:p.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:u,portalNode:s,setFocusManagerState:a}),[r,s]),children:[y&&s&&I.jsx(Re,{"data-type":"outside",ref:l,onFocus:m=>{if(re(m,s)){var f;(f=d.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Yt(x);b?.focus()}}}),y&&s&&I.jsx("span",{"aria-owns":s.id,style:sn}),s&&tt.createPortal(e,s),y&&s&&I.jsx(Re,{"data-type":"outside",ref:c,onFocus:m=>{if(re(m,s)){var f;(f=u.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Xt(x);b?.focus(),i?.closeOnFocusOut&&i?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const cn=()=>p.useContext($e),un={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ee=n=>{var e,t;return{escapeKey:typeof n=="boolean"?n:(e=n?.escapeKey)!=null?e:!1,outsidePress:typeof n=="boolean"?n:(t=n?.outsidePress)!=null?t:!0}};function fn(n,e){e===void 0&&(e={});const{open:t,onOpenChange:o,elements:r,dataRef:s}=n,{enabled:i=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:d=!1,referencePressEvent:u="pointerdown",ancestorScroll:g=!1,bubbles:h,capture:y}=e,m=qe(),f=W(typeof l=="function"?l:()=>!1),x=typeof l=="function"?f:l,b=p.useRef(!1),{escapeKey:R,outsidePress:v}=Ee(h),{escapeKey:D,outsidePress:C}=Ee(y),O=p.useRef(!1),A=W(S=>{var E;if(!t||!i||!a||S.key!=="Escape"||O.current)return;const P=(E=s.current.floatingContext)==null?void 0:E.nodeId,M=m?Z(m.nodesRef.current,P):[];if(!R&&(S.stopPropagation(),M.length>0)){let w=!0;if(M.forEach(N=>{var q;if((q=N.context)!=null&&q.open&&!N.context.dataRef.current.__escapeKeyBubbles){w=!1;return}}),!w)return}o(!1,Kt(S)?S.nativeEvent:S,"escape-key")}),F=W(S=>{var E;const P=()=>{var M;A(S),(M=Q(S))==null||M.removeEventListener("keydown",P)};(E=Q(S))==null||E.addEventListener("keydown",P)}),T=W(S=>{var E;const P=s.current.insideReactTree;s.current.insideReactTree=!1;const M=b.current;if(b.current=!1,c==="click"&&M||P||typeof x=="function"&&!x(S))return;const w=Q(S),N="["+de("inert")+"]",q=z(r.floating).querySelectorAll(N);let L=j(w)?w:null;for(;L&&!ne(L);){const k=ot(L);if(ne(k)||!j(k))break;L=k}if(q.length&&j(w)&&!Lt(w)&&!ce(w,r.floating)&&Array.from(q).every(k=>!ce(L,k)))return;if(rt(w)&&K){const k=ne(w),B=st(w),Y=/auto|scroll/,Ke=k||Y.test(B.overflowX),Be=k||Y.test(B.overflowY),Ue=Ke&&w.clientWidth>0&&w.scrollWidth>w.clientWidth,Ve=Be&&w.clientHeight>0&&w.scrollHeight>w.clientHeight,We=B.direction==="rtl",He=Ve&&(We?S.offsetX<=w.offsetWidth-w.clientWidth:S.offsetX>w.clientWidth),Xe=Ue&&S.offsetY>w.clientHeight;if(He||Xe)return}const U=(E=s.current.floatingContext)==null?void 0:E.nodeId,X=m&&Z(m.nodesRef.current,U).some(k=>{var B;return oe(S,(B=k.context)==null?void 0:B.elements.floating)});if(oe(S,r.floating)||oe(S,r.domReference)||X)return;const fe=m?Z(m.nodesRef.current,U):[];if(fe.length>0){let k=!0;if(fe.forEach(B=>{var Y;if((Y=B.context)!=null&&Y.open&&!B.context.dataRef.current.__outsidePressBubbles){k=!1;return}}),!k)return}o(!1,S,"outside-press")}),$=W(S=>{var E;const P=()=>{var M;T(S),(M=Q(S))==null||M.removeEventListener(c,P)};(E=Q(S))==null||E.addEventListener(c,P)});p.useEffect(()=>{if(!t||!i)return;s.current.__escapeKeyBubbles=R,s.current.__outsidePressBubbles=v;let S=-1;function E(q){o(!1,q,"ancestor-scroll")}function P(){window.clearTimeout(S),O.current=!0}function M(){S=window.setTimeout(()=>{O.current=!1},nt()?5:0)}const w=z(r.floating);a&&(w.addEventListener("keydown",D?F:A,D),w.addEventListener("compositionstart",P),w.addEventListener("compositionend",M)),x&&w.addEventListener(c,C?$:T,C);let N=[];return g&&(j(r.domReference)&&(N=te(r.domReference)),j(r.floating)&&(N=N.concat(te(r.floating))),!j(r.reference)&&r.reference&&r.reference.contextElement&&(N=N.concat(te(r.reference.contextElement)))),N=N.filter(q=>{var L;return q!==((L=w.defaultView)==null?void 0:L.visualViewport)}),N.forEach(q=>{q.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(w.removeEventListener("keydown",D?F:A,D),w.removeEventListener("compositionstart",P),w.removeEventListener("compositionend",M)),x&&w.removeEventListener(c,C?$:T,C),N.forEach(q=>{q.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,r,a,x,c,t,o,g,i,R,v,A,D,F,T,C,$]),p.useEffect(()=>{s.current.insideReactTree=!1},[s,x,c]);const _=p.useMemo(()=>({onKeyDown:A,...d&&{[un[u]]:S=>{o(!1,S.nativeEvent,"reference-press")},...u!=="click"&&{onClick(S){o(!1,S.nativeEvent,"reference-press")}}}}),[A,o,d,u]),K=p.useMemo(()=>{function S(E){E.button===0&&(b.current=!0)}return{onKeyDown:A,onMouseDown:S,onMouseUp:S,[dn[c]]:()=>{s.current.insideReactTree=!0}}},[A,c,s]);return p.useMemo(()=>i?{reference:_,floating:K}:{},[i,_,K])}function gn(n){const{open:e=!1,onOpenChange:t,elements:o}=n,r=ue(),s=p.useRef({}),[i]=p.useState(()=>tn()),a=Fe()!=null,[l,c]=p.useState(o.reference),d=W((h,y,m)=>{s.current.openEvent=h?y:void 0,i.emit("openchange",{open:h,event:y,reason:m,nested:a}),t?.(h,y,m)}),u=p.useMemo(()=>({setPositionReference:c}),[]),g=p.useMemo(()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference}),[l,o.reference,o.floating]);return p.useMemo(()=>({dataRef:s,open:e,onOpenChange:d,elements:g,events:i,floatingId:r,refs:u}),[e,d,g,i,r,u])}function mn(n){n===void 0&&(n={});const{nodeId:e}=n,t=gn({...n,elements:{reference:null,floating:null,...n.elements}}),o=n.rootContext||t,r=o.elements,[s,i]=p.useState(null),[a,l]=p.useState(null),d=r?.domReference||s,u=p.useRef(null),g=qe();V(()=>{d&&(u.current=d)},[d]);const h=et({...n,elements:{...r,...a&&{reference:a}}}),y=p.useCallback(R=>{const v=j(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;l(v),h.refs.setReference(v)},[h.refs]),m=p.useCallback(R=>{(j(R)||R===null)&&(u.current=R,i(R)),(j(h.refs.reference.current)||h.refs.reference.current===null||R!==null&&!j(R))&&h.refs.setReference(R)},[h.refs]),f=p.useMemo(()=>({...h.refs,setReference:m,setPositionReference:y,domReference:u}),[h.refs,m,y]),x=p.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=p.useMemo(()=>({...h,...o,refs:f,elements:x,nodeId:e}),[h,f,x,e,o]);return V(()=>{o.dataRef.current.floatingContext=b;const R=g?.nodesRef.current.find(v=>v.id===e);R&&(R.context=b)}),p.useMemo(()=>({...h,context:b,refs:f,elements:x}),[h,f,x,b])}function se(n,e,t){const o=new Map,r=t==="item";let s=n;if(r&&n){const{[he]:i,[be]:a,...l}=n;s=l}return{...t==="floating"&&{tabIndex:-1,[Gt]:""},...s,...e.map(i=>{const a=i?i[t]:null;return typeof a=="function"?n?a(n):null:a}).concat(n).reduce((i,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(r&&[he,be].includes(c)))if(c.indexOf("on")===0){if(o.has(c)||o.set(c,[]),typeof d=="function"){var u;(u=o.get(c))==null||u.push(d),i[c]=function(){for(var g,h=arguments.length,y=new Array(h),m=0;m<h;m++)y[m]=arguments[m];return(g=o.get(c))==null?void 0:g.map(f=>f(...y)).find(f=>f!==void 0)}}}else i[c]=d}),i),{})}}function pn(n){n===void 0&&(n=[]);const e=n.map(a=>a?.reference),t=n.map(a=>a?.floating),o=n.map(a=>a?.item),r=p.useCallback(a=>se(a,n,"reference"),e),s=p.useCallback(a=>se(a,n,"floating"),t),i=p.useCallback(a=>se(a,n,"item"),o);return p.useMemo(()=>({getReferenceProps:r,getFloatingProps:s,getItemProps:i}),[r,s,i])}const vn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hn(n,e){var t,o;e===void 0&&(e={});const{open:r,elements:s,floatingId:i}=n,{enabled:a=!0,role:l="dialog"}=e,c=ue(),d=((t=s.domReference)==null?void 0:t.id)||c,u=p.useMemo(()=>{var b;return((b=jt(s.floating))==null?void 0:b.id)||i},[s.floating,i]),g=(o=vn.get(l))!=null?o:l,y=Fe()!=null,m=p.useMemo(()=>g==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:r?u:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":g==="alertdialog"?"dialog":g,"aria-controls":r?u:void 0,...g==="listbox"&&{role:"combobox"},...g==="menu"&&{id:d},...g==="menu"&&y&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[g,u,y,r,d,l]),f=p.useMemo(()=>{const b={id:u,...g&&{role:g}};return g==="tooltip"||l==="label"?b:{...b,...g==="menu"&&{"aria-labelledby":d}}},[g,u,d,l]),x=p.useCallback(b=>{let{active:R,selected:v}=b;const D={role:"option",...R&&{id:u+"-fui-option"}};switch(l){case"select":case"combobox":return{...D,"aria-selected":v}}return{}},[u,l]);return p.useMemo(()=>a?{reference:m,floating:f,item:x}:{},[a,m,f,x])}function bn(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:a}=n,l=o&&!r,c=Ze(t),d=new RegExp(`\\s${c}$`),u=i?"^":"",g=r?"":c,h=l?new RegExp(`${u}${c}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${g}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const m=a.pos-y.length,f=Array.from(y.matchAll(h)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const x=f.input.slice(Math.max(0,f.index-1),f.index),b=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!b)return null;const R=m+f.index;let v=R+f[0].length;return l&&d.test(y.slice(v-1,v+1))&&(f[0]+=" ",v+=1),R<a.pos&&v>=a.pos?{range:{from:R,to:v},query:f[0].slice(t.length),text:f[0]}:null}function xn(n){return n.docChanged?n.steps.some(e=>{const t=e.slice;if(!t?.content)return!1;const o=t.content.textBetween(0,t.content.size,`
|
|
2
2
|
`);return/\s/.test(o)}):!1}function yn(n){return()=>{const e=n.state.selection.$anchor.pos,{top:t,right:o,bottom:r,left:s}=n.view.coordsAtPos(e);try{return new DOMRect(s,t,o-s,r-t)}catch{return null}}}function Rn(n,e,t,o){return t?()=>{const r=o.getState(n.state),s=r?.decorationId,i=e.dom.querySelector(`[data-decoration-id="${s}"]`);return i?.getBoundingClientRect()||null}:yn(n)}function Sn({match:n,dismissedRange:e,state:t,transaction:o,editor:r,shouldResetDismissed:s,effectiveAllowSpaces:i}){return s?.({editor:r,state:t,range:e,match:n,transaction:o,allowSpaces:i})?!1:i?n.range.from===e.from:n.range.from===e.from&&!xn(o)}function En({view:n,pluginKeyRef:e}){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}function wn({pluginKey:n,decorationTag:e,decorationClass:t,decorationContent:o,decorationEmptyClass:r,renderer:s,dispatchExit:i}){return{handleKeyDown(a,l){var c;const d=n.getState(a.state);if(!d.active)return!1;if(l.key==="Escape"||l.key==="Esc"){var u;return s==null||(u=s.onKeyDown)===null||u===void 0||u.call(s,{view:a,event:l,range:d.range}),i(a),!0}return(s==null||(c=s.onKeyDown)===null||c===void 0?void 0:c.call(s,{view:a,event:l,range:d.range}))||!1},decorations(a){const{active:l,range:c,decorationId:d,query:u}=n.getState(a);if(!l)return null;const g=!u?.length,h=[t];return g&&h.push(r),Ge.create(a.doc,[ze.inline(c.from,c.to,{nodeName:e,class:h.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":o})])}}}function Cn({editor:n,char:e,effectiveAllowSpaces:t,allowToIncludeChar:o,allowedPrefixes:r,startOfLine:s,findSuggestionMatch:i,allow:a,shouldShow:l,shouldKeepDismissed:c,pluginKey:d}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(u,g,h,y){const{isEditable:m}=n,{composing:f}=n.view,{selection:x}=u,{empty:b,from:R}=x,v={...g},D=u.getMeta(d);if(D&&D.exit)return v.active=!1,v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null,v.dismissedRange=g.active?{...g.range}:g.dismissedRange,v;if(v.composing=f,u.docChanged&&v.dismissedRange!==null&&(v.dismissedRange={from:u.mapping.map(v.dismissedRange.from),to:u.mapping.map(v.dismissedRange.to)}),m&&(b||n.view.composing)){(R<g.range.from||R>g.range.to)&&!f&&!g.composing&&(v.active=!1);const C=i({char:e,allowSpaces:t,allowToIncludeChar:o,allowedPrefixes:r,startOfLine:s,$position:x.$from}),O=`id_${Math.floor(Math.random()*4294967295)}`;C&&a({editor:n,state:y,range:C.range,isActive:g.active})&&(!l||l({editor:n,range:C.range,query:C.query,text:C.text,transaction:u}))?(v.dismissedRange!==null&&!c({match:C,dismissedRange:v.dismissedRange,state:y,transaction:u})&&(v.dismissedRange=null),v.dismissedRange===null?(v.active=!0,v.decorationId=g.decorationId||O,v.range=C.range,v.query=C.query,v.text=C.text):v.active=!1):(C||(v.dismissedRange=null),v.active=!1)}else v.active=!1;return v.active||(v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null),v}}}function In({editor:n,items:e}){let t=null,o=null,r=null;const s=()=>{o!==null&&(clearTimeout(o),o=null),r?.(),r=null},i=c=>new Promise(d=>{r=d,o=setTimeout(()=>{o=null;const u=r;r=null,u?.()},c)}),a=()=>{t?.abort(),s(),t=null};return{abort:a,fetch:async(c,d)=>{a(),t=new AbortController;const u=t;if(d>0&&await i(d),t!==u||u.signal.aborted)return{status:"aborted"};try{const g=await e({editor:n,query:c,signal:u.signal});return t!==u||u.signal.aborted?{status:"aborted"}:{status:"resolved",items:g}}catch{return t!==u||u.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function Tn({placement:n,offset:e,flip:t,floatingUi:o}){var r,s,i,a;const l=[at({mainAxis:(r=e.mainAxis)!==null&&r!==void 0?r:4,crossAxis:(s=e.crossAxis)!==null&&s!==void 0?s:0})];return t&&l.push(lt()),!(o==null||(i=o.middleware)===null||i===void 0)&&i.length&&l.push(...o.middleware),{placement:n,strategy:(a=o?.strategy)!==null&&a!==void 0?a:"absolute",middleware:l}}function Pn(n){if(n instanceof HTMLElement)return n;if(typeof n=="string")try{const e=document.querySelector(n);if(e)return e}catch{return document.body}return document.body}function An({getReferenceRect:n,contextElement:e,config:t,container:o,dismissOnOutsideClick:r,dismiss:s}){return(i,a={})=>{const l={getBoundingClientRect:()=>{var y;return(y=n())!==null&&y!==void 0?y:new DOMRect},contextElement:e};let c=!1;const d=!i.isConnected;d&&Pn(o).appendChild(i),a.onPosition||(i.style.visibility="hidden",i.style.width="max-content");const g=Ce(l,i,()=>{ct(l,i,{placement:t.placement,strategy:t.strategy,middleware:t.middleware}).then(({x:y,y:m,placement:f,strategy:x})=>{if(a.onPosition){a.onPosition({x:y,y:m,placement:f,strategy:x});return}Object.assign(i.style,{position:x,left:`${y}px`,top:`${m}px`}),c||(c=!0,i.style.visibility="")})},a.autoUpdate);let h;return r&&(h=y=>{const m=y.target;!(m instanceof Node)||i.contains(m)||e.contains(m)||s()},document.addEventListener("pointerdown",h,!0)),()=>{g(),h&&document.removeEventListener("pointerdown",h,!0),d&&i.remove()}}}function Nn({editor:n,pluginKey:e,items:t,renderer:o,minQueryLength:r,debounce:s,initialItems:i,placement:a,offset:l,container:c,flip:d,floatingUi:u,dismissOnOutsideClick:g,command:h,clientRectFor:y,dispatchExit:m}){let f;const x=In({editor:n,items:t}),b=Tn({placement:a,offset:l,flip:d,floatingUi:u});function R(v,D){switch(v){case"started":var C;o==null||(C=o.onStart)===null||C===void 0||C.call(o,D);break;case"updated":var O;o==null||(O=o.onUpdate)===null||O===void 0||O.call(o,D);break;case"stopped":var A;o==null||(A=o.onExit)===null||A===void 0||A.call(o,D)}}return{update:async(v,D)=>{var C,O;const A=e.getState(D),F=e.getState(v.state);if(!A||!F)return;let T=null;const $=A.query!==F.query,_=A.text!==F.text,K=A.range.from!==F.range.from||A.range.to!==F.range.to,S=$||_||K;if(!A.active&&F.active)T="started";else if(A.active&&!F.active)T="stopped";else if(F.active&&S)T="updated";else return;const E=T==="stopped"?A:F,P=v.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`),M=y(v,P),w=r===0||(E.query?E.query.length>=r:!1),N=(T==="started"||T==="updated")&&w;if(f={editor:n,range:E.range,query:E.query||"",text:E.text||"",items:i??[],command:U=>h({editor:n,range:E.range,props:U}),decorationNode:P,clientRect:M,loading:N,placement:a,offset:{mainAxis:(C=l.mainAxis)!==null&&C!==void 0?C:4,crossAxis:(O=l.crossAxis)!==null&&O!==void 0?O:0},container:c,flip:d,floatingUi:b,mount:An({getReferenceRect:M,contextElement:v.dom,config:b,container:c,dismissOnOutsideClick:g,dismiss:()=>m(n.view)})},T==="started"){var q;o==null||(q=o.onBeforeStart)===null||q===void 0||q.call(o,f)}if(T==="updated"){var L;o==null||(L=o.onBeforeUpdate)===null||L===void 0||L.call(o,f)}if(T==="started"&&R(T,f),T==="started"||T==="updated")if(!N)x.abort(),f={...f,items:i??[],loading:!1};else{f={...f,items:i??[],loading:!0},T="updated",R(T,f);const U=await x.fetch(E.query||"",s);if(U.status==="aborted")return;const X=e.getState(v.state);if(!X?.active){x.abort();return}f=U.status==="resolved"?{...f,items:U.items,loading:!1}:{...f,loading:!1}}if(T==="stopped"){x.abort(),R(T,f),f=void 0;return}T==="updated"&&R(T,f)},destroy:()=>{var v;x.abort(),f&&(o==null||(v=o.onExit)===null||v===void 0||v.call(o,f))}}}const ke=new ie("suggestion");function _e({pluginKey:n=ke,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:u=()=>null,items:g=()=>[],minQueryLength:h=0,debounce:y=0,initialItems:m,placement:f="bottom-start",offset:x={},container:b,flip:R=!0,floatingUi:v,dismissOnOutsideClick:D=!0,render:C=()=>({}),allow:O=()=>!0,findSuggestionMatch:A=bn,shouldShow:F,shouldResetDismissed:T}){const $=C?.(),_=o&&!r,K=(P,M)=>Rn(e,P,M,n);function S(P){return Sn({...P,editor:e,shouldResetDismissed:T,effectiveAllowSpaces:_})}const E=P=>En({view:P,pluginKeyRef:n});return new Qe({key:n,view:()=>Nn({editor:e,pluginKey:n,items:g,renderer:$,minQueryLength:h,debounce:y,initialItems:m,placement:f,offset:x,container:b,flip:R,floatingUi:v,dismissOnOutsideClick:D,command:u,clientRectFor:K,dispatchExit:E}),state:Cn({editor:e,char:t,effectiveAllowSpaces:_,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,findSuggestionMatch:A,allow:O,shouldShow:F,shouldKeepDismissed:S,pluginKey:n}),props:wn({pluginKey:n,decorationTag:a,decorationClass:l,decorationContent:c,decorationEmptyClass:d,renderer:$,dispatchExit:E})})}function Xn(n,e=ke){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}var Yn=_e;function Dn(n){const e=H.c(17),{editor:t,query:o,items:r,onSelect:s,onClose:i}=n,[a,l]=p.useState(0),c=p.useRef(r),d=p.useRef(a),u=p.useRef(s),g=p.useRef(i),h=p.useDeferredValue(o),[y,m]=p.useState(h);y!==h&&(m(h),l(0)),a>=r.length&&r.length>0&&l(0);let f,x;e[0]!==r?(f=()=>{c.current=r},x=[r],e[0]=r,e[1]=f,e[2]=x):(f=e[1],x=e[2]),p.useEffect(f,x);let b,R;e[3]!==a?(b=()=>{d.current=a},R=[a],e[3]=a,e[4]=b,e[5]=R):(b=e[4],R=e[5]),p.useEffect(b,R);let v,D;e[6]!==s?(v=()=>{u.current=s},D=[s],e[6]=s,e[7]=v,e[8]=D):(v=e[7],D=e[8]),p.useEffect(v,D);let C,O;e[9]!==i?(C=()=>{g.current=i},O=[i],e[9]=i,e[10]=C,e[11]=O):(C=e[10],O=e[11]),p.useEffect(C,O);let A,F;e[12]!==t?(F=()=>{if(t?.isDestroyed)return;let _;try{_=t.view.dom}catch{return}if(!_)return;const K=E=>{const P=c.current;if(!P.length)return!1;const M=()=>l(N=>(N+1)%P.length),w=()=>l(N=>(N-1+P.length)%P.length);switch(E.key){case"ArrowUp":return E.preventDefault(),w(),!0;case"ArrowDown":return E.preventDefault(),M(),!0;case"Tab":return E.preventDefault(),E.shiftKey?w():M(),!0;case"Home":return E.preventDefault(),l(0),!0;case"End":return E.preventDefault(),l(P.length-1),!0;case"Enter":{if(E.isComposing)return!1;E.preventDefault();const N=d.current;return N!==-1&&P[N]&&u.current?.(P[N],N),!0}case"Escape":return E.preventDefault(),g.current?.(),!0;default:return!1}},S=E=>{K(E)};return _.addEventListener("keydown",S,!0),()=>{_?.removeEventListener("keydown",S,!0)}},A=[t],e[12]=t,e[13]=A,e[14]=F):(A=e[13],F=e[14]),p.useEffect(F,A);const T=r.length?a:void 0;let $;return e[15]!==T?($={selectedIndex:T,setSelectedIndex:l},e[15]=T,e[16]=$):$=e[16],$}function Mn(n,e){switch(e.type){case"SET_SELECTED_ITEM":return{...n,selectedItem:e.payload};case"ON_START":return{...n,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...n,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return n}}const Le=p.createContext(void 0);function je(){const n=p.useContext(Le);if(!n)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return n}function On(n){const e=H.c(16),{editor:t,char:o,pluginKey:r,allow:s,onOpenChange:i}=n;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=a):a=e[0];const[l,c]=p.useReducer(Mn,a);let d;e[1]!==i?(d=m=>{i?.(m)},e[1]=i,e[2]=d):d=e[2];const u=p.useEffectEvent(d);let g;e[3]!==o||e[4]!==s||e[5]!==t||e[6]!==u||e[7]!==r?(g=()=>{if(t?.isDestroyed)return;const m=r instanceof ie?r:new ie(r);t.state.plugins.find(b=>b.spec.key===m)&&t.unregisterPlugin(m);const x=_e({pluginKey:m,editor:t,char:o,allow(b){const R=t.state.doc.resolve(b.range.from);for(let v=R.depth;v>0;v--)if(R.node(v).type.name==="image")return!1;return!(s&&!s(b))},command(){},render:()=>({onStart:b=>{c({type:"ON_START",payload:{element:b.decorationNode??null,query:b.query,range:b.range}}),u(!0)},onUpdate:b=>{c({type:"ON_UPDATE",payload:{element:b.decorationNode??null,query:b.query,range:b.range}})},onKeyDown:b=>b.event.key==="Escape"?(c({type:"ON_EXIT"}),!0):!1,onExit:()=>{c({type:"ON_EXIT"}),u(!1)}}),items:Fn});return t.registerPlugin(x),()=>{t?.isDestroyed||t.unregisterPlugin(m)}},e[3]=o,e[4]=s,e[5]=t,e[6]=u,e[7]=r,e[8]=g):g=e[8];let h;e[9]!==o||e[10]!==s||e[11]!==t||e[12]!==r?(h=[t,r,o,c,s],e[9]=o,e[10]=s,e[11]=t,e[12]=r,e[13]=h):h=e[13],p.useEffect(g,h);let y;return e[14]!==l?(y={state:l,dispatch:c},e[14]=l,e[15]=y):y=e[15],y}function Fn(){return[]}function qn({editor:n,queryKey:e,queryFn:t,onSelect:o}){const{state:r,dispatch:s}=je(),i=p.useDeferredValue(r.query),{data:a}=ut({queryKey:dt.suggestionItems(e,r.open,i),queryFn:()=>r.open?t({query:i}):[]}),l=()=>{s({type:"ON_EXIT"})},c=async(u,g)=>{if(!(r.selectedItem!==null||!r.range)){s({type:"SET_SELECTED_ITEM",payload:u});try{const{view:h}=n,m=h.state.selection.$to.nodeAfter?.text?.startsWith(" "),f=r.range?{...r.range}:{from:0,to:0};m&&r.range&&(f.to+=1),await o({range:f,item:u})===!1?s({type:"SET_SELECTED_ITEM",payload:null}):l()}catch{l()}}},{selectedIndex:d}=Dn({editor:n,query:i,items:a,onSelect:c,onClose:l});return{selectedItem:r.selectedItem,items:a,selectedIndex:d,close:l,onSelect:c}}function $n({children:n}){const{state:e,dispatch:t}=je(),{open:o,element:r}=e,s=()=>{t({type:"ON_EXIT"})},{refs:i,floatingStyles:a,context:l}=mn({placement:"bottom-start",open:o,onOpenChange:g=>{g||s()},elements:{reference:r},middleware:[ft(10),gt(),mt()],whileElementsMounted:Ce}),c=fn(l,{outsidePress:g=>!(g.target instanceof Element&&g.target.closest(".ProseMirror"))}),d=hn(l,{role:"listbox"}),{getFloatingProps:u}=pn([c,d]);return o?I.jsx(ln,{children:I.jsx("div",{ref:i.setFloating,style:a,...u(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-soft outline-hidden overflow-hidden",children:n})}):null}const kn=n=>{const e=H.c(17),{item:t,isSelected:o,onSelect:r,isLoading:s,ref:i,renderItem:a}=n;let l;if(e[0]!==t){const x=bt(t._meta);l=t.title||xt(t.name,x),e[0]=t,e[1]=l}else l=e[1];const c=l,d=t.description||null,u=t.icon,g=o&&"bg-accent text-accent-foreground",h=s&&"pointer-events-none opacity-50";let y;e[2]!==g||e[3]!==h?(y=vt("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",g,h),e[2]=g,e[3]=h,e[4]=y):y=e[4];let m;e[5]!==d||e[6]!==u||e[7]!==s||e[8]!==t||e[9]!==c||e[10]!==a?(m=a?a(t):I.jsxs(I.Fragment,{children:[u!==void 0&&I.jsx(yt,{icon:u,name:c,size:"xs",className:"mr-2"}),I.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[I.jsxs("div",{className:"flex items-center justify-between gap-2",children:[I.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:c}),s&&I.jsx(ht,{size:"xs"})]}),d&&I.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d})]}),t.drillable&&I.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-2xs font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"})]}),e[5]=d,e[6]=u,e[7]=s,e[8]=t,e[9]=c,e[10]=a,e[11]=m):m=e[11];let f;return e[12]!==r||e[13]!==i||e[14]!==y||e[15]!==m?(f=I.jsx("div",{ref:i,onClick:r,className:y,children:m}),e[12]=r,e[13]=i,e[14]=y,e[15]=m,e[16]=f):f=e[16],f},_n=n=>{const e=H.c(24),{editor:t,queryKey:o,queryFn:r,onSelect:s,renderItem:i,emptyLabel:a}=n,l=pt();let c;e[0]!==t||e[1]!==s||e[2]!==r||e[3]!==o?(c={editor:t,queryKey:o,queryFn:r,onSelect:s},e[0]=t,e[1]=s,e[2]=r,e[3]=o,e[4]=c):c=e[4];const{items:d,selectedIndex:u,onSelect:g,selectedItem:h}=qn(c);if(!d.length){let x;e[5]!==a||e[6]!==l?(x=a??l("chat.mention.noItemsFound"),e[5]=a,e[6]=l,e[7]=x):x=e[7];let b;return e[8]!==x?(b=I.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-soft p-3 text-sm",children:x}),e[8]=x,e[9]=b):b=e[9],b}let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[10]=y):y=e[10];let m;if(e[11]!==g||e[12]!==d||e[13]!==i||e[14]!==u||e[15]!==h?.name){let x;e[17]!==g||e[18]!==i||e[19]!==u||e[20]!==h?.name?(x=(b,R)=>I.jsx(kn,{item:b,isSelected:R===u,ref:R===u?Kn:void 0,onSelect:()=>g(b,R),isLoading:h?.name===b.name,renderItem:i},`${b.kind??"item"}:${b.name}`),e[17]=g,e[18]=i,e[19]=u,e[20]=h?.name,e[21]=x):x=e[21],m=d.map(x),e[11]=g,e[12]=d,e[13]=i,e[14]=u,e[15]=h?.name,e[16]=m}else m=e[16];let f;return e[22]!==m?(f=I.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:y,children:I.jsx("div",{className:"p-1",children:m})}),e[22]=m,e[23]=f):f=e[23],f};function Ln(){const n=H.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=I.jsx("div",{className:"p-1",children:[...Array(3)].map(jn)}),n[0]=e):e=n[0],e}function jn(n,e){return I.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[I.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),I.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Qn(n){const e=H.c(20),{editor:t,char:o,pluginKey:r,queryKey:s,queryFn:i,onSelect:a,allow:l,onOpenChange:c,renderItem:d,emptyLabel:u}=n;let g;e[0]!==l||e[1]!==o||e[2]!==t||e[3]!==c||e[4]!==r?(g={editor:t,char:o,pluginKey:r,allow:l,onOpenChange:c},e[0]=l,e[1]=o,e[2]=t,e[3]=c,e[4]=r,e[5]=g):g=e[5];const{state:h,dispatch:y}=On(g);let m;e[6]!==y||e[7]!==h?(m={state:h,dispatch:y},e[6]=y,e[7]=h,e[8]=m):m=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=I.jsx(Ln,{}),e[9]=f):f=e[9];let x;e[10]!==t||e[11]!==u||e[12]!==a||e[13]!==i||e[14]!==s||e[15]!==d?(x=I.jsx($n,{children:I.jsx(p.Suspense,{fallback:f,children:I.jsx(_n,{editor:t,queryKey:s,queryFn:i,onSelect:a,renderItem:d,emptyLabel:u})})}),e[10]=t,e[11]=u,e[12]=a,e[13]=i,e[14]=s,e[15]=d,e[16]=x):x=e[16];let b;return e[17]!==m||e[18]!==x?(b=I.jsx(Le.Provider,{value:m,children:x}),e[17]=m,e[18]=x,e[19]=b):b=e[19],b}function Kn(n){n&&n.scrollIntoView({block:"center",behavior:"smooth"})}export{Qn as S,Yn as a,Xn as e,Hn as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as i,bG as C,bE as _,bB as T,bH as I,bM as M,bX as H,bT as z,c as A,l as g}from"./index-
|
|
1
|
+
import{r as c,j as i,bG as C,bE as _,bB as T,bH as I,bM as M,bX as H,bT as z,c as A,l as g}from"./index-CaH7O3hJ.js";var m="Switch",[U]=z(m),[q,L]=U(m),y=c.forwardRef((o,e)=>{const{__scopeSwitch:t,name:s,checked:r,defaultChecked:n,required:a,disabled:d,value:u="on",onCheckedChange:w,form:l,...k}=o,[p,h]=c.useState(null),S=_(e,b=>h(b)),v=c.useRef(!1),x=p?l||!!p.closest("form"):!0,[f,N]=T({prop:r,defaultProp:n??!1,onChange:w,caller:m});return i.jsxs(q,{scope:t,checked:f,disabled:d,children:[i.jsx(C.button,{type:"button",role:"switch","aria-checked":f,"aria-required":a,"data-state":j(f),"data-disabled":d?"":void 0,disabled:d,value:u,...k,ref:S,onClick:I(o.onClick,b=>{N(B=>!B),x&&(v.current=b.isPropagationStopped(),v.current||b.stopPropagation())})}),x&&i.jsx(R,{control:p,bubbles:!v.current,name:s,value:u,checked:f,required:a,disabled:d,form:l,style:{transform:"translateX(-100%)"}})]})});y.displayName=m;var E="SwitchThumb",P=c.forwardRef((o,e)=>{const{__scopeSwitch:t,...s}=o,r=L(E,t);return i.jsx(C.span,{"data-state":j(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:e})});P.displayName=E;var O="SwitchBubbleInput",R=c.forwardRef(({__scopeSwitch:o,control:e,checked:t,bubbles:s=!0,...r},n)=>{const a=c.useRef(null),d=_(a,n),u=M(t),w=H(e);return c.useEffect(()=>{const l=a.current;if(!l)return;const k=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(k,"checked").set;if(u!==t&&h){const S=new Event("click",{bubbles:s});h.call(l,t),l.dispatchEvent(S)}},[u,t,s]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:d,style:{...r.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});R.displayName=O;function j(o){return o?"checked":"unchecked"}var X=y,$=P;function F(o){const e=A.c(9);let t,s;e[0]!==o?({className:t,...s}=o,e[0]=o,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-foreground/15 inline-flex h-[1.125rem] w-8 shrink-0 items-center rounded-full border-2 border-transparent transition-colors outline-none focus-ring disabled:opacity-50",t),e[3]=t,e[4]=r):r=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx($,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-3.5 rounded-full shadow-[0_0_0_1px_#0000000f] ring-0 transition-transform data-[state=checked]:translate-x-3.5 data-[state=unchecked]:translate-x-0")}),e[5]=n):n=e[5];let a;return e[6]!==s||e[7]!==r?(a=i.jsx(X,{"data-slot":"switch",className:r,...s,children:n}),e[6]=s,e[7]=r,e[8]=a):a=e[8],a}export{F as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b2 as P,b3 as m}from"./CategoricalChart-
|
|
1
|
+
import{b2 as P,b3 as m}from"./CategoricalChart-CRSSpo7X.js";const w=Math.cos,f=Math.sin,c=Math.sqrt,y=Math.PI,h=2*y,v={draw(n,l){const o=c(l/y);n.moveTo(o,0),n.arc(0,0,o,0,h)}},I={draw(n,l){const o=c(l/5)/2;n.moveTo(-3*o,-o),n.lineTo(-o,-o),n.lineTo(-o,-3*o),n.lineTo(o,-3*o),n.lineTo(o,-o),n.lineTo(3*o,-o),n.lineTo(3*o,o),n.lineTo(o,o),n.lineTo(o,3*o),n.lineTo(-o,3*o),n.lineTo(-o,o),n.lineTo(-3*o,o),n.closePath()}},g=c(1/3),k=g*2,W={draw(n,l){const o=c(l/k),a=o*g;n.moveTo(0,-o),n.lineTo(a,0),n.lineTo(0,o),n.lineTo(-a,0),n.closePath()}},$={draw(n,l){const o=c(l),a=-o/2;n.rect(a,a,o,o)}},q=.8908130915292852,p=f(y/10)/f(7*y/10),M=f(h/10)*p,S=-w(h/10)*p,j={draw(n,l){const o=c(l*q),a=M*o,i=S*o;n.moveTo(0,-o),n.lineTo(a,i);for(let s=1;s<5;++s){const t=h*s/5,u=w(t),e=f(t);n.lineTo(e*o,-u*o),n.lineTo(u*a-e*i,e*a+u*i)}n.closePath()}},b=c(3),A={draw(n,l){const o=-c(l/(b*3));n.moveTo(0,o*2),n.lineTo(-b*o,-o),n.lineTo(b*o,-o),n.closePath()}},r=-.5,T=c(3)/2,d=1/c(12),C=(d/2+1)*3,B={draw(n,l){const o=c(l/C),a=o/2,i=o*d,s=a,t=o*d+o,u=-s,e=t;n.moveTo(a,i),n.lineTo(s,t),n.lineTo(u,e),n.lineTo(r*a-T*i,T*a+r*i),n.lineTo(r*s-T*t,T*s+r*t),n.lineTo(r*u-T*e,T*u+r*e),n.lineTo(r*a+T*i,r*i-T*a),n.lineTo(r*s+T*t,r*t-T*s),n.lineTo(r*u+T*e,r*e-T*u),n.closePath()}};function E(n,l){let o=null,a=P(i);n=typeof n=="function"?n:m(n||v),l=typeof l=="function"?l:m(l===void 0?64:+l);function i(){let s;if(o||(o=s=a()),n.apply(this,arguments).draw(o,+l.apply(this,arguments)),s)return o=null,s+""||null}return i.type=function(s){return arguments.length?(n=typeof s=="function"?s:m(s),i):n},i.size=function(s){return arguments.length?(l=typeof s=="function"?s:m(+s),i):l},i.context=function(s){return arguments.length?(o=s??null,i):o},i}export{E as S,A as a,j as b,$ as c,W as d,I as e,v as f,B as s};
|