@objectstack/console 17.1.0 → 17.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +731 -0
- package/README.md +26 -10
- package/dist/.objectstack-injection.json +2 -2
- package/dist/.objectui-sha +1 -1
- package/dist/assets/ActionResultDialog-CQwenjVA.js +9 -0
- package/dist/assets/AiPendingActionsPage-7gZ8zlOy.js +1 -0
- package/dist/assets/ApiConsolePage-DUF0ysH7.js +1 -0
- package/dist/assets/{AppDocsIndex-DVrJTsbv.js → AppDocsIndex-CP_AVG4X.js} +1 -1
- package/dist/assets/AppManagementPage-BJktnoa5.js +1 -0
- package/dist/assets/ApprovalsInboxPage-DlnxY-uy.js +1 -0
- package/dist/assets/{AuditLogPage-B-2e1YhN.js → AuditLogPage-DIJPRjji.js} +1 -1
- package/dist/assets/{ComponentNavView-BVbkfJfE.js → ComponentNavView-C84QByT7.js} +1 -1
- package/dist/assets/CreateViewDialog-Zbd9Cagm.js +1 -0
- package/dist/assets/DashboardView-UyKHklBx.js +1 -0
- package/dist/assets/{DeveloperHubPage-CWq2uYpr.js → DeveloperHubPage-BRyNdrCJ.js} +1 -1
- package/dist/assets/DocPage-Bx8ZXCYt.js +1 -0
- package/dist/assets/{DocShell-UFsFTSr-.js → DocShell-Ipy_IDvh.js} +1 -1
- package/dist/assets/DocsIndex-CmY-7OQR.js +1 -0
- package/dist/assets/DocsLayout-BNsSvaz2.js +1 -0
- package/dist/assets/DocsSlug-Cb_NMM1k.js +1 -0
- package/dist/assets/ExpressionProvider-DqGWVuxV.js +1 -0
- package/dist/assets/FlowRunsPage-B6ustUgi.js +1 -0
- package/dist/assets/{IntegrationsPage-DdKbqwGE.js → IntegrationsPage-chOxmiyU.js} +2 -2
- package/dist/assets/InterfaceListPage-DVETnQm5.js +1 -0
- package/dist/assets/MarketplaceInstalledPage-DA5pjhAz.js +1 -0
- package/dist/assets/MarketplacePackagePage-dCIVHBFi.js +4 -0
- package/dist/assets/MarketplacePage-wJb6g1p7.js +1 -0
- package/dist/assets/MetadataInspector-Cu-n1FYz.js +1 -0
- package/dist/assets/ObjectDataPage-CP-YSZYQ.js +1 -0
- package/dist/assets/PageView-B1_ibRuM.js +1 -0
- package/dist/assets/ProfilePage-DEr5iZVB.js +1 -0
- package/dist/assets/PublicFormsPage-CBcKQbNl.js +1 -0
- package/dist/assets/RecordDetailView-A8bbPnkK.js +3 -0
- package/dist/assets/RecordFormPage-CGQlYWDk.js +1 -0
- package/dist/assets/ReportDefaultInspector-R_p6YStL.js +1 -0
- package/dist/assets/ReportView-BTMrtcGH.js +2 -0
- package/dist/assets/RuntimeDraftBar-agGU39FL.js +1 -0
- package/dist/assets/SchemaForm-DJbupOno.js +3 -0
- package/dist/assets/SearchResultsPage-CHhZUc6L.js +1 -0
- package/dist/assets/SettingsHub-BGLR_gS7.js +1 -0
- package/dist/assets/SettingsView-Bq-7Zkzs.js +1 -0
- package/dist/assets/SkeletonDetail-B4-UKxai.js +1 -0
- package/dist/assets/SystemHubPage-CVZVag1e.js +1 -0
- package/dist/assets/{abnfDiagram-N423BO3Z-DfpQlDUF.js → abnfDiagram-VCTEODGH-DUS5D5dU.js} +1 -1
- package/dist/assets/app-shell-eager-leaves-BB0oaPx6.js +1 -0
- package/dist/assets/{utils-CJ4UwXMF.js → appRoute-DEVGXLLH.js} +1 -1
- package/dist/assets/architecture-7GRP2DOG-kzM7RUjO.js +1 -0
- package/dist/assets/{architectureDiagram-T3A2C74G-Ej_4n3NG.js → architectureDiagram-5GKGNRK7-mGW8P1lC.js} +1 -1
- package/dist/assets/blockDiagram-OSKFZWR5-Bz2hnVmp.js +129 -0
- package/dist/assets/c4Diagram-7LVT6UL2-DU3u1Y6c.js +38 -0
- package/dist/assets/channel-FD4s9EIH.js +1 -0
- package/dist/assets/{chunk-U6XO7XAA-D-dXvZaW.js → chunk-2ZTRR5NV-DXmA5XXf.js} +1 -1
- package/dist/assets/chunk-3NF5O7KM-B8Q7HUio.js +168 -0
- package/dist/assets/{chunk-YOTPTUD7-CDtXQZ13.js → chunk-3Z5EZCMW-D3OlaP15.js} +1 -1
- package/dist/assets/chunk-4HAMMTFA-BPKwX4iB.js +62 -0
- package/dist/assets/{chunk-BIQX33UG-DMScvo0C.js → chunk-5V3GS4D5-sE73jHoi.js} +1 -1
- package/dist/assets/{chunk-MOZMSUNE-DG70Besp.js → chunk-6AZGARVD-dsTIs5yl.js} +1 -1
- package/dist/assets/{chunk-5JV3BV7I-BrKM6vC-.js → chunk-6EIED4P4-BB4xaK3K.js} +1 -1
- package/dist/assets/{chunk-R7FJI6CG-DsJHM8am.js → chunk-6K3QC6MW-DaG1LefG.js} +1 -1
- package/dist/assets/{chunk-OSBZ3O6U-Dch_xyhf.js → chunk-6TQVIW2G-DL8WEcT0.js} +1 -1
- package/dist/assets/{chunk-JG7HCLWE-lCTbN-f1.js → chunk-747NJXEK-Bdie6H1T.js} +1 -1
- package/dist/assets/chunk-75Z2AOVW-CkSdnmiC.js +2 -0
- package/dist/assets/chunk-CLGD4ZFX-BTkDISwp.js +1 -0
- package/dist/assets/chunk-DU6HZSFF-BkY4hAzc.js +127 -0
- package/dist/assets/{chunk-2GRJ4B5K-D1if-ThW.js → chunk-F27PBJKO-DUKg0YWV.js} +1 -1
- package/dist/assets/{chunk-KEIR6QF5-ydf36Hye.js → chunk-FOHPRMQF-C65HoZVt.js} +2 -2
- package/dist/assets/chunk-GMAD6QVW-DZo_NykZ.js +72 -0
- package/dist/assets/chunk-GVQU2GXP-9ELY9S6X.js +1 -0
- package/dist/assets/chunk-H2I77ZZE-vCr_buP7.js +1 -0
- package/dist/assets/{chunk-GF5L2VYU-Dgjjn2FR.js → chunk-HLEWEB6X-iPkY2ESt.js} +1 -1
- package/dist/assets/{chunk-QBLGF6JB-CzQYydMJ.js → chunk-I5DQTOEV-Cz6Y6T9y.js} +1 -1
- package/dist/assets/{chunk-5FCAYU7R-BuOxxvKk.js → chunk-ICYGCRZG-DdtFYQ2l.js} +1 -1
- package/dist/assets/{chunk-CQNSW5MT-CCth14ZS.js → chunk-IH6LHLGP-DybuHD8B.js} +1 -1
- package/dist/assets/{chunk-CYSBUYHQ-DIigEFGo.js → chunk-KI3K4JFJ-CB_CI00L.js} +1 -1
- package/dist/assets/chunk-L3NEJ4N5-Bzz35TZJ.js +1 -0
- package/dist/assets/chunk-LNGE3PJU-DWpGwHrW.js +34 -0
- package/dist/assets/chunk-LQGUR6SS-iVI0GACK.js +1 -0
- package/dist/assets/chunk-OSK3NFVY-DcRwXCQD.js +10 -0
- package/dist/assets/{chunk-5TONJI2A-Bdh0MHqz.js → chunk-OUJLGHUK-TbeyE6CA.js} +1 -1
- package/dist/assets/chunk-P2QGCYS3-nx2-dM5t.js +1 -0
- package/dist/assets/{chunk-KBJHAD2P-DI4-lUt-.js → chunk-POPQ4Y6H-BxLOacOG.js} +1 -1
- package/dist/assets/{chunk-4I5QYGJK-DlrWrdEa.js → chunk-PWAF6VOD-2mst9kZu.js} +1 -1
- package/dist/assets/{chunk-6Q2QTUOP-C2vvuHlO.js → chunk-SVP7TREG-C3BMpr4x.js} +1 -1
- package/dist/assets/{chunk-EMLP6XTP-B4CrDa5p.js → chunk-UY3FDG6J-CDAtW6MI.js} +1 -1
- package/dist/assets/{chunk-5HE753X5-T_shrJhj.js → chunk-XHIXRSVI-CqmtoxrP.js} +1 -1
- package/dist/assets/chunk-XXDRQBXY-iNC8aYmk.js +1 -0
- package/dist/assets/{chunk-5RXB4S5H-JwFhdddt.js → chunk-ZLD2IHE6-ZFqtFJbj.js} +2 -2
- package/dist/assets/classDiagram-CYGNFDIV-D5Pd2TCl.js +1 -0
- package/dist/assets/classDiagram-v2-TLXNO2FR-D5Pd2TCl.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-XP-DnSP5.js → cose-bilkent-JH36ORCC-CPQv9aQH.js} +1 -1
- package/dist/assets/createDerive-Best2JCj.js +2 -0
- package/dist/assets/cynefin-OW5HDTMX-Dtvf1C60.js +1 -0
- package/dist/assets/{cynefinDiagram-MW4NZA55-B8MvpqXe.js → cynefinDiagram-5FMLGOSQ-Lnly8IJd.js} +1 -1
- package/dist/assets/cytoscape.esm-CGd-uY3x.js +321 -0
- package/dist/assets/dagre-OS7QT2EB-CdXLxmTK.js +4 -0
- package/dist/assets/dagre-PrKaheQc.js +1 -0
- package/dist/assets/data-adapter-DL25qpAe.js +5 -0
- package/dist/assets/default-inspector-registry-DeEG98bO.js +1 -0
- package/dist/assets/{diagram-7IWD3JNH-Xj62y5BF.js → diagram-S7CK7UJ4-DE8I3gxQ.js} +4 -4
- package/dist/assets/{diagram-UB23O5K3-bseKIzhv.js → diagram-UQ7AKVKN-D2xQpbEq.js} +1 -1
- package/dist/assets/{diagram-B4RE2ZJO-mI-iOCGl.js → diagram-VSXAHHWV-DnttDSlO.js} +1 -1
- package/dist/assets/{diagram-Q27KOJAE-B98Knrnh.js → diagram-VX7I27RA-BSEwkn7K.js} +1 -1
- package/dist/assets/{diagram-LBJQPF4R-BMTSoZch.js → diagram-Z3DM3KII-BgB9f0Nv.js} +1 -1
- package/dist/assets/dist-BpPy7hlB.js +5 -0
- package/dist/assets/{ebnfDiagram-BXEA7PRR-Bgo10FP1.js → ebnfDiagram-PWID7BFC-32WvKbS2.js} +1 -1
- package/dist/assets/erDiagram-2YWLMYGG-Dwf8uAdl.js +99 -0
- package/dist/assets/eventmodeling-NTZA5JFV-CSwP2CpK.js +1 -0
- package/dist/assets/expressionUser-CASszt1z.js +1 -0
- package/dist/assets/flowDiagram-T62WH6J4-CqVSNJ8T.js +1 -0
- package/dist/assets/framework-BfSv4Kb0.js +36 -0
- package/dist/assets/{ganttDiagram-PKOTCBZU-CrmKcYGt.js → ganttDiagram-EL5Y4UJY-DqYIE0Cu.js} +2 -2
- package/dist/assets/getIcon-CgyYxSEC.js +1 -0
- package/dist/assets/gitGraph-4MIJSDKK--Dc33TN5.js +1 -0
- package/dist/assets/{gitGraphDiagram-DS77QQ5N-COu0mOui.js → gitGraphDiagram-WWUBYQGX-D1dYmoGu.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-DUQut-ZU.js → highlighted-body-OFNGDK62-BxO9mjPI.js} +1 -1
- package/dist/assets/i18n-Cfqor-xb.js +9 -0
- package/dist/assets/i18n-locales-Bz4c8KXc.js +31 -0
- package/dist/assets/index-BU-FzlQ6.js +20 -0
- package/dist/assets/index-_VyGO4ms.css +2 -0
- package/dist/assets/info-A6RAGUB7-DBa3mCQO.js +1 -0
- package/dist/assets/{infoDiagram-6WML65LV-BT0Q6MIs.js → infoDiagram-FKFFQAWI-Cr1-5_Am.js} +1 -1
- package/dist/assets/infrastructure-CIpDEFyQ.js +3 -0
- package/dist/assets/{ishikawaDiagram-WSZJBQD7-kvPjMvBP.js → ishikawaDiagram-5VMMS53U-Bsjx7BsE.js} +1 -1
- package/dist/assets/{journeyDiagram-NVQOT4AX-DhXy7wxt.js → journeyDiagram-EYS64GPL-1scn5Z5c.js} +2 -2
- package/dist/assets/{kanban-definition-27J2QSJJ-CFDavpZY.js → kanban-definition-UXKFOSKX-DjLQAv5U.js} +2 -2
- package/dist/assets/mermaid-GHXKKRXX-NzEcDxBh.js +1 -0
- package/dist/assets/{mermaid-parser.core-Dd2B8Ckv.js → mermaid-parser.core-DUt1FNlO.js} +1 -1
- package/dist/assets/mermaid.core-pW40dd4u.js +10 -0
- package/dist/assets/metadata-admin-pawEBYI9.js +9 -0
- package/dist/assets/{mindmap-definition-FAOFIHXS-ITGoV4nW.js → mindmap-definition-THT77NOG-CUcYMB9H.js} +1 -1
- package/dist/assets/nav-selection-Dzm_mA3C.js +1 -0
- package/dist/assets/packet-AYTQ26CC-CPP93DZD.js +1 -0
- package/dist/assets/{pegDiagram-VL7TDLO6-BoRu9yvl.js → pegDiagram-XKGWAZYB-CT1r3sRa.js} +1 -1
- package/dist/assets/pie-WAS4IAKB-B-zzBvuc.js +1 -0
- package/dist/assets/{pieDiagram-7S7Q4E2Y-DVsM9krU.js → pieDiagram-E7YTZNPT-CSi-V1LQ.js} +3 -3
- package/dist/assets/plugin-calendar-BwiiCIjv.js +1 -0
- package/dist/assets/plugin-charts-CDGkx7z5.js +7 -0
- package/dist/assets/plugin-chatbot-BGnkLzFS.js +122 -0
- package/dist/assets/plugin-dashboard-Bj4ldCX6.js +6 -0
- package/dist/assets/plugin-form-_fjHxKTV.js +1 -0
- package/dist/assets/plugin-gantt-zR8DkpEg.js +63 -0
- package/dist/assets/plugin-grid-kkbz4uec.js +9 -0
- package/dist/assets/plugin-kanban-DA0eW6yj.js +1 -0
- package/dist/assets/plugin-map-DukneTNg.js +1 -0
- package/dist/assets/{plugin-markdown-7fyNN0UM.js → plugin-markdown-B7zwZHmn.js} +1 -1
- package/dist/assets/plugin-report-DaPtlsJr.js +59 -0
- package/dist/assets/plugin-timeline-B6rsNNAK.js +1 -0
- package/dist/assets/plugin-tree-DauauLFc.js +1 -0
- package/dist/assets/plugin-view-5qxxRyZZ.js +1 -0
- package/dist/assets/plugins-views-iYcMmImr.js +4 -0
- package/dist/assets/{quadrantDiagram-CIZ2JOQS-C4VzXHnp.js → quadrantDiagram-AXDQQJYC-DUJ_94hm.js} +1 -1
- package/dist/assets/radar-RG4KPBEZ-DWmbpYEk.js +1 -0
- package/dist/assets/railroad-74A4TZTK-xJ7dMu2F.js +1 -0
- package/dist/assets/railroad-abnf-HS5TGJTU-Cw4KG_nE.js +1 -0
- package/dist/assets/railroad-ebnf-LZEXJU2U-C0cgrfTl.js +1 -0
- package/dist/assets/railroad-peg-WCYAUIDC-DOEGG9oQ.js +1 -0
- package/dist/assets/{railroadDiagram-AXF67PYL-DqZ3yKWv.js → railroadDiagram-O6MQD6OU-CEyfAhzM.js} +1 -1
- package/dist/assets/{requirementDiagram-LRYGKXZP-BeH0P3vD.js → requirementDiagram-IS5BZ75X-CAK7hvBg.js} +2 -2
- package/dist/assets/{runtime-metadata-persistence-DpS5GXuQ.js → runtime-metadata-persistence-DYPxFzHI.js} +1 -1
- package/dist/assets/{sankeyDiagram-W5VNT64P-Bu_tPh-A.js → sankeyDiagram-P5KCCOFB-DgYJh7uz.js} +2 -2
- package/dist/assets/{sequenceDiagram-SI44F4Z6-BWEuLn1a.js → sequenceDiagram-WJ2MYXX4-DsQerPtC.js} +1 -1
- package/dist/assets/{src-CY2xhbXR.js → src-CVJP2nIc.js} +1 -1
- package/dist/assets/src-JX1BkhmR.js +17 -0
- package/dist/assets/{src-ClOOPIkS.js → src-S6pzKItc.js} +1 -1
- package/dist/assets/src-_DxAIBqo.js +1 -0
- package/dist/assets/{stateDiagram-OKZ733FA-Cp7aDYsZ.js → stateDiagram-XQSTLZYL-BJndPKik.js} +1 -1
- package/dist/assets/stateDiagram-v2-IH3M54BS-Bi94bTLl.js +1 -0
- package/dist/assets/studioEntry-C6G8U-LG.js +1 -0
- package/dist/assets/submitRedirect-UXd9NsjL.js +1 -0
- package/dist/assets/swimlanes-V6O3JKXN-BiKyiEJr.js +1 -0
- package/dist/assets/swimlanesDiagram-JKAHXJPX-DKIR852g.js +8 -0
- package/dist/assets/{timeline-definition-Z64GVDOM-BcUiJfLU.js → timeline-definition-24CTP7MA-CW5rY3PX.js} +2 -2
- package/dist/assets/treeView-Q6P3EWNA-BcWCBGcU.js +1 -0
- package/dist/assets/treemap-WGGIJYW6-DMTEJzXV.js +1 -0
- package/dist/assets/ui-components-D2lrjG-t.js +43 -0
- package/dist/assets/ui-layout-UUTFXV6S.js +1 -0
- package/dist/assets/use-book-data-qUZAxIs0.js +1 -0
- package/dist/assets/useActionModal-CkM-zGdy.js +1 -0
- package/dist/assets/usePackageL10n-F9isJ9pn.js +1 -0
- package/dist/assets/useSettingsLabel-CSZBfUiw.js +1 -0
- package/dist/assets/utils-MjUhYVsx.js +1 -0
- package/dist/assets/{vendor-charts-BEGSmcjR.js → vendor-charts-CY9WhhzX.js} +1 -1
- package/dist/assets/vendor-i18n-C1AQDWux.js +1 -0
- package/dist/assets/{vendor-markdown-C_Ip9E_I.js → vendor-markdown-BW_XFZ_b.js} +25 -25
- package/dist/assets/vendor-objectstack-BeKUVjuj.js +270 -0
- package/dist/assets/{vennDiagram-T6HMQDX7-BKJsL5fS.js → vennDiagram-4TSXK5OY-C79cMc25.js} +1 -1
- package/dist/assets/wardley-WFR3VGLG-BRyRizpT.js +1 -0
- package/dist/assets/{wardleyDiagram-T6FBY63Y-CZ0aMbYX.js → wardleyDiagram-VM6X3IG4-BAO0_jUk.js} +1 -1
- package/dist/assets/{xychartDiagram-ELKLHX3M-BpK2RmQ_.js → xychartDiagram-S5SC5T6Z-BIRd7YRo.js} +3 -3
- package/dist/eager-closure.json +318 -0
- package/dist/index.html +271 -15
- package/package.json +2 -2
- package/dist/assets/AdapterProvider-3zTVoQKF.js +0 -3
- package/dist/assets/AiPendingActionsPage-DD5DLXIK.js +0 -1
- package/dist/assets/ApiConsolePage-CSQNdOPN.js +0 -1
- package/dist/assets/AppManagementPage-vRCBT69X.js +0 -1
- package/dist/assets/ApprovalsInboxPage-Bft5QF0I.js +0 -1
- package/dist/assets/CreateViewDialog-CW0w7Nxc.js +0 -1
- package/dist/assets/DashboardView-CTBV4_tx.js +0 -1
- package/dist/assets/ExpressionProvider-X1OAB_O-.js +0 -1
- package/dist/assets/FlowRunsPage-CUhBLwm-.js +0 -1
- package/dist/assets/InterfaceListPage-FCdy-_Q-.js +0 -1
- package/dist/assets/ManagedByBadge-Bap9_dqR.js +0 -1
- package/dist/assets/MarketplaceAccessDenied-CrK7hygV.js +0 -1
- package/dist/assets/MarketplaceInstalledPage-Cv-qDRNA.js +0 -1
- package/dist/assets/MarketplacePackagePage-CMS--SE2.js +0 -4
- package/dist/assets/MarketplacePage-njErv-tN.js +0 -1
- package/dist/assets/MetadataInspector-CNeJqkLQ.js +0 -1
- package/dist/assets/MetadataProvider-DwMR1SMR.js +0 -1
- package/dist/assets/ObjectDataPage-BVV4yksz.js +0 -1
- package/dist/assets/PageView-XUBdr6tb.js +0 -1
- package/dist/assets/ProfilePage-ClU0WVRr.js +0 -1
- package/dist/assets/PublicFormsPage-a_MNzdQw.js +0 -1
- package/dist/assets/RecordDetailView-uf81gH3J.js +0 -11
- package/dist/assets/RecordFormPage-CLZcT8Z0.js +0 -1
- package/dist/assets/ReportDefaultInspector-DU2azDYd.js +0 -3
- package/dist/assets/ReportView-oFhBKNBE.js +0 -2
- package/dist/assets/SearchResultsPage-lgNcs7l7.js +0 -1
- package/dist/assets/SettingsHub-TQOc7wH3.js +0 -1
- package/dist/assets/SettingsView-DAje5pDB.js +0 -1
- package/dist/assets/SystemHubPage-DUE-2-vc.js +0 -1
- package/dist/assets/architecture-TIHT7OUA-B8Ln-u1a.js +0 -1
- package/dist/assets/blockDiagram-VBNYF7ZC-l_P_W7_Y.js +0 -132
- package/dist/assets/c4Diagram-5PPSVZJV-CE82HAlO.js +0 -10
- package/dist/assets/channel-DowAYf9b.js +0 -1
- package/dist/assets/chunk-3NCLNEKW-Z5ckM4mG.js +0 -1
- package/dist/assets/chunk-7BUUIJ7U-Bb538aSH.js +0 -1
- package/dist/assets/chunk-7Z6QIM7H-m6s_oalL.js +0 -10
- package/dist/assets/chunk-I66GZJ75-BsY3mBMx.js +0 -127
- package/dist/assets/chunk-J7OUQ5F2-Cl4FNR_k.js +0 -1
- package/dist/assets/chunk-JQJVKLGR-BApWxqMA.js +0 -156
- package/dist/assets/chunk-NSK5VX7P-BBTxIP6Z.js +0 -2
- package/dist/assets/chunk-QR6OTTB3-DJcD7xr-.js +0 -62
- package/dist/assets/chunk-RYQCIY6F-CnMsR_qh.js +0 -1
- package/dist/assets/chunk-UBXNYLIW-B7z1tp3V.js +0 -1
- package/dist/assets/chunk-W5SLKNZC-BnMc5i0B.js +0 -1
- package/dist/assets/chunk-WRU74C26-MrzCPX2E.js +0 -70
- package/dist/assets/chunk-XXDRQBXY-NKBlW2Dm.js +0 -1
- package/dist/assets/chunk-ZIRB5QZD-O39ZBUk3.js +0 -32
- package/dist/assets/classDiagram-JCYQIIEL-C4ADaKBz.js +0 -1
- package/dist/assets/classDiagram-v2-OCEON4UE-C4ADaKBz.js +0 -1
- package/dist/assets/createDerive-xZXxMz1g.js +0 -1
- package/dist/assets/cynefin-VYW2F7L2-exAq6djZ.js +0 -1
- package/dist/assets/cytoscape.esm-B-NFISlW.js +0 -321
- package/dist/assets/dagre-Buvkdvvj.js +0 -1
- package/dist/assets/dagre-VZM6K2ZE-B5E8-xuM.js +0 -4
- package/dist/assets/dist-jor1XT9f.js +0 -5
- package/dist/assets/erDiagram-JOGREHBK-BU4b8mUv.js +0 -85
- package/dist/assets/eventmodeling-45OFAUF4-DVTVIsGT.js +0 -1
- package/dist/assets/flowDiagram-UKHOOZJN-BDHHPApJ.js +0 -1
- package/dist/assets/framework-LCCQTTcs.js +0 -47
- package/dist/assets/getIcon-Bnm_i39L.js +0 -1
- package/dist/assets/gitGraph-TEB2WS4Q-DizXBl0d.js +0 -1
- package/dist/assets/i18n-DGSduXFT.js +0 -9
- package/dist/assets/index-ZtYnn1PE.css +0 -2
- package/dist/assets/index-mpVXni3j.js +0 -2
- package/dist/assets/info-DKCQHKI2-CfAGND28.js +0 -1
- package/dist/assets/infrastructure-CerjT_c2.js +0 -3
- package/dist/assets/map-BaFkSB1l.js +0 -1
- package/dist/assets/mermaid-GHXKKRXX-DQTMu5TJ.js +0 -1
- package/dist/assets/mermaid.core-BwiBFu_S.js +0 -10
- package/dist/assets/metadata-admin-C_DEFfDE.js +0 -25
- package/dist/assets/packet-7NZHBO7P-DeymwuCa.js +0 -1
- package/dist/assets/pie-RZYD4A2V-C2S5u8nr.js +0 -1
- package/dist/assets/plugin-calendar-ClpbcK3u.js +0 -1
- package/dist/assets/plugin-charts-Cq0LpABN.js +0 -7
- package/dist/assets/plugin-chatbot-Cq7rZtnW.js +0 -120
- package/dist/assets/plugin-dashboard-C8Ohdrxi.js +0 -6
- package/dist/assets/plugin-form-B7CBtYvZ.js +0 -1
- package/dist/assets/plugin-gantt-ChkG9_UG.js +0 -64
- package/dist/assets/plugin-grid-D49BBhCX.js +0 -8
- package/dist/assets/plugin-kanban-BsTsRjoP.js +0 -1
- package/dist/assets/plugin-map-CQAe4Yh6.js +0 -1
- package/dist/assets/plugin-report-01bEGHuR.js +0 -59
- package/dist/assets/plugin-timeline-Dw4Lj2Rz.js +0 -1
- package/dist/assets/plugin-tree-DW0XC55y.js +0 -1
- package/dist/assets/plugin-view-B9yCVdSX.js +0 -1
- package/dist/assets/plugins-views-BaBStVok.js +0 -4
- package/dist/assets/radar-I7S5WNFK-DzcfTC8k.js +0 -1
- package/dist/assets/railroad-3IZDKUUU-DT2-gzup.js +0 -1
- package/dist/assets/railroad-abnf-AHOZXSZD-BvCkhVdg.js +0 -1
- package/dist/assets/railroad-ebnf-EBAXGLYW-rvjxEE4k.js +0 -1
- package/dist/assets/railroad-peg-LSFZ7HO6-BIzZt1tD.js +0 -1
- package/dist/assets/skeletons-DVwGbFUS.js +0 -1
- package/dist/assets/src-BA9h8a8o.js +0 -1
- package/dist/assets/src-Ctj_ivDh.js +0 -19
- package/dist/assets/stateDiagram-v2-UEYNNEHI-DaTg8C5m.js +0 -1
- package/dist/assets/swimlanes-SLNWSIFB-wrx1JN6o.js +0 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-Bqz9GVuM.js +0 -8
- package/dist/assets/treeView-QDETBFTQ-DKZwqlNb.js +0 -1
- package/dist/assets/treemap-6X3UGDF4-Bqsldamv.js +0 -1
- package/dist/assets/ui-components-3mb69z8L.js +0 -42
- package/dist/assets/ui-layout-DpuFph25.js +0 -1
- package/dist/assets/use-book-data-BZg_051K.js +0 -1
- package/dist/assets/useActionModal-Z2yDiihK.js +0 -1
- package/dist/assets/usePackageL10n-Cy-u65Zo.js +0 -1
- package/dist/assets/useSettingsLabel-CvZKl8CQ.js +0 -1
- package/dist/assets/vendor-i18n-Cpia2wlg.js +0 -1
- package/dist/assets/vendor-objectstack-DGpW4oR-.js +0 -158
- package/dist/assets/wardley-OPB4EBWU-C_U_bbc2.js +0 -1
- /package/dist/assets/{sizeCapture-X5ZJPWSS-B0uUizjq.js → sizeCapture-INFHLROL-B0uUizjq.js} +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ui-components-BL3SEdAz.css","./plugin-dashboard-DnNKJB60.css","./plugin-map-DSnsEFKn.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{_ as n,a as r,b as i,c as a,f as o,g as s,h as c,i as l,l as u,p as d,r as f,s as p,u as m,v as h}from"./vendor-react-CsWFRkED.js";import{a as g,f as _,g as v,h as y,i as b,m as x,p as S,r as C,v as w,x as T,y as E}from"./infrastructure-CerjT_c2.js";import{dt as D}from"./vendor-objectstack-DGpW4oR-.js";import{A as O,D as ee,E as te,Et as ne,Gn as re,Gr as k,Jn as ie,Kn as ae,O as oe,Yn as se,at as ce,gt as le,it as ue,k as de,qn as fe}from"./framework-LCCQTTcs.js";import{Ar as A,Bc as pe,C as me,D as he,Ds as ge,E as _e,Hn as j,Io as ve,Ir as ye,Mr as M,Nr as N,Oo as be,Pr as P,Qr as F,Qs as xe,Rn as I,Si as Se,ai as Ce,gs as we,it as Te,jr as L,ol as Ee,po as De,sc as Oe,uc as ke,ul as Ae,uo as je,vc as Me,vo as Ne,xa as Pe,xo as R,yc as Fe}from"./ui-components-3mb69z8L.js";import{r as z}from"./vendor-ui-utils-BFw4cGI6.js";import{C as Ie,D as Le,O as Re,S as ze,_ as Be,a as Ve,b as He,c as Ue,d as We,f as Ge,g as Ke,h as qe,i as Je,k as B,l as Ye,m as Xe,n as Ze,o as Qe,p as $e,r as et,s as tt,u as nt,v as rt,w as it,x as at,y as ot}from"./src-Ctj_ivDh.js";import"./plugin-form-B7CBtYvZ.js";import{C as st}from"./RecordDetailView-uf81gH3J.js";import{t as ct}from"./useActionModal-Z2yDiihK.js";import{o as lt}from"./utils-CJ4UwXMF.js";import{r as ut}from"./plugin-chatbot-Cq7rZtnW.js";import{C as V,E as dt,O as ft,T as pt,b as mt,w as ht,x as gt}from"./MarketplaceAccessDenied-CrK7hygV.js";import{a as _t,i as vt,o as yt}from"./plugin-grid-D49BBhCX.js";import"./plugins-views-BaBStVok.js";import"./plugin-view-B9yCVdSX.js";import{n as H}from"./componentRegistry-ByxoJqMW.js";import{r as bt,t as xt}from"./plugin-markdown-7fyNN0UM.js";import{t as U}from"./DocShell-UFsFTSr-.js";import{a as St,i as W,l as Ct,n as G,o as wt,r as Tt,s as Et,t as Dt,u as Ot}from"./use-book-data-BZg_051K.js";var K=e(i(),1),kt=e(h(),1),q=f(),At={type:`object-master-detail-form`,objectName:`expense_claim`,mode:`create`,formType:`simple`,title:`New Expense Claim`,submitText:`Create Claim`,fields:[`title`,`applicant`,`department`,`reason`,`currency`,`claim_status`,`payment_status`,`remarks`],details:[{title:`Expense Lines`,childObject:`expense_line`,relationshipField:`expense_claim`,amountField:`amount`,totalField:`total_amount`,columns:[{name:`expense_date`,label:`Date`,type:`date`},{name:`category`,label:`Category`,type:`select`,options:[{label:`Travel & Transport`,value:`travel_transport`},{label:`Lodging`,value:`lodging`},{label:`Meals & Entertainment`,value:`meals_entertainment`},{label:`Office Supplies`,value:`office_supplies`},{label:`Communications`,value:`communications`},{label:`Training & Conference`,value:`training_conference`},{label:`Client / Project`,value:`client_project`},{label:`Other`,value:`other`}]},{name:`description`,label:`Description`,type:`text`},{name:`merchant_vendor`,label:`Merchant`,type:`text`},{name:`amount`,label:`Amount`,type:`currency`}]}]},jt=()=>(0,q.jsxs)(`div`,{className:`mx-auto max-w-3xl p-6`,children:[(0,q.jsx)(`h1`,{className:`mb-4 text-lg font-semibold`,children:`Dev · Master-Detail Form (ADR-0001)`}),(0,q.jsx)(ne,{schema:At})]}),Mt={type:`element:definition-list`,properties:{columns:2,items:[{term:`Status`,description:`Active`},{term:`Owner`,description:`Ada Lovelace`},{term:`Plan`,description:`Enterprise`},{term:`Renewal`,description:`2026-12-01`}]}},Nt={type:`element:repeater`,properties:{object:`showcase_category`,titleField:`name`,fields:[`color`],limit:10,emptyText:`No categories`}},Pt=()=>(0,q.jsxs)(`div`,{className:`mx-auto max-w-2xl space-y-8 p-6`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`mb-3 text-lg font-semibold`,children:`Dev · element:definition-list`}),(0,q.jsx)(`div`,{className:`rounded-lg border p-4`,children:(0,q.jsx)(ne,{schema:Mt})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`mb-3 text-lg font-semibold`,children:`Dev · element:repeater (showcase_category)`}),(0,q.jsx)(`div`,{className:`rounded-lg border p-4`,children:(0,q.jsx)(ne,{schema:Nt})})]})]}),Ft={type:`element:definition-list`,properties:{columns:2,items:[{term:`Status`,description:`Active`},{term:`Owner`,description:`Ada Lovelace`},{term:`Plan`,description:`Enterprise`},{term:`Renewal`,description:`2026-12-01`}]}},It=()=>{let{modalHandler:e,modalElement:t}=ct();return(0,q.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Dev · Action modal transport`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`One `,(0,q.jsx)(`code`,{children:`onModal`}),` handler, four placements, arbitrary SchemaNode content.`]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(F,{"data-testid":`open-center`,onClick:()=>e({placement:`center`,size:`lg`,title:`Center modal`,content:Ft}),children:`Center`}),(0,q.jsx)(F,{"data-testid":`open-side`,variant:`outline`,onClick:()=>e({placement:`side`,title:`Side drawer`,content:Ft}),children:`Side drawer`}),(0,q.jsx)(F,{"data-testid":`open-bottom`,variant:`outline`,onClick:()=>e({placement:`bottom`,title:`Bottom sheet`,content:Ft}),children:`Bottom sheet`}),(0,q.jsx)(F,{"data-testid":`open-fullscreen`,variant:`outline`,onClick:()=>e({placement:`fullscreen`,title:`Fullscreen`,content:Ft}),children:`Fullscreen`})]}),t]})},Lt=()=>{let[e,t]=K.useState([{},{}]);return(0,q.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-4 p-6`,children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Dev · Line-item grid with a lookup cell`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`The `,(0,q.jsx)(`code`,{children:`Account`}),` column is a real lookup picker bound to live `,(0,q.jsx)(`code`,{children:`showcase_account`}),`.`]}),(0,q.jsx)(me,{value:e,onChange:t,field:{columns:[{name:`account`,label:`Account`,type:`lookup`,reference:`showcase_account`,displayField:`name`},{name:`note`,label:`Note`,type:`text`},{name:`amount`,label:`Amount`,type:`currency`}],total_field:`amount`}}),(0,q.jsx)(`pre`,{className:`rounded bg-muted p-3 text-xs`,"data-testid":`rows-json`,children:JSON.stringify(e)})]})},Rt=[{id:`1`,name:`hotcrm-fix-verify`,org:`hotcrm-fix-verify`,type:`production`,status:`running`,host:`os-05ayzz.objectos.app`},{id:`2`,name:`Objectstack`,org:`Objectstack`,type:`production`,status:`running`,host:`os-0zpadn.objectos.app`},{id:`3`,name:`hotcrm`,org:`JIANGUO Zhuang's Workspace`,type:`production`,status:`running`,host:`os-48f50e60.objectos.app`}],zt=[{name:`open`,label:`Open`,variant:`primary`},{name:`upgrade`,label:`Upgrade Plan`,variant:`primary`},{name:`rename`,label:`Rename`,variant:`secondary`},{name:`archive`,label:`Archive`,variant:`secondary`}],Bt=[{field:`name`,label:`名称`},{field:`org`,label:`所属组织`},{field:`type`,label:`类型`},{field:`status`,label:`状态`},{field:`host`,label:`公开主机名`}];function Vt({maxInlineRowActions:e}){let t={type:`object-grid`,objectName:`showcase_environment`,columns:Bt,data:{provider:`value`,items:Rt},rowActionDefs:zt,...e==null?{}:{maxInlineRowActions:e}};return(0,q.jsx)(le,{children:(0,q.jsx)(vt,{schema:t})})}var Ht=()=>(0,q.jsxs)(`div`,{className:`mx-auto max-w-none space-y-8 p-6`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Dev · Row-action overflow (default)`}),(0,q.jsxs)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:[`Two `,(0,q.jsx)(`code`,{children:`variant:'primary'`}),` row actions. Only `,(0,q.jsx)(`strong`,{children:`Open`}),` stays inline;`,(0,q.jsx)(`strong`,{children:` Upgrade Plan`}),` + the secondaries fold into the `,(0,q.jsx)(`code`,{children:`⋮`}),` menu. The actions column hugs its content and must never clip the inline button.`]}),(0,q.jsx)(`div`,{className:`rounded-lg border`,"data-testid":`grid-default`,children:(0,q.jsx)(Vt,{})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Dev · Row-action overflow (maxInlineRowActions: 2)`}),(0,q.jsxs)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:[`Same data, author opts into two inline primaries — both `,(0,q.jsx)(`strong`,{children:`Open`}),` and`,(0,q.jsx)(`strong`,{children:` Upgrade Plan`}),` render inline and the column grows to fit them.`]}),(0,q.jsx)(`div`,{className:`rounded-lg border`,"data-testid":`grid-wide`,children:(0,q.jsx)(Vt,{maxInlineRowActions:2})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Dev · Row-action sticky-right (narrow / horizontal scroll)`}),(0,q.jsxs)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:[`A deliberately narrow container so the table scrolls horizontally. The`,(0,q.jsx)(`strong`,{children:` 操作`}),` column stays pinned to the right edge (always reachable), while the first `,(0,q.jsx)(`strong`,{children:`名称`}),` column stays frozen on the left. Scroll the grid sideways to check both edges hold.`]}),(0,q.jsx)(`div`,{className:`max-w-md overflow-hidden rounded-lg border`,"data-testid":`grid-scroll`,children:(0,q.jsx)(Vt,{})})]})]}),Ut=4,Wt=1e3;function Gt({endpoint:e,children:t}){let[n,r]=(0,K.useState)({});return(0,K.useEffect)(()=>{let t=!1;return(async()=>{for(let n=0;n<=Ut;n++)try{let n=await fetch(e,{credentials:`include`,headers:{Accept:`application/json`}});if(!n.ok)throw new re(n.status,ie(n));let i=await n.json();if(i.authenticated!==!1&&ee(i.locale),t)return;r({currency:i.currency??void 0,locale:i.locale??void 0});return}catch(e){if(!fe(e)||n===Ut)return;let r=e instanceof re?e.retryAfterMs:void 0;if(await se(ae(n,Wt,r)),t)return}})(),()=>{t=!0}},[e]),(0,q.jsx)(Ae,{value:n,children:t})}var Kt=(0,K.lazy)(()=>n(()=>import(`./SystemHubPage-DUE-2-vc.js`).then(e=>({default:e.SystemHubPage})),__vite__mapDeps([0,1]),import.meta.url)),qt=(0,K.lazy)(()=>n(()=>import(`./AppManagementPage-vRCBT69X.js`).then(e=>({default:e.AppManagementPage})),__vite__mapDeps([0,1]),import.meta.url)),Jt=(0,K.lazy)(()=>n(()=>import(`./ProfilePage-ClU0WVRr.js`).then(e=>({default:e.ProfilePage})),__vite__mapDeps([0]),import.meta.url)),Yt=(0,K.lazy)(()=>n(()=>import(`./ApprovalsInboxPage-Bft5QF0I.js`).then(e=>({default:e.ApprovalsInboxPage})),__vite__mapDeps([0,1]),import.meta.url)),Xt=(0,K.lazy)(()=>n(()=>import(`./AiPendingActionsPage-DD5DLXIK.js`).then(e=>({default:e.AiPendingActionsPage})),__vite__mapDeps([0]),import.meta.url)),Zt=(0,K.lazy)(()=>n(()=>import(`./AuditLogPage-B-2e1YhN.js`).then(e=>({default:e.AuditLogPage})),__vite__mapDeps([0]),import.meta.url)),Qt=(0,K.lazy)(()=>n(()=>import(`./SettingsHub-TQOc7wH3.js`).then(e=>({default:e.SettingsHub})),__vite__mapDeps([0]),import.meta.url)),$t=(0,K.lazy)(()=>n(()=>import(`./SettingsView-DAje5pDB.js`).then(e=>({default:e.SettingsView})),__vite__mapDeps([0]),import.meta.url)),en=(0,K.lazy)(()=>n(()=>import(`./DeveloperHubPage-CWq2uYpr.js`).then(e=>({default:e.DeveloperHubPage})),__vite__mapDeps([0]),import.meta.url)),tn=(0,K.lazy)(()=>n(()=>import(`./ApiConsolePage-CSQNdOPN.js`).then(e=>({default:e.ApiConsolePage})),__vite__mapDeps([0,1]),import.meta.url)),nn=(0,K.lazy)(()=>n(()=>import(`./FlowRunsPage-CUhBLwm-.js`).then(e=>({default:e.FlowRunsPage})),__vite__mapDeps([0,1]),import.meta.url)),rn=(0,K.lazy)(()=>n(()=>import(`./PublicFormsPage-a_MNzdQw.js`).then(e=>({default:e.PublicFormsPage})),__vite__mapDeps([0,1]),import.meta.url)),an=(0,K.lazy)(()=>n(()=>import(`./IntegrationsPage-DdKbqwGE.js`).then(e=>({default:e.IntegrationsPage})),__vite__mapDeps([0]),import.meta.url)),on=(0,K.lazy)(()=>n(()=>Promise.resolve().then(()=>dr),void 0,import.meta.url)),sn=(0,K.lazy)(()=>n(()=>import(`./AppDocsIndex-DVrJTsbv.js`),__vite__mapDeps([0,1]),import.meta.url)),cn=(0,K.lazy)(()=>n(()=>Promise.resolve().then(()=>hr),void 0,import.meta.url)),ln=(0,K.lazy)(()=>n(()=>Promise.resolve().then(()=>_r),void 0,import.meta.url));function un(){let{objectName:e}=c(),t=o().pathname.replace(/\/(system\/)?objects(\/.*)?$/,``),n=e?`${t}/metadata/object/${e}`:`${t}/metadata/object`;return(0,q.jsx)(p,{to:n,replace:!0})}function dn(){let{metadataType:e,itemName:t}=c(),n=`${o().pathname.replace(/\/(system\/)?metadata(\/.*)?$/,``)}/metadata`,r=e?t?`${n}/${encodeURIComponent(e)}/${t}`:`${n}/${encodeURIComponent(e)}`:n;return(0,q.jsx)(p,{to:r,replace:!0})}function J({objectName:e}){let t=o().pathname.replace(/\/system\/[^/]+\/?$/,``);return(0,q.jsx)(p,{to:`${t}/${e}`,replace:!0})}var fn=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(u,{path:`system`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Kt,{})})}),(0,q.jsx)(u,{path:`system/apps`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(qt,{})})}),(0,q.jsx)(u,{path:`system/profile`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Jt,{})})}),(0,q.jsx)(u,{path:`system/approvals`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Yt,{})})}),(0,q.jsx)(u,{path:`system/ai-approvals`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Xt,{})})}),(0,q.jsx)(u,{path:`system/audit-log`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Zt,{})})}),(0,q.jsx)(u,{path:`system/settings`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(Qt,{})})}),(0,q.jsx)(u,{path:`system/settings/:namespace`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)($t,{})})}),(0,q.jsx)(u,{path:`developer`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(en,{})})}),(0,q.jsx)(u,{path:`developer/api-console`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(tn,{})})}),(0,q.jsx)(u,{path:`developer/flow-runs`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(nn,{})})}),(0,q.jsx)(u,{path:`developer/public-forms`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(rn,{})})}),(0,q.jsx)(u,{path:`developer/integrations`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(an,{})})}),(0,q.jsxs)(u,{path:`docs`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(ln,{})}),children:[(0,q.jsx)(u,{index:!0,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(sn,{})})}),(0,q.jsx)(u,{path:`:slug`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(cn,{})})}),(0,q.jsx)(u,{path:`:slug/:name`,element:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(B,{}),children:(0,q.jsx)(on,{})})})]}),(0,q.jsx)(u,{path:`system/objects`,element:(0,q.jsx)(un,{})}),(0,q.jsx)(u,{path:`system/objects/:objectName`,element:(0,q.jsx)(un,{})}),(0,q.jsx)(u,{path:`system/metadata`,element:(0,q.jsx)(dn,{})}),(0,q.jsx)(u,{path:`system/metadata/:metadataType`,element:(0,q.jsx)(dn,{})}),(0,q.jsx)(u,{path:`system/metadata/:metadataType/:itemName`,element:(0,q.jsx)(dn,{})}),(0,q.jsx)(u,{path:`system/users`,element:(0,q.jsx)(J,{objectName:`sys_user`})}),(0,q.jsx)(u,{path:`system/organizations`,element:(0,q.jsx)(J,{objectName:`sys_organization`})}),(0,q.jsx)(u,{path:`system/roles`,element:(0,q.jsx)(J,{objectName:`sys_position`})}),(0,q.jsx)(u,{path:`system/positions`,element:(0,q.jsx)(J,{objectName:`sys_position`})}),(0,q.jsx)(u,{path:`system/permissions`,element:(0,q.jsx)(J,{objectName:`sys_permission_set`})})]});function pn(){let e=(0,K.useMemo)(()=>he({baseUrl:``}),[``]),t=(0,K.useMemo)(()=>T(),[]);return(0,q.jsx)(C,{endpoint:`/api/v1/auth/me/permissions`,fetcher:t,loadingFallback:(0,q.jsx)(B,{}),errorFallback:(e,t)=>(0,q.jsx)(B,{error:e.message,onRetry:t}),children:(0,q.jsx)(Gt,{endpoint:`/api/v1/auth/me/localization`,children:(0,q.jsx)(_e,{adapter:e,children:(0,q.jsx)($e,{extraRoutes:fn,extraRoutesNoApp:fn})})})})}function mn(e){return e._packageId===`com.objectstack.setup`||e.name===`setup`}function hn(e){let t=(e??[]).filter(e=>!!e?.name),n=t.find(e=>e.isDefault===!0);if(n)return`/apps/${n.name}`;let r=t.filter(e=>e.active!==!1&&e.hidden!==!0);return r.length===1&&!mn(r[0])?`/apps/${r[0].name}`:`/home`}function gn(e){return e===void 0||e===`ready`}var _n=1500;function vn(){let{apps:e,loading:t,getTypeStatus:n,refresh:r}=ce(),i=!t&&!gn(n?.(`app`)),a=(0,K.useRef)(!1);return(0,K.useEffect)(()=>{if(!i||a.current)return;a.current=!0;let e=setTimeout(()=>{r?.(`app`)},_n);return()=>clearTimeout(e)},[i,r]),t||i?(0,q.jsx)(ze,{}):(0,q.jsx)(p,{to:hn(e),replace:!0})}function yn(){let e=o(),t=e.pathname+e.search,n=t&&t!==`/`?`?redirect=${encodeURIComponent(t)}`:``;return(0,q.jsx)(p,{to:`/login${n}`,replace:!0})}function Y({children:e,requireOrganization:t=!0}){return(0,q.jsx)(v,{fallback:(0,q.jsx)(yn,{}),loadingFallback:(0,q.jsx)(ze,{}),children:(0,q.jsx)(He,{children:t?(0,q.jsx)(it,{children:e}):e})})}var bn=`/api/v1/auth`;function xn(e,t){return e===`fresh`?`first-run`:t.isLoading?`pending`:t.isAuthenticated?`settings`:e===`unknown`?`pending`:`settings`}function Sn(e){let[t,n]=(0,K.useState)(`unknown`);return(0,K.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{let e=await fetch(`${bn}/bootstrap-status`,{credentials:`include`}),r=e.ok?await e.json().catch(()=>({})):{};t||n(r.hasOwner===!0?`bootstrapped`:`fresh`)}catch{t||n(`fresh`)}})(),()=>{t=!0}},[e]),t}function Cn(){let{isAuthenticated:e,isLoading:t}=w();return xn(Sn(!t&&!e),{isAuthenticated:e,isLoading:t})}function X(e){return e.startsWith(`/_`)?e:`./`.replace(/\/$/,``)+(e.startsWith(`/`)?e:`/${e}`)}var wn=`/api/v1/auth`,Tn=`/`;function En(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function Dn(){let{t:e}=O(),t=d(),{user:n,signUp:r,refreshOrganizations:i,updateOrganization:a,createOrganization:o,switchOrganization:s}=w(),[c,l]=(0,K.useState)(``),[u,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(``),[h,g]=(0,K.useState)(``),[_,v]=(0,K.useState)(!1),[y,b]=(0,K.useState)(null);return(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch(`${wn}/bootstrap-status`,{credentials:`include`}),n=t.ok?await t.json().catch(()=>({})):{};e||b(n.hasOwner===!0)}catch{e||b(!1)}})(),()=>{e=!0}},[]),(0,K.useEffect)(()=>{y===!0&&!n&&t(`/login`,{replace:!0})},[y,n,t]),(0,K.useEffect)(()=>{n&&!_&&window.location.assign(X(Tn))},[n,_]),y===null?(0,q.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted`,children:(0,q.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted-foreground/20 border-t-primary`})}):(0,q.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,q.jsx)(`div`,{className:`flex w-full max-w-md flex-col gap-6`,children:(0,q.jsxs)(A,{children:[(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(P,{children:e(`auth.setup.welcomeTitle`,{defaultValue:`Welcome to ObjectStack`})}),(0,q.jsx)(M,{children:e(`auth.setup.description`,{defaultValue:`Create the first owner account to finish setting up this deployment.`})})]}),(0,q.jsx)(L,{children:(0,q.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),v(!0);try{await r(c,u,p);let e=h.trim();if(e)try{let t;for(let e=0;e<4&&!t?.id;e++)e>0&&await new Promise(e=>setTimeout(e,500)),t=(await i())?.[0];let n=En(e),r;t?.id?(await a(t.id,{name:e,...n?{slug:n}:{}}),r=t.id):r=(await o({name:e,slug:n||`org-${Date.now().toString(36)}`}))?.id,r&&await s(r).catch(()=>void 0)}catch(e){console.warn(`[setup] organization rename/create failed`,e)}window.location.assign(X(Tn))}catch(t){z.error(e(`auth.setup.failed`,{defaultValue:`Setup failed`}),{description:t.message})}finally{v(!1)}},className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(j,{htmlFor:`name`,children:e(`auth.setup.yourName`,{defaultValue:`Your name`})}),(0,q.jsx)(I,{id:`name`,autoComplete:`name`,required:!0,value:c,onChange:e=>l(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(j,{htmlFor:`orgName`,children:e(`auth.setup.orgName`,{defaultValue:`Organization name`})}),(0,q.jsx)(I,{id:`orgName`,required:!0,placeholder:e(`auth.setup.orgNamePlaceholder`,{defaultValue:`Acme Inc.`}),value:h,onChange:e=>g(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(j,{htmlFor:`email`,children:e(`auth.setup.emailLabel`,{defaultValue:`Email`})}),(0,q.jsx)(I,{id:`email`,type:`email`,placeholder:e(`auth.setup.emailPlaceholder`,{defaultValue:`name@example.com`}),autoComplete:`email`,required:!0,value:u,onChange:e=>f(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(j,{htmlFor:`password`,children:e(`auth.setup.passwordLabel`,{defaultValue:`Password`})}),(0,q.jsx)(I,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,placeholder:e(`auth.setup.passwordHint`,{defaultValue:`Minimum 8 characters`}),value:p,onChange:e=>m(e.target.value)})]}),(0,q.jsx)(F,{type:`submit`,className:`mt-2 w-full`,disabled:_,children:_?e(`auth.setup.submitting`,{defaultValue:`Setting up…`}):e(`auth.setup.submit`,{defaultValue:`Create owner account`})})]})})]})})})}function On(){let e=Cn();return e===`pending`?(0,q.jsx)(ze,{}):e===`first-run`?(0,q.jsx)(Dn,{}):(0,q.jsx)(Y,{requireOrganization:!1,children:(0,q.jsx)(Le,{})})}var kn=/\{\{record\.([a-z_][a-z0-9_]*)\}\}/g;function An(e){let t=D.safeParse({submitBehavior:{kind:`redirect`,url:e}});if(!t.success)return{ok:!1,refusal:t.error.issues.find(e=>e.path[0]===`submitBehavior`&&e.path[1]===`url`)?.message??t.error.issues[0]?.message??`\`submitBehavior.url\` is not a value this contract accepts: ${JSON.stringify(e)}.`};let n=t.data.submitBehavior;return{ok:!0,url:n?.kind===`redirect`?n.url:e}}function jn(e){return e==null?``:typeof e==`string`?e:typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)?String(e):``}function Mn(e,t){let n=An(e);if(!n.ok)return n;let r=n.url.replace(kn,(e,n)=>encodeURIComponent(jn(t[n])));return r.includes(`{`)||r.includes(`}`)?{ok:!1,refusal:`\`submitBehavior.url\` carries an interpolation this renderer could not resolve (${JSON.stringify(e)}). A token names one declared record field, spelled \`{{record.field_name}}\`, and the redirect is refused rather than followed with the token left in it.`}:{ok:!0,path:r}}var Nn=`/api/v1`,Pn=new Set([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]),Fn=`recordId`;function In(e,t){if(e!==`internal`)return{kind:`create`};let n=t.get(Fn);if(n===null)return{kind:`create`};let r=n.trim();return r?{kind:`edit`,recordId:r,recordObject:(t.get(`recordObject`)??``).trim()||null}:{kind:`refuse`,reason:`This form was opened to edit a record (?${Fn}=), but no record id was supplied. Re-open it from the record, or drop the parameter to create a new one.`}}function Ln(e){let t=typeof e==`string`?parseInt(e,10):e;return t===1||t===2||t===3||t===4?t:2}function Rn(e){if(Array.isArray(e))return e.map(e=>{if(typeof e==`string`)return{value:e,label:e};if(e&&typeof e==`object`){let t=String(e.value??e.id??``);return{value:t,label:String(e.label??e.name??t)}}return{value:String(e),label:String(e)}})}function zn(e,t){let n=e.sections??e.groups??[],r=t?.fields??{};return n.map(e=>{let t=Ln(e.columns),n=[];for(let t of e.fields??[]){let e=typeof t==`string`?{field:t}:{...t},i=r[e.field]??{type:`text`};n.push({name:e.field,label:e.label??i.label??e.field,type:i.type??`text`,required:e.required??i.required??!1,readonly:e.readonly??!1,hidden:e.hidden??!1,placeholder:e.placeholder??i.placeholder,helpText:e.helpText??i.helpText,defaultValue:i.defaultValue,options:Rn(i.options),maxLength:i.maxLength,colSpan:e.colSpan??1})}return{label:e.label,columns:t,collapsible:!!e.collapsible,collapsed:!!e.collapsed,fields:n}})}function Bn(e,t){return t||(e===`internal`?{kind:`created-record`}:{kind:`thank-you`})}function Vn(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.success==`boolean`&&`data`in t?t.data:t;return!n||typeof n!=`object`?null:n}function Hn(e){let t=Vn(e);if(!t)return null;let n=t.id;return typeof n==`string`?n===``?null:n:typeof n==`number`&&Number.isFinite(n)?String(n):null}function Un(e,t,n){let r=Vn(e);if(!r)throw Error(`Could not read record "${n}" of ${t}: the server returned no record payload.`);let i=r.object;if(typeof i==`string`&&i&&i!==t)throw Error(`Record "${n}" belongs to ${i}, but this form edits ${t}. Refusing to open it — check the action that linked here.`);let a=r.record;if(!a||typeof a!=`object`||Array.isArray(a))throw Error(`Could not read record "${n}" of ${t}: the response carried no "record".`);return a}function Wn(e,t,n){let r={};for(let i of e){i.defaultValue!==void 0&&(r[i.name]=i.defaultValue),n&&Object.prototype.hasOwnProperty.call(n,i.name)&&(r[i.name]=n[i.name]);let e=t.get(`prefill_${i.name}`);e!==null&&(r[i.name]=e)}return r}async function Z(e,t){return fetch(`${Nn}${e}`,{credentials:`include`,headers:{"Content-Type":`application/json`,...t?.headers??{}},...t})}async function Gn(e){let t=await Z(`/forms/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.text().catch(()=>``);throw Error(`Failed to load form (${t.status}): ${e||t.statusText}`)}let n=await t.json();return{label:n.label??n.form?.label??n.object,object:n.object,form:n.form,objectSchema:n.objectSchema,record:null}}function Kn(e,t){let n=t,r=n?.item??n,i=r?.spec??r,a=i&&typeof i==`object`&&i.config&&typeof i.config==`object`&&(`viewKind`in i||`object`in i),o=i&&typeof i==`object`?i.viewKind:void 0;if(o&&o!==`form`)throw Error(`View "${e}" is a ${o} view, not a form view — check the action or link that targets it.`);let s=a?i.config:i;if(!o&&s&&typeof s==`object`&&typeof s.type==`string`&&!Pn.has(s.type))throw Error(`View "${e}" is a ${s.type} view, not a form view — check the action or link that targets it.`);return{label:(a?i.label:void 0)??s?.label??e,object:(a?i.object:void 0)??s?.data?.object??i?.object,form:s}}async function qn(e,t,n){let r=await Z(`/meta/view/${encodeURIComponent(e)}`);if(!r.ok)throw Error(`Form metadata not found: view/${e}`);let{label:i,object:a,form:o}=Kn(e,await r.json());if(!a)throw Error(`FormView "${e}" is missing an "object" target`);if(n&&n!==a)throw Error(`This form edits ${a}, but the link says record "${t}" belongs to ${n}. Refusing to open it — check the action that linked here.`);let s=null;try{let e=await Z(`/meta/object/${encodeURIComponent(a)}`);if(e.ok){let t=await e.json(),n=t?.item??t,r=n?.spec??n;r?.fields&&typeof r.fields==`object`&&(s={name:r.name??a,label:r.label,fields:r.fields})}}catch{}let c=null;if(t){let e=await Z(`/data/${encodeURIComponent(a)}/${encodeURIComponent(t)}`);if(!e.ok){let n=await e.text().catch(()=>``);throw Error(`Could not open record "${t}" of ${a} for editing (${e.status})${n?`: ${n}`:e.statusText?`: ${e.statusText}`:``}`)}c=Un(await e.json(),a,t)}return{label:i,object:a,form:o,objectSchema:s,record:c}}async function Jn(e,t){let n=await Z(`/forms/${encodeURIComponent(e)}/submit`,{method:`POST`,body:JSON.stringify(t)});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`Submit failed (${n.status}): ${e||n.statusText}`)}return n.json().catch(()=>({}))}async function Yn(e,t,n){let r=await Z(n?`/data/${encodeURIComponent(e)}/${encodeURIComponent(n)}`:`/data/${encodeURIComponent(e)}`,{method:n?`PATCH`:`POST`,body:JSON.stringify(t)});if(!r.ok){let e=await r.text().catch(()=>``);throw Error(`${n?`Update`:`Create`} failed (${r.status}): ${e||r.statusText}`)}return r.json().catch(()=>({}))}var Xn=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50`;function Zn({field:e,value:t,onChange:n}){let r={id:`f_${e.name}`,name:e.name,required:e.required,disabled:e.readonly,placeholder:e.placeholder,className:Xn},i=t??``;switch(e.type){case`textarea`:case`paragraph`:case`long_text`:return(0,q.jsx)(`textarea`,{...r,rows:5,maxLength:e.maxLength,value:String(i),onChange:e=>n(e.target.value)});case`number`:case`integer`:case`decimal`:case`currency`:return(0,q.jsx)(`input`,{...r,type:`number`,value:i===``?``:Number(i),onChange:e=>n(e.target.value===``?null:Number(e.target.value))});case`email`:return(0,q.jsx)(`input`,{...r,type:`email`,value:String(i),onChange:e=>n(e.target.value)});case`url`:return(0,q.jsx)(`input`,{...r,type:`url`,value:String(i),onChange:e=>n(e.target.value)});case`password`:return(0,q.jsx)(`input`,{...r,type:`password`,value:String(i),onChange:e=>n(e.target.value)});case`date`:return(0,q.jsx)(`input`,{...r,type:`date`,value:String(i),onChange:e=>n(e.target.value)});case`time`:return(0,q.jsx)(`input`,{...r,type:`time`,value:String(i),onChange:e=>n(e.target.value)});case`datetime`:case`timestamp`:return(0,q.jsx)(`input`,{...r,type:`datetime-local`,value:String(i),onChange:e=>n(e.target.value)});case`boolean`:case`toggle`:case`checkbox`:return(0,q.jsxs)(`label`,{className:`inline-flex items-center gap-2 text-sm`,children:[(0,q.jsx)(`input`,{id:r.id,name:r.name,type:`checkbox`,disabled:e.readonly,checked:!!i,onChange:e=>n(e.target.checked),className:`h-4 w-4 rounded border-input`}),(0,q.jsx)(`span`,{children:e.placeholder??e.label})]});case`select`:case`picklist`:case`enum`:{let t=e.options??[];return(0,q.jsxs)(`select`,{...r,value:String(i),onChange:e=>n(e.target.value),children:[(0,q.jsx)(`option`,{value:``,disabled:e.required,children:e.placeholder??`— Select —`}),t.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))]})}case`radio`:{let t=e.options??[];return(0,q.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:t.map(t=>(0,q.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,q.jsx)(`input`,{type:`radio`,name:e.name,value:t.value,checked:String(i)===t.value,disabled:e.readonly,onChange:()=>n(t.value)}),(0,q.jsx)(`span`,{children:t.label})]},t.value))})}default:return(0,q.jsx)(`input`,{...r,type:`text`,maxLength:e.maxLength,value:String(i),onChange:e=>n(e.target.value)})}}function Qn({mode:e,recordPath:t}){let n=c(),[r]=s(),i=d(),a=(e===`public`?n.slug:n.name)??``,o=In(e,r),l=o.kind===`edit`?o.recordId:null,u=o.kind===`edit`?o.recordObject:null,[f,p]=(0,K.useState)(!0),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)({}),[b,x]=(0,K.useState)(!1),[S,C]=(0,K.useState)(!1),[w,T]=(0,K.useState)(null);(0,K.useEffect)(()=>{let t=!1;return p(!0),h(null),(o.kind===`refuse`?Promise.reject(Error(o.reason)):e===`public`?Gn(a):qn(a,l,u)).then(e=>{if(t)return;_(e);let n=zn(e.form,e.objectSchema).flatMap(e=>e.fields);y(Wn(n,r,e.record))}).catch(e=>{t||(_(null),h(e?.message??String(e)))}).finally(()=>{t||p(!1)}),()=>{t=!0}},[e,a,r]);let E=(0,K.useMemo)(()=>g?zn(g.form,g.objectSchema):[],[g]),D=Bn(e,g?.form?.submitBehavior),O=w?.kind===`pending`?w.path:null,ee=D.kind===`redirect`?D.delayMs??0:0;(0,K.useEffect)(()=>{if(O===null)return;let e=setTimeout(()=>i(O),ee);return()=>clearTimeout(e)},[O,ee,i]);let te=async n=>{if(n.preventDefault(),g){x(!0),h(null);try{let n=e===`public`?await Jn(a,v):await Yn(g.object,v,l);switch(z.success(`Submitted`),D.kind){case`created-record`:{let e=l??Hn(n),r=e?t?.(g.object,e):null;if(r){i(r);break}C(!0);break}case`redirect`:{let e=Vn(n)?.record,t=l??Hn(n),r=Mn(D.url,{...v,...e&&typeof e==`object`?e:{},...t?{id:t}:{}});if(!r.ok){z.error(r.refusal),T({kind:`refused`,refusal:r.refusal}),C(!0);break}T({kind:`pending`,path:r.path}),C(!0);break}case`continue`:{let e=E.flatMap(e=>e.fields);y(Wn(e,r,g.record));break}default:C(!0)}}catch(e){let t=e?.message??String(e);h(t),z.error(t)}finally{x(!1)}}};if(f)return(0,q.jsx)(`div`,{className:`flex min-h-[60vh] items-center justify-center`,children:(0,q.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Loading…`})});if(m&&!g)return(0,q.jsx)(`div`,{className:`mx-auto max-w-2xl p-6`,children:(0,q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:m})});if(!g)return null;if(S&&(D.kind===`thank-you`||D.kind===`created-record`)){let e=D.kind===`thank-you`?D.title:void 0,t=D.kind===`thank-you`?D.message:void 0;return(0,q.jsx)(`div`,{className:`mx-auto max-w-2xl p-6`,children:(0,q.jsxs)(`div`,{className:`rounded-md border bg-card p-6 text-center`,children:[(0,q.jsx)(`h2`,{className:`mb-2 text-lg font-semibold`,children:e??`Thanks!`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t??`Your submission has been received.`})]})})}return S&&D.kind===`redirect`?w?.kind===`refused`?(0,q.jsxs)(`div`,{className:`mx-auto max-w-2xl space-y-4 p-6`,children:[(0,q.jsxs)(`div`,{className:`rounded-md border bg-card p-6 text-center`,children:[(0,q.jsx)(`h2`,{className:`mb-2 text-lg font-semibold`,children:`Thanks!`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your submission has been received.`})]}),(0,q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:w.refusal})]}):(0,q.jsx)(`div`,{className:`mx-auto max-w-2xl p-6 text-center text-sm text-muted-foreground`,children:`Redirecting…`}):(0,q.jsxs)(`div`,{className:`mx-auto max-w-2xl p-4 sm:p-6`,children:[(0,q.jsxs)(`header`,{className:`mb-6`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold`,children:g.label}),g.form?.label&&g.form.label!==g.label&&(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:g.form.label})]}),(0,q.jsxs)(`form`,{onSubmit:te,className:`space-y-6`,children:[E.map((e,t)=>(0,q.jsxs)(`section`,{className:`rounded-md border bg-card p-4 sm:p-5`,children:[e.label&&(0,q.jsx)(`h2`,{className:`mb-3 text-sm font-medium`,children:e.label}),(0,q.jsx)(`div`,{className:e.columns===1?`grid grid-cols-1 gap-4`:e.columns===2?`grid grid-cols-1 gap-4 sm:grid-cols-2`:e.columns===3?`grid grid-cols-1 gap-4 sm:grid-cols-3`:`grid grid-cols-1 gap-4 sm:grid-cols-4`,children:e.fields.filter(e=>!e.hidden).map(e=>(0,q.jsxs)(`div`,{className:e.colSpan===2?`sm:col-span-2`:e.colSpan===3?`sm:col-span-3`:e.colSpan===4?`sm:col-span-4`:``,children:[(0,q.jsxs)(`label`,{htmlFor:`f_${e.name}`,className:`mb-1 block text-xs font-medium text-foreground`,children:[e.label,e.required&&(0,q.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`})]}),(0,q.jsx)(Zn,{field:e,value:v[e.name],onChange:t=>y(n=>({...n,[e.name]:t}))}),e.helpText&&(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.helpText})]},e.name))})]},t)),m&&(0,q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:m}),(0,q.jsx)(`div`,{className:`flex justify-end gap-2`,children:(0,q.jsx)(`button`,{type:`submit`,disabled:b,className:`rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow-sm hover:bg-primary/90 disabled:opacity-50`,children:b?`Submitting…`:`Submit`})})]})]})}function $n(e,t,n,r){if(!n||!r)return null;let i=lt(e,t);return`/apps/${encodeURIComponent(i)}/${encodeURIComponent(n)}/record/${encodeURIComponent(r)}`}function er(){let{apps:e}=ce(),{currentAppName:t}=st(),{user:n}=w(),r=(0,K.useMemo)(()=>(n,r)=>$n(e,t,n,r),[e,t]);return(0,q.jsx)(Ge,{userId:n?.id,children:(0,q.jsx)(Qn,{mode:`internal`,recordPath:r})})}function tr({enabled:e=!1,url:t=`/api/v1/dev/metadata-events`,debounceMs:n=400,reconnectDelayMs:r=2e3}){let i=(0,K.useRef)(null);return(0,K.useEffect)(()=>{if(!e||typeof window>`u`||typeof EventSource>`u`)return;let a=null,o=null,s=!1,c=e=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{try{z.info(`Metadata changed (${e}) — reloading…`,{duration:800})}catch{}setTimeout(()=>{try{window.location.reload()}catch{}},150)},n)},l=e=>{try{let t=JSON.parse(e.data),n=t?.name?`${t.metadataType??`metadata`}:${t.name}`:`metadata`;c(n)}catch{c(`change`)}},u=e=>{let t=`rebuild`;try{t=JSON.parse(e.data)?.reason??t}catch{}c(t)},d=()=>{if(!s)try{a=new EventSource(t),a.addEventListener(`metadata-change`,l),a.addEventListener(`reload`,u),a.addEventListener(`error`,()=>{s||a?.readyState===EventSource.CLOSED&&(a=null,o=setTimeout(d,r))})}catch{o=setTimeout(d,r)}};return d(),()=>{if(s=!0,o&&clearTimeout(o),i.current&&clearTimeout(i.current),a)try{a.close()}catch{}}},[e,t,n,r]),null}function nr(e){let t=e.data??e;return{record:t.record??{},link:t.link,redactedFields:t.redactFields}}function rr(){let e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_SENTRY_DSN:`https://1373a588ceb9da150b11e64bf85f583d@o4510356161757184.ingest.us.sentry.io/4511439670673408`,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_SEND_DEFAULT_PII:`true`,VITE_SERVER_URL:``,VITE_USE_MOCK_SERVER:`false`}.VITE_SERVER_URL??``;return e?e.replace(/\/$/,``):typeof window<`u`?window.location.origin:``}function ir(){let{token:e}=c(),t=`${(0,K.useMemo)(()=>rr(),[])}/api/v1`,[n,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(null),[o,s]=(0,K.useState)(!0),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(null),h=(0,K.useCallback)(async n=>{if(e){s(!0),a(null);try{let i=new URL(`${t}/share-links/${encodeURIComponent(e)}/resolve`);n&&i.searchParams.set(`password`,n);let o=await fetch(i.toString(),{headers:{Accept:`application/json`}});if(o.status===401){u(!0),a(n?`Wrong password.`:null),s(!1);return}if(o.status===404){a(`This link is invalid or no longer available.`),s(!1);return}if(o.status===410){a(`This link has expired or was revoked.`),s(!1);return}if(!o.ok){let e=await o.json().catch(()=>null);a(e?.error?.message??`Failed to load (HTTP ${o.status}).`),s(!1);return}r(nr(await o.json())),u(!1)}catch(e){a(e?.message??`Failed to load shared content.`)}finally{s(!1)}}},[t,e]);(0,K.useEffect)(()=>{h()},[h]),(0,K.useEffect)(()=>{if(!n||n.link.object_name!==`ai_conversations`)return;let e=`${t}/share-links/${encodeURIComponent(n.link.token)}/messages`;fetch(e,{headers:{Accept:`application/json`}}).then(e=>e.ok?e.json():null).then(e=>m(e?.data??[])).catch(()=>m([]))},[t,n]);let g=(0,K.useMemo)(()=>p?Be(ot(rt(p))):[],[p]);if(o)return(0,q.jsxs)(`div`,{className:`flex h-svh w-full items-center justify-center bg-background text-muted-foreground`,children:[(0,q.jsx)(R,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading…`]});if(l)return(0,q.jsxs)(`div`,{className:`mx-auto flex h-svh max-w-md flex-col items-center justify-center gap-4 px-4 text-center`,children:[(0,q.jsx)(be,{className:`h-8 w-8 text-muted-foreground`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Password required`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The owner protected this link with a password.`}),(0,q.jsxs)(`form`,{className:`flex w-full flex-col gap-2`,onSubmit:e=>{e.preventDefault(),h(d)},children:[(0,q.jsx)(j,{htmlFor:`share-pw`,className:`sr-only`,children:`Password`}),(0,q.jsx)(I,{id:`share-pw`,type:`password`,value:d,onChange:e=>f(e.target.value),autoFocus:!0,placeholder:`Enter password`}),i&&(0,q.jsx)(`p`,{className:`text-xs text-destructive`,children:i}),(0,q.jsx)(F,{type:`submit`,size:`sm`,children:`Continue`})]})]});if(i)return(0,q.jsxs)(`div`,{className:`mx-auto flex h-svh max-w-md flex-col items-center justify-center gap-3 px-4 text-center`,children:[(0,q.jsx)(Se,{className:`h-8 w-8 text-amber-500`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Can't open this link`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i})]});if(!n)return null;if(n.link.object_name===`ai_conversations`){let e=n.record;return(0,q.jsxs)(`div`,{className:`mx-auto flex h-svh max-w-3xl flex-col bg-background`,children:[(0,q.jsxs)(`header`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b bg-background px-4 py-3`,children:[(0,q.jsx)(je,{className:`h-5 w-5 text-muted-foreground`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`h1`,{className:`truncate text-sm font-semibold`,children:e.title??`Shared conversation`}),(0,q.jsx)(`p`,{className:`truncate text-[11px] text-muted-foreground`,children:`Read-only · Shared via ObjectStack`})]}),(0,q.jsx)(ye,{variant:`outline`,className:`text-[10px] capitalize`,children:n.link.permission})]}),(0,q.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col`,children:p==null?(0,q.jsxs)(`div`,{className:`flex flex-1 items-center justify-center py-12 text-sm text-muted-foreground`,children:[(0,q.jsx)(R,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading messages…`]}):p.length===0?(0,q.jsx)(`p`,{className:`py-12 text-center text-sm text-muted-foreground`,children:`This conversation has no messages yet.`}):(0,q.jsx)(ut,{readOnly:!0,surface:`plain`,messages:g,showAvatars:!0,maxHeight:`100%`,className:`flex-1`})}),(0,q.jsx)(`footer`,{className:`border-t bg-muted/30 px-4 py-2 text-center text-[11px] text-muted-foreground`,children:`Powered by ObjectStack`})]})}return(0,q.jsxs)(`div`,{className:`mx-auto flex h-svh max-w-3xl flex-col bg-background`,children:[(0,q.jsx)(`header`,{className:`border-b px-4 py-3`,children:(0,q.jsxs)(`h1`,{className:`text-sm font-semibold`,children:[`Shared `,n.link.object_name]})}),(0,q.jsxs)(`main`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,q.jsx)(`pre`,{className:`overflow-x-auto rounded-md border bg-muted/30 p-3 text-[12px]`,children:JSON.stringify(n.record,null,2)}),n.redactedFields&&n.redactedFields.length>0&&(0,q.jsxs)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:[`Some fields are hidden by the owner: `,n.redactedFields.join(`, `)]})]})]})}var ar=/(^```[^\n]*\n[\s\S]*?\n```[ \t]*$|^~~~[^\n]*\n[\s\S]*?\n~~~[ \t]*$)/m,or=/(`[^`\n]+`)/,sr=/\]\((?:\.\/)?([a-z][a-z0-9_]*)\.md(#[^)\s]*)?\)/g;function cr(e){return e.split(or).map((e,t)=>t%2==1?e:e.replace(sr,`](/docs/$1$2)`)).join(``)}function lr(e){let t=[],n=e;for(;;){let e=ar.exec(n);if(!e||e.index===void 0)return t.push(cr(n)),t.join(``);t.push(cr(n.slice(0,e.index)),e[0]),n=n.slice(e.index+e[0].length)}}function ur({book:e,activeDoc:t,docHref:n}){return(0,q.jsxs)(`nav`,{"aria-label":e.label??e.name,className:`text-sm`,children:[e.label?(0,q.jsx)(`div`,{className:`mb-3 px-2 text-sm font-semibold text-foreground`,children:e.label}):null,(0,q.jsx)(`div`,{className:`space-y-5`,children:e.groups.map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`mb-1 px-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.label}),(0,q.jsx)(`ul`,{className:`space-y-0.5`,children:e.entries.map((e,i)=>{if(e.separator)return(0,q.jsx)(`li`,{className:`my-1.5 border-t border-border/60`,"aria-hidden":!0},`sep-${i}`);if(e.href)return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1.5 rounded px-2 py-1 text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.label??e.href}),(0,q.jsx)(ge,{className:`h-3 w-3 shrink-0 opacity-60`})]})},`ext-${i}`);if(!e.doc)return null;let a=e.doc===t;return(0,q.jsx)(`li`,{children:(0,q.jsx)(r,{to:n(e.doc),"aria-current":a?`page`:void 0,className:`block truncate rounded px-2 py-1 transition ${a?`bg-primary/10 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:e.label??e.doc})},e.doc)})})]},e.key))})]})}var dr=t({default:()=>fr});function fr(){let{slug:e,name:t,appName:n}=c(),r=d(),i=ue(),{t:a}=O(),[o,s]=(0,K.useState)(null),[l,u]=(0,K.useState)(`loading`),[f,p]=(0,K.useState)(``);(0,K.useEffect)(()=>{let e=!1;async function r(){if(!(!t||!i)){u(`loading`);try{let r=await i.getClient().meta.getItem(`doc`,t,n?{packageId:n}:void 0),a=r?.item??r?.data??r;if(e)return;a&&typeof a.content==`string`?(s({name:t,label:a.label,content:a.content}),u(`ready`)):u(`missing`)}catch(t){if(e)return;(t?.status??t?.response?.status)===404||/not found/i.test(t?.message??``)?u(`missing`):(p(t?.message??`Failed to load documentation`),u(`error`))}}}return r(),()=>{e=!0}},[t,n,i]);let m=(0,K.useCallback)(e=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}#${e}`)},[]),h=(0,K.useCallback)(e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0)return;let t=e.target.closest(`a`)?.getAttribute(`href`);t&&(t.startsWith(`/docs/`)?(e.preventDefault(),r(t)):t.startsWith(`#`)&&(e.preventDefault(),m(decodeURIComponent(t.slice(1)))))},[r,m]),g=(0,K.useCallback)((e,t)=>{e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),m(t))},[m]),_=(0,K.useMemo)(()=>bt(o?.content??``),[o?.content]),v=a(`help.onThisPage`,{defaultValue:`On this page`}),{books:y,docs:b}=G(),x=n?`/apps/${n}/docs`:`/docs`,S=(0,K.useMemo)(()=>{let t=y.find(t=>W(t)===e);return t?Ct(t,Ot(t,b)):null},[y,b,e]),C=(0,K.useCallback)(t=>`${x}/${e}/${t}`,[x,e]);return l===`loading`?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,q.jsx)(R,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):l===`missing`?(0,q.jsx)(U,{breadcrumb:t,children:(0,q.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,q.jsx)(we,{className:`h-10 w-10 text-muted-foreground`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Documentation not found`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No document named `,(0,q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:t}),` is installed. It may belong to a package that is not installed, or it was removed in a newer version.`]})]})}):l===`error`?(0,q.jsx)(U,{breadcrumb:t,children:(0,q.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,q.jsx)(ke,{className:`h-10 w-10 text-destructive`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Failed to load documentation`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f})]})}):(0,q.jsxs)(U,{breadcrumb:o?.label??t,children:[S?(0,q.jsxs)(`details`,{className:`group mx-auto max-w-6xl px-4 pt-4 sm:px-6 lg:hidden`,children:[(0,q.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md border bg-muted/30 px-3 py-2 text-sm font-medium [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(De,{className:`h-4 w-4 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`truncate`,children:S.label??`Contents`}),(0,q.jsx)(Me,{className:`ml-auto h-4 w-4 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,q.jsx)(`div`,{className:`mt-2 rounded-md border p-3`,children:(0,q.jsx)(ur,{book:S,activeDoc:t,docHref:C})})]}):null,(0,q.jsxs)(`div`,{className:`mx-auto flex gap-8 p-4 sm:p-6 ${S?`max-w-6xl`:`max-w-5xl`}`,children:[S?(0,q.jsx)(`aside`,{className:`hidden w-56 shrink-0 lg:block`,children:(0,q.jsx)(`nav`,{className:`sticky top-20 max-h-[calc(100vh-6rem)] overflow-auto pr-1`,children:(0,q.jsx)(ur,{book:S,activeDoc:t,docHref:C})})}):null,(0,q.jsx)(`article`,{className:`min-w-0 max-w-3xl flex-1 [&_h1]:scroll-mt-24 [&_h2]:scroll-mt-24 [&_h3]:scroll-mt-24`,onClick:h,children:(0,q.jsx)(xt,{schema:{type:`markdown`,content:lr(o?.content??``)}})}),_.length>=3?(0,q.jsx)(`aside`,{className:`hidden xl:block w-56 shrink-0`,children:(0,q.jsxs)(`nav`,{"aria-label":v,className:`sticky top-20 max-h-[calc(100vh-6rem)] overflow-auto`,children:[(0,q.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:v}),(0,q.jsx)(`ul`,{className:`border-l border-border text-sm`,children:_.map(e=>(0,q.jsx)(`li`,{style:{paddingLeft:(e.depth-2)*12},children:(0,q.jsx)(`a`,{href:`#${e.id}`,onClick:t=>g(t,e.id),className:`-ml-px block border-l border-transparent py-0.5 pl-3 text-muted-foreground hover:border-primary hover:text-foreground`,children:e.text})},e.id))})]})}):null]})]})}function pr(){let{books:e,docs:t,state:n,error:i}=G(),a=(0,K.useMemo)(()=>St(e,t),[e,t]);return n===`loading`?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,q.jsx)(R,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):n===`error`?(0,q.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,q.jsx)(ke,{className:`h-10 w-10 text-destructive`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Failed to load documentation`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i})]}):(0,q.jsx)(U,{children:(0,q.jsxs)(`div`,{className:`mx-auto max-w-4xl p-4 sm:p-6`,children:[(0,q.jsxs)(`header`,{className:`mb-6`,children:[(0,q.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Documentation`}),(0,q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Books and guides from your installed packages.`})]}),a.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-16 text-center text-muted-foreground`,children:[(0,q.jsx)(pe,{className:`h-10 w-10`}),(0,q.jsxs)(`p`,{className:`text-sm`,children:[`No documentation is installed. Packages ship docs as flat`,(0,q.jsx)(`code`,{className:`mx-1 rounded bg-muted px-1 py-0.5`,children:`src/docs/*.md`}),`files, organised by a `,(0,q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`book`}),` (ADR-0046).`]})]}):(0,q.jsx)(`ul`,{className:`grid items-stretch gap-3 sm:grid-cols-2`,children:a.map(e=>(0,q.jsx)(`li`,{className:`h-full`,children:(0,q.jsxs)(r,{to:`/docs/${e.slug}`,className:`flex h-full items-start gap-3 rounded-md border border-border p-3 hover:bg-muted/50`,children:[(0,q.jsx)(pe,{className:`mt-0.5 h-5 w-5 shrink-0 text-muted-foreground`}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`div`,{className:`text-sm font-semibold`,children:e.label}),e.description?(0,q.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):e.subtitle?(0,q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground/70`,children:e.subtitle}):null,(0,q.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground/80`,children:[e.docCount,` `,e.docCount===1?`article`:`articles`]})]})]})},e.name))})]})})}function mr(){let{slug:e,appName:t}=c(),{books:n,docs:r,state:i}=G(),a=(0,K.useMemo)(()=>n.find(t=>W(t)===e),[n,e]),o=(0,K.useMemo)(()=>a?wt(Ct(a,Ot(a,r))):void 0,[a,r]);if(i===`loading`)return(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,q.jsx)(R,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})});if(a&&o){let n=t?`/apps/${t}/docs`:`/docs`;return(0,q.jsx)(p,{to:`${n}/${e}/${o}`,replace:!0})}return(0,q.jsx)(U,{breadcrumb:a?a.label??e:e,children:(0,q.jsx)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:a?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(pe,{className:`h-10 w-10 text-muted-foreground`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:a.label??e}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This book has no documents yet.`})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(we,{className:`h-10 w-10 text-muted-foreground`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Book not found`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No book named `,(0,q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:e}),` is installed.`]})]})})})}var hr=t({default:()=>gr});function gr(){let{slug:e,appName:t}=c(),{books:n,docs:r,state:i}=G();if(i===`loading`)return(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,q.jsx)(R,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})});if(e&&n.some(t=>W(t)===e))return(0,q.jsx)(mr,{});let a=t?`/apps/${t}/docs`:`/docs`,o=e?Et(e,n,r):null;return o&&e?(0,q.jsx)(p,{to:`${a}/${W(o)}/${e}`,replace:!0}):(0,q.jsx)(U,{breadcrumb:e,children:(0,q.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,q.jsx)(we,{className:`h-10 w-10 text-muted-foreground`}),(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Documentation not found`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No book or document named `,(0,q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:e}),` is installed.`]})]})})}var _r=t({default:()=>vr});function vr(){let e=Tt();return(0,q.jsx)(Dt.Provider,{value:e,children:(0,q.jsx)(a,{})})}function yr(e){let t=e.split(`:`)[0].toLowerCase();return/^cloud\./.test(t)}function br(e){let t=e.split(`:`)[0].toLowerCase();return t===`localhost`||t===`127.0.0.1`||t===`[::1]`||t.endsWith(`.local`)}function xr(){return typeof window>`u`?null:window.location.host||null}function Sr(){let e=V(),t=gt();return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 select-none`,children:[(0,q.jsx)(`span`,{className:`inline-flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-indigo-500 to-indigo-600 text-white shadow-sm shadow-indigo-500/30 overflow-hidden`,children:t?(0,q.jsx)(`img`,{src:t,alt:e,className:`h-full w-full object-contain`}):(0,q.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,q.jsx)(`path`,{d:`M12 2 2 7l10 5 10-5-10-5Z`}),(0,q.jsx)(`path`,{d:`m2 17 10 5 10-5`}),(0,q.jsx)(`path`,{d:`m2 12 10 5 10-5`})]})}),(0,q.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-foreground`,children:e})]})}function Q({children:e,formWidth:t=`sm`}){let{t:n}=O(),r=t===`md`?`max-w-md`:`max-w-sm`,i=xr(),a=!!i&&!yr(i)&&!br(i);return(0,K.useEffect)(()=>{if(typeof document>`u`||!i)return;let e=document.title;return a&&(document.title=i),()=>{document.title=e}},[i,a]),(0,q.jsxs)(`div`,{className:`relative flex min-h-svh w-full items-center justify-center overflow-hidden bg-background p-6`,children:[(0,q.jsxs)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 -z-10`,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 opacity-[0.35] dark:opacity-[0.25] [mask-image:radial-gradient(ellipse_at_center,black,transparent_72%)] [-webkit-mask-image:radial-gradient(ellipse_at_center,black,transparent_72%)]`,style:{backgroundImage:`radial-gradient(hsl(var(--border)) 1px, transparent 1px)`,backgroundSize:`22px 22px`}}),(0,q.jsx)(`div`,{className:`absolute left-1/2 top-1/2 h-[34rem] w-[34rem] -translate-x-1/2 -translate-y-1/2 rounded-full bg-gradient-to-br from-indigo-500/10 to-indigo-600/10 blur-3xl dark:from-indigo-500/10 dark:to-indigo-600/10`})]}),(0,q.jsxs)(`div`,{className:Ee(`flex w-full flex-col gap-5`,r),children:[(0,q.jsx)(Sr,{}),a?(0,q.jsx)(`div`,{className:`flex justify-center`,children:(0,q.jsx)(`span`,{className:`rounded-full border border-border/60 bg-background/60 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-foreground`,title:n(`auth.shell.tenantHostHint`,{defaultValue:`You are signing in to this workspace`}),children:i})}):null,e]})]})}function Cr(e){let t=`/api/v1/auth/oauth2/authorize${e}`,n=()=>window.location.assign(t);fetch(t,{credentials:`include`,redirect:`manual`,headers:{accept:`application/json`}}).then(async e=>{let t=await e.json().catch(()=>null),r=t?.url??t?.redirect_uri??t?.redirectURI;if(e.ok&&r){window.location.href=r;return}n()}).catch(n)}function wr(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}var Tr=`os.console.devAdminHintDismissed`;function Er(e){return(0,q.jsx)(r,{to:e.href,className:e.className,children:e.children})}function Dr(){let{t:e}=O(),[t]=s(),n=t.get(`redirect`),{user:r,isLoading:i,organizations:a,isOrganizationsLoading:o,activeOrganization:c,switchOrganization:l,getAuthConfig:u}=w(),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(null),[h,g]=(0,K.useState)(()=>{try{return window.localStorage.getItem(Tr)===`1`}catch{return!1}}),_=()=>{g(!0);try{window.localStorage.setItem(Tr,`1`)}catch{}},[v,b]=(0,K.useState)(!1),x=(0,K.useRef)(!1),[S,C]=(0,K.useState)(!1);(0,K.useLayoutEffect)(()=>{i||C(!0)},[i]);let T=(0,K.useMemo)(()=>{if(typeof window>`u`)return null;let e=new URLSearchParams(window.location.search),t=e.get(`redirect_uri`);if(!e.has(`client_id`)||!t)return null;try{return new URL(t).host}catch{return null}},[]),E=(0,K.useMemo)(()=>{let e=t.get(`error`);return e?{code:e,description:t.get(`error_description`)}:null},[]);if((0,K.useEffect)(()=>{let e=!1;return u().then(t=>{if(e)return;f(t?.emailPassword?.disableSignUp===!0);let n=t?.devSeedAdmin;m(n&&typeof n.email==`string`?{email:n.email,password:typeof n.password==`string`?n.password:void 0}:null)}).catch(()=>{}),()=>{e=!0}},[u]),(0,K.useEffect)(()=>{if(r){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){x.current||(x.current=!0,Cr(window.location.search));return}}if(!c){if(o||v)return;if(a.length===1){b(!0),l(a[0].id).catch(()=>void 0).finally(()=>b(!1));return}if(a.length===0){window.location.assign(X(wr(n)?n:`/`));return}window.location.assign(X(`/organizations`));return}v||window.location.assign(X(wr(n)?n:`/`))}},[r,c,a,o,v,n,l]),i&&!S||r)return(0,q.jsx)(Q,{children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,q.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,q.jsx)(`span`,{children:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})})]})});let D=n?`/register?redirect=${encodeURIComponent(n)}`:`/register`;return(0,q.jsx)(Q,{formWidth:`md`,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[E?(0,q.jsx)(y,{message:e(`auth.login.errors.oauthCallbackFailed`,{defaultValue:`Single sign-on could not be completed — the sign-in link expired or was already used. Please try again.`})+(E.description?` (${E.description})`:` (${E.code})`)}):null,T?(0,q.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-md border border-primary/30 bg-primary/5 px-4 py-3 text-sm text-foreground`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 inline-block size-2 shrink-0 rounded-full bg-primary`}),(0,q.jsx)(`span`,{children:e(`auth.login.ssoHandoff`,{target:T,defaultValue:`Continue to ${T}`})})]}):null,p&&!h?(0,q.jsxs)(`div`,{role:`status`,"data-testid":`dev-admin-hint`,className:`flex items-start gap-3 rounded-md border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm text-foreground`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 inline-block size-2 shrink-0 rounded-full bg-amber-500`}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`div`,{className:`font-medium`,children:e(`auth.login.devAdminHint.title`,{defaultValue:`Development instance`})}),(0,q.jsxs)(`div`,{className:`text-muted-foreground`,children:[e(`auth.login.devAdminHint.body`,{defaultValue:`Sign in with the seeded dev admin:`}),` `,(0,q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`,children:p.email}),p.password?(0,q.jsxs)(q.Fragment,{children:[` / `,(0,q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`,children:p.password})]}):null]})]}),(0,q.jsx)(`button`,{type:`button`,onClick:_,"aria-label":e(`auth.login.devAdminHint.dismiss`,{defaultValue:`Dismiss`}),className:`shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,q.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`size-3.5 fill-current`,children:(0,q.jsx)(`path`,{d:`M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 0 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 1 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z`})})})]}):null,(0,q.jsx)(A,{className:`border-border/60 px-4 py-8 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:(0,q.jsx)(Or,{registerUrl:d?void 0:D,redirect:n})})]})})}function Or({registerUrl:e,redirect:t}){let{t:n}=O(),r=d(),i=(0,K.useRef)(``);return(0,K.useEffect)(()=>{let e=e=>{let t=e.target;t?.id===`login-email`&&(i.current=t.value)};return document.addEventListener(`input`,e,!0),()=>document.removeEventListener(`input`,e,!0)},[]),(0,q.jsx)(x,{onError:e=>{let n=e.message||``,a=e.code,o=n.toLowerCase();if(a===`EMAIL_NOT_VERIFIED`||o.includes(`email`)&&(o.includes(`verif`)||o.includes(`not verified`))){let e=new URLSearchParams;i.current&&e.set(`email`,i.current),t&&e.set(`redirect`,t),r(`/verify-email-prompt?${e.toString()}`)}},title:n(`auth.login.title`,{defaultValue:`Sign in to your account`}),description:n(`auth.login.description`,{defaultValue:`Enter your email and password to continue`}),registerUrl:e,forgotPasswordUrl:`/forgot-password`,linkComponent:Er,errorMessages:{INVALID_EMAIL_OR_PASSWORD:n(`auth.login.errors.invalidCredentials`,{defaultValue:`Invalid email or password. Please try again.`}),EMAIL_NOT_VERIFIED:n(`auth.login.errors.emailNotVerified`,{defaultValue:`Please verify your email address before signing in.`})},labels:{emailLabel:n(`auth.login.emailLabel`,{defaultValue:`Email`}),emailPlaceholder:n(`auth.login.emailPlaceholder`,{defaultValue:`name@example.com`}),emailOrPhoneLabel:n(`auth.login.emailOrPhoneLabel`,{defaultValue:`Email or phone number`}),emailOrPhonePlaceholder:n(`auth.login.emailOrPhonePlaceholder`,{defaultValue:`name@example.com or +1 555 000 0000`}),passwordLabel:n(`auth.login.passwordLabel`,{defaultValue:`Password`}),passwordPlaceholder:n(`auth.login.passwordPlaceholder`,{defaultValue:`Enter your password`}),forgotPasswordText:n(`auth.login.forgotPasswordText`,{defaultValue:`Forgot password?`}),submitButton:n(`auth.login.submitButton`,{defaultValue:`Sign In`}),submittingButton:n(`auth.login.submittingButton`,{defaultValue:`Signing in…`}),noAccountText:n(`auth.login.noAccountText`,{defaultValue:`Don't have an account?`}),signUpText:n(`auth.login.signUpText`,{defaultValue:`Sign up`}),phoneLabel:n(`auth.login.phoneLabel`,{defaultValue:`Phone number`}),phonePlaceholder:n(`auth.login.phonePlaceholder`,{defaultValue:`+1 555 000 0000`}),otpCodeLabel:n(`auth.login.otpCodeLabel`,{defaultValue:`Verification code`}),otpCodePlaceholder:n(`auth.login.otpCodePlaceholder`,{defaultValue:`6-digit code`}),sendOtpButton:n(`auth.login.sendOtpButton`,{defaultValue:`Get code`}),resendOtpCountdownText:n(`auth.login.resendOtpCountdownText`,{defaultValue:`Resend in {seconds}s`}),usePhoneOtpText:n(`auth.login.usePhoneOtpText`,{defaultValue:`Sign in with verification code`}),usePasswordSignInText:n(`auth.login.usePasswordSignInText`,{defaultValue:`Sign in with password instead`})}})}function kr(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function Ar(e){return(0,q.jsx)(r,{to:e.href,className:e.className,children:e.children})}function jr(){let{t:e}=O(),t=d(),[n]=s(),r=n.get(`redirect`),{user:i,isLoading:a,organizations:o,isOrganizationsLoading:c,activeOrganization:l,switchOrganization:u,getAuthConfig:f}=w(),[p,m]=(0,K.useState)(null),[h,g]=(0,K.useState)(!1),_=(0,K.useRef)(!1),[v,y]=(0,K.useState)(!1);if((0,K.useLayoutEffect)(()=>{a||y(!0)},[a]),(0,K.useEffect)(()=>{let e=!1;return f().then(n=>{if(e)return;let i=n?.emailPassword?.disableSignUp===!0;if(m(i),i){let e=r?`?redirect=${encodeURIComponent(r)}`:``;t(`/login${e}`,{replace:!0})}}).catch(()=>{e||m(!1)}),()=>{e=!0}},[f,t,r]),(0,K.useEffect)(()=>{if(i){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){_.current||(_.current=!0,Cr(window.location.search));return}}if(!l){if(c||h)return;if(o.length===1){g(!0),u(o[0].id).catch(()=>void 0).finally(()=>g(!1));return}if(o.length===0){window.location.assign(X(kr(r)?r:`/`));return}window.location.assign(X(`/organizations`));return}h||window.location.assign(X(kr(r)?r:`/`))}},[i,l,o,c,h,r,u]),p===null||a&&!v||i)return(0,q.jsx)(Q,{children:(0,q.jsx)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:(0,q.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`})})});let b=r?`/login?redirect=${encodeURIComponent(r)}`:`/login`;return(0,q.jsx)(Q,{formWidth:`md`,children:(0,q.jsx)(A,{className:`border-border/60 px-4 py-8 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:(0,q.jsx)(S,{title:e(`auth.register.title`,{defaultValue:`Create an account`}),description:e(`auth.register.description`,{defaultValue:`Create your account to start building.`}),loginUrl:b,linkComponent:Ar,errorMessages:{USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:e(`auth.register.errors.userExists`,{defaultValue:`An account with this email already exists. Try signing in instead.`}),USER_ALREADY_EXISTS:e(`auth.register.errors.userExists`,{defaultValue:`An account with this email already exists. Try signing in instead.`})},onVerificationRequired:e=>{let n=new URLSearchParams;n.set(`email`,e),r&&n.set(`redirect`,r),t(`/verify-email-prompt?${n.toString()}`,{replace:!0})},labels:{nameLabel:e(`auth.register.nameLabel`,{defaultValue:`Name`}),namePlaceholder:e(`auth.register.namePlaceholder`,{defaultValue:`John Doe`}),emailLabel:e(`auth.register.emailLabel`,{defaultValue:`Email`}),emailPlaceholder:e(`auth.register.emailPlaceholder`,{defaultValue:`name@example.com`}),passwordLabel:e(`auth.register.passwordLabel`,{defaultValue:`Password`}),passwordPlaceholder:e(`auth.register.passwordPlaceholder`,{defaultValue:`Create a password (min. 8 characters)`}),confirmPasswordLabel:e(`auth.register.confirmPasswordLabel`,{defaultValue:`Confirm Password`}),confirmPasswordPlaceholder:e(`auth.register.confirmPasswordPlaceholder`,{defaultValue:`Confirm your password`}),passwordMismatchError:e(`auth.register.passwordMismatchError`,{defaultValue:`Passwords do not match`}),passwordTooShortError:e(`auth.register.passwordTooShortError`,{defaultValue:`Password must be at least 8 characters`}),submitButton:e(`auth.register.submitButton`,{defaultValue:`Create Account`}),submittingButton:e(`auth.register.submittingButton`,{defaultValue:`Creating account…`}),hasAccountText:e(`auth.register.hasAccountText`,{defaultValue:`Already have an account?`}),signInText:e(`auth.register.signInText`,{defaultValue:`Sign in`})}})})})}function Mr(e){return(0,q.jsx)(r,{to:e.href,className:e.className,children:e.children})}function Nr(){let{t:e}=O();return(0,q.jsx)(Q,{formWidth:`md`,children:(0,q.jsx)(A,{className:`border-border/60 px-4 py-8 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:(0,q.jsx)(_,{loginUrl:`/login`,linkComponent:Mr,title:e(`auth.forgotPassword.title`,{defaultValue:`Reset your password`}),description:e(`auth.forgotPassword.description`,{defaultValue:`Enter your email address and we'll send you a link to reset your password`}),labels:{emailLabel:e(`auth.forgotPassword.emailLabel`,{defaultValue:`Email`}),emailPlaceholder:e(`auth.forgotPassword.emailPlaceholder`,{defaultValue:`name@example.com`}),submitButton:e(`auth.forgotPassword.submitButton`,{defaultValue:`Send Reset Link`}),submittingButton:e(`auth.forgotPassword.submittingButton`,{defaultValue:`Sending…`}),successTitle:e(`auth.forgotPassword.successTitle`,{defaultValue:`Check your email`}),successDescription:e(`auth.forgotPassword.successDescription`,{defaultValue:`We've sent a password reset link to {email}. Please check your inbox.`}),backToSignInText:e(`auth.forgotPassword.backToSignInText`,{defaultValue:`Back to sign in`}),phoneLabel:e(`auth.forgotPassword.phoneLabel`,{defaultValue:`Phone number`}),phonePlaceholder:e(`auth.forgotPassword.phonePlaceholder`,{defaultValue:`+1 555 000 0000`}),otpCodeLabel:e(`auth.forgotPassword.otpCodeLabel`,{defaultValue:`Verification code`}),otpCodePlaceholder:e(`auth.forgotPassword.otpCodePlaceholder`,{defaultValue:`6-digit code`}),sendOtpButton:e(`auth.forgotPassword.sendOtpButton`,{defaultValue:`Get code`}),resendOtpCountdownText:e(`auth.forgotPassword.resendOtpCountdownText`,{defaultValue:`Resend in {seconds}s`}),newPasswordLabel:e(`auth.forgotPassword.newPasswordLabel`,{defaultValue:`New password`}),newPasswordPlaceholder:e(`auth.forgotPassword.newPasswordPlaceholder`,{defaultValue:`Enter a new password`}),resetButton:e(`auth.forgotPassword.resetButton`,{defaultValue:`Reset Password`}),usePhoneResetText:e(`auth.forgotPassword.usePhoneResetText`,{defaultValue:`Reset via SMS code`}),useEmailResetText:e(`auth.forgotPassword.useEmailResetText`,{defaultValue:`Reset via email instead`}),phoneSuccessTitle:e(`auth.forgotPassword.phoneSuccessTitle`,{defaultValue:`Password reset`}),phoneSuccessDescription:e(`auth.forgotPassword.phoneSuccessDescription`,{defaultValue:`Your password has been reset. You can now sign in with your new password.`}),rememberPasswordText:e(`auth.forgotPassword.rememberPasswordText`,{defaultValue:`Remember your password?`}),signInText:e(`auth.forgotPassword.signInText`,{defaultValue:`Sign in`})}})})})}function Pr(){let{t:e}=O(),t=d(),[n]=s(),i=n.get(`token`),{resetPassword:a}=w(),[o,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(``),[f,p]=(0,K.useState)(!1);return(0,q.jsx)(Q,{children:(0,q.jsxs)(A,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(P,{className:`text-xl tracking-tight`,children:e(`auth.resetPassword.title`,{defaultValue:`Set a new password`})}),(0,q.jsx)(M,{children:e(`auth.resetPassword.description`,{defaultValue:`Choose a password you have not used before.`})})]}),(0,q.jsx)(L,{children:i?(0,q.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),o!==l){z.error(e(`auth.resetPassword.passwordsMismatch`,{defaultValue:`Passwords do not match`}));return}if(!i){z.error(e(`auth.resetPassword.missingToken`,{defaultValue:`Reset link is missing or expired`}));return}p(!0);try{await a(i,o),z.success(e(`auth.resetPassword.success`,{defaultValue:`Password updated`})),t(`/login`)}catch(t){z.error(e(`auth.resetPassword.failed`,{defaultValue:`Reset failed`}),{description:t.message})}finally{p(!1)}},className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(j,{htmlFor:`new-password`,children:e(`auth.resetPassword.newPassword`,{defaultValue:`New password`})}),(0,q.jsx)(I,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:o,onChange:e=>c(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(j,{htmlFor:`confirm-password`,children:e(`auth.resetPassword.confirmPassword`,{defaultValue:`Confirm password`})}),(0,q.jsx)(I,{id:`confirm-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:l,onChange:e=>u(e.target.value)})]}),(0,q.jsx)(F,{type:`submit`,className:`w-full`,disabled:f,children:f?e(`auth.resetPassword.submitting`,{defaultValue:`Updating…`}):e(`auth.resetPassword.submit`,{defaultValue:`Update password`})})]}):(0,q.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.resetPassword.invalidToken`,{defaultValue:`This reset link is invalid or has expired.`}),` `,(0,q.jsx)(r,{to:`/forgot-password`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.resetPassword.requestNewLink`,{defaultValue:`Request a new link`})})]})})]})})}function Fr(e){return e&&e.startsWith(`/`)&&!e.startsWith(`//`)?e:`/`}function Ir(){let{t:e}=O(),t=d(),[n]=s(),i=Fr(n.get(`next`)),{user:a,isLoading:o,setInitialPassword:c}=w(),[l,u]=(0,K.useState)(``),[f,p]=(0,K.useState)(``),[m,h]=(0,K.useState)(!1);return(0,q.jsx)(Q,{children:(0,q.jsxs)(A,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(P,{className:`text-xl tracking-tight`,children:e(`auth.setPassword.title`)}),(0,q.jsx)(M,{children:e(`auth.setPassword.description`)})]}),(0,q.jsx)(L,{children:!o&&!a?(0,q.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.setPassword.noSession`),` `,(0,q.jsx)(r,{to:`/login`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.setPassword.backToSignIn`)})]}):(0,q.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),l!==f){z.error(e(`auth.setPassword.passwordsMismatch`));return}h(!0);try{await c(l),z.success(e(`auth.setPassword.success`)),t(i)}catch(t){z.error(e(`auth.setPassword.failed`),{description:t.message})}finally{h(!1)}},className:`flex flex-col gap-4`,children:[a?.email?(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(j,{htmlFor:`set-password-email`,children:e(`auth.setPassword.email`)}),(0,q.jsx)(I,{id:`set-password-email`,type:`email`,autoComplete:`username`,value:a.email,disabled:!0,className:`bg-muted text-muted-foreground`})]}):null,(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(j,{htmlFor:`new-password`,children:e(`auth.setPassword.newPassword`)}),(0,q.jsx)(I,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:l,onChange:e=>u(e.target.value)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(j,{htmlFor:`confirm-password`,children:e(`auth.setPassword.confirmPassword`)}),(0,q.jsx)(I,{id:`confirm-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:f,onChange:e=>p(e.target.value)})]}),(0,q.jsx)(F,{type:`submit`,className:`w-full`,disabled:m,children:e(m?`auth.setPassword.submitting`:`auth.setPassword.submit`)})]})})]})})}var Lr=`/api/v1/auth`;function Rr(){let{t:e}=O(),[t]=s(),n=t.get(`token`),[i,a]=(0,K.useState)(`loading`),[o,c]=(0,K.useState)(``);return(0,K.useEffect)(()=>{if(!n){a(`error`),c(e(`auth.verifyEmail.missingToken`,{defaultValue:`Verification link is missing a token.`}));return}let t=!1;return(async()=>{try{let e=await fetch(`${Lr}/verify-email`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({token:n})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t?.message||`Verification failed: ${e.status}`)}t||a(`success`)}catch(n){t||(a(`error`),c(n.message||e(`auth.verifyEmail.errorDescription`,{defaultValue:`Verification failed. Please request a new link.`})))}})(),()=>{t=!0}},[n,e]),(0,q.jsx)(Q,{children:(0,q.jsxs)(A,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[i===`loading`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(P,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.verifyingTitle`,{defaultValue:`Verifying…`})}),(0,q.jsx)(M,{children:e(`auth.verifyEmail.verifyingDescription`,{defaultValue:`Hang tight while we confirm your email.`})})]}),(0,q.jsx)(L,{className:`flex justify-center py-6`,children:(0,q.jsx)(`div`,{className:`h-10 w-10 animate-spin rounded-full border-4 border-muted border-t-primary`})})]}),i===`success`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-500 ring-1 ring-emerald-500/30`,children:(0,q.jsx)(Oe,{className:`size-6`})}),(0,q.jsx)(P,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.successTitle`,{defaultValue:`Email verified`})}),(0,q.jsx)(M,{children:e(`auth.verifyEmail.successDescription`,{defaultValue:`Your email is confirmed. You can now sign in.`})})]}),(0,q.jsx)(L,{className:`text-center`,children:(0,q.jsx)(r,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.signInLink`,{defaultValue:`Go to sign in`})})})]}),i===`error`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-destructive/10 text-destructive ring-1 ring-destructive/30`,children:(0,q.jsx)(xe,{className:`size-6`})}),(0,q.jsx)(P,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.errorTitle`,{defaultValue:`Verification failed`})}),(0,q.jsx)(M,{children:o||e(`auth.verifyEmail.errorDescription`,{defaultValue:`Verification failed. Please request a new link.`})})]}),(0,q.jsx)(L,{className:`text-center`,children:(0,q.jsx)(r,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.backToSignIn`,{defaultValue:`Back to sign in`})})})]})]})})}function zr(){let{t:e}=O(),t=d(),[n]=s(),r=n.get(`email`)??``,i=n.get(`redirect`)??``,{sendVerificationEmail:a}=w(),[o,c]=(0,K.useState)(!1),[l,u]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null);return(0,q.jsx)(Q,{children:(0,q.jsxs)(A,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(`div`,{className:`mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10`,children:(0,q.jsx)(Ne,{className:`size-8 text-primary`})}),(0,q.jsx)(P,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.title`,{defaultValue:`Verify your email address`})}),(0,q.jsx)(M,{children:e(`auth.verifyEmail.description`,{defaultValue:`We sent a verification link to your email address. Please click the link to verify your account.`})})]}),(0,q.jsx)(L,{children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[r?(0,q.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.verifyEmail.sentTo`,{defaultValue:`Sent to:`}),` `,(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:r})]}):null,f?(0,q.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,q.jsx)(`p`,{className:`font-medium`,children:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Cannot resend verification email`})}),(0,q.jsx)(`p`,{className:`mt-1 text-destructive/90`,children:f})]}):null,(0,q.jsx)(F,{onClick:async()=>{if(!r){z.error(e(`auth.verifyEmail.resendFailed`,{defaultValue:`Cannot resend verification email`}),{description:e(`auth.verifyEmail.emailMissing`,{defaultValue:`Email address is missing`})});return}c(!0),p(null);try{await a(r,i||`/`),u(!0),z.success(e(`auth.verifyEmail.resentSuccess`,{defaultValue:`Verification email sent!`}),{description:e(`auth.verifyEmail.resentDescription`,{defaultValue:`Please check your inbox and click the verification link.`})})}catch(t){let n=t?.message?.trim()||e(`auth.verifyEmail.resendUnavailable`,{defaultValue:`Email delivery may not be configured for this environment. Contact support if this persists.`});u(!1),p(n),z.error(e(`auth.verifyEmail.resendFailed`,{defaultValue:`Cannot resend verification email`}),{description:n})}finally{c(!1)}},disabled:o||l,className:`w-full`,variant:l?`outline`:`default`,children:o?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Pe,{className:`mr-2 size-4 animate-spin`}),e(`auth.verifyEmail.resending`,{defaultValue:`Sending…`})]}):l?e(`auth.verifyEmail.resent`,{defaultValue:`Email sent! Check your inbox`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Pe,{className:`mr-2 size-4`}),e(`auth.verifyEmail.resendButton`,{defaultValue:`Resend verification email`})]})}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,q.jsx)(`span`,{className:`w-full border-t`})}),(0,q.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,q.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:e(`auth.verifyEmail.or`,{defaultValue:`Or`})})})]}),(0,q.jsx)(F,{onClick:()=>{let e=i?`?redirect=${encodeURIComponent(i)}`:``;t(`/login${e}`)},variant:`ghost`,className:`w-full`,children:e(`auth.verifyEmail.backToLogin`,{defaultValue:`Back to login`})}),(0,q.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:e(`auth.verifyEmail.checkSpam`,{defaultValue:`Didn't receive the email? Check your spam folder or contact support.`})})]})})]})})}var Br=`/api/v1/auth`;function Vr(){let{t:e}=O(),t=d(),{user:n,isLoading:r}=w(),[i,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(null),c=typeof window<`u`?window.location.search:``,l=c.startsWith(`?`)?c.slice(1):c,u=new URLSearchParams(l),f=u.get(`client_id`)??void 0,p=u.get(`scope`)??``;(0,K.useEffect)(()=>{if(!r&&!n){let e=window.location.pathname+window.location.search;t(`/login?redirect=${encodeURIComponent(e)}`,{replace:!0})}},[n,r,t]),(0,K.useEffect)(()=>{if(!f)return;let e=!1;return fetch(`${Br}/oauth2/applications/${encodeURIComponent(f)}/public`,{credentials:`include`}).then(async t=>{if(!t.ok)return;let n=await t.json().catch(()=>({}));if(e)return;let r=n?.data??n;s(r)}).catch(()=>{}),()=>{e=!0}},[f]);let m=p.split(/\s+/).filter(Boolean),h=async t=>{a(!0);try{let n=await fetch(`${Br}/oauth2/consent`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({accept:t,oauth_query:l})}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r?.message||`Consent failed: ${n.status}`);let i=r.redirect_uri??r.redirectURI??r.url;if(i){window.location.href=i;return}let a=t?e(`oauth.consent.granted`,{defaultValue:`Access granted`}):e(`oauth.consent.denied`,{defaultValue:`Access denied`});z(a,{description:e(`oauth.consent.noRedirect`,{defaultValue:`No redirect URL returned by the server.`})})}catch(t){z.error(e(`oauth.consent.failed`,{defaultValue:`Consent failed`}),{description:t.message})}finally{a(!1)}},g=o?.name??o?.client_name??f??e(`oauth.consent.unknownApp`,{defaultValue:`an application`});return(0,q.jsx)(`div`,{className:`flex min-h-svh w-full flex-1 items-center justify-center bg-background px-4`,children:(0,q.jsxs)(A,{className:`w-full max-w-md`,children:[(0,q.jsxs)(N,{className:`items-center text-center`,children:[(0,q.jsx)(`div`,{className:`mb-3 rounded-full border bg-muted p-3`,children:o?.icon||o?.logo_uri?(0,q.jsx)(`img`,{src:o.icon||o.logo_uri,alt:``,className:`h-8 w-8 rounded`,onError:e=>{e.currentTarget.style.display=`none`}}):(0,q.jsx)(ve,{className:`h-7 w-7 text-muted-foreground`})}),(0,q.jsx)(P,{className:`text-xl`,children:e(`oauth.consent.title`,{appName:g,defaultValue:`${g} wants to access your account`})}),(0,q.jsx)(M,{children:e(`oauth.consent.request`,{appName:g,suffix:n?.email?` (${n.email})`:``,defaultValue:`${g} is requesting permission${n?.email?` for ${n.email}`:``}.`})})]}),(0,q.jsxs)(L,{className:`space-y-4`,children:[m.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:e(`oauth.consent.willAllow`,{defaultValue:`This app will be able to:`})}),(0,q.jsx)(`ul`,{className:`space-y-1.5 rounded-md border bg-muted/40 p-3 text-sm`,children:m.map(t=>(0,q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(Fe,{className:`mt-0.5 h-4 w-4 text-green-600 dark:text-green-400`}),(0,q.jsx)(`span`,{children:Hr(t,e)})]},t))})]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-2`,children:[(0,q.jsxs)(F,{variant:`outline`,onClick:()=>h(!1),disabled:i,children:[(0,q.jsx)(Ce,{className:`mr-2 h-4 w-4`}),e(`oauth.consent.deny`,{defaultValue:`Deny`})]}),(0,q.jsxs)(F,{onClick:()=>h(!0),disabled:i,children:[(0,q.jsx)(Fe,{className:`mr-2 h-4 w-4`}),i?e(`oauth.consent.submitting`,{defaultValue:`Authorizing…`}):e(`oauth.consent.authorize`,{defaultValue:`Authorize`})]})]}),(0,q.jsx)(`p`,{className:`pt-2 text-center text-xs text-muted-foreground`,children:e(`oauth.consent.footer`,{defaultValue:`You can revoke access at any time from your account settings.`})})]})]})})}function Hr(e,t){switch(e){case`openid`:return t(`oauth.consent.scope.openid`,{defaultValue:`Confirm your identity`});case`profile`:return t(`oauth.consent.scope.profile`,{defaultValue:`Read your basic profile (name, picture)`});case`email`:return t(`oauth.consent.scope.email`,{defaultValue:`Read your email address`});case`offline_access`:return t(`oauth.consent.scope.offlineAccess`,{defaultValue:`Stay signed in (refresh access)`});default:return e}}var Ur=`/api/v1/auth`;function $({children:e}){return(0,q.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,q.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:[(0,q.jsxs)(`a`,{href:`#`,className:`flex items-center gap-2 self-center font-medium`,children:[(0,q.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded-md bg-primary text-primary-foreground overflow-hidden`,children:gt()?(0,q.jsx)(`img`,{src:gt(),alt:V(),className:`h-full w-full object-contain`}):(0,q.jsx)(Oe,{className:`size-4`})}),V()]}),(0,q.jsx)(`div`,{className:`flex flex-col gap-6`,children:e})]})})}function Wr(){let{t:e}=O(),t=o(),[n]=s(),r=n.get(`user_code`)??n.get(`code`)??``,i=n.get(`runtime_name`)??``,a=n.get(`runtime_version`)??``,{user:c,isLoading:l,getAuthConfig:u}=w(),f=d(),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(!1),[b,x]=(0,K.useState)(!1),[S,C]=(0,K.useState)(``),[T,E]=(0,K.useState)(null);if((0,K.useEffect)(()=>{let e=!0;return u().then(t=>{e&&E(t?.features?.deviceAuthorization===!0)}).catch(()=>{e&&E(!0)}),()=>{e=!1}},[u]),!r)return(0,q.jsx)($,{children:(0,q.jsx)(A,{children:(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(P,{children:e(`auth.device.invalidTitle`,{defaultValue:`Invalid device link`})}),(0,q.jsx)(M,{children:e(`auth.device.invalidDescription`,{defaultValue:`No device code was provided in the URL.`})})]})})});if(T===!1)return(0,q.jsx)($,{children:(0,q.jsx)(A,{children:(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(P,{children:e(`auth.device.disabledTitle`,{defaultValue:`Device authorization not enabled`})}),(0,q.jsx)(M,{children:e(`auth.device.disabledDescription`,{defaultValue:`This deployment does not have device authorization enabled, so this device cannot be approved here.`})})]})})});if(l||T===null)return(0,q.jsx)($,{children:(0,q.jsx)(A,{children:(0,q.jsx)(N,{className:`text-center`,children:(0,q.jsx)(M,{children:e(`auth.device.loading`,{defaultValue:`Loading…`})})})})});if(!c)return(0,q.jsx)(p,{to:`/login?redirect=${encodeURIComponent(`/auth/device${t.search}`)}`,replace:!0});if(v)return(0,q.jsx)($,{children:(0,q.jsx)(A,{children:(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(Oe,{className:`mx-auto mb-2 h-10 w-10 text-green-500`}),(0,q.jsx)(P,{children:e(`auth.device.approvedTitle`,{defaultValue:`Device authorized`})}),(0,q.jsx)(M,{children:e(`auth.device.approvedDescription`,{defaultValue:`You can return to the device — it should sign in shortly.`})})]})})});if(b)return(0,q.jsx)($,{children:(0,q.jsx)(A,{children:(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(P,{children:e(`auth.device.deniedTitle`,{defaultValue:`Access denied`})}),(0,q.jsx)(M,{children:e(`auth.device.deniedDescription`,{defaultValue:`The device will not be granted access.`})})]})})});let D=async()=>{await fetch(`${Ur}/device?user_code=${encodeURIComponent(r)}`,{credentials:`include`}).catch(()=>{})};return(0,q.jsx)($,{children:(0,q.jsxs)(A,{children:[(0,q.jsxs)(N,{className:`text-center`,children:[(0,q.jsx)(P,{children:e(`auth.device.title`,{defaultValue:`Authorize new device`})}),(0,q.jsx)(M,{children:e(`auth.device.subtitle`,{email:c.email,defaultValue:`Approve this device to sign in as ${c.email}.`})})]}),(0,q.jsxs)(L,{className:`space-y-4`,children:[i?(0,q.jsxs)(`div`,{className:`rounded-md border bg-background px-4 py-3 text-center`,children:[(0,q.jsx)(`p`,{className:`mb-1 text-xs text-muted-foreground`,children:e(`auth.device.requesterLabel`,{defaultValue:`Connection request from`})}),(0,q.jsx)(`p`,{className:`font-medium`,children:i}),a?(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[V().toLowerCase(),` `,a]}):null]}):null,(0,q.jsxs)(`div`,{className:`rounded-md border bg-background px-4 py-3 text-center`,children:[(0,q.jsx)(`p`,{className:`mb-1 text-xs text-muted-foreground`,children:e(`auth.device.userCodeLabel`,{defaultValue:`Device code`})}),(0,q.jsx)(`p`,{className:`font-mono text-lg font-semibold tracking-widest`,children:r})]}),(0,q.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:e(`auth.device.approveWarning`,{defaultValue:`Only approve if you started this connection yourself a moment ago. Once approved, this runtime can access your organization's private packages.`})}),(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:e(`auth.device.loggedInAs`,{email:c.email,defaultValue:`Signed in as ${c.email}`})}),S&&(0,q.jsx)(`p`,{className:`text-center text-sm text-destructive`,children:S}),(0,q.jsx)(F,{onClick:async()=>{C(``),h(!0);try{await D();let t=await fetch(`${Ur}/device/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:r})});if(!t.ok){let n=await t.json().catch(()=>({}));throw Error(n?.message??n?.error?.message??e(`auth.device.approveFailed`,{defaultValue:`Approval failed`}))}y(!0),z.success(e(`auth.device.approveSuccess`,{defaultValue:`Device authorized`}),{description:e(`auth.device.approveSuccessDescription`,{defaultValue:`You can close this window.`})})}catch(t){C(t?.message??e(`auth.device.approveFailed`,{defaultValue:`Approval failed`}))}finally{h(!1)}},className:`w-full`,disabled:m||g,children:m?e(`auth.device.approving`,{defaultValue:`Approving…`}):e(`auth.device.approve`,{defaultValue:`Approve device`})}),(0,q.jsx)(F,{onClick:async()=>{C(``),_(!0);try{await D(),await fetch(`${Ur}/device/deny`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:r})}),x(!0)}catch(t){C(t?.message??e(`auth.device.denyFailed`,{defaultValue:`Failed to deny request`}))}finally{_(!1)}},variant:`outline`,className:`w-full`,disabled:m||g,children:g?e(`auth.device.denying`,{defaultValue:`Denying…`}):e(`auth.device.deny`,{defaultValue:`Deny request`})}),(0,q.jsx)(`div`,{className:`text-center`,children:(0,q.jsx)(`button`,{type:`button`,className:`text-sm text-muted-foreground underline-offset-4 hover:underline`,onClick:()=>f(`/`),children:e(`auth.device.cancel`,{defaultValue:`Cancel`})})})]})]})]})})}var Gr=`/api/v1/auth`;function Kr(){try{if(typeof document>`u`)return`/`;let e=document.querySelector(`base`)?.getAttribute(`href`);return e&&new URL(e,window.location.origin).pathname.replace(/\/$/,``)||`/`}catch{return`/`}}var qr=Kr();function Jr(){let{user:e}=w();return(0,q.jsx)(Ge,{userId:e?.id,children:(0,q.jsx)(We,{})})}function Yr(){let e=o();return(0,K.useEffect)(()=>{document.title=V();let e=mt();if(e){let t=document.getElementById(`favicon`);t&&(t.href=e,t.type=e.endsWith(`.svg`)?`image/svg+xml`:`image/png`)}},[e]),null}function Xr(){return(0,q.jsxs)(E,{authUrl:Gr,children:[(0,q.jsx)(qe,{position:`bottom-right`}),(0,q.jsx)(tr,{}),(0,q.jsxs)(l,{basename:qr,children:[(0,q.jsx)(Yr,{}),(0,q.jsx)(at,{children:(0,q.jsxs)(m,{children:[(0,q.jsx)(u,{path:`/login`,element:(0,q.jsx)(Dr,{})}),(0,q.jsx)(u,{path:`/register`,element:(0,q.jsx)(jr,{})}),(0,q.jsx)(u,{path:`/forgot-password`,element:(0,q.jsx)(Nr,{})}),(0,q.jsx)(u,{path:`/reset-password`,element:(0,q.jsx)(Pr,{})}),(0,q.jsx)(u,{path:`/set-password`,element:(0,q.jsx)(Ir,{})}),(0,q.jsx)(u,{path:`/verify-email`,element:(0,q.jsx)(Rr,{})}),(0,q.jsx)(u,{path:`/verify-email-prompt`,element:(0,q.jsx)(zr,{})}),(0,q.jsx)(u,{path:`/setup`,element:(0,q.jsx)(On,{})}),(0,q.jsx)(u,{path:`/oauth/consent`,element:(0,q.jsx)(Vr,{})}),(0,q.jsx)(u,{path:`/auth/device`,element:(0,q.jsx)(Wr,{})}),(0,q.jsx)(u,{path:`/accept-invitation/:invitationId`,element:(0,q.jsx)(Je,{})}),(0,q.jsx)(u,{path:`/f/:slug`,element:(0,q.jsx)(Qn,{mode:`public`})}),(0,q.jsx)(u,{path:`/s/:token`,element:(0,q.jsx)(ir,{})}),(0,q.jsx)(u,{path:`/studio`,element:(0,q.jsx)(Y,{children:(0,q.jsxs)(`div`,{className:`flex min-h-screen flex-col bg-background text-foreground`,children:[(0,q.jsx)(`header`,{className:`flex shrink-0 items-center border-b px-3 py-2`,children:(0,q.jsx)(r,{to:`/home`,title:`返回主页`,className:`inline-flex items-center gap-1.5 rounded-md px-1.5 py-0.5 text-[13px] font-semibold hover:bg-muted`,children:V()})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,q.jsx)(Ze,{})})]})})}),(0,q.jsx)(u,{path:`/studio/:packageId`,element:(0,q.jsx)(p,{to:`data`,replace:!0})}),(0,q.jsx)(u,{path:`/studio/:packageId/:tab`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(et,{})})}),(0,q.jsx)(u,{path:`/forms/:name`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(er,{})})}),(0,q.jsxs)(u,{path:`/docs`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(vr,{})}),children:[(0,q.jsx)(u,{index:!0,element:(0,q.jsx)(pr,{})}),(0,q.jsx)(u,{path:`:slug`,element:(0,q.jsx)(gr,{})}),(0,q.jsx)(u,{path:`:slug/:name`,element:(0,q.jsx)(fr,{})})]}),(0,q.jsx)(u,{path:`/home`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(Jr,{})})}),(0,q.jsx)(u,{path:`/dev/master-detail`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(jt,{})})}),(0,q.jsx)(u,{path:`/dev/lists`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(Pt,{})})}),(0,q.jsx)(u,{path:`/dev/modal`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(It,{})})}),(0,q.jsx)(u,{path:`/dev/lookup`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(Lt,{})})}),(0,q.jsx)(u,{path:`/dev/row-actions`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(Ht,{})})}),(0,q.jsx)(u,{path:`/organizations`,element:(0,q.jsx)(Y,{requireOrganization:!1,children:(0,q.jsx)(nt,{children:(0,q.jsx)(Ye,{})})})}),(0,q.jsxs)(u,{path:`/organizations/:slug`,element:(0,q.jsx)(Y,{requireOrganization:!1,children:(0,q.jsx)(Ue,{})}),children:[(0,q.jsx)(u,{index:!0,element:(0,q.jsx)(p,{to:`members`,replace:!0})}),(0,q.jsx)(u,{path:`members`,element:(0,q.jsx)(tt,{})}),(0,q.jsx)(u,{path:`invitations`,element:(0,q.jsx)(Qe,{})}),(0,q.jsx)(u,{path:`settings`,element:(0,q.jsx)(Ve,{})})]}),(0,q.jsx)(u,{path:`/system/*`,element:(0,q.jsx)(Re,{})}),(0,q.jsx)(u,{path:`/ai`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(Ie,{children:(0,q.jsx)(Ke,{})})})}),(0,q.jsx)(u,{path:`/ai/:agent`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(Ie,{children:(0,q.jsx)(Ke,{})})})}),(0,q.jsx)(u,{path:`/ai/:agent/:conversationId`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(Ie,{children:(0,q.jsx)(Ke,{})})})}),(0,q.jsx)(u,{path:`/apps/:appName/*`,element:(0,q.jsx)(Y,{children:(0,q.jsx)(pn,{})})}),(0,q.jsx)(u,{path:`/`,element:(0,q.jsx)(Y,{requireOrganization:!1,children:(0,q.jsx)(vn,{})})}),(0,q.jsx)(u,{path:`*`,element:(0,q.jsx)(p,{to:`/`,replace:!0})})]})})]})]})}async function Zr(e){try{let t=await fetch(`/api/v1/i18n/translations/${e}`);if(!t.ok)return console.warn(`[i18n] Failed to load translations for '${e}': HTTP ${t.status}`),{};let n=await t.json(),r;return r=n?.data?.translations&&typeof n.data.translations==`object`?n.data.translations:n,b(r)?g(r):r}catch(t){return console.warn(`[i18n] Failed to load translations for '${e}':`,t),{}}}async function Qr(){try{let e=await fetch(`/api/v1/i18n/locales`);if(!e.ok)return console.warn(`[i18n] Failed to load the app locale list: HTTP ${e.status}`),[];let t=await e.json(),n=t?.data?.locales??t?.locales??t;if(!Array.isArray(n))return console.warn(`[i18n] Unexpected /i18n/locales payload; ignoring.`),[];let r=[];for(let e of n){let t=typeof e==`string`?e:e?.code;typeof t==`string`&&t.length>0&&!r.includes(t)&&r.push(t)}return r}catch(e){return console.warn(`[i18n] Failed to load the app locale list:`,e),[]}}async function $r(e){try{let t=await fetch(`${e}/api/v1/auth/me/localization`,{credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok)return;let n=await t.json();if(n?.authenticated===!1)return;ee(n?.locale)}catch{}}async function ei(e,t=500){if(de()||oe())return;let n=$r(e);await Promise.race([n,new Promise(e=>setTimeout(e,t))])}var ti=`auth-session-token`,ni=`auth-active-organization-id`;async function ri(e){if(typeof window>`u`)return;let t;try{t=localStorage.getItem(ti)}catch{return}if(t)try{let n=await fetch(`${e}/get-session`,{method:`GET`,credentials:`omit`,headers:{Authorization:`Bearer ${t}`,Accept:`application/json`}});if(n.ok){let e=await n.json().catch(()=>null);if(e?.user??e?.data?.user??null)return}localStorage.removeItem(ti),localStorage.removeItem(ni)}catch{}}k.registerLazy(`object-map`,()=>n(()=>import(`./plugin-map-CQAe4Yh6.js`).then(e=>e.t),__vite__mapDeps([0,2]),import.meta.url),{namespace:`plugin-map`,category:`view`}),k.registerLazy(`map`,()=>n(()=>import(`./plugin-map-CQAe4Yh6.js`).then(e=>e.t),__vite__mapDeps([0,2]),import.meta.url),{namespace:`view`,category:`view`}),k.registerLazy(`object-tree`,()=>n(()=>import(`./plugin-tree-DW0XC55y.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-tree`,category:`view`}),k.registerLazy(`tree`,()=>n(()=>import(`./plugin-tree-DW0XC55y.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`});for(let e of[`dashboard`,`metric`,`metric-card`,`object-metric`,`pivot`,`object-pivot`,`dashboard-grid`,`object-data-table`])k.registerLazy(e,()=>n(()=>import(`./plugin-dashboard-C8Ohdrxi.js`).then(e=>e.t),__vite__mapDeps([0,1]),import.meta.url),{namespace:`plugin-dashboard`,category:`view`});k.registerLazy(`chart`,()=>n(()=>import(`./plugin-charts-Cq0LpABN.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-charts`,category:`chart`});for(let e of[`object-chart`,`bar-chart`,`pie-chart`,`donut-chart`,`radar-chart`,`scatter-chart`,`line-chart`,`area-chart`,`advanced-chart`,`chart:bar`])k.registerLazy(e,()=>n(()=>import(`./plugin-charts-Cq0LpABN.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-charts`,category:`chart`});k.registerLazy(`object-gantt`,()=>n(()=>import(`./plugin-gantt-ChkG9_UG.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-gantt`,category:`view`}),k.registerLazy(`gantt`,()=>n(()=>import(`./plugin-gantt-ChkG9_UG.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`}),k.registerLazy(`markdown`,()=>n(()=>import(`./plugin-markdown-7fyNN0UM.js`).then(e=>e.n),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-markdown`,category:`display`}),k.registerLazy(`object-timeline`,()=>n(()=>import(`./plugin-timeline-Dw4Lj2Rz.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-timeline`,category:`view`}),k.registerLazy(`timeline`,()=>n(()=>import(`./plugin-timeline-Dw4Lj2Rz.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`}),k.registerLazy(`object-calendar`,()=>n(()=>import(`./plugin-calendar-ClpbcK3u.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-calendar`,category:`view`}),k.registerLazy(`calendar`,()=>n(()=>import(`./plugin-calendar-ClpbcK3u.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`}),k.registerLazy(`calendar-view`,()=>n(()=>import(`./plugin-calendar-ClpbcK3u.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-calendar`,category:`view`}),k.registerLazy(`object-kanban`,()=>n(()=>import(`./plugin-kanban-BsTsRjoP.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-kanban`,category:`view`}),k.registerLazy(`kanban`,()=>n(()=>import(`./plugin-kanban-BsTsRjoP.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`view`,category:`view`});for(let e of[`kanban-ui`,`kanban-enhanced`])k.registerLazy(e,()=>n(()=>import(`./plugin-kanban-BsTsRjoP.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-kanban`,category:`view`});k.registerLazy(`report`,()=>n(()=>import(`./plugin-report-01bEGHuR.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-report`,category:`view`});for(let e of[`report-viewer`,`spec-report`])k.registerLazy(e,()=>n(()=>import(`./plugin-report-01bEGHuR.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),{namespace:`plugin-report`,category:`view`});var ii=(0,K.lazy)(()=>n(()=>import(`./ApiConsolePage-CSQNdOPN.js`).then(e=>({default:e.ApiConsolePage})),__vite__mapDeps([0,1]),import.meta.url)),ai=(0,K.lazy)(()=>n(()=>import(`./FlowRunsPage-CUhBLwm-.js`).then(e=>({default:e.FlowRunsPage})),__vite__mapDeps([0,1]),import.meta.url)),oi=(0,K.lazy)(()=>n(()=>import(`./PublicFormsPage-a_MNzdQw.js`).then(e=>({default:e.PublicFormsPage})),__vite__mapDeps([0,1]),import.meta.url));function si({label:e}){return(0,q.jsxs)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:[`Loading `,e,`…`]})}H({ref:`developer:api-console`,label:`API Console`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(si,{label:`API console`}),children:(0,q.jsx)(ii,{...e})})}),H({ref:`developer:flow-runs`,label:`Flow Runs`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(si,{label:`flow runs`}),children:(0,q.jsx)(ai,{...e})})}),H({ref:`developer:public-forms`,label:`Public Forms`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(si,{label:`public forms`}),children:(0,q.jsx)(oi,{...e})})});var ci=(0,K.lazy)(()=>n(()=>import(`./src-Ctj_ivDh.js`).then(e=>e.t).then(e=>({default:e.BuilderLanding})),__vite__mapDeps([0,1]),import.meta.url));H({ref:`studio:builder`,label:`应用构建`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:`加载应用构建器…`}),children:(0,q.jsx)(ci,{...e})})});var li=(0,K.lazy)(()=>n(()=>import(`./ProfilePage-ClU0WVRr.js`).then(e=>({default:e.ProfilePage})),__vite__mapDeps([0]),import.meta.url));function ui(){let{t:e}=O();return(0,q.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:e(`common.loading`,{defaultValue:`Loading…`})})}H({ref:`account:profile_card`,label:`My Profile`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(ui,{}),children:(0,q.jsx)(li,{...e})})});var di=(0,K.lazy)(()=>n(()=>import(`./ApprovalsInboxPage-Bft5QF0I.js`).then(e=>({default:e.ApprovalsInboxPage})),__vite__mapDeps([0,1]),import.meta.url));function fi(){let{t:e}=O();return(0,q.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:e(`common.loading`,{defaultValue:`Loading…`})})}H({ref:`approvals:inbox`,label:`Approvals Inbox`,source:`@object-ui/console`,component:e=>(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(fi,{}),children:(0,q.jsx)(di,{...e})})});var pi=`/api/v1/auth`;Xe(),Te();var mi=``.replace(/\/+$/,``);Promise.all([ft(mi),ri(pi),ei(mi)]).finally(()=>{document.title=V();let e=mt();if(e){let t=document.getElementById(`favicon`);t&&(t.href=e,t.type=e.endsWith(`.svg`)?`image/svg+xml`:`image/png`)}let t=_t({enabled:!0,name:V(),shortName:ht(),description:pt(),themeColor:dt(),backgroundColor:`#ffffff`,display:`standalone`,startUrl:`./`,scope:`./`,orientation:`any`,icons:[{src:e||`./favicon.svg`,sizes:`any`,type:`image/svg+xml`,purpose:`any`}]}),n=new Blob([JSON.stringify(t)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.querySelector(`link[rel="manifest"]`);i&&i.remove();let a=document.createElement(`link`);a.rel=`manifest`,a.href=r,document.head.appendChild(a),kt.createRoot(document.getElementById(`root`)).render((0,q.jsx)(K.StrictMode,{children:(0,q.jsx)(yt,{pwa:{enabled:!0,name:V(),shortName:ht()},children:(0,q.jsx)(te,{loadLanguage:Zr,loadLocales:Qr,children:(0,q.jsx)(Xr,{})})})}))});export{An as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-KEIR6QF5-ydf36Hye.js";import{n as e}from"./chunk-BIQX33UG-DMScvo0C.js";export{e as createInfoServices};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{Dn as r,En as i,On as a,Tn as o,wn as s}from"./vendor-objectstack-DGpW4oR-.js";import{Gn as c,Jn as l,Kn as u,Yn as d,qn as f}from"./framework-LCCQTTcs.js";var p=e(t(),1),m=new Set,h={emit(e){for(let t of Array.from(m))try{t(e)}catch{}},subscribe(e){return m.add(e),()=>{m.delete(e)}}};function g(e,t){if(e!==403||!t||typeof t!=`object`)return null;let n=t.error;if(!n||typeof n!=`object`)return null;let r=n.code;if(r===`MFA_REQUIRED`||r===`PASSWORD_EXPIRED`){let e=n.message;return{code:r,message:typeof e==`string`?e:``}}return null}var _=(0,p.createContext)(null);_.displayName=`AuthContext`;var v=`1.6.28`,y=Symbol.for(`better-auth:broadcast-channel`),b=()=>Math.floor(Date.now()/1e3),x=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>`u`))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:b()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);t?.event!==`session`||!t?.data||this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function S(e=`better-auth.message`){return globalThis[y]||(globalThis[y]=new x(e)),globalThis[y]}var C=[],w=0,T=null,E=4,ee=globalThis.nanostoresGlobal||={epoch:0},D=()=>{let e;for(w=0;w<C.length;w+=E)try{C[w](C[w+1].value,C[w+2],C[w+3])}catch(t){e=t}if(C.length=0,e)throw e},O=e=>{let t=[],n={eq:Object.is,get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=w+E;t<C.length;)C[t]===e?C.splice(t,E):t+=E;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){ee.epoch++;let i=!C.length&&!0;for(let i of t)T?.has(i)||(T?.add(i),C.push(i,n,e,r));i&&D()},off(){},set(e){let t=n.value;n.eq(t,e)||(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},k=2,A=5,j=6,M=10,N=(e,t,n,r)=>(e.events=e.events||{},e.events[n+M]||(e.events[n+M]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+M](),delete e.events[n+M])}),P=(e,t)=>N(e,t,k,t=>{let n=e.set,r=e.setKey;return e.setKey&&=(n,i)=>{let a;if(t({abort:()=>{a=!0},changed:n,newValue:{...e.value,[n]:i}}),!a)return r(n,i)},e.set=e=>{let r;if(t({abort:()=>{r=!0},newValue:e}),!r)return n(e)},()=>{e.set=n,e.setKey=r}}),te=1e3,ne=(e,t)=>N(e,n=>{let r=t(n);r&&e.events[j].push(r)},A,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[j]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[j])t();e.events[j]=[]}},te)},()=>{e.listen=n,e.off=r}});function F(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function I(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!I(e[n],t[n]))return!1;return!0}if(F(e)&&F(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!(r in t)||!I(e[r],t[r]))return!1;return!0}return!1}function re(e,t){return P(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}var L=Symbol.for(`better-auth:focus-manager`),ie=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function ae(){return globalThis[L]||(globalThis[L]=new ie),globalThis[L]}var R=Symbol.for(`better-auth:online-manager`),oe=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function z(){return globalThis[R]||(globalThis[R]=new oe),globalThis[R]}var se={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},ce=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,le={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},ue=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function de(e){return e instanceof Date&&!isNaN(e.getTime())}function B(e){let t=ue.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return de(f)?f:null}function V(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in le)return le[s];if(!ce.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(se).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=B(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function fe(e,t={strict:!0}){return V(e,t)}var pe=()=>typeof window>`u`;function me(e,t){return I(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}var he=(e,t,n,r)=>{let i=O({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>a(e)});re(i,me);let a=async e=>new Promise(a=>{let o=typeof r==`function`?r({data:i.get().data,error:i.get().error,isPending:i.get().isPending}):r;n(t,{...o,query:{...o?.query,...e?.query},async onSuccess(e){let t=i.get(),n=t.data!=null&&e.data!=null&&I(t.data,e.data)?t.data:e.data;i.set({data:n,error:null,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onSuccess?.(e)},async onError(e){let{request:t}=e,n=typeof t.retry==`number`?t.retry:t.retry?.attempts,r=t.retryAttempt||0;if(n&&r<n)return;let a=e.error.status===401;i.set({error:e.error,data:a?null:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onError?.(e)},async onRequest(e){let t=i.get();i.set({isPending:t.data===null,data:t.data,error:null,isRefetching:!0,refetch:i.value.refetch}),await o?.onRequest?.(e)}}).catch(e=>{i.set({error:e,data:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}).finally(()=>{a(void 0)})});e=Array.isArray(e)?e:[e];let o=!1,s=!1,c=!1,l=()=>{if(o){c=!0;return}o=!0,a().finally(()=>{o=!1;let e=c&&s;c=!1,e&&l()})};return ne(i,()=>{if(pe())return;s=!0;let t=!1,n,r=e.map(e=>e.listen(()=>{t?a():(t=!0,clearTimeout(n),l())}));return n=setTimeout(()=>{t=!0,l()},0),()=>{s=!1;for(let e of r)e();clearTimeout(n)}}),i},ge=()=>Math.floor(Date.now()/1e3),_e=5;function ve(e){let{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},l=()=>s||z().isOnline,u=e=>{if(l()){if(e?.event===`storage`){t();return}if(e?.event===`poll`){c.lastSessionRequest=ge(),t();return}if(e?.event===`visibilitychange`){if(ge()-c.lastSessionRequest<_e)return;c.lastSessionRequest=ge(),t();return}t()}},d=e=>{S().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{n()&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=S().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=ae().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=z().subscribe(e=>{e&&u({event:`visibilitychange`})})},g=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,f(),p(),m(),h(),g(),c.cleanupBroadcastSetup=S().setup(),c.cleanupFocusSetup=ae().setup(),c.cleanupOnlineSetup=z().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.unsubscribeSignal&&=(c.unsubscribeSignal(),void 0),c.cleanupBroadcastSetup&&=(c.cleanupBroadcastSetup(),void 0),c.cleanupFocusSetup&&=(c.cleanupFocusSetup(),void 0),c.cleanupOnlineSetup&&=(c.cleanupOnlineSetup(),void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:d}}var ye=Object.create(null),be=e=>({}),H=new Proxy(ye,{get(e,t){return be()[t]??ye[t]},has(e,t){return t in be()||t in ye},set(e,t,n){let r=be(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=be(!0);return delete n[t],!0},ownKeys(){let e=be(!0);return Object.keys(e)}});H.NODE_ENV;function U(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return U(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return U(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return U(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return U(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return U(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return U(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return U(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});function xe(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}function Se(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function Ce(e){let t=e.split(`
|
|
2
|
-
at `);return t.length<=1?e:(t.splice(1,1),t.join(`
|
|
3
|
-
at `))}function we(e,t){class n extends e{#e;constructor(...e){if(Se()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=Ce(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),n}var Te={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};we(class extends Error{status;body;headers;statusCode;constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:Te[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,this.body=t}},Error);var W=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}},Ee=47;function De(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===Ee;)t--;return t===e.length?e:e.slice(0,t)}function Oe(e){try{return(De(new URL(e).pathname)||`/`)!==`/`}catch{throw new W(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function ke(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new W(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof W?t:new W(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function Ae(e,t=`/api/auth`){if(ke(e),Oe(e))return e;let n=De(e);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function je(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function Me(e,t,n,r,i){if(e)return Ae(e,t);if(r!==!1){let e=H.BETTER_AUTH_URL||H.NEXT_PUBLIC_BETTER_AUTH_URL||H.PUBLIC_BETTER_AUTH_URL||H.NUXT_PUBLIC_BETTER_AUTH_URL||H.NUXT_PUBLIC_AUTH_URL||(H.BASE_URL===`/`?void 0:H.BASE_URL);if(e)return Ae(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&je(o,`proto`)&&je(a,`host`))try{return Ae(`${o}://${a}`,t)}catch{}if(n){let e=Ne(n.url);if(!e)throw new W(`Could not get origin from request. Please provide a valid base URL.`);return Ae(e,t)}if(typeof window<`u`&&window.location)return Ae(window.location.origin,t)}function Ne(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var Pe=[`javascript:`,`data:`,`vbscript:`];function Fe(e){let t;try{t=new URL(e)}catch{return!0}return!Pe.includes(t.protocol)}var Ie={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&Fe(e.data.url)&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},Le=()=>typeof window>`u`,Re=te;function ze(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}function Be(e){return!e||e.session===null&&e.user===null?null:e}function Ve(e,t){return I(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function He(e,t){let n=O(!1),r,i=0,a=0;n.listen(()=>{a++,i=0});let o=e=>u(e),s=O({data:null,error:null,isPending:!0,isRefetching:!1,refetch:o});re(s,Ve);let c=async(t,n)=>{let r=s.value;if(s.set({...r,isPending:r.data===null,isRefetching:!0,error:null,refetch:o}),t.aborted)return`aborted`;try{let r=await e(`/get-session`,{method:`GET`,query:n?.query,signal:t});if(t.aborted)return`aborted`;let{data:i,error:a}=ze(r),c=`fresh`;if(i?.needsRefresh)try{let n=await e(`/get-session`,{method:`POST`,signal:t});if(t.aborted)return`aborted`;({data:i,error:a}=ze(n))}catch{if(t.aborted)return`aborted`;c=`stale`}if(a){let e=s.value,t=a?.status===401;return s.set({data:t?null:e.data,error:a,isPending:!1,isRefetching:!1,refetch:o}),`failed`}let l=Be(i),u=s.value,d=u.data!=null&&l!=null&&I(u.data,l)?u.data:l;return s.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:o}),c}catch(e){if(t.aborted)return`aborted`;let n=s.value;return s.set({data:n.data,error:e,isPending:!1,isRefetching:!1,refetch:o}),`failed`}},l=()=>{let e=s.value.data?.session?.expiresAt,t=e instanceof Date?e.getTime():1/0;return Math.min(Date.now()+Re,t)},u=e=>{i=0,r?.cancel();let t=new AbortController,n={cancel:()=>t.abort(),promise:Promise.resolve().then(()=>t.signal.aborted?`aborted`:c(t.signal,e)),revision:a};r=n;let o=e=>{r===n&&(r=void 0,e===`fresh`&&n.revision===a&&(i=l()))};return n.promise.then(o,()=>o(`failed`)),n.promise.then(()=>void 0)},d=()=>r?.revision===a?r.promise.then(()=>void 0):Date.now()<i?Promise.resolve():u(),f=()=>{};return ne(s,()=>{let e;Le()||(e=setTimeout(()=>{d()},0));let r=ve({fetchSession:u,shouldPollSession:()=>s.value.data!=null,sessionSignal:n,options:t});return r.init(),f=r.broadcastSessionUpdate,()=>{e&&clearTimeout(e),r.cleanup()}}),{session:s,$sessionSignal:n,broadcastSessionUpdate:e=>f(e)}}function Ue(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function We(e,t,n=`.`,r){if(!Ue(t))return We(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(i[t]=Array.isArray(a)&&Array.isArray(i[t])?[...a,...i[t]]:Ue(a)&&Ue(i[t])?We(a,i[t],(n?`${n}.`:``)+t.toString(),r):a))}return i}function Ge(e){return(...t)=>t.reduce((t,n)=>We(t,n,``,e),{})}var Ke=Ge(),qe=Object.defineProperty,Je=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,Xe=Object.getOwnPropertySymbols,Ze=Object.prototype.hasOwnProperty,Qe=Object.prototype.propertyIsEnumerable,$e=(e,t,n)=>t in e?qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G=(e,t)=>{for(var n in t||={})Ze.call(t,n)&&$e(e,n,t[n]);if(Xe)for(var n of Xe(t))Qe.call(t,n)&&$e(e,n,t[n]);return e},K=(e,t)=>Je(e,Ye(t)),et=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},tt=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},nt=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},rt=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function it(e){if(typeof e==`number`)return new nt({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new nt(e);case`exponential`:return new rt(e);default:throw Error(`Invalid retry strategy`)}}var at=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},ot=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function st(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return ot.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function ct(e){try{return JSON.parse(e),!0}catch{return!1}}function lt(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function ut(e){try{return JSON.parse(e)}catch{return e}}function dt(e){return typeof e==`function`}function ft(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&dt(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&dt(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}function pt(...e){let t={};for(let n of e)if(n){if(n instanceof Headers)n.forEach((e,n)=>{t[n]=e});else{let e=Array.isArray(n)?n:Object.entries(n);for(let[n,r]of e)r!=null&&(t[n]=r)}}return t}async function mt(e){let t=new Headers(pt(e?.headers,await at(e)));if(!t.has(`content-type`)){let n=ht(e?.body);n&&t.set(`content-type`,n)}return t}function ht(e){return lt(e)?`application/json`:null}function gt(e){let t=e.get(`content-type`);return t?t.split(`;`)[0].trim().toLowerCase():null}function _t(e,t){let{body:n}=e;return n?!lt(n)||typeof n==`string`?n:gt(t)===`application/x-www-form-urlencoded`?new URLSearchParams(n).toString():JSON.stringify(n):null}function vt(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return St.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function yt(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var bt=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function xt(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new bt(n.issues);return n.value}var St=[`get`,`post`,`put`,`patch`,`delete`],Ct=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``)),e.startsWith(`/`)&&e.charAt(1)===`@`&&(e=e.substring(1));let i=r.schema[e];if(i){let e=n?.headers;if(i.headers&&!n?.disableValidation){let t={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((e,n)=>{t[n.toLowerCase()]=e});else if(typeof n.headers==`object`)for(let[e,r]of Object.entries(n.headers))r!=null&&(t[e.toLowerCase()]=r)}let r=await xt(i.headers,t),a={};for(let[e,t]of Object.entries(r))a[e.toLowerCase()]=t;e=a}let r=K(G({},n),{method:i.method,output:i.output,headers:e});return n?.disableValidation||(r=K(G({},r),{body:i.input?await xt(i.input,n?.body):n?.body,params:i.params?await xt(i.params,n?.params):n?.params,query:i.query?await xt(i.query,n?.query):n?.query})),{url:t,options:r}}}return{url:t,options:n}}}),wt=e=>{async function t(t,n){let r=K(G(G({},e),n),{headers:pt(e?.headers,n?.headers),plugins:[...e?.plugins||[],Ct(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await Ot(t,r)}catch(e){return{data:null,error:{status:500,statusText:`Fetch Error`,message:`Fetch related error. Captured by catchAllError option. See error property for more details.`,error:e}}}return await Ot(t,r)}return t},Tt=e=>e===`.`||e===`..`;function Et(e,t){let n=e;for(let[e,r]of t)n=n.replace(e,r);if(Tt(n))throw TypeError(`Path parameters cannot be reserved path segments`);return encodeURIComponent(n)}function Dt(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];St.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}let l=new Map;if(r){if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];l.set(n,String(e))}}else for(let[e,t]of Object.entries(r))l.set(`:${e}`,String(t))}o=o.split(`/`).map(e=>Et(e,l)).join(`/`),o=o.replace(/^\/+/,``);let u=c.toString();return u=u.length>0?`?${u}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${u}`,a):`${a}${o}${u}`}var Ot=async(e,t)=>{let{hooks:n,url:r,options:i}=await tt(e,t),a=ft(i),o=new AbortController,s=i.signal??o.signal,c=Dt(r,i),l=await mt(i),u=_t(i,l),d=vt(r,i),f=K(G({},i),{url:c,headers:l,body:u,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&Object.assign(f,t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=yt(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e(K(G({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=st(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??ut)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await xt(f.output,r.data));for(let e of n.onSuccess)e&&await e(K(G({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??ut,_=await m.text(),v=ct(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:K(G({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(K(G({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=it(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await Ot(e,K(G({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new et(m.status,m.statusText,v?y:_);return{data:null,error:K(G({},y),{status:m.status,statusText:m.statusText})}},kt=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},At=(e,t)=>{let n=`credentials`in Request.prototype,r=Me(e?.baseURL,e?.basePath,void 0,t)??kt(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=wt({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?fe(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Ie],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=He(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p},v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/revoke-other-sessions`||e===`/change-email`||e===`/change-password`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=Ke(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function jt(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function Mt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Nt=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,Pt=/['\u2019]/g;function Ft(e){return e.replace(Pt,``).match(Nt)??[]}function It(e){return Ft(e).map(e=>e.toLowerCase()).join(`-`)}function Lt(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function Rt(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||jt(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(It).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=Lt(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function zt(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,atomListeners:a,$store:o}=At(e),s={};for(let[e,t]of Object.entries(r))s[`use${Mt(e)}`]=t;return Rt({...n,...s,$fetch:i,$store:o},i,t,r,a)}function Bt(e){return{success:!1,error:`You are not allowed to access resource: ${e}`}}function Vt(e){return{success:!1,error:`unauthorized to access resource "${e}"`}}function Ht(e){return e===`OR`?`OR`:`AND`}function Ut(e){return Array.isArray(e)}function Wt(e){if(Ut(e))return{actions:e,connector:`AND`};if(!e||typeof e!=`object`)throw new W(`Invalid access control request`);let{actions:t,connector:n}=e;return Ut(t)?{actions:t,connector:Ht(n)}:{actions:[],connector:Ht(n)}}function Gt(e,t){return typeof t==`string`&&e.includes(t)}function Kt(e,{actions:t,connector:n}){return t.length===0?!1:n===`OR`?t.some(t=>Gt(e,t)):t.every(t=>Gt(e,t))}function qt(e){return{authorize(t,n=`AND`){let r=!1;for(let[i,a]of Object.entries(t)){let t=e[i];if(!t){if(n===`AND`)return Bt(i);continue}let o=Kt(t,Wt(a));if(o&&(r=!0),o&&n===`OR`)return{success:!0};if(!o&&n===`AND`)return Vt(i)}return r?{success:!0}:{success:!1,error:`Not authorized`}},statements:e}}function Jt(e){return{newRole(e){return qt(e)},statements:e}}var Yt=xe({YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION:`You are not allowed to create a new organization`,YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS:`You have reached the maximum number of organizations`,ORGANIZATION_ALREADY_EXISTS:`Organization already exists`,ORGANIZATION_SLUG_ALREADY_TAKEN:`Organization slug already taken`,ORGANIZATION_NOT_FOUND:`Organization not found`,USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION:`User is not a member of the organization`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION:`You are not allowed to update this organization`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION:`You are not allowed to delete this organization`,NO_ACTIVE_ORGANIZATION:`No active organization`,USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION:`User is already a member of this organization`,MEMBER_NOT_FOUND:`Member not found`,ROLE_NOT_FOUND:`Role not found`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM:`You are not allowed to create a new team`,TEAM_ALREADY_EXISTS:`Team already exists`,TEAM_NOT_FOUND:`Team not found`,YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER:`You cannot leave the organization as the only owner`,YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER:`You cannot leave the organization without an owner`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER:`You are not allowed to delete this member`,YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION:`You are not allowed to invite users to this organization`,USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION:`User is already invited to this organization`,INVITATION_NOT_FOUND:`Invitation not found`,YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION:`You are not the recipient of the invitation`,EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION:`Email verification required before accepting or rejecting invitation`,EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION:`Email verification required to view or list invitations for the session email`,YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION:`You are not allowed to cancel this invitation`,INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION:`Inviter is no longer a member of the organization`,YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE:`You are not allowed to invite a user with this role`,FAILED_TO_RETRIEVE_INVITATION:`Failed to retrieve invitation`,YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS:`You have reached the maximum number of teams`,UNABLE_TO_REMOVE_LAST_TEAM:`Unable to remove last team`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER:`You are not allowed to update this member`,ORGANIZATION_MEMBERSHIP_LIMIT_REACHED:`Organization membership limit reached`,YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION:`You are not allowed to create teams in this organization`,YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION:`You are not allowed to delete teams in this organization`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM:`You are not allowed to update this team`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM:`You are not allowed to delete this team`,INVITATION_LIMIT_REACHED:`Invitation limit reached`,TEAM_MEMBER_LIMIT_REACHED:`Team member limit reached`,USER_IS_NOT_A_MEMBER_OF_THE_TEAM:`User is not a member of the team`,YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM:`You are not allowed to list the members of this team`,YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM:`You do not have an active team`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER:`You are not allowed to create a new member`,YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER:`You are not allowed to remove a team member`,YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION:`You are not allowed to access this organization as an owner`,YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION:`You are not a member of this organization`,MISSING_AC_INSTANCE:`Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information`,YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE:`You must be in an organization to create a role`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE:`You are not allowed to create a role`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE:`You are not allowed to update a role`,YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE:`You are not allowed to delete a role`,YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE:`You are not allowed to read a role`,YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE:`You are not allowed to list a role`,YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE:`You are not allowed to get a role`,TOO_MANY_ROLES:`This organization has too many roles`,INVALID_RESOURCE:`The provided permission includes an invalid resource`,ROLE_NAME_IS_ALREADY_TAKEN:`That role name is already taken`,CANNOT_DELETE_A_PRE_DEFINED_ROLE:`Cannot delete a pre-defined role`,ROLE_IS_ASSIGNED_TO_MEMBERS:`Cannot delete a role that is assigned to members. Please reassign the members to a different role first`,INVALID_TEAM_ID:`Team id contains a reserved character`}),Xt=Jt({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),Zt=Xt.newRole({organization:[`update`],invitation:[`create`,`cancel`],member:[`create`,`update`,`delete`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),Qt=Xt.newRole({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),$t=Xt.newRole({organization:[],member:[],invitation:[],team:[],ac:[`read`]}),en={admin:Zt,owner:Qt,member:$t},tn=(e,t)=>{if(!e.permissions)return!1;let n=e.role.split(`,`),r=e.options.creatorRole||`owner`,i=n.includes(r),a=e.allowCreatorAllPermissions||!1;if(i&&a)return!0;for(let r of n)if(t[r]?.authorize(e.permissions)?.success)return!0;return!1},nn=e=>tn(e,e.options.roles||en),rn=e=>{let t=O(!1),n=O(!1),r=O(!1),i=O(!1),a={admin:Zt,member:$t,owner:Qt,...e?.roles};return{id:`organization`,version:v,$InferServerPlugin:{},getActions:(t,n,r)=>({$Infer:{ActiveOrganization:{},Organization:{},Invitation:{},Member:{},Team:{}},organization:{checkRolePermission:t=>nn({role:t.role,options:{ac:e?.ac,roles:a},permissions:t.permissions})}}),getAtoms:e=>{let a=he(t,`/organization/list`,e,{method:`GET`});return{$listOrg:t,$activeOrgSignal:n,$activeMemberSignal:r,$activeMemberRoleSignal:i,activeOrganization:he([n],`/organization/get-full-organization`,e,()=>({method:`GET`})),listOrganizations:a,activeMember:he([n,r],`/organization/get-active-member`,e,{method:`GET`}),activeMemberRole:he([n,i],`/organization/get-active-member-role`,e,{method:`GET`})}},pathMethods:{"/organization/get-full-organization":`GET`,"/organization/list-user-teams":`GET`},atomListeners:[{matcher(e){return e===`/organization/create`||e===`/organization/delete`||e===`/organization/update`},signal:`$listOrg`},{matcher(e){return e===`/sign-out`||e.startsWith(`/organization`)},signal:`$activeOrgSignal`},{matcher(e){return e.startsWith(`/organization/set-active`)||e===`/organization/create`||e===`/organization/delete`||e===`/organization/remove-member`||e===`/organization/leave`||e===`/organization/accept-invitation`},signal:`$sessionSignal`},{matcher(e){return e.includes(`/organization/update-member-role`)||e.startsWith(`/organization/set-active`)},signal:`$activeMemberSignal`},{matcher(e){return e.includes(`/organization/update-member-role`)||e.startsWith(`/organization/set-active`)},signal:`$activeMemberRoleSignal`}],$ERROR_CODES:Yt}},an=xe({OTP_NOT_ENABLED:`OTP not enabled`,OTP_HAS_EXPIRED:`OTP has expired`,TOTP_NOT_ENABLED:`TOTP not enabled`,TWO_FACTOR_NOT_ENABLED:`Two factor isn't enabled`,BACKUP_CODES_NOT_ENABLED:`Backup codes aren't enabled`,INVALID_BACKUP_CODE:`Invalid backup code`,INVALID_CODE:`Invalid code`,TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:`Too many attempts. Please request a new code.`,ACCOUNT_TEMPORARILY_LOCKED:`Too many failed verification attempts. Your account is temporarily locked. Please try again later.`,INVALID_TWO_FACTOR_COOKIE:`Invalid two factor cookie`}),on=e=>({id:`two-factor`,version:v,$InferServerPlugin:{},atomListeners:[{matcher:e=>e.startsWith(`/two-factor/`),signal:`$sessionSignal`}],pathMethods:{"/two-factor/disable":`POST`,"/two-factor/enable":`POST`,"/two-factor/send-otp":`POST`,"/two-factor/generate-backup-codes":`POST`,"/two-factor/get-totp-uri":`POST`,"/two-factor/verify-totp":`POST`,"/two-factor/verify-otp":`POST`,"/two-factor/verify-backup-code":`POST`},fetchPlugins:[{id:`two-factor`,name:`two-factor`,hooks:{async onSuccess(t){if(t.data?.twoFactorRedirect){if(e?.onTwoFactorRedirect){await e.onTwoFactorRedirect({twoFactorMethods:t.data.twoFactorMethods});return}e?.twoFactorPage&&typeof window<`u`&&Fe(e.twoFactorPage)&&(window.location.href=e.twoFactorPage)}}}}],$ERROR_CODES:an}),sn=Object.values({pending:`pending`,accepted:`accepted`,rejected:`rejected`,canceled:`canceled`}),cn=new Set(sn);function ln(e){return typeof e==`string`&&cn.has(e)}var un=`auth-session-token`,q={_memoryToken:null,_rotationListeners:new Set,get(){try{if(typeof localStorage<`u`)return localStorage.getItem(un)}catch{}return this._memoryToken},set(e){let t=this.get();this._memoryToken=e;try{typeof localStorage<`u`&&localStorage.setItem(un,e)}catch{}if(t&&t!==e)for(let e of[...this._rotationListeners])try{e()}catch{}},clear(){this._memoryToken=null;try{typeof localStorage<`u`&&localStorage.removeItem(un)}catch{}},subscribeRotation(e){return this._rotationListeners.add(e),()=>{this._rotationListeners.delete(e)}}};function J(e,t){let n=Error(e.message??t??`Auth request failed with status ${e.status}`);return e.code&&(n.code=e.code),n}function dn(e,t){let n=e?.status;if(!ln(n))throw Error(`${t}: unexpected invitation status ${JSON.stringify(n)} — expected one of ${sn.join(` | `)}`);return e}function fn(e,t){return(Array.isArray(e)?e:[]).map(e=>dn(e,t))}function pn(e){try{let t=new URL(e);return{origin:t.origin,basePath:t.pathname.replace(/\/$/,``)}}catch{return{origin:mn()??`http://localhost`,basePath:e.replace(/\/$/,``)}}}function mn(){try{if(typeof window<`u`&&window.location?.origin)return window.location.origin}catch{}}function hn(){try{if(typeof document<`u`){let e=document.querySelector(`base`)?.getAttribute(`href`);if(e)return`${new URL(e,mn()??`http://localhost`).pathname.replace(/\/$/,``)}/reset-password`}}catch{}return`/reset-password`}function gn(e){let t=e||globalThis.fetch.bind(globalThis);return async(e,n)=>{let r=new Headers(n?.headers),i=q.get();if(i){let t=typeof e==`string`?e:e instanceof URL?e.href:e.url;/\/api\//i.test(t)&&r.set(`Authorization`,`Bearer ${i}`)}let a=await t(e,{...n,headers:r}),o=a.headers.get(`set-auth-token`);return o&&q.set(o),a}}function _n(e){let{baseURL:t,fetchFn:n}=e,{origin:r,basePath:i}=pn(t),a=gn(n),o=zt({baseURL:r,basePath:i,disableDefaultFetchPlugins:!0,fetchOptions:{customFetchImpl:a},plugins:[rn(),on()]});async function s(e,t){let n=await a(`${r}${i}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify(t)}),o=await n.json().catch(()=>({}));if(!n.ok){let e=Error(o?.message??`Auth request failed with status ${n.status}`);throw o?.code&&(e.code=o.code),e.status=n.status,e}return o??{}}async function c(e){let t=typeof AbortController<`u`?new AbortController:void 0,n=t?setTimeout(()=>t.abort(),e):void 0;try{let e=`${r}${i}/config`,n=await a(e,{method:`GET`,headers:{"Content-Type":`application/json`},...t?{signal:t.signal}:{}});if(!n.ok)throw Error(`Failed to load auth config (status ${n.status})`);let o=await n.json();return o&&typeof o==`object`&&`data`in o&&o.data?o.data:o}finally{n!==void 0&&clearTimeout(n)}}let l=[500,1500,3500],u=null;async function d(){let e;for(let t=0;t<=l.length;t++)try{return await c(8e3)}catch(n){e=n,t<l.length&&await new Promise(e=>setTimeout(e,l[t]))}throw e instanceof Error?e:Error(String(e))}return{async signIn(e){let{data:t,error:n}=await o.signIn.email({email:e.email,password:e.password});if(n)throw J(n);let r=t;return r.session?.token&&q.set(r.session.token),{user:r.user,session:r.session}},async signUp(e){let{data:t,error:n}=await o.signUp.email({email:e.email,password:e.password,name:e.name});if(n)throw J(n);let r=t,i=r.token??r.session?.token??null;i&&q.set(i);let a=r.session??null;return!a&&i&&(a={token:i}),{user:r.user,session:a,requiresVerification:i===null}},async sendVerificationEmail(e,t){let{error:n}=await o.sendVerificationEmail({email:e,callbackURL:t});if(n)throw Error(n.message??`Auth request failed with status ${n.status}`)},async signOut(){let{error:e}=await o.signOut();if(q.clear(),e)throw Error(e.message??`Auth request failed with status ${e.status}`)},async getSession(){let e=null;try{let t=await o.getSession();t.error||(e=t.data)}catch{}if(e){let t=e;return t.session?.token&&q.set(t.session.token),{user:t.user,session:t.session}}if(q.get())try{let e=await(n||globalThis.fetch.bind(globalThis))(`${r}${i}/get-session`,{method:`GET`,credentials:`include`,headers:{"Content-Type":`application/json`}});if(e.ok){let t=await e.json().catch(()=>null);if(t?.user&&t?.session)return t.session.token?q.set(t.session.token):q.clear(),{user:t.user,session:t.session};q.clear()}}catch{}return null},async forgotPassword(e){let t=o,n=t.requestPasswordReset??t.forgetPassword;if(typeof n!=`function`)throw Error(`password reset is not available on this auth backend`);let{error:r}=await n({email:e,redirectTo:hn()});if(r)throw Error(r.message??`Auth request failed with status ${r.status}`)},async resetPassword(e,t){let{error:n}=await o.resetPassword({token:e,newPassword:t});if(n)throw Error(n.message??`Auth request failed with status ${n.status}`)},async sendPhoneOtp(e){await s(`/phone-number/send-otp`,{phoneNumber:e})},async signInWithPhoneOtp(e,t){let n=await s(`/phone-number/verify`,{phoneNumber:e,code:t}),r=typeof n.token==`string`?n.token:void 0,i=n.user??null;if(!r||!i)throw Error(`No account is registered for this phone number.`);return q.set(r),{user:i,session:{token:r}}},async signInWithPhonePassword(e,t){let n=await s(`/sign-in/phone-number`,{phoneNumber:e,password:t}),r=typeof n.token==`string`?n.token:void 0,i=n.user??null;if(!r||!i)throw Error(`Invalid phone number or password.`);return q.set(r),{user:i,session:{token:r}}},async requestPhonePasswordReset(e){await s(`/phone-number/request-password-reset`,{phoneNumber:e})},async resetPasswordWithPhoneOtp(e,t,n){await s(`/phone-number/reset-password`,{phoneNumber:e,otp:t,newPassword:n})},async changePassword(e,t,n){let r=o.changePassword;if(typeof r!=`function`)throw Error(`change-password is not available on this auth backend`);let{error:i}=await r({currentPassword:e,newPassword:t,...n?.revokeOtherSessions==null?{}:{revokeOtherSessions:n.revokeOtherSessions}});if(i)throw Error(i.message??`Auth request failed with status ${i.status}`)},async enrollTotp(e){let t=o.twoFactor;if(!t||typeof t.enable!=`function`)throw Error(`two-factor enrollment is not available on this auth backend`);let{data:n,error:r}=await t.enable({password:e});if(r)throw Error(r.message??`Two-factor enable failed (${r.status??`?`})`);return{totpURI:n?.totpURI??``,backupCodes:n?.backupCodes??[]}},async verifyTotp(e){let t=o.twoFactor;if(!t||typeof t.verifyTotp!=`function`)throw Error(`two-factor verification is not available on this auth backend`);let{error:n}=await t.verifyTotp({code:e});if(n)throw Error(n.message??`Two-factor verification failed (${n.status??`?`})`)},async setInitialPassword(e){let t=`${r}${i}/set-initial-password`,n=await a(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({newPassword:e})});if(!n.ok){let e=`Set password failed with status ${n.status}`;try{let t=await n.json();t?.error?.message&&(e=t.error.message)}catch{}throw Error(e)}},async hasLocalPassword(){let e=`${r}${i}/list-accounts`;try{let t=await a(e,{method:`GET`,headers:{"Content-Type":`application/json`}});if(!t.ok)return!1;let n=await t.json();return(Array.isArray(n)?n:n&&`data`in n&&Array.isArray(n.data)?n.data:[]).some(e=>e?.providerId===`credential`)}catch{return!1}},async updateUser(e){let{data:t,error:n}=await o.updateUser(e);if(n)throw Error(n.message??`Auth request failed with status ${n.status}`);if(!t)throw Error(`Update user returned no data`);let r=t;return r&&typeof r==`object`&&`user`in r?r.user:r},async describeDelegableScope(){try{let e=i.replace(/\/auth$/,`/security`),t=await a(`${r}${e}/my-delegable-scope`,{method:`GET`,headers:{"Content-Type":`application/json`}});if(!t.ok)return null;let n=await t.json(),o=n&&typeof n==`object`&&`data`in n?n.data:n;return o&&typeof o==`object`&&Array.isArray(o.placeableBusinessUnitIds)?o:null}catch{return null}},async getConfig(){return u||=d().catch(e=>{throw u=null,e}),u},async signInWithProvider(e,t={}){let{type:n=`social`,callbackURL:r,errorCallbackURL:i}=t,a=e=>new Promise((t,n)=>{let r=setTimeout(()=>n(Error(`Sign-in timed out — the server did not respond. Please try again.`)),2e4);e.then(e=>{clearTimeout(r),t(e)},e=>{clearTimeout(r),n(e)})}),s=async()=>await a(o.signIn.social({provider:e,callbackURL:r,errorCallbackURL:i})),c;if(n===`oidc`){if(c=await s(),c.error){let t=o.signIn.oauth2,n=t?await a(t({providerId:e,callbackURL:r,errorCallbackURL:i})).catch(()=>null):null;n&&!n.error&&(c=n)}}else c=await s();let{data:l,error:u}=c;if(u)throw Error(u.message??`Auth request failed with status ${u.status}`);if(!l?.url)throw Error(`Sign-in with "${e}" did not return a redirect URL — please try again or contact your administrator.`);typeof window<`u`&&(window.location.href=l.url)},async listOrganizations(){let{data:e,error:t}=await o.organization.list();if(t)throw J(t,`Failed to list organizations`);return e??[]},async createOrganization(e){let{data:t,error:n}=await o.organization.create({name:e.name,slug:e.slug,logo:e.logo});if(n)throw J(n,`Failed to create organization`);return t},async setActiveOrganization(e){let{data:t,error:n}=await o.organization.setActive({organizationId:e});if(n)throw J(n,`Failed to set active organization`);return t??null},async getActiveOrganization(){let{data:e,error:t}=await o.organization.getFullOrganization();return t||!e?null:e},async getActiveMember(){let e=o.organization?.getActiveMember;if(typeof e!=`function`)return null;let{data:t,error:n}=await e();return n||!t?null:t},async getMembers(e){let{data:t,error:n}=await o.organization.listMembers({query:{organizationId:e}});if(n)throw J(n,`Failed to get members`);let r=t;return Array.isArray(r)?r:r?.members??[]},async inviteMember(e){let{data:t,error:n}=await o.organization.inviteMember({organizationId:e.organizationId,email:e.email,role:e.role,...e.businessUnitId?{businessUnitId:e.businessUnitId}:{},...e.positions?.length?{positions:e.positions}:{}});if(n)throw J(n,`Failed to invite member`);return dn(t,`inviteMember`)},async removeMember(e){let{error:t}=await o.organization.removeMember({organizationId:e.organizationId,memberIdOrUserId:e.memberIdOrUserId});if(t)throw J(t,`Failed to remove member`)},async updateMemberRole(e){let{error:t}=await o.organization.updateMemberRole({organizationId:e.organizationId,memberId:e.memberId,role:e.role});if(t)throw J(t,`Failed to update member role`)},async updateOrganization(e,t){let{data:n,error:r}=await o.organization.update({organizationId:e,data:t});if(r)throw J(r,`Failed to update organization`);return n},async deleteOrganization(e){let{error:t}=await o.organization.delete({organizationId:e});if(t)throw J(t,`Failed to delete organization`)},async leaveOrganization(e){let{error:t}=await o.organization.leave({organizationId:e});if(t)throw J(t,`Failed to leave organization`)},async listInvitations(e){let{data:t,error:n}=await o.organization.listInvitations({query:{organizationId:e}});if(n)throw J(n,`Failed to list invitations`);return fn(t,`listInvitations`)},async cancelInvitation(e){let{error:t}=await o.organization.cancelInvitation({invitationId:e});if(t)throw J(t,`Failed to cancel invitation`)},async getInvitation(e){let{data:t,error:n}=await o.organization.getInvitation({query:{id:e}});if(n)throw J(n,`Failed to load invitation`);return dn(t,`getInvitation`)},async acceptInvitation(e){let{error:t}=await o.organization.acceptInvitation({invitationId:e});if(t)throw J(t,`Failed to accept invitation`)},async rejectInvitation(e){let{error:t}=await o.organization.rejectInvitation({invitationId:e});if(t)throw J(t,`Failed to reject invitation`)},async listUserInvitations(){let{data:e,error:t}=await o.organization.listUserInvitations();if(t)throw J(t,`Failed to list invitations`);return fn(e,`listUserInvitations`)}}}var vn=`auth-active-organization-id`,Y={_memoryValue:null,get(){try{if(typeof localStorage<`u`)return localStorage.getItem(vn)}catch{}return this._memoryValue},set(e){this._memoryValue=e;try{typeof localStorage<`u`&&localStorage.setItem(vn,e)}catch{}},clear(){this._memoryValue=null;try{typeof localStorage<`u`&&localStorage.removeItem(vn)}catch{}}};function yn(e){if(typeof window>`u`||!window.location)return!0;try{return new URL(e,window.location.href).origin!==window.location.origin}catch{return!0}}function bn(e){return async(t,n)=>{let r=new Headers(n?.headers),i=typeof t==`string`?t:t instanceof URL?t.href:t.url;if(e?.sameOriginOnly&&yn(i))return fetch(t,n);let a=/\/api\//i.test(i),o=q.get();o&&a&&r.set(`Authorization`,`Bearer ${o}`);let s=Y.get();if(s&&r.set(`X-Tenant-ID`,s),a&&!r.has(`Accept-Language`)&&typeof document<`u`){let e=document.documentElement.lang;e&&r.set(`Accept-Language`,e)}let c=await fetch(t,{...n,headers:r});if(a){let e=c.headers.get(`set-auth-token`);e&&q.set(e)}if(a&&c.status===403)try{let e=g(c.status,await c.clone().json());e&&h.emit(e)}catch{}return c}}var X=n(),xn=`objectui:metadata:`;function Sn(){if(typeof sessionStorage<`u`)try{for(let e of Object.keys(sessionStorage))e.startsWith(xn)&&sessionStorage.removeItem(e)}catch{}Y.clear()}function Cn({authUrl:e,client:t,onAuthStateChange:n,enabled:r=!0,previewMode:i,children:a}){let o=(0,p.useMemo)(()=>t??_n({baseURL:e}),[t,e]),[s,c]=(0,p.useState)(null),[l,u]=(0,p.useState)(null),[d,f]=(0,p.useState)(!0),[m,g]=(0,p.useState)(null),[v,y]=(0,p.useState)(null),[b,x]=(0,p.useState)([]),[S,C]=(0,p.useState)(null),[w,T]=(0,p.useState)(null),[E,ee]=(0,p.useState)(!1),D=i!=null,O=r&&!D?s!==null&&l!==null:!0,k=(0,p.useRef)(!1),A=(0,p.useCallback)(async e=>{k.current=!0;try{let t=await o.getSession();if(e?.())return;t?(c(t.user),u(t.session)):(c(null),u(null))}catch(t){if(e?.())return;g(t instanceof Error?t:Error(String(t)))}finally{k.current=!1,e?.()||f(!1)}},[o]),j=(0,p.useCallback)(async()=>{!r||D||await A()},[r,D,A]);(0,p.useEffect)(()=>{if(!(!r||D))return q.subscribeRotation(()=>{k.current||A()})},[r,D,A]),(0,p.useEffect)(()=>{if(D){let e=i.simulatedRole??`admin`,t=i.simulatedUserName??`Preview User`,n=i.expiresInSeconds??0;c({id:`preview-user`,email:`preview@preview.local`,name:t,role:e,roles:[e]}),u({token:`preview-token`,expiresAt:n>0?new Date(Date.now()+n*1e3):new Date(Date.now()+31536e6)}),f(!1);return}if(!r){c({id:`guest`,email:`guest@local`,name:`Guest User`,role:`admin`}),u({token:`guest-token`,expiresAt:new Date(Date.now()+31536e6)}),f(!1);return}let e=!1;return A(()=>e),()=>{e=!0}},[o,r,D,i,A]),(0,p.useEffect)(()=>{n?.({user:s,session:l,isAuthenticated:O,isLoading:d,error:m})},[s,l,O,d,m,n]);let M=(0,p.useCallback)(async(e,t)=>{f(!0),g(null);try{let n=await o.signIn({email:e,password:t});c(n.user),u(n.session)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}finally{f(!1)}},[o]),N=(0,p.useCallback)(async(e,t,n)=>{f(!0),g(null);try{let r=await o.signUp({name:e,email:t,password:n});return r.requiresVerification?{requiresVerification:!0}:(c(r.user),u(r.session),{requiresVerification:!1})}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}finally{f(!1)}},[o]),P=(0,p.useCallback)(async()=>{f(!0);try{await o.signOut(),c(null),u(null),g(null),x([]),C(null)}catch(e){g(e instanceof Error?e:Error(String(e)))}finally{Sn(),f(!1)}},[o]),te=(0,p.useCallback)(async e=>{g(null);try{let t=await o.updateUser(e);c(t)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]),ne=(0,p.useCallback)(async e=>{g(null);try{await o.forgotPassword(e)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]),F=(0,p.useCallback)(async(e,t)=>{g(null);try{await o.sendVerificationEmail(e,t)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]),I=(0,p.useCallback)(async(e,t)=>{g(null);try{await o.resetPassword(e,t)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]),re=(0,p.useCallback)(async e=>{g(null);try{await o.sendPhoneOtp(e)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]),L=(0,p.useCallback)(async(e,t)=>{f(!0),g(null);try{let n=await o.signInWithPhoneOtp(e,t);c(n.user),u(n.session)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}finally{f(!1)}},[o]),ie=(0,p.useCallback)(async(e,t)=>{f(!0),g(null);try{let n=await o.signInWithPhonePassword(e,t);c(n.user),u(n.session)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}finally{f(!1)}},[o]),ae=(0,p.useCallback)(async e=>{g(null);try{await o.requestPhonePasswordReset(e)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]),R=(0,p.useCallback)(async(e,t,n)=>{g(null);try{await o.resetPasswordWithPhoneOtp(e,t,n)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]);(0,p.useEffect)(()=>h.subscribe(e=>{y(t=>t??e)}),[]);let oe=(0,p.useCallback)(e=>o.enrollTotp(e),[o]),z=(0,p.useCallback)(e=>o.verifyTotp(e),[o]),se=(0,p.useCallback)(async(e,t,n)=>{g(null);try{await o.changePassword(e,t,n)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]),ce=(0,p.useCallback)(async e=>{g(null);try{await o.setInitialPassword(e)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]),le=(0,p.useCallback)(()=>o.hasLocalPassword(),[o]),ue=(0,p.useCallback)(()=>o.getConfig(),[o]),de=(0,p.useCallback)(async(e,t)=>{g(null);try{await o.signInWithProvider(e,t)}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]),B=(0,p.useCallback)(async e=>{if(!(!r||D)){ee(!0);try{let t=await o.listOrganizations();if(e?.())return t;if(x(t),t.length>0&&!S){let n=null;try{n=await o.getActiveOrganization()}catch{n=null}if(!n&&t.length===1)try{n=await o.setActiveOrganization(t[0].id)}catch{n=null}n&&!e?.()&&(C(n),Y.set(n.id))}return t}catch(t){e?.()||console.warn(`[AuthProvider] Failed to load organizations:`,t)}finally{e?.()||ee(!1)}}},[o,r,D,S]),V=(0,p.useCallback)(async()=>{if(!r||D){let e=D?i?.simulatedRole??`admin`:`admin`;T({id:`preview-member`,organizationId:S?.id??`preview-org`,userId:`preview-user`,role:e});return}if(!S){T(null);return}try{let e=await o.getActiveMember();T(e)}catch(e){console.warn(`[AuthProvider] Failed to load active member:`,e),T(null)}},[o,r,D,i,S]);(0,p.useEffect)(()=>{V()},[V]),(0,p.useEffect)(()=>{if(!(s&&r&&!D))return;let e=!1;return B(()=>e),()=>{e=!0}},[s,r,D]);let fe=(0,p.useCallback)(async e=>{g(null);try{let t=await o.setActiveOrganization(e);C(t),t?Y.set(t.id):Y.clear()}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o]),pe=(0,p.useCallback)(async e=>{g(null);try{let t=await o.createOrganization(e);return await B(),await fe(t.id),t}catch(e){let t=e instanceof Error?e:Error(String(e));throw g(t),t}},[o,B,fe]),me=(0,p.useCallback)(async(e,t)=>{let n=await o.updateOrganization(e,t);return await B(),S?.id===e&&C(n),n},[o,B,S]),he=(0,p.useCallback)(async e=>{await o.deleteOrganization(e),S?.id===e&&(C(null),Y.clear()),await B()},[o,S,B]),ge=(0,p.useCallback)(async e=>{await o.leaveOrganization(e),S?.id===e&&(C(null),Y.clear()),await B()},[o,S,B]),_e=(0,p.useCallback)(e=>o.getMembers(e),[o]),ve=(0,p.useCallback)(e=>o.inviteMember(e),[o]),ye=(0,p.useCallback)(()=>o.describeDelegableScope(),[o]),be=(0,p.useCallback)(e=>o.removeMember(e),[o]),H=(0,p.useCallback)(e=>o.updateMemberRole(e),[o]),U=(0,p.useCallback)(e=>o.listInvitations(e),[o]),xe=(0,p.useCallback)(e=>o.cancelInvitation(e),[o]),Se=(0,p.useCallback)(e=>o.getInvitation(e),[o]),Ce=(0,p.useCallback)(async e=>{await o.acceptInvitation(e),await B()},[o,B]),we=(0,p.useCallback)(e=>o.rejectInvitation(e),[o]),Te=(0,p.useCallback)(()=>o.listUserInvitations(),[o]),W=r&&!D,Ee=(0,p.useMemo)(()=>({user:s,session:l,isAuthenticated:O,isAuthEnabled:W,isLoading:d,error:m,isPreviewMode:D,previewMode:D?i:null,signIn:M,signUp:N,signOut:P,refreshSession:j,updateUser:te,forgotPassword:ne,sendVerificationEmail:F,resetPassword:I,sendPhoneOtp:re,signInWithPhoneOtp:L,signInWithPhonePassword:ie,requestPhonePasswordReset:ae,resetPasswordWithPhoneOtp:R,changePassword:se,remediationRequired:v,setRemediationRequired:y,enrollTotp:oe,verifyTotp:z,setInitialPassword:ce,hasLocalPassword:le,getAuthConfig:ue,signInWithProvider:de,organizations:b,activeOrganization:S,activeMember:w,isOrganizationsLoading:E,switchOrganization:fe,createOrganization:pe,refreshOrganizations:B,updateOrganization:me,deleteOrganization:he,leaveOrganization:ge,getMembers:_e,inviteMember:ve,describeDelegableScope:ye,removeMember:be,updateMemberRole:H,listInvitations:U,cancelInvitation:xe,getInvitation:Se,acceptInvitation:Ce,rejectInvitation:we,listUserInvitations:Te}),[s,l,O,W,d,m,D,i,M,N,P,j,te,ne,F,I,se,ce,le,ue,de,re,L,ie,ae,R,v,oe,z,b,S,w,E,fe,pe,B,me,he,ge,_e,ve,ye,be,H,U,xe,Se,Ce,we,Te]);return(0,X.jsx)(_.Provider,{value:Ee,children:a})}function wn(){return(0,p.useContext)(_)||{user:null,session:null,isAuthenticated:!1,isAuthEnabled:!1,isLoading:!1,error:null,isPreviewMode:!1,previewMode:null,signIn:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},signUp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},signOut:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},refreshSession:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},updateUser:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},forgotPassword:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},sendVerificationEmail:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},resetPassword:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},sendPhoneOtp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},signInWithPhoneOtp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},signInWithPhonePassword:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},requestPhonePasswordReset:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},resetPasswordWithPhoneOtp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},changePassword:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},remediationRequired:null,setRemediationRequired:()=>{},enrollTotp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},verifyTotp:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},setInitialPassword:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},hasLocalPassword:async()=>!1,getAuthConfig:async()=>({}),describeDelegableScope:async()=>null,signInWithProvider:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},organizations:[],activeOrganization:null,activeMember:null,isOrganizationsLoading:!1,switchOrganization:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},createOrganization:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},refreshOrganizations:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},updateOrganization:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},deleteOrganization:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},leaveOrganization:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},getMembers:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},inviteMember:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},removeMember:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},updateMemberRole:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},listInvitations:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},cancelInvitation:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},getInvitation:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},acceptInvitation:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},rejectInvitation:async()=>{throw Error(`useAuth must be used within an AuthProvider`)},listUserInvitations:async()=>{throw Error(`useAuth must be used within an AuthProvider`)}}}var Tn=new Set([`owner`,`admin`,`super_admin`,`superadmin`,`platform_admin`,`system_admin`,`org_owner`,`org_admin`]);function En(e){return typeof e==`string`&&Tn.has(e.toLowerCase())}function Dn(){let{activeMember:e,user:t}=wn();return!!(En(e?.role)||En(t?.role)||Array.isArray(t?.roles)&&t.roles.some(En))}function On({fallback:e=null,requiredRoles:t,loadingFallback:n,children:r}){let{isAuthenticated:i,isLoading:a,user:o}=wn();if(a)return(0,X.jsx)(X.Fragment,{children:n??null});if(!i)return(0,X.jsx)(X.Fragment,{children:e});if(t&&t.length>0&&o){let n=o.roles??(o.role?[o.role]:[]);if(!t.some(e=>n.includes(e)))return(0,X.jsx)(X.Fragment,{children:e})}return(0,X.jsx)(X.Fragment,{children:r})}var Z=`flex h-11 w-full rounded-lg border border-input bg-background px-3.5 py-2 text-sm shadow-sm ring-offset-background transition-colors placeholder:text-muted-foreground hover:border-primary/40 focus-visible:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50`,kn=`inline-flex h-11 w-full items-center justify-center gap-2 rounded-lg bg-gradient-to-r from-primary to-primary/85 px-4 py-2 text-sm font-medium text-primary-foreground shadow-sm ring-offset-background transition-[box-shadow,background-color,transform] hover:shadow-md hover:from-primary hover:to-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 active:scale-[0.99] disabled:pointer-events-none disabled:opacity-60 motion-reduce:transition-none motion-reduce:active:transform-none`,Q=`text-sm font-medium leading-none text-foreground`;function $(){return(0,X.jsxs)(`svg`,{className:`h-4 w-4 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[(0,X.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,X.jsx)(`path`,{className:`opacity-90`,d:`M4 12a8 8 0 018-8`,stroke:`currentColor`,strokeWidth:`4`,strokeLinecap:`round`})]})}function An({className:e}){return(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e??`h-4 w-4 shrink-0`,"aria-hidden":`true`,children:[(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,X.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,X.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]})}function jn({className:e}){return(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e??`h-7 w-7`,"aria-hidden":`true`,children:[(0,X.jsx)(`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`}),(0,X.jsx)(`path`,{d:`m22 6-10 7L2 6`})]})}function Mn({icon:e,title:t,description:n}){return(0,X.jsxs)(`div`,{className:`flex flex-col items-center space-y-3 text-center`,children:[e&&(0,X.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-2xl bg-primary/10 text-primary ring-1 ring-primary/15`,children:e}),(0,X.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground sm:text-[1.6rem]`,children:t}),n&&(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:n})]})}function Nn({message:e}){return(0,X.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive`,role:`alert`,children:[(0,X.jsx)(An,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,X.jsx)(`span`,{className:`leading-snug`,children:e})]})}var Pn={google:`Google`,github:`GitHub`,microsoft:`Microsoft`,apple:`Apple`,facebook:`Facebook`,twitter:`Twitter`,discord:`Discord`,gitlab:`GitLab`,linkedin:`LinkedIn`},Fn={google:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{fill:`#EA4335`,d:`M12 10.2v3.9h5.5c-.24 1.4-1.7 4.1-5.5 4.1-3.3 0-6-2.74-6-6.1s2.7-6.1 6-6.1c1.88 0 3.14.8 3.86 1.5l2.64-2.55C16.84 3.36 14.66 2.4 12 2.4 6.92 2.4 2.8 6.52 2.8 11.6S6.92 20.8 12 20.8c6.92 0 9.2-4.86 9.2-7.4 0-.5-.06-.88-.14-1.2H12z`})}),github:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56v-2.07c-3.2.7-3.87-1.37-3.87-1.37-.52-1.33-1.27-1.69-1.27-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.75 2.68 1.25 3.34.96.1-.74.4-1.25.73-1.54-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.29 1.18-3.1-.12-.29-.51-1.46.11-3.04 0 0 .97-.31 3.18 1.18a11.04 11.04 0 015.79 0c2.21-1.49 3.18-1.18 3.18-1.18.62 1.58.23 2.75.11 3.04.74.81 1.18 1.84 1.18 3.1 0 4.42-2.7 5.39-5.27 5.68.41.36.78 1.06.78 2.13v3.16c0 .31.21.68.8.56C20.21 21.39 23.5 17.08 23.5 12 23.5 5.65 18.35.5 12 .5z`})}),microsoft:(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:[(0,X.jsx)(`path`,{fill:`#F25022`,d:`M2 2h9.5v9.5H2z`}),(0,X.jsx)(`path`,{fill:`#7FBA00`,d:`M12.5 2H22v9.5h-9.5z`}),(0,X.jsx)(`path`,{fill:`#00A4EF`,d:`M2 12.5h9.5V22H2z`}),(0,X.jsx)(`path`,{fill:`#FFB900`,d:`M12.5 12.5H22V22h-9.5z`})]}),apple:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M16.37 12.55c-.02-2.27 1.85-3.36 1.94-3.42-1.06-1.55-2.71-1.76-3.3-1.79-1.4-.14-2.74.83-3.45.83-.71 0-1.81-.81-2.98-.79-1.53.02-2.95.89-3.74 2.27-1.6 2.77-.41 6.86 1.14 9.11.76 1.1 1.66 2.34 2.83 2.3 1.14-.05 1.57-.74 2.94-.74 1.37 0 1.76.74 2.96.71 1.22-.02 2-1.12 2.75-2.23.87-1.28 1.22-2.52 1.24-2.59-.03-.01-2.38-.91-2.4-3.66zM14.1 5.31c.62-.76 1.05-1.81.93-2.86-.9.04-2 .6-2.65 1.35-.58.66-1.1 1.74-.96 2.76 1.01.08 2.04-.51 2.68-1.25z`})}),facebook:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{fill:`#1877F2`,d:`M24 12C24 5.37 18.63 0 12 0S0 5.37 0 12c0 5.99 4.39 10.95 10.13 11.85V15.47H7.08V12h3.05V9.36c0-3.01 1.79-4.67 4.53-4.67 1.31 0 2.69.23 2.69.23v2.96h-1.51c-1.49 0-1.96.93-1.96 1.88V12h3.33l-.53 3.47h-2.8v8.38C19.61 22.95 24 17.99 24 12z`})}),twitter:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),discord:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{fill:`#5865F2`,d:`M20.32 4.37A19.79 19.79 0 0016.56 3l-.18.36a18.27 18.27 0 00-8.76 0L7.44 3a19.79 19.79 0 00-3.76 1.37C.99 8.4.27 12.34.63 16.22a19.94 19.94 0 006.07 3.07l.49-.7a13.2 13.2 0 01-2.07-.99c.17-.13.34-.27.5-.41a14.13 14.13 0 0012.76 0c.16.14.33.28.5.41-.66.4-1.36.73-2.07.99l.49.7a19.92 19.92 0 006.07-3.07c.43-4.5-.66-8.41-2.95-11.85zM8.52 14.12c-1.18 0-2.15-1.08-2.15-2.41 0-1.33.95-2.42 2.15-2.42 1.2 0 2.17 1.09 2.15 2.42 0 1.33-.96 2.41-2.15 2.41zm6.96 0c-1.18 0-2.15-1.08-2.15-2.41 0-1.33.95-2.42 2.15-2.42 1.2 0 2.17 1.09 2.15 2.42 0 1.33-.95 2.41-2.15 2.41z`})}),gitlab:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{fill:`#FC6D26`,d:`M23.6 9.6L23.57 9.5 20.3.81a.84.84 0 00-1.6.05L16.5 7.6H7.5L5.3.86a.84.84 0 00-1.6-.05L.43 9.5l-.03.1a5.84 5.84 0 001.94 6.74l.01.01.03.02 4.8 3.6 2.38 1.8 1.45 1.1a1 1 0 001.2 0l1.45-1.1 2.38-1.8 4.83-3.62.01-.01a5.84 5.84 0 001.93-6.74z`})}),linkedin:(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{fill:`#0A66C2`,d:`M20.45 20.45h-3.55v-5.57c0-1.33-.02-3.04-1.85-3.04-1.85 0-2.13 1.45-2.13 2.94v5.67H9.36V9h3.41v1.56h.05c.48-.9 1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.45v6.29zM5.34 7.43a2.06 2.06 0 11.01-4.13 2.06 2.06 0 010 4.13zM7.12 20.45H3.56V9h3.56v11.45zM22.22 0H1.77C.79 0 0 .77 0 1.72v20.56C0 23.23.79 24 1.77 24h20.45c.98 0 1.78-.77 1.78-1.72V1.72C24 .77 23.2 0 22.22 0z`})})};function In({id:e}){let t=Fn[e];return t?(0,X.jsx)(`span`,{className:`mr-2 flex h-4 w-4 items-center justify-center`,children:t}):(0,X.jsx)(`span`,{className:`mr-2 flex h-4 w-4 items-center justify-center rounded-sm bg-muted text-[10px] font-bold uppercase`,children:e[0]})}function Ln({mode:e=`sign-in`,callbackURL:t,errorCallbackURL:n,dividerText:r=`or continue with email`,onProvidersResolved:i}){let{getAuthConfig:a,signInWithProvider:o}=wn(),[s,c]=(0,p.useState)([]),[l,u]=(0,p.useState)(!0),[d,f]=(0,p.useState)(null),[m,h]=(0,p.useState)(null);if((0,p.useEffect)(()=>{let e=!1;return Promise.resolve().then(()=>a()).then(t=>{if(e)return;let n=(t?.socialProviders??[]).filter(e=>e.enabled);c(n),i?.(n.length>0)}).catch(t=>{e||(console.warn(`[SocialSignInButtons] failed to load auth config`,t),i?.(!1))}).finally(()=>{e||u(!1)}),()=>{e=!0}},[a]),l||s.length===0)return null;let g=e===`sign-in`?`Continue with`:`Sign up with`,_=typeof window<`u`?window.location.href:void 0,v=async e=>{if(!m){f(null),h(e.id);try{await o(e.id,{callbackURL:t??_,errorCallbackURL:n??t??_,type:e.type??`social`})}catch(e){f(e instanceof Error?e.message:String(e)),h(null)}}};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[d&&(0,X.jsx)(`div`,{className:`rounded-md bg-destructive/15 p-3 text-sm text-destructive`,role:`alert`,children:d}),s.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>v(e),disabled:m!==null,"aria-busy":m===e.id,className:`inline-flex h-10 w-full items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,children:[m===e.id?(0,X.jsx)($,{}):(0,X.jsx)(In,{id:e.id}),g,` `,Pn[e.id]??e.name]},e.id)),(0,X.jsxs)(`div`,{className:`relative my-1`,children:[(0,X.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,X.jsx)(`span`,{className:`w-full border-t`})}),(0,X.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,X.jsx)(`span`,{className:`bg-background px-2 text-muted-foreground`,children:r})})]})]})}function Rn(e){let t=String(e??``).replace(/[\s\-().]/g,``);return/^\+?[0-9]{6,15}$/.test(t)?t:null}function zn(e){return typeof e!=`string`||e.includes(`@`)?!1:Rn(e)!==null}var Bn=({href:e,className:t,children:n})=>(0,X.jsx)(`a`,{href:e,className:t,children:n}),Vn=()=>(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`h-6 w-6`,"aria-hidden":`true`,children:[(0,X.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`11`,rx:`2`}),(0,X.jsx)(`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`})]});function Hn({onSuccess:e,onError:t,registerUrl:n=`/register`,forgotPasswordUrl:r=`/forgot-password`,title:i=`Sign in to your account`,description:a=`Enter your email and password to continue`,icon:o,hideIcon:s=!1,linkComponent:c=Bn,labels:l={},errorMessages:u}){let{signIn:d,isLoading:f,getAuthConfig:m,sendPhoneOtp:h,signInWithPhoneOtp:g,signInWithPhonePassword:_}=wn(),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(null),[w,T]=(0,p.useState)(!1),[E,ee]=(0,p.useState)(!1),[D,O]=(0,p.useState)(`password`),[k,A]=(0,p.useState)(``),[j,M]=(0,p.useState)(``),[N,P]=(0,p.useState)(!1),[te,ne]=(0,p.useState)(!1),[F,I]=(0,p.useState)(0),[re,L]=(0,p.useState)(!1),[ie,ae]=(0,p.useState)(!1),[R,oe]=(0,p.useState)(!1),[z,se]=(0,p.useState)(!1),[ce,le]=(0,p.useState)(!1),[ue,de]=(0,p.useState)(!0);(0,p.useEffect)(()=>{let e=!1;return Promise.resolve().then(()=>m()).then(t=>{e||(ae(t?.features?.sso===!0),T(t?.features?.phoneNumberOtp===!0),ee(t?.features?.phoneNumber===!0),oe(t?.features?.ssoEnforced===!0||t?.emailPassword?.enabled===!1))}).catch(()=>{}).finally(()=>{e||de(!1)}),()=>{e=!0}},[m]);let B=!R||z,V={emailLabel:l.emailLabel??`Email`,emailPlaceholder:l.emailPlaceholder??`name@example.com`,emailOrPhoneLabel:l.emailOrPhoneLabel??`Email or phone number`,emailOrPhonePlaceholder:l.emailOrPhonePlaceholder??`name@example.com or +1 555 000 0000`,passwordLabel:l.passwordLabel??`Password`,passwordPlaceholder:l.passwordPlaceholder??`Enter your password`,forgotPasswordText:l.forgotPasswordText??`Forgot password?`,submitButton:l.submitButton??`Sign In`,submittingButton:l.submittingButton??`Signing in…`,noAccountText:l.noAccountText??`Don't have an account?`,signUpText:l.signUpText??`Sign up`,orText:l.orText??`or`,ssoButton:l.ssoButton??`Sign in with SSO`,usePasswordText:l.usePasswordText??`Use a password instead`,backToSsoText:l.backToSsoText??`Back to single sign-on`,ssoOnlyDescription:l.ssoOnlyDescription??`Sign in with your organization's single sign-on`,phoneLabel:l.phoneLabel??`Phone number`,phonePlaceholder:l.phonePlaceholder??`+1 555 000 0000`,otpCodeLabel:l.otpCodeLabel??`Verification code`,otpCodePlaceholder:l.otpCodePlaceholder??`6-digit code`,sendOtpButton:l.sendOtpButton??`Get code`,resendOtpCountdownText:l.resendOtpCountdownText??`Resend in {seconds}s`,usePhoneOtpText:l.usePhoneOtpText??`Sign in with verification code`,usePasswordSignInText:l.usePasswordSignInText??`Sign in with password instead`};(0,p.useEffect)(()=>{if(F<=0)return;let e=setTimeout(()=>I(e=>e>1?e-1:0),1e3);return()=>clearTimeout(e)},[F]);let fe=async n=>{n.preventDefault(),C(null);let r=v.trim();try{D===`phone-otp`?await g(k.trim(),j.trim()):E&&zn(r)?await _(Rn(r)??r,b):await d(r,b),e?.()}catch(e){let n=e instanceof Error?e:Error(String(e)),r=n.code;C(r&&u?.[r]||n.message),t?.(n)}},pe=async()=>{if(!(!k.trim()||N||F>0)){C(null),P(!0);try{await h(k.trim()),ne(!0),I(60)}catch(e){let n=e instanceof Error?e:Error(String(e)),r=n.code;C(r&&u?.[r]||n.message),t?.(n)}finally{P(!1)}}},me=e=>{O(e),C(null)};return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full flex-col justify-center space-y-7 sm:w-[400px]`,children:[(0,X.jsx)(Mn,{icon:s?void 0:o??(0,X.jsx)(Vn,{}),title:i,description:R&&!z?V.ssoOnlyDescription:a}),(0,X.jsx)(`div`,{className:`space-y-5`,children:ue?(0,X.jsx)(`div`,{className:`flex justify-center py-10`,role:`status`,"aria-live":`polite`,"data-testid":`login-config-loading`,children:(0,X.jsx)($,{})}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ln,{mode:`sign-in`,onProvidersResolved:e=>L(e)}),B?D===`phone-otp`?(0,X.jsxs)(`form`,{onSubmit:fe,className:`space-y-4`,children:[S&&(0,X.jsx)(Nn,{message:S}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`login-phone`,className:Q,children:V.phoneLabel}),(0,X.jsx)(`input`,{id:`login-phone`,type:`tel`,placeholder:V.phonePlaceholder,value:k,onChange:e=>A(e.target.value),required:!0,autoComplete:`tel`,disabled:f,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`login-otp`,className:Q,children:V.otpCodeLabel}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(`input`,{id:`login-otp`,type:`text`,inputMode:`numeric`,placeholder:V.otpCodePlaceholder,value:j,onChange:e=>M(e.target.value),required:!0,autoComplete:`one-time-code`,disabled:f,className:Z}),(0,X.jsxs)(`button`,{type:`button`,onClick:pe,disabled:N||F>0||!k.trim()||f,className:`shrink-0 rounded-md border border-input bg-background px-3 py-2 text-sm font-medium transition-colors hover:bg-accent disabled:opacity-50`,children:[N&&(0,X.jsx)($,{}),F>0?V.resendOtpCountdownText.replace(`{seconds}`,String(F)):V.sendOtpButton]})]})]}),(0,X.jsxs)(`button`,{type:`submit`,disabled:f||!te,className:kn,children:[f&&(0,X.jsx)($,{}),f?V.submittingButton:V.submitButton]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>me(`password`),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:V.usePasswordSignInText})]}):(0,X.jsxs)(`form`,{onSubmit:fe,className:`space-y-4`,children:[S&&(0,X.jsx)(Nn,{message:S}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`login-email`,className:Q,children:E?V.emailOrPhoneLabel:V.emailLabel}),(0,X.jsx)(`input`,{id:`login-email`,type:E?`text`:`email`,inputMode:E?`text`:`email`,placeholder:E?V.emailOrPhonePlaceholder:V.emailPlaceholder,value:v,onChange:e=>y(e.target.value),required:!0,autoComplete:`username`,disabled:f,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`label`,{htmlFor:`login-password`,className:Q,children:V.passwordLabel}),r&&(0,X.jsx)(c,{href:r,className:`text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:V.forgotPasswordText})]}),(0,X.jsx)(`input`,{id:`login-password`,type:`password`,placeholder:V.passwordPlaceholder,value:b,onChange:e=>x(e.target.value),required:!0,autoComplete:`current-password`,disabled:f,className:Z})]}),(0,X.jsxs)(`button`,{type:`submit`,disabled:f,className:kn,children:[f&&(0,X.jsx)($,{}),f?V.submittingButton:V.submitButton]}),ie&&(0,X.jsxs)(`button`,{type:`button`,onClick:async()=>{if(ce)return;C(null);let e=v.trim();if(zn(e)){C(`Enter your email address to sign in with SSO.`);return}le(!0);try{let t=window.location.pathname.replace(/\/login(?:\/.*)?$/,``),n=await fetch(`/api/v1/auth/sign-in/sso`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,callbackURL:t+`/home`}),credentials:`include`}),r=await n.json().catch(()=>({}));if(n.ok&&typeof r.url==`string`){window.location.href=r.url;return}C(r.message||`No SSO provider is configured for this email domain.`),le(!1)}catch(e){C(e instanceof Error?e.message:String(e)),le(!1)}},disabled:f||ce,"aria-busy":ce,className:`flex w-full items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent disabled:opacity-50`,children:[ce&&(0,X.jsx)($,{}),V.ssoButton]}),w&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>me(`phone-otp`),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:V.usePhoneOtpText}),R&&z&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>se(!1),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:V.backToSsoText})]}):(0,X.jsxs)(`div`,{className:`space-y-4`,children:[S&&(0,X.jsx)(Nn,{message:S}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>se(!0),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:V.usePasswordText})]})]})}),n&&!R&&(0,X.jsxs)(`p`,{className:`px-8 text-center text-sm text-muted-foreground`,children:[V.noAccountText,` `,(0,X.jsx)(c,{href:n,className:`font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:underline`,children:V.signUpText})]})]})}var Un=({href:e,className:t,children:n})=>(0,X.jsx)(`a`,{href:e,className:t,children:n}),Wn=()=>(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`h-6 w-6`,"aria-hidden":`true`,children:[(0,X.jsx)(`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`}),(0,X.jsx)(`circle`,{cx:`9`,cy:`7`,r:`4`}),(0,X.jsx)(`line`,{x1:`19`,y1:`8`,x2:`19`,y2:`14`}),(0,X.jsx)(`line`,{x1:`22`,y1:`11`,x2:`16`,y2:`11`})]});function Gn({onSuccess:e,onVerificationRequired:t,onError:n,loginUrl:r=`/login`,title:i=`Create an account`,description:a=`Enter your information to get started`,icon:o,hideIcon:s=!1,linkComponent:c=Un,labels:l={},errorMessages:u}){let{signUp:d,isLoading:f}=wn(),[m,h]=(0,p.useState)(``),[g,_]=(0,p.useState)(``),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(null),w={nameLabel:l.nameLabel??`Name`,namePlaceholder:l.namePlaceholder??`John Doe`,emailLabel:l.emailLabel??`Email`,emailPlaceholder:l.emailPlaceholder??`name@example.com`,passwordLabel:l.passwordLabel??`Password`,passwordPlaceholder:l.passwordPlaceholder??`Create a password (min. 8 characters)`,confirmPasswordLabel:l.confirmPasswordLabel??`Confirm Password`,confirmPasswordPlaceholder:l.confirmPasswordPlaceholder??`Confirm your password`,passwordMismatchError:l.passwordMismatchError??`Passwords do not match`,passwordTooShortError:l.passwordTooShortError??`Password must be at least 8 characters`,submitButton:l.submitButton??`Create Account`,submittingButton:l.submittingButton??`Creating account…`,hasAccountText:l.hasAccountText??`Already have an account?`,signInText:l.signInText??`Sign in`,orText:l.orText??`or`};return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full flex-col justify-center space-y-7 sm:w-[400px]`,children:[(0,X.jsx)(Mn,{icon:s?void 0:o??(0,X.jsx)(Wn,{}),title:i,description:a}),(0,X.jsxs)(`div`,{className:`space-y-5`,children:[(0,X.jsx)(Ln,{mode:`sign-up`}),(0,X.jsxs)(`form`,{onSubmit:async r=>{if(r.preventDefault(),C(null),v!==b){C(w.passwordMismatchError);return}if(v.length<8){C(w.passwordTooShortError);return}let i=g.trim();try{if((await d(m,i,v))?.requiresVerification){t?.(i);return}e?.()}catch(e){let t=e instanceof Error?e:Error(String(e)),r=t.code;C(r&&u?.[r]||t.message),n?.(t)}},className:`space-y-4`,children:[S&&(0,X.jsx)(Nn,{message:S}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`register-name`,className:Q,children:w.nameLabel}),(0,X.jsx)(`input`,{id:`register-name`,type:`text`,placeholder:w.namePlaceholder,value:m,onChange:e=>h(e.target.value),required:!0,autoComplete:`name`,disabled:f,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`register-email`,className:Q,children:w.emailLabel}),(0,X.jsx)(`input`,{id:`register-email`,type:`email`,placeholder:w.emailPlaceholder,value:g,onChange:e=>_(e.target.value),required:!0,autoComplete:`email`,disabled:f,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`register-password`,className:Q,children:w.passwordLabel}),(0,X.jsx)(`input`,{id:`register-password`,type:`password`,placeholder:w.passwordPlaceholder,value:v,onChange:e=>y(e.target.value),required:!0,minLength:8,autoComplete:`new-password`,disabled:f,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`register-confirm-password`,className:Q,children:w.confirmPasswordLabel}),(0,X.jsx)(`input`,{id:`register-confirm-password`,type:`password`,placeholder:w.confirmPasswordPlaceholder,value:b,onChange:e=>x(e.target.value),required:!0,minLength:8,autoComplete:`new-password`,disabled:f,className:Z})]}),(0,X.jsxs)(`button`,{type:`submit`,disabled:f,className:kn,children:[f&&(0,X.jsx)($,{}),f?w.submittingButton:w.submitButton]})]})]}),r&&(0,X.jsxs)(`p`,{className:`px-8 text-center text-sm text-muted-foreground`,children:[w.hasAccountText,` `,(0,X.jsx)(c,{href:r,className:`font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:underline`,children:w.signInText})]})]})}var Kn=({href:e,className:t,children:n})=>(0,X.jsx)(`a`,{href:e,className:t,children:n}),qn=()=>(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`h-6 w-6`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4`})});function Jn({onSuccess:e,onError:t,loginUrl:n=`/login`,title:r=`Reset your password`,description:i=`Enter your email address and we'll send you a link to reset your password`,icon:a,hideIcon:o=!1,linkComponent:s=Kn,labels:c={}}){let{forgotPassword:l,isLoading:u,getAuthConfig:d,requestPhonePasswordReset:f,resetPasswordWithPhoneOtp:m}=wn(),[h,g]=(0,p.useState)(``),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(!1),[x,S]=(0,p.useState)(!1),[C,w]=(0,p.useState)(`email`),[T,E]=(0,p.useState)(``),[ee,D]=(0,p.useState)(``),[O,k]=(0,p.useState)(``),[A,j]=(0,p.useState)(!1),[M,N]=(0,p.useState)(!1),[P,te]=(0,p.useState)(0),[ne,F]=(0,p.useState)(!1),[I,re]=(0,p.useState)(!1);(0,p.useEffect)(()=>{let e=!1;return Promise.resolve().then(()=>d()).then(t=>{e||S(t?.features?.phoneNumberOtp===!0)}).catch(()=>{}),()=>{e=!0}},[d]),(0,p.useEffect)(()=>{if(P<=0)return;let e=setTimeout(()=>te(e=>e>1?e-1:0),1e3);return()=>clearTimeout(e)},[P]);let L={emailLabel:c.emailLabel??`Email`,emailPlaceholder:c.emailPlaceholder??`name@example.com`,submitButton:c.submitButton??`Send Reset Link`,submittingButton:c.submittingButton??`Sending…`,successTitle:c.successTitle??`Check your email`,successDescription:c.successDescription??`We've sent a password reset link to {email}. Please check your inbox.`,backToSignInText:c.backToSignInText??`Back to sign in`,rememberPasswordText:c.rememberPasswordText??`Remember your password?`,signInText:c.signInText??`Sign in`,phoneLabel:c.phoneLabel??`Phone number`,phonePlaceholder:c.phonePlaceholder??`+1 555 000 0000`,otpCodeLabel:c.otpCodeLabel??`Verification code`,otpCodePlaceholder:c.otpCodePlaceholder??`6-digit code`,sendOtpButton:c.sendOtpButton??`Get code`,resendOtpCountdownText:c.resendOtpCountdownText??`Resend in {seconds}s`,newPasswordLabel:c.newPasswordLabel??`New password`,newPasswordPlaceholder:c.newPasswordPlaceholder??`Enter a new password`,resetButton:c.resetButton??`Reset Password`,usePhoneResetText:c.usePhoneResetText??`Reset via SMS code`,useEmailResetText:c.useEmailResetText??`Reset via email instead`,phoneSuccessTitle:c.phoneSuccessTitle??`Password reset`,phoneSuccessDescription:c.phoneSuccessDescription??`Your password has been reset. You can now sign in with your new password.`},ie=async n=>{n.preventDefault(),v(null);try{await l(h.trim()),b(!0),e?.()}catch(e){let n=e instanceof Error?e:Error(String(e));v(n.message),t?.(n)}},ae=async()=>{if(!(!T.trim()||A||P>0)){v(null),j(!0);try{await f(T.trim()),N(!0),te(60)}catch(e){let n=e instanceof Error?e:Error(String(e));v(n.message),t?.(n)}finally{j(!1)}}},R=async n=>{n.preventDefault(),v(null),re(!0);try{await m(T.trim(),ee.trim(),O),F(!0),e?.()}catch(e){let n=e instanceof Error?e:Error(String(e));v(n.message),t?.(n)}finally{re(!1)}},oe=e=>{w(e),v(null)};if(ne)return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full flex-col justify-center space-y-7 sm:w-[400px]`,children:[(0,X.jsx)(Mn,{icon:(0,X.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-2xl bg-emerald-500/10 text-emerald-600 ring-1 ring-emerald-500/15 dark:text-emerald-400`,children:(0,X.jsx)(jn,{})}),title:L.phoneSuccessTitle,description:L.phoneSuccessDescription}),n&&(0,X.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,X.jsxs)(s,{href:n,className:`font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:underline`,children:[`← `,L.backToSignInText]})})]});if(y){let e=L.successDescription.includes(`{email}`)?L.successDescription.replace(`{email}`,h):`${L.successDescription} ${h}`;return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full flex-col justify-center space-y-7 sm:w-[400px]`,children:[(0,X.jsx)(Mn,{icon:(0,X.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-2xl bg-emerald-500/10 text-emerald-600 ring-1 ring-emerald-500/15 dark:text-emerald-400`,children:(0,X.jsx)(jn,{})}),title:L.successTitle,description:e}),n&&(0,X.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,X.jsxs)(s,{href:n,className:`font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:underline`,children:[`← `,L.backToSignInText]})})]})}return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full flex-col justify-center space-y-7 sm:w-[400px]`,children:[(0,X.jsx)(Mn,{icon:o?void 0:a??(0,X.jsx)(qn,{}),title:r,description:i}),C===`phone`?(0,X.jsxs)(`form`,{onSubmit:R,className:`space-y-4`,children:[_&&(0,X.jsx)(Nn,{message:_}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`forgot-phone`,className:Q,children:L.phoneLabel}),(0,X.jsx)(`input`,{id:`forgot-phone`,type:`tel`,placeholder:L.phonePlaceholder,value:T,onChange:e=>E(e.target.value),required:!0,autoComplete:`tel`,disabled:I,className:Z})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`forgot-otp`,className:Q,children:L.otpCodeLabel}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(`input`,{id:`forgot-otp`,type:`text`,inputMode:`numeric`,placeholder:L.otpCodePlaceholder,value:ee,onChange:e=>D(e.target.value),required:!0,autoComplete:`one-time-code`,disabled:I,className:Z}),(0,X.jsxs)(`button`,{type:`button`,onClick:ae,disabled:A||P>0||!T.trim()||I,className:`shrink-0 rounded-md border border-input bg-background px-3 py-2 text-sm font-medium transition-colors hover:bg-accent disabled:opacity-50`,children:[A&&(0,X.jsx)($,{}),P>0?L.resendOtpCountdownText.replace(`{seconds}`,String(P)):L.sendOtpButton]})]})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`forgot-new-password`,className:Q,children:L.newPasswordLabel}),(0,X.jsx)(`input`,{id:`forgot-new-password`,type:`password`,placeholder:L.newPasswordPlaceholder,value:O,onChange:e=>k(e.target.value),required:!0,autoComplete:`new-password`,disabled:I,className:Z})]}),(0,X.jsxs)(`button`,{type:`submit`,disabled:I||!M,className:kn,children:[I&&(0,X.jsx)($,{}),I?L.submittingButton:L.resetButton]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>oe(`email`),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:L.useEmailResetText})]}):(0,X.jsxs)(`form`,{onSubmit:ie,className:`space-y-4`,children:[_&&(0,X.jsx)(Nn,{message:_}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{htmlFor:`forgot-email`,className:Q,children:L.emailLabel}),(0,X.jsx)(`input`,{id:`forgot-email`,type:`email`,placeholder:L.emailPlaceholder,value:h,onChange:e=>g(e.target.value),required:!0,autoComplete:`email`,disabled:u,className:Z})]}),(0,X.jsxs)(`button`,{type:`submit`,disabled:u,className:kn,children:[u&&(0,X.jsx)($,{}),u?L.submittingButton:L.submitButton]}),x&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>oe(`phone`),className:`w-full text-center text-xs text-muted-foreground underline-offset-4 transition-colors hover:text-primary hover:underline`,children:L.usePhoneResetText})]}),n&&(0,X.jsxs)(`p`,{className:`px-8 text-center text-sm text-muted-foreground`,children:[L.rememberPasswordText,` `,(0,X.jsx)(s,{href:n,className:`font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:underline`,children:L.signInText})]})]})}function Yn(e){return e?e.name?e.name.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2):e.email?.[0]?.toUpperCase()??`?`:`?`}var Xn=[...s],Zn={[a]:{key:`organization.roles.owner`,defaultValue:`Owner`},[o]:{key:`organization.roles.admin`,defaultValue:`Admin`},[i]:{key:`organization.roles.delegatedAdmin`,defaultValue:`Delegated Admin`},[r]:{key:`organization.roles.member`,defaultValue:`Member`}},Qn=0,$n=1,er=2,tr=3;function nr(e){if(typeof e!=`string`)return Qn;let t=e.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean);if(t.length===0)return Qn;let n=$n;for(let e of t)e===`owner`?n=Math.max(n,tr):e===`admin`&&(n=Math.max(n,er));return n}function rr(e){let t=nr(e);return t<er?[r]:Xn.filter(e=>nr(e)<=t)}function ir(e,t){let n=nr(e);if(n<er)return[];let r=n>=tr;return!r&&nr(t)>=tr?[]:Xn.filter(e=>e!==`owner`||r)}function ar(e,t=`en`){let n=e instanceof Date?e:new Date(e),r=new Date,i=n.getTime()-r.getTime(),a=Math.round(i/1e3),o=Math.round(a/60),s=Math.round(o/60),c=Math.round(s/24),l=new Intl.RelativeTimeFormat(t,{numeric:`auto`});if(Math.abs(a)<60)return l.format(a,`second`);if(Math.abs(o)<60)return l.format(o,`minute`);if(Math.abs(s)<24)return l.format(s,`hour`);if(Math.abs(c)<30)return l.format(c,`day`);let u=Math.round(c/30);return Math.abs(u)<12?l.format(u,`month`):l.format(Math.round(c/365),`year`)}function or(e){if(!e)return!1;let t=e.objects;if(!t||typeof t!=`object`||Array.isArray(t))return!1;for(let e of Object.values(t))if(e&&typeof e==`object`&&!Array.isArray(e)&&`fields`in e)return!0;return!1}var sr=[`apps`,`messages`,`validationMessages`,`dashboards`,`globalActions`];function cr(e){let t={},n={},r={},i=e.objects;if(i)for(let[e,a]of Object.entries(i)){if(!a||typeof a!=`object`)continue;let i={};a.label&&(i.label=a.label),a.pluralLabel&&(i.pluralLabel=a.pluralLabel),a.description&&(i.description=a.description);for(let[e,t]of Object.entries(a))e.startsWith(`_`)&&(i[e]=t);if(t[e]=i,a.fields&&typeof a.fields==`object`){let t=Object.entries(a.fields);for(let[i,a]of t)a?.label&&(n[e]||(n[e]={}),n[e][i]=a.label),a?.options&&typeof a.options==`object`&&Object.keys(a.options).length>0&&(r[e]||(r[e]={}),r[e][i]=a.options)}}let a={};Object.keys(t).length>0&&(a.objects=t),Object.keys(n).length>0&&(a.fields=n),Object.keys(r).length>0&&(a.fieldOptions=r);for(let t of sr)e[t]!==void 0&&(a[t]=e[t]);let o=new Set([`objects`,...sr]);for(let[t,n]of Object.entries(e))o.has(t)||(a[t]=n);return{app:a}}var lr=(0,p.createContext)(null);lr.displayName=`PermissionContext`;var ur=`/api/v1/auth/me/permissions`;function dr({endpoint:e=ur,fetcher:t,initialPermissions:n,loadingFallback:r=null,errorFallback:i,maxRetries:a=3,retryBaseDelayMs:o=500,children:s}){let[m,h]=(0,p.useState)(n??null),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(!n),b=(0,p.useCallback)(async n=>{let r=()=>!n?.cancelled;y(!0),_(null);let i=t??fetch,s=Math.max(0,a)+1;for(let t=0;t<s;t++)try{let t=await i(e,{credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok)throw new c(t.status,l(t),`Permissions endpoint returned ${t.status}`);let n=await t.json();if(!r())return;h(n),y(!1);return}catch(e){let n=e instanceof Error?e:Error(String(e));if(!f(n)||t===s-1){if(!r())return;_(n),y(!1);return}let i=n instanceof c?n.retryAfterMs:void 0;if(await d(u(t,o,i)),!r())return}},[e,t,a,o]),x=(0,p.useCallback)(()=>{b()},[b]);(0,p.useEffect)(()=>{if(n)return;let e={cancelled:!1};return b(e),()=>{e.cancelled=!0}},[b,n]);let S=(0,p.useCallback)((e,t,n)=>{if(!m)return!1;let r=(e??``).toLowerCase(),i=`${r}.${t}`,a=m.fields?.[i]??m.fields?.[`${e}.${t}`];if(a)return n===`read`?a.readable!==!1:a.editable!==!1;let o=m.objects?.[r]??m.objects?.[e]??m.objects?.[`*`];return o?n===`read`?o.allowRead!==!1:o.allowEdit!==!1:m.authenticated!==!0},[m]),C=(0,p.useCallback)((e,t)=>{if(!m)return{allowed:!1,reason:`permissions-loading`};let n=m.objects?.[e]??m.objects?.[`*`],r={read:`allowRead`,view:`allowRead`,create:`allowCreate`,update:`allowEdit`,edit:`allowEdit`,delete:`allowDelete`,import:`allowCreate`,export:`allowRead`}[t]??`allowRead`,i=n?n[r]!==!1:m.authenticated!==!0;return{allowed:i,reason:i?void 0:`denied-by-permission-set`}},[m]),w=(0,p.useCallback)(e=>{if(!m)return[];let t=`${e}.`,n=[];for(let[e,r]of Object.entries(m.fields??{})){if(!e.startsWith(t))continue;let i=e.slice(t.length);n.push({field:i,read:r.readable!==!1,write:r.editable!==!1})}return n},[m]),T=(0,p.useCallback)(()=>void 0,[]),E=(0,p.useCallback)(e=>{if(!m)return;let t=(e??``).toLowerCase(),n=(m.objects?.[t]??m.objects?.[e])?.apiOperations;return Array.isArray(n)?n:void 0},[m]),ee=(0,p.useMemo)(()=>({check:C,checkField:S,getFieldPermissions:w,getRowFilter:T,getObjectApiOperations:E,roles:m?.roles??[],systemPermissions:m?.systemPermissions,hasCapabilities:e=>{let t=m?.systemPermissions;if(!Array.isArray(t))return!0;let n=new Set(t);return e.every(e=>n.has(e))},isLoaded:!v&&!g&&m!==null}),[C,S,w,T,E,m,v,g]);return v&&!m?(0,X.jsx)(X.Fragment,{children:r}):g&&!m?i?(0,X.jsx)(X.Fragment,{children:i(g,x)}):(0,X.jsx)(X.Fragment,{children:r}):(0,X.jsx)(lr.Provider,{value:ee,children:s})}function fr(){let e=(0,p.useContext)(lr);return(0,p.useMemo)(()=>e?{...e,can:(t,n)=>e.check(t,n).allowed,cannot:(t,n)=>!e.check(t,n).allowed}:{check:()=>({allowed:!0}),checkField:()=>!0,getFieldPermissions:()=>[],getRowFilter:()=>void 0,getObjectApiOperations:()=>void 0,roles:[],systemPermissions:void 0,hasCapabilities:()=>!0,isLoaded:!1,can:()=>!0,cannot:()=>!1},[e])}function pr(e){let{checkField:t,getFieldPermissions:n}=fr(),r=(0,p.useMemo)(()=>n(e),[n,e]);return(0,p.useMemo)(()=>({permissions:r,canRead:n=>t(e,n,`read`),canWrite:n=>t(e,n,`write`),readableFields:n=>n.filter(n=>t(e,n,`read`)),writableFields:n=>n.filter(n=>t(e,n,`write`))}),[r,t,e])}export{q as S,Dn as _,cr as a,Y as b,ir as c,Yn as d,Jn as f,On as g,Nn as h,or as i,rr as l,Hn as m,fr as n,ar as o,Gn as p,dr as r,Zn as s,pr as t,nr as u,wn as v,bn as x,Cn as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,F as t,G as n,H as r,I as i,M as a,P as o,Q as s,R as c,S as ee,Z as l,_ as u,b as d,f,g as p,it as m,j as h,k as g,l as _,q as v,rt as y,tt as b,v as te,w as ne,x as re,y as ie,z as x}from"./graphlib-DS17s2tU.js";var S=Object.create,ae=function(){function e(){}return function(t){if(!l(t))return{};if(S)return S(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function C(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function w(e,t,n){t==`__proto__`&&v?v(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var oe=Object.prototype.hasOwnProperty;function T(e,t,n){var i=e[t];(!(oe.call(e,t)&&r(i,n))||n===void 0&&!(t in e))&&w(e,t,n)}function E(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?w(n,s,c):T(n,s,c)}return n}function se(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var D=Object.prototype.hasOwnProperty;function ce(e){if(!l(e))return se(e);var t=c(e),n=[];for(var r in e)r==`constructor`&&(t||!D.call(e,r))||n.push(r);return n}function O(e){return x(e)?a(e,!0):ce(e)}var k=h(Object.getPrototypeOf,Object);function le(e,t){return e&&E(t,g(t),e)}function ue(e,t){return e&&E(t,O(t),e)}var A=typeof exports==`object`&&exports&&!exports.nodeType&&exports,j=A&&typeof module==`object`&&module&&!module.nodeType&&module,M=j&&j.exports===A?m.Buffer:void 0,N=M?M.allocUnsafe:void 0;function P(e,t){if(t)return e.slice();var n=e.length,r=N?N(n):new e.constructor(n);return e.copy(r),r}function de(e,t){return E(e,d(e),t)}var F=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ne(t,d(e)),e=k(e);return t}:re;function fe(e,t){return E(e,F(e),t)}function pe(e){return ie(e,O,F)}var I=Object.prototype.hasOwnProperty;function L(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&I.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function R(e){var t=new e.constructor(e.byteLength);return new p(t).set(new p(e)),t}function z(e,t){var n=t?R(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var B=/\w*$/;function me(e){var t=new e.constructor(e.source,B.exec(e));return t.lastIndex=e.lastIndex,t}var V=y?y.prototype:void 0,H=V?V.valueOf:void 0;function he(e){return H?Object(H.call(e)):{}}function U(e,t){var n=t?R(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var ge=`[object Boolean]`,_e=`[object Date]`,ve=`[object Map]`,ye=`[object Number]`,be=`[object RegExp]`,xe=`[object Set]`,Se=`[object String]`,Ce=`[object Symbol]`,we=`[object ArrayBuffer]`,Te=`[object DataView]`,Ee=`[object Float32Array]`,De=`[object Float64Array]`,Oe=`[object Int8Array]`,ke=`[object Int16Array]`,Ae=`[object Int32Array]`,je=`[object Uint8Array]`,Me=`[object Uint8ClampedArray]`,Ne=`[object Uint16Array]`,Pe=`[object Uint32Array]`;function Fe(e,t,n){var r=e.constructor;switch(t){case we:return R(e);case ge:case _e:return new r(+e);case Te:return z(e,n);case Ee:case De:case Oe:case ke:case Ae:case je:case Me:case Ne:case Pe:return U(e,n);case ve:return new r;case ye:case Se:return new r(e);case be:return me(e);case xe:return new r;case Ce:return he(e)}}function W(e){return typeof e.constructor==`function`&&!c(e)?ae(k(e)):{}}var Ie=`[object Map]`;function Le(e){return b(e)&&u(e)==Ie}var G=o&&o.isMap,Re=G?t(G):Le,ze=`[object Set]`;function Be(e){return b(e)&&u(e)==ze}var K=o&&o.isSet,Ve=K?t(K):Be,He=1,Ue=2,We=4,q=`[object Arguments]`,Ge=`[object Array]`,Ke=`[object Boolean]`,qe=`[object Date]`,Je=`[object Error]`,J=`[object Function]`,Ye=`[object GeneratorFunction]`,Xe=`[object Map]`,Ze=`[object Number]`,Y=`[object Object]`,Qe=`[object RegExp]`,$e=`[object Set]`,et=`[object String]`,tt=`[object Symbol]`,nt=`[object WeakMap]`,rt=`[object ArrayBuffer]`,it=`[object DataView]`,X=`[object Float32Array]`,at=`[object Float64Array]`,ot=`[object Int8Array]`,st=`[object Int16Array]`,ct=`[object Int32Array]`,lt=`[object Uint8Array]`,ut=`[object Uint8ClampedArray]`,dt=`[object Uint16Array]`,ft=`[object Uint32Array]`,Z={};Z[q]=Z[Ge]=Z[rt]=Z[it]=Z[Ke]=Z[qe]=Z[X]=Z[at]=Z[ot]=Z[st]=Z[ct]=Z[Xe]=Z[Ze]=Z[Y]=Z[Qe]=Z[$e]=Z[et]=Z[tt]=Z[lt]=Z[ut]=Z[dt]=Z[ft]=!0,Z[Je]=Z[J]=Z[nt]=!1;function Q(e,t,r,a,o,c){var d,f=t&He,p=t&Ue,m=t&We;if(r&&(d=o?r(e,a,o,c):r(e)),d!==void 0)return d;if(!l(e))return e;var h=s(e);if(h){if(d=L(e),!f)return C(e,d)}else{var _=u(e),v=_==J||_==Ye;if(i(e))return P(e,f);if(_==Y||_==q||v&&!o){if(d=p||v?{}:W(e),!f)return p?fe(e,ue(d,e)):de(e,le(d,e))}else{if(!Z[_])return o?e:{};d=Fe(e,_,f)}}c||=new ee;var y=c.get(e);if(y)return y;c.set(e,d),Ve(e)?e.forEach(function(n){d.add(Q(n,t,r,n,e,c))}):Re(e)&&e.forEach(function(n,i){d.set(i,Q(n,t,r,i,e,c))});var b=h?void 0:(m?p?pe:te:p?O:g)(e);return n(b||e,function(n,i){b&&(i=n,n=e[i]),T(d,i,Q(n,t,r,i,e,c))}),d}function $(e,t){var n=-1,r=x(e)?Array(e.length):[];return _(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function pt(t,n){return(s(t)?e:$)(t,f(n,3))}export{U as a,O as c,w as d,C as f,W as i,E as l,$ as n,P as o,Q as r,k as s,pt as t,T as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e}from"./plugin-chatbot-Cq7rZtnW.js";export{e as Mermaid};
|