docs-i18n 0.11.1 → 0.12.1
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/admin/app/lib/auth-client.ts +1 -1
- package/admin/app/lib/auth.server.ts +51 -1
- package/admin/app/server.ts +4 -1
- package/admin/dist/client/assets/{auth-client-DqJZaFZR.js → auth-client-ChAoRxRf.js} +1 -1
- package/admin/dist/client/assets/{login-CQjkiBAF.js → login-DpI70f1L.js} +1 -1
- package/admin/dist/client/assets/{main-bc5tcdGg.js → main-HccfHTVt.js} +2 -2
- package/admin/dist/client/assets/{routes-CTPOG_v1.js → routes-D1wZzUqP.js} +1 -1
- package/admin/dist/server/assets/Match-jV7Q5nbh.js +3236 -0
- package/admin/dist/server/assets/{__tanstack-start-server-fn-resolver-N1N5mZVv.js → __tanstack-start-server-fn-resolver-BDlz7b4M.js} +18 -18
- package/admin/dist/server/assets/{_tanstack-start-manifest_v-BgMVPPt2.js → _tanstack-start-manifest_v-CZNmyv5h.js} +4 -4
- package/admin/dist/server/assets/{adapter-DjXlUL1J.js → adapter-Btzrjxp2.js} +1 -1
- package/admin/dist/server/assets/auth-Hlc_ErDZ.js +40 -0
- package/admin/dist/server/assets/{auth-client-CoUpyQIM.js → auth-client-DZADgYlJ.js} +3 -3
- package/admin/dist/server/assets/auth.server-C-Ece-zJ.js +2 -0
- package/admin/dist/server/assets/{auth.server-BLVDnTCZ.js → auth.server-C5kH0jex.js} +53 -12
- package/admin/dist/server/assets/{bun-sqlite-dialect-C8OaCWSL-BNNY-FoT.js → bun-sqlite-dialect-C8OaCWSL-kcfNhLVL.js} +2 -2
- package/admin/dist/server/assets/{compiled-query-CnFG_BVV.js → compiled-query-BniCsfyw.js} +1 -1
- package/admin/dist/server/assets/createServerFn-CAF9Kl7K.js +370 -0
- package/admin/dist/server/assets/{createServerRpc-Cyyxq9HQ.js → createServerRpc-D1Slsi4e.js} +1 -1
- package/admin/dist/server/assets/{d1-sqlite-dialect-sYHNqBte-Bjz-cybU.js → d1-sqlite-dialect-sYHNqBte-DH7CDIkk.js} +2 -2
- package/admin/dist/server/assets/{dist-DBv71kqn.js → dist-3sjmTS6w.js} +8321 -106
- package/admin/dist/server/assets/{dist-CUzFWZag.js → dist-B_54zSkq.js} +8 -8
- package/admin/dist/server/assets/dist-CaR9v9w1.js +2 -0
- package/admin/dist/server/assets/{dist-C3-e8E2B.js → dist-D3NMliQC.js} +2 -2
- package/admin/dist/server/assets/{error-codes-BhMTGvV6.js → error-codes-Dw4P_cJu.js} +1 -1
- package/admin/dist/server/assets/init-CSXxGq7r.js +2 -0
- package/admin/dist/server/assets/{init-CJJUsPDL.js → init-QOUAlWr8.js} +3 -3
- package/admin/dist/server/assets/{jobs-DrEe9YOj.js → jobs-CcwecqaK.js} +5 -5
- package/admin/dist/server/assets/{kysely-adapter-YC8RFPyc.js → kysely-adapter-DZDLFHLq.js} +1 -1
- package/admin/dist/server/assets/{login-SqzTMYOZ.js → login-BMn8hY2z.js} +2 -2
- package/admin/dist/server/assets/{misc-BSoYldBT.js → misc-leinq0id.js} +5 -5
- package/admin/dist/server/assets/{models-CoviNHUP.js → models-DTJbdHu7.js} +2 -2
- package/admin/dist/server/assets/{node-sqlite-dialect-BJIaP6lL.js → node-sqlite-dialect-CTaKW6AP.js} +2 -2
- package/admin/dist/server/assets/request-response-Bj40K48O.js +589 -0
- package/admin/dist/server/assets/{router-Cxm33tn3.js → router-DWZHm_v_.js} +4 -4
- package/admin/dist/server/assets/{routes-DtWFPDUc.js → routes-CUOd2KKc.js} +4 -8
- package/admin/dist/server/assets/{routes-CxGhew8Z.js → routes-DMh4pkeO.js} +4 -4
- package/admin/dist/server/assets/{sqlite-adapter-CL2EidjD.js → sqlite-adapter-C24CHMIE.js} +1 -1
- package/admin/dist/server/assets/{status-B1AGLvHn.js → status-Bdrqzx_H.js} +2 -2
- package/admin/dist/server/assets/status-C_h82YTJ.js +2 -0
- package/admin/dist/server/assets/{status-D7PU72hm.js → status-VBCTGlIL.js} +4 -4
- package/admin/dist/server/server.js +77 -4233
- package/admin/server/functions/auth.ts +0 -48
- package/admin/vite.config.ts +9 -5
- package/dist/chunk-BHYFOPS6.js +111 -0
- package/dist/cli.js +44 -5
- package/dist/index.d.ts +108 -1
- package/dist/index.js +224 -1
- package/dist/pipeline-3XGFR4QL.js +104 -0
- package/dist/{rescan-HXMWFAOC.js → rescan-7XDHUNH5.js} +33 -2
- package/dist/runner-KUGSO4CL.js +10 -0
- package/package.json +2 -1
- package/template/dist/client/assets/{Doc-CbmLeLjl.js → Doc-BKO69_nz.js} +1 -1
- package/template/dist/client/assets/{DocsLayout-ERG7nrAc.js → DocsLayout-BGugXxEQ.js} +1 -1
- package/template/dist/client/assets/{FileTabs-CCynw0nL.js → FileTabs-4fZriOj4.js} +1 -1
- package/template/dist/client/assets/{Footer-l6Y8-ltB.js → Footer-DYh1AfWA.js} +1 -1
- package/template/dist/client/assets/{FrameworkContent-pNf68F7f.js → FrameworkContent-rVvjxASn.js} +1 -1
- package/template/dist/client/assets/{MarkdownHeadingContext-6I862CKH.js → MarkdownHeadingContext-CdvUDZFU.js} +4 -4
- package/template/dist/client/assets/{PostNotFound-ScC0039d.js → PostNotFound-WoSYGsGu.js} +1 -1
- package/template/dist/client/assets/{_basePickBy-B-GcvGxW.js → _basePickBy-Dd7GuR7A.js} +1 -1
- package/template/dist/client/assets/{_baseUniq-C1WySGZQ.js → _baseUniq-DMxQLGFI.js} +1 -1
- package/template/dist/client/assets/_lang-3AqGszEy.js +1 -0
- package/template/dist/client/assets/_lang._project-COkrIqzH.js +1 -0
- package/template/dist/client/assets/_lang._project._version-B8vRZczu.js +1 -0
- package/template/dist/client/assets/{_lang._project._version.docs-aw08dKvN.js → _lang._project._version.docs-DokNGgvU.js} +1 -1
- package/template/dist/client/assets/{_lang._project._version.docs._-B4Vb_S0V.js → _lang._project._version.docs._-CXCNZzOb.js} +1 -1
- package/template/dist/client/assets/_lang._project._version.docs._-DR0WSQEb.js +1 -0
- package/template/dist/client/assets/_lang._project._version.docs.framework._framework._-C_Grro8r.js +1 -0
- package/template/dist/client/assets/{_lang._project._version.docs.framework._framework.index-DInYPTXM.js → _lang._project._version.docs.framework._framework.index-DsYjXRdj.js} +1 -1
- package/template/dist/client/assets/{_lang._project._version.docs.framework.index-B7EvJmBI.js → _lang._project._version.docs.framework.index-DQX1lBi3.js} +1 -1
- package/template/dist/client/assets/{_lang._project.docs-4oX3ADgu.js → _lang._project.docs-DsYQj9jI.js} +1 -1
- package/template/dist/client/assets/_lang._project.docs._-DlM_D6DD.js +1 -0
- package/template/dist/client/assets/{_lang._project.docs._-emq0IsQw.js → _lang._project.docs._-l2tTjx80.js} +1 -1
- package/template/dist/client/assets/_lang.blog-CEwEtalL.js +1 -0
- package/template/dist/client/assets/_lang.blog-D6YGC3tK.js +1 -0
- package/template/dist/client/assets/_lang.blog._-DgHu4oLy.js +1 -0
- package/template/dist/client/assets/{_lang.blog._-DErizs7q.js → _lang.blog._-Umz18sQE.js} +1 -1
- package/template/dist/client/assets/_lang.blog.index-C8LKUFtD.js +1 -0
- package/template/dist/client/assets/{_lang.blog.index-DZDuDkQr.js → _lang.blog.index-DzUqpOBE.js} +1 -1
- package/template/dist/client/assets/{_lang.docs-CQK0rfqt.js → _lang.docs-CUh3R7DD.js} +1 -1
- package/template/dist/client/assets/{_lang.docs._-BiCvgeV1.js → _lang.docs._-DlgTPy3s.js} +1 -1
- package/template/dist/client/assets/_lang.docs._-DmaQE7lx.js +1 -0
- package/template/dist/client/assets/_lang.docs.framework._framework._-B4C4uDFp.js +1 -0
- package/template/dist/client/assets/{_lang.docs.framework._framework.index-Bu5p5Q_r.js → _lang.docs.framework._framework.index-DTg6Xd3p.js} +1 -1
- package/template/dist/client/assets/{_lang.docs.framework.index-uTDFLagP.js → _lang.docs.framework.index-BQ2enasl.js} +1 -1
- package/template/dist/client/assets/{arc-C16C7aa3.js → arc-DGPgC_QF.js} +1 -1
- package/template/dist/client/assets/{architectureDiagram-2XIMDMQ5-DgSSDH9Z.js → architectureDiagram-2XIMDMQ5-yI53_GAi.js} +1 -1
- package/template/dist/client/assets/{blockDiagram-WCTKOSBZ-Bs8e58Or.js → blockDiagram-WCTKOSBZ-C3tr24zy.js} +1 -1
- package/template/dist/client/assets/{c4Diagram-IC4MRINW-DsGaAPtm.js → c4Diagram-IC4MRINW-DOA-mowm.js} +1 -1
- package/template/dist/client/assets/channel-DzZD7dUQ.js +1 -0
- package/template/dist/client/assets/{chunk-4BX2VUAB-BQdq93Vq.js → chunk-4BX2VUAB-B6NSnNJJ.js} +1 -1
- package/template/dist/client/assets/{chunk-55IACEB6-zjp4uUiZ.js → chunk-55IACEB6-CWYwArBH.js} +1 -1
- package/template/dist/client/assets/{chunk-FMBD7UC4-CEdYlBOF.js → chunk-FMBD7UC4-DSyn2wIW.js} +1 -1
- package/template/dist/client/assets/{chunk-JSJVCQXG-CVkDw9ls.js → chunk-JSJVCQXG-D83nm5W0.js} +1 -1
- package/template/dist/client/assets/{chunk-KX2RTZJC--1vKv-mr.js → chunk-KX2RTZJC-DD7fN9e9.js} +1 -1
- package/template/dist/client/assets/{chunk-NQ4KR5QH-Cpo-W18l.js → chunk-NQ4KR5QH-C3YlYiU5.js} +1 -1
- package/template/dist/client/assets/{chunk-QZHKN3VN-BizWJuB4.js → chunk-QZHKN3VN-B7wBEuCG.js} +1 -1
- package/template/dist/client/assets/{chunk-WL4C6EOR-6lLYa9R1.js → chunk-WL4C6EOR-ByA1FloT.js} +1 -1
- package/template/dist/client/assets/classDiagram-VBA2DB6C-CRozKaUD.js +1 -0
- package/template/dist/client/assets/classDiagram-v2-RAHNMMFH-CRozKaUD.js +1 -0
- package/template/dist/client/assets/clone-CGnOEl4E.js +1 -0
- package/template/dist/client/assets/{cose-bilkent-S5V4N54A-CaD0EGPJ.js → cose-bilkent-S5V4N54A-nt_sXfWc.js} +1 -1
- package/template/dist/client/assets/{dagre-KLK3FWXG-h4F9WtDQ.js → dagre-KLK3FWXG-DUsyMTPd.js} +1 -1
- package/template/dist/client/assets/{diagram-E7M64L7V-CBUSWzH5.js → diagram-E7M64L7V-D5SAypX0.js} +1 -1
- package/template/dist/client/assets/{diagram-IFDJBPK2-C5oMubv0.js → diagram-IFDJBPK2-WhP5c8Vz.js} +1 -1
- package/template/dist/client/assets/{diagram-P4PSJMXO-DdPwwhHR.js → diagram-P4PSJMXO-AMrwIlhf.js} +1 -1
- package/template/dist/client/assets/{erDiagram-INFDFZHY-0U5A-RF0.js → erDiagram-INFDFZHY-BxifSpCV.js} +1 -1
- package/template/dist/client/assets/{flowDiagram-PKNHOUZH-CXN3pvSW.js → flowDiagram-PKNHOUZH-BMAowE9I.js} +1 -1
- package/template/dist/client/assets/{ganttDiagram-A5KZAMGK-DlovlSO7.js → ganttDiagram-A5KZAMGK-Bay-0iRq.js} +1 -1
- package/template/dist/client/assets/{gitGraphDiagram-K3NZZRJ6-Bo-Jjy7v.js → gitGraphDiagram-K3NZZRJ6-Va91W3gw.js} +1 -1
- package/template/dist/client/assets/{graph-C0TauvuO.js → graph-CbBYObK_.js} +1 -1
- package/template/dist/client/assets/{index-iATq4LEm.js → index-CF6qz2tX.js} +1 -1
- package/template/dist/client/assets/{infoDiagram-LFFYTUFH-BbvPzztn.js → infoDiagram-LFFYTUFH-Byd5C-4U.js} +1 -1
- package/template/dist/client/assets/{ishikawaDiagram-PHBUUO56-DKCMONMO.js → ishikawaDiagram-PHBUUO56-DxOKnE1v.js} +1 -1
- package/template/dist/client/assets/{journeyDiagram-4ABVD52K-D9NP_vvu.js → journeyDiagram-4ABVD52K-IRmt7RI4.js} +1 -1
- package/template/dist/client/assets/{kanban-definition-K7BYSVSG-X-u_nWxK.js → kanban-definition-K7BYSVSG-BjTVXn-R.js} +1 -1
- package/template/dist/client/assets/{layout-IeRzBrUX.js → layout-Bbx6A0bC.js} +1 -1
- package/template/dist/client/assets/{linear-DEzVUeiK.js → linear-Df2eAW4A.js} +1 -1
- package/template/dist/client/assets/{main-Csj9i19C.js → main-DqZtiCro.js} +2 -2
- package/template/dist/client/assets/{mermaid.core-CCnh2DG0.js → mermaid.core-BIoiBcAA.js} +4 -4
- package/template/dist/client/assets/{mindmap-definition-YRQLILUH-DgyN4Ft-.js → mindmap-definition-YRQLILUH-Btzz0iIP.js} +1 -1
- package/template/dist/client/assets/ordinal-Cboi1Yqb.js +1 -0
- package/template/dist/client/assets/{pieDiagram-SKSYHLDU-DDVqU_2Q.js → pieDiagram-SKSYHLDU-C2amrGtU.js} +1 -1
- package/template/dist/client/assets/{quadrantDiagram-337W2JSQ-BeUxMqle.js → quadrantDiagram-337W2JSQ-EVgH9VuN.js} +1 -1
- package/template/dist/client/assets/{react-os8EX6z1.js → react-qvbbiZob.js} +1 -1
- package/template/dist/client/assets/{requirementDiagram-Z7DCOOCP-CpzdlyEd.js → requirementDiagram-Z7DCOOCP-BkYPbRis.js} +1 -1
- package/template/dist/client/assets/{sankeyDiagram-WA2Y5GQK-CmSWF6XU.js → sankeyDiagram-WA2Y5GQK-B5EIaP-h.js} +1 -1
- package/template/dist/client/assets/{sequenceDiagram-2WXFIKYE-DarofLka.js → sequenceDiagram-2WXFIKYE-BC33VGOc.js} +1 -1
- package/template/dist/client/assets/{stateDiagram-RAJIS63D-CEio2h-7.js → stateDiagram-RAJIS63D-DiKvWUYb.js} +1 -1
- package/template/dist/client/assets/stateDiagram-v2-FVOUBMTO-DjKMPYGe.js +1 -0
- package/template/dist/client/assets/{timeline-definition-YZTLITO2-By_Wk6uc.js → timeline-definition-YZTLITO2-QiFlgbRA.js} +1 -1
- package/template/dist/client/assets/{treemap-KZPCXAKY-mKcaMbv9.js → treemap-KZPCXAKY-BOYbyS9G.js} +1 -1
- package/template/dist/client/assets/{vennDiagram-LZ73GAT5-Dx_Fh7nH.js → vennDiagram-LZ73GAT5-CqmW7j4r.js} +1 -1
- package/template/dist/client/assets/{xychartDiagram-JWTSCODW-DSAwWbBw.js → xychartDiagram-JWTSCODW-gj6oWX8l.js} +1 -1
- package/template/dist/server/assets/{Doc-B8TJBEmx.js → Doc-9tJiX5y6.js} +3 -3
- package/template/dist/server/assets/{DocsLayout-CnWgvk8u.js → DocsLayout-BTjhU_W5.js} +2 -2
- package/template/dist/server/assets/{Footer-WapWK45U.js → Footer-CefTi2yh.js} +1 -1
- package/template/dist/server/assets/{FrameworkContent-gzqT-Q1n.js → FrameworkContent-BkJvuP04.js} +2 -2
- package/template/dist/server/assets/{MarkdownHeadingContext-Iyk66Y4x.js → MarkdownHeadingContext-37oQpb36.js} +3 -3
- package/template/dist/server/assets/{PostNotFound-GKdNuzsX.js → PostNotFound-BqBZf83v.js} +1 -1
- package/template/dist/server/assets/{_basePickBy-DJ9gzwF8.js → _basePickBy-DZ3TPUta.js} +2 -2
- package/template/dist/server/assets/{_baseUniq-CezmbvU2.js → _baseUniq-DKicWTQT.js} +1 -1
- package/template/dist/server/assets/{_lang._project._version.docs-BOZ34yW7.js → _lang._project._version.docs-U-t4mk5_.js} +3 -3
- package/template/dist/server/assets/{_lang._project._version.docs._-5W2jN7Re.js → _lang._project._version.docs._-DMgnElWM.js} +5 -5
- package/template/dist/server/assets/{_lang._project._version.docs.framework._framework._-DeN_oA8l.js → _lang._project._version.docs.framework._framework._-kBw_9L-F.js} +5 -5
- package/template/dist/server/assets/{_lang._project._version.docs.framework._framework.index-jWKDCQSE.js → _lang._project._version.docs.framework._framework.index-Bsyj0DD5.js} +1 -1
- package/template/dist/server/assets/{_lang._project._version.docs.framework.index-DOT4MtjZ.js → _lang._project._version.docs.framework.index-CmLAP_Io.js} +1 -1
- package/template/dist/server/assets/{_lang._project.docs-r4V9TXuu.js → _lang._project.docs-Bb4ZZ_jr.js} +3 -3
- package/template/dist/server/assets/{_lang._project.docs._-Bge7JaYE.js → _lang._project.docs._-ChrpJ61j.js} +5 -5
- package/template/dist/server/assets/{_lang.blog-DJOfiyA8.js → _lang.blog-8j6IvzvQ.js} +2 -2
- package/template/dist/server/assets/{_lang.blog._-yJSqbX08.js → _lang.blog._-BPzP97Ac.js} +2 -2
- package/template/dist/server/assets/{_lang.blog._-C7iqMj9O.js → _lang.blog._-DNX8UglA.js} +2 -2
- package/template/dist/server/assets/{_lang.blog.index-Df_6_IKx.js → _lang.blog.index-CeZnMJBi.js} +1 -1
- package/template/dist/server/assets/{_lang.blog.index-CrdyROhK.js → _lang.blog.index-DzVKqoC4.js} +2 -2
- package/template/dist/server/assets/{_lang.docs-Jwt4deTW.js → _lang.docs-B4StnHMb.js} +3 -3
- package/template/dist/server/assets/{_lang.docs._-D_DdKLAV.js → _lang.docs._--c0In1AT.js} +5 -5
- package/template/dist/server/assets/{_lang.docs.framework._framework._-BkQaZ_1f.js → _lang.docs.framework._framework._-Be0U7cDg.js} +5 -5
- package/template/dist/server/assets/{_lang.docs.framework._framework.index-BLx8p8IS.js → _lang.docs.framework._framework.index-BZ512aSk.js} +1 -1
- package/template/dist/server/assets/{_lang.docs.framework.index-BytQ_q8T.js → _lang.docs.framework.index-U8z3j4kz.js} +1 -1
- package/template/dist/server/assets/{_tanstack-start-manifest_v-RX6ItZ5S.js → _tanstack-start-manifest_v-DXpQ8503.js} +1 -1
- package/template/dist/server/assets/{arc-BwftnT5H.js → arc-B4h6h_n6.js} +1 -1
- package/template/dist/server/assets/{architecture-PBZL5I3N-KbDVC6gM.js → architecture-PBZL5I3N-CUwqLXkR.js} +6 -6
- package/template/dist/server/assets/{architectureDiagram-2XIMDMQ5-BoLvWxb3.js → architectureDiagram-2XIMDMQ5-CuCoxdBe.js} +6 -6
- package/template/dist/server/assets/{blockDiagram-WCTKOSBZ-GPFcXs-f.js → blockDiagram-WCTKOSBZ-D5PsUOim.js} +6 -6
- package/template/dist/server/assets/{c4Diagram-IC4MRINW-EQwQCspo.js → c4Diagram-IC4MRINW-CXy5xO3o.js} +2 -2
- package/template/dist/server/assets/{channel-CxvwuPH7.js → channel-D0l-mWaF.js} +1 -1
- package/template/dist/server/assets/{chunk-4BX2VUAB-DUgcw5ei.js → chunk-4BX2VUAB-M7FVHMss.js} +1 -1
- package/template/dist/server/assets/{chunk-55IACEB6-Cn15uD91.js → chunk-55IACEB6-D_gDAje5.js} +1 -1
- package/template/dist/server/assets/{chunk-FMBD7UC4-Ck3iyLPu.js → chunk-FMBD7UC4-B5Bebx-Y.js} +1 -1
- package/template/dist/server/assets/{chunk-JSJVCQXG-VAT8yncE.js → chunk-JSJVCQXG-DxBkq-uB.js} +1 -1
- package/template/dist/server/assets/{chunk-KX2RTZJC-B1bd2VmA.js → chunk-KX2RTZJC-BMHm1EGi.js} +1 -1
- package/template/dist/server/assets/{chunk-NQ4KR5QH-CR67GG9C.js → chunk-NQ4KR5QH-Cp28pTwT.js} +3 -3
- package/template/dist/server/assets/{chunk-QZHKN3VN-B9SSazM4.js → chunk-QZHKN3VN-Bq5GZqaR.js} +1 -1
- package/template/dist/server/assets/{chunk-WL4C6EOR-DZ4Pjuao.js → chunk-WL4C6EOR-C9Nj5GdW.js} +5 -5
- package/template/dist/server/assets/{classDiagram-VBA2DB6C-CA6_4Wb2.js → classDiagram-VBA2DB6C-CUchv9T5.js} +6 -6
- package/template/dist/server/assets/{classDiagram-v2-RAHNMMFH-CA6_4Wb2.js → classDiagram-v2-RAHNMMFH-CUchv9T5.js} +6 -6
- package/template/dist/server/assets/{clone-DJHP_iVy.js → clone-CJcTi58S.js} +1 -1
- package/template/dist/server/assets/{cose-bilkent-S5V4N54A-DtU-cN6W.js → cose-bilkent-S5V4N54A-CxvCMhN_.js} +1 -1
- package/template/dist/server/assets/{dagre-KLK3FWXG-yZYrVU4p.js → dagre-KLK3FWXG-B5bQP7FL.js} +6 -6
- package/template/dist/server/assets/{diagram-E7M64L7V-8Yyz0aw0.js → diagram-E7M64L7V-NjHca90S.js} +8 -8
- package/template/dist/server/assets/{diagram-IFDJBPK2-DcxFYI3M.js → diagram-IFDJBPK2-CoTCfBKd.js} +6 -6
- package/template/dist/server/assets/{diagram-P4PSJMXO-CehxUcI0.js → diagram-P4PSJMXO-DHvGgYjH.js} +6 -6
- package/template/dist/server/assets/{erDiagram-INFDFZHY-Bu2p1_Pj.js → erDiagram-INFDFZHY-01crajKr.js} +4 -4
- package/template/dist/server/assets/{flowDiagram-PKNHOUZH-B_eKR7I0.js → flowDiagram-PKNHOUZH-BkUQ_vxg.js} +6 -6
- package/template/dist/server/assets/{ganttDiagram-A5KZAMGK-DP6YEZof.js → ganttDiagram-A5KZAMGK-DvrO-w2P.js} +2 -2
- package/template/dist/server/assets/{gitGraph-HDMCJU4V-Bt0qhVL4.js → gitGraph-HDMCJU4V-h9JNaxB7.js} +6 -6
- package/template/dist/server/assets/{gitGraphDiagram-K3NZZRJ6-DwvkdYrg.js → gitGraphDiagram-K3NZZRJ6-BoKm6Fm-.js} +7 -7
- package/template/dist/server/assets/{graph-BVFNe_k5.js → graph-BoxbfI7Z.js} +2 -2
- package/template/dist/server/assets/{index-DvBGSZeA.js → index-Jfzi6SZW.js} +2 -2
- package/template/dist/server/assets/{info-3K5VOQVL-CFejRnvB.js → info-3K5VOQVL-DgaSHqkS.js} +6 -6
- package/template/dist/server/assets/{infoDiagram-LFFYTUFH-D0v9uyXI.js → infoDiagram-LFFYTUFH-DgV5W8-I.js} +5 -5
- package/template/dist/server/assets/{ishikawaDiagram-PHBUUO56-DZumspL4.js → ishikawaDiagram-PHBUUO56-CqlMQ0Fq.js} +1 -1
- package/template/dist/server/assets/{journeyDiagram-4ABVD52K-nRp_-qZp.js → journeyDiagram-4ABVD52K-D6ySTub8.js} +4 -4
- package/template/dist/server/assets/{kanban-definition-K7BYSVSG-BMKyyzjt.js → kanban-definition-K7BYSVSG-BT8m7Cwk.js} +2 -2
- package/template/dist/server/assets/{layout-mpiN5R-5.js → layout-CkYcErfn.js} +4 -4
- package/template/dist/server/assets/{linear-CqNYgjEx.js → linear-F_0dWGZL.js} +1 -1
- package/template/dist/server/assets/{mermaid-parser.core-B8Uu3QZY.js → mermaid-parser.core-q5MdUJuo.js} +11 -11
- package/template/dist/server/assets/{mermaid.core-BI3nMhNO.js → mermaid.core-DOWTODR1.js} +31 -31
- package/template/dist/server/assets/{mindmap-definition-YRQLILUH-DCoFqLPh.js → mindmap-definition-YRQLILUH-BQxlQqn-.js} +3 -3
- package/template/dist/server/assets/{ordinal-Bcam90FY.js → ordinal-CxptdPJm.js} +1 -1
- package/template/dist/server/assets/{packet-RMMSAZCW-djgonfKN.js → packet-RMMSAZCW-D8FkLZuP.js} +6 -6
- package/template/dist/server/assets/{pie-UPGHQEXC-Dug2t-PE.js → pie-UPGHQEXC-Diw2fHLk.js} +6 -6
- package/template/dist/server/assets/{pieDiagram-SKSYHLDU-CS0_hW4w.js → pieDiagram-SKSYHLDU-B1J4UJZ7.js} +8 -8
- package/template/dist/server/assets/{quadrantDiagram-337W2JSQ-BpQNM0zu.js → quadrantDiagram-337W2JSQ-BvjKLapg.js} +2 -2
- package/template/dist/server/assets/{radar-KQ55EAFF-3ir2W9Wi.js → radar-KQ55EAFF-CcBdPU3n.js} +6 -6
- package/template/dist/server/assets/{requirementDiagram-Z7DCOOCP-D92RyjV4.js → requirementDiagram-Z7DCOOCP-Bgr_wnAs.js} +3 -3
- package/template/dist/server/assets/{router-DPPgDicW.js → router-DxwPl-Dc.js} +18 -18
- package/template/dist/server/assets/{sankeyDiagram-WA2Y5GQK-DCPRB-xO.js → sankeyDiagram-WA2Y5GQK-B0UwtyW3.js} +2 -2
- package/template/dist/server/assets/{sequenceDiagram-2WXFIKYE-C1ab2VvU.js → sequenceDiagram-2WXFIKYE-BbxQJHjO.js} +3 -3
- package/template/dist/server/assets/{stateDiagram-RAJIS63D-GhG1G3ff.js → stateDiagram-RAJIS63D-Cg-uJ_UO.js} +8 -8
- package/template/dist/server/assets/{stateDiagram-v2-FVOUBMTO-C-KtMadV.js → stateDiagram-v2-FVOUBMTO-BWVPrqfa.js} +4 -4
- package/template/dist/server/assets/{timeline-definition-YZTLITO2-DyfAQCd4.js → timeline-definition-YZTLITO2-DCSJT2WT.js} +2 -2
- package/template/dist/server/assets/{treemap-KZPCXAKY-Cn0Cw4Cl.js → treemap-KZPCXAKY-a0nhlKgx.js} +6 -6
- package/template/dist/server/assets/{vennDiagram-LZ73GAT5-D2Ak5JUa.js → vennDiagram-LZ73GAT5-Bk2HQEQq.js} +1 -1
- package/template/dist/server/assets/{xychartDiagram-JWTSCODW-DqoBOs1L.js → xychartDiagram-JWTSCODW-C4svHkt_.js} +3 -3
- package/template/dist/server/server.js +7 -6
- package/admin/dist/server/assets/auth-dSAIPjBw.js +0 -72
- package/template/dist/client/assets/_lang-B3tRf7os.js +0 -1
- package/template/dist/client/assets/_lang._project-CH0inpmY.js +0 -1
- package/template/dist/client/assets/_lang._project._version-CESvrqds.js +0 -1
- package/template/dist/client/assets/_lang._project._version.docs._-BexMyJr9.js +0 -1
- package/template/dist/client/assets/_lang._project._version.docs.framework._framework._-BbQgUWTH.js +0 -1
- package/template/dist/client/assets/_lang._project.docs._-R9bOn492.js +0 -1
- package/template/dist/client/assets/_lang.blog-BViCs72M.js +0 -1
- package/template/dist/client/assets/_lang.blog-DhVkwYEk.js +0 -1
- package/template/dist/client/assets/_lang.blog._-BHdaHDBU.js +0 -1
- package/template/dist/client/assets/_lang.blog.index-CELEUrkj.js +0 -1
- package/template/dist/client/assets/_lang.docs._-axvS_dfl.js +0 -1
- package/template/dist/client/assets/_lang.docs.framework._framework._-D2FAQ0gW.js +0 -1
- package/template/dist/client/assets/channel-Clrp6Lr4.js +0 -1
- package/template/dist/client/assets/classDiagram-VBA2DB6C-Beq6_jEy.js +0 -1
- package/template/dist/client/assets/classDiagram-v2-RAHNMMFH-Beq6_jEy.js +0 -1
- package/template/dist/client/assets/clone-BbBu6MzK.js +0 -1
- package/template/dist/client/assets/ordinal-BENe2yWM.js +0 -1
- package/template/dist/client/assets/stateDiagram-v2-FVOUBMTO-CbfK0_BD.js +0 -1
- package/admin/dist/server/assets/{error-CASJ5tIm.js → error-CxLURp5B.js} +0 -0
- package/admin/dist/server/assets/{job-manager-D9Ab9hgu.js → job-manager-3L0YHdRR.js} +0 -0
- package/admin/dist/server/assets/{migrator-ZpVZslbq.js → migrator-6o36lk3A.js} +0 -0
- package/admin/dist/server/assets/{start-BiybVoR2.js → start-BYRsG6Vf.js} +0 -0
- package/admin/dist/server/assets/{string-B4XlckmJ.js → string-Dgr41sRK.js} +0 -0
- package/admin/dist/server/assets/{useNavigate-0H08s_Q2.js → useNavigate-CDLfQmZd.js} +0 -0
- package/dist/{assemble-CP2BRYQJ.js → assemble-S3MWVLBI.js} +1 -1
- package/dist/{status-AGZDXOTZ.js → status-NX47XZIU.js} +1 -1
- package/dist/{translate-A5X6MX4Y.js → translate-AGUNMZMQ.js} +1 -1
|
@@ -4,7 +4,7 @@ import { anonymousClient } from 'better-auth/client/plugins';
|
|
|
4
4
|
import { adminClient } from 'better-auth/client/plugins';
|
|
5
5
|
|
|
6
6
|
export const authClient = createAuthClient({
|
|
7
|
-
baseURL: typeof window !== 'undefined' ? window.location.origin : 'http://localhost:
|
|
7
|
+
baseURL: typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3404',
|
|
8
8
|
basePath: '/api/auth',
|
|
9
9
|
plugins: [
|
|
10
10
|
usernameClient(),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { betterAuth } from 'better-auth';
|
|
2
|
+
import { getMigrations } from 'better-auth/db/migration';
|
|
2
3
|
import { username } from 'better-auth/plugins';
|
|
3
4
|
import { anonymous } from 'better-auth/plugins';
|
|
4
5
|
import { admin } from 'better-auth/plugins';
|
|
@@ -8,6 +9,7 @@ import { mkdirSync } from 'node:fs';
|
|
|
8
9
|
|
|
9
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
11
|
let _auth: any = null;
|
|
12
|
+
let _migrated = false;
|
|
11
13
|
|
|
12
14
|
function getDbPath(): string {
|
|
13
15
|
const projectRoot = process.env.DOCS_I18N_PROJECT_ROOT || process.cwd();
|
|
@@ -29,10 +31,12 @@ export function getAuth() {
|
|
|
29
31
|
_auth = betterAuth({
|
|
30
32
|
database: db,
|
|
31
33
|
secret: process.env.BETTER_AUTH_SECRET || 'docs-i18n-admin-dev-secret-change-in-production',
|
|
32
|
-
|
|
34
|
+
trustedOrigins: ['http://localhost:*'],
|
|
35
|
+
baseURL: process.env.BETTER_AUTH_URL || 'http://localhost:3404',
|
|
33
36
|
basePath: '/api/auth',
|
|
34
37
|
emailAndPassword: {
|
|
35
38
|
enabled: true,
|
|
39
|
+
minPasswordLength: 4,
|
|
36
40
|
},
|
|
37
41
|
plugins: [
|
|
38
42
|
username(),
|
|
@@ -60,3 +64,49 @@ export function getAuth() {
|
|
|
60
64
|
|
|
61
65
|
return _auth;
|
|
62
66
|
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Run database migrations and seed admin user if needed (once per server lifetime).
|
|
70
|
+
*/
|
|
71
|
+
export async function ensureMigrations() {
|
|
72
|
+
if (_migrated) return;
|
|
73
|
+
_migrated = true;
|
|
74
|
+
const auth = getAuth();
|
|
75
|
+
const { runMigrations } = await getMigrations(auth.options);
|
|
76
|
+
await runMigrations();
|
|
77
|
+
await seedAdminIfNeeded(auth);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let _seeded = false;
|
|
81
|
+
|
|
82
|
+
async function seedAdminIfNeeded(auth: any) {
|
|
83
|
+
if (_seeded) return;
|
|
84
|
+
_seeded = true;
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
// Query DB directly — auth.api.listUsers requires admin privileges
|
|
88
|
+
const dbPath = getDbPath();
|
|
89
|
+
const db = new Database(dbPath);
|
|
90
|
+
const row = db.prepare('SELECT COUNT(*) as count FROM user').get() as any;
|
|
91
|
+
db.close();
|
|
92
|
+
if (row?.count > 0) return;
|
|
93
|
+
|
|
94
|
+
const result = await auth.api.signUpEmail({
|
|
95
|
+
body: {
|
|
96
|
+
email: 'admin@docs-i18n.local',
|
|
97
|
+
password: 'admin',
|
|
98
|
+
name: 'Admin',
|
|
99
|
+
username: 'admin',
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (result?.user?.id) {
|
|
104
|
+
await auth.api.setRole({
|
|
105
|
+
body: { userId: result.user.id, role: 'admin' },
|
|
106
|
+
});
|
|
107
|
+
console.log('[auth] Default admin user created (username: admin, password: admin)');
|
|
108
|
+
}
|
|
109
|
+
} catch (err) {
|
|
110
|
+
console.warn('[auth] Admin seed skipped:', err instanceof Error ? err.message : err);
|
|
111
|
+
}
|
|
112
|
+
}
|
package/admin/app/server.ts
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* to add better-auth API route handling at /api/auth/*.
|
|
4
4
|
*/
|
|
5
5
|
import { createStartHandler, defaultStreamHandler } from '@tanstack/react-start/server';
|
|
6
|
-
import { getAuth } from './lib/auth.server';
|
|
6
|
+
import { getAuth, ensureMigrations } from './lib/auth.server';
|
|
7
|
+
|
|
8
|
+
// Run migrations before accepting any requests
|
|
9
|
+
await ensureMigrations();
|
|
7
10
|
|
|
8
11
|
const startHandler = createStartHandler(defaultStreamHandler);
|
|
9
12
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{f as e,u as t}from"./useNavigate-CEOVvMjz.js";var n=Object.create(null),r=e=>({}),i=new Proxy(n,{get(e,t){return r()[t]??n[t]},has(e,t){return t in r()||t in n},set(e,t,n){let i=r(!0);return i[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=r(!0);return delete n[t],!0},ownKeys(){let e=r(!0);return Object.keys(e)}});function a(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 a(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return a(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return a(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return a(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return a(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return a(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return a(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});var o=1,s=4,c=8,l=24,u={eterm:s,cons25:s,console:s,cygwin:s,dtterm:s,gnome:s,hurd:s,jfbterm:s,konsole:s,kterm:s,mlterm:s,mosh:l,putty:s,st:s,"rxvt-unicode-24bit":l,terminator:l,"xterm-kitty":l},d=new Map(Object.entries({APPVEYOR:c,BUILDKITE:c,CIRCLECI:l,DRONE:c,GITEA_ACTIONS:l,GITHUB_ACTIONS:l,GITLAB_CI:c,TRAVIS:c})),f=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function p(){if(a(`FORCE_COLOR`)!==void 0)switch(a(`FORCE_COLOR`)){case``:case`1`:case`true`:return s;case`2`:return c;case`3`:return l;default:return o}if(a(`NODE_DISABLE_COLORS`)!==void 0&&a(`NODE_DISABLE_COLORS`)!==``||a(`NO_COLOR`)!==void 0&&a(`NO_COLOR`)!==``||a(`TERM`)===`dumb`)return o;if(a(`TMUX`))return l;if(`TF_BUILD`in i&&`AGENT_NAME`in i)return s;if(`CI`in i){for(let{0:e,1:t}of d)if(e in i)return t;return a(`CI_NAME`)===`codeship`?c:o}if(`TEAMCITY_VERSION`in i)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(a(`TEAMCITY_VERSION`))===null?o:s;switch(a(`TERM_PROGRAM`)){case`iTerm.app`:return!a(`TERM_PROGRAM_VERSION`)||/^[0-2]\./.exec(a(`TERM_PROGRAM_VERSION`))!==null?c:l;case`HyperTerm`:case`MacTerm`:return l;case`Apple_Terminal`:return c}if(a(`COLORTERM`)===`truecolor`||a(`COLORTERM`)===`24bit`)return l;if(a(`TERM`)){if(/truecolor/.exec(a(`TERM`))!==null)return l;if(/^xterm-256/.exec(a(`TERM`))!==null)return c;let e=a(`TERM`).toLowerCase();if(u[e])return u[e];if(f.some(t=>t.exec(e)!==null))return s}return a(`COLORTERM`)?s:o}var m={reset:`\x1B[0m`,bright:`\x1B[1m`,dim:`\x1B[2m`,undim:`\x1B[22m`,underscore:`\x1B[4m`,blink:`\x1B[5m`,reverse:`\x1B[7m`,hidden:`\x1B[8m`,fg:{black:`\x1B[30m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,magenta:`\x1B[35m`,cyan:`\x1B[36m`,white:`\x1B[37m`},bg:{black:`\x1B[40m`,red:`\x1B[41m`,green:`\x1B[42m`,yellow:`\x1B[43m`,blue:`\x1B[44m`,magenta:`\x1B[45m`,cyan:`\x1B[46m`,white:`\x1B[47m`}},h=[`debug`,`info`,`success`,`warn`,`error`];function g(e,t){return h.indexOf(t)>=h.indexOf(e)}var _={info:m.fg.blue,success:m.fg.green,warn:m.fg.yellow,error:m.fg.red,debug:m.fg.magenta},v=(e,t,n)=>{let r=new Date().toISOString();return n?`${m.dim}${r}${m.reset} ${_[e]}${e.toUpperCase()}${m.reset} ${m.bright}[Better Auth]:${m.reset} ${t}`:`${r} ${e.toUpperCase()} [Better Auth]: ${t}`};(e=>{let t=e?.disabled!==!0,n=e?.level??`warn`,r=e?.disableColors===void 0?p()!==1:!e.disableColors,i=(i,a,o=[])=>{if(!t||!g(n,i))return;let s=v(i,a,r);if(!e||typeof e.log!=`function`){i===`error`?console.error(s,...o):i===`warn`?console.warn(s,...o):console.log(s,...o);return}e.log(i===`success`?`info`:i,a,...o)};return{...Object.fromEntries(h.map(e=>[e,(...[t,...n])=>i(e,t,n)])),get level(){return n}}})();function y(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}y({USER_NOT_FOUND:`User not found`,FAILED_TO_CREATE_USER:`Failed to create user`,FAILED_TO_CREATE_SESSION:`Failed to create session`,FAILED_TO_UPDATE_USER:`Failed to update user`,FAILED_TO_GET_SESSION:`Failed to get session`,INVALID_PASSWORD:`Invalid password`,INVALID_EMAIL:`Invalid email`,INVALID_EMAIL_OR_PASSWORD:`Invalid email or password`,INVALID_USER:`Invalid user`,SOCIAL_ACCOUNT_ALREADY_LINKED:`Social account already linked`,PROVIDER_NOT_FOUND:`Provider not found`,INVALID_TOKEN:`Invalid token`,TOKEN_EXPIRED:`Token expired`,ID_TOKEN_NOT_SUPPORTED:`id_token not supported`,FAILED_TO_GET_USER_INFO:`Failed to get user info`,USER_EMAIL_NOT_FOUND:`User email not found`,EMAIL_NOT_VERIFIED:`Email not verified`,PASSWORD_TOO_SHORT:`Password too short`,PASSWORD_TOO_LONG:`Password too long`,USER_ALREADY_EXISTS:`User already exists.`,USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:`User already exists. Use another email.`,EMAIL_CAN_NOT_BE_UPDATED:`Email can not be updated`,CREDENTIAL_ACCOUNT_NOT_FOUND:`Credential account not found`,SESSION_EXPIRED:`Session expired. Re-authenticate to perform this action.`,FAILED_TO_UNLINK_LAST_ACCOUNT:`You can't unlink your last account`,ACCOUNT_NOT_FOUND:`Account not found`,USER_ALREADY_HAS_PASSWORD:`User already has a password. Provide that to delete the account.`,CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:`Cross-site navigation login blocked. This request appears to be a CSRF attack.`,VERIFICATION_EMAIL_NOT_ENABLED:`Verification email isn't enabled`,EMAIL_ALREADY_VERIFIED:`Email is already verified`,EMAIL_MISMATCH:`Email mismatch`,SESSION_NOT_FRESH:`Session is not fresh`,LINKED_ACCOUNT_ALREADY_EXISTS:`Linked account already exists`,INVALID_ORIGIN:`Invalid origin`,INVALID_CALLBACK_URL:`Invalid callbackURL`,INVALID_REDIRECT_URL:`Invalid redirectURL`,INVALID_ERROR_CALLBACK_URL:`Invalid errorCallbackURL`,INVALID_NEW_USER_CALLBACK_URL:`Invalid newUserCallbackURL`,MISSING_OR_NULL_ORIGIN:`Missing or null Origin`,CALLBACK_URL_REQUIRED:`callbackURL is required`,FAILED_TO_CREATE_VERIFICATION:`Unable to create verification`,FIELD_NOT_ALLOWED:`Field not allowed to be set`,ASYNC_VALIDATION_NOT_SUPPORTED:`Async validation is not supported`,VALIDATION_ERROR:`Validation Error`,MISSING_FIELD:`Field is required`,METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED:`POST method requires deferSessionRefresh to be enabled in session config`,BODY_MUST_BE_AN_OBJECT:`Body must be an object`,PASSWORD_ALREADY_SET:`User already has a password set`});function b(){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 ee(e){let t=e.split(`
|
|
2
2
|
at `);return t.length<=1?e:(t.splice(1,1),t.join(`
|
|
3
|
-
at `))}function te(e,t){class n extends e{#e;constructor(...e){if(b()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=ee(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 ne={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};te(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:ne[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 x=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}};function re(e){try{return(new URL(e).pathname.replace(/\/+$/,``)||`/`)!==`/`}catch{throw new x(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function ie(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new x(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof x?t:new x(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function S(e,t=`/api/auth`){if(ie(e),re(e))return e;let n=e.replace(/\/+$/,``);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function C(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 ae(e,t,n,r,a){if(e)return S(e,t);if(r!==!1){let e=i.BETTER_AUTH_URL||i.NEXT_PUBLIC_BETTER_AUTH_URL||i.PUBLIC_BETTER_AUTH_URL||i.NUXT_PUBLIC_BETTER_AUTH_URL||i.NUXT_PUBLIC_AUTH_URL||(i.BASE_URL===`/`?void 0:i.BASE_URL);if(e)return S(e,t)}let o=n?.headers.get(`x-forwarded-host`),s=n?.headers.get(`x-forwarded-proto`);if(o&&s&&a&&C(s,`proto`)&&C(o,`host`))try{return S(`${s}://${o}`,t)}catch{}if(n){let e=oe(n.url);if(!e)throw new x(`Could not get origin from request. Please provide a valid base URL.`);return S(e,t)}if(typeof window<`u`&&window.location)return S(window.location.origin,t)}function oe(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}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*$/,w={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},le=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function ue(e){return e instanceof Date&&!isNaN(e.getTime())}function de(e){let t=le.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 ue(f)?f:null}function fe(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();if(o.length>0&&o[0]===`"`&&o.endsWith(`"`)&&!o.slice(1,-1).includes(`"`))return o.slice(1,-1);let s=o.toLowerCase();if(s.length<=9&&s in w)return w[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=de(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function pe(e,t={strict:!0}){return fe(e,t)}var me={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},T=[],E=0,D=4,he=0,ge=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=E+D;t<T.length;)T[t]===e?T.splice(t,D):t+=D;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){he++;let i=!T.length;for(let i of t)T.push(i,n.value,e,r);if(i){for(E=0;E<T.length;E+=D)T[E](T[E+1],T[E+2],T[E+3]);T.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},_e=5,O=6,k=10,ve=(e,t,n,r)=>(e.events=e.events||{},e.events[n+k]||(e.events[n+k]=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+k](),delete e.events[n+k])}),ye=1e3,A=(e,t)=>ve(e,n=>{let r=t(n);r&&e.events[O].push(r)},_e,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[O]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[O])t();e.events[O]=[]}},ye)},()=>{e.listen=n,e.off=r}});function be(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}var xe=()=>typeof window>`u`,Se=(e,t,n,r)=>{let i=ge({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>a(e)}),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){i.set({data:e.data,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;for(let t of e)t.subscribe(async()=>{xe()||(o?await a():A(i,()=>{let e=setTimeout(async()=>{o||=(await a(),!0)},0);return()=>{i.off(),t.off(),clearTimeout(e)}}))});return i},j=Symbol.for(`better-auth:broadcast-channel`),Ce=()=>Math.floor(Date.now()/1e3),we=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:Ce()}))}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 M(e=`better-auth.message`){return globalThis[j]||(globalThis[j]=new we(e)),globalThis[j]}var N=Symbol.for(`better-auth:focus-manager`),Te=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 P(){return globalThis[N]||(globalThis[N]=new Te),globalThis[N]}var F=Symbol.for(`better-auth:online-manager`),Ee=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 I(){return globalThis[F]||(globalThis[F]=new Ee),globalThis[F]}var L=()=>Math.floor(Date.now()/1e3);function R(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}var De=5;function Oe(e){let{sessionAtom:t,sessionSignal:n,$fetch:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={lastSync:0,lastSessionRequest:0,cachedSession:void 0},l=()=>s||I().isOnline,u=e=>{if(!l())return;if(e?.event===`storage`){c.lastSync=L(),n.set(!n.get());return}let i=t.get(),a=()=>{c.lastSessionRequest=L(),r(`/get-session`).then(async e=>{let{data:a,error:o}=R(e);if(a?.needsRefresh)try{let e=await r(`/get-session`,{method:`POST`});({data:a,error:o}=R(e))}catch{}let s=a?.session&&a?.user?a:null;t.set({...i,data:s,error:o}),c.lastSync=L(),n.set(!n.get())}).catch(()=>{})};if(e?.event===`poll`){a();return}if(e?.event===`visibilitychange`){if(L()-c.lastSessionRequest<De)return;c.lastSessionRequest=L()}if(e?.event===`visibilitychange`){a();return}(i?.data===null||i?.data===void 0)&&(c.lastSync=L(),n.set(!n.get()))},d=e=>{M().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{t.get()?.data&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=M().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=P().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=I().subscribe(e=>{e&&u({event:`visibilitychange`})})};return{init:()=>{f(),p(),m(),h(),M().setup(),P().setup(),I().setup()},cleanup:()=>{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.lastSync=0,c.lastSessionRequest=0,c.cachedSession=void 0},triggerRefetch:u,broadcastSessionUpdate:d}}function ke(e,t){let n=ge(!1),r=Se(n,`/get-session`,e,{method:`GET`}),i=()=>{};return A(r,()=>{let a=Oe({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return a.init(),i=a.broadcastSessionUpdate,()=>{a.cleanup()}}),{session:r,$sessionSignal:n,broadcastSessionUpdate:e=>i(e)}}function z(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 B(e,t,n=`.`,r){if(!z(t))return B(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:z(a)&&z(i[t])?i[t]=B(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Ae(e){return(...t)=>t.reduce((t,n)=>B(t,n,``,e),{})}var je=Ae(),Me=Object.defineProperty,Ne=Object.defineProperties,Pe=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,H=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||={})Fe.call(t,n)&&H(e,n,t[n]);if(V)for(var n of V(t))Ie.call(t,n)&&H(e,n,t[n]);return e},W=(e,t)=>Ne(e,Pe(t)),Le=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)}},Re=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}},G=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}},ze=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 Be(e){if(typeof e==`number`)return new G({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new G(e);case`exponential`:return new ze(e);default:throw Error(`Invalid retry strategy`)}}var Ve=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},He=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Ue(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 He.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function We(e){try{return JSON.parse(e),!0}catch{return!1}}function K(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 q(e){try{return JSON.parse(e)}catch{return e}}function Ge(e){return typeof e==`function`}function Ke(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&Ge(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&Ge(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}async function qe(e){let t=new Headers(e?.headers),n=await Ve(e);for(let[e,r]of Object.entries(n||{}))t.set(e,r);if(!t.has(`content-type`)){let n=Je(e?.body);n&&t.set(`content-type`,n)}return t}function Je(e){return K(e)?`application/json`:null}function Ye(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(K(e.body)&&!t.has(`content-type`)){for(let[t,n]of Object.entries(e?.body))n instanceof Date&&(e.body[t]=n.toISOString());return JSON.stringify(e.body)}return t.has(`content-type`)&&t.get(`content-type`)===`application/x-www-form-urlencoded`&&K(e.body)?new URLSearchParams(e.body).toString():e.body}function Xe(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return $e.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function Ze(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var Qe=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function J(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new Qe(n.issues);return n.value}var $e=[`get`,`post`,`put`,`patch`,`delete`],et=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,``));let i=r.schema[e];if(i){let e=W(U({},n),{method:i.method,output:i.output});return n?.disableValidation||(e=W(U({},e),{body:i.input?await J(i.input,n?.body):n?.body,params:i.params?await J(i.params,n?.params):n?.params,query:i.query?await J(i.query,n?.query):n?.query})),{url:t,options:e}}}return{url:t,options:n}}}),tt=e=>{async function t(t,n){let r=W(U(U({},e),n),{plugins:[...e?.plugins||[],et(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await Y(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 Y(t,r)}return t};function nt(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];$e.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)}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];o=o.replace(n,e)}}else for(let[e,t]of Object.entries(r))o=o.replace(`:${e}`,String(t));o=o.split(`/`).map(encodeURIComponent).join(`/`),o.startsWith(`/`)&&(o=o.slice(1));let l=c.toString();return l=l.length>0?`?${l}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${l}`,a):`${a}${o}${l}`}var Y=async(e,t)=>{let{hooks:n,url:r,options:i}=await Re(e,t),a=Ke(i),o=new AbortController,s=i.signal??o.signal,c=nt(r,i),l=Ye(i),u=await qe(i),d=Xe(r,i),f=W(U({},i),{url:c,headers:u,body:l,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&(f=t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=Ze(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(W(U({},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=Ue(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??q)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await J(f.output,r.data));for(let e of n.onSuccess)e&&await e(W(U({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??q,_=await m.text(),v=We(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:W(U({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(W(U({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=Be(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 Y(e,W(U({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new Le(m.status,m.statusText,v?y:_);return{data:null,error:W(U({},y),{status:m.status,statusText:m.statusText})}},rt=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{}}},it=(e,t)=>{let n=`credentials`in Request.prototype,r=ae(e?.baseURL,e?.basePath,void 0,t)??rt(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=tt({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?pe(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[me],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=ke(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===`/change-email`},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=je(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function at(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function ot(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 st(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`||at(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=ot(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()}var X=e(t(),1);function ct(e,t={}){let n=(0,X.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,a=(0,X.useCallback)(t=>{let i=e=>{n.current!==e&&(n.current=e,t())};return i(e.value),r?.length?be(e,r,i):e.listen(i)},i),o=()=>n.current;return(0,X.useSyncExternalStore)(a,o,o)}function lt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ut(e){return`use${lt(e)}`}function dt(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:o}=it(e),s={};for(let[e,t]of Object.entries(r))s[ut(e)]=()=>ct(t);return st({...n,...s,$fetch:i,$store:a},i,t,r,o)}var ft=y({FAILED_TO_CREATE_USER:`Failed to create user`,USER_ALREADY_EXISTS:`User already exists.`,USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:`User already exists. Use another email.`,YOU_CANNOT_BAN_YOURSELF:`You cannot ban yourself`,YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:`You are not allowed to change users role`,YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:`You are not allowed to create users`,YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:`You are not allowed to list users`,YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:`You are not allowed to list users sessions`,YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:`You are not allowed to ban users`,YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:`You are not allowed to impersonate users`,YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:`You are not allowed to revoke users sessions`,YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:`You are not allowed to delete users`,YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:`You are not allowed to set users password`,BANNED_USER:`You have been banned from this application`,YOU_ARE_NOT_ALLOWED_TO_GET_USER:`You are not allowed to get user`,NO_DATA_TO_UPDATE:`No data to update`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS:`You are not allowed to update users`,YOU_CANNOT_REMOVE_YOURSELF:`You cannot remove yourself`,YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE:`You are not allowed to set a non-existent role value`,YOU_CANNOT_IMPERSONATE_ADMINS:`You cannot impersonate admins`,INVALID_ROLE_TYPE:`Invalid role type`});function pt(e){return{authorize(t,n=`AND`){let r=!1;for(let[i,a]of Object.entries(t)){let t=e[i];if(!t)return{success:!1,error:`You are not allowed to access resource: ${i}`};if(Array.isArray(a))r=a.every(e=>t.includes(e));else if(typeof a==`object`){let e=a;r=e.connector===`OR`?e.actions.some(e=>t.includes(e)):e.actions.every(e=>t.includes(e))}else throw new x(`Invalid access control request`);if(r&&n===`OR`)return{success:r};if(!r&&n===`AND`)return{success:!1,error:`unauthorized to access resource "${i}"`}}return r?{success:r}:{success:!1,error:`Not authorized`}},statements:e}}function mt(e){return{newRole(e){return pt(e)},statements:e}}var Z=mt({user:[`create`,`list`,`set-role`,`ban`,`impersonate`,`impersonate-admins`,`delete`,`set-password`,`get`,`update`],session:[`list`,`revoke`,`delete`]}),ht=Z.newRole({user:[`create`,`list`,`set-role`,`ban`,`impersonate`,`delete`,`set-password`,`get`,`update`],session:[`list`,`revoke`,`delete`]}),gt=Z.newRole({user:[],session:[]}),_t={admin:ht,user:gt},vt=e=>{if(e.userId&&e.options?.adminUserIds?.includes(e.userId))return!0;if(!e.permissions)return!1;let t=(e.role||e.options?.defaultRole||`user`).split(`,`),n=e.options?.roles||_t;for(let r of t)if(n[r]?.authorize(e.permissions)?.success)return!0;return!1},yt=e=>{let t={admin:ht,user:gt,...e?.roles};return{id:`admin-client`,$InferServerPlugin:{},getActions:()=>({admin:{checkRolePermission:n=>vt({role:n.role,options:{ac:e?.ac,roles:t},permissions:n.permissions})}}),pathMethods:{"/admin/list-users":`GET`,"/admin/stop-impersonating":`POST`},$ERROR_CODES:ft}},bt=y({INVALID_EMAIL_FORMAT:`Email was not generated in a valid format`,FAILED_TO_CREATE_USER:`Failed to create user`,COULD_NOT_CREATE_SESSION:`Could not create session`,ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:`Anonymous users cannot sign in again anonymously`,FAILED_TO_DELETE_ANONYMOUS_USER:`Failed to delete anonymous user`,USER_IS_NOT_ANONYMOUS:`User is not anonymous`,DELETE_ANONYMOUS_USER_DISABLED:`Deleting anonymous users is disabled`}),xt=()=>({id:`anonymous`,$InferServerPlugin:{},pathMethods:{"/sign-in/anonymous":`POST`,"/delete-anonymous-user":`POST`},atomListeners:[{matcher:e=>e===`/sign-in/anonymous`,signal:`$sessionSignal`}],$ERROR_CODES:bt});y({OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,TOO_MANY_ATTEMPTS:`Too many attempts`}),y({INVALID_OAUTH_CONFIGURATION:`Invalid OAuth configuration`,TOKEN_URL_NOT_FOUND:`Invalid OAuth configuration. Token URL not found.`,PROVIDER_CONFIG_NOT_FOUND:`No config found for provider`,PROVIDER_ID_REQUIRED:`Provider ID is required`,INVALID_OAUTH_CONFIG:`Invalid OAuth configuration.`,SESSION_REQUIRED:`Session is required`,ISSUER_MISMATCH:`OAuth issuer mismatch. The authorization server issuer does not match the expected value (RFC 9207).`,ISSUER_MISSING:`OAuth issuer parameter missing. The authorization server did not include the required iss parameter (RFC 9207).`}),y({INVALID_SESSION_TOKEN:`Invalid session token`}),y({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`,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`});var Q=mt({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]});Q.newRole({organization:[`update`],invitation:[`create`,`cancel`],member:[`create`,`update`,`delete`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),Q.newRole({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),Q.newRole({organization:[],member:[],invitation:[],team:[],ac:[`read`]}),y({INVALID_PHONE_NUMBER:`Invalid phone number`,PHONE_NUMBER_EXIST:`Phone number already exists`,PHONE_NUMBER_NOT_EXIST:`phone number isn't registered`,INVALID_PHONE_NUMBER_OR_PASSWORD:`Invalid phone number or password`,UNEXPECTED_ERROR:`Unexpected error`,OTP_NOT_FOUND:`OTP not found`,OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,PHONE_NUMBER_NOT_VERIFIED:`Phone number not verified`,PHONE_NUMBER_CANNOT_BE_UPDATED:`Phone number cannot be updated`,SEND_OTP_NOT_IMPLEMENTED:`sendOTP not implemented`,TOO_MANY_ATTEMPTS:`Too many attempts`}),y({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.`,INVALID_TWO_FACTOR_COOKIE:`Invalid two factor cookie`});var St=y({INVALID_USERNAME_OR_PASSWORD:`Invalid username or password`,EMAIL_NOT_VERIFIED:`Email not verified`,UNEXPECTED_ERROR:`Unexpected error`,USERNAME_IS_ALREADY_TAKEN:`Username is already taken. Please try another.`,USERNAME_TOO_SHORT:`Username is too short`,USERNAME_TOO_LONG:`Username is too long`,INVALID_USERNAME:`Username is invalid`,INVALID_DISPLAY_USERNAME:`Display username is invalid`}),$=dt({baseURL:typeof window<`u`?window.location.origin:`http://localhost:3456`,basePath:`/api/auth`,plugins:[{id:`username`,$InferServerPlugin:{},atomListeners:[{matcher:e=>e===`/sign-in/username`,signal:`$sessionSignal`}],$ERROR_CODES:St},xt(),yt()]}),{useSession:Ct,signIn:wt,signUp:Tt,signOut:Et}=$;export{$ as t};
|
|
3
|
+
at `))}function te(e,t){class n extends e{#e;constructor(...e){if(b()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=ee(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 ne={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};te(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:ne[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 x=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}};function re(e){try{return(new URL(e).pathname.replace(/\/+$/,``)||`/`)!==`/`}catch{throw new x(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function ie(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new x(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof x?t:new x(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function S(e,t=`/api/auth`){if(ie(e),re(e))return e;let n=e.replace(/\/+$/,``);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function C(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 ae(e,t,n,r,a){if(e)return S(e,t);if(r!==!1){let e=i.BETTER_AUTH_URL||i.NEXT_PUBLIC_BETTER_AUTH_URL||i.PUBLIC_BETTER_AUTH_URL||i.NUXT_PUBLIC_BETTER_AUTH_URL||i.NUXT_PUBLIC_AUTH_URL||(i.BASE_URL===`/`?void 0:i.BASE_URL);if(e)return S(e,t)}let o=n?.headers.get(`x-forwarded-host`),s=n?.headers.get(`x-forwarded-proto`);if(o&&s&&a&&C(s,`proto`)&&C(o,`host`))try{return S(`${s}://${o}`,t)}catch{}if(n){let e=oe(n.url);if(!e)throw new x(`Could not get origin from request. Please provide a valid base URL.`);return S(e,t)}if(typeof window<`u`&&window.location)return S(window.location.origin,t)}function oe(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}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*$/,w={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},le=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function ue(e){return e instanceof Date&&!isNaN(e.getTime())}function de(e){let t=le.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 ue(f)?f:null}function fe(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();if(o.length>0&&o[0]===`"`&&o.endsWith(`"`)&&!o.slice(1,-1).includes(`"`))return o.slice(1,-1);let s=o.toLowerCase();if(s.length<=9&&s in w)return w[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=de(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function pe(e,t={strict:!0}){return fe(e,t)}var me={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},T=[],E=0,D=4,he=0,ge=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=E+D;t<T.length;)T[t]===e?T.splice(t,D):t+=D;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){he++;let i=!T.length;for(let i of t)T.push(i,n.value,e,r);if(i){for(E=0;E<T.length;E+=D)T[E](T[E+1],T[E+2],T[E+3]);T.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},_e=5,O=6,k=10,ve=(e,t,n,r)=>(e.events=e.events||{},e.events[n+k]||(e.events[n+k]=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+k](),delete e.events[n+k])}),ye=1e3,A=(e,t)=>ve(e,n=>{let r=t(n);r&&e.events[O].push(r)},_e,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[O]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[O])t();e.events[O]=[]}},ye)},()=>{e.listen=n,e.off=r}});function be(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}var xe=()=>typeof window>`u`,Se=(e,t,n,r)=>{let i=ge({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>a(e)}),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){i.set({data:e.data,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;for(let t of e)t.subscribe(async()=>{xe()||(o?await a():A(i,()=>{let e=setTimeout(async()=>{o||=(await a(),!0)},0);return()=>{i.off(),t.off(),clearTimeout(e)}}))});return i},j=Symbol.for(`better-auth:broadcast-channel`),Ce=()=>Math.floor(Date.now()/1e3),we=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:Ce()}))}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 M(e=`better-auth.message`){return globalThis[j]||(globalThis[j]=new we(e)),globalThis[j]}var N=Symbol.for(`better-auth:focus-manager`),Te=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 P(){return globalThis[N]||(globalThis[N]=new Te),globalThis[N]}var F=Symbol.for(`better-auth:online-manager`),Ee=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 I(){return globalThis[F]||(globalThis[F]=new Ee),globalThis[F]}var L=()=>Math.floor(Date.now()/1e3);function R(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}var De=5;function Oe(e){let{sessionAtom:t,sessionSignal:n,$fetch:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={lastSync:0,lastSessionRequest:0,cachedSession:void 0},l=()=>s||I().isOnline,u=e=>{if(!l())return;if(e?.event===`storage`){c.lastSync=L(),n.set(!n.get());return}let i=t.get(),a=()=>{c.lastSessionRequest=L(),r(`/get-session`).then(async e=>{let{data:a,error:o}=R(e);if(a?.needsRefresh)try{let e=await r(`/get-session`,{method:`POST`});({data:a,error:o}=R(e))}catch{}let s=a?.session&&a?.user?a:null;t.set({...i,data:s,error:o}),c.lastSync=L(),n.set(!n.get())}).catch(()=>{})};if(e?.event===`poll`){a();return}if(e?.event===`visibilitychange`){if(L()-c.lastSessionRequest<De)return;c.lastSessionRequest=L()}if(e?.event===`visibilitychange`){a();return}(i?.data===null||i?.data===void 0)&&(c.lastSync=L(),n.set(!n.get()))},d=e=>{M().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{t.get()?.data&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=M().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=P().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=I().subscribe(e=>{e&&u({event:`visibilitychange`})})};return{init:()=>{f(),p(),m(),h(),M().setup(),P().setup(),I().setup()},cleanup:()=>{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.lastSync=0,c.lastSessionRequest=0,c.cachedSession=void 0},triggerRefetch:u,broadcastSessionUpdate:d}}function ke(e,t){let n=ge(!1),r=Se(n,`/get-session`,e,{method:`GET`}),i=()=>{};return A(r,()=>{let a=Oe({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return a.init(),i=a.broadcastSessionUpdate,()=>{a.cleanup()}}),{session:r,$sessionSignal:n,broadcastSessionUpdate:e=>i(e)}}function z(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 B(e,t,n=`.`,r){if(!z(t))return B(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:z(a)&&z(i[t])?i[t]=B(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Ae(e){return(...t)=>t.reduce((t,n)=>B(t,n,``,e),{})}var je=Ae(),Me=Object.defineProperty,Ne=Object.defineProperties,Pe=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,H=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||={})Fe.call(t,n)&&H(e,n,t[n]);if(V)for(var n of V(t))Ie.call(t,n)&&H(e,n,t[n]);return e},W=(e,t)=>Ne(e,Pe(t)),Le=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)}},Re=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}},G=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}},ze=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 Be(e){if(typeof e==`number`)return new G({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new G(e);case`exponential`:return new ze(e);default:throw Error(`Invalid retry strategy`)}}var Ve=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},He=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Ue(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 He.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function We(e){try{return JSON.parse(e),!0}catch{return!1}}function K(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 q(e){try{return JSON.parse(e)}catch{return e}}function Ge(e){return typeof e==`function`}function Ke(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&Ge(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&Ge(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}async function qe(e){let t=new Headers(e?.headers),n=await Ve(e);for(let[e,r]of Object.entries(n||{}))t.set(e,r);if(!t.has(`content-type`)){let n=Je(e?.body);n&&t.set(`content-type`,n)}return t}function Je(e){return K(e)?`application/json`:null}function Ye(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(K(e.body)&&!t.has(`content-type`)){for(let[t,n]of Object.entries(e?.body))n instanceof Date&&(e.body[t]=n.toISOString());return JSON.stringify(e.body)}return t.has(`content-type`)&&t.get(`content-type`)===`application/x-www-form-urlencoded`&&K(e.body)?new URLSearchParams(e.body).toString():e.body}function Xe(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return $e.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function Ze(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var Qe=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function J(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new Qe(n.issues);return n.value}var $e=[`get`,`post`,`put`,`patch`,`delete`],et=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,``));let i=r.schema[e];if(i){let e=W(U({},n),{method:i.method,output:i.output});return n?.disableValidation||(e=W(U({},e),{body:i.input?await J(i.input,n?.body):n?.body,params:i.params?await J(i.params,n?.params):n?.params,query:i.query?await J(i.query,n?.query):n?.query})),{url:t,options:e}}}return{url:t,options:n}}}),tt=e=>{async function t(t,n){let r=W(U(U({},e),n),{plugins:[...e?.plugins||[],et(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await Y(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 Y(t,r)}return t};function nt(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];$e.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)}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];o=o.replace(n,e)}}else for(let[e,t]of Object.entries(r))o=o.replace(`:${e}`,String(t));o=o.split(`/`).map(encodeURIComponent).join(`/`),o.startsWith(`/`)&&(o=o.slice(1));let l=c.toString();return l=l.length>0?`?${l}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${l}`,a):`${a}${o}${l}`}var Y=async(e,t)=>{let{hooks:n,url:r,options:i}=await Re(e,t),a=Ke(i),o=new AbortController,s=i.signal??o.signal,c=nt(r,i),l=Ye(i),u=await qe(i),d=Xe(r,i),f=W(U({},i),{url:c,headers:u,body:l,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&(f=t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=Ze(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(W(U({},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=Ue(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??q)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await J(f.output,r.data));for(let e of n.onSuccess)e&&await e(W(U({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??q,_=await m.text(),v=We(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:W(U({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(W(U({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=Be(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 Y(e,W(U({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new Le(m.status,m.statusText,v?y:_);return{data:null,error:W(U({},y),{status:m.status,statusText:m.statusText})}},rt=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{}}},it=(e,t)=>{let n=`credentials`in Request.prototype,r=ae(e?.baseURL,e?.basePath,void 0,t)??rt(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=tt({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?pe(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[me],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=ke(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===`/change-email`},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=je(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function at(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function ot(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 st(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`||at(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=ot(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()}var X=e(t(),1);function ct(e,t={}){let n=(0,X.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,a=(0,X.useCallback)(t=>{let i=e=>{n.current!==e&&(n.current=e,t())};return i(e.value),r?.length?be(e,r,i):e.listen(i)},i),o=()=>n.current;return(0,X.useSyncExternalStore)(a,o,o)}function lt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ut(e){return`use${lt(e)}`}function dt(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:o}=it(e),s={};for(let[e,t]of Object.entries(r))s[ut(e)]=()=>ct(t);return st({...n,...s,$fetch:i,$store:a},i,t,r,o)}var ft=y({FAILED_TO_CREATE_USER:`Failed to create user`,USER_ALREADY_EXISTS:`User already exists.`,USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:`User already exists. Use another email.`,YOU_CANNOT_BAN_YOURSELF:`You cannot ban yourself`,YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:`You are not allowed to change users role`,YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:`You are not allowed to create users`,YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:`You are not allowed to list users`,YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:`You are not allowed to list users sessions`,YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:`You are not allowed to ban users`,YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:`You are not allowed to impersonate users`,YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:`You are not allowed to revoke users sessions`,YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:`You are not allowed to delete users`,YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:`You are not allowed to set users password`,BANNED_USER:`You have been banned from this application`,YOU_ARE_NOT_ALLOWED_TO_GET_USER:`You are not allowed to get user`,NO_DATA_TO_UPDATE:`No data to update`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS:`You are not allowed to update users`,YOU_CANNOT_REMOVE_YOURSELF:`You cannot remove yourself`,YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE:`You are not allowed to set a non-existent role value`,YOU_CANNOT_IMPERSONATE_ADMINS:`You cannot impersonate admins`,INVALID_ROLE_TYPE:`Invalid role type`});function pt(e){return{authorize(t,n=`AND`){let r=!1;for(let[i,a]of Object.entries(t)){let t=e[i];if(!t)return{success:!1,error:`You are not allowed to access resource: ${i}`};if(Array.isArray(a))r=a.every(e=>t.includes(e));else if(typeof a==`object`){let e=a;r=e.connector===`OR`?e.actions.some(e=>t.includes(e)):e.actions.every(e=>t.includes(e))}else throw new x(`Invalid access control request`);if(r&&n===`OR`)return{success:r};if(!r&&n===`AND`)return{success:!1,error:`unauthorized to access resource "${i}"`}}return r?{success:r}:{success:!1,error:`Not authorized`}},statements:e}}function mt(e){return{newRole(e){return pt(e)},statements:e}}var Z=mt({user:[`create`,`list`,`set-role`,`ban`,`impersonate`,`impersonate-admins`,`delete`,`set-password`,`get`,`update`],session:[`list`,`revoke`,`delete`]}),ht=Z.newRole({user:[`create`,`list`,`set-role`,`ban`,`impersonate`,`delete`,`set-password`,`get`,`update`],session:[`list`,`revoke`,`delete`]}),gt=Z.newRole({user:[],session:[]}),_t={admin:ht,user:gt},vt=e=>{if(e.userId&&e.options?.adminUserIds?.includes(e.userId))return!0;if(!e.permissions)return!1;let t=(e.role||e.options?.defaultRole||`user`).split(`,`),n=e.options?.roles||_t;for(let r of t)if(n[r]?.authorize(e.permissions)?.success)return!0;return!1},yt=e=>{let t={admin:ht,user:gt,...e?.roles};return{id:`admin-client`,$InferServerPlugin:{},getActions:()=>({admin:{checkRolePermission:n=>vt({role:n.role,options:{ac:e?.ac,roles:t},permissions:n.permissions})}}),pathMethods:{"/admin/list-users":`GET`,"/admin/stop-impersonating":`POST`},$ERROR_CODES:ft}},bt=y({INVALID_EMAIL_FORMAT:`Email was not generated in a valid format`,FAILED_TO_CREATE_USER:`Failed to create user`,COULD_NOT_CREATE_SESSION:`Could not create session`,ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:`Anonymous users cannot sign in again anonymously`,FAILED_TO_DELETE_ANONYMOUS_USER:`Failed to delete anonymous user`,USER_IS_NOT_ANONYMOUS:`User is not anonymous`,DELETE_ANONYMOUS_USER_DISABLED:`Deleting anonymous users is disabled`}),xt=()=>({id:`anonymous`,$InferServerPlugin:{},pathMethods:{"/sign-in/anonymous":`POST`,"/delete-anonymous-user":`POST`},atomListeners:[{matcher:e=>e===`/sign-in/anonymous`,signal:`$sessionSignal`}],$ERROR_CODES:bt});y({OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,TOO_MANY_ATTEMPTS:`Too many attempts`}),y({INVALID_OAUTH_CONFIGURATION:`Invalid OAuth configuration`,TOKEN_URL_NOT_FOUND:`Invalid OAuth configuration. Token URL not found.`,PROVIDER_CONFIG_NOT_FOUND:`No config found for provider`,PROVIDER_ID_REQUIRED:`Provider ID is required`,INVALID_OAUTH_CONFIG:`Invalid OAuth configuration.`,SESSION_REQUIRED:`Session is required`,ISSUER_MISMATCH:`OAuth issuer mismatch. The authorization server issuer does not match the expected value (RFC 9207).`,ISSUER_MISSING:`OAuth issuer parameter missing. The authorization server did not include the required iss parameter (RFC 9207).`}),y({INVALID_SESSION_TOKEN:`Invalid session token`}),y({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`,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`});var Q=mt({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]});Q.newRole({organization:[`update`],invitation:[`create`,`cancel`],member:[`create`,`update`,`delete`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),Q.newRole({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),Q.newRole({organization:[],member:[],invitation:[],team:[],ac:[`read`]}),y({INVALID_PHONE_NUMBER:`Invalid phone number`,PHONE_NUMBER_EXIST:`Phone number already exists`,PHONE_NUMBER_NOT_EXIST:`phone number isn't registered`,INVALID_PHONE_NUMBER_OR_PASSWORD:`Invalid phone number or password`,UNEXPECTED_ERROR:`Unexpected error`,OTP_NOT_FOUND:`OTP not found`,OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,PHONE_NUMBER_NOT_VERIFIED:`Phone number not verified`,PHONE_NUMBER_CANNOT_BE_UPDATED:`Phone number cannot be updated`,SEND_OTP_NOT_IMPLEMENTED:`sendOTP not implemented`,TOO_MANY_ATTEMPTS:`Too many attempts`}),y({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.`,INVALID_TWO_FACTOR_COOKIE:`Invalid two factor cookie`});var St=y({INVALID_USERNAME_OR_PASSWORD:`Invalid username or password`,EMAIL_NOT_VERIFIED:`Email not verified`,UNEXPECTED_ERROR:`Unexpected error`,USERNAME_IS_ALREADY_TAKEN:`Username is already taken. Please try another.`,USERNAME_TOO_SHORT:`Username is too short`,USERNAME_TOO_LONG:`Username is too long`,INVALID_USERNAME:`Username is invalid`,INVALID_DISPLAY_USERNAME:`Display username is invalid`}),$=dt({baseURL:typeof window<`u`?window.location.origin:`http://localhost:3404`,basePath:`/api/auth`,plugins:[{id:`username`,$InferServerPlugin:{},atomListeners:[{matcher:e=>e===`/sign-in/username`,signal:`$sessionSignal`}],$ERROR_CODES:St},xt(),yt()]}),{useSession:Ct,signIn:wt,signUp:Tt,signOut:Et}=$;export{$ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,i as t,t as n,u as r}from"./useNavigate-CEOVvMjz.js";import{t as i}from"./auth-client-
|
|
1
|
+
import{f as e,i as t,t as n,u as r}from"./useNavigate-CEOVvMjz.js";import{t as i}from"./auth-client-ChAoRxRf.js";var a=e(r()),o=t();function s(){let e=n(),[t,r]=(0,a.useState)(`login`),[s,c]=(0,a.useState)(``),[l,u]=(0,a.useState)(``),[d,f]=(0,a.useState)(``),[p,m]=(0,a.useState)(``),[h,g]=(0,a.useState)(null),[_,v]=(0,a.useState)(!1);return(0,o.jsx)(`div`,{className:`login-page`,children:(0,o.jsxs)(`div`,{className:`login-card`,children:[(0,o.jsx)(`h2`,{children:`Translation Admin`}),(0,o.jsx)(`p`,{className:`login-subtitle`,children:`Sign in to manage translations`}),(0,o.jsxs)(`div`,{className:`login-mode-toggle`,children:[(0,o.jsx)(`button`,{type:`button`,className:t===`login`?`active`:``,onClick:()=>{r(`login`),g(null)},children:`Sign In`}),(0,o.jsx)(`button`,{type:`button`,className:t===`register`?`active`:``,onClick:()=>{r(`register`),g(null)},children:`Register`})]}),h&&(0,o.jsx)(`div`,{className:`login-error`,children:h}),t===`login`?(0,o.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),g(null),v(!0);try{let{error:t}=await i.signIn.username({username:s,password:l});if(t){g(t.message||`Login failed`),v(!1);return}e({to:`/`})}catch(e){g(e instanceof Error?e.message:`Login failed`),v(!1)}},children:[(0,o.jsx)(`label`,{htmlFor:`login-username`,children:`Username`}),(0,o.jsx)(`input`,{id:`login-username`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`admin`,required:!0,autoComplete:`username`}),(0,o.jsx)(`label`,{htmlFor:`login-password`,children:`Password`}),(0,o.jsx)(`input`,{id:`login-password`,type:`password`,value:l,onChange:e=>u(e.target.value),placeholder:`password`,required:!0,autoComplete:`current-password`}),(0,o.jsx)(`button`,{type:`submit`,className:`btn login-btn`,disabled:_,children:_?`Signing in...`:`Sign In`})]}):(0,o.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),g(null),v(!0);try{let{error:t}=await i.signUp.email({email:d,password:l,name:p||s,username:s});if(t){g(t.message||`Registration failed`),v(!1);return}e({to:`/`})}catch(e){g(e instanceof Error?e.message:`Registration failed`),v(!1)}},children:[(0,o.jsx)(`label`,{htmlFor:`reg-username`,children:`Username`}),(0,o.jsx)(`input`,{id:`reg-username`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`username`,required:!0,autoComplete:`username`}),(0,o.jsx)(`label`,{htmlFor:`reg-name`,children:`Display Name`}),(0,o.jsx)(`input`,{id:`reg-name`,type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:`John Doe`,autoComplete:`name`}),(0,o.jsx)(`label`,{htmlFor:`reg-email`,children:`Email`}),(0,o.jsx)(`input`,{id:`reg-email`,type:`email`,value:d,onChange:e=>f(e.target.value),placeholder:`user@example.com`,required:!0,autoComplete:`email`}),(0,o.jsx)(`label`,{htmlFor:`reg-password`,children:`Password`}),(0,o.jsx)(`input`,{id:`reg-password`,type:`password`,value:l,onChange:e=>u(e.target.value),placeholder:`password`,required:!0,minLength:4,autoComplete:`new-password`}),(0,o.jsx)(`button`,{type:`submit`,className:`btn login-btn`,disabled:_,children:_?`Creating account...`:`Create Account`})]}),(0,o.jsx)(`div`,{className:`login-divider`,children:(0,o.jsx)(`span`,{children:`or`})}),(0,o.jsx)(`button`,{type:`button`,className:`btn btn-outline login-btn`,onClick:async()=>{g(null),v(!0);try{let{error:t}=await i.signIn.anonymous();if(t){g(t.message||`Anonymous login failed`),v(!1);return}e({to:`/`})}catch(e){g(e instanceof Error?e.message:`Anonymous login failed`),v(!1)}},disabled:_,children:`Continue as Guest`}),(0,o.jsx)(`p`,{className:`login-hint`,children:`Guests can view translations but cannot make changes.`})]})})}export{s as component};
|