decocms 4.76.49 → 4.76.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-BnHU1WVh.js → AlertCircle-CIfsY-8W.js} +1 -1
- package/dist/client/assets/{AreaChart-Dacra_O5.js → AreaChart-BMYamlHM.js} +1 -1
- package/dist/client/assets/{ArrowUp-YJEwgKMQ.js → ArrowUp-rqVNw9bm.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-NJr4X8di.js → ArrowUpRight-xj0NDHre.js} +1 -1
- package/dist/client/assets/{Check-B2Iz7C2o.js → Check-CI4iU_MT.js} +1 -1
- package/dist/client/assets/{CheckCircle-RW91I6m2.js → CheckCircle-_lgB5zuL.js} +1 -1
- package/dist/client/assets/{ChevronDown-wkyJh8B-.js → ChevronDown-CTL_keEs.js} +1 -1
- package/dist/client/assets/{ChevronRight-C6LjrcaC.js → ChevronRight-ErROf0f-.js} +1 -1
- package/dist/client/assets/{ChevronUp-DRO1QadU.js → ChevronUp-5BPapW0x.js} +1 -1
- package/dist/client/assets/{Circle-CUxvy7wD.js → Circle-DnaW_J1p.js} +1 -1
- package/dist/client/assets/{Copy01-CXB2pTie.js → Copy01-C_2NY45r.js} +1 -1
- package/dist/client/assets/{DotsVertical-kGeNAaNA.js → DotsVertical-3sGXRvyQ.js} +1 -1
- package/dist/client/assets/{Eye-D-Dw2M4r.js → Eye-CkivEXGk.js} +1 -1
- package/dist/client/assets/{FilterLines-DyOhC9x2.js → FilterLines-CZDLKL6H.js} +1 -1
- package/dist/client/assets/{Flag01-DsknWftL.js → Flag01-DDZN5nm7.js} +1 -1
- package/dist/client/assets/{Globe01-utYkciWz.js → Globe01-D2NgZQ5r.js} +1 -1
- package/dist/client/assets/{Globe04-D89bbuxY.js → Globe04-Bp9obDMC.js} +1 -1
- package/dist/client/assets/{HardDrive-DCDsB3vQ.js → HardDrive-BaVJEpej.js} +1 -1
- package/dist/client/assets/{Key01-2FRG7RAz.js → Key01-CB3144XW.js} +1 -1
- package/dist/client/assets/{LayoutLeft-QyCZpZ79.js → LayoutLeft-DBbQVqI-.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CmI96IVZ.js → LinkExternal01-CuC_KpxQ.js} +1 -1
- package/dist/client/assets/{List-CUPVMrxo.js → List-v1NvYfix.js} +1 -1
- package/dist/client/assets/{Monitor01-Ctbzjkwm.js → Monitor01-DnrNULNN.js} +1 -1
- package/dist/client/assets/{Package-CGK8L4DO.js → Package-r2-V_I1m.js} +1 -1
- package/dist/client/assets/{Palette-BJai2GVd.js → Palette-X5dCo6tM.js} +1 -1
- package/dist/client/assets/{Play-D8R5ZwHG.js → Play-DHueljHt.js} +1 -1
- package/dist/client/assets/{Plus-DJRb0N6g.js → Plus-CAm5Bdmk.js} +1 -1
- package/dist/client/assets/{SearchLg-B-29p8W9.js → SearchLg-Dk8KacTp.js} +1 -1
- package/dist/client/assets/{SearchMd-6NWySKrO.js → SearchMd-CI-wNdGe.js} +1 -1
- package/dist/client/assets/{Settings02-CQTNCM_z.js → Settings02-DOMO2IHY.js} +1 -1
- package/dist/client/assets/{Shield01-CxhrfJnr.js → Shield01-DzB2hvzJ.js} +1 -1
- package/dist/client/assets/{Star01-zxSxEpuh.js → Star01-BVfaM_3K.js} +1 -1
- package/dist/client/assets/{Stars01-B29ViNxv.js → Stars01-AmjYKoUt.js} +1 -1
- package/dist/client/assets/{Stars02-tMgYvh9q.js → Stars02-C2fK9Cs4.js} +1 -1
- package/dist/client/assets/{Sun-txEnN6V0.js → Sun-uvDmgJqd.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-CgzrCwk9.js → SwitchHorizontal01-llCZWdhP.js} +1 -1
- package/dist/client/assets/{Tool01-D08MgGA9.js → Tool01-DnKt8rGu.js} +1 -1
- package/dist/client/assets/{Tool02-DVWYgFCk.js → Tool02-DJJZoyL-.js} +1 -1
- package/dist/client/assets/{Trash01-CYokEpYZ.js → Trash01-rL4weY4b.js} +1 -1
- package/dist/client/assets/{TrendUp01-8hfrWGb0.js → TrendUp01-D4GOu9o7.js} +1 -1
- package/dist/client/assets/{Upload01-N0TvdNGd.js → Upload01-BZtw8yG4.js} +1 -1
- package/dist/client/assets/{User01-CijmqPgt.js → User01-Du0-zqfx.js} +1 -1
- package/dist/client/assets/{UserPlus01-B4d4_9jq.js → UserPlus01-CpJLFiOO.js} +1 -1
- package/dist/client/assets/{Users01-DqtNsyNi.js → Users01-Cki1BfyB.js} +1 -1
- package/dist/client/assets/{Users03-FvR7CwhH.js → Users03-OTPsvIgo.js} +1 -1
- package/dist/client/assets/{X-B-UPR33q.js → X-DQEB-fUW.js} +1 -1
- package/dist/client/assets/{XCircle-C5w4Sl-I.js → XCircle-DV9eQwVy.js} +1 -1
- package/dist/client/assets/{XClose-CpCRuHnW.js → XClose-NN9Ytu40.js} +1 -1
- package/dist/client/assets/{Zap-O4fvRZrc.js → Zap-CQFWIf93.js} +1 -1
- package/dist/client/assets/{ZapSquare-CLQ3f842.js → ZapSquare-BVvGjKfv.js} +1 -1
- package/dist/client/assets/{ZoomOut-Ds166syU.js → ZoomOut-mUMV6TFE.js} +1 -1
- package/dist/client/assets/{access-gate-BrXDUU55.js → access-gate-DyFVSBWg.js} +1 -1
- package/dist/client/assets/{add-section-modal-jeL28rmu.js → add-section-modal-BwRljJno.js} +1 -1
- package/dist/client/assets/{agent-icon-B6xaAgiS.js → agent-icon-hze-jg23.js} +1 -1
- package/dist/client/assets/{agents-list-BaRQrVc6.js → agents-list-D-UBT8IR.js} +1 -1
- package/dist/client/assets/{ai-providers-TR_Z3E1J.js → ai-providers-C9kBAR3v.js} +1 -1
- package/dist/client/assets/{alert-Dy_XdxPO.js → alert-CoEkLA7g.js} +1 -1
- package/dist/client/assets/{alert-dialog-B87oXsG-.js → alert-dialog-CcRl6dh7.js} +1 -1
- package/dist/client/assets/{app-editor-sbU5zaJ_.js → app-editor-Bb-FSSnj.js} +1 -1
- package/dist/client/assets/{auth-BMQqACla.js → auth-CrWXHGRR.js} +1 -1
- package/dist/client/assets/{auth-catchall-BAv22B3I.js → auth-catchall-AMZs1ldO.js} +1 -1
- package/dist/client/assets/{auth-entry-BjqF_BrQ.js → auth-entry-8TjcZi9d.js} +1 -1
- package/dist/client/assets/{auth-split-layout-B9O0xDY7.js → auth-split-layout-BDrOBgod.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-9csBbFeE.js → authenticate-and-persist-oauth-BK5EZwFp.js} +1 -1
- package/dist/client/assets/{automation-list-row-CF3-rf0R.js → automation-list-row-BkkHzWH4.js} +1 -1
- package/dist/client/assets/{automation-runs-CKxw-xFo.js → automation-runs-BmX8SmIW.js} +13 -13
- package/dist/client/assets/automations-K8snZtI9.js +1 -0
- package/dist/client/assets/{autosend-CRGH-uCu.js → autosend-JOlHhBzJ.js} +1 -1
- package/dist/client/assets/{avatar-YW0Bjo8H.js → avatar-BnMVkhTa.js} +1 -1
- package/dist/client/assets/{badge-BriaGMIr.js → badge-BnTbl2Tl.js} +1 -1
- package/dist/client/assets/{block-document-Yo1zvZpR.js → block-document-C8LOvt9O.js} +1 -1
- package/dist/client/assets/{brand-context-BzclsfS_.js → brand-context-BGeK0E67.js} +1 -1
- package/dist/client/assets/{buckets-B8JBONrs.js → buckets-4HVzpTFh.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-B9_SurP6.js → bulk-category-panel-BX2f-Aej.js} +1 -1
- package/dist/client/assets/{calendar-RuUK7TS8.js → calendar-CVnNTnkn.js} +1 -1
- package/dist/client/assets/{capability-load-error-BcSCgrcJ.js → capability-load-error-ChN6dkhv.js} +1 -1
- package/dist/client/assets/{card-BX-MHzNC.js → card-9CY3IBIC.js} +1 -1
- package/dist/client/assets/{category-editor-BFaWbjkr.js → category-editor-BFS9xtyp.js} +1 -1
- package/dist/client/assets/{chat-context-D3KFW4Pn.js → chat-context-CBIWRQDF.js} +1 -1
- package/dist/client/assets/{checkbox-wsRsKCH7.js → checkbox-C9jbSUfh.js} +1 -1
- package/dist/client/assets/{cli-auth-success-ubad9hMO.js → cli-auth-success-BgGybZTU.js} +1 -1
- package/dist/client/assets/{collection-detail-T9D27p__.js → collection-detail-7AmiIYfR.js} +1 -1
- package/dist/client/assets/{collection-display-button-DVdWFNcJ.js → collection-display-button-v5fpnwO6.js} +1 -1
- package/dist/client/assets/{collection-search-BCkjixL5.js → collection-search-BYNuNmzL.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BaSJyUFB.js → collection-table-wrapper-Bi01EKsZ.js} +1 -1
- package/dist/client/assets/{collection-tabs-DCxJHshW.js → collection-tabs-BOzQ-20F.js} +1 -1
- package/dist/client/assets/{command-CfKaCWIq.js → command-WBnorhQN.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-DPhTgQwF.js → commerce-onboarding-ClF1B2Wm.js} +1 -1
- package/dist/client/assets/{companions-core-CcO_2vjX.js → companions-core-BfbaoPq6.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-BP5ruFDe.js → connect-desktop-dialog-CkBsmbXr.js} +1 -1
- package/dist/client/assets/{connection-card-BtoQSBij.js → connection-card-MWrnszJ7.js} +1 -1
- package/dist/client/assets/{connection-detail-JIZrPniV.js → connection-detail-CKAUmhBH.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-hcIYB8td.js → connection-form-helpers-CuVSHCK0.js} +1 -1
- package/dist/client/assets/{connections-DTXsxorW.js → connections-M_46Yseu.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-A4wv5Dm-.js → decopilot-sse-pool-CvSotbMv.js} +1 -1
- package/dist/client/assets/{dialog-BXEobDEe.js → dialog-BOOy_UpN.js} +1 -1
- package/dist/client/assets/{domain-settings-BzfLB_KG.js → domain-settings-34wBYoqh.js} +1 -1
- package/dist/client/assets/{drawer-BI2bgTGs.js → drawer-C2CWvQ87.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BA_bzNsm.js → dropdown-menu-C177i7en.js} +1 -1
- package/dist/client/assets/{empty-state-B0L2IAdY.js → empty-state-CtACbyFz.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CoQqeYeQ.js → extract-connection-data-B8stXQNE.js} +1 -1
- package/dist/client/assets/file-explorer-CMrKU7M3.js +2 -0
- package/dist/client/assets/{file-type-icon-C1BXVCU6.js → file-type-icon-DPE-o4jz.js} +1 -1
- package/dist/client/assets/{files-PQrdCSIw.js → files-BRlHXeZO.js} +1 -1
- package/dist/client/assets/{form-DMA8VjIU.js → form-Dg5TiHvA.js} +1 -1
- package/dist/client/assets/{general-C9MFkPMv.js → general-epkpj9mx.js} +1 -1
- package/dist/client/assets/{github-repo-picker-atFQ3h83.js → github-repo-picker-ChoLqcc8.js} +1 -1
- package/dist/client/assets/{hooks-B94FOV1X.js → hooks-WqYQNc_d.js} +1 -1
- package/dist/client/assets/{index-BH1U8Nc4.js → index-5lIG4Cjq.js} +1 -1
- package/dist/client/assets/{index-B2IpXFSk.js → index-B5QWfESq.js} +6 -6
- package/dist/client/assets/{index-pBXHu3jy.js → index-BGcH16Tm.js} +1 -1
- package/dist/client/assets/{index-CJtbm6y_.js → index-BNNIB3sj.js} +5 -5
- package/dist/client/assets/{index-pw46WQtO.js → index-BRUndeIM.js} +1 -1
- package/dist/client/assets/{index-CAeePdqM.js → index-BiWqm-2a.js} +1 -1
- package/dist/client/assets/{index-DQ7viotb.js → index-BsTqVTb-.js} +3 -3
- package/dist/client/assets/{index-BreCE_21.js → index-CAIjDQVz.js} +1 -1
- package/dist/client/assets/{index-CEOgWxk-.js → index-Ci9jxXhD.js} +1 -1
- package/dist/client/assets/{index-D7BaOenA.js → index-CiBu7i5s.js} +1 -1
- package/dist/client/assets/{index-mklRdWPY.js → index-DdMruut4.js} +1 -1
- package/dist/client/assets/{index-CO7VBe2M.js → index-HTNB1LY2.js} +2 -2
- package/dist/client/assets/{index-ClzzqoMN.js → index-JK2_MDcU.js} +1 -1
- package/dist/client/assets/{index-CzVHf7Ap.js → index-adnVIpLM.js} +1 -1
- package/dist/client/assets/{index-redirect-Diy2eTGA.js → index-redirect-C8NmCCDK.js} +1 -1
- package/dist/client/assets/{input-783WqkaW.js → input-Be-N8FL1.js} +1 -1
- package/dist/client/assets/{integration-icon-CpiFsckQ.js → integration-icon-6zGvFKc5.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-DQliPz2T.js → invite-member-dialog-CEFuo6Ba.js} +1 -1
- package/dist/client/assets/{label-DRLwUGMZ.js → label-BmkJ7pPY.js} +1 -1
- package/dist/client/assets/{layout-DUe900Bz.js → layout-DYviorcI.js} +1 -1
- package/dist/client/assets/{login-BCmf8ZqY.js → login-Hmi-Fq25.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BRRKWKtD.js → mcp-oauth-C2iTPQZk.js} +1 -1
- package/dist/client/assets/{members-D9smUp4G.js → members-Aca20TwI.js} +1 -1
- package/dist/client/assets/{monaco-editor-DEHPlRXy.js → monaco-editor-B1j8wHP_.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-C9PgNv_Y.js → monitoring-stats-row-B8sYE-Hl.js} +1 -1
- package/dist/client/assets/{multi-select-T1g9SLcN.js → multi-select-DmC0Re9g.js} +1 -1
- package/dist/client/assets/{oauth-callback-CKsvPc5G.js → oauth-callback-CBKyKTYK.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-FWn1Rivj.js → oauth-callback-ai-provider-LWA0STHf.js} +1 -1
- package/dist/client/assets/{onboarding-Dkupkn9w.js → onboarding-CWxn04PM.js} +1 -1
- package/dist/client/assets/{org-install-BrbDYYKo.js → org-install-tiny0B05.js} +1 -1
- package/dist/client/assets/{org-layout-BoMhM_4_.js → org-layout-BdOAq2b7.js} +1 -1
- package/dist/client/assets/{organization-choice-BoEW2JRx.js → organization-choice-Boj4ERTN.js} +1 -1
- package/dist/client/assets/{orgs-DjIAUMyS.js → orgs-D2muDruX.js} +1 -1
- package/dist/client/assets/{page-seo-form-B7Ii0C31.js → page-seo-form-BAvb_lnU.js} +1 -1
- package/dist/client/assets/page-seo-sheet-D7ynb80a.js +1 -0
- package/dist/client/assets/{popover-BJQaiJ2F.js → popover-DqJyIDsr.js} +1 -1
- package/dist/client/assets/{post-editor-D3W9p90N.js → post-editor-D516m35p.js} +1 -1
- package/dist/client/assets/{primitives-CiK5Wvsr.js → primitives-MxrGFAE8.js} +1 -1
- package/dist/client/assets/{profile-iwEbexPz.js → profile-BLVLFZ-4.js} +1 -1
- package/dist/client/assets/project-app-view-D7AbwYHT.js +1 -0
- package/dist/client/assets/record-editor-B-z99QmM.js +1 -0
- package/dist/client/assets/redirect-editor-BPqcZkce.js +1 -0
- package/dist/client/assets/registry-CFugvs6l.js +2 -0
- package/dist/client/assets/{registry-layout-CmqjS3tF.js → registry-layout-Dzh2wgD5.js} +1 -1
- package/dist/client/assets/{reports-D-3oyiH-.js → reports-cW5aMtzN.js} +1 -1
- package/dist/client/assets/{require-capability-Mwv3G2Wv.js → require-capability-TYaQ_jzJ.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CGkIwMlg.js → required-auth-layout-CWGPiWRr.js} +1 -1
- package/dist/client/assets/{reset-password-Bsf8WbEx.js → reset-password-DPNFKFvL.js} +1 -1
- package/dist/client/assets/{roles-CGYuKAGA.js → roles-SYC9O9Ao.js} +1 -1
- package/dist/client/assets/{search-input-CbBt_hwl.js → search-input-DEQrdNAQ.js} +1 -1
- package/dist/client/assets/{secrets-BzkmvzGH.js → secrets-DMkilhyD.js} +1 -1
- package/dist/client/assets/{sections-editor-C-e30nQC.js → sections-editor-CvRu1cOv.js} +1 -1
- package/dist/client/assets/{select-UOdEK8ld.js → select-MCVw8-DS.js} +1 -1
- package/dist/client/assets/{select-model-CXVmAkgn.js → select-model-DpQX3aDM.js} +1 -1
- package/dist/client/assets/{self-tool-result-CD_XYQHz.js → self-tool-result-B_oSDG-V.js} +1 -1
- package/dist/client/assets/{seo-editor-DeoYwwqh.js → seo-editor-DdRARs1F.js} +1 -1
- package/dist/client/assets/{settings-layout-BJxt8xXx.js → settings-layout-Bhok2DOk.js} +1 -1
- package/dist/client/assets/{settings-section-CfQpTGXU.js → settings-section-yMNMXQGU.js} +1 -1
- package/dist/client/assets/{shell-controls-W-ZpN-Ts.js → shell-controls-BLNoLZRH.js} +1 -1
- package/dist/client/assets/{shell-layout-DhFYjC1t.js → shell-layout-D21G-jfD.js} +1 -1
- package/dist/client/assets/{sidebar-DCgTHOQU.js → sidebar-3GjqyzOm.js} +1 -1
- package/dist/client/assets/{skeleton-D-ztH7j1.js → skeleton-DMppxm-y.js} +1 -1
- package/dist/client/assets/{sso-B3MCitHr.js → sso-C0vzkCu_.js} +1 -1
- package/dist/client/assets/store-registry-D5RTLbbs.js +2 -0
- package/dist/client/assets/{store-I0ii3lrj.js → store-uVU0O3r1.js} +1 -1
- package/dist/client/assets/{studio-tools-BksY-Ad2.js → studio-tools-DGTmHkra.js} +1 -1
- package/dist/client/assets/{switch-DGqoIuJx.js → switch-BRgcwLRT.js} +1 -1
- package/dist/client/assets/{table-BHmrO8KV.js → table-BRnlZTyI.js} +1 -1
- package/dist/client/assets/{tabs-hKnLKYtp.js → tabs-fX2HzwB8.js} +1 -1
- package/dist/client/assets/{textarea-CMk4yqcC.js → textarea-BqvSyTp9.js} +1 -1
- package/dist/client/assets/{toggle-group-BkLEELHq.js → toggle-group-RllCKsx3.js} +1 -1
- package/dist/client/assets/{toolbar-C5Y0NGMt.js → toolbar-DXcqQfQP.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-BnkdHuZu.js → toolbar-icon-button-BYSUG33c.js} +1 -1
- package/dist/client/assets/{tooltip-BS-OvIHF.js → tooltip-C0WFaxn1.js} +1 -1
- package/dist/client/assets/{use-ai-providers-fnve2hOS.js → use-ai-providers-DAi_sqms.js} +1 -1
- package/dist/client/assets/{use-automations-ykni-nDO.js → use-automations-DXdOXn4W.js} +1 -1
- package/dist/client/assets/{use-autosave-Dm8FKJA8.js → use-autosave-Pjq-jGyb.js} +1 -1
- package/dist/client/assets/{use-capability-FyDdM1OY.js → use-capability-CaOJ4RA0.js} +1 -1
- package/dist/client/assets/{use-clock-tick-BgWkcZef.js → use-clock-tick-DpGprcXz.js} +1 -1
- package/dist/client/assets/{use-collections-qEVIutQN.js → use-collections-D420J4pu.js} +1 -1
- package/dist/client/assets/{use-connection-BP5IgchH.js → use-connection-C-cm_Zca.js} +1 -1
- package/dist/client/assets/{use-copy-CXSo9qrf.js → use-copy-D_0uzSqv.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-C29HY0QE.js → use-create-virtual-mcp-CKd4HS6p.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DmNYey6u.js → use-debounced-autosave-ClDch0Lj.js} +1 -1
- package/dist/client/assets/{use-debounced-value-DvBYllnp.js → use-debounced-value-DJ6FXRJ8.js} +1 -1
- package/dist/client/assets/use-deco-credits-DglXerxg.js +1 -0
- package/dist/client/assets/{use-decopilot-events-BH8NADEo.js → use-decopilot-events-D5etxzeG.js} +1 -1
- package/dist/client/assets/{use-delete-connection-D8Zzy_XD.js → use-delete-connection-CfocHLRf.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-euN1ZCnG.js → use-deployment-admin-CQ8gUCKR.js} +1 -1
- package/dist/client/assets/{use-file-configs-Bk2sm9Tm.js → use-file-configs-B1OpgCsA.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-Dr_9gvr9.js → use-infinite-scroll-Bd2R9N8w.js} +1 -1
- package/dist/client/assets/{use-join-requests-BeF5HZcR.js → use-join-requests-fItivNWZ.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-BRwQPSok.js → use-mcp-auth-status-DjLPKl6K.js} +1 -1
- package/dist/client/assets/{use-mcp-client-vJ_hUKuw.js → use-mcp-client-B9CKszKk.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CSZSTtuE.js → use-mcp-tools-Bu7p1TAu.js} +1 -1
- package/dist/client/assets/{use-members-C8PUXjwn.js → use-members-SkrIfqQj.js} +1 -1
- package/dist/client/assets/{use-mobile-BpfZPuSO.js → use-mobile-B70Vai6R.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-Bts97NhH.js → use-navigate-to-agent-DQWfHojT.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-BTW6scjC.js → use-org-auth-client-DTWRtVEM.js} +1 -1
- package/dist/client/assets/{use-org-sso-DHt-iU6o.js → use-org-sso-BuEBaQ5k.js} +1 -1
- package/dist/client/assets/{use-organization-roles-CRYhg04d.js → use-organization-roles-BFodJcj1.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DeHTHMpw.js → use-organization-settings-Cmcszs_h.js} +1 -1
- package/dist/client/assets/{use-registry-connections-CKsh3sEK.js → use-registry-connections-DeY9757P.js} +1 -1
- package/dist/client/assets/{use-secrets-M9uB4BOe.js → use-secrets-C4RjsTOr.js} +1 -1
- package/dist/client/assets/{use-status-sounds-Cib4eoV_.js → use-status-sounds-1Fr5JAvP.js} +1 -1
- package/dist/client/assets/{use-view-mode-DwaJQjgy.js → use-view-mode-vlFrTq0d.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-DVMAHGer.js → use-virtual-mcp-B_ZEXWu6.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CJa8irpc.js +1 -0
- package/dist/client/assets/{useRouterState-B8NdmLNY.js → useRouterState-BOm3KWkb.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-xA3CKSE4.js +1 -0
- package/dist/client/assets/{users-CkDLDosV.js → users-DMP2atvJ.js} +1 -1
- package/dist/client/assets/{variant-calendar-BxE6JaNT.js → variant-calendar-BKB6zdAd.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-8s4FUS-M.js → view-mode-toggle-B29QsfVY.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/automations-rrwY2xr-.js +0 -1
- package/dist/client/assets/file-explorer-MMGy1yNj.js +0 -2
- package/dist/client/assets/page-seo-sheet-CzZ1z6GP.js +0 -1
- package/dist/client/assets/project-app-view-C8YG8mws.js +0 -1
- package/dist/client/assets/record-editor-DYkHRVTf.js +0 -1
- package/dist/client/assets/redirect-editor-ClQgDUpd.js +0 -1
- package/dist/client/assets/registry-Cmc40tJJ.js +0 -2
- package/dist/client/assets/store-registry-7IEPyxow.js +0 -2
- package/dist/client/assets/use-deco-credits-B76eIFb2.js +0 -1
- package/dist/client/assets/useInfiniteQuery-CoOlPRVo.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DGfH2E6n.js +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{c as $,C as de,n as Ze,d as We,K as X,m as ie,aY as wn,r as S,ap as zs,l as ce,j as r,U as Cs,i as $s,B as J,aL as jn,t as ue,w as Ps,L as Es,e as Ds,b as kn,u as Sn,E as $t}from"./index-DQ7viotb.js";import{i as Ts}from"./ChevronRight-C6LjrcaC.js";import{s as Nn}from"./Eye-D-Dw2M4r.js";import{n as Ve,i as xt}from"./Globe01-utYkciWz.js";import{b as Fs,c as Ms,e as Is,i as Ls,f as zn,a as Cn,g as Os,d as Rs}from"./ZoomOut-Ds166syU.js";import{a as dt}from"./Palette-BJai2GVd.js";import{s as As}from"./Plus-DJRb0N6g.js";import{i as _s}from"./SearchLg-B-29p8W9.js";import{t as Us}from"./Stars01-B29ViNxv.js";import{i as ut}from"./Upload01-N0TvdNGd.js";import{s as $n}from"./XClose-CpCRuHnW.js";import{i as At}from"./Zap-O4fvRZrc.js";import{u as Pn}from"./use-mobile-BpfZPuSO.js";import{f as Bs,a as Hs,b as qs,c as Ks,d as Ws,e as Gs,A as Vs,g as Xs}from"./alert-dialog-B87oXsG-.js";import{D as En,a as Ue,d as Je,e as et,i as Dn,h as Qs,c as Ys}from"./dialog-BXEobDEe.js";import{I as Xe}from"./input-783WqkaW.js";import{S as ae}from"./skeleton-D-ztH7j1.js";import{F as ke,M as _t,d as Tn}from"./file-type-icon-C1BXVCU6.js";import{T as Zs}from"./toolbar-C5Y0NGMt.js";import{a as Js}from"./Package-CGK8L4DO.js";import{u as el}from"./use-debounced-value-DvBYllnp.js";import{i as Fn}from"./DotsVertical-kGeNAaNA.js";import{i as Mn}from"./Key01-2FRG7RAz.js";import{s as In}from"./Trash01-CYokEpYZ.js";import{D as Ut,a as Bt,c as Ht,d as Fe}from"./dropdown-menu-BA_bzNsm.js";import{T as tl}from"./textarea-CMk4yqcC.js";import{t as nl}from"./ChevronDown-wkyJh8B-.js";import{n as sl}from"./ChevronUp-DRO1QadU.js";import{i as ft}from"./X-B-UPR33q.js";import{P as ll,b as rl,a as il}from"./popover-BJQaiJ2F.js";import{b as be,T as ye,a as ve}from"./tooltip-BS-OvIHF.js";import{i as ol}from"./Check-B2Iz7C2o.js";import{a as al}from"./Copy01-CXB2pTie.js";import{n as Ln}from"./LinkExternal01-CmI96IVZ.js";import{l as cl,F as dl}from"./index-BreCE_21.js";import{i as ul}from"./LayoutLeft-QyCZpZ79.js";function On(n){return n.contentHash??`${n.size}-${n.updatedAt}`}function pe(n,e,t,s){const l=new URLSearchParams(s).toString();return`/api/${encodeURIComponent(n)}/fs/${encodeURIComponent(e)}/${t}${l?`?${l}`:""}`}async function fe(n,e,t){const s=await fetch(n,e);if(s.ok||t?.allow404&&s.status===404)return s;let l="";try{l=(await s.json()).error??""}catch{}throw new Error(l||`HTTP ${s.status}`)}function qt(n,e){const t=$.c(11),{org:s}=de();let l;t[0]!==s.id||t[1]!==e||t[2]!==n?(l=X.orgFsList(s.id,n,e),t[0]=s.id,t[1]=e,t[2]=n,t[3]=l):l=t[3];let i;t[4]!==s.slug||t[5]!==e||t[6]!==n?(i=async()=>(await(await fe(pe(s.slug,n,"list",{path:e}))).json()).entries.toSorted(fl),t[4]=s.slug,t[5]=e,t[6]=n,t[7]=i):i=t[7];let o;return t[8]!==l||t[9]!==i?(o={queryKey:l,placeholderData:wn,queryFn:i},t[8]=l,t[9]=i,t[10]=o):o=t[10],ie(o)}function fl(n,e){return n.kind!==e.kind?n.kind==="dir"?-1:1:n.path.localeCompare(e.path)}function Rn(n,e,t){const s=$.c(15),{org:l}=de();let i;s[0]!==l.id||s[1]!==e||s[2]!==n?(i=X.orgFsStat(l.id,n??"",e),s[0]=l.id,s[1]=e,s[2]=n,s[3]=i):i=s[3];const o=n!==null;let a;s[4]!==t?(a=t?.refetchIntervalWhenAbsent?f=>f.state.data?!1:t.refetchIntervalWhenAbsent??!1:void 0,s[4]=t,s[5]=a):a=s[5];let c;s[6]!==l.slug||s[7]!==e||s[8]!==n?(c=async()=>{const f=await fe(pe(l.slug,n??"","stat",{path:e}),void 0,{allow404:!0});return f.status===404?null:(await f.json()).entry},s[6]=l.slug,s[7]=e,s[8]=n,s[9]=c):c=s[9];let d;return s[10]!==i||s[11]!==o||s[12]!==a||s[13]!==c?(d={queryKey:i,enabled:o,refetchInterval:a,queryFn:c},s[10]=i,s[11]=o,s[12]=a,s[13]=c,s[14]=d):d=s[14],ie(d)}function hl(n){const e=$.c(9),{org:t}=de();let s;e[0]!==t.id||e[1]!==n?(s=X.orgFsUsage(t.id,n),e[0]=t.id,e[1]=n,e[2]=s):s=e[2];let l;e[3]!==t.slug||e[4]!==n?(l=async()=>await(await fe(pe(t.slug,n,"usage"))).json(),e[3]=t.slug,e[4]=n,e[5]=l):l=e[5];let i;return e[6]!==s||e[7]!==l?(i={queryKey:s,queryFn:l},e[6]=s,e[7]=l,e[8]=i):i=e[8],ie(i)}function ml(n,e){const t=$.c(9),s=n===void 0?60:n,{org:l}=de();let i;t[0]!==l.id?(i=X.orgFsRecent(l.id),t[0]=l.id,t[1]=i):i=t[1];const o=e?.enabled;let a;t[2]!==s||t[3]!==l.slug?(a=async()=>(await(await fe(`/api/${encodeURIComponent(l.slug)}/fs/recent?limit=${s}`)).json()).entries,t[2]=s,t[3]=l.slug,t[4]=a):a=t[4];let c;return t[5]!==i||t[6]!==o||t[7]!==a?(c={queryKey:i,enabled:o,queryFn:a},t[5]=i,t[6]=o,t[7]=a,t[8]=c):c=t[8],ie(c)}function pl(n,e){const t=$.c(11),s=50,{org:l}=de();let i;t[0]!==l.id||t[1]!==n?(i=X.orgFsSearch(l.id,n),t[0]=l.id,t[1]=n,t[2]=i):i=t[2];const o=n.length>0;let a;t[3]!==s||t[4]!==l.slug||t[5]!==n?(a=async()=>(await(await fe(`/api/${encodeURIComponent(l.slug)}/fs/search?q=${encodeURIComponent(n)}&limit=${s}`)).json()).entries,t[3]=s,t[4]=l.slug,t[5]=n,t[6]=a):a=t[6];let c;return t[7]!==i||t[8]!==o||t[9]!==a?(c={queryKey:i,enabled:o,placeholderData:wn,queryFn:a},t[7]=i,t[8]=o,t[9]=a,t[10]=c):c=t[10],ie(c)}function Do(n){const e=$.c(8),{org:t}=de();let s;e[0]!==t.id?(s=X.orgFsSkills(t.id),e[0]=t.id,e[1]=s):s=e[1];const l=n?.enabled;let i;e[2]!==t.slug?(i=async()=>{const a=await fe(`/api/${encodeURIComponent(t.slug)}/fs/skills`),{skills:c}=await a.json();return c.map(xl)},e[2]=t.slug,e[3]=i):i=e[3];let o;return e[4]!==s||e[5]!==l||e[6]!==i?(o={queryKey:s,enabled:l,queryFn:i},e[4]=s,e[5]=l,e[6]=i,e[7]=o):o=e[7],ie(o)}function xl(n){return{volume:n.volume,path:n.path}}async function To(n){const e=await fe(`/api/${encodeURIComponent(n)}/fs/skills`),{skills:t}=await e.json();return t}async function gl(n,e,t){return(await fe(pe(n,e,"read",{path:t}))).text()}const bl=new Set(["md","mdx","markdown","txt","text"]),yl=25,vl=64*1024,wl=256*1024,jl=4;function kl(n){const e=n.lastIndexOf(".");return e===-1?!1:bl.has(n.slice(e+1).toLowerCase())}async function Fo(n,e,t){const s=t?`${t}/`:"",l=u=>u.startsWith(s)?u.slice(s.length):u,i=[],o=[],a=[{path:t,depth:0}];for(;a.length>0;){const u=a.shift();if(!u)break;let h;try{h=(await(await fe(pe(n,e,"list",{path:u.path}))).json()).entries}catch{continue}for(const m of[...h].sort((p,g)=>p.path.localeCompare(g.path))){if(m.kind==="dir"){u.depth<jl&&a.push({path:m.path,depth:u.depth+1});continue}kl(m.path)&&m.size<=vl&&i.length<yl?i.push(m.path):o.push(l(m.path))}}const c=await Promise.all(i.map(u=>gl(n,e,u).catch(()=>null))),d=[];let f=0;return i.forEach((u,h)=>{const m=c[h];if(m==null||f+m.length>wl){o.push(l(u));return}f+=m.length,d.push({relPath:l(u),content:m})}),d.sort((u,h)=>u.relPath==="SKILL.md"?-1:h.relPath==="SKILL.md"?1:u.relPath.localeCompare(h.relPath)),o.sort(),{files:d,omittedPaths:o}}function An(){const n=$.c(7),{org:e}=de();let t;n[0]!==e.id?(t=X.orgFsPublicSets(e.id),n[0]=e.id,n[1]=t):t=n[1];let s;n[2]!==e.slug?(s=async()=>(await(await fe(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,n[2]=e.slug,n[3]=s):s=n[3];let l;return n[4]!==t||n[5]!==s?(l={queryKey:t,staleTime:3e5,queryFn:s},n[4]=t,n[5]=s,n[6]=l):l=n[6],ie(l)}function Sl(n){const e=$.c(3),{org:t}=de();let s;return e[0]!==t.slug||e[1]!==n?(s=l=>pe(t.slug,n,"read",{path:l}),e[0]=t.slug,e[1]=n,e[2]=s):s=e[2],s}function tt(){const n=$.c(2),{org:e}=de();let t;return n[0]!==e.slug?(t=(s,l)=>pe(e.slug,s,"read",{path:l}),n[0]=e.slug,n[1]=t):t=n[1],t}function _n(n){const e=$.c(3),{org:t}=de();let s;return e[0]!==t||e[1]!==n?(s={mutationFn:async l=>(await(await fe(pe(t.slug,n,"file",{path:l.path}),{method:"PUT",headers:{"content-type":l.contentType??"text/html; charset=utf-8"},body:l.body})).json()).entry},e[0]=t,e[1]=n,e[2]=s):s=e[2],We(s)}function Nl(n){const e=$.c(18),{org:t}=de(),s=Ze();let l;e[0]!==t||e[1]!==n?(l=async d=>(await(await fe(pe(t.slug,n,"public",{path:d.path}),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({mode:d.mode,password:d.password})})).json()).entry,e[0]=t,e[1]=n,e[2]=l):l=e[2];let i;e[3]!==t||e[4]!==s||e[5]!==n?(i=async d=>{const f=X.orgFsStat(t.id,n,d.path);await s.cancelQueries({queryKey:f});const u=s.getQueryData(f),h=d.mode!=="private";return s.setQueryData(f,m=>m&&{...m,readPublic:h,effectivePublic:h,shareMode:d.mode}),{key:f,previous:u}},e[3]=t,e[4]=s,e[5]=n,e[6]=i):i=e[6];let o;e[7]!==s?(o=(d,f,u)=>{u&&s.setQueryData(u.key,u.previous)},e[7]=s,e[8]=o):o=e[8];let a;e[9]!==t||e[10]!==s||e[11]!==n?(a=(d,f,u)=>{s.invalidateQueries({queryKey:X.orgFsStat(t.id,n,u.path)}),s.invalidateQueries({queryKey:X.orgFsVolume(t.id,n)}),s.invalidateQueries({queryKey:X.orgFsRecent(t.id)}),s.invalidateQueries({queryKey:X.orgFsSearchRoot(t.id)})},e[9]=t,e[10]=s,e[11]=n,e[12]=a):a=e[12];let c;return e[13]!==l||e[14]!==i||e[15]!==o||e[16]!==a?(c={mutationFn:l,onMutate:i,onError:o,onSettled:a},e[13]=l,e[14]=i,e[15]=o,e[16]=a,e[17]=c):c=e[17],We(c)}function It(n){const e=$.c(26),{org:t}=de(),s=Ze();let l;e[0]!==t||e[1]!==s||e[2]!==n?(l=()=>{s.invalidateQueries({queryKey:X.orgFsVolume(t.id,n)}),s.invalidateQueries({queryKey:X.orgFsRecent(t.id)}),s.invalidateQueries({queryKey:X.orgFsSearchRoot(t.id)})},e[0]=t,e[1]=s,e[2]=n,e[3]=l):l=e[3];const i=l;let o;e[4]!==t||e[5]!==n?(o=async b=>{for(const x of b.files){const y=b.dir?`${b.dir}/${x.name}`:x.name;await fe(pe(t.slug,n,"file",{path:y}),{method:"PUT",headers:{"content-type":x.type||"application/octet-stream"},body:x})}},e[4]=t,e[5]=n,e[6]=o):o=e[6];let a;e[7]!==i||e[8]!==o?(a={mutationFn:o,onSettled:i},e[7]=i,e[8]=o,e[9]=a):a=e[9];const c=We(a);let d;e[10]!==t||e[11]!==n?(d=async b=>{await fe(pe(t.slug,n,"dir",{path:b}),{method:"POST"})},e[10]=t,e[11]=n,e[12]=d):d=e[12];let f;e[13]!==i||e[14]!==d?(f={mutationFn:d,onSuccess:i},e[13]=i,e[14]=d,e[15]=f):f=e[15];const u=We(f);let h;e[16]!==t||e[17]!==n?(h=async b=>{await fe(pe(t.slug,n,"file",{path:b}),{method:"DELETE"})},e[16]=t,e[17]=n,e[18]=h):h=e[18];let m;e[19]!==i||e[20]!==h?(m={mutationFn:h,onSuccess:i},e[19]=i,e[20]=h,e[21]=m):m=e[21];const p=We(m);let g;return e[22]!==u||e[23]!==p||e[24]!==c?(g={upload:c,mkdir:u,remove:p},e[22]=u,e[23]=p,e[24]=c,e[25]=g):g=e[25],g}const gt=S.createContext(null);gt.displayName="PanelGroupContext";const se={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Kt=10,Te=S.useLayoutEffect,tn=zs.useId,zl=typeof tn=="function"?tn:()=>null;let Cl=0;function Wt(n=null){const e=zl(),t=S.useRef(n||e||null);return t.current===null&&(t.current=""+Cl++),n??t.current}function Un({children:n,className:e="",collapsedSize:t,collapsible:s,defaultSize:l,forwardedRef:i,id:o,maxSize:a,minSize:c,onCollapse:d,onExpand:f,onResize:u,order:h,style:m,tagName:p="div",...g}){const b=S.useContext(gt);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:y,getPanelSize:j,getPanelStyle:N,groupId:C,isPanelCollapsed:k,reevaluatePanelConstraints:w,registerPanel:B,resizePanel:R,unregisterPanel:_}=b,v=Wt(o),M=S.useRef({callbacks:{onCollapse:d,onExpand:f,onResize:u},constraints:{collapsedSize:t,collapsible:s,defaultSize:l,maxSize:a,minSize:c},id:v,idIsFromProps:o!==void 0,order:h});S.useRef({didLogMissingDefaultSizeWarning:!1}),Te(()=>{const{callbacks:U,constraints:O}=M.current,H={...O};M.current.id=v,M.current.idIsFromProps=o!==void 0,M.current.order=h,U.onCollapse=d,U.onExpand=f,U.onResize=u,O.collapsedSize=t,O.collapsible=s,O.defaultSize=l,O.maxSize=a,O.minSize=c,(H.collapsedSize!==O.collapsedSize||H.collapsible!==O.collapsible||H.maxSize!==O.maxSize||H.minSize!==O.minSize)&&w(M.current,H)}),Te(()=>{const U=M.current;return B(U),()=>{_(U)}},[h,v,B,_]),S.useImperativeHandle(i,()=>({collapse:()=>{x(M.current)},expand:U=>{y(M.current,U)},getId(){return v},getSize(){return j(M.current)},isCollapsed(){return k(M.current)},isExpanded(){return!k(M.current)},resize:U=>{R(M.current,U)}}),[x,y,j,k,v,R]);const Z=N(M.current,l);return S.createElement(p,{...g,children:n,className:e,id:v,style:{...Z,...m},[se.groupId]:C,[se.panel]:"",[se.panelCollapsible]:s||void 0,[se.panelId]:v,[se.panelSize]:parseFloat(""+Z.flexGrow).toFixed(1)})}const Bn=S.forwardRef((n,e)=>S.createElement(Un,{...n,forwardedRef:e}));Un.displayName="Panel";Bn.displayName="forwardRef(Panel)";let Lt=null,ct=-1,ze=null;function $l(n,e){if(e){const t=(e&Gn)!==0,s=(e&Vn)!==0,l=(e&Xn)!==0,i=(e&Qn)!==0;if(t)return l?"se-resize":i?"ne-resize":"e-resize";if(s)return l?"sw-resize":i?"nw-resize":"w-resize";if(l)return"s-resize";if(i)return"n-resize"}switch(n){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Pl(){ze!==null&&(document.head.removeChild(ze),Lt=null,ze=null,ct=-1)}function Pt(n,e){var t,s;const l=$l(n,e);if(Lt!==l){if(Lt=l,ze===null&&(ze=document.createElement("style"),document.head.appendChild(ze)),ct>=0){var i;(i=ze.sheet)===null||i===void 0||i.removeRule(ct)}ct=(t=(s=ze.sheet)===null||s===void 0?void 0:s.insertRule(`*{cursor: ${l} !important;}`))!==null&&t!==void 0?t:-1}}function Hn(n){return n.type==="keydown"}function qn(n){return n.type.startsWith("pointer")}function Kn(n){return n.type.startsWith("mouse")}function bt(n){if(qn(n)){if(n.isPrimary)return{x:n.clientX,y:n.clientY}}else if(Kn(n))return{x:n.clientX,y:n.clientY};return{x:1/0,y:1/0}}function El(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Dl(n,e,t){return n.x<e.x+e.width&&n.x+n.width>e.x&&n.y<e.y+e.height&&n.y+n.height>e.y}function Tl(n,e){if(n===e)throw new Error("Cannot compare node with itself");const t={a:ln(n),b:ln(e)};let s;for(;t.a.at(-1)===t.b.at(-1);)n=t.a.pop(),e=t.b.pop(),s=n;G(s,"Stacking order can only be calculated for elements with a common ancestor");const l={a:sn(nn(t.a)),b:sn(nn(t.b))};if(l.a===l.b){const i=s.childNodes,o={a:t.a.at(-1),b:t.b.at(-1)};let a=i.length;for(;a--;){const c=i[a];if(c===o.a)return 1;if(c===o.b)return-1}}return Math.sign(l.a-l.b)}const Fl=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Ml(n){var e;const t=getComputedStyle((e=Wn(n))!==null&&e!==void 0?e:n).display;return t==="flex"||t==="inline-flex"}function Il(n){const e=getComputedStyle(n);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Ml(n))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||Fl.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function nn(n){let e=n.length;for(;e--;){const t=n[e];if(G(t,"Missing node"),Il(t))return t}return null}function sn(n){return n&&Number(getComputedStyle(n).zIndex)||0}function ln(n){const e=[];for(;n;)e.push(n),n=Wn(n);return e}function Wn(n){const{parentNode:e}=n;return e&&e instanceof ShadowRoot?e.host:e}const Gn=1,Vn=2,Xn=4,Qn=8,Ll=El()==="coarse";let xe=[],_e=!1,De=new Map,yt=new Map;const Qe=new Set;function Ol(n,e,t,s,l){var i;const{ownerDocument:o}=e,a={direction:t,element:e,hitAreaMargins:s,setResizeHandlerState:l},c=(i=De.get(o))!==null&&i!==void 0?i:0;return De.set(o,c+1),Qe.add(a),ht(),function(){var f;yt.delete(n),Qe.delete(a);const u=(f=De.get(o))!==null&&f!==void 0?f:1;if(De.set(o,u-1),ht(),u===1&&De.delete(o),xe.includes(a)){const h=xe.indexOf(a);h>=0&&xe.splice(h,1),Vt(),l("up",!0,null)}}}function Rl(n){const{target:e}=n,{x:t,y:s}=bt(n);_e=!0,Gt({target:e,x:t,y:s}),ht(),xe.length>0&&(mt("down",n),n.preventDefault(),Yn(e)||n.stopImmediatePropagation())}function Et(n){const{x:e,y:t}=bt(n);if(_e&&n.buttons===0&&(_e=!1,mt("up",n)),!_e){const{target:s}=n;Gt({target:s,x:e,y:t})}mt("move",n),Vt(),xe.length>0&&n.preventDefault()}function Dt(n){const{target:e}=n,{x:t,y:s}=bt(n);yt.clear(),_e=!1,xe.length>0&&(n.preventDefault(),Yn(e)||n.stopImmediatePropagation()),mt("up",n),Gt({target:e,x:t,y:s}),Vt(),ht()}function Yn(n){let e=n;for(;e;){if(e.hasAttribute(se.resizeHandle))return!0;e=e.parentElement}return!1}function Gt({target:n,x:e,y:t}){xe.splice(0);let s=null;(n instanceof HTMLElement||n instanceof SVGElement)&&(s=n),Qe.forEach(l=>{const{element:i,hitAreaMargins:o}=l,a=i.getBoundingClientRect(),{bottom:c,left:d,right:f,top:u}=a,h=Ll?o.coarse:o.fine;if(e>=d-h&&e<=f+h&&t>=u-h&&t<=c+h){if(s!==null&&document.contains(s)&&i!==s&&!i.contains(s)&&!s.contains(i)&&Tl(s,i)>0){let p=s,g=!1;for(;p&&!p.contains(i);){if(Dl(p.getBoundingClientRect(),a)){g=!0;break}p=p.parentElement}if(g)return}xe.push(l)}})}function Tt(n,e){yt.set(n,e)}function Vt(){let n=!1,e=!1;xe.forEach(s=>{const{direction:l}=s;l==="horizontal"?n=!0:e=!0});let t=0;yt.forEach(s=>{t|=s}),n&&e?Pt("intersection",t):n?Pt("horizontal",t):e?Pt("vertical",t):Pl()}let Ft=new AbortController;function ht(){Ft.abort(),Ft=new AbortController;const n={capture:!0,signal:Ft.signal};Qe.size&&(_e?(xe.length>0&&De.forEach((e,t)=>{const{body:s}=t;e>0&&(s.addEventListener("contextmenu",Dt,n),s.addEventListener("pointerleave",Et,n),s.addEventListener("pointermove",Et,n))}),window.addEventListener("pointerup",Dt,n),window.addEventListener("pointercancel",Dt,n)):De.forEach((e,t)=>{const{body:s}=t;e>0&&(s.addEventListener("pointerdown",Rl,n),s.addEventListener("pointermove",Et,n))}))}function mt(n,e){Qe.forEach(t=>{const{setResizeHandlerState:s}=t,l=xe.includes(t);s(n,l,e)})}function Al(){const[n,e]=S.useState(0);return S.useCallback(()=>e(t=>t+1),[])}function G(n,e){if(!n)throw console.error(e),Error(e)}function Me(n,e,t=Kt){return n.toFixed(t)===e.toFixed(t)?0:n>e?1:-1}function we(n,e,t=Kt){return Me(n,e,t)===0}function me(n,e,t){return Me(n,e,t)===0}function _l(n,e,t){if(n.length!==e.length)return!1;for(let s=0;s<n.length;s++){const l=n[s],i=e[s];if(!me(l,i,t))return!1}return!0}function Ae({panelConstraints:n,panelIndex:e,size:t}){const s=n[e];G(s!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:l=0,collapsible:i,maxSize:o=100,minSize:a=0}=s;if(Me(t,a)<0)if(i){const c=(l+a)/2;Me(t,c)<0?t=l:t=a}else t=a;return t=Math.min(o,t),t=parseFloat(t.toFixed(Kt)),t}function He({delta:n,initialLayout:e,panelConstraints:t,pivotIndices:s,prevLayout:l,trigger:i}){if(me(n,0))return e;const o=[...e],[a,c]=s;G(a!=null,"Invalid first pivot index"),G(c!=null,"Invalid second pivot index");let d=0;if(i==="keyboard"){{const u=n<0?c:a,h=t[u];G(h,`Panel constraints not found for index ${u}`);const{collapsedSize:m=0,collapsible:p,minSize:g=0}=h;if(p){const b=e[u];if(G(b!=null,`Previous layout not found for panel index ${u}`),me(b,m)){const x=g-b;Me(x,Math.abs(n))>0&&(n=n<0?0-x:x)}}}{const u=n<0?a:c,h=t[u];G(h,`No panel constraints found for index ${u}`);const{collapsedSize:m=0,collapsible:p,minSize:g=0}=h;if(p){const b=e[u];if(G(b!=null,`Previous layout not found for panel index ${u}`),me(b,g)){const x=b-m;Me(x,Math.abs(n))>0&&(n=n<0?0-x:x)}}}}{const u=n<0?1:-1;let h=n<0?c:a,m=0;for(;;){const g=e[h];G(g!=null,`Previous layout not found for panel index ${h}`);const x=Ae({panelConstraints:t,panelIndex:h,size:100})-g;if(m+=x,h+=u,h<0||h>=t.length)break}const p=Math.min(Math.abs(n),Math.abs(m));n=n<0?0-p:p}{let h=n<0?a:c;for(;h>=0&&h<t.length;){const m=Math.abs(n)-Math.abs(d),p=e[h];G(p!=null,`Previous layout not found for panel index ${h}`);const g=p-m,b=Ae({panelConstraints:t,panelIndex:h,size:g});if(!me(p,b)&&(d+=p-b,o[h]=b,d.toPrecision(3).localeCompare(Math.abs(n).toPrecision(3),void 0,{numeric:!0})>=0))break;n<0?h--:h++}}if(_l(l,o))return l;{const u=n<0?c:a,h=e[u];G(h!=null,`Previous layout not found for panel index ${u}`);const m=h+d,p=Ae({panelConstraints:t,panelIndex:u,size:m});if(o[u]=p,!me(p,m)){let g=m-p,x=n<0?c:a;for(;x>=0&&x<t.length;){const y=o[x];G(y!=null,`Previous layout not found for panel index ${x}`);const j=y+g,N=Ae({panelConstraints:t,panelIndex:x,size:j});if(me(y,N)||(g-=N-y,o[x]=N),me(g,0))break;n>0?x--:x++}}}const f=o.reduce((u,h)=>h+u,0);return me(f,100)?o:l}function Ul({layout:n,panelsArray:e,pivotIndices:t}){let s=0,l=100,i=0,o=0;const a=t[0];G(a!=null,"No pivot index found"),e.forEach((u,h)=>{const{constraints:m}=u,{maxSize:p=100,minSize:g=0}=m;h===a?(s=g,l=p):(i+=g,o+=p)});const c=Math.min(l,100-i),d=Math.max(s,100-o),f=n[a];return{valueMax:c,valueMin:d,valueNow:f}}function Ye(n,e=document){return Array.from(e.querySelectorAll(`[${se.resizeHandleId}][data-panel-group-id="${n}"]`))}function Zn(n,e,t=document){const l=Ye(n,t).findIndex(i=>i.getAttribute(se.resizeHandleId)===e);return l??null}function Jn(n,e,t){const s=Zn(n,e,t);return s!=null?[s,s+1]:[-1,-1]}function es(n,e=document){var t;if(e instanceof HTMLElement&&(e==null||(t=e.dataset)===null||t===void 0?void 0:t.panelGroupId)==n)return e;const s=e.querySelector(`[data-panel-group][data-panel-group-id="${n}"]`);return s||null}function vt(n,e=document){const t=e.querySelector(`[${se.resizeHandleId}="${n}"]`);return t||null}function Bl(n,e,t,s=document){var l,i,o,a;const c=vt(e,s),d=Ye(n,s),f=c?d.indexOf(c):-1,u=(l=(i=t[f])===null||i===void 0?void 0:i.id)!==null&&l!==void 0?l:null,h=(o=(a=t[f+1])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null;return[u,h]}function Hl({committedValuesRef:n,eagerValuesRef:e,groupId:t,layout:s,panelDataArray:l,panelGroupElement:i,setLayout:o}){S.useRef({didWarnAboutMissingResizeHandle:!1}),Te(()=>{if(!i)return;const a=Ye(t,i);for(let c=0;c<l.length-1;c++){const{valueMax:d,valueMin:f,valueNow:u}=Ul({layout:s,panelsArray:l,pivotIndices:[c,c+1]}),h=a[c];if(h!=null){const m=l[c];G(m,`No panel data found for index "${c}"`),h.setAttribute("aria-controls",m.id),h.setAttribute("aria-valuemax",""+Math.round(d)),h.setAttribute("aria-valuemin",""+Math.round(f)),h.setAttribute("aria-valuenow",u!=null?""+Math.round(u):"")}}return()=>{a.forEach((c,d)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[t,s,l,i]),S.useEffect(()=>{if(!i)return;const a=e.current;G(a,"Eager values not found");const{panelDataArray:c}=a,d=es(t,i);G(d!=null,`No group found for id "${t}"`);const f=Ye(t,i);G(f,`No resize handles found for group id "${t}"`);const u=f.map(h=>{const m=h.getAttribute(se.resizeHandleId);G(m,"Resize handle element has no handle id attribute");const[p,g]=Bl(t,m,c,i);if(p==null||g==null)return()=>{};const b=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const y=c.findIndex(j=>j.id===p);if(y>=0){const j=c[y];G(j,`No panel data found for index ${y}`);const N=s[y],{collapsedSize:C=0,collapsible:k,minSize:w=0}=j.constraints;if(N!=null&&k){const B=He({delta:me(N,C)?w-C:C-N,initialLayout:s,panelConstraints:c.map(R=>R.constraints),pivotIndices:Jn(t,m,i),prevLayout:s,trigger:"keyboard"});s!==B&&o(B)}}break}}};return h.addEventListener("keydown",b),()=>{h.removeEventListener("keydown",b)}});return()=>{u.forEach(h=>h())}},[i,n,e,t,s,l,o])}function rn(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function ts(n,e){const t=n==="horizontal",{x:s,y:l}=bt(e);return t?s:l}function ql(n,e,t,s,l){const i=t==="horizontal",o=vt(e,l);G(o,`No resize handle element found for id "${e}"`);const a=o.getAttribute(se.groupId);G(a,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=s;const d=ts(t,n),f=es(a,l);G(f,`No group element found for id "${a}"`);const u=f.getBoundingClientRect(),h=i?u.width:u.height;return(d-c)/h*100}function Kl(n,e,t,s,l,i){if(Hn(n)){const o=t==="horizontal";let a=0;n.shiftKey?a=100:l!=null?a=l:a=10;let c=0;switch(n.key){case"ArrowDown":c=o?0:a;break;case"ArrowLeft":c=o?-a:0;break;case"ArrowRight":c=o?a:0;break;case"ArrowUp":c=o?0:-a;break;case"End":c=100;break;case"Home":c=-100;break}return c}else return s==null?0:ql(n,e,t,s,i)}function Wl({panelDataArray:n}){const e=Array(n.length),t=n.map(i=>i.constraints);let s=0,l=100;for(let i=0;i<n.length;i++){const o=t[i];G(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;a!=null&&(s++,e[i]=a,l-=a)}for(let i=0;i<n.length;i++){const o=t[i];G(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;if(a!=null)continue;const c=n.length-s,d=l/c;s++,e[i]=d,l-=d}return e}function Ie(n,e,t){e.forEach((s,l)=>{const i=n[l];G(i,`Panel data not found for index ${l}`);const{callbacks:o,constraints:a,id:c}=i,{collapsedSize:d=0,collapsible:f}=a,u=t[c];if(u==null||s!==u){t[c]=s;const{onCollapse:h,onExpand:m,onResize:p}=o;p&&p(s,u),f&&(h||m)&&(m&&(u==null||we(u,d))&&!we(s,d)&&m(),h&&(u==null||!we(u,d))&&we(s,d)&&h())}})}function at(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t])return!1;return!0}function Gl({defaultSize:n,dragState:e,layout:t,panelData:s,panelIndex:l,precision:i=3}){const o=t[l];let a;return o==null?a=n!=null?n.toPrecision(i):"1":s.length===1?a="1":a=o.toPrecision(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function Vl(n,e=10){let t=null;return(...l)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...l)},e)}}function on(n){try{if(typeof localStorage<"u")n.getItem=e=>localStorage.getItem(e),n.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),n.getItem=()=>null,n.setItem=()=>{}}}function ns(n){return`react-resizable-panels:${n}`}function ss(n){return n.map(e=>{const{constraints:t,id:s,idIsFromProps:l,order:i}=e;return l?s:i?`${i}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function ls(n,e){try{const t=ns(n),s=e.getItem(t);if(s){const l=JSON.parse(s);if(typeof l=="object"&&l!=null)return l}}catch{}return null}function Xl(n,e,t){var s,l;const i=(s=ls(n,t))!==null&&s!==void 0?s:{},o=ss(e);return(l=i[o])!==null&&l!==void 0?l:null}function Ql(n,e,t,s,l){var i;const o=ns(n),a=ss(e),c=(i=ls(n,l))!==null&&i!==void 0?i:{};c[a]={expandToSizes:Object.fromEntries(t.entries()),layout:s};try{l.setItem(o,JSON.stringify(c))}catch(d){console.error(d)}}function an({layout:n,panelConstraints:e}){const t=[...n],s=t.reduce((i,o)=>i+o,0);if(t.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${t.map(i=>`${i}%`).join(", ")}`);if(!me(s,100)&&t.length>0)for(let i=0;i<e.length;i++){const o=t[i];G(o!=null,`No layout data found for index ${i}`);const a=100/s*o;t[i]=a}let l=0;for(let i=0;i<e.length;i++){const o=t[i];G(o!=null,`No layout data found for index ${i}`);const a=Ae({panelConstraints:e,panelIndex:i,size:o});o!=a&&(l+=o-a,t[i]=a)}if(!me(l,0))for(let i=0;i<e.length;i++){const o=t[i];G(o!=null,`No layout data found for index ${i}`);const a=o+l,c=Ae({panelConstraints:e,panelIndex:i,size:a});if(o!==c&&(l-=c-o,t[i]=c,me(l,0)))break}return t}const Yl=100,qe={getItem:n=>(on(qe),qe.getItem(n)),setItem:(n,e)=>{on(qe),qe.setItem(n,e)}},cn={};function rs({autoSaveId:n=null,children:e,className:t="",direction:s,forwardedRef:l,id:i=null,onLayout:o=null,keyboardResizeBy:a=null,storage:c=qe,style:d,tagName:f="div",...u}){const h=Wt(i),m=S.useRef(null),[p,g]=S.useState(null),[b,x]=S.useState([]),y=Al(),j=S.useRef({}),N=S.useRef(new Map),C=S.useRef(0),k=S.useRef({autoSaveId:n,direction:s,dragState:p,id:h,keyboardResizeBy:a,onLayout:o,storage:c}),w=S.useRef({layout:b,panelDataArray:[],panelDataArrayChanged:!1});S.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),S.useImperativeHandle(l,()=>({getId:()=>k.current.id,getLayout:()=>{const{layout:z}=w.current;return z},setLayout:z=>{const{onLayout:F}=k.current,{layout:I,panelDataArray:L}=w.current,D=an({layout:z,panelConstraints:L.map(A=>A.constraints)});rn(I,D)||(x(D),w.current.layout=D,F&&F(D),Ie(L,D,j.current))}}),[]),Te(()=>{k.current.autoSaveId=n,k.current.direction=s,k.current.dragState=p,k.current.id=h,k.current.onLayout=o,k.current.storage=c}),Hl({committedValuesRef:k,eagerValuesRef:w,groupId:h,layout:b,panelDataArray:w.current.panelDataArray,setLayout:x,panelGroupElement:m.current}),S.useEffect(()=>{const{panelDataArray:z}=w.current;if(n){if(b.length===0||b.length!==z.length)return;let F=cn[n];F==null&&(F=Vl(Ql,Yl),cn[n]=F);const I=[...z],L=new Map(N.current);F(n,I,L,b,c)}},[n,b,c]),S.useEffect(()=>{});const B=S.useCallback(z=>{const{onLayout:F}=k.current,{layout:I,panelDataArray:L}=w.current;if(z.constraints.collapsible){const D=L.map(he=>he.constraints),{collapsedSize:A=0,panelSize:Q,pivotIndices:te}=Ee(L,z,I);if(G(Q!=null,`Panel size not found for panel "${z.id}"`),!we(Q,A)){N.current.set(z.id,Q);const P=Oe(L,z)===L.length-1?Q-A:A-Q,V=He({delta:P,initialLayout:I,panelConstraints:D,pivotIndices:te,prevLayout:I,trigger:"imperative-api"});at(I,V)||(x(V),w.current.layout=V,F&&F(V),Ie(L,V,j.current))}}},[]),R=S.useCallback((z,F)=>{const{onLayout:I}=k.current,{layout:L,panelDataArray:D}=w.current;if(z.constraints.collapsible){const A=D.map(ne=>ne.constraints),{collapsedSize:Q=0,panelSize:te=0,minSize:he=0,pivotIndices:P}=Ee(D,z,L),V=F??he;if(we(te,Q)){const ne=N.current.get(z.id),ge=ne!=null&&ne>=V?ne:V,$e=Oe(D,z)===D.length-1?te-ge:ge-te,oe=He({delta:$e,initialLayout:L,panelConstraints:A,pivotIndices:P,prevLayout:L,trigger:"imperative-api"});at(L,oe)||(x(oe),w.current.layout=oe,I&&I(oe),Ie(D,oe,j.current))}}},[]),_=S.useCallback(z=>{const{layout:F,panelDataArray:I}=w.current,{panelSize:L}=Ee(I,z,F);return G(L!=null,`Panel size not found for panel "${z.id}"`),L},[]),v=S.useCallback((z,F)=>{const{panelDataArray:I}=w.current,L=Oe(I,z);return Gl({defaultSize:F,dragState:p,layout:b,panelData:I,panelIndex:L})},[p,b]),M=S.useCallback(z=>{const{layout:F,panelDataArray:I}=w.current,{collapsedSize:L=0,collapsible:D,panelSize:A}=Ee(I,z,F);return G(A!=null,`Panel size not found for panel "${z.id}"`),D===!0&&we(A,L)},[]),Z=S.useCallback(z=>{const{layout:F,panelDataArray:I}=w.current,{collapsedSize:L=0,collapsible:D,panelSize:A}=Ee(I,z,F);return G(A!=null,`Panel size not found for panel "${z.id}"`),!D||Me(A,L)>0},[]),U=S.useCallback(z=>{const{panelDataArray:F}=w.current;F.push(z),F.sort((I,L)=>{const D=I.order,A=L.order;return D==null&&A==null?0:D==null?-1:A==null?1:D-A}),w.current.panelDataArrayChanged=!0,y()},[y]);Te(()=>{if(w.current.panelDataArrayChanged){w.current.panelDataArrayChanged=!1;const{autoSaveId:z,onLayout:F,storage:I}=k.current,{layout:L,panelDataArray:D}=w.current;let A=null;if(z){const te=Xl(z,D,I);te&&(N.current=new Map(Object.entries(te.expandToSizes)),A=te.layout)}A==null&&(A=Wl({panelDataArray:D}));const Q=an({layout:A,panelConstraints:D.map(te=>te.constraints)});rn(L,Q)||(x(Q),w.current.layout=Q,F&&F(Q),Ie(D,Q,j.current))}}),Te(()=>{const z=w.current;return()=>{z.layout=[]}},[]);const O=S.useCallback(z=>{let F=!1;const I=m.current;return I&&window.getComputedStyle(I,null).getPropertyValue("direction")==="rtl"&&(F=!0),function(D){D.preventDefault();const A=m.current;if(!A)return()=>null;const{direction:Q,dragState:te,id:he,keyboardResizeBy:P,onLayout:V}=k.current,{layout:ne,panelDataArray:ge}=w.current,{initialLayout:Se}=te??{},$e=Jn(he,z,A);let oe=Kl(D,z,Q,te,P,A);const rt=Q==="horizontal";rt&&F&&(oe=-oe);const zt=ge.map(Ct=>Ct.constraints),Pe=He({delta:oe,initialLayout:Se??ne,panelConstraints:zt,pivotIndices:$e,prevLayout:ne,trigger:Hn(D)?"keyboard":"mouse-or-touch"}),it=!at(ne,Pe);(qn(D)||Kn(D))&&C.current!=oe&&(C.current=oe,!it&&oe!==0?rt?Tt(z,oe<0?Gn:Vn):Tt(z,oe<0?Xn:Qn):Tt(z,0)),it&&(x(Pe),w.current.layout=Pe,V&&V(Pe),Ie(ge,Pe,j.current))}},[]),H=S.useCallback((z,F)=>{const{onLayout:I}=k.current,{layout:L,panelDataArray:D}=w.current,A=D.map(ne=>ne.constraints),{panelSize:Q,pivotIndices:te}=Ee(D,z,L);G(Q!=null,`Panel size not found for panel "${z.id}"`);const P=Oe(D,z)===D.length-1?Q-F:F-Q,V=He({delta:P,initialLayout:L,panelConstraints:A,pivotIndices:te,prevLayout:L,trigger:"imperative-api"});at(L,V)||(x(V),w.current.layout=V,I&&I(V),Ie(D,V,j.current))},[]),W=S.useCallback((z,F)=>{const{layout:I,panelDataArray:L}=w.current,{collapsedSize:D=0,collapsible:A}=F,{collapsedSize:Q=0,collapsible:te,maxSize:he=100,minSize:P=0}=z.constraints,{panelSize:V}=Ee(L,z,I);V!=null&&(A&&te&&we(V,D)?we(D,Q)||H(z,Q):V<P?H(z,P):V>he&&H(z,he))},[H]),q=S.useCallback((z,F)=>{const{direction:I}=k.current,{layout:L}=w.current;if(!m.current)return;const D=vt(z,m.current);G(D,`Drag handle element not found for id "${z}"`);const A=ts(I,F);g({dragHandleId:z,dragHandleRect:D.getBoundingClientRect(),initialCursorPosition:A,initialLayout:L})},[]),ee=S.useCallback(()=>{g(null)},[]),Y=S.useCallback(z=>{const{panelDataArray:F}=w.current,I=Oe(F,z);I>=0&&(F.splice(I,1),delete j.current[z.id],w.current.panelDataArrayChanged=!0,y())},[y]),T=S.useMemo(()=>({collapsePanel:B,direction:s,dragState:p,expandPanel:R,getPanelSize:_,getPanelStyle:v,groupId:h,isPanelCollapsed:M,isPanelExpanded:Z,reevaluatePanelConstraints:W,registerPanel:U,registerResizeHandle:O,resizePanel:H,startDragging:q,stopDragging:ee,unregisterPanel:Y,panelGroupElement:m.current}),[B,p,s,R,_,v,h,M,Z,W,U,O,H,q,ee,Y]),K={display:"flex",flexDirection:s==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return S.createElement(gt.Provider,{value:T},S.createElement(f,{...u,children:e,className:t,id:i,ref:m,style:{...K,...d},[se.group]:"",[se.groupDirection]:s,[se.groupId]:h}))}const is=S.forwardRef((n,e)=>S.createElement(rs,{...n,forwardedRef:e}));rs.displayName="PanelGroup";is.displayName="forwardRef(PanelGroup)";function Oe(n,e){return n.findIndex(t=>t===e||t.id===e.id)}function Ee(n,e,t){const s=Oe(n,e),i=s===n.length-1?[s-1,s]:[s,s+1],o=t[s];return{...e.constraints,panelSize:o,pivotIndices:i}}function Zl({disabled:n,handleId:e,resizeHandler:t,panelGroupElement:s}){S.useEffect(()=>{if(n||t==null||s==null)return;const l=vt(e,s);if(l==null)return;const i=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),t(o);break}case"F6":{o.preventDefault();const a=l.getAttribute(se.groupId);G(a,`No group element found for id "${a}"`);const c=Ye(a,s),d=Zn(a,e,s);G(d!==null,`No resize element found for id "${e}"`);const f=o.shiftKey?d>0?d-1:c.length-1:d+1<c.length?d+1:0;c[f].focus();break}}};return l.addEventListener("keydown",i),()=>{l.removeEventListener("keydown",i)}},[s,n,e,t])}function os({children:n=null,className:e="",disabled:t=!1,hitAreaMargins:s,id:l,onBlur:i,onClick:o,onDragging:a,onFocus:c,onPointerDown:d,onPointerUp:f,style:u={},tabIndex:h=0,tagName:m="div",...p}){var g,b;const x=S.useRef(null),y=S.useRef({onClick:o,onDragging:a,onPointerDown:d,onPointerUp:f});S.useEffect(()=>{y.current.onClick=o,y.current.onDragging=a,y.current.onPointerDown=d,y.current.onPointerUp=f});const j=S.useContext(gt);if(j===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:N,groupId:C,registerResizeHandle:k,startDragging:w,stopDragging:B,panelGroupElement:R}=j,_=Wt(l),[v,M]=S.useState("inactive"),[Z,U]=S.useState(!1),[O,H]=S.useState(null),W=S.useRef({state:v});Te(()=>{W.current.state=v}),S.useEffect(()=>{if(t)H(null);else{const T=k(_);H(()=>T)}},[t,_,k]);const q=(g=s?.coarse)!==null&&g!==void 0?g:15,ee=(b=s?.fine)!==null&&b!==void 0?b:5;S.useEffect(()=>{if(t||O==null)return;const T=x.current;G(T,"Element ref not attached");let K=!1;return Ol(_,T,N,{coarse:q,fine:ee},(F,I,L)=>{if(!I){M("inactive");return}switch(F){case"down":{M("drag"),K=!1,G(L,'Expected event to be defined for "down" action'),w(_,L);const{onDragging:D,onPointerDown:A}=y.current;D?.(!0),A?.();break}case"move":{const{state:D}=W.current;K=!0,D!=="drag"&&M("hover"),G(L,'Expected event to be defined for "move" action'),O(L);break}case"up":{M("hover"),B();const{onClick:D,onDragging:A,onPointerUp:Q}=y.current;A?.(!1),Q?.(),K||D?.();break}}})},[q,N,t,ee,k,_,O,w,B]),Zl({disabled:t,handleId:_,resizeHandler:O,panelGroupElement:R});const Y={touchAction:"none",userSelect:"none"};return S.createElement(m,{...p,children:n,className:e,id:l,onBlur:()=>{U(!1),i?.()},onFocus:()=>{U(!0),c?.()},ref:x,role:"separator",style:{...Y,...u},tabIndex:h,[se.groupDirection]:N,[se.groupId]:C,[se.resizeHandle]:"",[se.resizeHandleActive]:v==="drag"?"pointer":Z?"keyboard":void 0,[se.resizeHandleEnabled]:!t,[se.resizeHandleId]:_,[se.resizeHandleState]:v})}os.displayName="PanelResizeHandle";function Jl(n){const e=$.c(10);let t,s,l;e[0]!==n?({className:t,ref:l,...s}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=l):(t=e[1],s=e[2],l=e[3]);let i;e[4]!==t?(i=ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),e[4]=t,e[5]=i):i=e[5];let o;return e[6]!==s||e[7]!==l||e[8]!==i?(o=r.jsx(is,{ref:l,"data-slot":"resizable-panel-group",className:i,...s}),e[6]=s,e[7]=l,e[8]=i,e[9]=o):o=e[9],o}function dn(n){const e=$.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let s;return e[2]!==t?(s=r.jsx(Bn,{"data-slot":"resizable-panel",...t}),e[2]=t,e[3]=s):s=e[3],s}function er(n){const e=$.c(12);let t,s,l;e[0]!==n?({withHandle:l,className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=l):(t=e[1],s=e[2],l=e[3]);let i;e[4]!==t?(i=ce("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),e[4]=t,e[5]=i):i=e[5];let o;e[6]!==l?(o=l&&r.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:r.jsx(Fs,{className:"size-2.5"})}),e[6]=l,e[7]=o):o=e[7];let a;return e[8]!==s||e[9]!==i||e[10]!==o?(a=r.jsx(os,{"data-slot":"resizable-handle",className:i,...s,children:o}),e[8]=s,e[9]=i,e[10]=o,e[11]=a):a=e[11],a}function tr(n){if(!n||n.includes("\\")||n.includes("..")||n.includes("\0"))return!0;try{const e=decodeURIComponent(n);if(e.includes("\\")||e.includes("..")||e.includes("\0"))return!0;if(e!==n&&e.includes("/")){const t=(n.match(/\//g)??[]).length;if((e.match(/\//g)??[]).length>t)return!0}return!1}catch{return!0}}function nr(n){if(tr(n))throw new Error(`Invalid block key: ${n||"(empty)"}`)}function sr(n){try{return decodeURIComponent(n)}catch{return n}}function lr(n){return nr(n),encodeURIComponent(n)}function rr(n){return`.deco/blocks/${lr(n)}.json`}function Mo(n){return`/${rr(n)}`}const Io=1e4,ir=3;function Ot(n){return n.trim()?(n.startsWith("/")?n:`/${n}`).replace(/\/+/g,"/"):"/"}function Xt(n){return n.startsWith("/")?n.slice(1):n}function pt(n){return n.trim()?n.startsWith("/")?n:`/${n}`:"/"}function or(n){const e=pt(n);if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.pop(),t.length===0?"/":`/${t.join("/")}`}function Lo(n,e){const t=e.replace(/^\/+|\/+$/g,"");return pt(t?`${n==="/"?"":n}/${t}`:n)}function Oo(n,e){return e==="directory"?n:or(n)}function Ro(n){const e=n.trim();return e?e.includes("/")||e.includes("\\")||e.includes("..")||e.includes("\0")?"Name cannot contain /, \\, or ..":null:"Name is required"}function ar(n){const e=Xt(n);return e?e.split("/").filter(Boolean).length:0}function Ao(n,e,t,s=!1){return{files:[...new Set([...n,...t.files])],directories:[...new Set([...e,...t.directories??[]])],truncated:s||!!t.truncated}}function _o(n,e){return ar(n)>=ir&&!e.has(n)}function Uo(n,e,t=[]){const s=Xt(n);if(e.includes(s)||t.includes(s))return!0;if(!s)return!1;const l=`${s}/`;return e.some(i=>i.startsWith(l))||t.some(i=>i.startsWith(l))}function Bo(n){const e=Xt(n),t=".deco/blocks/";if(!e.startsWith(t)||!e.endsWith(".json"))return null;const s=e.slice(t.length,-5);return sr(s)}function cr(n){if(!n)return"plaintext";const e=n.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?"typescript":e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?"javascript":e.endsWith(".json")?"json":e.endsWith(".md")||e.endsWith(".mdx")?"markdown":e.endsWith(".css")?"css":e.endsWith(".scss")?"scss":e.endsWith(".html")?"html":e.endsWith(".yaml")||e.endsWith(".yml")?"yaml":e.endsWith(".xml")||e.endsWith(".svg")?"xml":e.endsWith(".py")?"python":e.endsWith(".sql")?"sql":e.endsWith(".sh")?"shell":"plaintext"}function Ho(n){const e=Ot(n).split("/").filter(Boolean),t=["/"];let s="";for(const l of e.slice(0,-1))s+=`/${l}`,t.push(s);return t}function qo(n,e=[]){const t={children:[]},s=i=>{const a=Ot(i).split("/").filter(Boolean);let c=t,d="";for(const f of a){d+=`/${f}`;let u=c.children.find(h=>h.name===f);u?u.kind==="file"&&(u.kind="directory"):(u={name:f,path:d,kind:"directory",children:[]},c.children.push(u)),c=u}};for(const i of n){const a=Ot(i).split("/").filter(Boolean);let c=t,d="";a.forEach((f,u)=>{d+=`/${f}`;const h=u===a.length-1;let m=c.children.find(p=>p.name===f);m||(m={name:f,path:d,kind:h?"file":"directory",children:[]},c.children.push(m)),c=m})}for(const i of e)s(pt(i));const l=i=>{i.sort((o,a)=>o.kind!==a.kind?o.kind==="directory"?-1:1:o.name.localeCompare(a.name));for(const o of i)o.children.length>0&&l(o.children)};return l(t.children),t.children}function dr(n,e,t=0){const s=[];for(const l of n)l.name!==".gitkeep"&&(s.push({node:l,depth:t}),l.kind==="directory"&&l.children.length>0&&e.has(l.path)&&s.push(...dr(l.children,e,t+1)));return s}function Ko(n){return n.split(`
|
|
1
|
+
import{c as $,C as de,n as Ze,d as We,K as X,m as ie,aY as wn,r as S,ap as zs,l as ce,j as r,U as Cs,i as $s,B as J,aL as jn,t as ue,w as Ps,L as Es,e as Ds,b as kn,u as Sn,E as Pt}from"./index-BsTqVTb-.js";import{i as Ts}from"./ChevronRight-ErROf0f-.js";import{s as Nn}from"./Eye-CkivEXGk.js";import{n as Ve,i as xt}from"./Globe01-D2NgZQ5r.js";import{b as Fs,c as Ms,e as Is,i as Ls,f as zn,a as Cn,g as Os,d as Rs}from"./ZoomOut-mUMV6TFE.js";import{a as dt}from"./Palette-X5dCo6tM.js";import{s as As}from"./Plus-CAm5Bdmk.js";import{i as _s}from"./SearchLg-Dk8KacTp.js";import{t as Us}from"./Stars01-AmjYKoUt.js";import{i as ut}from"./Upload01-BZtw8yG4.js";import{s as $n}from"./XClose-NN9Ytu40.js";import{i as _t}from"./Zap-CQFWIf93.js";import{u as Pn}from"./use-mobile-B70Vai6R.js";import{f as Bs,a as Hs,b as qs,c as Ks,d as Ws,e as Gs,A as Vs,g as Xs}from"./alert-dialog-CcRl6dh7.js";import{D as En,a as Ue,d as Je,e as et,i as Dn,h as Qs,c as Ys}from"./dialog-BOOy_UpN.js";import{I as Xe}from"./input-Be-N8FL1.js";import{S as ae}from"./skeleton-DMppxm-y.js";import{F as ke,M as Ut,d as Tn}from"./file-type-icon-DPE-o4jz.js";import{T as Zs}from"./toolbar-DXcqQfQP.js";import{a as Js}from"./Package-r2-V_I1m.js";import{u as el}from"./use-debounced-value-DJ6FXRJ8.js";import{i as Fn}from"./DotsVertical-3sGXRvyQ.js";import{i as Mn}from"./Key01-CB3144XW.js";import{s as In}from"./Trash01-rL4weY4b.js";import{D as Bt,a as Ht,c as qt,d as Fe}from"./dropdown-menu-C177i7en.js";import{T as tl}from"./textarea-BqvSyTp9.js";import{t as nl}from"./ChevronDown-CTL_keEs.js";import{n as sl}from"./ChevronUp-5BPapW0x.js";import{i as ft}from"./X-DQEB-fUW.js";import{P as ll,b as rl,a as il}from"./popover-DqJyIDsr.js";import{b as be,T as ye,a as ve}from"./tooltip-C0WFaxn1.js";import{i as ol}from"./Check-CI4iU_MT.js";import{a as al}from"./Copy01-C_2NY45r.js";import{n as Ln}from"./LinkExternal01-CuC_KpxQ.js";import{l as cl,F as dl}from"./index-CAIjDQVz.js";import{i as ul}from"./LayoutLeft-DBbQVqI-.js";function On(n){return n.contentHash??`${n.size}-${n.updatedAt}`}function pe(n,e,t,s){const l=new URLSearchParams(s).toString();return`/api/${encodeURIComponent(n)}/fs/${encodeURIComponent(e)}/${t}${l?`?${l}`:""}`}async function fe(n,e,t){const s=await fetch(n,e);if(s.ok||t?.allow404&&s.status===404)return s;let l="";try{l=(await s.json()).error??""}catch{}throw new Error(l||`HTTP ${s.status}`)}function Kt(n,e){const t=$.c(11),{org:s}=de();let l;t[0]!==s.id||t[1]!==e||t[2]!==n?(l=X.orgFsList(s.id,n,e),t[0]=s.id,t[1]=e,t[2]=n,t[3]=l):l=t[3];let i;t[4]!==s.slug||t[5]!==e||t[6]!==n?(i=async()=>(await(await fe(pe(s.slug,n,"list",{path:e}))).json()).entries.toSorted(fl),t[4]=s.slug,t[5]=e,t[6]=n,t[7]=i):i=t[7];let o;return t[8]!==l||t[9]!==i?(o={queryKey:l,placeholderData:wn,queryFn:i},t[8]=l,t[9]=i,t[10]=o):o=t[10],ie(o)}function fl(n,e){return n.kind!==e.kind?n.kind==="dir"?-1:1:n.path.localeCompare(e.path)}function Rn(n,e,t){const s=$.c(15),{org:l}=de();let i;s[0]!==l.id||s[1]!==e||s[2]!==n?(i=X.orgFsStat(l.id,n??"",e),s[0]=l.id,s[1]=e,s[2]=n,s[3]=i):i=s[3];const o=n!==null;let a;s[4]!==t?(a=t?.refetchIntervalWhenAbsent?f=>f.state.data?!1:t.refetchIntervalWhenAbsent??!1:void 0,s[4]=t,s[5]=a):a=s[5];let c;s[6]!==l.slug||s[7]!==e||s[8]!==n?(c=async()=>{const f=await fe(pe(l.slug,n??"","stat",{path:e}),void 0,{allow404:!0});return f.status===404?null:(await f.json()).entry},s[6]=l.slug,s[7]=e,s[8]=n,s[9]=c):c=s[9];let d;return s[10]!==i||s[11]!==o||s[12]!==a||s[13]!==c?(d={queryKey:i,enabled:o,refetchInterval:a,queryFn:c},s[10]=i,s[11]=o,s[12]=a,s[13]=c,s[14]=d):d=s[14],ie(d)}function hl(n){const e=$.c(9),{org:t}=de();let s;e[0]!==t.id||e[1]!==n?(s=X.orgFsUsage(t.id,n),e[0]=t.id,e[1]=n,e[2]=s):s=e[2];let l;e[3]!==t.slug||e[4]!==n?(l=async()=>await(await fe(pe(t.slug,n,"usage"))).json(),e[3]=t.slug,e[4]=n,e[5]=l):l=e[5];let i;return e[6]!==s||e[7]!==l?(i={queryKey:s,queryFn:l},e[6]=s,e[7]=l,e[8]=i):i=e[8],ie(i)}function ml(n,e){const t=$.c(9),s=n===void 0?60:n,{org:l}=de();let i;t[0]!==l.id?(i=X.orgFsRecent(l.id),t[0]=l.id,t[1]=i):i=t[1];const o=e?.enabled;let a;t[2]!==s||t[3]!==l.slug?(a=async()=>(await(await fe(`/api/${encodeURIComponent(l.slug)}/fs/recent?limit=${s}`)).json()).entries,t[2]=s,t[3]=l.slug,t[4]=a):a=t[4];let c;return t[5]!==i||t[6]!==o||t[7]!==a?(c={queryKey:i,enabled:o,queryFn:a},t[5]=i,t[6]=o,t[7]=a,t[8]=c):c=t[8],ie(c)}function pl(n,e){const t=$.c(11),s=50,{org:l}=de();let i;t[0]!==l.id||t[1]!==n?(i=X.orgFsSearch(l.id,n),t[0]=l.id,t[1]=n,t[2]=i):i=t[2];const o=n.length>0;let a;t[3]!==s||t[4]!==l.slug||t[5]!==n?(a=async()=>(await(await fe(`/api/${encodeURIComponent(l.slug)}/fs/search?q=${encodeURIComponent(n)}&limit=${s}`)).json()).entries,t[3]=s,t[4]=l.slug,t[5]=n,t[6]=a):a=t[6];let c;return t[7]!==i||t[8]!==o||t[9]!==a?(c={queryKey:i,enabled:o,placeholderData:wn,queryFn:a},t[7]=i,t[8]=o,t[9]=a,t[10]=c):c=t[10],ie(c)}function Do(n){const e=$.c(8),{org:t}=de();let s;e[0]!==t.id?(s=X.orgFsSkills(t.id),e[0]=t.id,e[1]=s):s=e[1];const l=n?.enabled;let i;e[2]!==t.slug?(i=async()=>{const a=await fe(`/api/${encodeURIComponent(t.slug)}/fs/skills`),{skills:c}=await a.json();return c.map(xl)},e[2]=t.slug,e[3]=i):i=e[3];let o;return e[4]!==s||e[5]!==l||e[6]!==i?(o={queryKey:s,enabled:l,queryFn:i},e[4]=s,e[5]=l,e[6]=i,e[7]=o):o=e[7],ie(o)}function xl(n){return{volume:n.volume,path:n.path}}async function To(n){const e=await fe(`/api/${encodeURIComponent(n)}/fs/skills`),{skills:t}=await e.json();return t}async function gl(n,e,t){return(await fe(pe(n,e,"read",{path:t}))).text()}const bl=new Set(["md","mdx","markdown","txt","text"]),yl=25,vl=64*1024,wl=256*1024,jl=4;function kl(n){const e=n.lastIndexOf(".");return e===-1?!1:bl.has(n.slice(e+1).toLowerCase())}async function Fo(n,e,t){const s=t?`${t}/`:"",l=u=>u.startsWith(s)?u.slice(s.length):u,i=[],o=[],a=[{path:t,depth:0}];for(;a.length>0;){const u=a.shift();if(!u)break;let h;try{h=(await(await fe(pe(n,e,"list",{path:u.path}))).json()).entries}catch{continue}for(const m of[...h].sort((p,g)=>p.path.localeCompare(g.path))){if(m.kind==="dir"){u.depth<jl&&a.push({path:m.path,depth:u.depth+1});continue}kl(m.path)&&m.size<=vl&&i.length<yl?i.push(m.path):o.push(l(m.path))}}const c=await Promise.all(i.map(u=>gl(n,e,u).catch(()=>null))),d=[];let f=0;return i.forEach((u,h)=>{const m=c[h];if(m==null||f+m.length>wl){o.push(l(u));return}f+=m.length,d.push({relPath:l(u),content:m})}),d.sort((u,h)=>u.relPath==="SKILL.md"?-1:h.relPath==="SKILL.md"?1:u.relPath.localeCompare(h.relPath)),o.sort(),{files:d,omittedPaths:o}}function An(){const n=$.c(7),{org:e}=de();let t;n[0]!==e.id?(t=X.orgFsPublicSets(e.id),n[0]=e.id,n[1]=t):t=n[1];let s;n[2]!==e.slug?(s=async()=>(await(await fe(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,n[2]=e.slug,n[3]=s):s=n[3];let l;return n[4]!==t||n[5]!==s?(l={queryKey:t,staleTime:3e5,queryFn:s},n[4]=t,n[5]=s,n[6]=l):l=n[6],ie(l)}function Sl(n){const e=$.c(3),{org:t}=de();let s;return e[0]!==t.slug||e[1]!==n?(s=l=>pe(t.slug,n,"read",{path:l}),e[0]=t.slug,e[1]=n,e[2]=s):s=e[2],s}function tt(){const n=$.c(2),{org:e}=de();let t;return n[0]!==e.slug?(t=(s,l)=>pe(e.slug,s,"read",{path:l}),n[0]=e.slug,n[1]=t):t=n[1],t}function _n(n){const e=$.c(3),{org:t}=de();let s;return e[0]!==t||e[1]!==n?(s={mutationFn:async l=>(await(await fe(pe(t.slug,n,"file",{path:l.path}),{method:"PUT",headers:{"content-type":l.contentType??"text/html; charset=utf-8"},body:l.body})).json()).entry},e[0]=t,e[1]=n,e[2]=s):s=e[2],We(s)}function Nl(n){const e=$.c(18),{org:t}=de(),s=Ze();let l;e[0]!==t||e[1]!==n?(l=async d=>(await(await fe(pe(t.slug,n,"public",{path:d.path}),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({mode:d.mode,password:d.password})})).json()).entry,e[0]=t,e[1]=n,e[2]=l):l=e[2];let i;e[3]!==t||e[4]!==s||e[5]!==n?(i=async d=>{const f=X.orgFsStat(t.id,n,d.path);await s.cancelQueries({queryKey:f});const u=s.getQueryData(f),h=d.mode!=="private";return s.setQueryData(f,m=>m&&{...m,readPublic:h,effectivePublic:h,shareMode:d.mode}),{key:f,previous:u}},e[3]=t,e[4]=s,e[5]=n,e[6]=i):i=e[6];let o;e[7]!==s?(o=(d,f,u)=>{u&&s.setQueryData(u.key,u.previous)},e[7]=s,e[8]=o):o=e[8];let a;e[9]!==t||e[10]!==s||e[11]!==n?(a=(d,f,u)=>{s.invalidateQueries({queryKey:X.orgFsStat(t.id,n,u.path)}),s.invalidateQueries({queryKey:X.orgFsVolume(t.id,n)}),s.invalidateQueries({queryKey:X.orgFsRecent(t.id)}),s.invalidateQueries({queryKey:X.orgFsSearchRoot(t.id)})},e[9]=t,e[10]=s,e[11]=n,e[12]=a):a=e[12];let c;return e[13]!==l||e[14]!==i||e[15]!==o||e[16]!==a?(c={mutationFn:l,onMutate:i,onError:o,onSettled:a},e[13]=l,e[14]=i,e[15]=o,e[16]=a,e[17]=c):c=e[17],We(c)}function Lt(n){const e=$.c(26),{org:t}=de(),s=Ze();let l;e[0]!==t||e[1]!==s||e[2]!==n?(l=()=>{s.invalidateQueries({queryKey:X.orgFsVolume(t.id,n)}),s.invalidateQueries({queryKey:X.orgFsRecent(t.id)}),s.invalidateQueries({queryKey:X.orgFsSearchRoot(t.id)})},e[0]=t,e[1]=s,e[2]=n,e[3]=l):l=e[3];const i=l;let o;e[4]!==t||e[5]!==n?(o=async b=>{for(const x of b.files){const y=b.dir?`${b.dir}/${x.name}`:x.name;await fe(pe(t.slug,n,"file",{path:y}),{method:"PUT",headers:{"content-type":x.type||"application/octet-stream"},body:x})}},e[4]=t,e[5]=n,e[6]=o):o=e[6];let a;e[7]!==i||e[8]!==o?(a={mutationFn:o,onSettled:i},e[7]=i,e[8]=o,e[9]=a):a=e[9];const c=We(a);let d;e[10]!==t||e[11]!==n?(d=async b=>{await fe(pe(t.slug,n,"dir",{path:b}),{method:"POST"})},e[10]=t,e[11]=n,e[12]=d):d=e[12];let f;e[13]!==i||e[14]!==d?(f={mutationFn:d,onSuccess:i},e[13]=i,e[14]=d,e[15]=f):f=e[15];const u=We(f);let h;e[16]!==t||e[17]!==n?(h=async b=>{await fe(pe(t.slug,n,"file",{path:b}),{method:"DELETE"})},e[16]=t,e[17]=n,e[18]=h):h=e[18];let m;e[19]!==i||e[20]!==h?(m={mutationFn:h,onSuccess:i},e[19]=i,e[20]=h,e[21]=m):m=e[21];const p=We(m);let g;return e[22]!==u||e[23]!==p||e[24]!==c?(g={upload:c,mkdir:u,remove:p},e[22]=u,e[23]=p,e[24]=c,e[25]=g):g=e[25],g}const gt=S.createContext(null);gt.displayName="PanelGroupContext";const se={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Wt=10,Te=S.useLayoutEffect,tn=zs.useId,zl=typeof tn=="function"?tn:()=>null;let Cl=0;function Gt(n=null){const e=zl(),t=S.useRef(n||e||null);return t.current===null&&(t.current=""+Cl++),n??t.current}function Un({children:n,className:e="",collapsedSize:t,collapsible:s,defaultSize:l,forwardedRef:i,id:o,maxSize:a,minSize:c,onCollapse:d,onExpand:f,onResize:u,order:h,style:m,tagName:p="div",...g}){const b=S.useContext(gt);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:y,getPanelSize:j,getPanelStyle:N,groupId:C,isPanelCollapsed:k,reevaluatePanelConstraints:w,registerPanel:B,resizePanel:R,unregisterPanel:_}=b,v=Gt(o),M=S.useRef({callbacks:{onCollapse:d,onExpand:f,onResize:u},constraints:{collapsedSize:t,collapsible:s,defaultSize:l,maxSize:a,minSize:c},id:v,idIsFromProps:o!==void 0,order:h});S.useRef({didLogMissingDefaultSizeWarning:!1}),Te(()=>{const{callbacks:U,constraints:O}=M.current,H={...O};M.current.id=v,M.current.idIsFromProps=o!==void 0,M.current.order=h,U.onCollapse=d,U.onExpand=f,U.onResize=u,O.collapsedSize=t,O.collapsible=s,O.defaultSize=l,O.maxSize=a,O.minSize=c,(H.collapsedSize!==O.collapsedSize||H.collapsible!==O.collapsible||H.maxSize!==O.maxSize||H.minSize!==O.minSize)&&w(M.current,H)}),Te(()=>{const U=M.current;return B(U),()=>{_(U)}},[h,v,B,_]),S.useImperativeHandle(i,()=>({collapse:()=>{x(M.current)},expand:U=>{y(M.current,U)},getId(){return v},getSize(){return j(M.current)},isCollapsed(){return k(M.current)},isExpanded(){return!k(M.current)},resize:U=>{R(M.current,U)}}),[x,y,j,k,v,R]);const Z=N(M.current,l);return S.createElement(p,{...g,children:n,className:e,id:v,style:{...Z,...m},[se.groupId]:C,[se.panel]:"",[se.panelCollapsible]:s||void 0,[se.panelId]:v,[se.panelSize]:parseFloat(""+Z.flexGrow).toFixed(1)})}const Bn=S.forwardRef((n,e)=>S.createElement(Un,{...n,forwardedRef:e}));Un.displayName="Panel";Bn.displayName="forwardRef(Panel)";let Ot=null,ct=-1,ze=null;function $l(n,e){if(e){const t=(e&Gn)!==0,s=(e&Vn)!==0,l=(e&Xn)!==0,i=(e&Qn)!==0;if(t)return l?"se-resize":i?"ne-resize":"e-resize";if(s)return l?"sw-resize":i?"nw-resize":"w-resize";if(l)return"s-resize";if(i)return"n-resize"}switch(n){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Pl(){ze!==null&&(document.head.removeChild(ze),Ot=null,ze=null,ct=-1)}function Et(n,e){var t,s;const l=$l(n,e);if(Ot!==l){if(Ot=l,ze===null&&(ze=document.createElement("style"),document.head.appendChild(ze)),ct>=0){var i;(i=ze.sheet)===null||i===void 0||i.removeRule(ct)}ct=(t=(s=ze.sheet)===null||s===void 0?void 0:s.insertRule(`*{cursor: ${l} !important;}`))!==null&&t!==void 0?t:-1}}function Hn(n){return n.type==="keydown"}function qn(n){return n.type.startsWith("pointer")}function Kn(n){return n.type.startsWith("mouse")}function bt(n){if(qn(n)){if(n.isPrimary)return{x:n.clientX,y:n.clientY}}else if(Kn(n))return{x:n.clientX,y:n.clientY};return{x:1/0,y:1/0}}function El(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Dl(n,e,t){return n.x<e.x+e.width&&n.x+n.width>e.x&&n.y<e.y+e.height&&n.y+n.height>e.y}function Tl(n,e){if(n===e)throw new Error("Cannot compare node with itself");const t={a:ln(n),b:ln(e)};let s;for(;t.a.at(-1)===t.b.at(-1);)n=t.a.pop(),e=t.b.pop(),s=n;G(s,"Stacking order can only be calculated for elements with a common ancestor");const l={a:sn(nn(t.a)),b:sn(nn(t.b))};if(l.a===l.b){const i=s.childNodes,o={a:t.a.at(-1),b:t.b.at(-1)};let a=i.length;for(;a--;){const c=i[a];if(c===o.a)return 1;if(c===o.b)return-1}}return Math.sign(l.a-l.b)}const Fl=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Ml(n){var e;const t=getComputedStyle((e=Wn(n))!==null&&e!==void 0?e:n).display;return t==="flex"||t==="inline-flex"}function Il(n){const e=getComputedStyle(n);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Ml(n))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||Fl.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function nn(n){let e=n.length;for(;e--;){const t=n[e];if(G(t,"Missing node"),Il(t))return t}return null}function sn(n){return n&&Number(getComputedStyle(n).zIndex)||0}function ln(n){const e=[];for(;n;)e.push(n),n=Wn(n);return e}function Wn(n){const{parentNode:e}=n;return e&&e instanceof ShadowRoot?e.host:e}const Gn=1,Vn=2,Xn=4,Qn=8,Ll=El()==="coarse";let xe=[],_e=!1,De=new Map,yt=new Map;const Qe=new Set;function Ol(n,e,t,s,l){var i;const{ownerDocument:o}=e,a={direction:t,element:e,hitAreaMargins:s,setResizeHandlerState:l},c=(i=De.get(o))!==null&&i!==void 0?i:0;return De.set(o,c+1),Qe.add(a),ht(),function(){var f;yt.delete(n),Qe.delete(a);const u=(f=De.get(o))!==null&&f!==void 0?f:1;if(De.set(o,u-1),ht(),u===1&&De.delete(o),xe.includes(a)){const h=xe.indexOf(a);h>=0&&xe.splice(h,1),Xt(),l("up",!0,null)}}}function Rl(n){const{target:e}=n,{x:t,y:s}=bt(n);_e=!0,Vt({target:e,x:t,y:s}),ht(),xe.length>0&&(mt("down",n),n.preventDefault(),Yn(e)||n.stopImmediatePropagation())}function Dt(n){const{x:e,y:t}=bt(n);if(_e&&n.buttons===0&&(_e=!1,mt("up",n)),!_e){const{target:s}=n;Vt({target:s,x:e,y:t})}mt("move",n),Xt(),xe.length>0&&n.preventDefault()}function Tt(n){const{target:e}=n,{x:t,y:s}=bt(n);yt.clear(),_e=!1,xe.length>0&&(n.preventDefault(),Yn(e)||n.stopImmediatePropagation()),mt("up",n),Vt({target:e,x:t,y:s}),Xt(),ht()}function Yn(n){let e=n;for(;e;){if(e.hasAttribute(se.resizeHandle))return!0;e=e.parentElement}return!1}function Vt({target:n,x:e,y:t}){xe.splice(0);let s=null;(n instanceof HTMLElement||n instanceof SVGElement)&&(s=n),Qe.forEach(l=>{const{element:i,hitAreaMargins:o}=l,a=i.getBoundingClientRect(),{bottom:c,left:d,right:f,top:u}=a,h=Ll?o.coarse:o.fine;if(e>=d-h&&e<=f+h&&t>=u-h&&t<=c+h){if(s!==null&&document.contains(s)&&i!==s&&!i.contains(s)&&!s.contains(i)&&Tl(s,i)>0){let p=s,g=!1;for(;p&&!p.contains(i);){if(Dl(p.getBoundingClientRect(),a)){g=!0;break}p=p.parentElement}if(g)return}xe.push(l)}})}function Ft(n,e){yt.set(n,e)}function Xt(){let n=!1,e=!1;xe.forEach(s=>{const{direction:l}=s;l==="horizontal"?n=!0:e=!0});let t=0;yt.forEach(s=>{t|=s}),n&&e?Et("intersection",t):n?Et("horizontal",t):e?Et("vertical",t):Pl()}let Mt=new AbortController;function ht(){Mt.abort(),Mt=new AbortController;const n={capture:!0,signal:Mt.signal};Qe.size&&(_e?(xe.length>0&&De.forEach((e,t)=>{const{body:s}=t;e>0&&(s.addEventListener("contextmenu",Tt,n),s.addEventListener("pointerleave",Dt,n),s.addEventListener("pointermove",Dt,n))}),window.addEventListener("pointerup",Tt,n),window.addEventListener("pointercancel",Tt,n)):De.forEach((e,t)=>{const{body:s}=t;e>0&&(s.addEventListener("pointerdown",Rl,n),s.addEventListener("pointermove",Dt,n))}))}function mt(n,e){Qe.forEach(t=>{const{setResizeHandlerState:s}=t,l=xe.includes(t);s(n,l,e)})}function Al(){const[n,e]=S.useState(0);return S.useCallback(()=>e(t=>t+1),[])}function G(n,e){if(!n)throw console.error(e),Error(e)}function Me(n,e,t=Wt){return n.toFixed(t)===e.toFixed(t)?0:n>e?1:-1}function we(n,e,t=Wt){return Me(n,e,t)===0}function me(n,e,t){return Me(n,e,t)===0}function _l(n,e,t){if(n.length!==e.length)return!1;for(let s=0;s<n.length;s++){const l=n[s],i=e[s];if(!me(l,i,t))return!1}return!0}function Ae({panelConstraints:n,panelIndex:e,size:t}){const s=n[e];G(s!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:l=0,collapsible:i,maxSize:o=100,minSize:a=0}=s;if(Me(t,a)<0)if(i){const c=(l+a)/2;Me(t,c)<0?t=l:t=a}else t=a;return t=Math.min(o,t),t=parseFloat(t.toFixed(Wt)),t}function He({delta:n,initialLayout:e,panelConstraints:t,pivotIndices:s,prevLayout:l,trigger:i}){if(me(n,0))return e;const o=[...e],[a,c]=s;G(a!=null,"Invalid first pivot index"),G(c!=null,"Invalid second pivot index");let d=0;if(i==="keyboard"){{const u=n<0?c:a,h=t[u];G(h,`Panel constraints not found for index ${u}`);const{collapsedSize:m=0,collapsible:p,minSize:g=0}=h;if(p){const b=e[u];if(G(b!=null,`Previous layout not found for panel index ${u}`),me(b,m)){const x=g-b;Me(x,Math.abs(n))>0&&(n=n<0?0-x:x)}}}{const u=n<0?a:c,h=t[u];G(h,`No panel constraints found for index ${u}`);const{collapsedSize:m=0,collapsible:p,minSize:g=0}=h;if(p){const b=e[u];if(G(b!=null,`Previous layout not found for panel index ${u}`),me(b,g)){const x=b-m;Me(x,Math.abs(n))>0&&(n=n<0?0-x:x)}}}}{const u=n<0?1:-1;let h=n<0?c:a,m=0;for(;;){const g=e[h];G(g!=null,`Previous layout not found for panel index ${h}`);const x=Ae({panelConstraints:t,panelIndex:h,size:100})-g;if(m+=x,h+=u,h<0||h>=t.length)break}const p=Math.min(Math.abs(n),Math.abs(m));n=n<0?0-p:p}{let h=n<0?a:c;for(;h>=0&&h<t.length;){const m=Math.abs(n)-Math.abs(d),p=e[h];G(p!=null,`Previous layout not found for panel index ${h}`);const g=p-m,b=Ae({panelConstraints:t,panelIndex:h,size:g});if(!me(p,b)&&(d+=p-b,o[h]=b,d.toPrecision(3).localeCompare(Math.abs(n).toPrecision(3),void 0,{numeric:!0})>=0))break;n<0?h--:h++}}if(_l(l,o))return l;{const u=n<0?c:a,h=e[u];G(h!=null,`Previous layout not found for panel index ${u}`);const m=h+d,p=Ae({panelConstraints:t,panelIndex:u,size:m});if(o[u]=p,!me(p,m)){let g=m-p,x=n<0?c:a;for(;x>=0&&x<t.length;){const y=o[x];G(y!=null,`Previous layout not found for panel index ${x}`);const j=y+g,N=Ae({panelConstraints:t,panelIndex:x,size:j});if(me(y,N)||(g-=N-y,o[x]=N),me(g,0))break;n>0?x--:x++}}}const f=o.reduce((u,h)=>h+u,0);return me(f,100)?o:l}function Ul({layout:n,panelsArray:e,pivotIndices:t}){let s=0,l=100,i=0,o=0;const a=t[0];G(a!=null,"No pivot index found"),e.forEach((u,h)=>{const{constraints:m}=u,{maxSize:p=100,minSize:g=0}=m;h===a?(s=g,l=p):(i+=g,o+=p)});const c=Math.min(l,100-i),d=Math.max(s,100-o),f=n[a];return{valueMax:c,valueMin:d,valueNow:f}}function Ye(n,e=document){return Array.from(e.querySelectorAll(`[${se.resizeHandleId}][data-panel-group-id="${n}"]`))}function Zn(n,e,t=document){const l=Ye(n,t).findIndex(i=>i.getAttribute(se.resizeHandleId)===e);return l??null}function Jn(n,e,t){const s=Zn(n,e,t);return s!=null?[s,s+1]:[-1,-1]}function es(n,e=document){var t;if(e instanceof HTMLElement&&(e==null||(t=e.dataset)===null||t===void 0?void 0:t.panelGroupId)==n)return e;const s=e.querySelector(`[data-panel-group][data-panel-group-id="${n}"]`);return s||null}function vt(n,e=document){const t=e.querySelector(`[${se.resizeHandleId}="${n}"]`);return t||null}function Bl(n,e,t,s=document){var l,i,o,a;const c=vt(e,s),d=Ye(n,s),f=c?d.indexOf(c):-1,u=(l=(i=t[f])===null||i===void 0?void 0:i.id)!==null&&l!==void 0?l:null,h=(o=(a=t[f+1])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null;return[u,h]}function Hl({committedValuesRef:n,eagerValuesRef:e,groupId:t,layout:s,panelDataArray:l,panelGroupElement:i,setLayout:o}){S.useRef({didWarnAboutMissingResizeHandle:!1}),Te(()=>{if(!i)return;const a=Ye(t,i);for(let c=0;c<l.length-1;c++){const{valueMax:d,valueMin:f,valueNow:u}=Ul({layout:s,panelsArray:l,pivotIndices:[c,c+1]}),h=a[c];if(h!=null){const m=l[c];G(m,`No panel data found for index "${c}"`),h.setAttribute("aria-controls",m.id),h.setAttribute("aria-valuemax",""+Math.round(d)),h.setAttribute("aria-valuemin",""+Math.round(f)),h.setAttribute("aria-valuenow",u!=null?""+Math.round(u):"")}}return()=>{a.forEach((c,d)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[t,s,l,i]),S.useEffect(()=>{if(!i)return;const a=e.current;G(a,"Eager values not found");const{panelDataArray:c}=a,d=es(t,i);G(d!=null,`No group found for id "${t}"`);const f=Ye(t,i);G(f,`No resize handles found for group id "${t}"`);const u=f.map(h=>{const m=h.getAttribute(se.resizeHandleId);G(m,"Resize handle element has no handle id attribute");const[p,g]=Bl(t,m,c,i);if(p==null||g==null)return()=>{};const b=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const y=c.findIndex(j=>j.id===p);if(y>=0){const j=c[y];G(j,`No panel data found for index ${y}`);const N=s[y],{collapsedSize:C=0,collapsible:k,minSize:w=0}=j.constraints;if(N!=null&&k){const B=He({delta:me(N,C)?w-C:C-N,initialLayout:s,panelConstraints:c.map(R=>R.constraints),pivotIndices:Jn(t,m,i),prevLayout:s,trigger:"keyboard"});s!==B&&o(B)}}break}}};return h.addEventListener("keydown",b),()=>{h.removeEventListener("keydown",b)}});return()=>{u.forEach(h=>h())}},[i,n,e,t,s,l,o])}function rn(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function ts(n,e){const t=n==="horizontal",{x:s,y:l}=bt(e);return t?s:l}function ql(n,e,t,s,l){const i=t==="horizontal",o=vt(e,l);G(o,`No resize handle element found for id "${e}"`);const a=o.getAttribute(se.groupId);G(a,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=s;const d=ts(t,n),f=es(a,l);G(f,`No group element found for id "${a}"`);const u=f.getBoundingClientRect(),h=i?u.width:u.height;return(d-c)/h*100}function Kl(n,e,t,s,l,i){if(Hn(n)){const o=t==="horizontal";let a=0;n.shiftKey?a=100:l!=null?a=l:a=10;let c=0;switch(n.key){case"ArrowDown":c=o?0:a;break;case"ArrowLeft":c=o?-a:0;break;case"ArrowRight":c=o?a:0;break;case"ArrowUp":c=o?0:-a;break;case"End":c=100;break;case"Home":c=-100;break}return c}else return s==null?0:ql(n,e,t,s,i)}function Wl({panelDataArray:n}){const e=Array(n.length),t=n.map(i=>i.constraints);let s=0,l=100;for(let i=0;i<n.length;i++){const o=t[i];G(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;a!=null&&(s++,e[i]=a,l-=a)}for(let i=0;i<n.length;i++){const o=t[i];G(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;if(a!=null)continue;const c=n.length-s,d=l/c;s++,e[i]=d,l-=d}return e}function Ie(n,e,t){e.forEach((s,l)=>{const i=n[l];G(i,`Panel data not found for index ${l}`);const{callbacks:o,constraints:a,id:c}=i,{collapsedSize:d=0,collapsible:f}=a,u=t[c];if(u==null||s!==u){t[c]=s;const{onCollapse:h,onExpand:m,onResize:p}=o;p&&p(s,u),f&&(h||m)&&(m&&(u==null||we(u,d))&&!we(s,d)&&m(),h&&(u==null||!we(u,d))&&we(s,d)&&h())}})}function at(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t])return!1;return!0}function Gl({defaultSize:n,dragState:e,layout:t,panelData:s,panelIndex:l,precision:i=3}){const o=t[l];let a;return o==null?a=n!=null?n.toPrecision(i):"1":s.length===1?a="1":a=o.toPrecision(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function Vl(n,e=10){let t=null;return(...l)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...l)},e)}}function on(n){try{if(typeof localStorage<"u")n.getItem=e=>localStorage.getItem(e),n.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),n.getItem=()=>null,n.setItem=()=>{}}}function ns(n){return`react-resizable-panels:${n}`}function ss(n){return n.map(e=>{const{constraints:t,id:s,idIsFromProps:l,order:i}=e;return l?s:i?`${i}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function ls(n,e){try{const t=ns(n),s=e.getItem(t);if(s){const l=JSON.parse(s);if(typeof l=="object"&&l!=null)return l}}catch{}return null}function Xl(n,e,t){var s,l;const i=(s=ls(n,t))!==null&&s!==void 0?s:{},o=ss(e);return(l=i[o])!==null&&l!==void 0?l:null}function Ql(n,e,t,s,l){var i;const o=ns(n),a=ss(e),c=(i=ls(n,l))!==null&&i!==void 0?i:{};c[a]={expandToSizes:Object.fromEntries(t.entries()),layout:s};try{l.setItem(o,JSON.stringify(c))}catch(d){console.error(d)}}function an({layout:n,panelConstraints:e}){const t=[...n],s=t.reduce((i,o)=>i+o,0);if(t.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${t.map(i=>`${i}%`).join(", ")}`);if(!me(s,100)&&t.length>0)for(let i=0;i<e.length;i++){const o=t[i];G(o!=null,`No layout data found for index ${i}`);const a=100/s*o;t[i]=a}let l=0;for(let i=0;i<e.length;i++){const o=t[i];G(o!=null,`No layout data found for index ${i}`);const a=Ae({panelConstraints:e,panelIndex:i,size:o});o!=a&&(l+=o-a,t[i]=a)}if(!me(l,0))for(let i=0;i<e.length;i++){const o=t[i];G(o!=null,`No layout data found for index ${i}`);const a=o+l,c=Ae({panelConstraints:e,panelIndex:i,size:a});if(o!==c&&(l-=c-o,t[i]=c,me(l,0)))break}return t}const Yl=100,qe={getItem:n=>(on(qe),qe.getItem(n)),setItem:(n,e)=>{on(qe),qe.setItem(n,e)}},cn={};function rs({autoSaveId:n=null,children:e,className:t="",direction:s,forwardedRef:l,id:i=null,onLayout:o=null,keyboardResizeBy:a=null,storage:c=qe,style:d,tagName:f="div",...u}){const h=Gt(i),m=S.useRef(null),[p,g]=S.useState(null),[b,x]=S.useState([]),y=Al(),j=S.useRef({}),N=S.useRef(new Map),C=S.useRef(0),k=S.useRef({autoSaveId:n,direction:s,dragState:p,id:h,keyboardResizeBy:a,onLayout:o,storage:c}),w=S.useRef({layout:b,panelDataArray:[],panelDataArrayChanged:!1});S.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),S.useImperativeHandle(l,()=>({getId:()=>k.current.id,getLayout:()=>{const{layout:z}=w.current;return z},setLayout:z=>{const{onLayout:F}=k.current,{layout:I,panelDataArray:L}=w.current,D=an({layout:z,panelConstraints:L.map(A=>A.constraints)});rn(I,D)||(x(D),w.current.layout=D,F&&F(D),Ie(L,D,j.current))}}),[]),Te(()=>{k.current.autoSaveId=n,k.current.direction=s,k.current.dragState=p,k.current.id=h,k.current.onLayout=o,k.current.storage=c}),Hl({committedValuesRef:k,eagerValuesRef:w,groupId:h,layout:b,panelDataArray:w.current.panelDataArray,setLayout:x,panelGroupElement:m.current}),S.useEffect(()=>{const{panelDataArray:z}=w.current;if(n){if(b.length===0||b.length!==z.length)return;let F=cn[n];F==null&&(F=Vl(Ql,Yl),cn[n]=F);const I=[...z],L=new Map(N.current);F(n,I,L,b,c)}},[n,b,c]),S.useEffect(()=>{});const B=S.useCallback(z=>{const{onLayout:F}=k.current,{layout:I,panelDataArray:L}=w.current;if(z.constraints.collapsible){const D=L.map(he=>he.constraints),{collapsedSize:A=0,panelSize:Q,pivotIndices:te}=Ee(L,z,I);if(G(Q!=null,`Panel size not found for panel "${z.id}"`),!we(Q,A)){N.current.set(z.id,Q);const P=Oe(L,z)===L.length-1?Q-A:A-Q,V=He({delta:P,initialLayout:I,panelConstraints:D,pivotIndices:te,prevLayout:I,trigger:"imperative-api"});at(I,V)||(x(V),w.current.layout=V,F&&F(V),Ie(L,V,j.current))}}},[]),R=S.useCallback((z,F)=>{const{onLayout:I}=k.current,{layout:L,panelDataArray:D}=w.current;if(z.constraints.collapsible){const A=D.map(ne=>ne.constraints),{collapsedSize:Q=0,panelSize:te=0,minSize:he=0,pivotIndices:P}=Ee(D,z,L),V=F??he;if(we(te,Q)){const ne=N.current.get(z.id),ge=ne!=null&&ne>=V?ne:V,$e=Oe(D,z)===D.length-1?te-ge:ge-te,oe=He({delta:$e,initialLayout:L,panelConstraints:A,pivotIndices:P,prevLayout:L,trigger:"imperative-api"});at(L,oe)||(x(oe),w.current.layout=oe,I&&I(oe),Ie(D,oe,j.current))}}},[]),_=S.useCallback(z=>{const{layout:F,panelDataArray:I}=w.current,{panelSize:L}=Ee(I,z,F);return G(L!=null,`Panel size not found for panel "${z.id}"`),L},[]),v=S.useCallback((z,F)=>{const{panelDataArray:I}=w.current,L=Oe(I,z);return Gl({defaultSize:F,dragState:p,layout:b,panelData:I,panelIndex:L})},[p,b]),M=S.useCallback(z=>{const{layout:F,panelDataArray:I}=w.current,{collapsedSize:L=0,collapsible:D,panelSize:A}=Ee(I,z,F);return G(A!=null,`Panel size not found for panel "${z.id}"`),D===!0&&we(A,L)},[]),Z=S.useCallback(z=>{const{layout:F,panelDataArray:I}=w.current,{collapsedSize:L=0,collapsible:D,panelSize:A}=Ee(I,z,F);return G(A!=null,`Panel size not found for panel "${z.id}"`),!D||Me(A,L)>0},[]),U=S.useCallback(z=>{const{panelDataArray:F}=w.current;F.push(z),F.sort((I,L)=>{const D=I.order,A=L.order;return D==null&&A==null?0:D==null?-1:A==null?1:D-A}),w.current.panelDataArrayChanged=!0,y()},[y]);Te(()=>{if(w.current.panelDataArrayChanged){w.current.panelDataArrayChanged=!1;const{autoSaveId:z,onLayout:F,storage:I}=k.current,{layout:L,panelDataArray:D}=w.current;let A=null;if(z){const te=Xl(z,D,I);te&&(N.current=new Map(Object.entries(te.expandToSizes)),A=te.layout)}A==null&&(A=Wl({panelDataArray:D}));const Q=an({layout:A,panelConstraints:D.map(te=>te.constraints)});rn(L,Q)||(x(Q),w.current.layout=Q,F&&F(Q),Ie(D,Q,j.current))}}),Te(()=>{const z=w.current;return()=>{z.layout=[]}},[]);const O=S.useCallback(z=>{let F=!1;const I=m.current;return I&&window.getComputedStyle(I,null).getPropertyValue("direction")==="rtl"&&(F=!0),function(D){D.preventDefault();const A=m.current;if(!A)return()=>null;const{direction:Q,dragState:te,id:he,keyboardResizeBy:P,onLayout:V}=k.current,{layout:ne,panelDataArray:ge}=w.current,{initialLayout:Se}=te??{},$e=Jn(he,z,A);let oe=Kl(D,z,Q,te,P,A);const rt=Q==="horizontal";rt&&F&&(oe=-oe);const Ct=ge.map($t=>$t.constraints),Pe=He({delta:oe,initialLayout:Se??ne,panelConstraints:Ct,pivotIndices:$e,prevLayout:ne,trigger:Hn(D)?"keyboard":"mouse-or-touch"}),it=!at(ne,Pe);(qn(D)||Kn(D))&&C.current!=oe&&(C.current=oe,!it&&oe!==0?rt?Ft(z,oe<0?Gn:Vn):Ft(z,oe<0?Xn:Qn):Ft(z,0)),it&&(x(Pe),w.current.layout=Pe,V&&V(Pe),Ie(ge,Pe,j.current))}},[]),H=S.useCallback((z,F)=>{const{onLayout:I}=k.current,{layout:L,panelDataArray:D}=w.current,A=D.map(ne=>ne.constraints),{panelSize:Q,pivotIndices:te}=Ee(D,z,L);G(Q!=null,`Panel size not found for panel "${z.id}"`);const P=Oe(D,z)===D.length-1?Q-F:F-Q,V=He({delta:P,initialLayout:L,panelConstraints:A,pivotIndices:te,prevLayout:L,trigger:"imperative-api"});at(L,V)||(x(V),w.current.layout=V,I&&I(V),Ie(D,V,j.current))},[]),W=S.useCallback((z,F)=>{const{layout:I,panelDataArray:L}=w.current,{collapsedSize:D=0,collapsible:A}=F,{collapsedSize:Q=0,collapsible:te,maxSize:he=100,minSize:P=0}=z.constraints,{panelSize:V}=Ee(L,z,I);V!=null&&(A&&te&&we(V,D)?we(D,Q)||H(z,Q):V<P?H(z,P):V>he&&H(z,he))},[H]),q=S.useCallback((z,F)=>{const{direction:I}=k.current,{layout:L}=w.current;if(!m.current)return;const D=vt(z,m.current);G(D,`Drag handle element not found for id "${z}"`);const A=ts(I,F);g({dragHandleId:z,dragHandleRect:D.getBoundingClientRect(),initialCursorPosition:A,initialLayout:L})},[]),ee=S.useCallback(()=>{g(null)},[]),Y=S.useCallback(z=>{const{panelDataArray:F}=w.current,I=Oe(F,z);I>=0&&(F.splice(I,1),delete j.current[z.id],w.current.panelDataArrayChanged=!0,y())},[y]),T=S.useMemo(()=>({collapsePanel:B,direction:s,dragState:p,expandPanel:R,getPanelSize:_,getPanelStyle:v,groupId:h,isPanelCollapsed:M,isPanelExpanded:Z,reevaluatePanelConstraints:W,registerPanel:U,registerResizeHandle:O,resizePanel:H,startDragging:q,stopDragging:ee,unregisterPanel:Y,panelGroupElement:m.current}),[B,p,s,R,_,v,h,M,Z,W,U,O,H,q,ee,Y]),K={display:"flex",flexDirection:s==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return S.createElement(gt.Provider,{value:T},S.createElement(f,{...u,children:e,className:t,id:i,ref:m,style:{...K,...d},[se.group]:"",[se.groupDirection]:s,[se.groupId]:h}))}const is=S.forwardRef((n,e)=>S.createElement(rs,{...n,forwardedRef:e}));rs.displayName="PanelGroup";is.displayName="forwardRef(PanelGroup)";function Oe(n,e){return n.findIndex(t=>t===e||t.id===e.id)}function Ee(n,e,t){const s=Oe(n,e),i=s===n.length-1?[s-1,s]:[s,s+1],o=t[s];return{...e.constraints,panelSize:o,pivotIndices:i}}function Zl({disabled:n,handleId:e,resizeHandler:t,panelGroupElement:s}){S.useEffect(()=>{if(n||t==null||s==null)return;const l=vt(e,s);if(l==null)return;const i=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),t(o);break}case"F6":{o.preventDefault();const a=l.getAttribute(se.groupId);G(a,`No group element found for id "${a}"`);const c=Ye(a,s),d=Zn(a,e,s);G(d!==null,`No resize element found for id "${e}"`);const f=o.shiftKey?d>0?d-1:c.length-1:d+1<c.length?d+1:0;c[f].focus();break}}};return l.addEventListener("keydown",i),()=>{l.removeEventListener("keydown",i)}},[s,n,e,t])}function os({children:n=null,className:e="",disabled:t=!1,hitAreaMargins:s,id:l,onBlur:i,onClick:o,onDragging:a,onFocus:c,onPointerDown:d,onPointerUp:f,style:u={},tabIndex:h=0,tagName:m="div",...p}){var g,b;const x=S.useRef(null),y=S.useRef({onClick:o,onDragging:a,onPointerDown:d,onPointerUp:f});S.useEffect(()=>{y.current.onClick=o,y.current.onDragging=a,y.current.onPointerDown=d,y.current.onPointerUp=f});const j=S.useContext(gt);if(j===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:N,groupId:C,registerResizeHandle:k,startDragging:w,stopDragging:B,panelGroupElement:R}=j,_=Gt(l),[v,M]=S.useState("inactive"),[Z,U]=S.useState(!1),[O,H]=S.useState(null),W=S.useRef({state:v});Te(()=>{W.current.state=v}),S.useEffect(()=>{if(t)H(null);else{const T=k(_);H(()=>T)}},[t,_,k]);const q=(g=s?.coarse)!==null&&g!==void 0?g:15,ee=(b=s?.fine)!==null&&b!==void 0?b:5;S.useEffect(()=>{if(t||O==null)return;const T=x.current;G(T,"Element ref not attached");let K=!1;return Ol(_,T,N,{coarse:q,fine:ee},(F,I,L)=>{if(!I){M("inactive");return}switch(F){case"down":{M("drag"),K=!1,G(L,'Expected event to be defined for "down" action'),w(_,L);const{onDragging:D,onPointerDown:A}=y.current;D?.(!0),A?.();break}case"move":{const{state:D}=W.current;K=!0,D!=="drag"&&M("hover"),G(L,'Expected event to be defined for "move" action'),O(L);break}case"up":{M("hover"),B();const{onClick:D,onDragging:A,onPointerUp:Q}=y.current;A?.(!1),Q?.(),K||D?.();break}}})},[q,N,t,ee,k,_,O,w,B]),Zl({disabled:t,handleId:_,resizeHandler:O,panelGroupElement:R});const Y={touchAction:"none",userSelect:"none"};return S.createElement(m,{...p,children:n,className:e,id:l,onBlur:()=>{U(!1),i?.()},onFocus:()=>{U(!0),c?.()},ref:x,role:"separator",style:{...Y,...u},tabIndex:h,[se.groupDirection]:N,[se.groupId]:C,[se.resizeHandle]:"",[se.resizeHandleActive]:v==="drag"?"pointer":Z?"keyboard":void 0,[se.resizeHandleEnabled]:!t,[se.resizeHandleId]:_,[se.resizeHandleState]:v})}os.displayName="PanelResizeHandle";function Jl(n){const e=$.c(10);let t,s,l;e[0]!==n?({className:t,ref:l,...s}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=l):(t=e[1],s=e[2],l=e[3]);let i;e[4]!==t?(i=ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),e[4]=t,e[5]=i):i=e[5];let o;return e[6]!==s||e[7]!==l||e[8]!==i?(o=r.jsx(is,{ref:l,"data-slot":"resizable-panel-group",className:i,...s}),e[6]=s,e[7]=l,e[8]=i,e[9]=o):o=e[9],o}function dn(n){const e=$.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let s;return e[2]!==t?(s=r.jsx(Bn,{"data-slot":"resizable-panel",...t}),e[2]=t,e[3]=s):s=e[3],s}function er(n){const e=$.c(12);let t,s,l;e[0]!==n?({withHandle:l,className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=l):(t=e[1],s=e[2],l=e[3]);let i;e[4]!==t?(i=ce("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),e[4]=t,e[5]=i):i=e[5];let o;e[6]!==l?(o=l&&r.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:r.jsx(Fs,{className:"size-2.5"})}),e[6]=l,e[7]=o):o=e[7];let a;return e[8]!==s||e[9]!==i||e[10]!==o?(a=r.jsx(os,{"data-slot":"resizable-handle",className:i,...s,children:o}),e[8]=s,e[9]=i,e[10]=o,e[11]=a):a=e[11],a}function tr(n){if(!n||n.includes("\\")||n.includes("..")||n.includes("\0"))return!0;try{const e=decodeURIComponent(n);if(e.includes("\\")||e.includes("..")||e.includes("\0"))return!0;if(e!==n&&e.includes("/")){const t=(n.match(/\//g)??[]).length;if((e.match(/\//g)??[]).length>t)return!0}return!1}catch{return!0}}function nr(n){if(tr(n))throw new Error(`Invalid block key: ${n||"(empty)"}`)}function sr(n){try{return decodeURIComponent(n)}catch{return n}}function lr(n){return nr(n),encodeURIComponent(n)}function rr(n){return`.deco/blocks/${lr(n)}.json`}function Mo(n){return`/${rr(n)}`}const Io=1e4,ir=3;function Rt(n){return n.trim()?(n.startsWith("/")?n:`/${n}`).replace(/\/+/g,"/"):"/"}function wt(n){return n.startsWith("/")?n.slice(1):n}function Lo(n){const e=wt(n);return!e||e.includes("..")||e.includes("\\")?!1:e.startsWith(".deco/blocks/")||!e.startsWith("/")&&!e.includes("://")}function pt(n){return n.trim()?n.startsWith("/")?n:`/${n}`:"/"}function or(n){const e=pt(n);if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.pop(),t.length===0?"/":`/${t.join("/")}`}function Oo(n,e){const t=e.replace(/^\/+|\/+$/g,"");return pt(t?`${n==="/"?"":n}/${t}`:n)}function Ro(n,e){return e==="directory"?n:or(n)}function Ao(n){const e=n.trim();return e?e.includes("/")||e.includes("\\")||e.includes("..")||e.includes("\0")?"Name cannot contain /, \\, or ..":null:"Name is required"}function ar(n){const e=wt(n);return e?e.split("/").filter(Boolean).length:0}function _o(n,e,t,s=!1){return{files:[...new Set([...n,...t.files])],directories:[...new Set([...e,...t.directories??[]])],truncated:s||!!t.truncated}}function Uo(n,e){return ar(n)>=ir&&!e.has(n)}function Bo(n,e,t=[]){const s=wt(n);if(e.includes(s)||t.includes(s))return!0;if(!s)return!1;const l=`${s}/`;return e.some(i=>i.startsWith(l))||t.some(i=>i.startsWith(l))}function Ho(n){const e=wt(n),t=".deco/blocks/";if(!e.startsWith(t)||!e.endsWith(".json"))return null;const s=e.slice(t.length,-5);return sr(s)}function cr(n){if(!n)return"plaintext";const e=n.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?"typescript":e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?"javascript":e.endsWith(".json")?"json":e.endsWith(".md")||e.endsWith(".mdx")?"markdown":e.endsWith(".css")?"css":e.endsWith(".scss")?"scss":e.endsWith(".html")?"html":e.endsWith(".yaml")||e.endsWith(".yml")?"yaml":e.endsWith(".xml")||e.endsWith(".svg")?"xml":e.endsWith(".py")?"python":e.endsWith(".sql")?"sql":e.endsWith(".sh")?"shell":"plaintext"}function qo(n){const e=Rt(n).split("/").filter(Boolean),t=["/"];let s="";for(const l of e.slice(0,-1))s+=`/${l}`,t.push(s);return t}function Ko(n,e=[]){const t={children:[]},s=i=>{const a=Rt(i).split("/").filter(Boolean);let c=t,d="";for(const f of a){d+=`/${f}`;let u=c.children.find(h=>h.name===f);u?u.kind==="file"&&(u.kind="directory"):(u={name:f,path:d,kind:"directory",children:[]},c.children.push(u)),c=u}};for(const i of n){const a=Rt(i).split("/").filter(Boolean);let c=t,d="";a.forEach((f,u)=>{d+=`/${f}`;const h=u===a.length-1;let m=c.children.find(p=>p.name===f);m||(m={name:f,path:d,kind:h?"file":"directory",children:[]},c.children.push(m)),c=m})}for(const i of e)s(pt(i));const l=i=>{i.sort((o,a)=>o.kind!==a.kind?o.kind==="directory"?-1:1:o.name.localeCompare(a.name));for(const o of i)o.children.length>0&&l(o.children)};return l(t.children),t.children}function dr(n,e,t=0){const s=[];for(const l of n)l.name!==".gitkeep"&&(s.push({node:l,depth:t}),l.kind==="directory"&&l.children.length>0&&e.has(l.path)&&s.push(...dr(l.children,e,t+1)));return s}function Wo(n){return n.split(`
|
|
2
2
|
`).map(e=>{const t=e.match(/^\d+\t(.*)/);return t?t[1]:e}).join(`
|
|
3
|
-
`)}cl.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function ur(n){const e=$.c(11),{value:t,filename:s}=n,[l]=Cs(),i=l.theme==="dark"||l.theme==="system"&&typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches;let o;e[0]!==s?(o=cr(s),e[0]=s,e[1]=o):o=e[1];const a=i?"vs-dark":"light";let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsx($s,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=c):c=e[2];let d,f;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={enabled:!1},f={top:12,bottom:12},e[3]=d,e[4]=f):(d=e[3],f=e[4]);let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u={readOnly:!0,domReadOnly:!0,fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:3,wordWrap:"on",minimap:d,padding:f,renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}},e[5]=u):u=e[5];let h;return e[6]!==s||e[7]!==o||e[8]!==a||e[9]!==t?(h=r.jsx(dl,{path:s,language:o,value:t,theme:a,loading:c,options:u},s),e[6]=s,e[7]=o,e[8]=a,e[9]=t,e[10]=h):h=e[10],h}function as(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}const fr=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),hr=new Set(["txt","json","csv","tsv","log","yaml","yml","xml","toml","ts","tsx","js","jsx","py","rb","go","rs","java","sh","sql"]),un=2*1024*1024;function mr(n,e){const t=n.split(".").pop()?.toLowerCase()??"";return fr.has(t)?"image":t==="pdf"?"pdf":t==="html"||t==="htm"?"html":t==="md"||t==="markdown"?e<=un?"markdown":"download":hr.has(t)&&e<=un?"text":"download"}function cs(){const n=$.c(2);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(ae,{className:"h-6 w-2/3"}),n[0]=e):e=n[0];let t;return n[1]===Symbol.for("react.memo_cache_sentinel")?(t=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsxs("div",{className:"flex w-3/4 max-w-md flex-col gap-3 p-6",children:[e,r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsx(ae,{className:"h-3 w-full"}),r.jsx(ae,{className:"h-3 w-5/6"}),r.jsx(ae,{className:"h-3 w-2/3"})]})]})}),n[1]=t):t=n[1],t}function ds(n){const e=$.c(20),{file:t,note:s}=n;let l;e[0]!==t.filename?(l=r.jsx(ke,{filename:t.filename,className:"h-12 w-10"}),e[0]=t.filename,e[1]=l):l=e[1];let i;e[2]!==t.filename?(i=r.jsx("span",{className:"text-sm font-medium text-foreground",children:t.filename}),e[2]=t.filename,e[3]=i):i=e[3];let o;e[4]!==t.size?(o=as(t.size),e[4]=t.size,e[5]=o):o=e[5];const a=s?` · ${s}`:"";let c;e[6]!==o||e[7]!==a?(c=r.jsxs("span",{className:"text-xs text-muted-foreground",children:[o,a]}),e[6]=o,e[7]=a,e[8]=c):c=e[8];let d;e[9]!==i||e[10]!==c?(d=r.jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[i,c]}),e[9]=i,e[10]=c,e[11]=d):d=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Ve,{size:14}),e[12]=f):f=e[12];let u;e[13]!==t.downloadUrl||e[14]!==t.filename?(u=r.jsx(J,{asChild:!0,variant:"outline",size:"sm",children:r.jsxs("a",{href:t.downloadUrl,download:t.filename,children:[f,"Download"]})}),e[13]=t.downloadUrl,e[14]=t.filename,e[15]=u):u=e[15];let h;return e[16]!==l||e[17]!==d||e[18]!==u?(h=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-border bg-muted/30 px-10 py-8",children:[l,d,u]})}),e[16]=l,e[17]=d,e[18]=u,e[19]=h):h=e[19],h}function fn(n){const e=$.c(16),{file:t,markdown:s}=n;let l;e[0]!==t.downloadUrl?(l=X.fileText(t.downloadUrl),e[0]=t.downloadUrl,e[1]=l):l=e[1];let i;e[2]!==t.downloadUrl?(i=async()=>{const u=await fetch(t.downloadUrl,{credentials:"include"});if(!u.ok)throw new Error(`fetch failed: ${u.status}`);return u.text()},e[2]=t.downloadUrl,e[3]=i):i=e[3];let o;e[4]!==l||e[5]!==i?(o={queryKey:l,queryFn:i,staleTime:6e4,retry:!1},e[4]=l,e[5]=i,e[6]=o):o=e[6];const{data:a,isPending:c,isError:d}=ie(o);if(c){let u;return e[7]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(cs,{}),e[7]=u):u=e[7],u}if(d||a===void 0){let u;return e[8]!==t?(u=r.jsx(ds,{file:t,note:"preview unavailable"}),e[8]=t,e[9]=u):u=e[9],u}if(s){const u=`file-preview-${t.key}`;let h;return e[10]!==a||e[11]!==u?(h=r.jsx("div",{className:"h-full overflow-y-auto",children:r.jsx("div",{className:"prose prose-sm dark:prose-invert mx-auto max-w-3xl px-6 py-6",children:r.jsx(_t,{id:u,text:a})})}),e[10]=a,e[11]=u,e[12]=h):h=e[12],h}let f;return e[13]!==a||e[14]!==t.filename?(f=r.jsx(ur,{value:a,filename:t.filename}),e[13]=a,e[14]=t.filename,e[15]=f):f=e[15],f}function us(n){const e=$.c(15),{file:t}=n;switch(mr(t.filename,t.size)){case"image":{let l;return e[0]!==t.downloadUrl||e[1]!==t.filename?(l=r.jsx("div",{className:"flex h-full w-full items-center justify-center overflow-auto bg-muted/30 p-4",children:r.jsx("img",{src:t.downloadUrl,alt:t.filename,className:"max-h-full max-w-full rounded-lg object-contain"})}),e[0]=t.downloadUrl,e[1]=t.filename,e[2]=l):l=e[2],l}case"pdf":{let l;return e[3]!==t.downloadUrl||e[4]!==t.filename?(l=r.jsx("iframe",{src:t.downloadUrl,title:t.filename,className:"block h-full w-full bg-white"}),e[3]=t.downloadUrl,e[4]=t.filename,e[5]=l):l=e[5],l}case"html":{let l;return e[6]!==t.downloadUrl||e[7]!==t.filename?(l=r.jsx("iframe",{src:t.downloadUrl,title:t.filename,sandbox:"allow-scripts",className:"block h-full w-full bg-white"}),e[6]=t.downloadUrl,e[7]=t.filename,e[8]=l):l=e[8],l}case"markdown":{let l;return e[9]!==t?(l=r.jsx(fn,{file:t,markdown:!0}),e[9]=t,e[10]=l):l=e[10],l}case"text":{let l;return e[11]!==t?(l=r.jsx(fn,{file:t,markdown:!1}),e[11]=t,e[12]=l):l=e[12],l}default:{let l;return e[13]!==t?(l=r.jsx(ds,{file:t}),e[13]=t,e[14]=l):l=e[14],l}}}function pr(n){const e=$.c(40),{readUrl:t,editor:s,downloadName:l,trailing:i}=n;let o;e[0]!==t?(o=new URL(t,window.location.origin).toString(),e[0]=t,e[1]=o):o=e[1];const a=o;let c;e[2]!==s?(c=s.deckDetected&&r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:s.railOpen?"secondary":"ghost",size:"icon","aria-label":s.railOpen?"Hide slide list":"Show slide list",onClick:()=>s.setRailOpen(!s.railOpen),children:r.jsx(ul,{size:14})})}),r.jsx(ve,{side:"bottom",children:s.railOpen?"Hide slide list":"Show slide list"})]}),e[2]=s,e[3]=c):c=e[3];let d;e[4]!==a?(d=()=>window.open(a,"_blank","noopener"),e[4]=a,e[5]=d):d=e[5];let f;e[6]!==a?(f=r.jsx("span",{className:"truncate",children:a}),e[6]=a,e[7]=f):f=e[7];let u;e[8]!==a||e[9]!==d||e[10]!==f?(u=r.jsx("button",{type:"button",onClick:d,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:a,children:f}),e[8]=a,e[9]=d,e[10]=f,e[11]=u):u=e[11];let h;e[12]!==s.agentUpdated||e[13]!==s.reload?(h=s.agentUpdated&&r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsxs(J,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:s.reload,children:[r.jsx(jn,{size:12}),"Agent updated — reload"]})}),r.jsx(ve,{side:"bottom",children:"The agent rewrote this deck while you were editing. Reloading discards unsaved differences."})]}),e[12]=s.agentUpdated,e[13]=s.reload,e[14]=h):h=e[14];let m;e[15]!==s.saving?(m=s.saving&&r.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:"Saving…"}),e[15]=s.saving,e[16]=m):m=e[16];let p;e[17]!==s?(p=s.deckDetected&&s.writable&&r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:s.editMode?"secondary":"ghost",size:"icon","aria-label":s.editMode?"Done editing":"Edit inline",className:ce(s.editMode&&"text-primary"),onClick:()=>s.setEditMode(!s.editMode),children:r.jsx(Ms,{size:14})})}),r.jsx(ve,{side:"bottom",children:s.editMode?"Done editing":"Edit inline (text, reorder, delete)"})]}),e[17]=s,e[18]=p):p=e[18];let g;e[19]!==a||e[20]!==l||e[21]!==s.deckDetected?(g=s.deckDetected?r.jsxs(Ut,{children:[r.jsx(Bt,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon","aria-label":"Download",children:r.jsx(Ve,{size:14})})}),r.jsxs(Ht,{align:"end",children:[r.jsxs(Fe,{onClick:()=>window.open(`${a}#print`,"_blank","noopener"),children:[r.jsx(Is,{size:14}),"Export as PDF"]}),r.jsx(Fe,{asChild:!0,children:r.jsxs("a",{href:a,download:l,children:[r.jsx(Ls,{size:14}),"Download HTML"]})})]})]}):r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon","aria-label":"Download",asChild:!0,children:r.jsx("a",{href:a,download:l,children:r.jsx(Ve,{size:14})})})}),r.jsx(ve,{side:"bottom",children:"Download"})]}),e[19]=a,e[20]=l,e[21]=s.deckDetected,e[22]=g):g=e[22];let b;e[23]!==a?(b=()=>window.open(a,"_blank","noopener"),e[23]=a,e[24]=b):b=e[24];let x;e[25]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Ln,{size:14}),e[25]=x):x=e[25];let y;e[26]!==b?(y=r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon","aria-label":"Open in new tab",onClick:b,children:x})}),e[26]=b,e[27]=y):y=e[27];let j;e[28]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(ve,{side:"bottom",children:"Open in new tab"}),e[28]=j):j=e[28];let N;e[29]!==y?(N=r.jsxs(be,{children:[y,j]}),e[29]=y,e[30]=N):N=e[30];let C;return e[31]!==N||e[32]!==c||e[33]!==u||e[34]!==h||e[35]!==m||e[36]!==p||e[37]!==g||e[38]!==i?(C=r.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[c,u,h,m,p,g,N,i]}),e[31]=N,e[32]=c,e[33]=u,e[34]=h,e[35]=m,e[36]=p,e[37]=g,e[38]=i,e[39]=C):C=e[39],C}const Re=1;function xr(n){if(typeof n!="object"||n===null||n.v!==Re||n.source!=="deck-viewer")return null;const e=n;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class Ne extends Error{constructor(e,t){super(e),this.code=t,this.name="DeckOpError"}code}function fs(n){return[...n.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function gr(n){const t=new DOMParser().parseFromString(n,"text/html").querySelector("deck-viewer");return t?fs(t).length:null}function br(n,e){const t=new DOMParser().parseFromString(n,"text/html"),s=t.querySelector("deck-viewer");if(!s)throw new Ne("no <deck-viewer> element in source","no-viewer");const l=fs(s),i=e.kind==="move"?e.from:e.at,o=l[i];if(!o)throw new Ne(`slide index ${i} out of range (${l.length})`,"stale-index");switch(e.kind){case"remove":{if(l.length<=1)throw new Ne("cannot remove the last slide","bad-op");o.remove();break}case"duplicate":{const c=o.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");o.after(c);break}case"move":{if(e.to<0||e.to>=l.length)throw new Ne(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?l[e.to]:l[e.to].nextSibling;s.insertBefore(o,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new Ne(`invalid attribute name: ${e.name}`,"bad-op");o.setAttribute(e.name,e.value);break}case"remove-attr":{o.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new Ne("replace html has no root element","bad-op");o.replaceWith(t.importNode(d,!0));break}default:throw new Ne(`unknown op kind: ${e.kind}`,"bad-op")}return`${n.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
|
|
3
|
+
`)}cl.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function ur(n){const e=$.c(11),{value:t,filename:s}=n,[l]=Cs(),i=l.theme==="dark"||l.theme==="system"&&typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches;let o;e[0]!==s?(o=cr(s),e[0]=s,e[1]=o):o=e[1];const a=i?"vs-dark":"light";let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsx($s,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=c):c=e[2];let d,f;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={enabled:!1},f={top:12,bottom:12},e[3]=d,e[4]=f):(d=e[3],f=e[4]);let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u={readOnly:!0,domReadOnly:!0,fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:3,wordWrap:"on",minimap:d,padding:f,renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}},e[5]=u):u=e[5];let h;return e[6]!==s||e[7]!==o||e[8]!==a||e[9]!==t?(h=r.jsx(dl,{path:s,language:o,value:t,theme:a,loading:c,options:u},s),e[6]=s,e[7]=o,e[8]=a,e[9]=t,e[10]=h):h=e[10],h}function as(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}const fr=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),hr=new Set(["txt","json","csv","tsv","log","yaml","yml","xml","toml","ts","tsx","js","jsx","py","rb","go","rs","java","sh","sql"]),un=2*1024*1024;function mr(n,e){const t=n.split(".").pop()?.toLowerCase()??"";return fr.has(t)?"image":t==="pdf"?"pdf":t==="html"||t==="htm"?"html":t==="md"||t==="markdown"?e<=un?"markdown":"download":hr.has(t)&&e<=un?"text":"download"}function cs(){const n=$.c(2);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(ae,{className:"h-6 w-2/3"}),n[0]=e):e=n[0];let t;return n[1]===Symbol.for("react.memo_cache_sentinel")?(t=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsxs("div",{className:"flex w-3/4 max-w-md flex-col gap-3 p-6",children:[e,r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsx(ae,{className:"h-3 w-full"}),r.jsx(ae,{className:"h-3 w-5/6"}),r.jsx(ae,{className:"h-3 w-2/3"})]})]})}),n[1]=t):t=n[1],t}function ds(n){const e=$.c(20),{file:t,note:s}=n;let l;e[0]!==t.filename?(l=r.jsx(ke,{filename:t.filename,className:"h-12 w-10"}),e[0]=t.filename,e[1]=l):l=e[1];let i;e[2]!==t.filename?(i=r.jsx("span",{className:"text-sm font-medium text-foreground",children:t.filename}),e[2]=t.filename,e[3]=i):i=e[3];let o;e[4]!==t.size?(o=as(t.size),e[4]=t.size,e[5]=o):o=e[5];const a=s?` · ${s}`:"";let c;e[6]!==o||e[7]!==a?(c=r.jsxs("span",{className:"text-xs text-muted-foreground",children:[o,a]}),e[6]=o,e[7]=a,e[8]=c):c=e[8];let d;e[9]!==i||e[10]!==c?(d=r.jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[i,c]}),e[9]=i,e[10]=c,e[11]=d):d=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Ve,{size:14}),e[12]=f):f=e[12];let u;e[13]!==t.downloadUrl||e[14]!==t.filename?(u=r.jsx(J,{asChild:!0,variant:"outline",size:"sm",children:r.jsxs("a",{href:t.downloadUrl,download:t.filename,children:[f,"Download"]})}),e[13]=t.downloadUrl,e[14]=t.filename,e[15]=u):u=e[15];let h;return e[16]!==l||e[17]!==d||e[18]!==u?(h=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-border bg-muted/30 px-10 py-8",children:[l,d,u]})}),e[16]=l,e[17]=d,e[18]=u,e[19]=h):h=e[19],h}function fn(n){const e=$.c(16),{file:t,markdown:s}=n;let l;e[0]!==t.downloadUrl?(l=X.fileText(t.downloadUrl),e[0]=t.downloadUrl,e[1]=l):l=e[1];let i;e[2]!==t.downloadUrl?(i=async()=>{const u=await fetch(t.downloadUrl,{credentials:"include"});if(!u.ok)throw new Error(`fetch failed: ${u.status}`);return u.text()},e[2]=t.downloadUrl,e[3]=i):i=e[3];let o;e[4]!==l||e[5]!==i?(o={queryKey:l,queryFn:i,staleTime:6e4,retry:!1},e[4]=l,e[5]=i,e[6]=o):o=e[6];const{data:a,isPending:c,isError:d}=ie(o);if(c){let u;return e[7]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(cs,{}),e[7]=u):u=e[7],u}if(d||a===void 0){let u;return e[8]!==t?(u=r.jsx(ds,{file:t,note:"preview unavailable"}),e[8]=t,e[9]=u):u=e[9],u}if(s){const u=`file-preview-${t.key}`;let h;return e[10]!==a||e[11]!==u?(h=r.jsx("div",{className:"h-full overflow-y-auto",children:r.jsx("div",{className:"prose prose-sm dark:prose-invert mx-auto max-w-3xl px-6 py-6",children:r.jsx(Ut,{id:u,text:a})})}),e[10]=a,e[11]=u,e[12]=h):h=e[12],h}let f;return e[13]!==a||e[14]!==t.filename?(f=r.jsx(ur,{value:a,filename:t.filename}),e[13]=a,e[14]=t.filename,e[15]=f):f=e[15],f}function us(n){const e=$.c(15),{file:t}=n;switch(mr(t.filename,t.size)){case"image":{let l;return e[0]!==t.downloadUrl||e[1]!==t.filename?(l=r.jsx("div",{className:"flex h-full w-full items-center justify-center overflow-auto bg-muted/30 p-4",children:r.jsx("img",{src:t.downloadUrl,alt:t.filename,className:"max-h-full max-w-full rounded-lg object-contain"})}),e[0]=t.downloadUrl,e[1]=t.filename,e[2]=l):l=e[2],l}case"pdf":{let l;return e[3]!==t.downloadUrl||e[4]!==t.filename?(l=r.jsx("iframe",{src:t.downloadUrl,title:t.filename,className:"block h-full w-full bg-white"}),e[3]=t.downloadUrl,e[4]=t.filename,e[5]=l):l=e[5],l}case"html":{let l;return e[6]!==t.downloadUrl||e[7]!==t.filename?(l=r.jsx("iframe",{src:t.downloadUrl,title:t.filename,sandbox:"allow-scripts",className:"block h-full w-full bg-white"}),e[6]=t.downloadUrl,e[7]=t.filename,e[8]=l):l=e[8],l}case"markdown":{let l;return e[9]!==t?(l=r.jsx(fn,{file:t,markdown:!0}),e[9]=t,e[10]=l):l=e[10],l}case"text":{let l;return e[11]!==t?(l=r.jsx(fn,{file:t,markdown:!1}),e[11]=t,e[12]=l):l=e[12],l}default:{let l;return e[13]!==t?(l=r.jsx(ds,{file:t}),e[13]=t,e[14]=l):l=e[14],l}}}function pr(n){const e=$.c(40),{readUrl:t,editor:s,downloadName:l,trailing:i}=n;let o;e[0]!==t?(o=new URL(t,window.location.origin).toString(),e[0]=t,e[1]=o):o=e[1];const a=o;let c;e[2]!==s?(c=s.deckDetected&&r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:s.railOpen?"secondary":"ghost",size:"icon","aria-label":s.railOpen?"Hide slide list":"Show slide list",onClick:()=>s.setRailOpen(!s.railOpen),children:r.jsx(ul,{size:14})})}),r.jsx(ve,{side:"bottom",children:s.railOpen?"Hide slide list":"Show slide list"})]}),e[2]=s,e[3]=c):c=e[3];let d;e[4]!==a?(d=()=>window.open(a,"_blank","noopener"),e[4]=a,e[5]=d):d=e[5];let f;e[6]!==a?(f=r.jsx("span",{className:"truncate",children:a}),e[6]=a,e[7]=f):f=e[7];let u;e[8]!==a||e[9]!==d||e[10]!==f?(u=r.jsx("button",{type:"button",onClick:d,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:a,children:f}),e[8]=a,e[9]=d,e[10]=f,e[11]=u):u=e[11];let h;e[12]!==s.agentUpdated||e[13]!==s.reload?(h=s.agentUpdated&&r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsxs(J,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:s.reload,children:[r.jsx(jn,{size:12}),"Agent updated — reload"]})}),r.jsx(ve,{side:"bottom",children:"The agent rewrote this deck while you were editing. Reloading discards unsaved differences."})]}),e[12]=s.agentUpdated,e[13]=s.reload,e[14]=h):h=e[14];let m;e[15]!==s.saving?(m=s.saving&&r.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:"Saving…"}),e[15]=s.saving,e[16]=m):m=e[16];let p;e[17]!==s?(p=s.deckDetected&&s.writable&&r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:s.editMode?"secondary":"ghost",size:"icon","aria-label":s.editMode?"Done editing":"Edit inline",className:ce(s.editMode&&"text-primary"),onClick:()=>s.setEditMode(!s.editMode),children:r.jsx(Ms,{size:14})})}),r.jsx(ve,{side:"bottom",children:s.editMode?"Done editing":"Edit inline (text, reorder, delete)"})]}),e[17]=s,e[18]=p):p=e[18];let g;e[19]!==a||e[20]!==l||e[21]!==s.deckDetected?(g=s.deckDetected?r.jsxs(Bt,{children:[r.jsx(Ht,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon","aria-label":"Download",children:r.jsx(Ve,{size:14})})}),r.jsxs(qt,{align:"end",children:[r.jsxs(Fe,{onClick:()=>window.open(`${a}#print`,"_blank","noopener"),children:[r.jsx(Is,{size:14}),"Export as PDF"]}),r.jsx(Fe,{asChild:!0,children:r.jsxs("a",{href:a,download:l,children:[r.jsx(Ls,{size:14}),"Download HTML"]})})]})]}):r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon","aria-label":"Download",asChild:!0,children:r.jsx("a",{href:a,download:l,children:r.jsx(Ve,{size:14})})})}),r.jsx(ve,{side:"bottom",children:"Download"})]}),e[19]=a,e[20]=l,e[21]=s.deckDetected,e[22]=g):g=e[22];let b;e[23]!==a?(b=()=>window.open(a,"_blank","noopener"),e[23]=a,e[24]=b):b=e[24];let x;e[25]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Ln,{size:14}),e[25]=x):x=e[25];let y;e[26]!==b?(y=r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon","aria-label":"Open in new tab",onClick:b,children:x})}),e[26]=b,e[27]=y):y=e[27];let j;e[28]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(ve,{side:"bottom",children:"Open in new tab"}),e[28]=j):j=e[28];let N;e[29]!==y?(N=r.jsxs(be,{children:[y,j]}),e[29]=y,e[30]=N):N=e[30];let C;return e[31]!==N||e[32]!==c||e[33]!==u||e[34]!==h||e[35]!==m||e[36]!==p||e[37]!==g||e[38]!==i?(C=r.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[c,u,h,m,p,g,N,i]}),e[31]=N,e[32]=c,e[33]=u,e[34]=h,e[35]=m,e[36]=p,e[37]=g,e[38]=i,e[39]=C):C=e[39],C}const Re=1;function xr(n){if(typeof n!="object"||n===null||n.v!==Re||n.source!=="deck-viewer")return null;const e=n;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class Ne extends Error{constructor(e,t){super(e),this.code=t,this.name="DeckOpError"}code}function fs(n){return[...n.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function gr(n){const t=new DOMParser().parseFromString(n,"text/html").querySelector("deck-viewer");return t?fs(t).length:null}function br(n,e){const t=new DOMParser().parseFromString(n,"text/html"),s=t.querySelector("deck-viewer");if(!s)throw new Ne("no <deck-viewer> element in source","no-viewer");const l=fs(s),i=e.kind==="move"?e.from:e.at,o=l[i];if(!o)throw new Ne(`slide index ${i} out of range (${l.length})`,"stale-index");switch(e.kind){case"remove":{if(l.length<=1)throw new Ne("cannot remove the last slide","bad-op");o.remove();break}case"duplicate":{const c=o.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");o.after(c);break}case"move":{if(e.to<0||e.to>=l.length)throw new Ne(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?l[e.to]:l[e.to].nextSibling;s.insertBefore(o,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new Ne(`invalid attribute name: ${e.name}`,"bad-op");o.setAttribute(e.name,e.value);break}case"remove-attr":{o.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new Ne("replace html has no root element","bad-op");o.replaceWith(t.importNode(d,!0));break}default:throw new Ne(`unknown op kind: ${e.kind}`,"bad-op")}return`${n.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
|
|
4
4
|
`:""}${t.documentElement.outerHTML}
|
|
5
|
-
`}const hn="home",yr=400,vr=800;function wr(n){const e=n.savePath!==void 0,{org:t}=de(),s=Ze(),l=_n(hn),[i,o]=S.useState(!1),[a,c]=S.useState(!1),[d,f]=S.useState(!1),[u,h]=S.useState(!1),[m,p]=S.useState(!1),[g,b]=S.useState(!1),[x,y]=S.useState(null),[j,N]=S.useState(null),[C,k]=S.useState(0),[w]=S.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),B=i||g||m,R=()=>{n.savePath!==void 0&&(s.invalidateQueries({queryKey:X.orgFsStat(t.id,hn,n.savePath)}),s.invalidateQueries({queryKey:X.orgFsRecent(t.id)}))},_=T=>{w.iframe?.contentWindow?.postMessage(T,"*")},v=()=>{w.source=null,h(!1),j&&y(j),k(T=>T+1),R()};n.statMarker!==j&&(N(n.statMarker),n.statMarker!==null&&(x===null?y(n.statMarker):w.selfMarkers.has(n.statMarker)||n.statMarker!==x&&(B?h(!0):(w.source=null,y(n.statMarker)))));const M=async()=>{w.saveTimer=null;const T=w.source;if(T===null){b(!1);return}p(!0);try{const K=await l.mutateAsync({path:n.savePath,body:T});w.selfMarkers.add(On(K)),R()}catch(K){console.error("[deck-editor] save failed",K),ue.error("Couldn't save deck edits — reloading the preview."),W.current.reload()}finally{p(!1),b(!1)}},Z=T=>{b(!0),w.saveTimer&&clearTimeout(w.saveTimer),w.saveTimer=setTimeout(()=>{W.current.flushSave()},T)},U=(T,K,z)=>{_({v:Re,type:"ack",opId:T,ok:K,error:z})},O=async T=>{if(!e){U(T.opId,!1,"read-only preview");return}try{if(w.source===null){const z=await fetch(n.readUrl,{credentials:"include"});if(!z.ok)throw new Error(`HTTP ${z.status}`);w.source=await z.text()}const K=gr(w.source);if(K===null||K!==T.witness.childCount)throw new Ne(`slide count drifted (source ${K}, iframe ${T.witness.childCount})`,"stale-index");w.source=br(w.source,T.op),U(T.opId,!0),Z(T.op.kind==="replace"?vr:yr)}catch(K){console.error("[deck-editor] op failed",T.op,K),U(T.opId,!1,K instanceof Error?K.message:String(K)),ue.error("That edit couldn't be saved — reloading the preview."),W.current.reload()}},H=T=>{if(!w.iframe||T.source!==w.iframe.contentWindow)return;const K=xr(T.data);if(K){if(K.type==="ready"){c(!0),W.current.editMode?_({v:Re,type:"set-edit-mode",enabled:!0}):W.current.railOpen&&_({v:Re,type:"set-rail",open:!0});return}K.type==="op"&&(w.queue=w.queue.then(()=>W.current.handleOp(K)).catch(()=>{}))}},W=S.useRef({onMessage:H,handleOp:O,flushSave:M,reload:v,editMode:i,railOpen:d});W.current={onMessage:H,handleOp:O,flushSave:M,reload:v,editMode:i,railOpen:d};const[q]=S.useState(()=>{let T=null;return K=>{if(K){w.iframe=K;const z=F=>W.current.onMessage(F);window.addEventListener("message",z),T=()=>window.removeEventListener("message",z)}else T?.(),T=null,w.iframe=null}}),ee=T=>{f(T),_({v:Re,type:"set-rail",open:T})},Y=T=>{o(T),_({v:Re,type:"set-edit-mode",enabled:T}),T&&f(!0),!T&&u&&!g&&!m&&v()};return{iframeRef:q,deckDetected:a,writable:e,displayedMarker:x===null?null:`${x}.${C}`,editMode:i,setEditMode:Y,railOpen:d,setRailOpen:ee,saving:m,agentUpdated:u,reload:v,postToIframe:_}}const jr=300;function kr({readUrl:n,marker:e,title:t,savePath:s,trailing:l}){const i=wr({readUrl:n,statMarker:e,savePath:s}),[o,a]=S.useState(null);if(i.displayedMarker===null)return null;const c=n.includes("?")?"&":"?",d=`${n}${c}v=${encodeURIComponent(i.displayedMarker)}`,f=o===d;return r.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[r.jsx(pr,{readUrl:n,editor:i,downloadName:t.split("/").pop()??t,trailing:l}),r.jsx("div",{className:"relative flex-1",children:r.jsx("iframe",{ref:i.iframeRef,src:d,onLoad:()=>a(d),sandbox:"allow-scripts",className:ce("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",f?"opacity-100":"opacity-0"),style:{transitionDuration:`${jr}ms`},title:t},d)})]})}const Sr=[{mode:"private",label:"Org only",Icon:Ps},{mode:"public",label:"Public",Icon:xt},{mode:"password",label:"Password",Icon:Mn}];function hs(n){const e=$.c(38),{volume:t,path:s,kind:l,shareMode:i,effectivePublic:o,url:a}=n,c=Nl(t),{data:d}=Rn(t,s),f=d?.shareMode??i,h=(d?.effectivePublic??o)&&f==="private",m=l==="dir",p=m?"folder":"file",[g,b]=S.useState(!1),[x,y]=S.useState(""),[j,N]=S.useState(!1);let C;e[0]!==s||e[1]!==c||e[2]!==p?(C=(Y,T)=>{c.mutate({path:s,mode:Y,password:T},{onSuccess:()=>{b(!1),y(""),ue.success(Y==="private"?`This ${p} is now org-only`:Y==="public"?`Anyone with the link can now view this ${p}`:`This ${p} is now password-protected`)},onError:Nr})},e[0]=s,e[1]=c,e[2]=p,e[3]=C):C=e[3];const k=C;let w;e[4]!==k?(w=Y=>{if(Y==="password"){b(!0);return}b(!1),k(Y)},e[4]=k,e[5]=w):w=e[5];const B=w,R=g?"password":f;let _;e[6]!==a?(_=async()=>{a&&(await navigator.clipboard.writeText(a),N(!0),ue.success("Link copied to clipboard"),setTimeout(()=>N(!1),2e3))},e[6]=a,e[7]=_):_=e[7];const v=_;let M;e[8]!==j||e[9]!==v||e[10]!==a?(M=a?r.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-input bg-muted/50 px-2 py-1.5",children:[r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:a}),r.jsx(J,{variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:v,"aria-label":"Copy link",children:j?r.jsx(ol,{size:12,className:"text-success"}):r.jsx(al,{size:12})})]}):null,e[8]=j,e[9]=v,e[10]=a,e[11]=M):M=e[11];const Z=M;if(h){let Y;e[12]===Symbol.for("react.memo_cache_sentinel")?(Y=r.jsx("div",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:r.jsx(xt,{size:16})}),e[12]=Y):Y=e[12];let T;e[13]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Shared via a parent folder"}),e[13]=T):T=e[13];const K=m?"files in this folder":"this file";let z;e[14]!==K?(z=r.jsxs("div",{className:"flex items-start gap-3",children:[Y,r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[T,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Anyone with the link can view"," ",K,". Manage sharing on the parent folder."]})]})]}),e[14]=K,e[15]=z):z=e[15];let F;return e[16]!==Z||e[17]!==z?(F=r.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[z,Z]}),e[16]=Z,e[17]=z,e[18]=F):F=e[18],F}let U;e[19]!==R||e[20]!==B||e[21]!==c.isPending?(U=Sr.map(Y=>{const{mode:T,label:K,Icon:z}=Y;return r.jsxs("button",{type:"button",disabled:c.isPending,onClick:()=>B(T),className:ce("flex flex-col items-center gap-1 rounded-md px-2 py-2 text-xs font-medium transition-colors disabled:opacity-60",R===T?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(z,{size:15}),K]},T)}),e[19]=R,e[20]=B,e[21]=c.isPending,e[22]=U):U=e[22];let O;e[23]!==U?(O=r.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg bg-muted p-1",children:U}),e[23]=U,e[24]=O):O=e[24];const H=R==="private"?`Only members of your organization can open ${m?"these files":"this link"}.`:R==="public"?m?"Anyone on the internet can view files in this folder via their link.":"Anyone on the internet with the link can view this file.":`Anyone with the link AND the password can view ${m?"files in this folder":"this file"}.`;let W;e[25]!==H?(W=r.jsx("p",{className:"text-xs text-muted-foreground",children:H}),e[25]=H,e[26]=W):W=e[26];let q;e[27]!==R||e[28]!==k||e[29]!==f||e[30]!==x||e[31]!==c.isPending?(q=R==="password"&&r.jsxs("form",{className:"flex items-center gap-2",onSubmit:Y=>{Y.preventDefault(),x&&k("password",x)},children:[r.jsx(Xe,{type:"password",value:x,onChange:Y=>y(Y.target.value),placeholder:f==="password"?"New password":"Password",autoComplete:"new-password",className:"h-8 text-xs"}),r.jsx(J,{type:"submit",size:"sm",className:"shrink-0",disabled:!x||c.isPending,children:f==="password"?"Update":"Set"})]}),e[27]=R,e[28]=k,e[29]=f,e[30]=x,e[31]=c.isPending,e[32]=q):q=e[32];let ee;return e[33]!==Z||e[34]!==O||e[35]!==W||e[36]!==q?(ee=r.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[O,W,q,Z]}),e[33]=Z,e[34]=O,e[35]=W,e[36]=q,e[37]=ee):ee=e[37],ee}function Nr(n){return ue.error(n instanceof Error?n.message:"Failed to update sharing")}function mn(n){const e=$.c(7),{volume:t,path:s,shareMode:l,effectivePublic:i,url:o}=n;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(ll,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon","aria-label":"Share",children:r.jsx(zn,{size:14})})})}),r.jsx(ve,{side:"bottom",children:"Share"})]}),e[0]=a):a=e[0];let c;return e[1]!==i||e[2]!==s||e[3]!==l||e[4]!==o||e[5]!==t?(c=r.jsxs(rl,{children:[a,r.jsx(il,{align:"end",className:"w-80 p-3",children:r.jsx(hs,{volume:t,path:s,kind:"file",shareMode:l,effectivePublic:i,url:o})})]}),e[1]=i,e[2]=s,e[3]=l,e[4]=o,e[5]=t,e[6]=c):c=e[6],c}function zr(n){const e=$.c(11),{target:t,onOpenChange:s}=n,l=!!t,i=t?.kind==="dir"?"folder":"file";let o;e[0]!==i?(o=r.jsx(En,{children:r.jsxs(Ue,{children:["Share ",i]})}),e[0]=i,e[1]=o):o=e[1];let a;e[2]!==t?(a=t&&r.jsx(hs,{...t}),e[2]=t,e[3]=a):a=e[3];let c;e[4]!==o||e[5]!==a?(c=r.jsxs(Je,{className:"sm:max-w-md",children:[o,a]}),e[4]=o,e[5]=a,e[6]=c):c=e[6];let d;return e[7]!==s||e[8]!==l||e[9]!==c?(d=r.jsx(et,{open:l,onOpenChange:s,children:c}),e[7]=s,e[8]=l,e[9]=c,e[10]=d):d=e[10],d}function wt(n){const e=n?n.split("/").filter(Boolean):[],t=e[0]==="public",s=t?e[1]??null:null,l=t?s?`public-${s}`:null:e[0]??null,i=(t?e.slice(2):e.slice(1)).join("/");return{segments:e,volume:l,dirPath:i,isPublic:t,publicSet:s,readOnly:t}}function Le(n,e){return n.isPublic&&n.publicSet?`public/${n.publicSet}/${e}`:n.volume?`${n.volume}/${e}`:e}const pn="public-";function Qt(n){return n.startsWith(pn)?n.slice(pn.length):null}function Cr(n,e){const t=Qt(n);return t?`public/${t}/${e}`:`${n}/${e}`}function le(n){const e=n.lastIndexOf("/");return e===-1?n:n.slice(e+1)}function $r(n){const e=$.c(11),{org:t,previewPath:s}=n;let l;e[0]!==s?(l=s.split("/").slice(0,-1).join("/"),e[0]=s,e[1]=l):l=e[1];const i=l;let o;e[2]!==t?(o={org:t},e[2]=t,e[3]=o):o=e[3];let a;e[4]!==i||e[5]!==s?(a={path:i,preview:s},e[4]=i,e[5]=s,e[6]=a):a=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Cn,{size:14}),e[7]=c):c=e[7];let d;return e[8]!==o||e[9]!==a?(d=r.jsx(J,{variant:"ghost",size:"sm",asChild:!0,className:"shrink-0 gap-1.5 text-xs text-muted-foreground",children:r.jsxs(Es,{to:"/$org/files",params:o,search:a,children:[c,"See in library"]})}),e[8]=o,e[9]=a,e[10]=d):d=e[10],d}const Pr=n=>/\.html?$/i.test(n);function xn(n){const e=$.c(6),{onClose:t}=n;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx($n,{size:14}),e[0]=s):s=e[0];let l;e[1]!==t?(l=r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",onClick:t,children:s})}),e[1]=t,e[2]=l):l=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(ve,{side:"bottom",children:"Close"}),e[3]=i):i=e[3];let o;return e[4]!==l?(o=r.jsxs(be,{children:[l,i]}),e[4]=l,e[5]=o):o=e[5],o}function ms(n){const e=$.c(37),{previewPath:t,onClose:s,showSeeInLibrary:l,variant:i}=n,o=l===void 0?!1:l;let a;e[0]!==t?(a=wt(t),e[0]=t,e[1]=a):a=e[1];const c=a,{volume:d,dirPath:f}=c,{data:u,isPending:h}=Rn(d,f),m=Sl(d??""),p=le(f);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={strict:!1},e[2]=g):g=e[2];const{org:b}=Ds(g),x=i==="dialog";let y;e[3]!==b||e[4]!==t||e[5]!==o?(y=o&&b?r.jsx($r,{org:b,previewPath:t}):null,e[3]=b,e[4]=t,e[5]=o,e[6]=y):y=e[6];const j=y,N=u&&u.kind==="file"?{key:t,filename:p,size:u.size,downloadUrl:m(u.path)}:null;if(N&&u&&Pr(p)){const _=N.downloadUrl;let v;e[7]!==u?(v=On(u),e[7]=u,e[8]=v):v=e[8];const M=d??"",Z=u.shareMode??"private",U=u.effectivePublic??!1,O=window.location.origin+N.downloadUrl;let H;e[9]!==f||e[10]!==O||e[11]!==M||e[12]!==Z||e[13]!==U?(H=r.jsx(mn,{volume:M,path:f,shareMode:Z,effectivePublic:U,url:O}),e[9]=f,e[10]=O,e[11]=M,e[12]=Z,e[13]=U,e[14]=H):H=e[14];let W;e[15]!==x||e[16]!==s?(W=x?r.jsx("div",{className:"w-8 shrink-0"}):r.jsx(xn,{onClose:s}),e[15]=x,e[16]=s,e[17]=W):W=e[17];let q;return e[18]!==j||e[19]!==H||e[20]!==W?(q=r.jsxs(r.Fragment,{children:[H,j,W]}),e[18]=j,e[19]=H,e[20]=W,e[21]=q):q=e[21],r.jsxs(r.Fragment,{children:[x&&r.jsx(Ue,{className:"sr-only",children:p}),r.jsx(kr,{readUrl:_,marker:v,title:p,savePath:d==="home"?f:void 0,trailing:q},t)]})}const C=x?"h-11 py-1 pr-12 pl-2":"h-9 px-2";let k;e[22]!==C?(k=ce("flex shrink-0 items-center gap-1 border-b border-border/60",C),e[22]=C,e[23]=k):k=e[23];let w;e[24]!==u?.effectivePublic||e[25]!==u?.shareMode||e[26]!==N||e[27]!==f||e[28]!==d?(w=N&&r.jsxs(r.Fragment,{children:[r.jsx(mn,{volume:d??"",path:f,shareMode:u?.shareMode??"private",effectivePublic:u?.effectivePublic??!1,url:window.location.origin+N.downloadUrl}),r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",asChild:!0,children:r.jsx("a",{href:N.downloadUrl,download:N.filename,children:r.jsx(Ve,{size:14})})})}),r.jsx(ve,{side:"bottom",children:"Download"})]}),r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>window.open(N.downloadUrl,"_blank","noopener"),children:r.jsx(Ln,{size:14})})}),r.jsx(ve,{side:"bottom",children:"Open in new tab"})]})]}),e[24]=u?.effectivePublic,e[25]=u?.shareMode,e[26]=N,e[27]=f,e[28]=d,e[29]=w):w=e[29];let B;e[30]!==x||e[31]!==s?(B=!x&&r.jsx(xn,{onClose:s}),e[30]=x,e[31]=s,e[32]=B):B=e[32];let R;return e[33]!==N||e[34]!==p||e[35]!==h?(R=r.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:N?r.jsx(us,{file:N}):h?r.jsx(cs,{}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[r.jsx(ke,{filename:p,className:"h-7.5 w-6"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."})]})}),e[33]=N,e[34]=p,e[35]=h,e[36]=R):R=e[36],r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:k,children:[r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r.jsx(ke,{filename:p,className:"h-4.5 w-3.5 shrink-0"}),x?r.jsx(Ue,{className:"truncate text-xs font-medium text-foreground",children:p}):r.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:p}),N&&r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:as(N.size)})]}),j,w,B]}),R]})}function Er(n){const e=$.c(4),{previewPath:t,onClose:s,showSeeInLibrary:l}=n,i=l===void 0?!1:l;let o;return e[0]!==s||e[1]!==t||e[2]!==i?(o=r.jsx("div",{className:"flex h-full w-full flex-col bg-background",children:r.jsx(ms,{previewPath:t,onClose:s,showSeeInLibrary:i,variant:"panel"})}),e[0]=s,e[1]=t,e[2]=i,e[3]=o):o=e[3],o}const Dr=new Set(["output","upload","public","home"]),Tr=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function ps(n){return Dr.has(n)||!Tr.test(n)?"home":n}function Fr(n){const e=$.c(10),{icon:t,className:s}=n,l=s===void 0?"size-4":s;if(t.kind==="component"){const{Component:o}=t;let a;return e[0]!==o||e[1]!==l?(a=r.jsx(o,{className:l}),e[0]=o,e[1]=l,e[2]=a):a=e[2],a}if(t.kind==="url"){const o=t.src;let a;e[3]!==l?(a=ce(l,"rounded-sm object-cover"),e[3]=l,e[4]=a):a=e[4];let c;return e[5]!==t.src||e[6]!==a?(c=r.jsx("img",{src:o,alt:"",className:a}),e[5]=t.src,e[6]=a,e[7]=c):c=e[7],c}let i;return e[8]!==l?(i=r.jsx(Js,{className:l}),e[8]=l,e[9]=i):i=e[9],i}function Mr(n){const e=$.c(17),{title:t,icon:s,active:l,onClick:i,disabled:o,locked:a,className:c}=n,d=o===void 0?!1:o,f=a===void 0?!1:a,u=f||void 0,h=f&&"pointer-events-none",m=l?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let p;e[0]!==c||e[1]!==h||e[2]!==m?(p=ce("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]","disabled:opacity-40 disabled:pointer-events-none",h,m,c),e[0]=c,e[1]=h,e[2]=m,e[3]=p):p=e[3];let g;e[4]!==s?(g=r.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:r.jsx(Fr,{icon:s})}),e[4]=s,e[5]=g):g=e[5];let b;e[6]!==t?(b=r.jsx("span",{className:"max-md:hidden whitespace-nowrap text-sm font-medium leading-none",children:t}),e[6]=t,e[7]=b):b=e[7];let x;return e[8]!==l||e[9]!==d||e[10]!==i||e[11]!==u||e[12]!==p||e[13]!==g||e[14]!==b||e[15]!==t?(x=r.jsxs("button",{type:"button",onClick:i,disabled:d,"aria-pressed":l,"aria-disabled":u,"aria-label":t,className:p,children:[g,b]}),e[8]=l,e[9]=d,e[10]=i,e[11]=u,e[12]=p,e[13]=g,e[14]=b,e[15]=t,e[16]=x):x=e[16],x}function Ir(n){const e=$.c(33);let t,s,l;e[0]!==n?({glyph:t,readOnly:l,...s}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=l):(t=e[1],s=e[2],l=e[3]);const i=S.useId(),o=`${i}-back`,a=`${i}-front`,c=`url(#${o})`;let d;e[4]!==c?(d=r.jsx("path",{d:"M2.53738 2.55C1.13602 2.55 0 3.68602 0 5.08738V11.535H31.931V7.65326C31.931 6.23616 30.7822 5.08738 29.3651 5.08738H14.7681L13.8775 5.02542C13.3886 4.99141 12.9197 4.81809 12.5261 4.52596L10.7726 3.22419C10.1828 2.78638 9.46784 2.55 8.73334 2.55H2.53738Z",fill:c}),e[4]=c,e[5]=d):d=e[5];const f=`url(#${a})`;let u;e[6]!==f?(u=r.jsx("rect",{y:"8.72",width:"32",height:"21",rx:"2.566",fill:f}),e[6]=f,e[7]=u):u=e[7];let h,m,p;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("rect",{x:"0.3",y:"8.86",width:"31.4",height:"0.55",rx:"0.275",fill:"#FFFFFF",opacity:"0.25"}),m=r.jsx("rect",{y:"25.81",width:"32",height:"0.552",fill:"#84CDFB"}),p=r.jsx("rect",{y:"27.05",width:"32",height:"0.552",fill:"#84CDFB"}),e[8]=h,e[9]=m,e[10]=p):(h=e[8],m=e[9],p=e[10]);let g;e[11]!==t?(g=t&&r.jsx(t,{x:10.5,y:13.2,width:11,height:11,strokeWidth:2.2,style:{color:"#014AC9",opacity:.55}}),e[11]=t,e[12]=g):g=e[12];let b;e[13]!==l?(b=l&&r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"25.5",cy:"25.5",r:"6.2",strokeWidth:"1",className:"fill-background stroke-border"}),r.jsx(Nn,{x:22.1,y:22.1,width:6.8,height:6.8,strokeWidth:2.2,className:"text-muted-foreground"})]}),e[13]=l,e[14]=b):b=e[14];let x,y;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx("stop",{offset:"0.3",stopColor:"#4D87DF"}),y=r.jsx("stop",{offset:"1",stopColor:"#296FE8"}),e[15]=x,e[16]=y):(x=e[15],y=e[16]);let j;e[17]!==o?(j=r.jsxs("linearGradient",{id:o,x1:"15.97",y1:"2.55",x2:"15.97",y2:"9.53",gradientUnits:"userSpaceOnUse",children:[x,y]}),e[17]=o,e[18]=j):j=e[18];let N,C;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("stop",{stopColor:"#72B6FA"}),C=r.jsx("stop",{offset:"1",stopColor:"#5BB1EF"}),e[19]=N,e[20]=C):(N=e[19],C=e[20]);let k;e[21]!==a?(k=r.jsxs("radialGradient",{id:a,cx:"0",cy:"0",r:"10",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(1.6 0 0 2.1538 16 19.22)",children:[N,C]}),e[21]=a,e[22]=k):k=e[22];let w;e[23]!==j||e[24]!==k?(w=r.jsxs("defs",{children:[j,k]}),e[23]=j,e[24]=k,e[25]=w):w=e[25];let B;return e[26]!==s||e[27]!==w||e[28]!==d||e[29]!==u||e[30]!==g||e[31]!==b?(B=r.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...s,children:[d,u,h,m,p,g,b,w]}),e[26]=s,e[27]=w,e[28]=d,e[29]=u,e[30]=g,e[31]=b,e[32]=B):B=e[32],B}function Lr(n,e,t){return e?"color":t?"font":/^--brand-(text|fw|leading|tracking)/i.test(n)?"type":/^--brand-space/i.test(n)?"space":/^--brand-radius/i.test(n)?"radius":/^--brand-shadow/i.test(n)?"shadow":/^--brand-(duration|delay|ease)/i.test(n)?"motion":"other"}const Or=/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\(/i,Rr=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ar=["svg","png","jpg","jpeg","webp","avif","gif"];function _r(n){return n.split(".").pop()?.toLowerCase()??""}function Ur(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Br(n){const e=n.trim();return Rr.test(e)||Or.test(e)}function Hr(n){const e=n.trim(),t=e.match(/^#([0-9a-f]{3})$/i);return t?.[1]?`#${[...t[1]].map(s=>s+s).join("")}`:e}function xs(n){const e=[],t=new Map,s=/(--brand-[\w-]+)\s*:\s*([^;]+);/g;let l;for(;(l=s.exec(n))!==null;){const i=l[1],o=l[2].trim();t.has(i)||e.push(i),t.set(i,o)}return e.map(i=>{const o=t.get(i),a=Br(o),c=/^--brand-font/i.test(i);return{name:i,value:o,isColor:a,isFont:c,kind:Lr(i,a,c)}})}const gn=["primary","secondary","accent","neutral","success","warning","error","info","bg","fg","border","ring"];function qr(n){return n.match(/^--brand-([a-z]+)/i)?.[1]?.toLowerCase()??n}function Kr(n){const e=[],t=new Map;for(const l of n){if(l.kind!=="color")continue;const i=qr(l.name);t.has(i)||(e.push(i),t.set(i,[])),t.get(i).push(l)}return e.map(l=>{const i=t.get(l);return{family:l,tokens:i,isRamp:i.filter(o=>/-\d+$/.test(o.name)).length>=5}}).sort((l,i)=>{const o=gn.indexOf(l.family),a=gn.indexOf(i.family);return o===-1&&a===-1?0:o===-1?1:a===-1?-1:o-a})}function Wr(n,e,t){const s=new RegExp(`(${Ur(e)}\\s*:\\s*)[^;]+(;)`);if(s.test(n))return n.replace(s,(o,a,c)=>`${a}${t}${c}`);const l=n.search(/:root\s*\{/);if(l!==-1){const o=n.indexOf("{",l)+1;return`${n.slice(0,o)}
|
|
5
|
+
`}const hn="home",yr=400,vr=800;function wr(n){const e=n.savePath!==void 0,{org:t}=de(),s=Ze(),l=_n(hn),[i,o]=S.useState(!1),[a,c]=S.useState(!1),[d,f]=S.useState(!1),[u,h]=S.useState(!1),[m,p]=S.useState(!1),[g,b]=S.useState(!1),[x,y]=S.useState(null),[j,N]=S.useState(null),[C,k]=S.useState(0),[w]=S.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),B=i||g||m,R=()=>{n.savePath!==void 0&&(s.invalidateQueries({queryKey:X.orgFsStat(t.id,hn,n.savePath)}),s.invalidateQueries({queryKey:X.orgFsRecent(t.id)}))},_=T=>{w.iframe?.contentWindow?.postMessage(T,"*")},v=()=>{w.source=null,h(!1),j&&y(j),k(T=>T+1),R()};n.statMarker!==j&&(N(n.statMarker),n.statMarker!==null&&(x===null?y(n.statMarker):w.selfMarkers.has(n.statMarker)||n.statMarker!==x&&(B?h(!0):(w.source=null,y(n.statMarker)))));const M=async()=>{w.saveTimer=null;const T=w.source;if(T===null){b(!1);return}p(!0);try{const K=await l.mutateAsync({path:n.savePath,body:T});w.selfMarkers.add(On(K)),R()}catch(K){console.error("[deck-editor] save failed",K),ue.error("Couldn't save deck edits — reloading the preview."),W.current.reload()}finally{p(!1),b(!1)}},Z=T=>{b(!0),w.saveTimer&&clearTimeout(w.saveTimer),w.saveTimer=setTimeout(()=>{W.current.flushSave()},T)},U=(T,K,z)=>{_({v:Re,type:"ack",opId:T,ok:K,error:z})},O=async T=>{if(!e){U(T.opId,!1,"read-only preview");return}try{if(w.source===null){const z=await fetch(n.readUrl,{credentials:"include"});if(!z.ok)throw new Error(`HTTP ${z.status}`);w.source=await z.text()}const K=gr(w.source);if(K===null||K!==T.witness.childCount)throw new Ne(`slide count drifted (source ${K}, iframe ${T.witness.childCount})`,"stale-index");w.source=br(w.source,T.op),U(T.opId,!0),Z(T.op.kind==="replace"?vr:yr)}catch(K){console.error("[deck-editor] op failed",T.op,K),U(T.opId,!1,K instanceof Error?K.message:String(K)),ue.error("That edit couldn't be saved — reloading the preview."),W.current.reload()}},H=T=>{if(!w.iframe||T.source!==w.iframe.contentWindow)return;const K=xr(T.data);if(K){if(K.type==="ready"){c(!0),W.current.editMode?_({v:Re,type:"set-edit-mode",enabled:!0}):W.current.railOpen&&_({v:Re,type:"set-rail",open:!0});return}K.type==="op"&&(w.queue=w.queue.then(()=>W.current.handleOp(K)).catch(()=>{}))}},W=S.useRef({onMessage:H,handleOp:O,flushSave:M,reload:v,editMode:i,railOpen:d});W.current={onMessage:H,handleOp:O,flushSave:M,reload:v,editMode:i,railOpen:d};const[q]=S.useState(()=>{let T=null;return K=>{if(K){w.iframe=K;const z=F=>W.current.onMessage(F);window.addEventListener("message",z),T=()=>window.removeEventListener("message",z)}else T?.(),T=null,w.iframe=null}}),ee=T=>{f(T),_({v:Re,type:"set-rail",open:T})},Y=T=>{o(T),_({v:Re,type:"set-edit-mode",enabled:T}),T&&f(!0),!T&&u&&!g&&!m&&v()};return{iframeRef:q,deckDetected:a,writable:e,displayedMarker:x===null?null:`${x}.${C}`,editMode:i,setEditMode:Y,railOpen:d,setRailOpen:ee,saving:m,agentUpdated:u,reload:v,postToIframe:_}}const jr=300;function kr({readUrl:n,marker:e,title:t,savePath:s,trailing:l}){const i=wr({readUrl:n,statMarker:e,savePath:s}),[o,a]=S.useState(null);if(i.displayedMarker===null)return null;const c=n.includes("?")?"&":"?",d=`${n}${c}v=${encodeURIComponent(i.displayedMarker)}`,f=o===d;return r.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[r.jsx(pr,{readUrl:n,editor:i,downloadName:t.split("/").pop()??t,trailing:l}),r.jsx("div",{className:"relative flex-1",children:r.jsx("iframe",{ref:i.iframeRef,src:d,onLoad:()=>a(d),sandbox:"allow-scripts",className:ce("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",f?"opacity-100":"opacity-0"),style:{transitionDuration:`${jr}ms`},title:t},d)})]})}const Sr=[{mode:"private",label:"Org only",Icon:Ps},{mode:"public",label:"Public",Icon:xt},{mode:"password",label:"Password",Icon:Mn}];function hs(n){const e=$.c(38),{volume:t,path:s,kind:l,shareMode:i,effectivePublic:o,url:a}=n,c=Nl(t),{data:d}=Rn(t,s),f=d?.shareMode??i,h=(d?.effectivePublic??o)&&f==="private",m=l==="dir",p=m?"folder":"file",[g,b]=S.useState(!1),[x,y]=S.useState(""),[j,N]=S.useState(!1);let C;e[0]!==s||e[1]!==c||e[2]!==p?(C=(Y,T)=>{c.mutate({path:s,mode:Y,password:T},{onSuccess:()=>{b(!1),y(""),ue.success(Y==="private"?`This ${p} is now org-only`:Y==="public"?`Anyone with the link can now view this ${p}`:`This ${p} is now password-protected`)},onError:Nr})},e[0]=s,e[1]=c,e[2]=p,e[3]=C):C=e[3];const k=C;let w;e[4]!==k?(w=Y=>{if(Y==="password"){b(!0);return}b(!1),k(Y)},e[4]=k,e[5]=w):w=e[5];const B=w,R=g?"password":f;let _;e[6]!==a?(_=async()=>{a&&(await navigator.clipboard.writeText(a),N(!0),ue.success("Link copied to clipboard"),setTimeout(()=>N(!1),2e3))},e[6]=a,e[7]=_):_=e[7];const v=_;let M;e[8]!==j||e[9]!==v||e[10]!==a?(M=a?r.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-input bg-muted/50 px-2 py-1.5",children:[r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:a}),r.jsx(J,{variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:v,"aria-label":"Copy link",children:j?r.jsx(ol,{size:12,className:"text-success"}):r.jsx(al,{size:12})})]}):null,e[8]=j,e[9]=v,e[10]=a,e[11]=M):M=e[11];const Z=M;if(h){let Y;e[12]===Symbol.for("react.memo_cache_sentinel")?(Y=r.jsx("div",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:r.jsx(xt,{size:16})}),e[12]=Y):Y=e[12];let T;e[13]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Shared via a parent folder"}),e[13]=T):T=e[13];const K=m?"files in this folder":"this file";let z;e[14]!==K?(z=r.jsxs("div",{className:"flex items-start gap-3",children:[Y,r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[T,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Anyone with the link can view"," ",K,". Manage sharing on the parent folder."]})]})]}),e[14]=K,e[15]=z):z=e[15];let F;return e[16]!==Z||e[17]!==z?(F=r.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[z,Z]}),e[16]=Z,e[17]=z,e[18]=F):F=e[18],F}let U;e[19]!==R||e[20]!==B||e[21]!==c.isPending?(U=Sr.map(Y=>{const{mode:T,label:K,Icon:z}=Y;return r.jsxs("button",{type:"button",disabled:c.isPending,onClick:()=>B(T),className:ce("flex flex-col items-center gap-1 rounded-md px-2 py-2 text-xs font-medium transition-colors disabled:opacity-60",R===T?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(z,{size:15}),K]},T)}),e[19]=R,e[20]=B,e[21]=c.isPending,e[22]=U):U=e[22];let O;e[23]!==U?(O=r.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg bg-muted p-1",children:U}),e[23]=U,e[24]=O):O=e[24];const H=R==="private"?`Only members of your organization can open ${m?"these files":"this link"}.`:R==="public"?m?"Anyone on the internet can view files in this folder via their link.":"Anyone on the internet with the link can view this file.":`Anyone with the link AND the password can view ${m?"files in this folder":"this file"}.`;let W;e[25]!==H?(W=r.jsx("p",{className:"text-xs text-muted-foreground",children:H}),e[25]=H,e[26]=W):W=e[26];let q;e[27]!==R||e[28]!==k||e[29]!==f||e[30]!==x||e[31]!==c.isPending?(q=R==="password"&&r.jsxs("form",{className:"flex items-center gap-2",onSubmit:Y=>{Y.preventDefault(),x&&k("password",x)},children:[r.jsx(Xe,{type:"password",value:x,onChange:Y=>y(Y.target.value),placeholder:f==="password"?"New password":"Password",autoComplete:"new-password",className:"h-8 text-xs"}),r.jsx(J,{type:"submit",size:"sm",className:"shrink-0",disabled:!x||c.isPending,children:f==="password"?"Update":"Set"})]}),e[27]=R,e[28]=k,e[29]=f,e[30]=x,e[31]=c.isPending,e[32]=q):q=e[32];let ee;return e[33]!==Z||e[34]!==O||e[35]!==W||e[36]!==q?(ee=r.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[O,W,q,Z]}),e[33]=Z,e[34]=O,e[35]=W,e[36]=q,e[37]=ee):ee=e[37],ee}function Nr(n){return ue.error(n instanceof Error?n.message:"Failed to update sharing")}function mn(n){const e=$.c(7),{volume:t,path:s,shareMode:l,effectivePublic:i,url:o}=n;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(ll,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon","aria-label":"Share",children:r.jsx(zn,{size:14})})})}),r.jsx(ve,{side:"bottom",children:"Share"})]}),e[0]=a):a=e[0];let c;return e[1]!==i||e[2]!==s||e[3]!==l||e[4]!==o||e[5]!==t?(c=r.jsxs(rl,{children:[a,r.jsx(il,{align:"end",className:"w-80 p-3",children:r.jsx(hs,{volume:t,path:s,kind:"file",shareMode:l,effectivePublic:i,url:o})})]}),e[1]=i,e[2]=s,e[3]=l,e[4]=o,e[5]=t,e[6]=c):c=e[6],c}function zr(n){const e=$.c(11),{target:t,onOpenChange:s}=n,l=!!t,i=t?.kind==="dir"?"folder":"file";let o;e[0]!==i?(o=r.jsx(En,{children:r.jsxs(Ue,{children:["Share ",i]})}),e[0]=i,e[1]=o):o=e[1];let a;e[2]!==t?(a=t&&r.jsx(hs,{...t}),e[2]=t,e[3]=a):a=e[3];let c;e[4]!==o||e[5]!==a?(c=r.jsxs(Je,{className:"sm:max-w-md",children:[o,a]}),e[4]=o,e[5]=a,e[6]=c):c=e[6];let d;return e[7]!==s||e[8]!==l||e[9]!==c?(d=r.jsx(et,{open:l,onOpenChange:s,children:c}),e[7]=s,e[8]=l,e[9]=c,e[10]=d):d=e[10],d}function jt(n){const e=n?n.split("/").filter(Boolean):[],t=e[0]==="public",s=t?e[1]??null:null,l=t?s?`public-${s}`:null:e[0]??null,i=(t?e.slice(2):e.slice(1)).join("/");return{segments:e,volume:l,dirPath:i,isPublic:t,publicSet:s,readOnly:t}}function Le(n,e){return n.isPublic&&n.publicSet?`public/${n.publicSet}/${e}`:n.volume?`${n.volume}/${e}`:e}const pn="public-";function Qt(n){return n.startsWith(pn)?n.slice(pn.length):null}function Cr(n,e){const t=Qt(n);return t?`public/${t}/${e}`:`${n}/${e}`}function le(n){const e=n.lastIndexOf("/");return e===-1?n:n.slice(e+1)}function $r(n){const e=$.c(11),{org:t,previewPath:s}=n;let l;e[0]!==s?(l=s.split("/").slice(0,-1).join("/"),e[0]=s,e[1]=l):l=e[1];const i=l;let o;e[2]!==t?(o={org:t},e[2]=t,e[3]=o):o=e[3];let a;e[4]!==i||e[5]!==s?(a={path:i,preview:s},e[4]=i,e[5]=s,e[6]=a):a=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Cn,{size:14}),e[7]=c):c=e[7];let d;return e[8]!==o||e[9]!==a?(d=r.jsx(J,{variant:"ghost",size:"sm",asChild:!0,className:"shrink-0 gap-1.5 text-xs text-muted-foreground",children:r.jsxs(Es,{to:"/$org/files",params:o,search:a,children:[c,"See in library"]})}),e[8]=o,e[9]=a,e[10]=d):d=e[10],d}const Pr=n=>/\.html?$/i.test(n);function xn(n){const e=$.c(6),{onClose:t}=n;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx($n,{size:14}),e[0]=s):s=e[0];let l;e[1]!==t?(l=r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",onClick:t,children:s})}),e[1]=t,e[2]=l):l=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(ve,{side:"bottom",children:"Close"}),e[3]=i):i=e[3];let o;return e[4]!==l?(o=r.jsxs(be,{children:[l,i]}),e[4]=l,e[5]=o):o=e[5],o}function ms(n){const e=$.c(37),{previewPath:t,onClose:s,showSeeInLibrary:l,variant:i}=n,o=l===void 0?!1:l;let a;e[0]!==t?(a=jt(t),e[0]=t,e[1]=a):a=e[1];const c=a,{volume:d,dirPath:f}=c,{data:u,isPending:h}=Rn(d,f),m=Sl(d??""),p=le(f);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={strict:!1},e[2]=g):g=e[2];const{org:b}=Ds(g),x=i==="dialog";let y;e[3]!==b||e[4]!==t||e[5]!==o?(y=o&&b?r.jsx($r,{org:b,previewPath:t}):null,e[3]=b,e[4]=t,e[5]=o,e[6]=y):y=e[6];const j=y,N=u&&u.kind==="file"?{key:t,filename:p,size:u.size,downloadUrl:m(u.path)}:null;if(N&&u&&Pr(p)){const _=N.downloadUrl;let v;e[7]!==u?(v=On(u),e[7]=u,e[8]=v):v=e[8];const M=d??"",Z=u.shareMode??"private",U=u.effectivePublic??!1,O=window.location.origin+N.downloadUrl;let H;e[9]!==f||e[10]!==O||e[11]!==M||e[12]!==Z||e[13]!==U?(H=r.jsx(mn,{volume:M,path:f,shareMode:Z,effectivePublic:U,url:O}),e[9]=f,e[10]=O,e[11]=M,e[12]=Z,e[13]=U,e[14]=H):H=e[14];let W;e[15]!==x||e[16]!==s?(W=x?r.jsx("div",{className:"w-8 shrink-0"}):r.jsx(xn,{onClose:s}),e[15]=x,e[16]=s,e[17]=W):W=e[17];let q;return e[18]!==j||e[19]!==H||e[20]!==W?(q=r.jsxs(r.Fragment,{children:[H,j,W]}),e[18]=j,e[19]=H,e[20]=W,e[21]=q):q=e[21],r.jsxs(r.Fragment,{children:[x&&r.jsx(Ue,{className:"sr-only",children:p}),r.jsx(kr,{readUrl:_,marker:v,title:p,savePath:d==="home"?f:void 0,trailing:q},t)]})}const C=x?"h-11 py-1 pr-12 pl-2":"h-9 px-2";let k;e[22]!==C?(k=ce("flex shrink-0 items-center gap-1 border-b border-border/60",C),e[22]=C,e[23]=k):k=e[23];let w;e[24]!==u?.effectivePublic||e[25]!==u?.shareMode||e[26]!==N||e[27]!==f||e[28]!==d?(w=N&&r.jsxs(r.Fragment,{children:[r.jsx(mn,{volume:d??"",path:f,shareMode:u?.shareMode??"private",effectivePublic:u?.effectivePublic??!1,url:window.location.origin+N.downloadUrl}),r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",asChild:!0,children:r.jsx("a",{href:N.downloadUrl,download:N.filename,children:r.jsx(Ve,{size:14})})})}),r.jsx(ve,{side:"bottom",children:"Download"})]}),r.jsxs(be,{children:[r.jsx(ye,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",onClick:()=>window.open(N.downloadUrl,"_blank","noopener"),children:r.jsx(Ln,{size:14})})}),r.jsx(ve,{side:"bottom",children:"Open in new tab"})]})]}),e[24]=u?.effectivePublic,e[25]=u?.shareMode,e[26]=N,e[27]=f,e[28]=d,e[29]=w):w=e[29];let B;e[30]!==x||e[31]!==s?(B=!x&&r.jsx(xn,{onClose:s}),e[30]=x,e[31]=s,e[32]=B):B=e[32];let R;return e[33]!==N||e[34]!==p||e[35]!==h?(R=r.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:N?r.jsx(us,{file:N}):h?r.jsx(cs,{}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[r.jsx(ke,{filename:p,className:"h-7.5 w-6"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."})]})}),e[33]=N,e[34]=p,e[35]=h,e[36]=R):R=e[36],r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:k,children:[r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r.jsx(ke,{filename:p,className:"h-4.5 w-3.5 shrink-0"}),x?r.jsx(Ue,{className:"truncate text-xs font-medium text-foreground",children:p}):r.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:p}),N&&r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:as(N.size)})]}),j,w,B]}),R]})}function Er(n){const e=$.c(4),{previewPath:t,onClose:s,showSeeInLibrary:l}=n,i=l===void 0?!1:l;let o;return e[0]!==s||e[1]!==t||e[2]!==i?(o=r.jsx("div",{className:"flex h-full w-full flex-col bg-background",children:r.jsx(ms,{previewPath:t,onClose:s,showSeeInLibrary:i,variant:"panel"})}),e[0]=s,e[1]=t,e[2]=i,e[3]=o):o=e[3],o}const Dr=new Set(["output","upload","public","home"]),Tr=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function ps(n){return Dr.has(n)||!Tr.test(n)?"home":n}function Fr(n){const e=$.c(10),{icon:t,className:s}=n,l=s===void 0?"size-4":s;if(t.kind==="component"){const{Component:o}=t;let a;return e[0]!==o||e[1]!==l?(a=r.jsx(o,{className:l}),e[0]=o,e[1]=l,e[2]=a):a=e[2],a}if(t.kind==="url"){const o=t.src;let a;e[3]!==l?(a=ce(l,"rounded-sm object-cover"),e[3]=l,e[4]=a):a=e[4];let c;return e[5]!==t.src||e[6]!==a?(c=r.jsx("img",{src:o,alt:"",className:a}),e[5]=t.src,e[6]=a,e[7]=c):c=e[7],c}let i;return e[8]!==l?(i=r.jsx(Js,{className:l}),e[8]=l,e[9]=i):i=e[9],i}function Mr(n){const e=$.c(17),{title:t,icon:s,active:l,onClick:i,disabled:o,locked:a,className:c}=n,d=o===void 0?!1:o,f=a===void 0?!1:a,u=f||void 0,h=f&&"pointer-events-none",m=l?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let p;e[0]!==c||e[1]!==h||e[2]!==m?(p=ce("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]","disabled:opacity-40 disabled:pointer-events-none",h,m,c),e[0]=c,e[1]=h,e[2]=m,e[3]=p):p=e[3];let g;e[4]!==s?(g=r.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:r.jsx(Fr,{icon:s})}),e[4]=s,e[5]=g):g=e[5];let b;e[6]!==t?(b=r.jsx("span",{className:"max-md:hidden whitespace-nowrap text-sm font-medium leading-none",children:t}),e[6]=t,e[7]=b):b=e[7];let x;return e[8]!==l||e[9]!==d||e[10]!==i||e[11]!==u||e[12]!==p||e[13]!==g||e[14]!==b||e[15]!==t?(x=r.jsxs("button",{type:"button",onClick:i,disabled:d,"aria-pressed":l,"aria-disabled":u,"aria-label":t,className:p,children:[g,b]}),e[8]=l,e[9]=d,e[10]=i,e[11]=u,e[12]=p,e[13]=g,e[14]=b,e[15]=t,e[16]=x):x=e[16],x}function Ir(n){const e=$.c(33);let t,s,l;e[0]!==n?({glyph:t,readOnly:l,...s}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=l):(t=e[1],s=e[2],l=e[3]);const i=S.useId(),o=`${i}-back`,a=`${i}-front`,c=`url(#${o})`;let d;e[4]!==c?(d=r.jsx("path",{d:"M2.53738 2.55C1.13602 2.55 0 3.68602 0 5.08738V11.535H31.931V7.65326C31.931 6.23616 30.7822 5.08738 29.3651 5.08738H14.7681L13.8775 5.02542C13.3886 4.99141 12.9197 4.81809 12.5261 4.52596L10.7726 3.22419C10.1828 2.78638 9.46784 2.55 8.73334 2.55H2.53738Z",fill:c}),e[4]=c,e[5]=d):d=e[5];const f=`url(#${a})`;let u;e[6]!==f?(u=r.jsx("rect",{y:"8.72",width:"32",height:"21",rx:"2.566",fill:f}),e[6]=f,e[7]=u):u=e[7];let h,m,p;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("rect",{x:"0.3",y:"8.86",width:"31.4",height:"0.55",rx:"0.275",fill:"#FFFFFF",opacity:"0.25"}),m=r.jsx("rect",{y:"25.81",width:"32",height:"0.552",fill:"#84CDFB"}),p=r.jsx("rect",{y:"27.05",width:"32",height:"0.552",fill:"#84CDFB"}),e[8]=h,e[9]=m,e[10]=p):(h=e[8],m=e[9],p=e[10]);let g;e[11]!==t?(g=t&&r.jsx(t,{x:10.5,y:13.2,width:11,height:11,strokeWidth:2.2,style:{color:"#014AC9",opacity:.55}}),e[11]=t,e[12]=g):g=e[12];let b;e[13]!==l?(b=l&&r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"25.5",cy:"25.5",r:"6.2",strokeWidth:"1",className:"fill-background stroke-border"}),r.jsx(Nn,{x:22.1,y:22.1,width:6.8,height:6.8,strokeWidth:2.2,className:"text-muted-foreground"})]}),e[13]=l,e[14]=b):b=e[14];let x,y;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx("stop",{offset:"0.3",stopColor:"#4D87DF"}),y=r.jsx("stop",{offset:"1",stopColor:"#296FE8"}),e[15]=x,e[16]=y):(x=e[15],y=e[16]);let j;e[17]!==o?(j=r.jsxs("linearGradient",{id:o,x1:"15.97",y1:"2.55",x2:"15.97",y2:"9.53",gradientUnits:"userSpaceOnUse",children:[x,y]}),e[17]=o,e[18]=j):j=e[18];let N,C;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("stop",{stopColor:"#72B6FA"}),C=r.jsx("stop",{offset:"1",stopColor:"#5BB1EF"}),e[19]=N,e[20]=C):(N=e[19],C=e[20]);let k;e[21]!==a?(k=r.jsxs("radialGradient",{id:a,cx:"0",cy:"0",r:"10",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(1.6 0 0 2.1538 16 19.22)",children:[N,C]}),e[21]=a,e[22]=k):k=e[22];let w;e[23]!==j||e[24]!==k?(w=r.jsxs("defs",{children:[j,k]}),e[23]=j,e[24]=k,e[25]=w):w=e[25];let B;return e[26]!==s||e[27]!==w||e[28]!==d||e[29]!==u||e[30]!==g||e[31]!==b?(B=r.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...s,children:[d,u,h,m,p,g,b,w]}),e[26]=s,e[27]=w,e[28]=d,e[29]=u,e[30]=g,e[31]=b,e[32]=B):B=e[32],B}function Lr(n,e,t){return e?"color":t?"font":/^--brand-(text|fw|leading|tracking)/i.test(n)?"type":/^--brand-space/i.test(n)?"space":/^--brand-radius/i.test(n)?"radius":/^--brand-shadow/i.test(n)?"shadow":/^--brand-(duration|delay|ease)/i.test(n)?"motion":"other"}const Or=/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\(/i,Rr=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ar=["svg","png","jpg","jpeg","webp","avif","gif"];function _r(n){return n.split(".").pop()?.toLowerCase()??""}function Ur(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Br(n){const e=n.trim();return Rr.test(e)||Or.test(e)}function Hr(n){const e=n.trim(),t=e.match(/^#([0-9a-f]{3})$/i);return t?.[1]?`#${[...t[1]].map(s=>s+s).join("")}`:e}function xs(n){const e=[],t=new Map,s=/(--brand-[\w-]+)\s*:\s*([^;]+);/g;let l;for(;(l=s.exec(n))!==null;){const i=l[1],o=l[2].trim();t.has(i)||e.push(i),t.set(i,o)}return e.map(i=>{const o=t.get(i),a=Br(o),c=/^--brand-font/i.test(i);return{name:i,value:o,isColor:a,isFont:c,kind:Lr(i,a,c)}})}const gn=["primary","secondary","accent","neutral","success","warning","error","info","bg","fg","border","ring"];function qr(n){return n.match(/^--brand-([a-z]+)/i)?.[1]?.toLowerCase()??n}function Kr(n){const e=[],t=new Map;for(const l of n){if(l.kind!=="color")continue;const i=qr(l.name);t.has(i)||(e.push(i),t.set(i,[])),t.get(i).push(l)}return e.map(l=>{const i=t.get(l);return{family:l,tokens:i,isRamp:i.filter(o=>/-\d+$/.test(o.name)).length>=5}}).sort((l,i)=>{const o=gn.indexOf(l.family),a=gn.indexOf(i.family);return o===-1&&a===-1?0:o===-1?1:a===-1?-1:o-a})}function Wr(n,e,t){const s=new RegExp(`(${Ur(e)}\\s*:\\s*)[^;]+(;)`);if(s.test(n))return n.replace(s,(o,a,c)=>`${a}${t}${c}`);const l=n.search(/:root\s*\{/);if(l!==-1){const o=n.indexOf("{",l)+1;return`${n.slice(0,o)}
|
|
6
6
|
${e}: ${t};${n.slice(o)}`}const i=n.length>0&&!n.endsWith(`
|
|
7
7
|
`)?`
|
|
8
8
|
`:"";return`${n}${i}:root {
|
|
9
9
|
${e}: ${t};
|
|
10
10
|
}
|
|
11
11
|
`}function Gr(n){const e=n.filter(s=>s.kind==="file"),t=e.find(s=>/(^|\/)logo\.(svg|png|jpe?g|webp|avif|gif)$/i.test(s.path));return t?t.path:e.find(s=>Ar.includes(_r(s.path)))?.path??null}function Vr(n){const e={};for(const t of n.split(`
|
|
12
|
-
`)){const s=t.match(/^([A-Za-z][\w-]*):\s*(.*)$/);s?.[1]&&s[2]!==void 0&&(e[s[1].toLowerCase()]=s[2].trim())}return e}function bn(n){for(const e of n.split(/\n\s*\n/)){const t=e.trim();if(!(!t||t.startsWith("#")))return t.replace(/\n/g," ")}return null}function gs(n){const e=n.match(/^---\n([\s\S]*?)\n---\n?/);if(!e||e[1]===void 0)return{name:null,description:bn(n),body:n};const t=Vr(e[1]),s=n.slice(e[0].length);return{name:t.name||null,description:t.description||bn(s),body:s}}const Xr=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),Qr=new Set(["csv","tsv"]),Yr=new Set(["mp4","webm","mov","m4v"]),Zr=new Set(["txt","md","markdown","json","log","yaml","yml","xml","html","htm"]),Jr=256*1024;function nt(n){const e=new Date(n);if(Number.isNaN(e.getTime()))return"";const t=Date.now()-e.getTime(),s=Math.floor(t/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const l=Math.floor(s/60);if(l<24)return`${l}h ago`;const i=Math.floor(l/24);return i<30?`${i}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ei(n){return n.split(".").pop()?.toLowerCase()??""}async function jt(n,e){const t=await fetch(n,{credentials:"include",...e});if(!t.ok)throw new Error(`fetch failed: ${t.status}`);return t.text()}function bs(n){const e=$.c(3),{onShare:t}=n;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(zn,{size:14}),e[0]=s):s=e[0];let l;return e[1]!==t?(l=r.jsxs(Fe,{onClick:t,children:[s,"Share"]}),e[1]=t,e[2]=l):l=e[2],l}function ti(n){const e=$.c(9),{state:t}=n,s=t==="password"?"Password-protected — link + password to view":t==="inherited"?"Shared via a parent folder":"Public — anyone with the link can view",l=t==="password"?Mn:xt,i=t==="inherited"?"text-muted-foreground/60":"text-primary";let o;e[0]!==i?(o=ce(i),e[0]=i,e[1]=o):o=e[1];let a;e[2]!==l||e[3]!==s||e[4]!==o?(a=r.jsx(l,{size:12,className:o,"aria-label":s}),e[2]=l,e[3]=s,e[4]=o,e[5]=a):a=e[5];let c;return e[6]!==s||e[7]!==a?(c=r.jsx("span",{title:s,className:"mt-0.5 flex shrink-0 items-center",children:a}),e[6]=s,e[7]=a,e[8]=c):c=e[8],c}function ys(n){const e=$.c(18),{downloadUrl:t,filename:s,onShare:l,onDelete:i}=n,o=`Actions for ${s}`;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(Fn,{size:14}),e[0]=a):a=e[0];let c;e[1]!==o?(c=r.jsx(Bt,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:si,"aria-label":o,children:a})}),e[1]=o,e[2]=c):c=e[2];let d;e[3]!==l?(d=l&&r.jsx(bs,{onShare:l}),e[3]=l,e[4]=d):d=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Ve,{size:14}),e[5]=f):f=e[5];let u;e[6]!==t||e[7]!==s?(u=r.jsx(Fe,{asChild:!0,children:r.jsxs("a",{href:t,download:s,children:[f,"Download"]})}),e[6]=t,e[7]=s,e[8]=u):u=e[8];let h;e[9]!==i?(h=i&&r.jsxs(Fe,{variant:"destructive",onClick:i,children:[r.jsx(In,{size:14}),"Delete"]}),e[9]=i,e[10]=h):h=e[10];let m;e[11]!==d||e[12]!==u||e[13]!==h?(m=r.jsxs(Ht,{align:"end",onClick:ni,children:[d,u,h]}),e[11]=d,e[12]=u,e[13]=h,e[14]=m):m=e[14];let p;return e[15]!==c||e[16]!==m?(p=r.jsxs(Ut,{children:[c,m]}),e[15]=c,e[16]=m,e[17]=p):p=e[17],p}function ni(n){return n.stopPropagation()}function si(n){return n.stopPropagation()}function Yt(n){const e=$.c(16),{label:t,onBrowse:s,onShare:l,onDelete:i}=n;if(!s&&!l&&!i)return;const o=`Actions for ${t}`;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(Fn,{size:14}),e[0]=a):a=e[0];let c;e[1]!==o?(c=r.jsx(Bt,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:ri,"aria-label":o,children:a})}),e[1]=o,e[2]=c):c=e[2];let d;e[3]!==s?(d=s&&r.jsxs(Fe,{onClick:s,children:[r.jsx(Cn,{size:14}),"Browse files"]}),e[3]=s,e[4]=d):d=e[4];let f;e[5]!==l?(f=l&&r.jsx(bs,{onShare:l}),e[5]=l,e[6]=f):f=e[6];let u;e[7]!==i?(u=i&&r.jsxs(Fe,{variant:"destructive",onClick:i,children:[r.jsx(In,{size:14}),"Delete"]}),e[7]=i,e[8]=u):u=e[8];let h;e[9]!==d||e[10]!==f||e[11]!==u?(h=r.jsxs(Ht,{align:"end",onClick:li,children:[d,f,u]}),e[9]=d,e[10]=f,e[11]=u,e[12]=h):h=e[12];let m;return e[13]!==c||e[14]!==h?(m=r.jsxs(Ut,{children:[c,h]}),e[13]=c,e[14]=h,e[15]=m):m=e[15],m}function li(n){return n.stopPropagation()}function ri(n){return n.stopPropagation()}function st(n){const e=$.c(9),{onOpen:t,children:s,className:l}=n;let i;e[0]!==t?(i=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t())},e[0]=t,e[1]=i):i=e[1];let o;e[2]!==l?(o=ce("group/card flex cursor-pointer flex-col gap-3 rounded-2xl border border-border bg-background p-4 text-left transition-colors hover:border-border hover:bg-muted/40",l),e[2]=l,e[3]=o):o=e[3];let a;return e[4]!==s||e[5]!==t||e[6]!==i||e[7]!==o?(a=r.jsx("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:i,className:o,children:s}),e[4]=s,e[5]=t,e[6]=i,e[7]=o,e[8]=a):a=e[8],a}function lt(n){const e=$.c(19),{icon:t,name:s,meta:l,subtitle:i,publicState:o,actions:a}=n;let c;e[0]!==s?(c=r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-foreground",title:s,children:s}),e[0]=s,e[1]=c):c=e[1];let d;e[2]!==o?(d=o&&r.jsx(ti,{state:o}),e[2]=o,e[3]=d):d=e[3];let f;e[4]!==l?(f=l&&r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:l}),e[4]=l,e[5]=f):f=e[5];let u;e[6]!==c||e[7]!==d||e[8]!==f?(u=r.jsxs("div",{className:"flex items-start gap-3",children:[c,d,f]}),e[6]=c,e[7]=d,e[8]=f,e[9]=u):u=e[9];let h;e[10]!==i?(h=i&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",title:i,children:i}),e[10]=i,e[11]=h):h=e[11];let m;e[12]!==u||e[13]!==h?(m=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center",children:[u,h]}),e[12]=u,e[13]=h,e[14]=m):m=e[14];let p;return e[15]!==a||e[16]!==t||e[17]!==m?(p=r.jsxs("div",{className:"flex w-full items-center gap-2.5",children:[t,m,a]}),e[15]=a,e[16]=t,e[17]=m,e[18]=p):p=e[18],p}function kt(n){const e=$.c(17),{name:t,meta:s,subtitle:l,glyph:i,readOnly:o,publicState:a,onOpen:c,onShare:d,onDelete:f}=n;let u;e[0]!==i||e[1]!==o?(u=r.jsx(Ir,{glyph:i,readOnly:o,className:"size-8 shrink-0"}),e[0]=i,e[1]=o,e[2]=u):u=e[2];let h;e[3]!==t||e[4]!==f||e[5]!==d?(h=r.jsx(Yt,{label:t,onShare:d,onDelete:f}),e[3]=t,e[4]=f,e[5]=d,e[6]=h):h=e[6];let m;e[7]!==s||e[8]!==t||e[9]!==a||e[10]!==l||e[11]!==u||e[12]!==h?(m=r.jsx(lt,{icon:u,name:t,meta:s,subtitle:l,publicState:a,actions:h}),e[7]=s,e[8]=t,e[9]=a,e[10]=l,e[11]=u,e[12]=h,e[13]=m):m=e[13];let p;return e[14]!==c||e[15]!==m?(p=r.jsx(st,{onOpen:c,children:m}),e[14]=c,e[15]=m,e[16]=p):p=e[16],p}function vs(n){const e=$.c(22),{filename:t,updatedAt:s,downloadUrl:l,subtitle:i,publicState:o,onOpen:a,onShare:c,onDelete:d}=n;let f;e[0]!==t?(f=r.jsx(ke,{filename:t,className:"h-8 w-6.5 shrink-0"}),e[0]=t,e[1]=f):f=e[1];let u;e[2]!==s?(u=nt(s),e[2]=s,e[3]=u):u=e[3];let h;e[4]!==t||e[5]!==i?(h=i??Tn(t),e[4]=t,e[5]=i,e[6]=h):h=e[6];let m;e[7]!==l||e[8]!==t||e[9]!==d||e[10]!==c?(m=r.jsx(ys,{downloadUrl:l,filename:t,onShare:c,onDelete:d}),e[7]=l,e[8]=t,e[9]=d,e[10]=c,e[11]=m):m=e[11];let p;e[12]!==t||e[13]!==o||e[14]!==f||e[15]!==u||e[16]!==h||e[17]!==m?(p=r.jsx(lt,{icon:f,name:t,meta:u,subtitle:h,publicState:o,actions:m}),e[12]=t,e[13]=o,e[14]=f,e[15]=u,e[16]=h,e[17]=m,e[18]=p):p=e[18];let g;return e[19]!==a||e[20]!==p?(g=r.jsx(st,{onOpen:a,children:p}),e[19]=a,e[20]=p,e[21]=g):g=e[21],g}function ii(n){const e=$.c(28),{dirName:t,updatedAt:s,skillMdUrl:l,publicState:i,onOpen:o,onBrowse:a,onShare:c,onDelete:d}=n;let f;e[0]!==l?(f=X.fileText(l),e[0]=l,e[1]=f):f=e[1];let u;e[2]!==l?(u=()=>jt(l),e[2]=l,e[3]=u):u=e[3];let h;e[4]!==f||e[5]!==u?(h={queryKey:f,queryFn:u,staleTime:6e4,retry:!1},e[4]=f,e[5]=u,e[6]=h):h=e[6];const{data:m}=ie(h);let p;e[7]!==m?(p=m?gs(m):null,e[7]=m,e[8]=p):p=e[8];const g=p;let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:r.jsx(At,{size:16})}),e[9]=b):b=e[9];const x=g?.name??t;let y;e[10]!==s?(y=nt(s),e[10]=s,e[11]=y):y=e[11];let j;e[12]!==t||e[13]!==a||e[14]!==d||e[15]!==c?(j=r.jsx(Yt,{label:t,onBrowse:a,onShare:c,onDelete:d}),e[12]=t,e[13]=a,e[14]=d,e[15]=c,e[16]=j):j=e[16];let N;e[17]!==i||e[18]!==x||e[19]!==y||e[20]!==j?(N=r.jsx(lt,{icon:b,name:x,meta:y,subtitle:"Skill",publicState:i,actions:j}),e[17]=i,e[18]=x,e[19]=y,e[20]=j,e[21]=N):N=e[21];const C=g?.description??"";let k;e[22]!==C?(k=r.jsx("p",{className:"line-clamp-2 min-h-8 text-xs leading-4 text-muted-foreground",children:C}),e[22]=C,e[23]=k):k=e[23];let w;return e[24]!==o||e[25]!==k||e[26]!==N?(w=r.jsxs(st,{onOpen:o,children:[N,k]}),e[24]=o,e[25]=k,e[26]=N,e[27]=w):w=e[27],w}function oi(n){const e=$.c(37),{dirName:t,updatedAt:s,tokensUrl:l,onOpen:i,onBrowse:o,onDelete:a}=n;let c;e[0]!==l?(c=X.fileText(l),e[0]=l,e[1]=c):c=e[1];let d;e[2]!==l?(d=()=>jt(l),e[2]=l,e[3]=d):d=e[3];let f;e[4]!==c||e[5]!==d?(f={queryKey:c,queryFn:d,staleTime:6e4,retry:!1},e[4]=c,e[5]=d,e[6]=f):f=e[6];const{data:u}=ie(f);let h,m,p,g,b;if(e[7]!==u||e[8]!==t||e[9]!==o||e[10]!==a||e[11]!==i||e[12]!==s){const j=u?xs(u).filter(ci).slice(0,6):[];h=st,g=i;let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:r.jsx(dt,{size:16})}),e[18]=N):N=e[18];let C;e[19]!==s?(C=nt(s),e[19]=s,e[20]=C):C=e[20];let k;e[21]!==t||e[22]!==o||e[23]!==a?(k=r.jsx(Yt,{label:t,onBrowse:o,onDelete:a}),e[21]=t,e[22]=o,e[23]=a,e[24]=k):k=e[24],e[25]!==t||e[26]!==k||e[27]!==C?(b=r.jsx(lt,{icon:N,name:t,meta:C,subtitle:"Brand",actions:k}),e[25]=t,e[26]=k,e[27]=C,e[28]=b):b=e[28],m="flex min-h-5 items-center gap-1.5",p=j.map(ai),e[7]=u,e[8]=t,e[9]=o,e[10]=a,e[11]=i,e[12]=s,e[13]=h,e[14]=m,e[15]=p,e[16]=g,e[17]=b}else h=e[13],m=e[14],p=e[15],g=e[16],b=e[17];let x;e[29]!==m||e[30]!==p?(x=r.jsx("div",{className:m,children:p}),e[29]=m,e[30]=p,e[31]=x):x=e[31];let y;return e[32]!==h||e[33]!==g||e[34]!==b||e[35]!==x?(y=r.jsxs(h,{onOpen:g,children:[b,x]}),e[32]=h,e[33]=g,e[34]=b,e[35]=x,e[36]=y):y=e[36],y}function ai(n){return r.jsx("span",{className:"size-5 rounded-full border border-border/60",style:{backgroundColor:n.value},title:`${n.name}: ${n.value}`},n.name)}function ci(n){return n.isColor}function Mt(n){const e=$.c(4),{children:t}=n,[s,l]=S.useState(!1);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>c=>{if(!c)return;const d=new IntersectionObserver(f=>{const[u]=f;u?.isIntersecting&&(l(!0),d.disconnect())},{rootMargin:"200px"});d.observe(c)},e[0]=i):i=e[0];const[o]=S.useState(i);if(s){let c;return e[1]!==t?(c=r.jsx(r.Fragment,{children:t}),e[1]=t,e[2]=c):c=e[2],c}let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{ref:o,className:"h-full w-full"}),e[3]=a):a=e[3],a}function di(n){const e=$.c(11),{url:t}=n;let s;e[0]!==t?(s=X.fileText(t),e[0]=t,e[1]=s):s=e[1];let l;e[2]!==t?(l=()=>jt(t),e[2]=t,e[3]=l):l=e[3];let i;e[4]!==s||e[5]!==l?(i={queryKey:s,queryFn:l,staleTime:6e4,retry:!1},e[4]=s,e[5]=l,e[6]=i):i=e[6];const{data:o}=ie(i);if(!o)return null;let a;e[7]!==o?(a=o.slice(0,2e3),e[7]=o,e[8]=a):a=e[8];let c;return e[9]!==a?(c=r.jsx("pre",{className:"pointer-events-none h-full w-full overflow-hidden bg-background p-3 font-mono text-[9px] leading-[1.5] text-muted-foreground select-none",children:a}),e[9]=a,e[10]=c):c=e[10],c}function ui(n){const e=$.c(23),{url:t,ext:s}=n;let l;e[0]!==t?(l=X.csvThumb(t),e[0]=t,e[1]=l):l=e[1];let i;e[2]!==t?(i=()=>jt(t,{headers:{Range:"bytes=0-8191"}}),e[2]=t,e[3]=i):i=e[3];let o;e[4]!==l||e[5]!==i?(o={queryKey:l,queryFn:i,staleTime:6e4,retry:!1},e[4]=l,e[5]=i,e[6]=o):o=e[6];const{data:a}=ie(o);if(!a)return null;const c=s==="tsv"?" ":",";let d,f,u,h;if(e[7]!==a||e[8]!==c){h=Symbol.for("react.early_return_sentinel");e:{let b;e[13]!==c?(b=y=>y.split(c).slice(0,6).map(mi),e[13]=c,e[14]=b):b=e[14];const x=a.split(`
|
|
13
|
-
`).filter(Boolean).slice(0,7).map(b);if(x.length===0){h=null;break e}u="pointer-events-none h-full w-full overflow-hidden bg-background p-2 select-none",f="w-full border-collapse",d=x.map(fi)}e[7]=a,e[8]=c,e[9]=d,e[10]=f,e[11]=u,e[12]=h}else d=e[9],f=e[10],u=e[11],h=e[12];if(h!==Symbol.for("react.early_return_sentinel"))return h;let m;e[15]!==d?(m=r.jsx("tbody",{children:d}),e[15]=d,e[16]=m):m=e[16];let p;e[17]!==f||e[18]!==m?(p=r.jsx("table",{className:f,children:m}),e[17]=f,e[18]=m,e[19]=p):p=e[19];let g;return e[20]!==u||e[21]!==p?(g=r.jsx("div",{className:u,children:p}),e[20]=u,e[21]=p,e[22]=g):g=e[22],g}function fi(n,e){return r.jsx("tr",{className:ce(e===0&&"bg-muted/50 font-medium"),children:n.map(hi)},e)}function hi(n,e){return r.jsx("td",{className:"max-w-[56px] overflow-hidden border border-border/30 px-1 py-px text-[7px] leading-[1.4] text-muted-foreground",style:{maxWidth:56},children:r.jsx("span",{className:"block truncate",children:n})},e)}function mi(n){return n.trim().replace(/^"|"$/g,"")}function pi(n){const e=$.c(14),{filename:t,size:s,downloadUrl:l}=n;let i;if(e[0]!==l||e[1]!==t||e[2]!==s){const o=ei(t);let a;if(Xr.has(o)){let c;e[4]!==l?(c=r.jsx("img",{src:l,alt:"",loading:"lazy",className:"h-full w-full object-cover"}),e[4]=l,e[5]=c):c=e[5],a=c}else if(Yr.has(o)){const c=`${l}#t=0.1`;let d;e[6]!==c?(d=r.jsx(
|
|
12
|
+
`)){const s=t.match(/^([A-Za-z][\w-]*):\s*(.*)$/);s?.[1]&&s[2]!==void 0&&(e[s[1].toLowerCase()]=s[2].trim())}return e}function bn(n){for(const e of n.split(/\n\s*\n/)){const t=e.trim();if(!(!t||t.startsWith("#")))return t.replace(/\n/g," ")}return null}function gs(n){const e=n.match(/^---\n([\s\S]*?)\n---\n?/);if(!e||e[1]===void 0)return{name:null,description:bn(n),body:n};const t=Vr(e[1]),s=n.slice(e[0].length);return{name:t.name||null,description:t.description||bn(s),body:s}}const Xr=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),Qr=new Set(["csv","tsv"]),Yr=new Set(["mp4","webm","mov","m4v"]),Zr=new Set(["txt","md","markdown","json","log","yaml","yml","xml","html","htm"]),Jr=256*1024;function nt(n){const e=new Date(n);if(Number.isNaN(e.getTime()))return"";const t=Date.now()-e.getTime(),s=Math.floor(t/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const l=Math.floor(s/60);if(l<24)return`${l}h ago`;const i=Math.floor(l/24);return i<30?`${i}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ei(n){return n.split(".").pop()?.toLowerCase()??""}async function kt(n,e){const t=await fetch(n,{credentials:"include",...e});if(!t.ok)throw new Error(`fetch failed: ${t.status}`);return t.text()}function bs(n){const e=$.c(3),{onShare:t}=n;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(zn,{size:14}),e[0]=s):s=e[0];let l;return e[1]!==t?(l=r.jsxs(Fe,{onClick:t,children:[s,"Share"]}),e[1]=t,e[2]=l):l=e[2],l}function ti(n){const e=$.c(9),{state:t}=n,s=t==="password"?"Password-protected — link + password to view":t==="inherited"?"Shared via a parent folder":"Public — anyone with the link can view",l=t==="password"?Mn:xt,i=t==="inherited"?"text-muted-foreground/60":"text-primary";let o;e[0]!==i?(o=ce(i),e[0]=i,e[1]=o):o=e[1];let a;e[2]!==l||e[3]!==s||e[4]!==o?(a=r.jsx(l,{size:12,className:o,"aria-label":s}),e[2]=l,e[3]=s,e[4]=o,e[5]=a):a=e[5];let c;return e[6]!==s||e[7]!==a?(c=r.jsx("span",{title:s,className:"mt-0.5 flex shrink-0 items-center",children:a}),e[6]=s,e[7]=a,e[8]=c):c=e[8],c}function ys(n){const e=$.c(18),{downloadUrl:t,filename:s,onShare:l,onDelete:i}=n,o=`Actions for ${s}`;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(Fn,{size:14}),e[0]=a):a=e[0];let c;e[1]!==o?(c=r.jsx(Ht,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:si,"aria-label":o,children:a})}),e[1]=o,e[2]=c):c=e[2];let d;e[3]!==l?(d=l&&r.jsx(bs,{onShare:l}),e[3]=l,e[4]=d):d=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Ve,{size:14}),e[5]=f):f=e[5];let u;e[6]!==t||e[7]!==s?(u=r.jsx(Fe,{asChild:!0,children:r.jsxs("a",{href:t,download:s,children:[f,"Download"]})}),e[6]=t,e[7]=s,e[8]=u):u=e[8];let h;e[9]!==i?(h=i&&r.jsxs(Fe,{variant:"destructive",onClick:i,children:[r.jsx(In,{size:14}),"Delete"]}),e[9]=i,e[10]=h):h=e[10];let m;e[11]!==d||e[12]!==u||e[13]!==h?(m=r.jsxs(qt,{align:"end",onClick:ni,children:[d,u,h]}),e[11]=d,e[12]=u,e[13]=h,e[14]=m):m=e[14];let p;return e[15]!==c||e[16]!==m?(p=r.jsxs(Bt,{children:[c,m]}),e[15]=c,e[16]=m,e[17]=p):p=e[17],p}function ni(n){return n.stopPropagation()}function si(n){return n.stopPropagation()}function Yt(n){const e=$.c(16),{label:t,onBrowse:s,onShare:l,onDelete:i}=n;if(!s&&!l&&!i)return;const o=`Actions for ${t}`;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(Fn,{size:14}),e[0]=a):a=e[0];let c;e[1]!==o?(c=r.jsx(Ht,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:ri,"aria-label":o,children:a})}),e[1]=o,e[2]=c):c=e[2];let d;e[3]!==s?(d=s&&r.jsxs(Fe,{onClick:s,children:[r.jsx(Cn,{size:14}),"Browse files"]}),e[3]=s,e[4]=d):d=e[4];let f;e[5]!==l?(f=l&&r.jsx(bs,{onShare:l}),e[5]=l,e[6]=f):f=e[6];let u;e[7]!==i?(u=i&&r.jsxs(Fe,{variant:"destructive",onClick:i,children:[r.jsx(In,{size:14}),"Delete"]}),e[7]=i,e[8]=u):u=e[8];let h;e[9]!==d||e[10]!==f||e[11]!==u?(h=r.jsxs(qt,{align:"end",onClick:li,children:[d,f,u]}),e[9]=d,e[10]=f,e[11]=u,e[12]=h):h=e[12];let m;return e[13]!==c||e[14]!==h?(m=r.jsxs(Bt,{children:[c,h]}),e[13]=c,e[14]=h,e[15]=m):m=e[15],m}function li(n){return n.stopPropagation()}function ri(n){return n.stopPropagation()}function st(n){const e=$.c(9),{onOpen:t,children:s,className:l}=n;let i;e[0]!==t?(i=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t())},e[0]=t,e[1]=i):i=e[1];let o;e[2]!==l?(o=ce("group/card flex cursor-pointer flex-col gap-3 rounded-2xl border border-border bg-background p-4 text-left transition-colors hover:border-border hover:bg-muted/40",l),e[2]=l,e[3]=o):o=e[3];let a;return e[4]!==s||e[5]!==t||e[6]!==i||e[7]!==o?(a=r.jsx("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:i,className:o,children:s}),e[4]=s,e[5]=t,e[6]=i,e[7]=o,e[8]=a):a=e[8],a}function lt(n){const e=$.c(19),{icon:t,name:s,meta:l,subtitle:i,publicState:o,actions:a}=n;let c;e[0]!==s?(c=r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-foreground",title:s,children:s}),e[0]=s,e[1]=c):c=e[1];let d;e[2]!==o?(d=o&&r.jsx(ti,{state:o}),e[2]=o,e[3]=d):d=e[3];let f;e[4]!==l?(f=l&&r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:l}),e[4]=l,e[5]=f):f=e[5];let u;e[6]!==c||e[7]!==d||e[8]!==f?(u=r.jsxs("div",{className:"flex items-start gap-3",children:[c,d,f]}),e[6]=c,e[7]=d,e[8]=f,e[9]=u):u=e[9];let h;e[10]!==i?(h=i&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",title:i,children:i}),e[10]=i,e[11]=h):h=e[11];let m;e[12]!==u||e[13]!==h?(m=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center",children:[u,h]}),e[12]=u,e[13]=h,e[14]=m):m=e[14];let p;return e[15]!==a||e[16]!==t||e[17]!==m?(p=r.jsxs("div",{className:"flex w-full items-center gap-2.5",children:[t,m,a]}),e[15]=a,e[16]=t,e[17]=m,e[18]=p):p=e[18],p}function St(n){const e=$.c(17),{name:t,meta:s,subtitle:l,glyph:i,readOnly:o,publicState:a,onOpen:c,onShare:d,onDelete:f}=n;let u;e[0]!==i||e[1]!==o?(u=r.jsx(Ir,{glyph:i,readOnly:o,className:"size-8 shrink-0"}),e[0]=i,e[1]=o,e[2]=u):u=e[2];let h;e[3]!==t||e[4]!==f||e[5]!==d?(h=r.jsx(Yt,{label:t,onShare:d,onDelete:f}),e[3]=t,e[4]=f,e[5]=d,e[6]=h):h=e[6];let m;e[7]!==s||e[8]!==t||e[9]!==a||e[10]!==l||e[11]!==u||e[12]!==h?(m=r.jsx(lt,{icon:u,name:t,meta:s,subtitle:l,publicState:a,actions:h}),e[7]=s,e[8]=t,e[9]=a,e[10]=l,e[11]=u,e[12]=h,e[13]=m):m=e[13];let p;return e[14]!==c||e[15]!==m?(p=r.jsx(st,{onOpen:c,children:m}),e[14]=c,e[15]=m,e[16]=p):p=e[16],p}function vs(n){const e=$.c(22),{filename:t,updatedAt:s,downloadUrl:l,subtitle:i,publicState:o,onOpen:a,onShare:c,onDelete:d}=n;let f;e[0]!==t?(f=r.jsx(ke,{filename:t,className:"h-8 w-6.5 shrink-0"}),e[0]=t,e[1]=f):f=e[1];let u;e[2]!==s?(u=nt(s),e[2]=s,e[3]=u):u=e[3];let h;e[4]!==t||e[5]!==i?(h=i??Tn(t),e[4]=t,e[5]=i,e[6]=h):h=e[6];let m;e[7]!==l||e[8]!==t||e[9]!==d||e[10]!==c?(m=r.jsx(ys,{downloadUrl:l,filename:t,onShare:c,onDelete:d}),e[7]=l,e[8]=t,e[9]=d,e[10]=c,e[11]=m):m=e[11];let p;e[12]!==t||e[13]!==o||e[14]!==f||e[15]!==u||e[16]!==h||e[17]!==m?(p=r.jsx(lt,{icon:f,name:t,meta:u,subtitle:h,publicState:o,actions:m}),e[12]=t,e[13]=o,e[14]=f,e[15]=u,e[16]=h,e[17]=m,e[18]=p):p=e[18];let g;return e[19]!==a||e[20]!==p?(g=r.jsx(st,{onOpen:a,children:p}),e[19]=a,e[20]=p,e[21]=g):g=e[21],g}function ii(n){const e=$.c(28),{dirName:t,updatedAt:s,skillMdUrl:l,publicState:i,onOpen:o,onBrowse:a,onShare:c,onDelete:d}=n;let f;e[0]!==l?(f=X.fileText(l),e[0]=l,e[1]=f):f=e[1];let u;e[2]!==l?(u=()=>kt(l),e[2]=l,e[3]=u):u=e[3];let h;e[4]!==f||e[5]!==u?(h={queryKey:f,queryFn:u,staleTime:6e4,retry:!1},e[4]=f,e[5]=u,e[6]=h):h=e[6];const{data:m}=ie(h);let p;e[7]!==m?(p=m?gs(m):null,e[7]=m,e[8]=p):p=e[8];const g=p;let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:r.jsx(_t,{size:16})}),e[9]=b):b=e[9];const x=g?.name??t;let y;e[10]!==s?(y=nt(s),e[10]=s,e[11]=y):y=e[11];let j;e[12]!==t||e[13]!==a||e[14]!==d||e[15]!==c?(j=r.jsx(Yt,{label:t,onBrowse:a,onShare:c,onDelete:d}),e[12]=t,e[13]=a,e[14]=d,e[15]=c,e[16]=j):j=e[16];let N;e[17]!==i||e[18]!==x||e[19]!==y||e[20]!==j?(N=r.jsx(lt,{icon:b,name:x,meta:y,subtitle:"Skill",publicState:i,actions:j}),e[17]=i,e[18]=x,e[19]=y,e[20]=j,e[21]=N):N=e[21];const C=g?.description??"";let k;e[22]!==C?(k=r.jsx("p",{className:"line-clamp-2 min-h-8 text-xs leading-4 text-muted-foreground",children:C}),e[22]=C,e[23]=k):k=e[23];let w;return e[24]!==o||e[25]!==k||e[26]!==N?(w=r.jsxs(st,{onOpen:o,children:[N,k]}),e[24]=o,e[25]=k,e[26]=N,e[27]=w):w=e[27],w}function oi(n){const e=$.c(37),{dirName:t,updatedAt:s,tokensUrl:l,onOpen:i,onBrowse:o,onDelete:a}=n;let c;e[0]!==l?(c=X.fileText(l),e[0]=l,e[1]=c):c=e[1];let d;e[2]!==l?(d=()=>kt(l),e[2]=l,e[3]=d):d=e[3];let f;e[4]!==c||e[5]!==d?(f={queryKey:c,queryFn:d,staleTime:6e4,retry:!1},e[4]=c,e[5]=d,e[6]=f):f=e[6];const{data:u}=ie(f);let h,m,p,g,b;if(e[7]!==u||e[8]!==t||e[9]!==o||e[10]!==a||e[11]!==i||e[12]!==s){const j=u?xs(u).filter(ci).slice(0,6):[];h=st,g=i;let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:r.jsx(dt,{size:16})}),e[18]=N):N=e[18];let C;e[19]!==s?(C=nt(s),e[19]=s,e[20]=C):C=e[20];let k;e[21]!==t||e[22]!==o||e[23]!==a?(k=r.jsx(Yt,{label:t,onBrowse:o,onDelete:a}),e[21]=t,e[22]=o,e[23]=a,e[24]=k):k=e[24],e[25]!==t||e[26]!==k||e[27]!==C?(b=r.jsx(lt,{icon:N,name:t,meta:C,subtitle:"Brand",actions:k}),e[25]=t,e[26]=k,e[27]=C,e[28]=b):b=e[28],m="flex min-h-5 items-center gap-1.5",p=j.map(ai),e[7]=u,e[8]=t,e[9]=o,e[10]=a,e[11]=i,e[12]=s,e[13]=h,e[14]=m,e[15]=p,e[16]=g,e[17]=b}else h=e[13],m=e[14],p=e[15],g=e[16],b=e[17];let x;e[29]!==m||e[30]!==p?(x=r.jsx("div",{className:m,children:p}),e[29]=m,e[30]=p,e[31]=x):x=e[31];let y;return e[32]!==h||e[33]!==g||e[34]!==b||e[35]!==x?(y=r.jsxs(h,{onOpen:g,children:[b,x]}),e[32]=h,e[33]=g,e[34]=b,e[35]=x,e[36]=y):y=e[36],y}function ai(n){return r.jsx("span",{className:"size-5 rounded-full border border-border/60",style:{backgroundColor:n.value},title:`${n.name}: ${n.value}`},n.name)}function ci(n){return n.isColor}function It(n){const e=$.c(4),{children:t}=n,[s,l]=S.useState(!1);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>c=>{if(!c)return;const d=new IntersectionObserver(f=>{const[u]=f;u?.isIntersecting&&(l(!0),d.disconnect())},{rootMargin:"200px"});d.observe(c)},e[0]=i):i=e[0];const[o]=S.useState(i);if(s){let c;return e[1]!==t?(c=r.jsx(r.Fragment,{children:t}),e[1]=t,e[2]=c):c=e[2],c}let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{ref:o,className:"h-full w-full"}),e[3]=a):a=e[3],a}function di(n){const e=$.c(11),{url:t}=n;let s;e[0]!==t?(s=X.fileText(t),e[0]=t,e[1]=s):s=e[1];let l;e[2]!==t?(l=()=>kt(t),e[2]=t,e[3]=l):l=e[3];let i;e[4]!==s||e[5]!==l?(i={queryKey:s,queryFn:l,staleTime:6e4,retry:!1},e[4]=s,e[5]=l,e[6]=i):i=e[6];const{data:o}=ie(i);if(!o)return null;let a;e[7]!==o?(a=o.slice(0,2e3),e[7]=o,e[8]=a):a=e[8];let c;return e[9]!==a?(c=r.jsx("pre",{className:"pointer-events-none h-full w-full overflow-hidden bg-background p-3 font-mono text-[9px] leading-[1.5] text-muted-foreground select-none",children:a}),e[9]=a,e[10]=c):c=e[10],c}function ui(n){const e=$.c(23),{url:t,ext:s}=n;let l;e[0]!==t?(l=X.csvThumb(t),e[0]=t,e[1]=l):l=e[1];let i;e[2]!==t?(i=()=>kt(t,{headers:{Range:"bytes=0-8191"}}),e[2]=t,e[3]=i):i=e[3];let o;e[4]!==l||e[5]!==i?(o={queryKey:l,queryFn:i,staleTime:6e4,retry:!1},e[4]=l,e[5]=i,e[6]=o):o=e[6];const{data:a}=ie(o);if(!a)return null;const c=s==="tsv"?" ":",";let d,f,u,h;if(e[7]!==a||e[8]!==c){h=Symbol.for("react.early_return_sentinel");e:{let b;e[13]!==c?(b=y=>y.split(c).slice(0,6).map(mi),e[13]=c,e[14]=b):b=e[14];const x=a.split(`
|
|
13
|
+
`).filter(Boolean).slice(0,7).map(b);if(x.length===0){h=null;break e}u="pointer-events-none h-full w-full overflow-hidden bg-background p-2 select-none",f="w-full border-collapse",d=x.map(fi)}e[7]=a,e[8]=c,e[9]=d,e[10]=f,e[11]=u,e[12]=h}else d=e[9],f=e[10],u=e[11],h=e[12];if(h!==Symbol.for("react.early_return_sentinel"))return h;let m;e[15]!==d?(m=r.jsx("tbody",{children:d}),e[15]=d,e[16]=m):m=e[16];let p;e[17]!==f||e[18]!==m?(p=r.jsx("table",{className:f,children:m}),e[17]=f,e[18]=m,e[19]=p):p=e[19];let g;return e[20]!==u||e[21]!==p?(g=r.jsx("div",{className:u,children:p}),e[20]=u,e[21]=p,e[22]=g):g=e[22],g}function fi(n,e){return r.jsx("tr",{className:ce(e===0&&"bg-muted/50 font-medium"),children:n.map(hi)},e)}function hi(n,e){return r.jsx("td",{className:"max-w-[56px] overflow-hidden border border-border/30 px-1 py-px text-[7px] leading-[1.4] text-muted-foreground",style:{maxWidth:56},children:r.jsx("span",{className:"block truncate",children:n})},e)}function mi(n){return n.trim().replace(/^"|"$/g,"")}function pi(n){const e=$.c(14),{filename:t,size:s,downloadUrl:l}=n;let i;if(e[0]!==l||e[1]!==t||e[2]!==s){const o=ei(t);let a;if(Xr.has(o)){let c;e[4]!==l?(c=r.jsx("img",{src:l,alt:"",loading:"lazy",className:"h-full w-full object-cover"}),e[4]=l,e[5]=c):c=e[5],a=c}else if(Yr.has(o)){const c=`${l}#t=0.1`;let d;e[6]!==c?(d=r.jsx(It,{children:r.jsx("video",{src:c,preload:"metadata",muted:!0,playsInline:!0,className:"pointer-events-none h-full w-full object-cover"})}),e[6]=c,e[7]=d):d=e[7],a=d}else if(o==="pdf"){let c;e[8]!==t?(c=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsx(ke,{filename:t,className:"h-14 w-11 opacity-60"})}),e[8]=t,e[9]=c):c=e[9],a=c}else if(Qr.has(o))a=r.jsx(It,{children:r.jsx(ui,{url:l,ext:o})});else if(Zr.has(o)&&s<=Jr){let c;e[10]!==l?(c=r.jsx(It,{children:r.jsx(di,{url:l})}),e[10]=l,e[11]=c):c=e[11],a=c}else{let c;e[12]!==t?(c=r.jsx("div",{className:"flex h-full w-full items-center justify-center",children:r.jsx(ke,{filename:t,className:"h-14 w-11 opacity-60"})}),e[12]=t,e[13]=c):c=e[13],a=c}i=r.jsx("div",{className:"aspect-[400/265] w-full overflow-hidden rounded-lg border border-border/60 bg-muted/30",children:a}),e[0]=l,e[1]=t,e[2]=s,e[3]=i}else i=e[3];return i}function xi(n){const e=$.c(27),t=n.onOpen;let s;e[0]!==n.filename?(s=r.jsx(ke,{filename:n.filename,className:"h-8 w-6.5 shrink-0"}),e[0]=n.filename,e[1]=s):s=e[1];const l=n.filename;let i;e[2]!==n.updatedAt?(i=nt(n.updatedAt),e[2]=n.updatedAt,e[3]=i):i=e[3];let o;e[4]!==n.filename||e[5]!==n.subtitle?(o=n.subtitle??Tn(n.filename),e[4]=n.filename,e[5]=n.subtitle,e[6]=o):o=e[6];let a;e[7]!==n.downloadUrl||e[8]!==n.filename||e[9]!==n.onDelete||e[10]!==n.onShare?(a=r.jsx(ys,{downloadUrl:n.downloadUrl,filename:n.filename,onShare:n.onShare,onDelete:n.onDelete}),e[7]=n.downloadUrl,e[8]=n.filename,e[9]=n.onDelete,e[10]=n.onShare,e[11]=a):a=e[11];let c;e[12]!==n.filename||e[13]!==n.publicState||e[14]!==s||e[15]!==i||e[16]!==o||e[17]!==a?(c=r.jsx(lt,{icon:s,name:l,meta:i,subtitle:o,publicState:n.publicState,actions:a}),e[12]=n.filename,e[13]=n.publicState,e[14]=s,e[15]=i,e[16]=o,e[17]=a,e[18]=c):c=e[18];let d;e[19]!==n.downloadUrl||e[20]!==n.filename||e[21]!==n.size?(d=r.jsx(pi,{filename:n.filename,size:n.size,downloadUrl:n.downloadUrl}),e[19]=n.downloadUrl,e[20]=n.filename,e[21]=n.size,e[22]=d):d=e[22];let f;return e[23]!==n.onOpen||e[24]!==c||e[25]!==d?(f=r.jsxs(st,{onOpen:t,children:[c,d]}),e[23]=n.onOpen,e[24]=c,e[25]=d,e[26]=f):f=e[26],f}async function gi(n){const e=await fetch(n,{credentials:"include"});if(!e.ok)throw new Error(`fetch failed: ${e.status}`);return e.text()}const bi=`
|
|
14
14
|
*{box-sizing:border-box}
|
|
15
15
|
body{margin:0;padding:24px;background:var(--brand-bg,#0b0f1a);color:var(--brand-fg,#f5f7ff);font-family:var(--brand-font-body,system-ui,sans-serif);font-size:14px;line-height:1.5}
|
|
16
16
|
.stack{display:flex;flex-direction:column;gap:18px;max-width:760px}
|
|
@@ -170,4 +170,4 @@ import{c as $,C as de,n as Ze,d as We,K as X,m as ie,aY as wn,r as S,ap as zs,l
|
|
|
170
170
|
<p class="cta">slides-create --theme …</p>
|
|
171
171
|
</section>`].join(`
|
|
172
172
|
|
|
173
|
-
`);async function yn(n){const e=await fetch(n,{credentials:"include"});if(!e.ok)throw new Error(`fetch failed: ${e.status}`);return e.text()}function Si(n,e){const t=e?`<style>${e}</style>`:"";return n.replaceAll("{{{slides}}}",ki).replaceAll("{{title}}",ji).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${t}</head>`)}function Ni(n){const e=$.c(23),{readUrl:t,title:s,tokensUrl:l}=n;let i;e[0]!==t?(i=X.fileText(t),e[0]=t,e[1]=i):i=e[1];let o;e[2]!==t?(o=()=>yn(t),e[2]=t,e[3]=o):o=e[3];let a;e[4]!==i||e[5]!==o?(a={queryKey:i,queryFn:o,staleTime:6e4,retry:!1},e[4]=i,e[5]=o,e[6]=a):a=e[6];const c=ie(a);let d;e[7]!==l?(d=X.fileText(l??""),e[7]=l,e[8]=d):d=e[8];const f=!!l;let u;e[9]!==l?(u=()=>yn(l??""),e[9]=l,e[10]=u):u=e[10];let h;e[11]!==d||e[12]!==f||e[13]!==u?(h={queryKey:d,enabled:f,queryFn:u,staleTime:6e4,retry:!1},e[11]=d,e[12]=f,e[13]=u,e[14]=h):h=e[14];const m=ie(h);if(c.isPending||l&&m.isPending){let x;return e[15]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:r.jsx(ae,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[15]=x):x=e[15],x}if(c.isError||!c.data){let x;return e[16]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[16]=x):x=e[16],x}const p=m.data??null;let g;e[17]!==p||e[18]!==c.data?(g=Si(c.data,p),e[17]=p,e[18]=c.data,e[19]=g):g=e[19];let b;return e[20]!==g||e[21]!==s?(b=r.jsx("iframe",{title:s,srcDoc:g,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[20]=g,e[21]=s,e[22]=b):b=e[22],b}async function vn(n){const e=await fetch(n,{credentials:"include"});if(!e.ok)throw new Error(`fetch failed: ${e.status}`);return e.text()}function Ke(n){const e=$.c(2),{children:t}=n;let s;return e[0]!==t?(s=r.jsx("p",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=s):s=e[1],s}function zi(n){const e=$.c(16),{family:t,tokens:s,editing:l,valueOf:i,onEdit:o}=n;let a;e[0]!==t?(a=r.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1];let c;if(e[2]!==l||e[3]!==o||e[4]!==s||e[5]!==i){let u;e[7]!==l||e[8]!==o||e[9]!==i?(u=h=>{const m=i(h),p=`${h.name.replace(/^--brand-/,"")}: ${m}`;return l&&/^#/.test(m)?r.jsx("input",{type:"color","aria-label":h.name,title:p,value:Hr(m),onChange:g=>o(h.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},h.name):r.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},h.name)},e[7]=l,e[8]=o,e[9]=i,e[10]=u):u=e[10],c=s.map(u),e[2]=l,e[3]=o,e[4]=s,e[5]=i,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let f;return e[13]!==a||e[14]!==d?(f=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=f):f=e[15],f}function Ci(n){const e=$.c(9),{token:t,value:s}=n;if(t.kind==="space"){let i;return e[0]!==s?(i=r.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:r.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:s,maxWidth:"100%"}})}),e[0]=s,e[1]=i):i=e[1],i}if(t.kind==="radius"){let i;return e[2]!==s?(i=r.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:s}}),e[2]=s,e[3]=i):i=e[3],i}if(t.kind==="shadow"){let i;return e[4]!==s?(i=r.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:s}}),e[4]=s,e[5]=i):i=e[5],i}if(t.kind==="type"&&/^--brand-text-/.test(t.name)){const i=`min(${s}, 22px)`;let o;return e[6]!==i?(o=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:i},children:"Ag"}),e[6]=i,e[7]=o):o=e[7],o}let l;return e[8]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("span",{className:"size-7 shrink-0"}),e[8]=l):l=e[8],l}function ws(n){const e=$.c(17),{token:t,value:s,editing:l,onEdit:i}=n;let o;e[0]!==t||e[1]!==s?(o=r.jsx(Ci,{token:t,value:s}),e[0]=t,e[1]=s,e[2]=o):o=e[2];let a;if(e[3]!==t.name){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/^--brand-/,e[5]=u):u=e[5],a=t.name.replace(u,""),e[3]=t.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:a}),e[6]=a,e[7]=c):c=e[7];let d;e[8]!==l||e[9]!==i||e[10]!==t.name||e[11]!==s?(d=l?r.jsx(Xe,{value:s,onChange:u=>i(t.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):r.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:s}),e[8]=l,e[9]=i,e[10]=t.name,e[11]=s,e[12]=d):d=e[12];let f;return e[13]!==o||e[14]!==c||e[15]!==d?(f=r.jsxs("div",{className:"flex items-center gap-3",children:[o,c,d]}),e[13]=o,e[14]=c,e[15]=d,e[16]=f):f=e[16],f}function Be(n){const e=$.c(16),{label:t,tokens:s,editing:l,valueOf:i,onEdit:o}=n;if(s.length===0)return null;let a;e[0]!==t?(a=r.jsx(Ke,{children:t}),e[0]=t,e[1]=a):a=e[1];let c;if(e[2]!==l||e[3]!==o||e[4]!==s||e[5]!==i){let u;e[7]!==l||e[8]!==o||e[9]!==i?(u=h=>r.jsx(ws,{token:h,value:i(h),editing:l,onEdit:o},h.name),e[7]=l,e[8]=o,e[9]=i,e[10]=u):u=e[10],c=s.map(u),e[2]=l,e[3]=o,e[4]=s,e[5]=i,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let f;return e[13]!==a||e[14]!==d?(f=r.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=f):f=e[15],f}function js({brandPath:n,onClose:e,variant:t}){const{org:s}=de(),l=wt(n),i=l.volume??"",o=l.dirPath,a=le(o),c=l.readOnly,d=Ze(),f=tt(),u=_n(i),{upload:h,remove:m}=It(i),p=S.useRef(null),g=qt(i,o),b=g.data??[],x=E=>b.some(re=>re.kind==="file"&&le(re.path)===E),y=x("tokens.css"),j=x("brand.md"),N=x("slides-theme.html"),C=Gr(b),k=f(i,`${o}/tokens.css`),w=f(i,`${o}/brand.md`),B=f(i,`${o}/slides-theme.html`),R=ie({queryKey:X.fileText(k),enabled:y,queryFn:()=>vn(k),staleTime:6e4,retry:!1}),_=ie({queryKey:X.fileText(w),enabled:j,queryFn:()=>vn(w),staleTime:6e4,retry:!1}),[v,M]=S.useState(!1),[Z,U]=S.useState({}),[O,H]=S.useState(null),[W,q]=S.useState(!1),[ee,Y]=S.useState(!1),[T,K]=S.useState("deck"),z=R.data?xs(R.data):[],F=E=>z.find(re=>re.name===E)?.value,I=E=>Z[E.name]??E.value,L=Kr(z),D=z.filter(E=>E.kind==="font"),A=z.filter(E=>E.kind==="type"),Q=z.filter(E=>E.kind==="space"),te=z.filter(E=>E.kind==="radius"),he=z.filter(E=>E.kind==="shadow"),P=z.filter(E=>E.kind==="motion"),V=z.filter(E=>E.kind==="other"),ne=(E,re)=>U(ot=>({...ot,[E]:re})),ge=N&&T==="deck",Se=O??_.data??"",$e=Object.entries(Z).filter(([E,re])=>F(E)!==re),oe=O!==null&&O!==(_.data??""),rt=$e.length>0||oe;function zt(){U({}),H(null),M(!1)}async function Pe(){q(!0);try{if($e.length>0){let E=R.data??"";for(const[re,ot]of $e)E=Wr(E,re,ot);await u.mutateAsync({path:`${o}/tokens.css`,body:E,contentType:"text/css; charset=utf-8"}),d.invalidateQueries({queryKey:X.fileText(k)})}oe&&O!==null&&(await u.mutateAsync({path:`${o}/brand.md`,body:O,contentType:"text/markdown; charset=utf-8"}),d.invalidateQueries({queryKey:X.fileText(w)})),d.invalidateQueries({queryKey:X.orgFsVolume(s.id,i)}),d.invalidateQueries({queryKey:X.orgFsRecent(s.id)}),U({}),H(null),M(!1),ue.success("Brand saved")}catch(E){ue.error(E instanceof Error?E.message:"Failed to save brand")}finally{q(!1)}}async function it(E){const re=E?.[0];if(!re)return;const Jt=`logo.${(re.name.split(".").pop()??"png").toLowerCase()}`;try{await h.mutateAsync({dir:o,files:[new File([re],Jt,{type:re.type})]}),C&&le(C)!==Jt&&await m.mutateAsync(C),ue.success("Logo updated")}catch(en){ue.error(en instanceof Error?en.message:"Logo upload failed")}finally{p.current&&(p.current.value="")}}const Ct=!g.isPending&&!y&&!j&&!C;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(dt,{size:18})}),t==="dialog"?r.jsx(Ue,{className:"flex-1 truncate text-base font-medium text-foreground",children:a}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:a}),!c&&(v?r.jsxs(r.Fragment,{children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:zt,disabled:W,children:"Cancel"}),r.jsx(J,{size:"sm",disabled:!rt||W,onClick:()=>{Pe()},children:W?"Saving…":"Save"})]}):r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>M(!0),children:[r.jsx(Os,{size:14}),"Edit"]})),t==="dialog"?r.jsx(Dn,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(ft,{size:16})})}):r.jsx(J,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:r.jsx(ft,{size:16})})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:g.isPending?r.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[r.jsx(ae,{className:"h-40 w-full rounded-xl"}),r.jsx(ae,{className:"h-4 w-1/3"}),r.jsx(ae,{className:"h-4 w-2/3"})]}):Ct?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This brand is no longer available."}):r.jsxs(r.Fragment,{children:[(N||y)&&r.jsxs("div",{className:"shrink-0 border-b border-border",children:[r.jsxs("div",{role:"button",tabIndex:0,"aria-label":ee?"Show preview":"Hide preview",onClick:()=>Y(E=>!E),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Y(re=>!re))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:E=>E.stopPropagation(),children:[N&&r.jsx("button",{type:"button",onClick:()=>{K("deck"),Y(!1)},className:ce("rounded-md px-2.5 py-1",ge?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Deck"}),r.jsx("button",{type:"button",onClick:()=>{K("components"),Y(!1)},className:ce("rounded-md px-2.5 py-1",ge?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:"Components"})]}),ee?r.jsx(nl,{size:16,className:"shrink-0 text-muted-foreground"}):r.jsx(sl,{size:16,className:"shrink-0 text-muted-foreground"})]}),!ee&&r.jsx("div",{className:"px-4 pb-4",children:r.jsx("div",{className:ce("w-full overflow-hidden rounded-xl border border-border bg-muted/30",ge?"aspect-[16/9]":"h-96"),children:ge?r.jsx(Ni,{readUrl:B,title:`${a} deck theme`,tokensUrl:k}):r.jsx(wi,{tokensUrl:k})})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ke,{children:"Logo"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:C?r.jsx("img",{src:f(i,C),alt:`${a} logo`,className:"max-h-full max-w-full object-contain"}):r.jsx(dt,{size:28,className:"text-muted-foreground/50"})}),v&&r.jsxs("div",{children:[r.jsxs(J,{variant:"outline",size:"sm",disabled:h.isPending,onClick:()=>p.current?.click(),children:[r.jsx(ut,{size:14}),C?"Replace logo":"Add logo"]}),r.jsx("input",{ref:p,type:"file",accept:"image/*",className:"hidden",onChange:E=>{it(E.target.files)}})]})]})]}),L.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ke,{children:"Colors"}),L.map(E=>r.jsx(zi,{family:E.family,tokens:E.tokens,editing:v,valueOf:I,onEdit:ne},E.family))]}),(D.length>0||A.length>0)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ke,{children:"Typography"}),D.map(E=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:E.name.replace(/^--brand-font-?/,"")||"font"}),v?r.jsx(Xe,{value:I(E),onChange:re=>ne(E.name,re.target.value),className:"h-9"}):r.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:I(E)},children:I(E)})]},E.name)),A.map(E=>r.jsx(ws,{token:E,value:I(E),editing:v,onEdit:ne},E.name))]}),r.jsx(Be,{label:"Spacing",tokens:Q,editing:v,valueOf:I,onEdit:ne}),r.jsx(Be,{label:"Radius",tokens:te,editing:v,valueOf:I,onEdit:ne}),r.jsx(Be,{label:"Shadows",tokens:he,editing:v,valueOf:I,onEdit:ne}),r.jsx(Be,{label:"Motion",tokens:P,editing:v,valueOf:I,onEdit:ne}),r.jsx(Be,{label:"Tokens",tokens:V,editing:v,valueOf:I,onEdit:ne}),r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ke,{children:"Voice & guidelines"}),v?r.jsx(tl,{value:Se,onChange:E=>H(E.target.value),placeholder:"Describe the brand voice, tone, do's and don'ts…",className:"min-h-48 font-mono text-sm"}):_.isPending&&j?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(ae,{className:"h-3 w-full"}),r.jsx(ae,{className:"h-3 w-5/6"})]}):Se.trim()?r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:r.jsx(_t,{id:`brand-preview-${n}`,text:Se})}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No brand voice written yet."})]})]})]})})]})}function $i(n){const e=$.c(8),{brandPath:t,onClose:s}=n;let l;e[0]!==s?(l=a=>{a||s()},e[0]=s,e[1]=l):l=e[1];let i;e[2]!==t||e[3]!==s?(i=r.jsx(Je,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:r.jsx(js,{brandPath:t,onClose:s,variant:"dialog"})}),e[2]=t,e[3]=s,e[4]=i):i=e[4];let o;return e[5]!==l||e[6]!==i?(o=r.jsx(et,{open:!0,onOpenChange:l,children:i}),e[5]=l,e[6]=i,e[7]=o):o=e[7],o}function Pi(n){const e=$.c(3),{brandPath:t,onClose:s}=n;let l;return e[0]!==t||e[1]!==s?(l=r.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden bg-background",children:r.jsx(js,{brandPath:t,onClose:s,variant:"panel"})}),e[0]=t,e[1]=s,e[2]=l):l=e[2],l}function Ei(n){const e=$.c(9),{previewPath:t,onClose:s,showSeeInLibrary:l}=n,i=l===void 0?!1:l;let o;e[0]!==s?(o=d=>{d||s()},e[0]=s,e[1]=o):o=e[1];let a;e[2]!==s||e[3]!==t||e[4]!==i?(a=r.jsx(Je,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:r.jsx(ms,{previewPath:t,onClose:s,showSeeInLibrary:i,variant:"dialog"})}),e[2]=s,e[3]=t,e[4]=i,e[5]=a):a=e[5];let c;return e[6]!==o||e[7]!==a?(c=r.jsx(et,{open:!0,onOpenChange:o,children:a}),e[6]=o,e[7]=a,e[8]=c):c=e[8],c}function ks(n){const e=$.c(23),{skillPath:t,onClose:s,variant:l}=n,i=wt(t),{volume:o,dirPath:a}=i,c=tt(),d=c(o??"",`${a}/SKILL.md`),f=X.fileText(d);let u;e[0]!==d?(u=async()=>{const q=await fetch(d,{credentials:"include"});if(!q.ok)throw new Error(`fetch failed: ${q.status}`);return q.text()},e[0]=d,e[1]=u):u=e[1];let h;e[2]!==f||e[3]!==u?(h={queryKey:f,queryFn:u,staleTime:6e4,retry:!1},e[2]=f,e[3]=u,e[4]=h):h=e[4];const m=ie(h),p=qt(o??"",a);let g;e[5]!==a?(g=le(a),e[5]=a,e[6]=g):g=e[6];const b=g;let x;e[7]!==m.data?(x=m.data?gs(m.data):null,e[7]=m.data,e[8]=x):x=e[8];const y=x,j=Ti;let N;e[9]===Symbol.for("react.memo_cache_sentinel")?(N=(q,ee)=>j(q.path)?-1:j(ee.path)?1:le(q.path).localeCompare(le(ee.path)),e[9]=N):N=e[9];const C=(p.data??[]).filter(Di).sort(N),[k,w]=S.useState(null),B=k===null?null:C.find(q=>q.path===k)??null,R=y?.name??b;let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(At,{size:18})}),e[10]=_):_=e[10];let v;e[11]!==R||e[12]!==l?(v=l==="dialog"?r.jsx(Ue,{className:"flex-1 truncate text-base font-medium text-foreground",children:R}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:R}),e[11]=R,e[12]=l,e[13]=v):v=e[13];let M;e[14]!==s||e[15]!==l?(M=l==="dialog"?r.jsx(Dn,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(ft,{size:16})})}):r.jsx(J,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:s,children:r.jsx(ft,{size:16})}),e[14]=s,e[15]=l,e[16]=M):M=e[16];let Z;e[17]!==v||e[18]!==M?(Z=r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[_,v,M]}),e[17]=v,e[18]=M,e[19]=Z):Z=e[19];let U;e[20]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx("p",{className:"px-2 py-1.5 text-sm font-medium text-foreground",children:"Files"}),e[20]=U):U=e[20];const O="relative flex min-w-0 flex-1 flex-col overflow-y-auto",H=B?r.jsx(us,{file:{key:B.path,filename:le(B.path),size:B.size,downloadUrl:c(o??"",B.path)}}):m.isPending?r.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[r.jsx(ae,{className:"h-4 w-1/3"}),r.jsx(ae,{className:"h-3 w-full"}),r.jsx(ae,{className:"h-3 w-5/6"}),r.jsx(ae,{className:"h-3 w-2/3"})]}):m.isError||!y?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This skill is no longer available."}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col gap-4 border-b border-border p-6",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Description"}),r.jsx("p",{className:"text-base text-muted-foreground",children:y.description??"Claude Code skill"})]}),r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none p-6",children:r.jsx(_t,{id:`skill-preview-${t}`,text:y.body})})]});let W;return e[21]!==H?(W=r.jsx("div",{className:O,children:H}),e[21]=H,e[22]=W):W=e[22],r.jsxs(r.Fragment,{children:[Z,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsxs("div",{className:"flex w-[220px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted p-3",children:[U,p.isPending?r.jsx(ae,{className:"mx-2 h-4 w-24"}):C.map(q=>{const ee=j(q.path)?B===null:k===q.path;return r.jsxs("button",{type:"button",onClick:()=>w(j(q.path)?null:q.path),className:ce("flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left",ee?"bg-background shadow-sm":"hover:bg-muted/60"),children:[r.jsx(ke,{filename:le(q.path),className:"h-6 w-5 shrink-0"}),r.jsx("span",{className:ce("truncate text-sm",ee?"text-foreground":"text-muted-foreground"),children:le(q.path)})]},q.path)})]}),W]})]})}function Di(n){return n.kind==="file"}function Ti(n){return le(n)==="SKILL.md"}function Fi(n){const e=$.c(8),{skillPath:t,onClose:s}=n;let l;e[0]!==s?(l=a=>{a||s()},e[0]=s,e[1]=l):l=e[1];let i;e[2]!==s||e[3]!==t?(i=r.jsx(Je,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",closeButtonClassName:"hidden",children:r.jsx(ks,{skillPath:t,onClose:s,variant:"dialog"})}),e[2]=s,e[3]=t,e[4]=i):i=e[4];let o;return e[5]!==l||e[6]!==i?(o=r.jsx(et,{open:!0,onOpenChange:l,children:i}),e[5]=l,e[6]=i,e[7]=o):o=e[7],o}function Mi(n){const e=$.c(3),{skillPath:t,onClose:s}=n;let l;return e[0]!==s||e[1]!==t?(l=r.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden bg-background",children:r.jsx(ks,{skillPath:t,onClose:s,variant:"panel"})}),e[0]=s,e[1]=t,e[2]=l):l=e[2],l}function Zt(n){return`${window.location.origin}${n}`}function Ge(n){if(n.shareMode==="password")return"password";if(n.shareMode==="public"||n.readPublic)return"public";if(n.effectivePublic)return"inherited"}const Ss=[{id:"home",description:"Your organization's home folder",glyph:Rs},{id:"uploads",description:"Files your team uploads",glyph:ut},{id:"outputs",description:"Agent run outputs",glyph:Us}],Ii=6;function Ns(n,e,t){const s=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",l=Qt(n),i=l?`public/${l}`:n==="home"?ps(t):n;return s?`${i}/${s}`:i}function Ce(n){const e=$.c(2),{children:t}=n;let s;return e[0]!==t?(s=r.jsx("p",{className:"text-[13px] text-foreground",children:t}),e[0]=t,e[1]=s):s=e[1],s}function je(n){const e=$.c(2),{children:t}=n;let s;return e[0]!==t?(s=r.jsx("div",{className:"@container",children:r.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:t})}),e[0]=t,e[1]=s):s=e[1],s}function St(n){const e=$.c(2),{rows:t}=n,s=t===void 0?1:t;let l;return e[0]!==s?(l=r.jsx(je,{children:Array.from({length:s*3},Li)}),e[0]=s,e[1]=l):l=e[1],l}function Li(n,e){return r.jsx(ae,{className:"h-16 rounded-2xl"},e)}function Nt(n){const e=$.c(2),{children:t}=n;let s;return e[0]!==t?(s=r.jsx("p",{className:"text-sm text-muted-foreground",children:t}),e[0]=t,e[1]=s):s=e[1],s}function Oi(n){const e=$.c(6),{volume:t,displayName:s,description:l,glyph:i,onOpen:o}=n,a=hl(t),c=s??t,d=a.data?`${a.data.files} files`:void 0;let f;return e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==c||e[4]!==d?(f=r.jsx(kt,{name:c,meta:d,subtitle:l,glyph:i,onOpen:o}),e[0]=l,e[1]=i,e[2]=o,e[3]=c,e[4]=d,e[5]=f):f=e[5],f}function Ri(n){const e=$.c(8),{segments:t,onNavigate:s}=n;let l;e[0]!==s?(l=r.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground hover:underline",onClick:()=>s(""),children:"Library"}),e[0]=s,e[1]=l):l=e[1];let i;e[2]!==s||e[3]!==t?(i=t.map((a,c)=>{const d=t.slice(0,c+1).join("/"),f=c===t.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(Ts,{size:12,className:"shrink-0 text-muted-foreground"}),f?r.jsx("span",{className:"truncate font-medium text-foreground",children:a}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>s(d),children:a})]},d)}),e[2]=s,e[3]=t,e[4]=i):i=e[4];let o;return e[5]!==l||e[6]!==i?(o=r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[l,i]}),e[5]=l,e[6]=i,e[7]=o):o=e[7],o}function Ai(n){const e=$.c(32),{query:t,stale:s,onOpenFile:l,onShare:i,onDelete:o}=n,{org:a}=de(),c=tt(),d=pl(t);let f;e[0]!==c||e[1]!==i?(f=C=>i({volume:C.volume,path:C.path,kind:"file",shareMode:C.shareMode??"private",effectivePublic:C.effectivePublic??!1,url:Zt(c(C.volume,C.path))}),e[0]=c,e[1]=i,e[2]=f):f=e[2];const u=f;if(d.isPending){let C;return e[3]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(St,{rows:2}),e[3]=C):C=e[3],C}let h;e[4]!==d.data?(h=d.data??[],e[4]=d.data,e[5]=h):h=e[5];const m=h;if(m.length===0){let C;return e[6]!==t?(C=r.jsxs(Nt,{children:["No files match “",t,"”."]}),e[6]=t,e[7]=C):C=e[7],C}const p=(s||d.isPlaceholderData)&&"opacity-50";let g;e[8]!==p?(g=ce("flex flex-col gap-3",p),e[8]=p,e[9]=g):g=e[9];const b=m.length===1?"result":"results";let x;e[10]!==m.length||e[11]!==b?(x=r.jsxs(Ce,{children:[m.length," ",b]}),e[10]=m.length,e[11]=b,e[12]=x):x=e[12];let y;if(e[13]!==c||e[14]!==o||e[15]!==l||e[16]!==a||e[17]!==m||e[18]!==u){let C;e[20]!==c||e[21]!==o||e[22]!==l||e[23]!==a||e[24]!==u?(C=k=>{const w=Qt(k.volume)!==null;return r.jsx(vs,{filename:le(k.path),updatedAt:k.updatedAt,downloadUrl:c(k.volume,k.path),subtitle:Ns(k.volume,k.path,a.slug),publicState:Ge(k),onOpen:()=>l(Cr(k.volume,k.path)),onShare:w?void 0:()=>u(k),onDelete:w?void 0:()=>o({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[20]=c,e[21]=o,e[22]=l,e[23]=a,e[24]=u,e[25]=C):C=e[25],y=m.map(C),e[13]=c,e[14]=o,e[15]=l,e[16]=a,e[17]=m,e[18]=u,e[19]=y}else y=e[19];let j;e[26]!==y?(j=r.jsx(je,{children:y}),e[26]=y,e[27]=j):j=e[27];let N;return e[28]!==g||e[29]!==x||e[30]!==j?(N=r.jsxs("div",{className:g,children:[x,j]}),e[28]=g,e[29]=x,e[30]=j,e[31]=N):N=e[31],N}function _i(n){const e=$.c(24),{onOpenDir:t,onOpenFile:s,onShare:l,onDelete:i}=n,{org:o}=de(),a=ml(),c=An(),d=tt();let f;e[0]!==d||e[1]!==l?(f=y=>l({volume:y.volume,path:y.path,kind:"file",shareMode:y.shareMode??"private",effectivePublic:y.effectivePublic??!1,url:Zt(d(y.volume,y.path))}),e[0]=d,e[1]=l,e[2]=f):f=e[2];const u=f;let h;if(e[3]!==d||e[4]!==i||e[5]!==s||e[6]!==o||e[7]!==a.data||e[8]!==a.isPending||e[9]!==u){const y=(a.data??[]).slice(0,Ii);h=a.isPending?r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Recently added"}),r.jsx(St,{})]}):y.length>0?r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Recently added"}),r.jsx(je,{children:y.map(j=>r.jsx(xi,{filename:le(j.path),updatedAt:j.updatedAt,size:j.size,downloadUrl:d(j.volume,j.path),subtitle:Ns(j.volume,j.path,o.slug),publicState:Ge(j),onOpen:()=>s(`${j.volume}/${j.path}`),onShare:()=>u(j),onDelete:()=>i({volume:j.volume,path:j.path,kind:"file"})},`${j.volume}/${j.path}`))})]}):r.jsx(Nt,{children:"No files yet — upload one, or ask an agent to produce something."}),e[3]=d,e[4]=i,e[5]=s,e[6]=o,e[7]=a.data,e[8]=a.isPending,e[9]=u,e[10]=h}else h=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Ce,{children:"Folders"}),e[11]=m):m=e[11];let p;e[12]!==t||e[13]!==o?(p=Ss.map(y=>r.jsx(Oi,{volume:y.id,displayName:y.id==="home"?ps(o.slug):void 0,description:y.description,glyph:y.glyph,onOpen:()=>t(y.id)},y.id)),e[12]=t,e[13]=o,e[14]=p):p=e[14];let g;e[15]!==t||e[16]!==c.data?.length?(g=(c.data?.length??0)>0&&r.jsx(kt,{name:"public",meta:`${c.data?.length} sets`,subtitle:"Curated skill sets — read-only",glyph:xt,readOnly:!0,onOpen:()=>t("public")}),e[15]=t,e[16]=c.data?.length,e[17]=g):g=e[17];let b;e[18]!==p||e[19]!==g?(b=r.jsxs("div",{className:"flex flex-col gap-3",children:[m,r.jsxs(je,{children:[p,g]})]}),e[18]=p,e[19]=g,e[20]=b):b=e[20];let x;return e[21]!==h||e[22]!==b?(x=r.jsxs(r.Fragment,{children:[h,b]}),e[21]=h,e[22]=b,e[23]=x):x=e[23],x}function Ui(n){const e=$.c(11),{onOpenDir:t}=n,s=An();if(s.isPending){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(St,{}),e[0]=c):c=e[0],c}let l;e[1]!==s.data?(l=s.data??[],e[1]=s.data,e[2]=l):l=e[2];const i=l;if(i.length===0){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Nt,{children:"No public skill sets are configured."}),e[3]=c):c=e[3],c}let o;if(e[4]!==t||e[5]!==i){let c;e[7]!==t?(c=d=>r.jsx(kt,{name:d,subtitle:"Read-only",readOnly:!0,onOpen:()=>t(`public/${d}`)},d),e[7]=t,e[8]=c):c=e[8],o=i.map(c),e[4]=t,e[5]=i,e[6]=o}else o=e[6];let a;return e[9]!==o?(a=r.jsx(je,{children:o}),e[9]=o,e[10]=a):a=e[10],a}function Bi(n){const e=$.c(34),{location:t,onOpenDir:s,onOpenFile:l,onOpenSkill:i,onOpenBrand:o,onShare:a,onDelete:c}=n,d=t.volume??"",f=qt(d,t.dirPath),u=tt();if(f.isPending){let y;return e[0]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(St,{rows:2}),e[0]=y):y=e[0],y}if(f.isError){const y=f.error instanceof Error?f.error.message:"Failed to load";let j;return e[1]!==y?(j=r.jsx("p",{className:"text-sm text-destructive",children:y}),e[1]=y,e[2]=j):j=e[2],j}let h,m,p,g,b;if(e[3]!==u||e[4]!==f.data||e[5]!==t||e[6]!==c||e[7]!==o||e[8]!==s||e[9]!==l||e[10]!==i||e[11]!==a||e[12]!==d){b=Symbol.for("react.early_return_sentinel");e:{const y=f.data??[],j=y.filter(Wi),N=y.filter(Ki),C=y.filter(qi),k=y.filter(Hi);if(y.length===0){const v=t.readOnly?"Empty — this read-only set syncs from its GitHub source.":"Empty folder — upload a file or create a folder to get started.";let M;e[18]!==v?(M=r.jsx(Nt,{children:v}),e[18]=v,e[19]=M):M=e[19],b=M;break e}let w;e[20]!==t.readOnly||e[21]!==c||e[22]!==d?(w=v=>t.readOnly?void 0:()=>c({volume:d,path:v.path,kind:v.kind}),e[20]=t.readOnly,e[21]=c,e[22]=d,e[23]=w):w=e[23];const B=w;let R;e[24]!==u||e[25]!==t.readOnly||e[26]!==a||e[27]!==d?(R=v=>t.readOnly?void 0:()=>a({volume:d,path:v.path,kind:v.kind,shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:v.kind==="file"?Zt(u(d,v.path)):void 0}),e[24]=u,e[25]=t.readOnly,e[26]=a,e[27]=d,e[28]=R):R=e[28];const _=R;h=j.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Skills"}),r.jsx(je,{children:j.map(v=>r.jsx(ii,{dirName:le(v.path),updatedAt:v.updatedAt,skillMdUrl:u(d,`${v.path}/SKILL.md`),publicState:Ge(v),onOpen:()=>i(Le(t,v.path)),onBrowse:()=>s(Le(t,v.path)),onShare:_(v),onDelete:B(v)},v.path))})]}),m=N.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Brands"}),r.jsx(je,{children:N.map(v=>r.jsx(oi,{dirName:le(v.path),updatedAt:v.updatedAt,tokensUrl:u(d,`${v.path}/tokens.css`),onOpen:()=>o(Le(t,v.path)),onBrowse:()=>s(Le(t,v.path)),onDelete:B(v)},v.path))})]}),p=C.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Folders"}),r.jsx(je,{children:C.map(v=>r.jsx(kt,{name:le(v.path),meta:nt(v.updatedAt),readOnly:t.readOnly,publicState:Ge(v),onOpen:()=>s(Le(t,v.path)),onShare:_(v),onDelete:B(v)},v.path))})]}),g=k.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Files"}),r.jsx(je,{children:k.map(v=>r.jsx(vs,{filename:le(v.path),updatedAt:v.updatedAt,downloadUrl:u(d,v.path),publicState:Ge(v),onOpen:()=>l(Le(t,v.path)),onShare:_(v),onDelete:B(v)},v.path))})]})}e[3]=u,e[4]=f.data,e[5]=t,e[6]=c,e[7]=o,e[8]=s,e[9]=l,e[10]=i,e[11]=a,e[12]=d,e[13]=h,e[14]=m,e[15]=p,e[16]=g,e[17]=b}else h=e[13],m=e[14],p=e[15],g=e[16],b=e[17];if(b!==Symbol.for("react.early_return_sentinel"))return b;let x;return e[29]!==h||e[30]!==m||e[31]!==p||e[32]!==g?(x=r.jsxs(r.Fragment,{children:[h,m,p,g]}),e[29]=h,e[30]=m,e[31]=p,e[32]=g,e[33]=x):x=e[33],x}function Hi(n){return n.kind==="file"}function qi(n){return n.kind==="dir"&&!n.hasSkill&&!n.hasBrand}function Ki(n){return n.kind==="dir"&&n.hasBrand&&!n.hasSkill}function Wi(n){return n.kind==="dir"&&n.hasSkill}function Rt({onOpenFile:n,onOpenSkill:e,onOpenBrand:t}={}){const{org:s}=de(),l=Ze(),i=kn(),o=Pn(),a=Sn({strict:!1}),c=a.path??"",d=wt(c),f=d.segments.length===0,u=(P,V)=>i({to:".",search:ne=>({...ne,[P]:V||void 0})}),h=P=>u("path",P),m=(P,V)=>i({to:".",search:ne=>({...ne,preview:void 0,skill:void 0,brand:void 0,[P]:V})}),p=n??(P=>m("preview",P)),g=e??(P=>m("skill",P)),b=t??(P=>m("brand",P)),[x,y]=S.useState(""),j=el(x.trim(),300),[N,C]=S.useState(null),[k,w]=S.useState(null),[B,R]=S.useState(!1),[_,v]=S.useState(""),M=S.useRef(null),[Z,U]=S.useState(!1),O=S.useRef(0),H=d.readOnly?null:d.volume??"uploads",W=d.volume?d.dirPath:"",{upload:q,mkdir:ee}=It(H??"uploads"),{remove:Y}=It(N?.volume??"uploads");async function T(P){if(!(!H||!P||P.length===0))try{await q.mutateAsync({dir:W,files:[...P]}),ue.success(P.length===1?`Uploaded ${P[0]?.name}`:`Uploaded ${P.length} files`)}catch(V){ue.error(V instanceof Error?V.message:"Upload failed")}finally{M.current&&(M.current.value="")}}const K=H!==null,z=f?"uploads":d.segments.at(-1)??"this folder";function F(P){return P.dataTransfer.types.includes("Files")}function I(P){!K||!F(P)||(P.preventDefault(),O.current+=1,U(!0))}function L(P){!K||!F(P)||P.preventDefault()}function D(){K&&(O.current=Math.max(0,O.current-1),O.current===0&&U(!1))}function A(P){K&&(P.preventDefault(),O.current=0,U(!1),P.dataTransfer.files.length>0&&T(P.dataTransfer.files))}async function Q(){const P=_.trim();if(!(!H||!P))try{await ee.mutateAsync(W?`${W}/${P}`:P),ue.success(`Folder "${P}" created`),R(!1),v("")}catch(V){ue.error(V instanceof Error?V.message:"Failed to create folder")}}async function te(){if(!N)return;const P=N;try{await Y.mutateAsync(P.path),ue.success(`Deleted ${le(P.path)}`)}catch(V){ue.error(V instanceof Error?V.message:"Delete failed")}finally{C(null)}}function he(){for(const P of Ss)l.invalidateQueries({queryKey:X.orgFsVolume(s.id,P.id)});d.volume&&l.invalidateQueries({queryKey:X.orgFsVolume(s.id,d.volume)}),l.invalidateQueries({queryKey:X.orgFsRecent(s.id)}),l.invalidateQueries({queryKey:X.orgFsSearchRoot(s.id)}),l.invalidateQueries({queryKey:X.orgFsPublicSets(s.id)})}return r.jsxs("div",{className:"relative h-full",onDragEnter:I,onDragOver:L,onDragLeave:D,onDrop:A,children:[Z&&r.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[r.jsx(ut,{size:28,className:"text-primary"}),r.jsxs("p",{className:"text-sm font-medium text-foreground",children:["Drop to upload to ",z]})]})}),r.jsx("div",{className:"h-full overflow-y-auto",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[r.jsxs("div",{className:"flex flex-col gap-2",children:[!f&&r.jsx(Ri,{segments:d.segments,onNavigate:h}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h1",{className:"min-w-0 flex-1 truncate text-xl font-medium text-foreground",children:f?"Library":d.segments.at(-1)??"Library"}),r.jsx(J,{variant:"ghost",size:"icon",onClick:he,"aria-label":"Refresh",children:r.jsx(jn,{size:14})}),!f&&H&&r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>R(!0),children:[r.jsx(As,{size:14}),"New folder"]}),d.readOnly?r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Nn,{size:12}),"Read-only"]}):r.jsxs(J,{size:"sm",disabled:q.isPending,onClick:()=>M.current?.click(),children:[r.jsx(ut,{size:14}),q.isPending?"Uploading…":"Upload file"]}),r.jsx("input",{ref:M,type:"file",multiple:!0,className:"hidden",onChange:P=>{T(P.target.files)}})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx(_s,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),r.jsx(Xe,{value:x,onChange:P=>y(P.target.value),onKeyDown:P=>{P.key==="Escape"&&y("")},placeholder:"Search all files…",className:"h-10 rounded-xl pr-9 pl-9"}),x&&r.jsx(J,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>y(""),"aria-label":"Clear search",children:r.jsx($n,{size:14})})]}),j?r.jsx(Ai,{query:j,stale:x.trim()!==j,onOpenFile:p,onShare:w,onDelete:C}):f?r.jsx(_i,{onOpenDir:h,onOpenFile:p,onShare:w,onDelete:C}):d.volume===null?r.jsx(Ui,{onOpenDir:h}):r.jsx(Bi,{location:d,onOpenDir:h,onOpenFile:p,onOpenSkill:g,onOpenBrand:b,onShare:w,onDelete:C},d.volume)]})}),o&&(a.preview?r.jsx(Ei,{previewPath:a.preview,onClose:()=>u("preview",null)}):a.skill?r.jsx(Fi,{skillPath:a.skill,onClose:()=>u("skill",null)},a.skill):a.brand?r.jsx($i,{brandPath:a.brand,onClose:()=>u("brand",null)},a.brand):null),r.jsx(et,{open:B,onOpenChange:R,children:r.jsxs(Je,{children:[r.jsxs(En,{children:[r.jsx(Ue,{children:"New folder"}),r.jsxs(Qs,{children:["Create a folder in ",c||"the library","."]})]}),r.jsx(Xe,{autoFocus:!0,placeholder:"folder-name",value:_,onChange:P=>v(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Q()}}),r.jsxs(Ys,{children:[r.jsx(J,{variant:"outline",onClick:()=>R(!1),children:"Cancel"}),r.jsx(J,{disabled:!_.trim()||ee.isPending,onClick:()=>{Q()},children:"Create"})]})]})}),r.jsx(zr,{target:k,onOpenChange:P=>{P||w(null)}}),r.jsx(Bs,{open:N!==null,onOpenChange:P=>{P||C(null)},children:r.jsxs(Hs,{children:[r.jsxs(qs,{children:[r.jsxs(Ks,{children:["Delete ",N?le(N.path):"","?"]}),r.jsx(Ws,{children:N?.kind==="dir"?"The folder and everything inside it will be deleted for the whole organization. Sandboxes see this change within seconds.":"The file will be deleted for the whole organization. Sandboxes see this change within seconds."})]}),r.jsxs(Gs,{children:[r.jsx(Vs,{children:"Cancel"}),r.jsx(Xs,{onClick:()=>{te()},children:"Delete"})]})]})})]})}function Gi(){const n=$.c(12),e=Pn(),t=kn();let s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},n[0]=s):s=n[0];const l=Sn(s);let i;n[1]!==t?(i=d=>t({to:".",search:f=>({...f,[d]:void 0})}),n[1]=t,n[2]=i):i=n[2];const o=i;let a,c;if(n[3]!==o||n[4]!==e||n[5]!==l.brand||n[6]!==l.preview||n[7]!==l.skill){c=Symbol.for("react.early_return_sentinel");e:{const d=l.preview?{key:"preview",path:l.preview,panel:r.jsx(Er,{previewPath:l.preview,onClose:()=>o("preview")})}:l.skill?{key:"skill",path:l.skill,panel:r.jsx(Mi,{skillPath:l.skill,onClose:()=>o("skill")},l.skill)}:l.brand?{key:"brand",path:l.brand,panel:r.jsx(Pi,{brandPath:l.brand,onClose:()=>o("brand")},l.brand)}:null;if(e){let u;n[10]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-background",children:r.jsx($t,{children:r.jsx(Rt,{})})}),n[10]=u):u=n[10],c=u;break e}let f;n[11]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(dn,{order:1,minSize:30,defaultSize:55,children:r.jsx("div",{className:"h-full p-0.5 pt-0.25",children:r.jsx("div",{className:"card-shadow flex h-full flex-col overflow-hidden rounded-[0.75rem] bg-background",children:r.jsx($t,{children:r.jsx(Rt,{})})})})}),n[11]=f):f=n[11],a=r.jsxs(Jl,{direction:"horizontal",className:"min-h-0 flex-1 pt-0 pr-1 pb-1 pl-0",children:[f,d&&r.jsxs(r.Fragment,{children:[r.jsx(Zs.Tabs,{children:r.jsx(Mr,{title:le(d.path),icon:{kind:"component",Component:u=>d.key==="preview"?r.jsx(ke,{filename:le(d.path),...u}):d.key==="skill"?r.jsx(At,{...u}):r.jsx(dt,{...u})},active:!0,onClick:()=>o(d.key)})}),r.jsx(er,{className:"bg-sidebar"}),r.jsx(dn,{order:2,minSize:25,defaultSize:45,children:r.jsx("div",{className:"h-full p-0.5 pt-0.25",children:r.jsx("div",{className:"card-shadow flex h-full flex-col overflow-hidden rounded-[0.75rem] bg-background",children:r.jsx($t,{children:d.panel})})})})]})]})}n[3]=o,n[4]=e,n[5]=l.brand,n[6]=l.preview,n[7]=l.skill,n[8]=a,n[9]=c}else a=n[8],c=n[9];return c!==Symbol.for("react.early_return_sentinel")?c:a}const Wo=Object.freeze(Object.defineProperty({__proto__:null,LibraryPage:Rt,default:Gi},Symbol.toStringTag,{value:"Module"}));export{Xt as A,$i as B,pt as C,_o as D,ir as E,cs as F,Ko as G,kr as H,Ro as I,or as J,Lo as K,Er as L,Uo as M,Bo as N,Ao as O,Wo as P,Jl as R,Fi as S,Fr as T,To as a,tt as b,ml as c,Do as d,rr as e,Fo as f,cr as g,Mo as h,dn as i,er as j,nr as k,us as l,as as m,Rn as n,Sl as o,On as p,mn as q,Rt as r,Mr as s,Ei as t,It as u,Io as v,Ho as w,qo as x,dr as y,Oo as z};
|
|
173
|
+
`);async function yn(n){const e=await fetch(n,{credentials:"include"});if(!e.ok)throw new Error(`fetch failed: ${e.status}`);return e.text()}function Si(n,e){const t=e?`<style>${e}</style>`:"";return n.replaceAll("{{{slides}}}",ki).replaceAll("{{title}}",ji).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${t}</head>`)}function Ni(n){const e=$.c(23),{readUrl:t,title:s,tokensUrl:l}=n;let i;e[0]!==t?(i=X.fileText(t),e[0]=t,e[1]=i):i=e[1];let o;e[2]!==t?(o=()=>yn(t),e[2]=t,e[3]=o):o=e[3];let a;e[4]!==i||e[5]!==o?(a={queryKey:i,queryFn:o,staleTime:6e4,retry:!1},e[4]=i,e[5]=o,e[6]=a):a=e[6];const c=ie(a);let d;e[7]!==l?(d=X.fileText(l??""),e[7]=l,e[8]=d):d=e[8];const f=!!l;let u;e[9]!==l?(u=()=>yn(l??""),e[9]=l,e[10]=u):u=e[10];let h;e[11]!==d||e[12]!==f||e[13]!==u?(h={queryKey:d,enabled:f,queryFn:u,staleTime:6e4,retry:!1},e[11]=d,e[12]=f,e[13]=u,e[14]=h):h=e[14];const m=ie(h);if(c.isPending||l&&m.isPending){let x;return e[15]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:r.jsx(ae,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[15]=x):x=e[15],x}if(c.isError||!c.data){let x;return e[16]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[16]=x):x=e[16],x}const p=m.data??null;let g;e[17]!==p||e[18]!==c.data?(g=Si(c.data,p),e[17]=p,e[18]=c.data,e[19]=g):g=e[19];let b;return e[20]!==g||e[21]!==s?(b=r.jsx("iframe",{title:s,srcDoc:g,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[20]=g,e[21]=s,e[22]=b):b=e[22],b}async function vn(n){const e=await fetch(n,{credentials:"include"});if(!e.ok)throw new Error(`fetch failed: ${e.status}`);return e.text()}function Ke(n){const e=$.c(2),{children:t}=n;let s;return e[0]!==t?(s=r.jsx("p",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=s):s=e[1],s}function zi(n){const e=$.c(16),{family:t,tokens:s,editing:l,valueOf:i,onEdit:o}=n;let a;e[0]!==t?(a=r.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1];let c;if(e[2]!==l||e[3]!==o||e[4]!==s||e[5]!==i){let u;e[7]!==l||e[8]!==o||e[9]!==i?(u=h=>{const m=i(h),p=`${h.name.replace(/^--brand-/,"")}: ${m}`;return l&&/^#/.test(m)?r.jsx("input",{type:"color","aria-label":h.name,title:p,value:Hr(m),onChange:g=>o(h.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},h.name):r.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},h.name)},e[7]=l,e[8]=o,e[9]=i,e[10]=u):u=e[10],c=s.map(u),e[2]=l,e[3]=o,e[4]=s,e[5]=i,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let f;return e[13]!==a||e[14]!==d?(f=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=f):f=e[15],f}function Ci(n){const e=$.c(9),{token:t,value:s}=n;if(t.kind==="space"){let i;return e[0]!==s?(i=r.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:r.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:s,maxWidth:"100%"}})}),e[0]=s,e[1]=i):i=e[1],i}if(t.kind==="radius"){let i;return e[2]!==s?(i=r.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:s}}),e[2]=s,e[3]=i):i=e[3],i}if(t.kind==="shadow"){let i;return e[4]!==s?(i=r.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:s}}),e[4]=s,e[5]=i):i=e[5],i}if(t.kind==="type"&&/^--brand-text-/.test(t.name)){const i=`min(${s}, 22px)`;let o;return e[6]!==i?(o=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:i},children:"Ag"}),e[6]=i,e[7]=o):o=e[7],o}let l;return e[8]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("span",{className:"size-7 shrink-0"}),e[8]=l):l=e[8],l}function ws(n){const e=$.c(17),{token:t,value:s,editing:l,onEdit:i}=n;let o;e[0]!==t||e[1]!==s?(o=r.jsx(Ci,{token:t,value:s}),e[0]=t,e[1]=s,e[2]=o):o=e[2];let a;if(e[3]!==t.name){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/^--brand-/,e[5]=u):u=e[5],a=t.name.replace(u,""),e[3]=t.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:a}),e[6]=a,e[7]=c):c=e[7];let d;e[8]!==l||e[9]!==i||e[10]!==t.name||e[11]!==s?(d=l?r.jsx(Xe,{value:s,onChange:u=>i(t.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):r.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:s}),e[8]=l,e[9]=i,e[10]=t.name,e[11]=s,e[12]=d):d=e[12];let f;return e[13]!==o||e[14]!==c||e[15]!==d?(f=r.jsxs("div",{className:"flex items-center gap-3",children:[o,c,d]}),e[13]=o,e[14]=c,e[15]=d,e[16]=f):f=e[16],f}function Be(n){const e=$.c(16),{label:t,tokens:s,editing:l,valueOf:i,onEdit:o}=n;if(s.length===0)return null;let a;e[0]!==t?(a=r.jsx(Ke,{children:t}),e[0]=t,e[1]=a):a=e[1];let c;if(e[2]!==l||e[3]!==o||e[4]!==s||e[5]!==i){let u;e[7]!==l||e[8]!==o||e[9]!==i?(u=h=>r.jsx(ws,{token:h,value:i(h),editing:l,onEdit:o},h.name),e[7]=l,e[8]=o,e[9]=i,e[10]=u):u=e[10],c=s.map(u),e[2]=l,e[3]=o,e[4]=s,e[5]=i,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let f;return e[13]!==a||e[14]!==d?(f=r.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=f):f=e[15],f}function js({brandPath:n,onClose:e,variant:t}){const{org:s}=de(),l=jt(n),i=l.volume??"",o=l.dirPath,a=le(o),c=l.readOnly,d=Ze(),f=tt(),u=_n(i),{upload:h,remove:m}=Lt(i),p=S.useRef(null),g=Kt(i,o),b=g.data??[],x=E=>b.some(re=>re.kind==="file"&&le(re.path)===E),y=x("tokens.css"),j=x("brand.md"),N=x("slides-theme.html"),C=Gr(b),k=f(i,`${o}/tokens.css`),w=f(i,`${o}/brand.md`),B=f(i,`${o}/slides-theme.html`),R=ie({queryKey:X.fileText(k),enabled:y,queryFn:()=>vn(k),staleTime:6e4,retry:!1}),_=ie({queryKey:X.fileText(w),enabled:j,queryFn:()=>vn(w),staleTime:6e4,retry:!1}),[v,M]=S.useState(!1),[Z,U]=S.useState({}),[O,H]=S.useState(null),[W,q]=S.useState(!1),[ee,Y]=S.useState(!1),[T,K]=S.useState("deck"),z=R.data?xs(R.data):[],F=E=>z.find(re=>re.name===E)?.value,I=E=>Z[E.name]??E.value,L=Kr(z),D=z.filter(E=>E.kind==="font"),A=z.filter(E=>E.kind==="type"),Q=z.filter(E=>E.kind==="space"),te=z.filter(E=>E.kind==="radius"),he=z.filter(E=>E.kind==="shadow"),P=z.filter(E=>E.kind==="motion"),V=z.filter(E=>E.kind==="other"),ne=(E,re)=>U(ot=>({...ot,[E]:re})),ge=N&&T==="deck",Se=O??_.data??"",$e=Object.entries(Z).filter(([E,re])=>F(E)!==re),oe=O!==null&&O!==(_.data??""),rt=$e.length>0||oe;function Ct(){U({}),H(null),M(!1)}async function Pe(){q(!0);try{if($e.length>0){let E=R.data??"";for(const[re,ot]of $e)E=Wr(E,re,ot);await u.mutateAsync({path:`${o}/tokens.css`,body:E,contentType:"text/css; charset=utf-8"}),d.invalidateQueries({queryKey:X.fileText(k)})}oe&&O!==null&&(await u.mutateAsync({path:`${o}/brand.md`,body:O,contentType:"text/markdown; charset=utf-8"}),d.invalidateQueries({queryKey:X.fileText(w)})),d.invalidateQueries({queryKey:X.orgFsVolume(s.id,i)}),d.invalidateQueries({queryKey:X.orgFsRecent(s.id)}),U({}),H(null),M(!1),ue.success("Brand saved")}catch(E){ue.error(E instanceof Error?E.message:"Failed to save brand")}finally{q(!1)}}async function it(E){const re=E?.[0];if(!re)return;const Jt=`logo.${(re.name.split(".").pop()??"png").toLowerCase()}`;try{await h.mutateAsync({dir:o,files:[new File([re],Jt,{type:re.type})]}),C&&le(C)!==Jt&&await m.mutateAsync(C),ue.success("Logo updated")}catch(en){ue.error(en instanceof Error?en.message:"Logo upload failed")}finally{p.current&&(p.current.value="")}}const $t=!g.isPending&&!y&&!j&&!C;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(dt,{size:18})}),t==="dialog"?r.jsx(Ue,{className:"flex-1 truncate text-base font-medium text-foreground",children:a}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:a}),!c&&(v?r.jsxs(r.Fragment,{children:[r.jsx(J,{variant:"ghost",size:"sm",onClick:Ct,disabled:W,children:"Cancel"}),r.jsx(J,{size:"sm",disabled:!rt||W,onClick:()=>{Pe()},children:W?"Saving…":"Save"})]}):r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>M(!0),children:[r.jsx(Os,{size:14}),"Edit"]})),t==="dialog"?r.jsx(Dn,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(ft,{size:16})})}):r.jsx(J,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:r.jsx(ft,{size:16})})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:g.isPending?r.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[r.jsx(ae,{className:"h-40 w-full rounded-xl"}),r.jsx(ae,{className:"h-4 w-1/3"}),r.jsx(ae,{className:"h-4 w-2/3"})]}):$t?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This brand is no longer available."}):r.jsxs(r.Fragment,{children:[(N||y)&&r.jsxs("div",{className:"shrink-0 border-b border-border",children:[r.jsxs("div",{role:"button",tabIndex:0,"aria-label":ee?"Show preview":"Hide preview",onClick:()=>Y(E=>!E),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Y(re=>!re))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:E=>E.stopPropagation(),children:[N&&r.jsx("button",{type:"button",onClick:()=>{K("deck"),Y(!1)},className:ce("rounded-md px-2.5 py-1",ge?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Deck"}),r.jsx("button",{type:"button",onClick:()=>{K("components"),Y(!1)},className:ce("rounded-md px-2.5 py-1",ge?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:"Components"})]}),ee?r.jsx(nl,{size:16,className:"shrink-0 text-muted-foreground"}):r.jsx(sl,{size:16,className:"shrink-0 text-muted-foreground"})]}),!ee&&r.jsx("div",{className:"px-4 pb-4",children:r.jsx("div",{className:ce("w-full overflow-hidden rounded-xl border border-border bg-muted/30",ge?"aspect-[16/9]":"h-96"),children:ge?r.jsx(Ni,{readUrl:B,title:`${a} deck theme`,tokensUrl:k}):r.jsx(wi,{tokensUrl:k})})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ke,{children:"Logo"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:C?r.jsx("img",{src:f(i,C),alt:`${a} logo`,className:"max-h-full max-w-full object-contain"}):r.jsx(dt,{size:28,className:"text-muted-foreground/50"})}),v&&r.jsxs("div",{children:[r.jsxs(J,{variant:"outline",size:"sm",disabled:h.isPending,onClick:()=>p.current?.click(),children:[r.jsx(ut,{size:14}),C?"Replace logo":"Add logo"]}),r.jsx("input",{ref:p,type:"file",accept:"image/*",className:"hidden",onChange:E=>{it(E.target.files)}})]})]})]}),L.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ke,{children:"Colors"}),L.map(E=>r.jsx(zi,{family:E.family,tokens:E.tokens,editing:v,valueOf:I,onEdit:ne},E.family))]}),(D.length>0||A.length>0)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ke,{children:"Typography"}),D.map(E=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:E.name.replace(/^--brand-font-?/,"")||"font"}),v?r.jsx(Xe,{value:I(E),onChange:re=>ne(E.name,re.target.value),className:"h-9"}):r.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:I(E)},children:I(E)})]},E.name)),A.map(E=>r.jsx(ws,{token:E,value:I(E),editing:v,onEdit:ne},E.name))]}),r.jsx(Be,{label:"Spacing",tokens:Q,editing:v,valueOf:I,onEdit:ne}),r.jsx(Be,{label:"Radius",tokens:te,editing:v,valueOf:I,onEdit:ne}),r.jsx(Be,{label:"Shadows",tokens:he,editing:v,valueOf:I,onEdit:ne}),r.jsx(Be,{label:"Motion",tokens:P,editing:v,valueOf:I,onEdit:ne}),r.jsx(Be,{label:"Tokens",tokens:V,editing:v,valueOf:I,onEdit:ne}),r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ke,{children:"Voice & guidelines"}),v?r.jsx(tl,{value:Se,onChange:E=>H(E.target.value),placeholder:"Describe the brand voice, tone, do's and don'ts…",className:"min-h-48 font-mono text-sm"}):_.isPending&&j?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(ae,{className:"h-3 w-full"}),r.jsx(ae,{className:"h-3 w-5/6"})]}):Se.trim()?r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:r.jsx(Ut,{id:`brand-preview-${n}`,text:Se})}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No brand voice written yet."})]})]})]})})]})}function $i(n){const e=$.c(8),{brandPath:t,onClose:s}=n;let l;e[0]!==s?(l=a=>{a||s()},e[0]=s,e[1]=l):l=e[1];let i;e[2]!==t||e[3]!==s?(i=r.jsx(Je,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:r.jsx(js,{brandPath:t,onClose:s,variant:"dialog"})}),e[2]=t,e[3]=s,e[4]=i):i=e[4];let o;return e[5]!==l||e[6]!==i?(o=r.jsx(et,{open:!0,onOpenChange:l,children:i}),e[5]=l,e[6]=i,e[7]=o):o=e[7],o}function Pi(n){const e=$.c(3),{brandPath:t,onClose:s}=n;let l;return e[0]!==t||e[1]!==s?(l=r.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden bg-background",children:r.jsx(js,{brandPath:t,onClose:s,variant:"panel"})}),e[0]=t,e[1]=s,e[2]=l):l=e[2],l}function Ei(n){const e=$.c(9),{previewPath:t,onClose:s,showSeeInLibrary:l}=n,i=l===void 0?!1:l;let o;e[0]!==s?(o=d=>{d||s()},e[0]=s,e[1]=o):o=e[1];let a;e[2]!==s||e[3]!==t||e[4]!==i?(a=r.jsx(Je,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:r.jsx(ms,{previewPath:t,onClose:s,showSeeInLibrary:i,variant:"dialog"})}),e[2]=s,e[3]=t,e[4]=i,e[5]=a):a=e[5];let c;return e[6]!==o||e[7]!==a?(c=r.jsx(et,{open:!0,onOpenChange:o,children:a}),e[6]=o,e[7]=a,e[8]=c):c=e[8],c}function ks(n){const e=$.c(23),{skillPath:t,onClose:s,variant:l}=n,i=jt(t),{volume:o,dirPath:a}=i,c=tt(),d=c(o??"",`${a}/SKILL.md`),f=X.fileText(d);let u;e[0]!==d?(u=async()=>{const q=await fetch(d,{credentials:"include"});if(!q.ok)throw new Error(`fetch failed: ${q.status}`);return q.text()},e[0]=d,e[1]=u):u=e[1];let h;e[2]!==f||e[3]!==u?(h={queryKey:f,queryFn:u,staleTime:6e4,retry:!1},e[2]=f,e[3]=u,e[4]=h):h=e[4];const m=ie(h),p=Kt(o??"",a);let g;e[5]!==a?(g=le(a),e[5]=a,e[6]=g):g=e[6];const b=g;let x;e[7]!==m.data?(x=m.data?gs(m.data):null,e[7]=m.data,e[8]=x):x=e[8];const y=x,j=Ti;let N;e[9]===Symbol.for("react.memo_cache_sentinel")?(N=(q,ee)=>j(q.path)?-1:j(ee.path)?1:le(q.path).localeCompare(le(ee.path)),e[9]=N):N=e[9];const C=(p.data??[]).filter(Di).sort(N),[k,w]=S.useState(null),B=k===null?null:C.find(q=>q.path===k)??null,R=y?.name??b;let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(_t,{size:18})}),e[10]=_):_=e[10];let v;e[11]!==R||e[12]!==l?(v=l==="dialog"?r.jsx(Ue,{className:"flex-1 truncate text-base font-medium text-foreground",children:R}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:R}),e[11]=R,e[12]=l,e[13]=v):v=e[13];let M;e[14]!==s||e[15]!==l?(M=l==="dialog"?r.jsx(Dn,{asChild:!0,children:r.jsx(J,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(ft,{size:16})})}):r.jsx(J,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:s,children:r.jsx(ft,{size:16})}),e[14]=s,e[15]=l,e[16]=M):M=e[16];let Z;e[17]!==v||e[18]!==M?(Z=r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[_,v,M]}),e[17]=v,e[18]=M,e[19]=Z):Z=e[19];let U;e[20]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx("p",{className:"px-2 py-1.5 text-sm font-medium text-foreground",children:"Files"}),e[20]=U):U=e[20];const O="relative flex min-w-0 flex-1 flex-col overflow-y-auto",H=B?r.jsx(us,{file:{key:B.path,filename:le(B.path),size:B.size,downloadUrl:c(o??"",B.path)}}):m.isPending?r.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[r.jsx(ae,{className:"h-4 w-1/3"}),r.jsx(ae,{className:"h-3 w-full"}),r.jsx(ae,{className:"h-3 w-5/6"}),r.jsx(ae,{className:"h-3 w-2/3"})]}):m.isError||!y?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This skill is no longer available."}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col gap-4 border-b border-border p-6",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Description"}),r.jsx("p",{className:"text-base text-muted-foreground",children:y.description??"Claude Code skill"})]}),r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none p-6",children:r.jsx(Ut,{id:`skill-preview-${t}`,text:y.body})})]});let W;return e[21]!==H?(W=r.jsx("div",{className:O,children:H}),e[21]=H,e[22]=W):W=e[22],r.jsxs(r.Fragment,{children:[Z,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsxs("div",{className:"flex w-[220px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted p-3",children:[U,p.isPending?r.jsx(ae,{className:"mx-2 h-4 w-24"}):C.map(q=>{const ee=j(q.path)?B===null:k===q.path;return r.jsxs("button",{type:"button",onClick:()=>w(j(q.path)?null:q.path),className:ce("flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left",ee?"bg-background shadow-sm":"hover:bg-muted/60"),children:[r.jsx(ke,{filename:le(q.path),className:"h-6 w-5 shrink-0"}),r.jsx("span",{className:ce("truncate text-sm",ee?"text-foreground":"text-muted-foreground"),children:le(q.path)})]},q.path)})]}),W]})]})}function Di(n){return n.kind==="file"}function Ti(n){return le(n)==="SKILL.md"}function Fi(n){const e=$.c(8),{skillPath:t,onClose:s}=n;let l;e[0]!==s?(l=a=>{a||s()},e[0]=s,e[1]=l):l=e[1];let i;e[2]!==s||e[3]!==t?(i=r.jsx(Je,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",closeButtonClassName:"hidden",children:r.jsx(ks,{skillPath:t,onClose:s,variant:"dialog"})}),e[2]=s,e[3]=t,e[4]=i):i=e[4];let o;return e[5]!==l||e[6]!==i?(o=r.jsx(et,{open:!0,onOpenChange:l,children:i}),e[5]=l,e[6]=i,e[7]=o):o=e[7],o}function Mi(n){const e=$.c(3),{skillPath:t,onClose:s}=n;let l;return e[0]!==s||e[1]!==t?(l=r.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden bg-background",children:r.jsx(ks,{skillPath:t,onClose:s,variant:"panel"})}),e[0]=s,e[1]=t,e[2]=l):l=e[2],l}function Zt(n){return`${window.location.origin}${n}`}function Ge(n){if(n.shareMode==="password")return"password";if(n.shareMode==="public"||n.readPublic)return"public";if(n.effectivePublic)return"inherited"}const Ss=[{id:"home",description:"Your organization's home folder",glyph:Rs},{id:"uploads",description:"Files your team uploads",glyph:ut},{id:"outputs",description:"Agent run outputs",glyph:Us}],Ii=6;function Ns(n,e,t){const s=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",l=Qt(n),i=l?`public/${l}`:n==="home"?ps(t):n;return s?`${i}/${s}`:i}function Ce(n){const e=$.c(2),{children:t}=n;let s;return e[0]!==t?(s=r.jsx("p",{className:"text-[13px] text-foreground",children:t}),e[0]=t,e[1]=s):s=e[1],s}function je(n){const e=$.c(2),{children:t}=n;let s;return e[0]!==t?(s=r.jsx("div",{className:"@container",children:r.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:t})}),e[0]=t,e[1]=s):s=e[1],s}function Nt(n){const e=$.c(2),{rows:t}=n,s=t===void 0?1:t;let l;return e[0]!==s?(l=r.jsx(je,{children:Array.from({length:s*3},Li)}),e[0]=s,e[1]=l):l=e[1],l}function Li(n,e){return r.jsx(ae,{className:"h-16 rounded-2xl"},e)}function zt(n){const e=$.c(2),{children:t}=n;let s;return e[0]!==t?(s=r.jsx("p",{className:"text-sm text-muted-foreground",children:t}),e[0]=t,e[1]=s):s=e[1],s}function Oi(n){const e=$.c(6),{volume:t,displayName:s,description:l,glyph:i,onOpen:o}=n,a=hl(t),c=s??t,d=a.data?`${a.data.files} files`:void 0;let f;return e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==c||e[4]!==d?(f=r.jsx(St,{name:c,meta:d,subtitle:l,glyph:i,onOpen:o}),e[0]=l,e[1]=i,e[2]=o,e[3]=c,e[4]=d,e[5]=f):f=e[5],f}function Ri(n){const e=$.c(8),{segments:t,onNavigate:s}=n;let l;e[0]!==s?(l=r.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground hover:underline",onClick:()=>s(""),children:"Library"}),e[0]=s,e[1]=l):l=e[1];let i;e[2]!==s||e[3]!==t?(i=t.map((a,c)=>{const d=t.slice(0,c+1).join("/"),f=c===t.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(Ts,{size:12,className:"shrink-0 text-muted-foreground"}),f?r.jsx("span",{className:"truncate font-medium text-foreground",children:a}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>s(d),children:a})]},d)}),e[2]=s,e[3]=t,e[4]=i):i=e[4];let o;return e[5]!==l||e[6]!==i?(o=r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[l,i]}),e[5]=l,e[6]=i,e[7]=o):o=e[7],o}function Ai(n){const e=$.c(32),{query:t,stale:s,onOpenFile:l,onShare:i,onDelete:o}=n,{org:a}=de(),c=tt(),d=pl(t);let f;e[0]!==c||e[1]!==i?(f=C=>i({volume:C.volume,path:C.path,kind:"file",shareMode:C.shareMode??"private",effectivePublic:C.effectivePublic??!1,url:Zt(c(C.volume,C.path))}),e[0]=c,e[1]=i,e[2]=f):f=e[2];const u=f;if(d.isPending){let C;return e[3]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(Nt,{rows:2}),e[3]=C):C=e[3],C}let h;e[4]!==d.data?(h=d.data??[],e[4]=d.data,e[5]=h):h=e[5];const m=h;if(m.length===0){let C;return e[6]!==t?(C=r.jsxs(zt,{children:["No files match “",t,"”."]}),e[6]=t,e[7]=C):C=e[7],C}const p=(s||d.isPlaceholderData)&&"opacity-50";let g;e[8]!==p?(g=ce("flex flex-col gap-3",p),e[8]=p,e[9]=g):g=e[9];const b=m.length===1?"result":"results";let x;e[10]!==m.length||e[11]!==b?(x=r.jsxs(Ce,{children:[m.length," ",b]}),e[10]=m.length,e[11]=b,e[12]=x):x=e[12];let y;if(e[13]!==c||e[14]!==o||e[15]!==l||e[16]!==a||e[17]!==m||e[18]!==u){let C;e[20]!==c||e[21]!==o||e[22]!==l||e[23]!==a||e[24]!==u?(C=k=>{const w=Qt(k.volume)!==null;return r.jsx(vs,{filename:le(k.path),updatedAt:k.updatedAt,downloadUrl:c(k.volume,k.path),subtitle:Ns(k.volume,k.path,a.slug),publicState:Ge(k),onOpen:()=>l(Cr(k.volume,k.path)),onShare:w?void 0:()=>u(k),onDelete:w?void 0:()=>o({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[20]=c,e[21]=o,e[22]=l,e[23]=a,e[24]=u,e[25]=C):C=e[25],y=m.map(C),e[13]=c,e[14]=o,e[15]=l,e[16]=a,e[17]=m,e[18]=u,e[19]=y}else y=e[19];let j;e[26]!==y?(j=r.jsx(je,{children:y}),e[26]=y,e[27]=j):j=e[27];let N;return e[28]!==g||e[29]!==x||e[30]!==j?(N=r.jsxs("div",{className:g,children:[x,j]}),e[28]=g,e[29]=x,e[30]=j,e[31]=N):N=e[31],N}function _i(n){const e=$.c(24),{onOpenDir:t,onOpenFile:s,onShare:l,onDelete:i}=n,{org:o}=de(),a=ml(),c=An(),d=tt();let f;e[0]!==d||e[1]!==l?(f=y=>l({volume:y.volume,path:y.path,kind:"file",shareMode:y.shareMode??"private",effectivePublic:y.effectivePublic??!1,url:Zt(d(y.volume,y.path))}),e[0]=d,e[1]=l,e[2]=f):f=e[2];const u=f;let h;if(e[3]!==d||e[4]!==i||e[5]!==s||e[6]!==o||e[7]!==a.data||e[8]!==a.isPending||e[9]!==u){const y=(a.data??[]).slice(0,Ii);h=a.isPending?r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Recently added"}),r.jsx(Nt,{})]}):y.length>0?r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Recently added"}),r.jsx(je,{children:y.map(j=>r.jsx(xi,{filename:le(j.path),updatedAt:j.updatedAt,size:j.size,downloadUrl:d(j.volume,j.path),subtitle:Ns(j.volume,j.path,o.slug),publicState:Ge(j),onOpen:()=>s(`${j.volume}/${j.path}`),onShare:()=>u(j),onDelete:()=>i({volume:j.volume,path:j.path,kind:"file"})},`${j.volume}/${j.path}`))})]}):r.jsx(zt,{children:"No files yet — upload one, or ask an agent to produce something."}),e[3]=d,e[4]=i,e[5]=s,e[6]=o,e[7]=a.data,e[8]=a.isPending,e[9]=u,e[10]=h}else h=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Ce,{children:"Folders"}),e[11]=m):m=e[11];let p;e[12]!==t||e[13]!==o?(p=Ss.map(y=>r.jsx(Oi,{volume:y.id,displayName:y.id==="home"?ps(o.slug):void 0,description:y.description,glyph:y.glyph,onOpen:()=>t(y.id)},y.id)),e[12]=t,e[13]=o,e[14]=p):p=e[14];let g;e[15]!==t||e[16]!==c.data?.length?(g=(c.data?.length??0)>0&&r.jsx(St,{name:"public",meta:`${c.data?.length} sets`,subtitle:"Curated skill sets — read-only",glyph:xt,readOnly:!0,onOpen:()=>t("public")}),e[15]=t,e[16]=c.data?.length,e[17]=g):g=e[17];let b;e[18]!==p||e[19]!==g?(b=r.jsxs("div",{className:"flex flex-col gap-3",children:[m,r.jsxs(je,{children:[p,g]})]}),e[18]=p,e[19]=g,e[20]=b):b=e[20];let x;return e[21]!==h||e[22]!==b?(x=r.jsxs(r.Fragment,{children:[h,b]}),e[21]=h,e[22]=b,e[23]=x):x=e[23],x}function Ui(n){const e=$.c(11),{onOpenDir:t}=n,s=An();if(s.isPending){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Nt,{}),e[0]=c):c=e[0],c}let l;e[1]!==s.data?(l=s.data??[],e[1]=s.data,e[2]=l):l=e[2];const i=l;if(i.length===0){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(zt,{children:"No public skill sets are configured."}),e[3]=c):c=e[3],c}let o;if(e[4]!==t||e[5]!==i){let c;e[7]!==t?(c=d=>r.jsx(St,{name:d,subtitle:"Read-only",readOnly:!0,onOpen:()=>t(`public/${d}`)},d),e[7]=t,e[8]=c):c=e[8],o=i.map(c),e[4]=t,e[5]=i,e[6]=o}else o=e[6];let a;return e[9]!==o?(a=r.jsx(je,{children:o}),e[9]=o,e[10]=a):a=e[10],a}function Bi(n){const e=$.c(34),{location:t,onOpenDir:s,onOpenFile:l,onOpenSkill:i,onOpenBrand:o,onShare:a,onDelete:c}=n,d=t.volume??"",f=Kt(d,t.dirPath),u=tt();if(f.isPending){let y;return e[0]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Nt,{rows:2}),e[0]=y):y=e[0],y}if(f.isError){const y=f.error instanceof Error?f.error.message:"Failed to load";let j;return e[1]!==y?(j=r.jsx("p",{className:"text-sm text-destructive",children:y}),e[1]=y,e[2]=j):j=e[2],j}let h,m,p,g,b;if(e[3]!==u||e[4]!==f.data||e[5]!==t||e[6]!==c||e[7]!==o||e[8]!==s||e[9]!==l||e[10]!==i||e[11]!==a||e[12]!==d){b=Symbol.for("react.early_return_sentinel");e:{const y=f.data??[],j=y.filter(Wi),N=y.filter(Ki),C=y.filter(qi),k=y.filter(Hi);if(y.length===0){const v=t.readOnly?"Empty — this read-only set syncs from its GitHub source.":"Empty folder — upload a file or create a folder to get started.";let M;e[18]!==v?(M=r.jsx(zt,{children:v}),e[18]=v,e[19]=M):M=e[19],b=M;break e}let w;e[20]!==t.readOnly||e[21]!==c||e[22]!==d?(w=v=>t.readOnly?void 0:()=>c({volume:d,path:v.path,kind:v.kind}),e[20]=t.readOnly,e[21]=c,e[22]=d,e[23]=w):w=e[23];const B=w;let R;e[24]!==u||e[25]!==t.readOnly||e[26]!==a||e[27]!==d?(R=v=>t.readOnly?void 0:()=>a({volume:d,path:v.path,kind:v.kind,shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:v.kind==="file"?Zt(u(d,v.path)):void 0}),e[24]=u,e[25]=t.readOnly,e[26]=a,e[27]=d,e[28]=R):R=e[28];const _=R;h=j.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Skills"}),r.jsx(je,{children:j.map(v=>r.jsx(ii,{dirName:le(v.path),updatedAt:v.updatedAt,skillMdUrl:u(d,`${v.path}/SKILL.md`),publicState:Ge(v),onOpen:()=>i(Le(t,v.path)),onBrowse:()=>s(Le(t,v.path)),onShare:_(v),onDelete:B(v)},v.path))})]}),m=N.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Brands"}),r.jsx(je,{children:N.map(v=>r.jsx(oi,{dirName:le(v.path),updatedAt:v.updatedAt,tokensUrl:u(d,`${v.path}/tokens.css`),onOpen:()=>o(Le(t,v.path)),onBrowse:()=>s(Le(t,v.path)),onDelete:B(v)},v.path))})]}),p=C.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Folders"}),r.jsx(je,{children:C.map(v=>r.jsx(St,{name:le(v.path),meta:nt(v.updatedAt),readOnly:t.readOnly,publicState:Ge(v),onOpen:()=>s(Le(t,v.path)),onShare:_(v),onDelete:B(v)},v.path))})]}),g=k.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(Ce,{children:"Files"}),r.jsx(je,{children:k.map(v=>r.jsx(vs,{filename:le(v.path),updatedAt:v.updatedAt,downloadUrl:u(d,v.path),publicState:Ge(v),onOpen:()=>l(Le(t,v.path)),onShare:_(v),onDelete:B(v)},v.path))})]})}e[3]=u,e[4]=f.data,e[5]=t,e[6]=c,e[7]=o,e[8]=s,e[9]=l,e[10]=i,e[11]=a,e[12]=d,e[13]=h,e[14]=m,e[15]=p,e[16]=g,e[17]=b}else h=e[13],m=e[14],p=e[15],g=e[16],b=e[17];if(b!==Symbol.for("react.early_return_sentinel"))return b;let x;return e[29]!==h||e[30]!==m||e[31]!==p||e[32]!==g?(x=r.jsxs(r.Fragment,{children:[h,m,p,g]}),e[29]=h,e[30]=m,e[31]=p,e[32]=g,e[33]=x):x=e[33],x}function Hi(n){return n.kind==="file"}function qi(n){return n.kind==="dir"&&!n.hasSkill&&!n.hasBrand}function Ki(n){return n.kind==="dir"&&n.hasBrand&&!n.hasSkill}function Wi(n){return n.kind==="dir"&&n.hasSkill}function At({onOpenFile:n,onOpenSkill:e,onOpenBrand:t}={}){const{org:s}=de(),l=Ze(),i=kn(),o=Pn(),a=Sn({strict:!1}),c=a.path??"",d=jt(c),f=d.segments.length===0,u=(P,V)=>i({to:".",search:ne=>({...ne,[P]:V||void 0})}),h=P=>u("path",P),m=(P,V)=>i({to:".",search:ne=>({...ne,preview:void 0,skill:void 0,brand:void 0,[P]:V})}),p=n??(P=>m("preview",P)),g=e??(P=>m("skill",P)),b=t??(P=>m("brand",P)),[x,y]=S.useState(""),j=el(x.trim(),300),[N,C]=S.useState(null),[k,w]=S.useState(null),[B,R]=S.useState(!1),[_,v]=S.useState(""),M=S.useRef(null),[Z,U]=S.useState(!1),O=S.useRef(0),H=d.readOnly?null:d.volume??"uploads",W=d.volume?d.dirPath:"",{upload:q,mkdir:ee}=Lt(H??"uploads"),{remove:Y}=Lt(N?.volume??"uploads");async function T(P){if(!(!H||!P||P.length===0))try{await q.mutateAsync({dir:W,files:[...P]}),ue.success(P.length===1?`Uploaded ${P[0]?.name}`:`Uploaded ${P.length} files`)}catch(V){ue.error(V instanceof Error?V.message:"Upload failed")}finally{M.current&&(M.current.value="")}}const K=H!==null,z=f?"uploads":d.segments.at(-1)??"this folder";function F(P){return P.dataTransfer.types.includes("Files")}function I(P){!K||!F(P)||(P.preventDefault(),O.current+=1,U(!0))}function L(P){!K||!F(P)||P.preventDefault()}function D(){K&&(O.current=Math.max(0,O.current-1),O.current===0&&U(!1))}function A(P){K&&(P.preventDefault(),O.current=0,U(!1),P.dataTransfer.files.length>0&&T(P.dataTransfer.files))}async function Q(){const P=_.trim();if(!(!H||!P))try{await ee.mutateAsync(W?`${W}/${P}`:P),ue.success(`Folder "${P}" created`),R(!1),v("")}catch(V){ue.error(V instanceof Error?V.message:"Failed to create folder")}}async function te(){if(!N)return;const P=N;try{await Y.mutateAsync(P.path),ue.success(`Deleted ${le(P.path)}`)}catch(V){ue.error(V instanceof Error?V.message:"Delete failed")}finally{C(null)}}function he(){for(const P of Ss)l.invalidateQueries({queryKey:X.orgFsVolume(s.id,P.id)});d.volume&&l.invalidateQueries({queryKey:X.orgFsVolume(s.id,d.volume)}),l.invalidateQueries({queryKey:X.orgFsRecent(s.id)}),l.invalidateQueries({queryKey:X.orgFsSearchRoot(s.id)}),l.invalidateQueries({queryKey:X.orgFsPublicSets(s.id)})}return r.jsxs("div",{className:"relative h-full",onDragEnter:I,onDragOver:L,onDragLeave:D,onDrop:A,children:[Z&&r.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[r.jsx(ut,{size:28,className:"text-primary"}),r.jsxs("p",{className:"text-sm font-medium text-foreground",children:["Drop to upload to ",z]})]})}),r.jsx("div",{className:"h-full overflow-y-auto",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[r.jsxs("div",{className:"flex flex-col gap-2",children:[!f&&r.jsx(Ri,{segments:d.segments,onNavigate:h}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h1",{className:"min-w-0 flex-1 truncate text-xl font-medium text-foreground",children:f?"Library":d.segments.at(-1)??"Library"}),r.jsx(J,{variant:"ghost",size:"icon",onClick:he,"aria-label":"Refresh",children:r.jsx(jn,{size:14})}),!f&&H&&r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>R(!0),children:[r.jsx(As,{size:14}),"New folder"]}),d.readOnly?r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Nn,{size:12}),"Read-only"]}):r.jsxs(J,{size:"sm",disabled:q.isPending,onClick:()=>M.current?.click(),children:[r.jsx(ut,{size:14}),q.isPending?"Uploading…":"Upload file"]}),r.jsx("input",{ref:M,type:"file",multiple:!0,className:"hidden",onChange:P=>{T(P.target.files)}})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx(_s,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),r.jsx(Xe,{value:x,onChange:P=>y(P.target.value),onKeyDown:P=>{P.key==="Escape"&&y("")},placeholder:"Search all files…",className:"h-10 rounded-xl pr-9 pl-9"}),x&&r.jsx(J,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>y(""),"aria-label":"Clear search",children:r.jsx($n,{size:14})})]}),j?r.jsx(Ai,{query:j,stale:x.trim()!==j,onOpenFile:p,onShare:w,onDelete:C}):f?r.jsx(_i,{onOpenDir:h,onOpenFile:p,onShare:w,onDelete:C}):d.volume===null?r.jsx(Ui,{onOpenDir:h}):r.jsx(Bi,{location:d,onOpenDir:h,onOpenFile:p,onOpenSkill:g,onOpenBrand:b,onShare:w,onDelete:C},d.volume)]})}),o&&(a.preview?r.jsx(Ei,{previewPath:a.preview,onClose:()=>u("preview",null)}):a.skill?r.jsx(Fi,{skillPath:a.skill,onClose:()=>u("skill",null)},a.skill):a.brand?r.jsx($i,{brandPath:a.brand,onClose:()=>u("brand",null)},a.brand):null),r.jsx(et,{open:B,onOpenChange:R,children:r.jsxs(Je,{children:[r.jsxs(En,{children:[r.jsx(Ue,{children:"New folder"}),r.jsxs(Qs,{children:["Create a folder in ",c||"the library","."]})]}),r.jsx(Xe,{autoFocus:!0,placeholder:"folder-name",value:_,onChange:P=>v(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Q()}}),r.jsxs(Ys,{children:[r.jsx(J,{variant:"outline",onClick:()=>R(!1),children:"Cancel"}),r.jsx(J,{disabled:!_.trim()||ee.isPending,onClick:()=>{Q()},children:"Create"})]})]})}),r.jsx(zr,{target:k,onOpenChange:P=>{P||w(null)}}),r.jsx(Bs,{open:N!==null,onOpenChange:P=>{P||C(null)},children:r.jsxs(Hs,{children:[r.jsxs(qs,{children:[r.jsxs(Ks,{children:["Delete ",N?le(N.path):"","?"]}),r.jsx(Ws,{children:N?.kind==="dir"?"The folder and everything inside it will be deleted for the whole organization. Sandboxes see this change within seconds.":"The file will be deleted for the whole organization. Sandboxes see this change within seconds."})]}),r.jsxs(Gs,{children:[r.jsx(Vs,{children:"Cancel"}),r.jsx(Xs,{onClick:()=>{te()},children:"Delete"})]})]})})]})}function Gi(){const n=$.c(12),e=Pn(),t=kn();let s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},n[0]=s):s=n[0];const l=Sn(s);let i;n[1]!==t?(i=d=>t({to:".",search:f=>({...f,[d]:void 0})}),n[1]=t,n[2]=i):i=n[2];const o=i;let a,c;if(n[3]!==o||n[4]!==e||n[5]!==l.brand||n[6]!==l.preview||n[7]!==l.skill){c=Symbol.for("react.early_return_sentinel");e:{const d=l.preview?{key:"preview",path:l.preview,panel:r.jsx(Er,{previewPath:l.preview,onClose:()=>o("preview")})}:l.skill?{key:"skill",path:l.skill,panel:r.jsx(Mi,{skillPath:l.skill,onClose:()=>o("skill")},l.skill)}:l.brand?{key:"brand",path:l.brand,panel:r.jsx(Pi,{brandPath:l.brand,onClose:()=>o("brand")},l.brand)}:null;if(e){let u;n[10]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-background",children:r.jsx(Pt,{children:r.jsx(At,{})})}),n[10]=u):u=n[10],c=u;break e}let f;n[11]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(dn,{order:1,minSize:30,defaultSize:55,children:r.jsx("div",{className:"h-full p-0.5 pt-0.25",children:r.jsx("div",{className:"card-shadow flex h-full flex-col overflow-hidden rounded-[0.75rem] bg-background",children:r.jsx(Pt,{children:r.jsx(At,{})})})})}),n[11]=f):f=n[11],a=r.jsxs(Jl,{direction:"horizontal",className:"min-h-0 flex-1 pt-0 pr-1 pb-1 pl-0",children:[f,d&&r.jsxs(r.Fragment,{children:[r.jsx(Zs.Tabs,{children:r.jsx(Mr,{title:le(d.path),icon:{kind:"component",Component:u=>d.key==="preview"?r.jsx(ke,{filename:le(d.path),...u}):d.key==="skill"?r.jsx(_t,{...u}):r.jsx(dt,{...u})},active:!0,onClick:()=>o(d.key)})}),r.jsx(er,{className:"bg-sidebar"}),r.jsx(dn,{order:2,minSize:25,defaultSize:45,children:r.jsx("div",{className:"h-full p-0.5 pt-0.25",children:r.jsx("div",{className:"card-shadow flex h-full flex-col overflow-hidden rounded-[0.75rem] bg-background",children:r.jsx(Pt,{children:d.panel})})})})]})]})}n[3]=o,n[4]=e,n[5]=l.brand,n[6]=l.preview,n[7]=l.skill,n[8]=a,n[9]=c}else a=n[8],c=n[9];return c!==Symbol.for("react.early_return_sentinel")?c:a}const Go=Object.freeze(Object.defineProperty({__proto__:null,LibraryPage:At,default:Gi},Symbol.toStringTag,{value:"Module"}));export{Ro as A,$i as B,wt as C,pt as D,ir as E,cs as F,Uo as G,kr as H,Wo as I,Ao as J,or as K,Er as L,Oo as M,Bo as N,Ho as O,_o as P,Go as Q,Jl as R,Fi as S,Fr as T,To as a,tt as b,ml as c,Do as d,rr as e,Fo as f,cr as g,Mo as h,dn as i,er as j,nr as k,us as l,as as m,Rn as n,Sl as o,On as p,mn as q,At as r,Mr as s,Ei as t,Lt as u,Lo as v,Io as w,qo as x,Ko as y,dr as z};
|