termdock 1.4.353 → 1.4.355
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/THIRD_PARTY_NOTICES.md +56 -0
- package/dist/client/assets/AndroidMirrorView-BC_6L3mG.js +3 -0
- package/dist/client/assets/AndroidMirrorView-BC_6L3mG.js.br +0 -0
- package/dist/client/assets/AndroidMirrorView-BC_6L3mG.js.gz +0 -0
- package/dist/client/assets/{App-AjjtXg93.js → App-BGECv_n_.js} +36 -36
- package/dist/client/assets/App-BGECv_n_.js.br +0 -0
- package/dist/client/assets/App-BGECv_n_.js.gz +0 -0
- package/dist/client/assets/{ArchitecturePanel-Xi_R4Tso.js → ArchitecturePanel-CYdolNzT.js} +3 -3
- package/dist/client/assets/ArchitecturePanel-CYdolNzT.js.br +0 -0
- package/dist/client/assets/ArchitecturePanel-CYdolNzT.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-mAiaX5i8.js +2 -0
- package/dist/client/assets/ChangeWalkthroughPanel-mAiaX5i8.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-mAiaX5i8.js.gz +0 -0
- package/dist/client/assets/ChatRichContent-D2NtgMuL.js +277 -0
- package/dist/client/assets/ChatRichContent-D2NtgMuL.js.br +0 -0
- package/dist/client/assets/ChatRichContent-D2NtgMuL.js.gz +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-CcHsVfXD.js +1 -0
- package/dist/client/assets/CollaborationMainWorkspace-CcHsVfXD.js.br +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-CcHsVfXD.js.gz +0 -0
- package/dist/client/assets/{CollaborationTaskContent-D_NDzA-t.js → CollaborationTaskContent-FcrGGSr_.js} +2 -2
- package/dist/client/assets/{ComputerControlView-BGvF5NeQ.js → ComputerControlView-DU9krDsg.js} +4 -4
- package/dist/client/assets/ComputerControlView-DU9krDsg.js.br +0 -0
- package/dist/client/assets/ComputerControlView-DU9krDsg.js.gz +0 -0
- package/dist/client/assets/DagPlayground-CbEuQA68.js +1 -0
- package/dist/client/assets/DagPlayground-CbEuQA68.js.br +0 -0
- package/dist/client/assets/DagPlayground-CbEuQA68.js.gz +0 -0
- package/dist/client/assets/{DiffLab-CDt8EP6I.js → DiffLab-PysBkJrJ.js} +1 -1
- package/dist/client/assets/DiffLab-PysBkJrJ.js.br +0 -0
- package/dist/client/assets/DiffLab-PysBkJrJ.js.gz +0 -0
- package/dist/client/assets/DiffReview-Ce3wKMBk.js +1 -0
- package/dist/client/assets/DiffReview-Ce3wKMBk.js.br +0 -0
- package/dist/client/assets/DiffReview-Ce3wKMBk.js.gz +0 -0
- package/dist/client/assets/{DiffReviewLab-YqgsRn_K.js → DiffReviewLab-D6PxvtBY.js} +2 -2
- package/dist/client/assets/DiffReviewLab-D6PxvtBY.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-D6PxvtBY.js.gz +0 -0
- package/dist/client/assets/{DiffViewer-CT5_YwM2.js → DiffViewer-Bp-BLT2f.js} +1 -1
- package/dist/client/assets/DiffViewer-Bp-BLT2f.js.br +0 -0
- package/dist/client/assets/DiffViewer-Bp-BLT2f.js.gz +0 -0
- package/dist/client/assets/GitLoadingSkeleton-Fa4AXG-N.js +1 -0
- package/dist/client/assets/GitLoadingSkeleton-Fa4AXG-N.js.br +0 -0
- package/dist/client/assets/GitLoadingSkeleton-Fa4AXG-N.js.gz +0 -0
- package/dist/client/assets/{MarkdownPreview-DHLp5cqt.js → MarkdownPreview-_Z5UzhLt.js} +2 -2
- package/dist/client/assets/MarkdownPreview-_Z5UzhLt.js.br +0 -0
- package/dist/client/assets/MarkdownPreview-_Z5UzhLt.js.gz +0 -0
- package/dist/client/assets/{ModelPreview-DymFzc55.js → ModelPreview-Cl0X7I-U.js} +3 -3
- package/dist/client/assets/ModelPreview-Cl0X7I-U.js.br +0 -0
- package/dist/client/assets/ModelPreview-Cl0X7I-U.js.gz +0 -0
- package/dist/client/assets/{RecordingSaveDialog-CxSN76bp.js → RecordingSaveDialog-Ca2iJsOW.js} +1 -1
- package/dist/client/assets/RecordingSaveDialog-Ca2iJsOW.js.br +0 -0
- package/dist/client/assets/RecordingSaveDialog-Ca2iJsOW.js.gz +0 -0
- package/dist/client/assets/{RightSidebar-eIuDnhJn.js → RightSidebar-CwXIBpEw.js} +20 -20
- package/dist/client/assets/RightSidebar-CwXIBpEw.js.br +0 -0
- package/dist/client/assets/RightSidebar-CwXIBpEw.js.gz +0 -0
- package/dist/client/assets/SessionChatView-D3sLcYAc.js +13 -0
- package/dist/client/assets/SessionChatView-D3sLcYAc.js.br +0 -0
- package/dist/client/assets/SessionChatView-D3sLcYAc.js.gz +0 -0
- package/dist/client/assets/SessionResourceSidebar-BObKJeA9.js +2 -0
- package/dist/client/assets/SessionResourceSidebar-BObKJeA9.js.br +0 -0
- package/dist/client/assets/SessionResourceSidebar-BObKJeA9.js.gz +0 -0
- package/dist/client/assets/TodoWorkspace-BdesAuz4.js +1 -0
- package/dist/client/assets/TodoWorkspace-BdesAuz4.js.br +0 -0
- package/dist/client/assets/TodoWorkspace-BdesAuz4.js.gz +0 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-DI1Y-QAP.js → abnfDiagram-VCTEODGH-BajyXVpH.js} +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-BajyXVpH.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-BajyXVpH.js.gz +0 -0
- package/dist/client/assets/app-C3WX_u_Z.js +37 -0
- package/dist/client/assets/app-C3WX_u_Z.js.br +0 -0
- package/dist/client/assets/app-C3WX_u_Z.js.gz +0 -0
- package/dist/client/assets/{arc-QdJAJx_D.js → arc-CbhM5I2d.js} +1 -1
- package/dist/client/assets/arc-CbhM5I2d.js.br +0 -0
- package/dist/client/assets/arc-CbhM5I2d.js.gz +0 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-Bw2CvoGg.js → architectureDiagram-5GKGNRK7-CDKLcS6D.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-CDKLcS6D.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-CDKLcS6D.js.gz +0 -0
- package/dist/client/assets/{arrow-down-CZKuaGwN.js → arrow-down-Dp27yS0N.js} +1 -1
- package/dist/client/assets/{arrow-up-CYLC6_to.js → arrow-up-BEUQcf-s.js} +1 -1
- package/dist/client/assets/{blockDiagram-I7D4REHJ-CM2GI6sC.js → blockDiagram-I7D4REHJ-CXiIO6_W.js} +1 -1
- package/dist/client/assets/blockDiagram-I7D4REHJ-CXiIO6_W.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-CXiIO6_W.js.gz +0 -0
- package/dist/client/assets/{c4Diagram-7LVT6UL2-BAB2TKr4.js → c4Diagram-7LVT6UL2-uZ-i2eKH.js} +1 -1
- package/dist/client/assets/c4Diagram-7LVT6UL2-uZ-i2eKH.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-uZ-i2eKH.js.gz +0 -0
- package/dist/client/assets/channel-Dg7JKsqi.js +1 -0
- package/dist/client/assets/{chevron-left-BNby2AjR.js → chevron-left-D8ntyw2S.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-DI2pKKMQ.js → chunk-2Q5K7J3B-DVe3dVJR.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-D5l5zyYl.js → chunk-5VM5RSS4-BDBNKGuU.js} +1 -1
- package/dist/client/assets/{chunk-F27PBJKO-Japl432v.js → chunk-F27PBJKO-BP7hTwtm.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-BP7hTwtm.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-BP7hTwtm.js.gz +0 -0
- package/dist/client/assets/{chunk-IMKFNOWR-CDJoLgpw.js → chunk-IMKFNOWR-LIGuOtnb.js} +1 -1
- package/dist/client/assets/chunk-IMKFNOWR-LIGuOtnb.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-LIGuOtnb.js.gz +0 -0
- package/dist/client/assets/{chunk-JWPE2WC7-BQ2cpPDE.js → chunk-JWPE2WC7-C1_iFEvk.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-CWjI0yRx.js → chunk-POPQ4Y6H-CYZsO-QL.js} +1 -1
- package/dist/client/assets/{chunk-SVP7TREG-BzEphMpl.js → chunk-SVP7TREG-FnWYLNCS.js} +1 -1
- package/dist/client/assets/chunk-SVP7TREG-FnWYLNCS.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-FnWYLNCS.js.gz +0 -0
- package/dist/client/assets/{chunk-TICWLB2K-B2hsw7jN.js → chunk-TICWLB2K-dcOCcmQq.js} +1 -1
- package/dist/client/assets/chunk-TICWLB2K-dcOCcmQq.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-dcOCcmQq.js.gz +0 -0
- package/dist/client/assets/{chunk-XXDRQBXY-BEWjHo7s.js → chunk-XXDRQBXY-B2H2Yt9G.js} +1 -1
- package/dist/client/assets/circle-Pldg1yI9.js +1 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-D6QBd_IP.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-D6QBd_IP.js +1 -0
- package/dist/client/assets/{clipboard-6kE6vzDi.js → clipboard-tTkMEO1S.js} +1 -1
- package/dist/client/assets/clipboardText-BapOM7QN.js +1 -0
- package/dist/client/assets/clipboardText-BapOM7QN.js.br +0 -0
- package/dist/client/assets/clipboardText-BapOM7QN.js.gz +0 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-DpS77pec.js → cose-bilkent-JH36ORCC-Bz38mqD8.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-Bz38mqD8.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-Bz38mqD8.js.gz +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-D1y5kNwR.js → cynefin-OW5HDTMX-CZAa1A6y.js} +1 -1
- package/dist/client/assets/cynefin-OW5HDTMX-CZAa1A6y.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-CZAa1A6y.js.gz +0 -0
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-CqTCLyMC.js → cynefinDiagram-5FMLGOSQ-BaQnW4VG.js} +1 -1
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-BaQnW4VG.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-BaQnW4VG.js.gz +0 -0
- package/dist/client/assets/{dagre-GXQ25YYZ-DkJ-kRn6.js → dagre-GXQ25YYZ-BdnT61bc.js} +1 -1
- package/dist/client/assets/dagre-GXQ25YYZ-BdnT61bc.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-BdnT61bc.js.gz +0 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-DenrrE_C.js → diagram-S7CK7UJ4-BWiF8QNc.js} +1 -1
- package/dist/client/assets/diagram-S7CK7UJ4-BWiF8QNc.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-BWiF8QNc.js.gz +0 -0
- package/dist/client/assets/{diagram-UQ7AKVKN-B2ikSD8K.js → diagram-UQ7AKVKN-DLURjCFp.js} +1 -1
- package/dist/client/assets/diagram-UQ7AKVKN-DLURjCFp.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-DLURjCFp.js.gz +0 -0
- package/dist/client/assets/{diagram-VSXAHHWV-CQcNoZDC.js → diagram-VSXAHHWV-DYIcLklz.js} +1 -1
- package/dist/client/assets/diagram-VSXAHHWV-DYIcLklz.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-DYIcLklz.js.gz +0 -0
- package/dist/client/assets/{diagram-VX7I27RA-Cq3FaI-1.js → diagram-VX7I27RA-C9vqviXX.js} +1 -1
- package/dist/client/assets/diagram-VX7I27RA-C9vqviXX.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-C9vqviXX.js.gz +0 -0
- package/dist/client/assets/{diagram-Z3DM3KII-BcWReLM8.js → diagram-Z3DM3KII-BJuQxTkw.js} +1 -1
- package/dist/client/assets/diagram-Z3DM3KII-BJuQxTkw.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-BJuQxTkw.js.gz +0 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-DwwFkjaL.js → ebnfDiagram-PWID7BFC-BcbISm-z.js} +1 -1
- package/dist/client/assets/ebnfDiagram-PWID7BFC-BcbISm-z.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-BcbISm-z.js.gz +0 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-B1MNvouo.js → erDiagram-RLTQ6QDP-fhNpRzUG.js} +1 -1
- package/dist/client/assets/erDiagram-RLTQ6QDP-fhNpRzUG.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-fhNpRzUG.js.gz +0 -0
- package/dist/client/assets/external-link-DE8Gj-da.js +1 -0
- package/dist/client/assets/{flowDiagram-HODETNUW-B_tIl0Vb.js → flowDiagram-HODETNUW-CVDJ_1Zu.js} +1 -1
- package/dist/client/assets/flowDiagram-HODETNUW-CVDJ_1Zu.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-CVDJ_1Zu.js.gz +0 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CV0YyZHk.js → ganttDiagram-EL5Y4UJY-Dzn-mrfe.js} +1 -1
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-Dzn-mrfe.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-Dzn-mrfe.js.gz +0 -0
- package/dist/client/assets/{git-compare-CGiJqTYP.js → git-compare-Ct2eJNs4.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-DZvnSoyE.js → gitGraphDiagram-WWUBYQGX-Ci-wfvCz.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-Ci-wfvCz.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-Ci-wfvCz.js.gz +0 -0
- package/dist/client/assets/index-ByrWASlZ.js +1 -0
- package/dist/client/assets/index-ByrWASlZ.js.br +0 -0
- package/dist/client/assets/index-ByrWASlZ.js.gz +0 -0
- package/dist/client/assets/{index-CA1fR_jI.css → index-DOq3vkFG.css} +1 -1
- package/dist/client/assets/index-DOq3vkFG.css.br +0 -0
- package/dist/client/assets/{index-CA1fR_jI.css.gz → index-DOq3vkFG.css.gz} +0 -0
- package/dist/client/assets/{infoDiagram-27XIBGKW-G1OS50nR.js → infoDiagram-27XIBGKW-npBmeTt7.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-C0-s6pfy.js → ishikawaDiagram-5VMMS53U-CCn5Ha25.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-CCn5Ha25.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-CCn5Ha25.js.gz +0 -0
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-B-9Omdit.js → journeyDiagram-3NMN7TZE-CPl5oPfe.js} +1 -1
- package/dist/client/assets/journeyDiagram-3NMN7TZE-CPl5oPfe.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-CPl5oPfe.js.gz +0 -0
- package/dist/client/assets/{kanban-definition-UXKFOSKX-BS_qXegp.js → kanban-definition-UXKFOSKX-Dmia2kLZ.js} +1 -1
- package/dist/client/assets/kanban-definition-UXKFOSKX-Dmia2kLZ.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-Dmia2kLZ.js.gz +0 -0
- package/dist/client/assets/{layout-0NYin1Qz.js → layout-B2Kz5M73.js} +1 -1
- package/dist/client/assets/layout-B2Kz5M73.js.br +0 -0
- package/dist/client/assets/layout-B2Kz5M73.js.gz +0 -0
- package/dist/client/assets/{linear-CTVKrsxK.js → linear-D2CT7wE3.js} +1 -1
- package/dist/client/assets/linear-D2CT7wE3.js.br +0 -0
- package/dist/client/assets/linear-D2CT7wE3.js.gz +0 -0
- package/dist/client/assets/{link-C5oPMHMJ.js → link-x33s12VI.js} +3 -3
- package/dist/client/assets/link-x33s12VI.js.br +0 -0
- package/dist/client/assets/link-x33s12VI.js.gz +0 -0
- package/dist/client/assets/{list-tree-BPg9QdiM.js → list-tree-XBmm9il2.js} +1 -1
- package/dist/client/assets/{loader-circle-CTtHKNWd.js → loader-circle-D_nJKmMD.js} +1 -1
- package/dist/client/assets/{maximize-2-32OfQ0kG.js → maximize-2-t-zzENew.js} +1 -1
- package/dist/client/assets/{mermaid.core-BgCZP9ke.js → mermaid.core-G9XIcppl.js} +5 -5
- package/dist/client/assets/mermaid.core-G9XIcppl.js.br +0 -0
- package/dist/client/assets/mermaid.core-G9XIcppl.js.gz +0 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-BjSZRjkg.js → mindmap-definition-YA3MSWOX-D2OX9OkO.js} +1 -1
- package/dist/client/assets/mindmap-definition-YA3MSWOX-D2OX9OkO.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-D2OX9OkO.js.gz +0 -0
- package/dist/client/assets/{passwordBootstrap-CXQgj5nw.js → passwordBootstrap-DkTynZfV.js} +2 -2
- package/dist/client/assets/passwordBootstrap-DkTynZfV.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-DkTynZfV.js.gz +0 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-qDU0sU6m.js → pegDiagram-XKGWAZYB-qNjd6dbd.js} +1 -1
- package/dist/client/assets/pegDiagram-XKGWAZYB-qNjd6dbd.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-qNjd6dbd.js.gz +0 -0
- package/dist/client/assets/{pieDiagram-E7YTZNPT-CZF3MEOJ.js → pieDiagram-E7YTZNPT-DcCmKDFh.js} +1 -1
- package/dist/client/assets/pieDiagram-E7YTZNPT-DcCmKDFh.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-DcCmKDFh.js.gz +0 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-DcZW4RMG.js → quadrantDiagram-AXDQQJYC-BpDzkl9h.js} +1 -1
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-BpDzkl9h.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-BpDzkl9h.js.gz +0 -0
- package/dist/client/assets/{quote-CuTMveNr.js → quote-DeByS04O.js} +1 -1
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-DtQROK31.js → railroadDiagram-O6MQD6OU-DkwV8w7x.js} +1 -1
- package/dist/client/assets/railroadDiagram-O6MQD6OU-DkwV8w7x.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-DkwV8w7x.js.gz +0 -0
- package/dist/client/assets/{rdpSession-a1ZvAyiW.js → rdpSession-D5NrFTav.js} +1 -1
- package/dist/client/assets/rdpSession-D5NrFTav.js.br +0 -0
- package/dist/client/assets/rdpSession-D5NrFTav.js.gz +0 -0
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-B8yR39lm.js → requirementDiagram-BXWQKSXE-BRwt5MXl.js} +1 -1
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-B8yR39lm.js.br → requirementDiagram-BXWQKSXE-BRwt5MXl.js.br} +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-BRwt5MXl.js.gz +0 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-D27zuIFg.js → sankeyDiagram-P5KCCOFB-DZ8y_gv3.js} +1 -1
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-DZ8y_gv3.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-DZ8y_gv3.js.gz +0 -0
- package/dist/client/assets/search-CDJ4fv-q.js +1 -0
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-BI3gSsUa.js → sequenceDiagram-WJ2MYXX4-CJ9lZEsN.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-BI3gSsUa.js.br → sequenceDiagram-WJ2MYXX4-CJ9lZEsN.js.br} +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-CJ9lZEsN.js.gz +0 -0
- package/dist/client/assets/{settings-2-GFFo5UwO.js → settings-2-DtFz7lgk.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-NBzIIRER.js → sizeCapture-INFHLROL-Dt9ZzegQ.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-Dt9ZzegQ.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-Dt9ZzegQ.js.gz +0 -0
- package/dist/client/assets/{stateDiagram-D77RDMKH-D-D0FB4D.js → stateDiagram-D77RDMKH-DgeQtV3s.js} +1 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-DgeQtV3s.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-DgeQtV3s.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CKS6y2rR.js +1 -0
- package/dist/client/assets/sun-CvzpsfHU.js +1 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-CH_jxbV3.js → swimlanes-42K2YHIH-DHB6MQ8v.js} +1 -1
- package/dist/client/assets/swimlanes-42K2YHIH-DHB6MQ8v.js.br +0 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-CH_jxbV3.js.gz → swimlanes-42K2YHIH-DHB6MQ8v.js.gz} +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-DvUzDKPI.js +8 -0
- package/dist/client/assets/{syntaxHighlight-C9PKWUqs.js → syntaxHighlight-DF6Q5phI.js} +1 -1
- package/dist/client/assets/syntaxHighlight-DF6Q5phI.js.br +0 -0
- package/dist/client/assets/syntaxHighlight-DF6Q5phI.js.gz +0 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-DuiaCBON.js → timeline-definition-24CTP7MA-EqVVyv-E.js} +1 -1
- package/dist/client/assets/timeline-definition-24CTP7MA-EqVVyv-E.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-EqVVyv-E.js.gz +0 -0
- package/dist/client/assets/{triangle-alert-CuGUScPU.js → triangle-alert--5QOrsVl.js} +1 -1
- package/dist/client/assets/{unplug-C0pb-BKU.js → unplug-BNUx6Lmk.js} +1 -1
- package/dist/client/assets/{vennDiagram-4TSXK5OY-DUEZFEzo.js → vennDiagram-4TSXK5OY-BBE17-sL.js} +1 -1
- package/dist/client/assets/vennDiagram-4TSXK5OY-BBE17-sL.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-BBE17-sL.js.gz +0 -0
- package/dist/client/assets/{videoCompression-JAcp0atl.js → videoCompression-B09OiyP5.js} +1 -1
- package/dist/client/assets/videoCompression-B09OiyP5.js.br +0 -0
- package/dist/client/assets/videoCompression-B09OiyP5.js.gz +0 -0
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CnHmIbot.js → wardleyDiagram-VM6X3IG4-B4gZGXiA.js} +1 -1
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-B4gZGXiA.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-B4gZGXiA.js.gz +0 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-CDAoHQTr.js → xychartDiagram-S5SC5T6Z-BDO5xF5D.js} +1 -1
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-BDO5xF5D.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-BDO5xF5D.js.gz +0 -0
- package/dist/client/index.html +2 -2
- package/dist/client/index.html.br +0 -0
- package/dist/client/index.html.gz +0 -0
- package/dist/client/sw.js +1 -1
- package/dist/client/sw.js.br +0 -0
- package/dist/client/sw.js.gz +0 -0
- package/dist/server/agent/chatUIPrompt.js +13 -0
- package/dist/server/agent/collaborationCli.js +8 -2
- package/dist/server/agent/collaborationPrompt.js +2 -2
- package/dist/server/agent/collaborationStore.js +17 -0
- package/dist/server/agent/sessionChatRoutes.js +23 -1
- package/dist/server/cli.js +5 -0
- package/dist/server/federation/accessPolicy.js +3 -0
- package/dist/server/federation/authorization.js +7 -3
- package/dist/server/federation/invitations.js +9 -6
- package/dist/server/federation/runtime.js +8 -1
- package/dist/server/shared/chatPresentation.js +36 -0
- package/dist/server/shared/chatUILibrary.js +26 -0
- package/dist/server/shared/sessionAppearance.js +17 -0
- package/package.json +4 -1
- package/runtime-manifest.json +4 -4
- package/dist/client/assets/AndroidMirrorView-C39BgFa_.js +0 -3
- package/dist/client/assets/AndroidMirrorView-C39BgFa_.js.br +0 -0
- package/dist/client/assets/AndroidMirrorView-C39BgFa_.js.gz +0 -0
- package/dist/client/assets/App-AjjtXg93.js.br +0 -0
- package/dist/client/assets/App-AjjtXg93.js.gz +0 -0
- package/dist/client/assets/ArchitecturePanel-Xi_R4Tso.js.br +0 -0
- package/dist/client/assets/ArchitecturePanel-Xi_R4Tso.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-BH1Una8m.js +0 -2
- package/dist/client/assets/ChangeWalkthroughPanel-BH1Una8m.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-BH1Una8m.js.gz +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-CA9ZGT5N.js +0 -1
- package/dist/client/assets/CollaborationMainWorkspace-CA9ZGT5N.js.br +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-CA9ZGT5N.js.gz +0 -0
- package/dist/client/assets/ComputerControlView-BGvF5NeQ.js.br +0 -0
- package/dist/client/assets/ComputerControlView-BGvF5NeQ.js.gz +0 -0
- package/dist/client/assets/DagPlayground-CKqB6zap.js +0 -1
- package/dist/client/assets/DagPlayground-CKqB6zap.js.br +0 -0
- package/dist/client/assets/DagPlayground-CKqB6zap.js.gz +0 -0
- package/dist/client/assets/DiffLab-CDt8EP6I.js.br +0 -0
- package/dist/client/assets/DiffLab-CDt8EP6I.js.gz +0 -0
- package/dist/client/assets/DiffReview-YADkwVd6.js +0 -1
- package/dist/client/assets/DiffReview-YADkwVd6.js.br +0 -0
- package/dist/client/assets/DiffReview-YADkwVd6.js.gz +0 -0
- package/dist/client/assets/DiffReviewLab-YqgsRn_K.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-YqgsRn_K.js.gz +0 -0
- package/dist/client/assets/DiffViewer-CT5_YwM2.js.br +0 -0
- package/dist/client/assets/DiffViewer-CT5_YwM2.js.gz +0 -0
- package/dist/client/assets/GitLoadingSkeleton-DfWzAnA2.js +0 -1
- package/dist/client/assets/GitLoadingSkeleton-DfWzAnA2.js.br +0 -0
- package/dist/client/assets/GitLoadingSkeleton-DfWzAnA2.js.gz +0 -0
- package/dist/client/assets/MarkdownPreview-DHLp5cqt.js.br +0 -0
- package/dist/client/assets/MarkdownPreview-DHLp5cqt.js.gz +0 -0
- package/dist/client/assets/ModelPreview-DymFzc55.js.br +0 -0
- package/dist/client/assets/ModelPreview-DymFzc55.js.gz +0 -0
- package/dist/client/assets/RecordingSaveDialog-CxSN76bp.js.br +0 -0
- package/dist/client/assets/RecordingSaveDialog-CxSN76bp.js.gz +0 -0
- package/dist/client/assets/RightSidebar-eIuDnhJn.js.br +0 -0
- package/dist/client/assets/RightSidebar-eIuDnhJn.js.gz +0 -0
- package/dist/client/assets/SessionChatView-C5wXAt7h.js +0 -13
- package/dist/client/assets/SessionChatView-C5wXAt7h.js.br +0 -0
- package/dist/client/assets/SessionChatView-C5wXAt7h.js.gz +0 -0
- package/dist/client/assets/SessionResourceSidebar-Czai5Bt3.js +0 -2
- package/dist/client/assets/SessionResourceSidebar-Czai5Bt3.js.br +0 -0
- package/dist/client/assets/SessionResourceSidebar-Czai5Bt3.js.gz +0 -0
- package/dist/client/assets/TodoWorkspace-BftnnEU0.js +0 -1
- package/dist/client/assets/TodoWorkspace-BftnnEU0.js.br +0 -0
- package/dist/client/assets/TodoWorkspace-BftnnEU0.js.gz +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-DI1Y-QAP.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-DI1Y-QAP.js.gz +0 -0
- package/dist/client/assets/app-DvMXSNN7.js +0 -36
- package/dist/client/assets/app-DvMXSNN7.js.br +0 -0
- package/dist/client/assets/app-DvMXSNN7.js.gz +0 -0
- package/dist/client/assets/arc-QdJAJx_D.js.br +0 -0
- package/dist/client/assets/arc-QdJAJx_D.js.gz +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-Bw2CvoGg.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-Bw2CvoGg.js.gz +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-CM2GI6sC.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-CM2GI6sC.js.gz +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-BAB2TKr4.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-BAB2TKr4.js.gz +0 -0
- package/dist/client/assets/channel-CcDRt0AM.js +0 -1
- package/dist/client/assets/chunk-F27PBJKO-Japl432v.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-Japl432v.js.gz +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-CDJoLgpw.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-CDJoLgpw.js.gz +0 -0
- package/dist/client/assets/chunk-SVP7TREG-BzEphMpl.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-BzEphMpl.js.gz +0 -0
- package/dist/client/assets/chunk-TICWLB2K-B2hsw7jN.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-B2hsw7jN.js.gz +0 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-Dz0qH9Hg.js +0 -1
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-Dz0qH9Hg.js +0 -1
- package/dist/client/assets/clipboardText-B7202UNa.js +0 -1
- package/dist/client/assets/clipboardText-B7202UNa.js.br +0 -0
- package/dist/client/assets/clipboardText-B7202UNa.js.gz +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-DpS77pec.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-DpS77pec.js.gz +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-D1y5kNwR.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-D1y5kNwR.js.gz +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CqTCLyMC.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CqTCLyMC.js.gz +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-DkJ-kRn6.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-DkJ-kRn6.js.gz +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-DenrrE_C.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-DenrrE_C.js.gz +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-B2ikSD8K.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-B2ikSD8K.js.gz +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-CQcNoZDC.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-CQcNoZDC.js.gz +0 -0
- package/dist/client/assets/diagram-VX7I27RA-Cq3FaI-1.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-Cq3FaI-1.js.gz +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-BcWReLM8.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-BcWReLM8.js.gz +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-DwwFkjaL.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-DwwFkjaL.js.gz +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-B1MNvouo.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-B1MNvouo.js.gz +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-B_tIl0Vb.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-B_tIl0Vb.js.gz +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-CV0YyZHk.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-CV0YyZHk.js.gz +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-DZvnSoyE.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-DZvnSoyE.js.gz +0 -0
- package/dist/client/assets/index-CA1fR_jI.css.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-C0-s6pfy.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-C0-s6pfy.js.gz +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-B-9Omdit.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-B-9Omdit.js.gz +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-BS_qXegp.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-BS_qXegp.js.gz +0 -0
- package/dist/client/assets/layout-0NYin1Qz.js.br +0 -0
- package/dist/client/assets/layout-0NYin1Qz.js.gz +0 -0
- package/dist/client/assets/linear-CTVKrsxK.js.br +0 -0
- package/dist/client/assets/linear-CTVKrsxK.js.gz +0 -0
- package/dist/client/assets/link-C5oPMHMJ.js.br +0 -0
- package/dist/client/assets/link-C5oPMHMJ.js.gz +0 -0
- package/dist/client/assets/mermaid.core-BgCZP9ke.js.br +0 -0
- package/dist/client/assets/mermaid.core-BgCZP9ke.js.gz +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-BjSZRjkg.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-BjSZRjkg.js.gz +0 -0
- package/dist/client/assets/passwordBootstrap-CXQgj5nw.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-CXQgj5nw.js.gz +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-qDU0sU6m.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-qDU0sU6m.js.gz +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-CZF3MEOJ.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-CZF3MEOJ.js.gz +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-DcZW4RMG.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-DcZW4RMG.js.gz +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-DtQROK31.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-DtQROK31.js.gz +0 -0
- package/dist/client/assets/rdpSession-a1ZvAyiW.js.br +0 -0
- package/dist/client/assets/rdpSession-a1ZvAyiW.js.gz +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-B8yR39lm.js.gz +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-D27zuIFg.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-D27zuIFg.js.gz +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BI3gSsUa.js.gz +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-NBzIIRER.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-NBzIIRER.js.gz +0 -0
- package/dist/client/assets/sparkles-ZXBp-KvJ.js +0 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-D-D0FB4D.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-D-D0FB4D.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-Dk-QpCnJ.js +0 -1
- package/dist/client/assets/sun-CO5F9zS4.js +0 -1
- package/dist/client/assets/swimlanes-42K2YHIH-CH_jxbV3.js.br +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-C4E5FOdv.js +0 -8
- package/dist/client/assets/syntaxHighlight-C9PKWUqs.js.br +0 -0
- package/dist/client/assets/syntaxHighlight-C9PKWUqs.js.gz +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-DuiaCBON.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-DuiaCBON.js.gz +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-DUEZFEzo.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-DUEZFEzo.js.gz +0 -0
- package/dist/client/assets/videoCompression-JAcp0atl.js.br +0 -0
- package/dist/client/assets/videoCompression-JAcp0atl.js.gz +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-CnHmIbot.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-CnHmIbot.js.gz +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-CDAoHQTr.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-CDAoHQTr.js.gz +0 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-ByrWASlZ.js","assets/react-XDCjal2T.js","assets/RightSidebar-CwXIBpEw.js","assets/app-C3WX_u_Z.js","assets/dnd-BCFAPC0L.js","assets/terminal-Dea8wJF3.js","assets/index-DOq3vkFG.css","assets/MarkdownPreview-_Z5UzhLt.js","assets/use-gesture-react.esm-DYpdiE_k.js","assets/swiper-DJjq1TYT.js","assets/swiper-C2J0D0kV.css","assets/syntaxHighlight-DF6Q5phI.js","assets/list-tree-XBmm9il2.js","assets/GitLoadingSkeleton-Fa4AXG-N.js","assets/RecordingSaveDialog-Ca2iJsOW.js","assets/gestureArbiter-DszagC-d.js","assets/arrow-up-BEUQcf-s.js","assets/DiffReview-Ce3wKMBk.js","assets/DiffViewer-Bp-BLT2f.js","assets/git-compare-Ct2eJNs4.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert--5QOrsVl.js","assets/ChangeWalkthroughPanel-mAiaX5i8.js","assets/chevron-left-D8ntyw2S.js","assets/maximize-2-t-zzENew.js","assets/AndroidMirrorView-BC_6L3mG.js","assets/v4-EwEgHOG0.js","assets/unplug-BNUx6Lmk.js","assets/circle-Pldg1yI9.js","assets/loader-circle-D_nJKmMD.js","assets/search-CDJ4fv-q.js","assets/arrow-down-Dp27yS0N.js","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{aV as ya,a5 as Lo,cg as g,dm as ba,aY as Er,o as va,eb as _a,a4 as wa,ao as Sa,C as ka,d1 as $a,p as Oa}from"./app-C3WX_u_Z.js";import{b as w,r as ja}from"./dnd-BCFAPC0L.js";import{C as jt}from"./SessionChatView-D3sLcYAc.js";import{C as xa}from"./circle-Pldg1yI9.js";import{S as Aa}from"./search-CDJ4fv-q.js";import{E as Ea}from"./external-link-DE8Gj-da.js";import"./react-XDCjal2T.js";import"./terminal-Dea8wJF3.js";import"./quote-DeByS04O.js";import"./clipboardText-BapOM7QN.js";import"./loader-circle-D_nJKmMD.js";import"./arrow-down-Dp27yS0N.js";import"./arrow-up-BEUQcf-s.js";const za=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]],Ia=ya("arrow-down-up",za),Ta=globalThis;Ta[Symbol.for("openui.devtools.autoMount")]=!0;const Ra=2e3;function Na(e){const t=e?.OPENUI_POSTHOG_HOST??"https://dgoeivjus9jfp.cloudfront.net";return{apiKey:e?.OPENUI_POSTHOG_KEY??"phc_3OLW53x09ZTVZSV6BEpj5uycj3ooqR6KOemOjx04e3D",captureUrl:new URL("/capture/",t).toString()}}function $n(e){return e==="1"||e?.toLowerCase()==="true"}function Pa(e){return $n(e?.OPENUI_TELEMETRY_DISABLED)||$n(e?.DO_NOT_TRACK)}function Ca(e){return $n(e?.OPENUI_RUNTIME_TELEMETRY_ENABLED)&&!Pa(e)}function Bo(e){const t=e.trim();if(!t)return"";try{const r=new URL(t),o=bt(decodeURIComponent(r.pathname));if(r.protocol==="file:")return`file:${o}`;if(r.host)return zr(r.host,o)}catch{}if(/^[A-Za-z]:[\\/]/.test(t))return bt(t);const n=/^(?:[^@/\s]+@)?([^:/\s]+):(.+)$/.exec(t);return n?zr(n[1],n[2]):bt(t)}function zr(e,t){const n=e.trim().toLowerCase(),r=bt(t);return r?`${n}/${r}`:n}function bt(e){return e.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,"").replace(/\.git$/i,"")}function On(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Ir(e,t="|"){return e.map(n=>Qo(n)).join(t)}function jn(e,t){return typeof t=="bigint"?t.toString():t}class Za{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function Qn(e){return new Za(e)}function Ma(e){return e==null}function Yn(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Da(e,t){const n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}function $e(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function qo(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ke(e){return qo(e._zod.def)??e._zod.def.shape}function Jo(e,t,n){Object.defineProperty(e,t,{get(){const r=n();return $e(this,t,r),r},enumerable:!0,configurable:!0})}function Vo(e,t,n){t in e?$e(e,t,n):e[t]=n}function Ce(e,t,n,r){const o=ke(t);for(const s of n){const i=Object.getOwnPropertyDescriptor(o,s);i.enumerable&&(i.get?Jo(e,s,()=>{const a=t._zod.def.shape[s];return r?r(a,s):a}):Vo(e,s,r?r(i.value,s):i.value))}}function Ua(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Jo(e,n,()=>t[n]):Vo(e,n,r.value))}}function ue(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Fa(e){return JSON.stringify(e)}function La(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ko="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function xt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ba=Qn(()=>{if(ye.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Le(e){if(xt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(xt(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Wo(e){return Le(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const qa=new Set(["string","number","symbol"]);function Be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Oe(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function A(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Qo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ja(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const Yo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Va={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ka(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s={};return Ce(s,e,Wt(e,t)),Oe(e,ue(n,{shape:s,checks:[]}))}function Wt(e,t){const n=ke(e),r=[];for(const o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}function Wa(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=new Set(Wt(e,t)),i={};return Ce(i,e,Reflect.ownKeys(ke(e)).filter(a=>!s.has(a))),Oe(e,ue(n,{shape:i,checks:[]}))}function Qa(e,t){if(!Le(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=ke(e);for(const s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Oe(e,ue(e._zod.def,{shape:Go(e,t)}))}function Go(e,t){const n={};return Ce(n,e,Reflect.ownKeys(ke(e))),Ua(n,t),n}function Ya(e,t){if(!Le(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Oe(e,ue(e._zod.def,{shape:Go(e,t)}))}function Ga(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};Ce(n,e,Reflect.ownKeys(ke(e))),Ce(n,t,Reflect.ownKeys(ke(t)));const r=ue(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Oe(e,r)}function Tr(e,t,n,r="partial"){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const a=n?new Set(Wt(t,n)):void 0,u={};return Ce(u,t,Reflect.ownKeys(ke(t)),e&&((c,l)=>a&&!a.has(l)?c:new e({type:"optional",innerType:c}))),Oe(t,ue(t._zod.def,{shape:u,checks:[]}))}function Ha(e,t,n){const r=n?new Set(Wt(t,n)):void 0,o={};return Ce(o,t,Reflect.ownKeys(ke(t)),(s,i)=>r&&!r.has(i)?s:new e({type:"nonoptional",innerType:s})),Oe(t,ue(t._zod.def,{shape:o}))}function we(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Xa(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Ze(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Qe(e){return typeof e=="string"?e:e?.message}function Rr(e){const t=[];for(const n of e??[]){const r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;const o=r.maximum??r.length??r.size;o>=0&&t.push([o,n])}return t}function xn(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function Ee(e,t,n){var r;const o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);const s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:Qe(e.inst?._zod.def?.error?.(e))??Qe(s?.(e))??Qe(t?.error?.(e))??Qe(n.customError?.(e))??Qe(n.localeError?.(e))??"Invalid input",a={};for(const u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(a[u]=e[u]);return a.path??(a.path=[]),a.message=i,t?.reportInput&&(a.input=e.input),a}const eu=/[\uD800-\uDBFF]/;function Gn(e){const t=e.length;if(!eu.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function Hn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function tu(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";const n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function nt(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function nu(e,t){for(const n in t){const r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):ru(e,n,r.value)}}function ze(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ho(e,t,n){return ze(e,t,n,!1)}function Xo(e,t){for(const n in e){const r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return ze(this,n,r(this))},set(o){ze(this,n,o)}})}return t}function ru(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:ze(this,t,n.bind(this))},set(r){ze(this,t,r)}})}function ou(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}let cn,xe=!1;const su={configurable:!0,get(){xe=!0}};function D(e,t,n){const r=Object.getPrototypeOf(e._zod);if(t in r&&cn!==e._zod){cn=void 0;return}cn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,su);const o=xe;xe=!1;try{const s=n(this);return xe?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),xe=xe||o,s}catch(s){throw delete this[t],xe=xe||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function iu(e,t,n,r){const o=ou(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){const s={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,s),s.value=n(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:s})}})}const au="~constantCatch";function uu(e){const t=()=>e;return t[au]=!0,t}var Nr;const ln={value:void 0,enumerable:!1};let Pr="captureStackTrace"in Error?Error:null;function cu(e){const t=Pr;if(t){const n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return Pr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function b(e,t,n,r){const o={};function s(f){this.def=f,this.constr=p,this.traits=new Set}s.prototype=o;const i=n,a=i&&new WeakSet;function u(f,d){if(f._zod){if(f._zod.traits.has(e))return}else{ln.value=new s(d);try{Object.defineProperty(f,"_zod",ln)}finally{ln.value=void 0}}if(f._zod.traits.add(e),t(f,d),a){const h=Object.getPrototypeOf(f),y=f._zod.constr.prototype;let _=h;for(;_&&_!==y;)_=Object.getPrototypeOf(_);const v=_??h;a.has(v)||(a.add(v),nu(v,i))}const m=p.prototype;for(const h in m)Object.prototype.hasOwnProperty.call(m,h)&&(h in f||(f[h]=m[h].bind(f)))}const c=r?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:e});function p(f){const d=r?.Parent?cu(l):this;u(d,f);const m=d._zod.deferred;if(m){for(const y of m)y();d._zod.deferred=void 0}const h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(d),d}return Object.defineProperty(p,"init",{value:u}),Object.defineProperty(p,Symbol.hasInstance,{value:f=>r?.Parent&&f instanceof r.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(p,"name",{value:e}),p}class Pe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class es extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Nr=globalThis).__zod_globalConfig??(Nr.__zod_globalConfig={});const ye=globalThis.__zod_globalConfig;function _e(e){return e&&Object.assign(ye,e),ye}function lu(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,jn,2)),e.message}function fu(e){this._zod.message=e}const du={get:lu,set:fu,enumerable:!0,configurable:!0},fn={value:void 0,enumerable:!1},Cr=new WeakSet([Object.prototype,Error.prototype]),pu=(e,t)=>{e.name="$ZodError",fn.value=t,Object.defineProperty(e,"issues",fn),fn.value=void 0,Object.defineProperty(e,"message",du);const n=Object.getPrototypeOf(e);Cr.has(n)||(Cr.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},mu=b("$ZodError",pu);function hu(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function gu(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?hu(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function yu(e,t=n=>n.message){const n={_errors:[]},r=(o,s=[])=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{const a=[...s,...i.path];if(a.length===0)n._errors.push(t(i));else{let u=n,c=0;for(;c<a.length;){const l=a[c],p=c===a.length-1;if(l==="_errors"){p&&u._errors.push(t(i)),c++;continue}Object.prototype.hasOwnProperty.call(u,l)||Object.defineProperty(u,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const f=u[l];p&&f._errors.push(t(i)),u=f,c++}}}};return r(e),n}function Qt(e,t){return{callee:t?.callee??e,Err:t?.Err}}const Xn=e=>{const t=(n,r,o,s)=>{const i=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new Pe;if(a.issues.length){const u=new(s?.Err??e)(a.issues.map(c=>Ee(c,i,_e())));throw Ko(u,s?.callee??t),u}return a.value};return t},er=e=>{const t=async(n,r,o,s)=>{const i=o?{...o,async:!0}:{async:!0};let a=n._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new(s?.Err??e)(a.issues.map(c=>Ee(c,i,_e())));throw Ko(u,s?.callee??t),u}return a.value};return t},tr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Pe;return s.issues.length?ts(e,s.issues,o):{success:!0,data:s.value}};function ts(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>Ee(o,n,_e()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}const nr=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?ts(e,s.issues,o):{success:!0,data:s.value}},bu=Symbol.for("zod.compile.invalid"),vu=Symbol.for("zod.compile.fallback"),_u=((e,t,n)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==bu)return!0;if(r.definite===!0&&n===void 0)return!1}return wu(e,t,n)});function wu(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun;let s;if(o?(r[vu]=!0,s=o({value:t,issues:[]},r)):s=e._zod.run({value:t,issues:[]},r),s instanceof Promise)throw new Pe;return s.issues.length===0}const Su=async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},ku=e=>{const t=Xn(e),n=(r,o,s,i)=>{const a=s?{...s,direction:"backward"}:{direction:"backward"};return t(r,o,a,Qt(n,i))};return n},$u=e=>{const t=Xn(e),n=(r,o,s,i)=>t(r,o,s,Qt(n,i));return n},Ou=e=>{const t=er(e),n=async(r,o,s,i)=>{const a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(r,o,a,Qt(n,i))};return n},ju=e=>{const t=er(e),n=async(r,o,s,i)=>await t(r,o,s,Qt(n,i));return n},xu=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return tr(e)(t,n,o)},Au=e=>(t,n,r)=>tr(e)(t,n,r),Eu=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return nr(e)(t,n,o)},zu=e=>async(t,n,r)=>nr(e)(t,n,r),Iu=/^[cC][0-9a-z]{6,}$/,Tu=/^[0-9a-z]+$/,Ru=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Nu=/^[0-9a-vA-V]{20}$/,Pu=/^[A-Za-z0-9]{27}$/,Cu=/^[a-zA-Z0-9_-]{21}$/;function Zu(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Mu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Du=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Zr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Uu=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Fu="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Lu(){return new RegExp(Fu,"u")}const Bu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,qu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ju=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Vu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ku=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wu=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Qu=/^https?$/,Yu=/^\+[1-9]\d{6,14}$/,ns="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Gu(e){return new RegExp(`^${e}$`)}const Hu=Gu(ns);function An(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Xu(e){return new RegExp(`^${An(e)}$`)}function ec(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${An({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${An({precision:e.precision})}`:n;return new RegExp(`^${ns}T(?:${r})$`)}const tc=/^[\s\S]{0,}$/,nc=/^-?\d+$/,rr=/^-?\d+(?:\.\d+)?$/,rc=/^(?:true|false)$/i,oc=/^null$/i,sc=/^[^A-Z]*$/,ic=/^[^a-z]*$/,le=b("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),or=e=>{const t=e.value;return!Ma(t)&&t.length!==void 0},At={number:"number",bigint:"bigint",object:"date"},rs=b("$ZodCheckLessThan",(e,t)=>{le.init(e,t);const n=At[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:At[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),os=b("$ZodCheckGreaterThan",(e,t)=>{le.init(e,t);const n=At[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:At[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ac=b("$ZodCheckMultipleOf",(e,t)=>{le.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Da(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),uc=b("$ZodCheckNumberFormat",(e,t)=>{le.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Yo[t.format];e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),cc=b("$ZodCheckMaxLength",(e,t)=>{var n;le.init(e,t),(n=e._zod.def).when??(n.when=or),e._zod.check=r=>{const o=r.value,s=o.length;if((typeof o=="string"&&s>t.maximum?Gn(o):s)<=t.maximum)return;const a=Hn(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lc=b("$ZodCheckMinLength",(e,t)=>{var n;le.init(e,t),(n=e._zod.def).when??(n.when=or),e._zod.check=r=>{const o=r.value,s=o.length;if((typeof o=="string"&&s>=t.minimum&&s<t.minimum*2?Gn(o):s)>=t.minimum)return;const a=Hn(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fc=b("$ZodCheckLengthEquals",(e,t)=>{var n;le.init(e,t),(n=e._zod.def).when??(n.when=or),e._zod.check=r=>{const o=r.value,s=o.length,i=typeof o=="string"&&s>=t.length&&s<=t.length*2?Gn(o):s;if(i===t.length)return;const a=Hn(o),u=i>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Yt=b("$ZodCheckStringFormat",(e,t)=>{var n,r;le.init(e,t),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),dc=b("$ZodCheckRegex",(e,t)=>{Yt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),pc=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sc),Yt.init(e,t)}),mc=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ic),Yt.init(e,t)}),hc=b("$ZodCheckIncludes",(e,t)=>{le.init(e,t);const n=Be(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),gc=b("$ZodCheckStartsWith",(e,t)=>{le.init(e,t);const n=new RegExp(`^${Be(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),yc=b("$ZodCheckEndsWith",(e,t)=>{le.init(e,t);const n=new RegExp(`.*${Be(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),bc=b("$ZodCheckOverwrite",(e,t)=>{le.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class vc{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
3
|
+
`).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
|
+
${n.join(`
|
|
5
|
+
`)}
|
|
6
|
+
};`)(...Object.values(this.closed))}}const _c={major:4,minor:6,patch:7},q=b("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_c;const r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const s of o)for(const i of s._zod.onattach)i(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(a,u,c)=>{if(a.memo)return a;let l=we(a),p;for(const f of u){if(f._zod.def.when){if(Xa(a)||!f._zod.def.when(a))continue}else if(l)continue;const d=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&c?.async===!1)throw new Pe;if(p||m instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await m,a.issues.length!==d&&(xn(a.issues,d,e),l||(l=we(a,d)))});else{if(a.issues.length===d)continue;xn(a.issues,d,e),l||(l=we(a,d))}}return p?p.then(()=>a):a},i=(a,u,c)=>{if(we(a))return a.aborted=!0,a;const l=s(u,o,c);if(l instanceof Promise){if(c.async===!1)throw new Pe;return l.then(p=>e._zod.parse(p,c))}return e._zod.parse(l,c)};e._zod.run=(a,u)=>{if(u.skipChecks)return e._zod.parse(a,u);if(u.direction==="backward"){const l=e._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(p=>i(p,a,u)):i(l,a,u)}const c=e._zod.parse(a,u);if(c instanceof Promise){if(u.async===!1)throw new Pe;return c.then(l=>s(l,o,u))}return s(c,o,u)}}},{get"~standard"(){return Ho(this,"~standard",is(this))},set"~standard"(e){ze(this,"~standard",e)}}),ss=(e,t)=>e.issues.length?{issues:e.issues.map(n=>Ee(n,t,_e()))}:{value:e.value};async function wc(e,t){const n={async:!0};return ss(await e._zod.run({value:t,issues:[]},n),n)}function is(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return ss(r,n)}catch{}return wc(e,t)},vendor:"zod",version:1}}const sr=b("$ZodString",(e,t)=>{q.init(e,t),e._zod.pattern=t.pattern??tc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),V=b("$ZodStringFormat",(e,t)=>{Yt.init(e,t),sr.init(e,t)}),Sc=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Du),V.init(e,t)}),kc=b("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Zr(r))}else t.pattern??(t.pattern=Zr());V.init(e,t)}),$c=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Uu),V.init(e,t)}),as=1,Et=2;function us(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Oc(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?us(e)||Et:jc(e,t)}function jc(e,t){if(!t.normalize&&t.protocol?.source===Qu.source&&!/^https?:\/\//i.test(e))return as;try{if(typeof URL<"u"){const n=URL;if(typeof n.parse=="function")return n.parse(e)??Et}return new URL(e)}catch{return Et}}const xc=/[\t\n\r]/g;function Mr(e){return e.replace(xc,"")}function Ac(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ec(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const zc=b("$ZodURL",(e,t)=>{V.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=Oc(r,t);if(o===as){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Et){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=Mr(r);return}t.hostname&&!Ac(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Ec(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:Mr(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ic=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Lu()),V.init(e,t)}),Tc=b("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Cu:Zu(t.length)),V.init(e,t)}),Rc=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Iu),V.init(e,t)}),Nc=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Tu),V.init(e,t)}),Pc=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ru),V.init(e,t)}),Cc=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Nu),V.init(e,t)}),Zc=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Pu),V.init(e,t)}),Mc=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ec(t)),V.init(e,t)}),Dc=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hu),V.init(e,t)}),Uc=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Xu(t)),V.init(e,t)}),Fc=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Mu),V.init(e,t)}),Lc=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Bu),V.init(e,t)}),Bc=/^[0-9a-fA-F:.]+$/;function cs(e){return Bc.test(e)?us(`http://[${e}]`):!1}const qc=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=qu),V.init(e,t),e._zod.check=n=>{cs(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Jc=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ju),V.init(e,t)});function Vc(e){const t=e.split("/");if(t.length!==2)return!1;const[n,r]=t;if(!r)return!1;const o=Number(r);return`${o}`!==r||o<0||o>128?!1:cs(n)}const Kc=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Vu),V.init(e,t),e._zod.check=n=>{Vc(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function ls(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const fs=/^[0-9a-zA-Z+/]*={0,2}$/,Wc=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=fs),V.init(e,t),e._zod.check=n=>{ls(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),ir=/^[A-Za-z0-9_-]*$/;function Qc(e){if(!ir.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return ls(n)}const Yc=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ir),V.init(e,t),e._zod.check=n=>{Qc(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Gc=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Yu),V.init(e,t)});function Hc(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Xc=b("$ZodJWT",(e,t)=>{V.init(e,t),e._zod.check=n=>{Hc(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ds=b("$ZodNumber",(e,t)=>{q.init(e,t),e._zod.pattern=rr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),el=b("$ZodNumberFormat",(e,t)=>{uc.init(e,t),ds.init(e,t)}),tl=b("$ZodBoolean",(e,t)=>{q.init(e,t),e._zod.pattern=rc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),nl=b("$ZodNull",(e,t)=>{q.init(e,t),e._zod.pattern=oc,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),rl=b("$ZodAny",(e,t)=>{q.init(e,t),e._zod.parse=n=>n}),ol=b("$ZodUnknown",(e,t)=>{q.init(e,t),e._zod.parse=n=>n}),sl=b("$ZodNever",(e,t)=>{q.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function il(e,t){const n=Rr(e._zod.def.checks);if(!n.length)return;const r=Math.min(...n.map(s=>s[0])),o=e._zod.parse;e._zod.parse=(s,i)=>{const a=t(s.value);if(a>r&&!i?.skipChecks&&i?.direction!=="backward"){for(const[u,c]of Rr(e._zod.def.checks))if(a>u&&c._zod.def.when(s)){const l=s.issues.length;return c._zod.check(s),s.issues[l].continue=!1,xn(s.issues,l,e),s}}return o(s,i)}}const al=e=>Array.isArray(e)?e.length:-1;function Dr(e,t,n){e.issues.length&&t.issues.push(...Ze(n,e.issues)),t.value[n]=e.value}const ul=b("$ZodArray",(e,t)=>{q.init(e,t);const n=ye.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=n?n.alloc(e,r,Array(s.length),o):Array(s.length);const i=[],a=o?.abortEarly;for(let u=0;u<s.length;u++){const c=s[u],l=t.element._zod.run({value:c,issues:[]},o);if(l instanceof Promise)i.push(l.then(p=>Dr(p,r,u)));else if(Dr(l,r,u),a&&l.issues.length!==0&&we(l))break}return i.length?Promise.all(i).then(()=>r):r},il(e,al)});function zt(e,t,n,r,o,s){const i=n in r,a=s==="optional";if(!(!i&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...Ze(n,e.issues))}if(!i&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(i||o==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}const cl=[];function ps(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:cl,o=r.length?[...t,...r]:t;for(const i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);const s=Ja(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function ms(e,t,n,r,o,s,i){const a=[],u=o.keySet,c=o.catchall._zod,l=c.def.type,p=c.optin,f=c.optout;let d=0;for(const m in t){if(i&&n.issues.length!==d){if(we(n,d))break;d=n.issues.length}if(u.has(m))continue;if(m==="__proto__"){l==="never"&&a.push(m);continue}if(l==="never"){a.push(m);continue}const h=c.run({value:t[m],issues:[]},r);h instanceof Promise?e.push(h.then(y=>zt(y,n,m,t,p,f))):zt(h,n,m,t,p,f)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const ll=b("$ZodObject",(e,t)=>{q.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const c=()=>{const l={...r};return Object.defineProperty(t,"shape",{value:l}),c.raw=l,l};c.raw=r,Object.defineProperty(t,"shape",{get:c})}const o=Qn(()=>ps(t));D(e,"propValues",c=>{const l=c.def.shape,p={};for(const f in l){const d=l[f]._zod;if(d.values){Object.prototype.hasOwnProperty.call(p,f)||$e(p,f,new Set);for(const m of d.values)p[f].add(m);d.optin!==void 0&&p[f].add(void 0)}}return p});const s=xt,i=t.catchall;let a;const u=ye.memoizer;u?.attach(e),e._zod.parse=(c,l)=>{a??(a=o.value);const p=c.value;if(!s(p))return c.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),c;c.value=u?u.alloc(e,c,{},l):{};const f=[],d=a.shape,m=l?.abortEarly;let h=c.issues.length;for(const y of a.allKeys){if(m&&c.issues.length!==h){if(we(c,h))break;h=c.issues.length}if(y==="__proto__")continue;const _=d[y],v=_._zod.optin,E=_._zod.optout,O=_._zod.run({value:p[y],issues:[]},l);O instanceof Promise?f.push(O.then(k=>zt(k,c,y,p,v,E))):zt(O,c,y,p,v,E)}return i?ms(f,p,c,l,o.value,e,m===!0):f.length?Promise.all(f).then(()=>c):c}}),fl=b("$ZodObjectJIT",(e,t)=>{ll.init(e,t);const n=e._zod.parse,r=Qn(()=>ps(t)),o=ye.memoizer,s=d=>{const m=r.value,h=m.symbolKeys,y=new vc(["payload","ctx"],{shape:d,inst:e,memo:o,syms:h}),_=k=>`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`,v=(k,$)=>`
|
|
7
|
+
let ${k}_ab = false;
|
|
8
|
+
for (let i = 0; i < ${k}.issues.length; i++) {
|
|
9
|
+
const iss = ${k}.issues[i];
|
|
10
|
+
iss.path = iss.path ? [${$}, ...iss.path] : [${$}];
|
|
11
|
+
payload.issues.push(iss);
|
|
12
|
+
if (iss.continue !== true) ${k}_ab = true;
|
|
13
|
+
}
|
|
14
|
+
if (${k}_ab && ctx && ctx.abortEarly) {
|
|
15
|
+
payload.value = newResult;
|
|
16
|
+
return payload;
|
|
17
|
+
}`;y.write("const input = payload.value;");const E=Object.create(null);let O=0;for(const k of m.allKeys)E[k]=`key_${O++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const k of m.allKeys){if(k==="__proto__")continue;const $=E[k],C=typeof k=="symbol"?`syms[${h.indexOf(k)}]`:Fa(k),fe=`${C} in input`,j=d[k],z=j?._zod?.optin,S=z!==void 0,x=j?._zod?.optout==="optional";if(y.write(`const ${$} = ${_(C)};`),S&&x){const M=z==="optional"?`${$}_present`:`${$}.value !== undefined || ${$}_present`;y.write(`
|
|
18
|
+
const ${$}_present = ${fe};
|
|
19
|
+
if (!${$}.issues.length || ${$}_present) {
|
|
20
|
+
if (${$}.issues.length) {${v($,C)}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (${M}) {
|
|
24
|
+
newResult[${C}] = ${$}.value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
`)}else S?(y.write(`
|
|
29
|
+
if (${$}.issues.length) {${v($,C)}
|
|
30
|
+
}
|
|
31
|
+
`),z==="defaulted"?y.write(`newResult[${C}] = ${$}.value;`):y.write(`
|
|
32
|
+
if (${$}.value !== undefined || ${fe}) {
|
|
33
|
+
newResult[${C}] = ${$}.value;
|
|
34
|
+
}
|
|
35
|
+
`)):y.write(`
|
|
36
|
+
const ${$}_present = ${fe};
|
|
37
|
+
if (${$}.issues.length) {${v($,C)}
|
|
38
|
+
}
|
|
39
|
+
if (!${$}_present && !${$}.issues.length) {
|
|
40
|
+
payload.issues.push({
|
|
41
|
+
code: "invalid_type",
|
|
42
|
+
expected: "nonoptional",
|
|
43
|
+
input: undefined,
|
|
44
|
+
path: [${C}]
|
|
45
|
+
});
|
|
46
|
+
if (ctx && ctx.abortEarly) {
|
|
47
|
+
payload.value = newResult;
|
|
48
|
+
return payload;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (${$}_present) {
|
|
53
|
+
newResult[${C}] = ${$}.value;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()};let i;const a=xt,u=!ye.jitless,l=u&&Ba.value,p=t.catchall;let f;e._zod.parse=(d,m)=>{f??(f=r.value);const h=d.value;return a(h)?u&&l&&m?.async===!1&&m.jitless!==!0?(i||(i=s(t.shape)),d=i(d,m),p?ms([],h,d,m,f,e,m?.abortEarly===!0):d):n(d,m):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d)}});function Ur(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!we(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>Ee(i,r,_e())))}),t)}const dl=b("$ZodUnion",(e,t)=>{q.init(e,t),D(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),D(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),D(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),D(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){const o=r.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Yn(s.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1;const i=[];for(const a of t.options){const u=a._zod.run({value:r.value,issues:[]},o);if(u instanceof Promise)i.push(u),s=!0;else{if(u.issues.length===0)return u;i.push(u)}}return s?Promise.all(i).then(a=>Ur(a,r,e,o)):Ur(i,r,e,o)}}),pl=b("$ZodIntersection",(e,t)=>{q.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([u,c])=>Fr(n,u,c)):Fr(n,s,i)}});function En(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Le(e)&&Le(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(const s of r){if(s==="__proto__")continue;const i=En(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=En(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Fr(e,t,n){const r=new Map;let o;const s=new Map,i=(c,l)=>{let p;if(c.code==="unrecognized_keys"&&!c.path?.length)o??(o=c),p=c.keys;else if(c.code==="invalid_key"&&c.origin==="record"&&c.path?.length===1){const f=String(c.path[0]);s.has(f)||s.set(f,c),p=[f]}else return!1;for(const f of p)r.has(f)||r.set(f,{}),r.get(f)[l]=!0;return!0};for(const c of t.issues)i(c,"l")||e.issues.push(c);for(const c of n.issues)i(c,"r")||e.issues.push(c);const a=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(a.length){const c=o?a.filter(l=>o.keys.includes(l)):[];c.length&&e.issues.push({...o,keys:c});for(const l of a)!c.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}const u=En(t.value,n.value);if(!u.valid){if(we(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}const ml=b("$ZodRecord",(e,t)=>{q.init(e,t);const n=ye.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const s=r.value;if(!Le(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const i=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};const u=new Set;for(const l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(u.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;const p=t.keyType._zod.run({value:l,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(m=>Ee(m,o,_e())),input:l,path:[l],inst:e});continue}const f=p.value;if(f==="__proto__")continue;const d=t.valueType._zod.run({value:s[l],issues:[]},o);d instanceof Promise?i.push(d.then(m=>{m.issues.length&&r.issues.push(...Ze(l,m.issues)),r.value[f]=m.value})):(d.issues.length&&r.issues.push(...Ze(l,d.issues)),r.value[f]=d.value)}let c;for(const l in s)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=s[l]}else c=c??[],c.push(l);c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let u;for(const c of Reflect.ownKeys(s)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,c))continue;let l=t.keyType._zod.run({value:c,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&rr.test(c)&&l.issues.length){const m=t.keyType._zod.run({value:Number(c),issues:[]},o);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?r.value[c]=s[c]:a?(u=u??[],u.push(c)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>Ee(m,o,_e())),input:c,path:[c],inst:e});continue}const f=l.value;if(f==="__proto__")continue;const d=t.valueType._zod.run({value:s[c],issues:[]},o);d instanceof Promise?i.push(d.then(m=>{m.issues.length&&r.issues.push(...Ze(c,m.issues)),r.value[f]=m.value})):(d.issues.length&&r.issues.push(...Ze(c,d.issues)),r.value[f]=d.value)}u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}return i.length?Promise.all(i).then(()=>r):r}}),hl=b("$ZodEnum",(e,t)=>{q.init(e,t);const n=On(t.entries),r=new Set(n);e._zod.values=r,D(e,"pattern",o=>{const s=On(o.def.entries).filter(i=>qa.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>Be(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),gl=b("$ZodLiteral",(e,t)=>{q.init(e,t);const n=new Set(t.values);e._zod.values=n,D(e,"pattern",r=>{const o=r.def.values;return new RegExp(o.length?`^(${o.map(s=>typeof s=="string"?Be(s):s?Be(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),yl=b("$ZodTransform",(e,t)=>{q.init(e,t),e._zod.optin="optional",ye.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new es(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new Pe;return n.value=o,n}});function Lr(e,t){return e.value=t.issues.length?void 0:t.value,e}const hs=b("$ZodOptional",(e,t)=>{q.init(e,t),D(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",D(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),D(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Yn(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;const o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(s=>Lr(n,s)):Lr(n,o)}return t.innerType._zod.run(n,r)}}),bl=b("$ZodExactOptional",(e,t)=>{hs.init(e,t),D(e,"values",n=>n.def.innerType._zod.values),D(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),vl=b("$ZodNullable",(e,t)=>{q.init(e,t),D(e,"optin",n=>n.def.innerType._zod.optin),D(e,"optout",n=>n.def.innerType._zod.optout),D(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Yn(r.source)}|null)$`):void 0}),D(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),_l=b("$ZodDefault",(e,t)=>{q.init(e,t),e._zod.optin="defaulted",D(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Br(s,t)):Br(o,t)}});function Br(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const wl=b("$ZodPrefault",(e,t)=>{q.init(e,t),e._zod.optin="defaulted",D(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Sl=b("$ZodNonOptional",(e,t)=>{q.init(e,t),D(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>qr(s,e)):qr(o,e)}});function qr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Jr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Ee(o,r,_e()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const kl=b("$ZodCatch",(e,t)=>{q.init(e,t),D(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),D(e,"optout",n=>n.def.innerType._zod.optout),D(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(s=>Jr(n,s,t,r)):Jr(n,o,t,r)}}),$l=b("$ZodPipe",(e,t)=>{q.init(e,t),D(e,"values",n=>n.def.in._zod.values),D(e,"optin",n=>n.def.in._zod.optin),D(e,"optout",n=>n.def.out._zod.optout),D(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>ct(i,t.in,r)):ct(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>ct(s,t.out,r)):ct(o,t.out,r)}});function ct(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Ol=b("$ZodReadonly",(e,t)=>{q.init(e,t),D(e,"propValues",n=>n.def.innerType._zod.propValues),D(e,"values",n=>n.def.innerType._zod.values),D(e,"optin",n=>n.def.innerType?._zod?.optin),D(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Vr):Vr(o)}});function Vr(e){return e.memo||(e.value=Object.freeze(e.value)),e}const jl=b("$ZodCustom",(e,t)=>{le.init(e,t),q.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Kr(s,n,r,e));Kr(o,n,r,e)}});function Kr(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(nt(o))}}class xl extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const zn="~memo",Wr=[];function gs(e){return e!==null&&typeof e=="object"}function dn(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const ys=new WeakMap,He=0,vt=1,et=2;function _t(e,t,n){const r=ys.get(e);if(r!==void 0)return r?et:He;if(t.has(e))return et;t.add(e);let o=He;const s=l=>{if(o!==et&&l?._zod){const p=_t(l,t);p>o&&(o=p)}},i=(l,p)=>{let f=He;for(const d of Reflect.ownKeys(l)){const m=Object.getOwnPropertyDescriptor(l,d);if(!m.enumerable)continue;const h=m.get?vt:m.value?._zod?_t(m.value,t):He;h>f&&(f=h)}return f},a=l=>{l>o&&(o=l)},u=e._zod.def;switch(u.type){case"object":{const l=qo(u);a(l?i(l):vt),s(u.catchall);break}case"array":s(u.element);break;case"tuple":for(const l of u.items)s(l);s(u.rest);break;case"record":case"map":s(u.keyType),s(u.valueType);break;case"set":s(u.valueType);break;case"union":for(const l of u.options)s(l);break;case"intersection":s(u.left),s(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(u.innerType);break;case"pipe":s(u.in),s(u.out);break;case"function":s(u.input),s(u.output);break;case"lazy":{const l=u._cachedInner??void 0;a(l?_t(l,t):vt);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const l in u){const p=Object.getOwnPropertyDescriptor(u,l);if(!p||p.get)continue;const f=p.value;if(!(!f||typeof f!="object")){if(f._zod)s(f);else if(Array.isArray(f))for(const d of f)s(d)}}}return t.delete(e),Al(e,o)}function Al(e,t){return t!==vt&&ys.set(e,t===et),t}function El(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let lt;const ft=[],zl={alloc(e,t,n){const r=lt;if(!r)return n;lt=void 0;const o={value:n,issues:null};return r.set(t.value,o),ft.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const n=e._zod.parse,r=(o,s)=>{if(s.direction!=="backward"&&Tl(s,o.value))throw new xl;return n(o,s)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const i=e._zod.parse,a=(u,c)=>{if(n===void 0){const _=_t(e,new Set);if(_===He)return e._zod.parse=i,e._zod.run===a&&(e._zod.run=i),i(u,c);_===et||r?n=!0:r=!0}const l=u.value;if(!gs(l))return i(u,c);let p=c[zn];p||(p={buckets:new WeakMap,backEdges:void 0},c[zn]=p);let f;o===c?f=s:(f=El(p,e),o=c,s=f);const d=f.get(l);if(d)return u.value=d.value,d.issues?d.issues.length&&u.issues.push(...dn(d.issues)):(u.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(d.value)),u;lt=f;const m=ft.length,h=i(u,c);lt=void 0;const y=ft.length>m?ft.pop():void 0;return h instanceof Promise?h.then(_=>(y&&(y.issues=_.issues.length?dn(_.issues):Wr),_)):(y&&(y.issues=h.issues.length?dn(h.issues):Wr),h)};e._zod.parse=a,e._zod.run===i&&(e._zod.run=a)})}};function Il(){return zl}function Tl(e,t){const n=e[zn]?.backEdges;return n!==void 0&&gs(t)&&n.has(t)}const Rl=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):r[s]??s}return s=>{switch(s.code){case"invalid_type":{const i=o(s.expected),a=tu(s.input),u=o(a,s.input);return`Invalid input: expected ${i}, received ${u}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${Qo(s.values[0])}`:`Invalid option: expected one of ${Ir(s.values,"|")}`;case"too_big":{const i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);return a?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{const i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);return a?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{const i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${n[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Ir(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(a=>`'${a}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Nl(){return{localeError:Rl()}}var Qr;class Pl{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function bs(){return new Pl}(Qr=globalThis).__zod_globalRegistry??(Qr.__zod_globalRegistry=bs());const Ne=globalThis.__zod_globalRegistry;function vs(e){return e.checks&&(e.checks=[...e.checks]),e}function Cl(e,t){return new e(vs({type:"string",...A(t)}))}function Zl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...A(t)})}function Ml(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...A(t)})}function Dl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...A(t)})}function Ul(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(t)})}function Fl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(t)})}function Ll(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(t)})}function Bl(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...A(t)})}function ql(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...A(t)})}function Jl(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(t)})}function Vl(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...A(t)})}function Kl(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(t)})}function Wl(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...A(t)})}function Ql(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...A(t)})}function Yl(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(t)})}function Gl(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(t)})}function Hl(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(t)})}function Xl(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(t)})}function ef(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(t)})}function tf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...A(t)})}function nf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...A(t)})}function rf(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...A(t)})}function of(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...A(t)})}function sf(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(t)})}function af(e,t){return new e({type:"string",format:"date",check:"string_format",...A(t)})}function uf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...A(t)})}function cf(e,t){return new e({type:"string",format:"duration",check:"string_format",...A(t)})}function lf(e,t){return new e(vs({type:"number",checks:[],...A(t)}))}function ff(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...A(t)})}function df(e,t){return new e({type:"boolean",...A(t)})}function pf(e,t){return new e({type:"null",...A(t)})}function mf(e){return new e({type:"any"})}function hf(e){return new e({type:"unknown"})}function gf(e,t){return new e({type:"never",...A(t)})}function Yr(e,t){return new rs({check:"less_than",...A(t),value:e,inclusive:!1})}function pn(e,t){return new rs({check:"less_than",...A(t),value:e,inclusive:!0})}function Gr(e,t){return new os({check:"greater_than",...A(t),value:e,inclusive:!1})}function mn(e,t){return new os({check:"greater_than",...A(t),value:e,inclusive:!0})}function Hr(e,t){return new ac({check:"multiple_of",...A(t),value:e})}function _s(e,t){return new cc({check:"max_length",...A(t),maximum:e})}function It(e,t){return new lc({check:"min_length",...A(t),minimum:e})}function ws(e,t){return new fc({check:"length_equals",...A(t),length:e})}function yf(e,t){return new dc({check:"string_format",format:"regex",...A(t),pattern:e})}function bf(e){return new pc({check:"string_format",format:"lowercase",...A(e)})}function vf(e){return new mc({check:"string_format",format:"uppercase",...A(e)})}function _f(e,t){return new hc({check:"string_format",format:"includes",...A(t),includes:e})}function wf(e,t){return new gc({check:"string_format",format:"starts_with",...A(t),prefix:e})}function Sf(e,t){return new yc({check:"string_format",format:"ends_with",...A(t),suffix:e})}function Ve(e){return new bc({check:"overwrite",tx:e})}function kf(e){return Ve(t=>t.normalize(e))}function $f(){return Ve(e=>e.trim())}function Of(){return Ve(e=>e.toLowerCase())}function jf(){return Ve(e=>e.toUpperCase())}function xf(){return Ve(e=>La(e))}function Af(e,t,n){return new e({type:"array",element:t,...A(n)})}function Ef(e,t,n){return new e({type:"custom",check:"custom",fn:t,...A(n)})}function zf(e,t){const n=If(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(nt(o,r.value,n._zod.def));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(nt(s))}},e(r.value,r)),t);return n}function If(e,t){const n=new le({check:"custom",...A(t)});return n._zod.check=e,n}function tt(e,...t){for(const n of t)for(const r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&$e(e,r,n[r]);return e}function Tt(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Ne,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function X(e,t,n,r,o){const s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(o);return Object.assign(n,s),!0}function B(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{const f=i.schema,d=t.processors[o.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,f,l)}const p=e._zod.parent;p&&(i.ref||(i.ref=p),B(p,t,l),t.seen.get(p).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&tt(i.schema,u),t.io==="input"&&ne(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Xr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Rt(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const u=r.get(a);if(u&&u!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const p=e.external.registry.get(i[0])?.id,f=e.external.uri??(m=>m);if(p)return{ref:f(p)};const d=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=d,{defId:d,ref:`${f("__shared")}#/${a}/${Xr(d)}`}}const u="#",c=`${u}/${a}/`;if(i[1]===n&&!i[1].schema.id)return{ref:u};const l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+Xr(l)}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:u,defId:c}=o(i);a.def={...a.schema},c&&(a.defId=c);const l=a.schema;for(const p in l)delete l[p];l.$ref=u};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
57
|
+
|
|
58
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}a.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ss(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const r of t){if(!r||typeof r!="object")return;Ss(r);const o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;const s=r.type;for(const i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;n.includes(i)||n.push(i)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const ks=new Set(["type","properties","required","additionalProperties"]),eo=["oneOf","anyOf"];function to(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function In(e){const t=[];for(const s of e){if(typeof s!="object"||s.type!=="object")return null;for(const i in s)if(!ks.has(i))return null;t.push(s)}const n={},r=new Set;for(const s of t){for(const i in s.properties){if(Object.prototype.hasOwnProperty.call(n,i))continue;const a=[];for(const c of t){const l=c.properties?.[i]??to(c);l!=null&&(a.some(p=>JSON.stringify(p)===JSON.stringify(l))||a.push(l))}const u=a.length===1?a[0]:In(a)??{allOf:a};$e(n,i,u)}for(const i of s.required??[])r.add(i)}const o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{const s=[];for(const i of t){const a=to(i);a&&!s.some(u=>JSON.stringify(u)===JSON.stringify(a))&&s.push(a)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function Tf(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const o of ks)if(o in e)return;const n=t.filter(o=>eo.some(s=>Array.isArray(o[s])));let r=null;if(!n.length)r=In(t);else{const o=n[0],s=eo.find(u=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;const i=t.filter(u=>u!==o),a=o[s].map(u=>In([...i,u]));if(a.some(u=>!u))return;r={[s]:a}}r&&(delete e.allOf,tt(e,r))}function Nt(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const u=e.seen.get(a);if(u.ref===null)return;const c=u.def??u.schema,l={...c},p=u.ref;if(u.ref=null,p){r(p);const d=e.seen.get(p),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(m)):tt(c,m),tt(c,l),a._zod.parent===p)for(const y in c)y==="$ref"||y==="allOf"||y in l||delete c[y];if(m.$ref&&d.def)for(const y in c)y==="$ref"||y==="allOf"||y in d.def&&JSON.stringify(c[y])===JSON.stringify(d.def[y])&&delete c[y]}const f=a._zod.parent;if(f&&f!==p){r(f);const d=e.seen.get(f);if(d?.schema.$ref&&(c.$ref=d.schema.$ref,d.def))for(const m in c)m==="$ref"||m==="allOf"||m in d.def&&JSON.stringify(c[m])===JSON.stringify(d.def[m])&&delete c[m]}e.override({zodSchema:a,jsonSchema:c,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(const a of e.seen.entries())Ss(a[1].def??a[1].schema);for(const a of e.deferred)a();if(e.intersections.length){const a=new Map;for(const u of e.seen.values())for(const c of[u.schema,u.def]){const l=c?.allOf;if(!Array.isArray(l))continue;const p=a.get(l);p?p.push(c):a.set(l,[c])}for(const u of e.intersections)for(const c of a.get(u)??[])Tf(c)}}const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}tt(o,n.defId?n.schema:n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;const i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const a of e.seen.entries()){const u=a[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,$e(i,u.defId,u.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Pt(t,"input",e.processors),output:Pt(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ne(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ne(r.element,n);if(r.type==="set")return ne(r.valueType,n);if(r.type==="lazy")return ne(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return ne(r.innerType,n);if(r.type==="intersection")return ne(r.left,n)||ne(r.right,n);if(r.type==="record"||r.type==="map")return ne(r.keyType,n)||ne(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ne(r.in,n)||ne(r.out,n);if(r.type==="object"){for(const o in r.shape)if(ne(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(ne(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(ne(o,n))return!0;return!!(r.rest&&ne(r.rest,n))}return!1}const Rf=(e,t={})=>n=>{const r=Tt({...n,processors:t});return B(e,r),Rt(r,e),Nt(r,e)},Pt=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=Tt({...o??{},target:s,io:t,processors:n});return B(e,i),Rt(i,e),Nt(i,e)},qe=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Je=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},no=(e,t)=>{qe(e,"minimum",t),Je(e,"maximum",t)},$s=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Os=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},js=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},xs=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},ro=(e,t)=>qe(e,"minimum",t.minimum),oo=(e,t)=>Je(e,"maximum",t.maximum),so=e=>(t,n)=>{xs(t,n.format);const[r,o]=e[n.format];qe(t,"minimum",r),Je(t,"maximum",o)},Nf={greater_than:(e,t)=>qe(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Je(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>$s(e,t.value),number_format:so(Yo),bigint_format:so(Va),min_length:ro,max_length:oo,length_equals:(e,t)=>no(e,t.length),min_size:ro,max_size:oo,size_equals:(e,t)=>no(e,t.size),string_format:(e,t)=>{xs(e,t.format),t.pattern&&Os(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>js(e,t.mime)};function pe(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const s of r)Nf[s._zod.def.check]?.(t,s._zod.def);const o=e._zod.bag;o.minimum!==void 0&&qe(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&qe(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Je(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Je(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&$s(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&js(t,o.mime);for(const s of o.patterns??[])Os(t,s);return t}const Pf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Cf=new Map([[fs,Ku],[ir,Wu]]),As=e=>Cf.get(e)??e,Es=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:u,contentEncoding:c,laxFormat:l}=pe(e);if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Pf[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),c&&(o.contentEncoding=c),u&&u.size>0){const p=[...u].map(As);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},zs=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:c,isInt:l}=pe(e);o.type=l?"integer":"number";const p=typeof c=="number"&&c>=(s??Number.NEGATIVE_INFINITY),f=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(p?d?(o.minimum=c,o.exclusiveMinimum=!0):o.exclusiveMinimum=c:typeof s=="number"&&(o.minimum=s),f?d?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof i=="number"&&(o.maximum=i),a){const m=new Set;for(const _ of a)Number.isFinite(_)&&_!==0?m.add(Math.abs(_)):X(e,t,o,r,`A multipleOf divisor of ${_} cannot be represented in JSON Schema`);const[h,...y]=m;h!==void 0&&(o.multipleOf=h),y.length&&(o.allOf=[...o.allOf??[],...y.map(_=>({multipleOf:_}))])}},Is=(e,t,n,r)=>{n.type="boolean"},Zf=(e,t,n,r)=>{X(e,t,n,r,"BigInt cannot be represented in JSON Schema")},Mf=(e,t,n,r)=>{X(e,t,n,r,"Symbols cannot be represented in JSON Schema")},Ts=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Df=(e,t,n,r)=>{X(e,t,n,r,"Undefined cannot be represented in JSON Schema")},Uf=(e,t,n,r)=>{X(e,t,n,r,"Void cannot be represented in JSON Schema")},Rs=(e,t,n,r)=>{n.not={}},Ns=(e,t,n,r)=>{},Ps=(e,t,n,r)=>{},Ff=(e,t,n,r)=>{X(e,t,n,r,"Date cannot be represented in JSON Schema")},Cs=(e,t,n,r)=>{const o=e._zod.def,s=On(o.entries);if(s.length===0){n.not={};return}s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},Zs=(e,t,n,r)=>{const o=e._zod.def;if(o.values.length===0){n.not={};return}const s=[];for(const i of o.values)if(i===void 0){if(X(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(X(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},Lf=(e,t,n,r)=>{X(e,t,n,r,"NaN cannot be represented in JSON Schema")},Bf=(e,t,n,r)=>{const o=n,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},qf=(e,t,n,r)=>{const o=n;o.type="string",o.format="binary",o.contentEncoding="binary";const{minimum:s,maximum:i,mime:a}=pe(e);s!==void 0&&(o.minLength=s),i!==void 0&&(o.maxLength=i),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(u=>({contentMediaType:u})))},Jf=(e,t,n,r)=>{n.type="boolean"},Ms=(e,t,n,r)=>{X(e,t,n,r,"Custom types cannot be represented in JSON Schema")},Vf=(e,t,n,r)=>{X(e,t,n,r,"Function types cannot be represented in JSON Schema")},Ds=(e,t,n,r)=>{X(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Kf=(e,t,n,r)=>{X(e,t,n,r,"Map cannot be represented in JSON Schema")},Wf=(e,t,n,r)=>{X(e,t,n,r,"Set cannot be represented in JSON Schema")},Us=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=pe(e);typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=B(s.element,t,{...r,path:[...r.path,"items"]})};function rt(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?rt(t.out):t.type==="catch"?rt(t.innerType):e._zod.optin}const Fs=(e,t,n,r)=>{const o=n,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&X(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(const c in i)$e(o.properties,c,B(i[c],t,{...r,path:[...r.path,"properties",c]}));const u=[];for(const c of Object.keys(i)){const l=s.shape[c];(t.io==="input"?rt(l)===void 0:l._zod.optout===void 0)&&u.push(c)}u.length>0&&(o.required=u),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=B(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Ls=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,u)=>B(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",u]}));s?n.oneOf=i:n.anyOf=i},Bs=(e,t,n,r)=>{const o=e._zod.def,s=B(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=B(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,u=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=u,t.intersections.push(u)},Qf=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="array";const i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=s.items.map((h,y)=>B(h,t,{...r,path:[...r.path,i,y]})),c=s.rest?B(s.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;let l=s.items.length;for(;l>0;){const h=s.items[l-1];if(!(t.io==="input"?rt(h)!==void 0:h._zod.optout==="optional"))break;l--}const p=s.items.length,f=!s.rest;t.target==="draft-2020-12"?(o.prefixItems=u,f?o.items=!1:c&&(o.items=c),l>0&&(o.minItems=l),f&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:u},c&&o.items.anyOf.push(c),l>0&&(o.minItems=l),f&&(o.maxItems=p)):(o.items=u,f?o.additionalItems=!1:c&&(o.additionalItems=c),l>0&&(o.minItems=l),f&&(o.maxItems=p));const{minimum:d,maximum:m}=pe(e);typeof d=="number"&&(o.minItems=d),typeof m=="number"&&(o.maxItems=m)};function Tn(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);const m=e.get(t)?.def;if(!m)return t;const h=Tn(e,m,n);return h===m?t:h}for(const m of["anyOf","oneOf"]){const h=t[m];if(!Array.isArray(h))continue;const y=h.map(_=>Tn(e,_,n));y.some((_,v)=>_!==h[v])&&(t={...t,[m]:y})}const r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(m=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some(m=>typeof m=="number"))return t;const{minimum:i,maximum:a,exclusiveMinimum:u,exclusiveMaximum:c,multipleOf:l,format:p,id:f,...d}=t;return d.enum?d.enum=d.enum.map(m=>typeof m=="number"?String(m):m):typeof d.const=="number"&&(d.const=String(d.const)),o&&(d.type="string",s||(d.pattern=(r.includes("number")?rr:nc).source)),d}const Rn=new WeakMap;function Yf(e){const t=new Map;for(const r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);const n=new Map;for(const r of Rn.get(e)??[]){const o=e.seen.get(r),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;const i=Tn(t,s,new Set);i!==s&&n.set(s,i)}if(n.size)for(const r of e.seen.values())for(const o of[r.schema,r.def]){const s=o&&n.get(o.propertyNames);s&&(o.propertyNames=s)}}const qs=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const i=s.keyType,a=pe(i).patterns;if(s.mode==="loose"&&a&&a.size>0){const l=B(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const p of a)$e(o.patternProperties,As(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=B(s.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=Rn.get(t);l||(l=[],Rn.set(t,l),t.deferred.push(()=>Yf(t))),l.push(e)}o.additionalProperties=B(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const u=i._zod.values,c=t.io==="input"&&rt(s.valueType)!==void 0;if(u&&!s.partial&&!c){const l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(o.required=l.map(String))}},Js=(e,t,n,r)=>{const o=e._zod.def,s=B(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Vs=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},ar=Symbol();function Ks(e,t,n,r,o){let s=!1;const i=JSON.stringify(e,(a,u)=>typeof u!="bigint"?u:(s=!0,null));return s?(X(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),ar):JSON.parse(i)}const Ws=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;const i=Ks(o.defaultValue,e,t,n,r);i!==ar&&(n.default=i)},Qs=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;const i=Ks(o.defaultValue,e,t,n,r);i!==ar&&(n._prefault=i)},Ys=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{X(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=i},Gs=(e,t,n,r)=>{const o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;B(i,t,r);const a=t.seen.get(e);a.ref=i},Hs=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Gf=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},ur=(e,t,n,r)=>{const o=e._zod.def;B(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Hf=(e,t,n,r)=>{const o=e._zod.innerType;B(o,t,r);const s=t.seen.get(e);s.ref=o},io={string:Es,number:zs,boolean:Is,bigint:Zf,symbol:Mf,null:Ts,undefined:Df,void:Uf,never:Rs,any:Ns,unknown:Ps,date:Ff,enum:Cs,literal:Zs,nan:Lf,template_literal:Bf,file:qf,success:Jf,custom:Ms,function:Vf,transform:Ds,map:Kf,set:Wf,array:Us,object:Fs,union:Ls,intersection:Bs,tuple:Qf,record:qs,nullable:Js,nonoptional:Vs,default:Ws,prefault:Qs,catch:Ys,pipe:Gs,readonly:Hs,promise:Gf,optional:ur,lazy:Hf};function ao(e,t){if("_idmap"in e){const r=e,o=Tt({...t,processors:io}),s={};for(const u of r._idmap.entries()){const[c,l]=u;B(l,o)}const i={},a={registry:r,uri:t?.uri,defs:s};o.external=a;for(const u of r._idmap.entries()){const[c,l]=u;Rt(o,l),$e(i,c,Nt(o,l))}if(Object.keys(s).length>0){const u=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[u]:s}}return{schemas:i}}const n=Tt({...t,processors:io});return B(e,n),Rt(n,e),Nt(n,e)}const uo=new WeakSet([Object.prototype,Error.prototype]);function dt(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const Xf=(e,t)=>{mu.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);uo.has(n)||(uo.add(n),dt(n,"format",r=>o=>yu(r,o)),dt(n,"flatten",r=>o=>gu(r,o)),dt(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,jn,2)}),dt(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,jn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},me=b("ZodError",Xf,void 0,{Parent:Error}),ed=Xn(me),td=er(me),nd=tr(me),rd=nr(me),od=ku(me),sd=$u(me),id=Ou(me),ad=ju(me),ud=xu(me),cd=Au(me),ld=Eu(me),fd=zu(me);function dd(){ye.localeError||_e(Nl())}function Gt(){ye.memoizer||_e({memoizer:Il()})}const J=b("ZodType",(e,t)=>(dd(),q.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(ue(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Oe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(dp(e,t))},superRefine(e,t){return this.check(pp(e,t))},overwrite(e){return this.check(Ve(e))},optional(){return po(this)},exactOptional(){return Xd(this)},nullable(){return mo(this)},nullish(){return po(mo(this))},nonoptional(e){return sp(this,e)},array(){return ae(this)},or(e){return Ke([this,e])},and(e){return Wd(this,e)},transform(e){return ho(this,Hd(e))},default(e){return np(this,e)},prefault(e){return op(this,e)},catch(e){return ap(this,e)},pipe(e){return ho(this,e)},readonly(){return lp(this)},describe(e){const t=this.clone();return Ne.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ne.get(this);const t=this.clone();return Ne.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ho(this,"~standard",{...is(this),jsonSchema:{input:Pt(this,"input"),output:Pt(this,"output")}})},set"~standard"(e){ze(this,"~standard",e)},parse:function e(t,n){return ed(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await td(this,t,n,{callee:e})},safeParse(e,t){return nd(this,e,t)},async safeParseAsync(e,t){return rd(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ze(this,"spa",e)},validate(e,t){return _u(this,e,t)},validateAsync(e,t){return Su(this,e,t)},encode:function e(t,n){return od(this,t,n,{callee:e})},decode:function e(t,n){return sd(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await id(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ad(this,t,n,{callee:e})},safeEncode(e,t){return ud(this,e,t)},safeDecode(e,t){return cd(this,e,t)},async safeEncodeAsync(e,t){return ld(this,e,t)},async safeDecodeAsync(e,t){return fd(this,e,t)},toJSONSchema(e){return Rf(this,{})(e)},get description(){return Ne.get(this)?.description},get _def(){return this._zod.def}}),Xs=b("_ZodString",(e,t)=>{sr.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Es(e,n,r)},Xo({format:e=>pe(e).format??null,minLength:e=>pe(e).minimum??null,maxLength:e=>pe(e).maximum??null},{regex(...e){return this.check(yf(...e))},includes(...e){return this.check(_f(...e))},startsWith(...e){return this.check(wf(...e))},endsWith(...e){return this.check(Sf(...e))},min(...e){return this.check(It(...e))},max(...e){return this.check(_s(...e))},length(...e){return this.check(ws(...e))},nonempty(...e){return this.check(It(1,...e))},lowercase(e){return this.check(bf(e))},uppercase(e){return this.check(vf(e))},trim(){return this.check($f())},normalize(...e){return this.check(kf(...e))},toLowerCase(){return this.check(Of())},toUpperCase(){return this.check(jf())},slugify(){return this.check(xf())}})),pd=b("ZodString",(e,t)=>{sr.init(e,t),Xs.init(e,t)},{email(e){return this.check(Zl(bd,e))},url(e){return this.check(Bl(_d,e))},jwt(e){return this.check(of(Pd,e))},emoji(e){return this.check(ql(wd,e))},guid(e){return this.check(Ml(vd,e))},uuid(e){return this.check(Dl(pt,e))},uuidv4(e){return this.check(Ul(pt,e))},uuidv6(e){return this.check(Fl(pt,e))},uuidv7(e){return this.check(Ll(pt,e))},nanoid(e){return this.check(Jl(Sd,e))},cuid(e){return this.check(Vl(kd,e))},cuid2(e){return this.check(Kl($d,e))},ulid(e){return this.check(Wl(Od,e))},base64(e){return this.check(tf(Td,e))},base64url(e){return this.check(nf(Rd,e))},xid(e){return this.check(Ql(jd,e))},ksuid(e){return this.check(Yl(xd,e))},ipv4(e){return this.check(Gl(Ad,e))},ipv6(e){return this.check(Hl(Ed,e))},cidrv4(e){return this.check(Xl(zd,e))},cidrv6(e){return this.check(ef(Id,e))},e164(e){return this.check(rf(Nd,e))},datetime(e){return this.check(sf(md,e))},date(e){return this.check(af(hd,e))},time(e){return this.check(uf(gd,e))},duration(e){return this.check(cf(yd,e))}});function oe(e){return Cl(pd,e)}const K=b("ZodStringFormat",(e,t)=>{V.init(e,t),Xs.init(e,t)}),md=b("ZodISODateTime",(e,t)=>{Mc.init(e,t),K.init(e,t)}),hd=b("ZodISODate",(e,t)=>{Dc.init(e,t),K.init(e,t)}),gd=b("ZodISOTime",(e,t)=>{Uc.init(e,t),K.init(e,t)}),yd=b("ZodISODuration",(e,t)=>{Fc.init(e,t),K.init(e,t)}),bd=b("ZodEmail",(e,t)=>{$c.init(e,t),K.init(e,t)}),vd=b("ZodGUID",(e,t)=>{Sc.init(e,t),K.init(e,t)}),pt=b("ZodUUID",(e,t)=>{kc.init(e,t),K.init(e,t)}),_d=b("ZodURL",(e,t)=>{zc.init(e,t),K.init(e,t)}),wd=b("ZodEmoji",(e,t)=>{Ic.init(e,t),K.init(e,t)}),Sd=b("ZodNanoID",(e,t)=>{Tc.init(e,t),K.init(e,t)}),kd=b("ZodCUID",(e,t)=>{Rc.init(e,t),K.init(e,t)}),$d=b("ZodCUID2",(e,t)=>{Nc.init(e,t),K.init(e,t)}),Od=b("ZodULID",(e,t)=>{Pc.init(e,t),K.init(e,t)}),jd=b("ZodXID",(e,t)=>{Cc.init(e,t),K.init(e,t)}),xd=b("ZodKSUID",(e,t)=>{Zc.init(e,t),K.init(e,t)}),Ad=b("ZodIPv4",(e,t)=>{Lc.init(e,t),K.init(e,t)}),Ed=b("ZodIPv6",(e,t)=>{qc.init(e,t),K.init(e,t)}),zd=b("ZodCIDRv4",(e,t)=>{Jc.init(e,t),K.init(e,t)}),Id=b("ZodCIDRv6",(e,t)=>{Kc.init(e,t),K.init(e,t)}),Td=b("ZodBase64",(e,t)=>{Wc.init(e,t),K.init(e,t)}),Rd=b("ZodBase64URL",(e,t)=>{Yc.init(e,t),K.init(e,t)}),Nd=b("ZodE164",(e,t)=>{Gc.init(e,t),K.init(e,t)}),Pd=b("ZodJWT",(e,t)=>{Xc.init(e,t),K.init(e,t)}),ei=b("ZodNumber",(e,t)=>{ds.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zs(e,n,r,o),e.isFinite=!0},Xo({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=pe(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=pe(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=pe(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>pe(e).format??null},{gt(e,t){return this.check(Gr(e,t))},gte(e,t){return this.check(mn(e,t))},min(e,t){return this.check(mn(e,t))},lt(e,t){return this.check(Yr(e,t))},lte(e,t){return this.check(pn(e,t))},max(e,t){return this.check(pn(e,t))},int(e){return this.check(co(e))},safe(e){return this.check(co(e))},positive(e){return this.check(Gr(0,e))},nonnegative(e){return this.check(mn(0,e))},negative(e){return this.check(Yr(0,e))},nonpositive(e){return this.check(pn(0,e))},multipleOf(e,t){return this.check(Hr(e,t))},step(e,t){return this.check(Hr(e,t))},finite(){return this}}));function re(e){return lf(ei,e)}const Cd=b("ZodNumberFormat",(e,t)=>{el.init(e,t),ei.init(e,t)});function co(e){return ff(Cd,e)}const Zd=b("ZodBoolean",(e,t)=>{tl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Is(e,n,r)});function wt(e){return df(Zd,e)}const Md=b("ZodNull",(e,t)=>{nl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ts(e,n,r)});function Dd(e){return pf(Md,e)}const Ud=b("ZodAny",(e,t)=>{rl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ns()});function Se(){return mf(Ud)}const Fd=b("ZodUnknown",(e,t)=>{ol.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ps()});function lo(){return hf(Fd)}const Ld=b("ZodNever",(e,t)=>{sl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rs(e,n,r)});function Bd(e){return gf(Ld,e)}const qd=b("ZodArray",(e,t)=>{Gt(),ul.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Us(e,n,r,o),e.element=t.element},{min(e,t){return this.check(It(e,t))},nonempty(e){return this.check(It(1,e))},max(e,t){return this.check(_s(e,t))},length(e,t){return this.check(ws(e,t))},unwrap(){return this.element}});function ae(e,t){return Af(qd,e,t)}const Jd=b("ZodObject",(e,t)=>{Gt(),fl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fs(e,n,r,o),iu(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return De(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ue(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ue(this._zod.def,{catchall:lo()}))},loose(){return this.clone(ue(this._zod.def,{catchall:lo()}))},strict(){return this.clone(ue(this._zod.def,{catchall:Bd()}))},strip(){return this.clone(ue(this._zod.def,{catchall:void 0}))},extend(e){return Qa(this,e)},safeExtend(e){return Ya(this,e)},merge(e){return Ga(this,e)},pick(e){return Ka(this,e)},omit(e){return Wa(this,e)},partial(...e){return Tr(ti,this,e[0])},exactPartial(...e){return Tr(ni,this,e[0],"exactPartial")},required(...e){return Ha(ri,this,e[0])}});function P(e,t){const n={type:"object",shape:e??{},...A(t)};return new Jd(n)}const Vd=b("ZodUnion",(e,t)=>{dl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ls(e,n,r,o),e.options=t.options});function Ke(e,t){return new Vd({type:"union",options:e,...A(t)})}const Kd=b("ZodIntersection",(e,t)=>{pl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bs(e,n,r,o)});function Wd(e,t){return new Kd({type:"intersection",left:e,right:t})}const fo=b("ZodRecord",(e,t)=>{Gt(),ml.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qs(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Qd(e,t,n){return!t||!t._zod?new fo({type:"record",keyType:oe(),valueType:e,...A(t)}):new fo({type:"record",keyType:e,valueType:t,...A(n)})}const Nn=b("ZodEnum",(e,t)=>{hl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Cs(e,r,o),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Nn({...t,checks:[],...A(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Nn({...t,checks:[],...A(o),entries:s})}});function De(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Nn({type:"enum",entries:n,...A(t)})}const Yd=b("ZodLiteral",(e,t)=>{gl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zs(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function cr(e,t){return new Yd({type:"literal",values:Array.isArray(e)?e:[e],...A(t)})}const Gd=b("ZodTransform",(e,t)=>{Gt(),yl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ds(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new es(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(nt(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=e),n.issues.push(nt(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Hd(e){return new Gd({type:"transform",transform:e})}const ti=b("ZodOptional",(e,t)=>{hs.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ur(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function po(e){return new ti({type:"optional",innerType:e})}const ni=b("ZodExactOptional",(e,t)=>{bl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ur(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Xd(e){return new ni({type:"optional",innerType:e})}const ep=b("ZodNullable",(e,t)=>{vl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Js(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function mo(e){return new ep({type:"nullable",innerType:e})}const tp=b("ZodDefault",(e,t)=>{_l.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ws(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function np(e,t){return new tp({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Wo(t)}})}const rp=b("ZodPrefault",(e,t)=>{wl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function op(e,t){return new rp({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Wo(t)}})}const ri=b("ZodNonOptional",(e,t)=>{Sl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sp(e,t){return new ri({type:"nonoptional",innerType:e,...A(t)})}const ip=b("ZodCatch",(e,t)=>{kl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ys(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ap(e,t){return new ip({type:"catch",innerType:e,catchValue:typeof t=="function"?t:uu(t)})}const up=b("ZodPipe",(e,t)=>{$l.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gs(e,n,r,o),e.in=t.in,e.out=t.out});function ho(e,t){return new up({type:"pipe",in:e,out:t})}const cp=b("ZodReadonly",(e,t)=>{Ol.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lp(e){return new cp({type:"readonly",innerType:e})}const fp=b("ZodCustom",(e,t)=>{jl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ms(e,n,r,o)});function dp(e,t={}){return Ef(fp,e,t)}function pp(e,t){return zf(e,t)}const oi=new WeakSet;function mp(e){oi.add(e)}function Ue(e){return typeof e=="object"&&e!==null&&oi.has(e)}const Ct=new WeakMap;function lr(e,t){Ct.set(e,t)}const Zt=new WeakMap;function Pn(e,t){return Zt.set(t,e),t}function hp(e,t){const n=Ct.get(e);n&&Ct.set(t,n);const r=Zt.get(e);r&&Zt.set(t,r)}function fr(e,t){if(e!=null&&typeof e=="object"&&"_def"in e&&!("_zod"in e))throw new Error(`[OpenUI] Component "${t}" was defined with a Zod 3 schema. OpenUI requires Zod 4 schemas. If you're on zod@3.25+, import from "zod/v4" instead of "zod". See: https://zod.dev/v4/versioning`)}function ce(e){return e?._zod?.def}function dr(e){return ce(e)?.type}function si(e){const t=dr(e);return t==="optional"||t==="default"||t==="nullable"}function We(e){let t=e,n=ce(t);for(;n?.type==="optional"||n?.type==="default"||n?.type==="nullable";)t=n.innerType,n=ce(t);return t}function ii(e){return dr(We(e))==="array"}function gp(e){const t=ce(We(e));if(t?.type==="array")return t.element??t.innerType}function yp(e){const t=ce(We(e));if(t?.type==="enum"){if(Array.isArray(t.values))return t.values;if(t.entries&&typeof t.entries=="object")return Object.keys(t.entries)}}function bp(e,t){try{const n=t?.get(e);if(n?.id)return n.id}catch{}if(typeof e=="object"&&e!==null)return Ct.get(e)}function Mt(e){const t=ce(e);if(t?.type==="union"&&Array.isArray(t.options))return t.options}function vp(e){const t=ce(e);if(t?.type==="object"&&t.shape&&typeof t.shape=="object")return t.shape}function Re(e,t){const n=Ue(e),r=_p(We(e),t);if(r)return n?`$binding<${r}>`:r}function _p(e,t){const n=typeof e=="object"&&e!==null&&Zt.get(e);if(n)return`@${n}`;const r=bp(e,t);if(r)return r;const o=Mt(e);if(o){const u=o.map(c=>Re(c,t)).filter(Boolean);if(u.length>0)return u.join(" | ")}if(ii(e)){const u=gp(e);if(!u)return;const c=Re(u,t);return c?Mt(We(u))!==void 0?`(${c})[]`:`${c}[]`:void 0}const s=dr(e);if(s==="string")return"string";if(s==="number")return"number";if(s==="boolean")return"boolean";if(s==="any")return"any";if(s==="record"){const u=ce(e);return`Record<${Re(u?.keyType,t)??"string"}, ${Re(u?.valueType,t)??"any"}>`}const i=yp(e);if(i)return i.map(u=>`"${u}"`).join(" | ");if(s==="literal"){const u=ce(e)?.values;if(Array.isArray(u)&&u.length===1){const c=u[0];return typeof c=="string"?`"${c}"`:String(c)}}const a=vp(e);return a?`{${Object.entries(a).map(([u,c])=>{const l=si(c)?"?":"",p=Re(c,t);return p?`${u}${l}: ${p}`:`${u}${l}`}).join(", ")}}`:"any"}function wp(e,t){return Object.entries(e).map(([n,r])=>({name:n,isOptional:si(r),isArray:ii(r),typeAnnotation:Re(r,t)}))}function Sp(e,t){return`${e}(${t.map(n=>n.typeAnnotation?n.isOptional?`${n.name}?: ${n.typeAnnotation}`:`${n.name}: ${n.typeAnnotation}`:n.isArray?n.isOptional?`[${n.name}]?`:`[${n.name}]`:n.isOptional?`${n.name}?`:n.name).join(", ")})`}function Ht(e,t,n,r){const o=Sp(e,wp(t._zod.def.shape,r)),s=n&&Re(n,r);return s?`${o} → ${s}`:o}const he=e=>{throw new Error(`[extend] ${e}`)};function kp(e,t){const n=$p(e,t.components),r=jp(n,Op(n));return{...e,id:void 0,components:Ap(n,r),componentGroups:zp(e.componentGroups,n.removed),functions:[...e.functions??[],...t.functions?.add??[]],actions:[...e.actions??[],...t.actions?.add??[]]}}function $p(e,t={}){const n=new Map(e.components.map(c=>[c.name,c])),r=new Map(e.components.map(c=>[c.props,c.name])),o=new Map,s=new Set,i=c=>{n.set(c.name,c),r.set(c.props,c.name),s.add(c.name)};for(const c of t.add??[]){const{component:l,slots:p}="slots"in c?c:{component:c,slots:void 0},f=l.name;n.has(f)&&he(`Component "${f}" already exists. Use override.`),p?.length===0&&he(`"slots" for "${f}" is empty. Omit it to only list it.`),i(l),p&&o.set(f,p)}const a=new Set;for(const c of t.override??[])n.has(c.name)||he(`Cannot override "${c.name}": not in the library. Use add.`),a.has(c.name)&&he(`Component "${c.name}" is overridden twice.`),a.add(c.name),i(c);const u=new Set(t.remove);for(const c of u)s.has(c)&&he(`Cannot remove "${c}": it is added or overridden in the same call.`),n.delete(c)||he(`Cannot remove "${c}": not in the library.`),c===e.root&&he(`Cannot remove "${c}": it is the library root.`);return{byName:n,nameOf:r,slotRequests:o,removed:u}}function pr(e,t){const n=We(e),r=ce(n);return r?.type==="array"?pr(r.element,t):Mt(n)?.some(o=>t.has(o))?n:void 0}function Op({byName:e,nameOf:t}){const n=[];for(const r of e.values())for(const[o,s]of Object.entries(r.props.shape))pr(s,t)&&n.push(`${r.name}.${o}`);return n}function jp(e,t){const n=new Map;for(const[r,o]of e.slotRequests)for(const s of o){const i=xp(s,r,t,e.byName),a=n.get(i)??[];a.includes(r)||n.set(i,[...a,r])}return n}function xp(e,t,n,r){if(n.includes(e))return e;const o=e.split(".")[0],s=n.filter(a=>a.startsWith(`${o}.`));if(!e.includes(".")&&s.length===1)return s[0];const i=`Slot "${e}" for "${t}"`;return r.has(o)||he(`${i}: "${o}" is not in the library.`),s.length||he(`${i}: "${o}" has no content slot (a prop that is a union of components, or an optional or array of one).`),he(`${i} must be one content slot. Candidates: ${s.join(", ")}.`)}function Ap(e,t){const{byName:n,nameOf:r,removed:o}=e,s=new Map(n),i=new Map;for(const l of Ep(e,t)){const p=n.get(l),f={},d=yo(p.props,{get shape(){return f}});s.set(l,{...p,props:d,ref:d}),i.set(l,f)}const a=l=>s.get(l).props,u=(l,p)=>he(`Cannot remove "${l}": it is the only type allowed in ${p.path}.`),c=(l,p,f)=>{const d=r.get(l);if(d!==void 0)return o.has(d)&&u(d,p),a(d);const m=ce(l);if(!m||m.type==="lazy")return l;if(f.has(l))return f.get(l);f.set(l,l);const h=O=>c(O,p,f),y={},_=Mt(l),v=_?.some(O=>r.has(O));for(const[O,k]of Object.entries(m)){if(O==="checks"||v&&O==="options")continue;const $=ui(O,k,h);go($,k)||(y[O]=$)}if(v){const O=_.filter(C=>!o.has(r.get(C)??"")).map(h),k=l===p.union?p.added.filter(C=>!O.includes(C)):[];!O.length&&!k.length&&u(r.get(_[0]),p);const $=[...O,...k];go($,_)||(y.options=$)}const E=Object.keys(y).length?yo(l,y):l;return f.set(l,E),E};for(const[l,p]of i)for(const[f,d]of Object.entries(n.get(l).props.shape)){const m=`${l}.${f}`,h=(t.get(m)??[]).map(a);p[f]=c(d,{path:m,union:pr(d,r),added:h},new Map)}return[...s.values()]}function Ep({byName:e,nameOf:t,removed:n},r){const o=new Map;for(const[u,c]of e){const l=new Set;for(const p of Object.values(c.props.shape))ai(p,t,l);o.set(u,l)}const s=u=>{const c=t.get(u);return n.has(c)||e.get(c).props!==u},i=new Set([...r.keys()].map(u=>u.split(".")[0])),a=new Set([...e.keys()].filter(u=>i.has(u)));for(const[u,c]of o)[...c].some(s)&&a.add(u);for(let u=!0;u;){u=!1;for(const[c,l]of o)a.has(c)||![...l].some(p=>a.has(t.get(p)))||(a.add(c),u=!0)}return a}function ai(e,t,n,r=new Set){if(t.has(e))return void n.add(e);const o=ce(e);if(!(!o||o.type==="lazy"||r.has(e))){r.add(e);for(const[s,i]of Object.entries(o))s!=="checks"&&ui(s,i,a=>ai(a,t,n,r))}}function ui(e,t,n){if(ce(t))return n(t);if(Array.isArray(t))return t.map(n);if(e!=="shape")return t;const r={};for(const[o,s]of Object.entries(t))r[o]=n(s);return r}function go(e,t){if(e===t)return!0;if(ce(e))return!1;const n=Object.entries(e);return n.length===Object.keys(t).length&&n.every(([r,o])=>o===t[r])}function yo(e,t){const n=e,r=Oe(n,ue(n._zod.def,t));hp(n,r),Ue(n)&&mp(r);const o=Ne.get(n);return o&&Ne.add(r,o),r}function zp(e,t){return e?.map(n=>({...n,components:n.components.filter(r=>!t.has(r))})).filter(n=>n.components.length)}function ci(e,t){if(fr(e,t),e?._zod?.def.type!=="object")throw new Error(`[OpenUI] "${t}" params must be a z.object().`)}function de(e){return ci(e.params,e.name),e.returns&&fr(e.returns,e.name),e}function Ye(e){ci(e.params,e.name);const t=P({type:cr(e.name),params:e.params});return{...e,ref:Pn(e.name,t)}}function hn(e,t){if(!t||e==null)return;if(!t.includes("."))return e[t];let n=e;for(const r of t.split(".")){if(n==null)return;n=n[r]}return n}function R(e){if(typeof e=="number")return e;if(typeof e=="string"){const t=Number(e);return isNaN(t)?0:t}return typeof e=="boolean"&&e?1:0}const bo=e=>e.reduce((t,n)=>t+R(n),0),je=()=>ae(Se()),mt=()=>P({numbers:ae(re())}),gn=()=>P({number:re()}),li=[de({name:"Count",description:"Returns array length",params:P({array:je()}),returns:re(),fn:({array:e})=>Array.isArray(e)?e.length:0}),de({name:"First",description:"Returns first element of array",params:P({array:je()}),returns:Se(),fn:({array:e})=>Array.isArray(e)?e[0]??null:null}),de({name:"Last",description:"Returns last element of array",params:P({array:je()}),returns:Se(),fn:({array:e})=>Array.isArray(e)?e[e.length-1]??null:null}),de({name:"Sum",description:"Sum of numeric array",params:mt(),returns:re(),fn:({numbers:e})=>Array.isArray(e)?bo(e):0}),de({name:"Avg",description:"Average of numeric array",params:mt(),returns:re(),fn:({numbers:e})=>Array.isArray(e)&&e.length?bo(e)/e.length:0}),de({name:"Min",description:"Minimum value in array",params:mt(),returns:re(),fn:({numbers:e})=>Array.isArray(e)&&e.length?e.reduce((t,n)=>Math.min(t,R(n)),R(e[0])):0}),de({name:"Max",description:"Maximum value in array",params:mt(),returns:re(),fn:({numbers:e})=>Array.isArray(e)&&e.length?e.reduce((t,n)=>Math.max(t,R(n)),R(e[0])):0}),de({name:"Sort",description:'Sort array by field. Direction: "asc" (default) or "desc"',params:P({array:je(),field:oe(),direction:De(["asc","desc"]).optional()}),returns:je(),fn:({array:e,field:t,direction:n})=>{if(!Array.isArray(e))return e;const r=String(t??""),o=String(n??"asc")==="desc";return[...e].sort((s,i)=>{const a=r?hn(s,r):s,u=r?hn(i,r):i,c=typeof a=="number"||typeof a=="string"&&!isNaN(Number(a))&&a!=="",l=typeof u=="number"||typeof u=="string"&&!isNaN(Number(u))&&u!=="";if(c&&l){const f=R(a)-R(u);return o?-f:f}const p=String(a??"").localeCompare(String(u??""));return o?-p:p})}}),de({name:"Filter",description:"Filter array by field value",params:P({array:je(),field:oe(),operator:De(["==","!=",">","<",">=","<=","contains"]),value:Se()}),returns:je(),fn:({array:e,field:t,operator:n,value:r})=>{if(!Array.isArray(e))return[];const o=String(t??""),s=String(n??"==");return e.filter(i=>{const a=o?hn(i,o):i;switch(s){case"==":return a==r;case"!=":return a!=r;case">":return R(a)>R(r);case"<":return R(a)<R(r);case">=":return R(a)>=R(r);case"<=":return R(a)<=R(r);case"contains":return String(a??"").includes(String(r??""));default:return!1}})}}),de({name:"Round",description:"Round to N decimal places (default 0)",params:P({number:re(),decimals:re().optional()}),returns:re(),fn:({number:e,decimals:t})=>{const n=R(e),r=t!=null?R(t):0,o=Math.pow(10,r);return Math.round(n*o)/o}}),de({name:"Abs",description:"Absolute value",params:gn(),returns:re(),fn:({number:e})=>Math.abs(R(e))}),de({name:"Floor",description:"Round down to nearest integer",params:gn(),returns:re(),fn:({number:e})=>Math.floor(R(e))}),de({name:"Ceil",description:"Round up to nearest integer",params:gn(),returns:re(),fn:({number:e})=>Math.ceil(R(e))}),{name:"Each",description:"Evaluate template for each element. varName is the loop variable — use it ONLY inside the template expression (inline). Do NOT create a separate statement for the template.",params:P({array:je(),varName:oe(),template:Se()}),lazy:!0}],fi=Object.fromEntries(li.map(e=>[e.name,e])),ve={Run:"run",ToAssistant:"continue_conversation",OpenUrl:"open_url",Set:"set",Reset:"reset"};function yn(e){const t=Se();return lr(t,e),t}const di=()=>P({type:cr("open_url"),url:oe()}),pi=()=>P({type:cr("continue_conversation"),context:oe().optional()}),mr=Ke([di(),pi(),P({type:oe(),params:Qd(oe(),Se()).optional()})]);lr(mr,"ActionExpression");function Ip(){return mr}const Dt={OpenUrl:{ref:Pn("OpenUrl",di())},ToAssistant:{ref:Pn("ToAssistant",pi())}},mi={ActionExpression:mr,OpenUrl:Dt.OpenUrl.ref,ToAssistant:Dt.ToAssistant.ref},hi=[{...Ye({name:"Run",description:"Execute a Mutation or re-fetch a Query (ref must be a declared Query/Mutation)",params:P({ref:yn("Query | Mutation")})}),lazy:!0},{...Ye({name:"ToAssistant",description:'Send a message to the assistant (for conversational buttons like "Tell me more", "Explain this"). The optional context is any value (object, array, string, number) passed to the assistant as hidden data, e.g. @ToAssistant("Show details", {orderId: 42})',params:P({message:oe(),context:Se().optional()})}),ref:Dt.ToAssistant.ref,step:({message:e,context:t})=>({type:ve.ToAssistant,message:String(e??""),context:t??void 0})},{...Ye({name:"OpenUrl",description:"Navigate to a URL",params:P({url:oe()})}),ref:Dt.OpenUrl.ref,step:({url:e})=>({type:ve.OpenUrl,url:String(e??"")})},{...Ye({name:"Set",description:"Set a $variable to a specific value",params:P({variable:yn("$variable"),value:Se()})}),lazy:!0},{...Ye({name:"Reset",description:'Reset $variables to their declared defaults; pass several to reset each (e.g. @Reset($title, $priority) restores $title="" and $priority="medium")',params:P({variable:yn("$variable")})}),lazy:!0}],gi=Object.fromEntries(hi.map(e=>[e.name,e])),vo=(e,t)=>({kind:e,params:Object.keys(t.params.shape).map(n=>({name:n,required:!1})),builtin:!0,...t.lazy?{lazy:!0}:{}}),ot=new Map([...li.map(e=>[e.name,vo("function",e)]),...hi.map(e=>[e.name,vo("action",e)]),["Action",{kind:"action",params:[{name:"steps",required:!0}],builtin:!0,lazy:!0}]]);function Xt(e){return e?.callDefs??ot}function Ut(e){return ot.has(e)}function Tp(e,t){return ot.get(e)?.kind==="action"||!1}const Me={Query:"Query",Mutation:"Mutation"};function st(e){return e in Me}const Rp="lang_core_parser_parse_used",yi=.1,Np="1.0.1",_o=Symbol.for("@openuidev/lang-core/telemetry/v1");async function Pp(e){const t=globalThis.crypto?.subtle;if(!t)throw new Error("Web Crypto is unavailable");const n=new TextEncoder().encode(e),r=await t.digest("SHA-256",n);return Array.from(new Uint8Array(r),o=>o.toString(16).padStart(2,"0")).join("")}function Cp(){const e=globalThis.process;if(!(!e||typeof e!="object"))return e}function Zp(){const e=globalThis;return e.navigator?.product==="ReactNative"||!!(e.window&&e.document)}function Mp(){const e=globalThis.WorkerGlobalScope;return!!(e&&e.prototype.isPrototypeOf(globalThis))}function Dp(){if(Zp())return;const e=globalThis,t=Cp();if(e.Bun&&typeof e.Bun=="object")return{name:"bun",version:e.Bun.version,env:t?.env,process:t};if(e.Deno&&typeof e.Deno=="object")return{name:"deno",version:e.Deno.version?.deno};if(typeof e.EdgeRuntime=="string")return{name:"edge",version:e.EdgeRuntime};if(typeof e.WebSocketPair=="function")return{name:"edge"};if(!Mp()&&(t?.release?.name==="node"||typeof t?.versions?.node=="string"&&t.versions.node.length>0))return{name:"node",version:t.versions?.node,env:t.env,process:t}}function Up(e){const t=e?.NODE_ENV;return t==="production"||t==="development"||t==="test"?t:"unknown"}function Fp(){const e=globalThis;return e[_o]??={runtimeId:globalThis.crypto.randomUUID()},e[_o]}function Lp(e){const t=e.getBuiltinModule?.("node:child_process")?.execFile;return t?new Promise(n=>{try{t("git",["config","--local","--get","remote.origin.url"],{encoding:"utf8",timeout:1e3,windowsHide:!0},(r,o)=>{const s=o?.trim();n(r||!s?void 0:s)})}catch{n(void 0)}}):Promise.resolve(void 0)}async function Bp(e){if(!e)return;const t=await Lp(e)||e.env?.REPOSITORY_URL||e.cwd?.();return t&&Bo(t)||void 0}function qp(e){const t=Bo(e);return t?Pp(t):Promise.reject(new TypeError("Repository identifier is empty"))}function Jp(e,t){return t.name!=="node"?Promise.resolve(void 0):(e.projectHash??=Promise.resolve().then(()=>Bp(t.process)).then(n=>n?qp(n):void 0).catch(()=>{}),e.projectHash)}async function Vp(e){if(!e.env)return{id:null,isCI:!1};try{const t=await Lo(()=>import("./index-ByrWASlZ.js").then(n=>n.i),__vite__mapDeps([0,1]));return{id:t.id,isCI:t.isCI}}catch{return{id:null,isCI:!1}}}async function Kp(e,t,n){const r=Na(n.env);await globalThis.fetch(r.captureUrl,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({api_key:r.apiKey,event:e,timestamp:new Date().toISOString(),properties:t}),keepalive:!0,signal:globalThis.AbortSignal.timeout(Ra)})}function Wp(e){const t={"unknown-component":0,"missing-required":0,"null-required":0,"inline-reserved":0,"excess-args":0,"type-mismatch":0,"unknown-function":0,"no-root":0};for(const n of e.meta.errors)t[n.code]+=1;return{unknown_component_count:t["unknown-component"],missing_required_count:t["missing-required"],null_required_count:t["null-required"],inline_reserved_count:t["inline-reserved"],excess_args_count:t["excess-args"]}}function Qp(e){return{outcome:e.meta.errors.length>0?"invalid":e.root?"valid":"no_renderable_root",incomplete:e.meta.incomplete,has_renderable_root:e.root!==null,statement_count:e.meta.statementCount,unresolved_count:e.meta.unresolved.length,orphaned_count:e.meta.orphaned.length,validation_error_count:e.meta.errors.length,...Wp(e)}}async function bi(e,t){const{state:n,runtime:r,environment:o}=e,[s,i]=await Promise.all([Jp(n,r),Vp(r)]);await Kp(Rp,{distinct_id:n.runtimeId,$process_person_profile:!1,event_id:globalThis.crypto.randomUUID(),telemetry_schema_version:1,sdk_name:"@openuidev/lang-core",sdk_version:Np,api_surface:"parser.parse",runtime:r.name,runtime_version:r.version,environment:o,ci:i.isCI,...i.id?{ci_name:i.id}:{},sample_rate:yi,...t,...s?{project_hash_version:1,project_hash:s}:{}},r)}function Yp(){try{const e=Dp();if(!e||typeof globalThis.fetch!="function"||typeof globalThis.crypto?.randomUUID!="function"||typeof globalThis.AbortSignal?.timeout!="function")return;const t=e.env;return!Ca(t)||Math.random()>=yi?void 0:{state:Fp(),runtime:e,environment:Up(t)}}catch{return}}function Gp(e,t){if(e)try{const n=Qp(t);Promise.resolve().then(()=>bi(e,n)).catch(()=>{})}catch{}}function Hp(e){if(e)try{Promise.resolve().then(()=>bi(e,{outcome:"threw"})).catch(()=>{})}catch{}}function Ft(e){const t=e.type;if(t==="string"){const n=e.enum;return n?n.map(r=>`"${r}"`).join(" | "):"string"}if(t==="number"||t==="integer")return"number";if(t==="boolean")return"boolean";if(t==="array"){const n=e.items;return n?`${Ft(n)}[]`:"any[]"}if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const r=e.required??[];return`{${Object.entries(n).map(([o,s])=>`${o}${r.includes(o)?"":"?"}: ${Ft(s)}`).join(", ")}}`}return"object"}return"any"}function vi(e){const t=e.type;if(t==="string")return"";if(t==="number"||t==="integer")return 0;if(t==="boolean")return!1;if(t==="array")return[];if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const r={};for(const[o,s]of Object.entries(n))r[o]=vi(s);return r}return{}}return null}const Xp="You are an AI assistant that responds using openui-lang, a declarative UI language. Your ENTIRE response must be valid openui-lang code — no markdown, no explanations, just openui-lang.";function em(e,t){const n=["## Syntax Rules","","1. Each statement is on its own line: `identifier = Expression`",`2. \`root\` is the entry point — every program must define \`root = ${e}(...)\``,'3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)',"4. Use references for readability: define `name = ...` on one line, then use `name` later","5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.",'6. Arguments are POSITIONAL (order matters, not names). Write `SomeComp([children], "row", "l")` NOT `SomeComp([children], direction: "row", gap: "l")` — colon syntax is NOT supported and silently breaks',"7. Optional arguments can be omitted from the end"];let r=8;return t.bindings&&n.push(`${r++}. Declare mutable state with \`$varName = defaultValue\`. Components marked with \`$binding\` can read/write these. Undeclared $variables are auto-created with null default.`),t.supportsExpressions&&n.push(`${r++}. String concatenation: \`"text" + $var + "more"\``,`${r++}. Dot member access: \`query.field\` reads a field; on arrays it extracts that field from every element`,`${r++}. Index access: \`arr[0]\`, \`data[index]\``,`${r++}. Arithmetic operators: +, -, *, /, % (work on numbers; + is string concat when either side is a string)`,`${r++}. Comparison: ==, !=, >, <, >=, <=`,`${r++}. Logical: &&, ||, ! (prefix)`,`${r++}. Ternary: \`condition ? valueIfTrue : valueIfFalse\``,`${r++}. Parentheses for grouping: \`(a + b) * c\``),n.push("- Strings use double quotes with backslash escaping"),n.join(`
|
|
59
|
+
`)}function Lt(e){return e.description?`@${e.signature} — ${e.description}`:`@${e.signature}`}function tm(e,t){const n=[...Object.values(fi).map(r=>Lt({...r,signature:Ht(r.name,r.params,r.returns)})),...e].join(`
|
|
60
|
+
`);return`## Built-in Functions
|
|
61
|
+
|
|
62
|
+
Data functions prefixed with \`@\` to distinguish from components. These are the ONLY functions available — do NOT invent new ones.
|
|
63
|
+
Use @-prefixed built-in functions (@Count, @Sum, @Avg, @Min, @Max, @Round) on ${t?"Query results":"data"}. Do NOT hardcode computed values.
|
|
64
|
+
|
|
65
|
+
${n}
|
|
66
|
+
|
|
67
|
+
Builtins compose — output of one is input to the next:
|
|
68
|
+
\`@Count(@Filter(data.rows, "field", "==", "val"))\` for KPIs/chart values, \`@Round(@Avg(data.rows.score), 1)\`, \`@Each(data.rows, "item", Comp(item.field))\` for per-item rendering.
|
|
69
|
+
Array pluck: \`data.rows.field\` extracts a field from every row → use with @Sum, @Avg, charts, tables.
|
|
70
|
+
|
|
71
|
+
IMPORTANT @Each rule: The loop variable (e.g. "item") is ONLY available inside the @Each template expression. Always inline the template — do NOT extract it to a separate statement.
|
|
72
|
+
CORRECT: \`list = @Each(rows, "t", Comp(t.name))\`
|
|
73
|
+
WRONG: \`item = Comp(t.name)\` then \`list = @Each(rows, "t", item)\`, because t is undefined in item.`}function nm(){return`## Query — Live Data Fetching
|
|
74
|
+
|
|
75
|
+
Fetch data from available tools. Returns defaults instantly, swaps in real data when it arrives.
|
|
76
|
+
|
|
77
|
+
\`\`\`
|
|
78
|
+
metrics = Query("tool_name", {arg1: value, arg2: $binding}, {defaultField: 0, defaultData: []}, refreshInterval?)
|
|
79
|
+
\`\`\`
|
|
80
|
+
|
|
81
|
+
- First arg: tool name (string)
|
|
82
|
+
- Second arg: arguments object (may reference $bindings — re-fetches automatically on change)
|
|
83
|
+
- Third arg: default data (rendered immediately before fetch resolves)
|
|
84
|
+
- Fourth arg (optional): refresh interval in seconds (e.g. 30 for auto-refresh every 30s)
|
|
85
|
+
- Use dot access on results: metrics.totalEvents, metrics.data.day (array pluck)
|
|
86
|
+
- Query results must use regular identifiers: \`metrics = Query(...)\`, NOT \`$metrics = Query(...)\`
|
|
87
|
+
- Manual refresh: \`Button("Refresh", Action([@Run(query1), @Run(query2)]), "secondary")\` — re-fetches the listed queries
|
|
88
|
+
- Refresh all queries: create Action with @Run for each query`}function rm(){return`## Mutation — Write Operations
|
|
89
|
+
|
|
90
|
+
Execute state-changing tool calls (create, update, delete). Unlike Query (auto-fetches on render), Mutation fires only on button click via Action.
|
|
91
|
+
|
|
92
|
+
\`\`\`
|
|
93
|
+
result = Mutation("tool_name", {arg1: $binding, arg2: "value"})
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
- First arg: tool name (string)
|
|
97
|
+
- Second arg: arguments object (evaluated with current $binding values at click time)
|
|
98
|
+
- result.status: "idle" | "loading" | "success" | "error"
|
|
99
|
+
- result.data: tool response on success
|
|
100
|
+
- result.error: error message on failure
|
|
101
|
+
- Mutation results use regular identifiers: \`result = Mutation(...)\`, NOT \`$result\`
|
|
102
|
+
- Show loading state: \`result.status == "loading" ? TextContent("Saving...") : null\``}const _i="## Action — Button Behavior";function wi(e){return Object.values(gi).filter(t=>t.name==="Run"?e.toolCalls:t.name==="Set"||t.name==="Reset"?e.bindings:!0)}function om(e,t){const n=[...wi(e).map(s=>`- ${Lt({...s,signature:Ht(s.name,s.params)})}`),...t],r=[];e.toolCalls&&r.push('Example — mutation + refresh + reset (PREFERRED pattern):\n```\n$binding = "default"\nresult = Mutation("tool_name", {field: $binding})\ndata = Query("tool_name", {}, {rows: []})\nonSubmit = Action([@Run(result), @Run(data), @Reset($binding)])\n```'),r.push('Example — simple nav:\n```\nviewBtn = Button("View", @OpenUrl("https://example.com"))\n```');const o=['- An action can be assigned to a variable or inlined: Button("Go", onSubmit) and Button("Go", Action([...])) both work'];return e.toolCalls&&o.push("- If a @Run(mutation) step fails, remaining steps are skipped (halt on failure)","- @Run(queryRef) re-fetches the query (fire-and-forget, cannot fail)"),`${_i}
|
|
103
|
+
|
|
104
|
+
An action wires a button click to operations. Pass one @-prefixed step bare, e.g. Button("Ask", @ToAssistant("Tell me more")). Put several steps in Action([...]), e.g. Button("Read", Action([@OpenUrl("https://example.com"), @ToAssistant("Summarize this page")])). Steps execute in order.
|
|
105
|
+
Buttons without an action automatically send their label to the assistant (equivalent to @ToAssistant(label)).
|
|
106
|
+
|
|
107
|
+
Available steps:
|
|
108
|
+
${n.join(`
|
|
109
|
+
`)}
|
|
110
|
+
|
|
111
|
+
${r.join(`
|
|
112
|
+
|
|
113
|
+
`)}
|
|
114
|
+
|
|
115
|
+
${o.join(`
|
|
116
|
+
`)}`}function sm(){return`## Interactive Filters
|
|
117
|
+
|
|
118
|
+
To let the user filter data with a dropdown:
|
|
119
|
+
1. Declare a $variable with a default: \`$dateRange = "14"\`
|
|
120
|
+
2. Create a Select with name, items, and binding: \`Select("dateRange", [SelectItem("7", "Last 7 days"), ...], null, null, $dateRange)\`
|
|
121
|
+
3. Wrap in FormControl for a label: \`FormControl("Date Range", Select(...))\`
|
|
122
|
+
4. Pass $dateRange in Query args: \`Query("tool", {dateRange: $dateRange}, {defaults})\`
|
|
123
|
+
5. When the user changes the Select, $dateRange updates and the Query automatically re-fetches
|
|
124
|
+
|
|
125
|
+
FILTER WIRING RULE: If a $binding filter is visible in the UI, EVERY relevant Query MUST reference that $binding in its args. Never show a filter dropdown while hardcoding the query args.
|
|
126
|
+
|
|
127
|
+
Rules for $variables:
|
|
128
|
+
- $variables hold simple values (strings or numbers), NOT arrays or objects
|
|
129
|
+
- $variables must be bound to a Select/Input component via the value argument (last positional arg) to be interactive
|
|
130
|
+
- Queries must use regular identifiers (NOT $variables): \`metrics = Query(...)\` not \`$metrics = Query(...)\`
|
|
131
|
+
- **Auto-declare**: You do NOT need to explicitly declare $variables. If you use \`$foo\` without declaring it, the parser auto-creates \`$foo = null\`. You can still declare explicitly to set a default: \`$days = "14"\`
|
|
132
|
+
|
|
133
|
+
## Forms
|
|
134
|
+
|
|
135
|
+
Simple form — no $bindings needed. Field values are managed internally by the Form via the name prop:
|
|
136
|
+
\`\`\`
|
|
137
|
+
contactForm = Form("contact", submitBtn, [nameField, emailField])
|
|
138
|
+
nameField = FormControl("Name", Input("name", "Your name", "text", {required: true}))
|
|
139
|
+
emailField = FormControl("Email", Input("email", "your@email.com", "email", {required: true, email: true}))
|
|
140
|
+
submitBtn = Button("Submit")
|
|
141
|
+
\`\`\`
|
|
142
|
+
|
|
143
|
+
Use $bindings when you need to read field values elsewhere (in Action context, Query args, or conditionals). They are auto-declared:
|
|
144
|
+
\`\`\`
|
|
145
|
+
$role = "engineer"
|
|
146
|
+
contactForm = Form("contact", submitBtn, [nameField, emailField, roleField])
|
|
147
|
+
nameField = FormControl("Name", Input("name", "Enter your name", "text", {required: true}, $name))
|
|
148
|
+
emailField = FormControl("Email", Input("email", "Enter your email", "email", {required: true, email: true}, $email))
|
|
149
|
+
roleField = FormControl("Role", Select("role", [SelectItem("engineer", "Engineer"), SelectItem("designer", "Designer"), SelectItem("pm", "PM")], null, {required: true}, $role))
|
|
150
|
+
submitBtn = Button("Submit")
|
|
151
|
+
\`\`\`
|
|
152
|
+
|
|
153
|
+
For form + mutation patterns (create, refresh, reset), see the Action section example above.
|
|
154
|
+
|
|
155
|
+
IMPORTANT: Always add validation rules to form fields used with Mutations. Use OBJECT syntax: {required: true, email: true, minLength: 8}. The renderer shows error messages automatically and blocks submit when validation fails.`}function im(){return`## Edit Mode
|
|
156
|
+
|
|
157
|
+
The runtime merges by statement name: same name = replace, new name = append.
|
|
158
|
+
Output ONLY statements that changed or are new. Everything else is kept automatically.
|
|
159
|
+
|
|
160
|
+
### Delete
|
|
161
|
+
To remove a component, re-declare its parent without that component in the parent's children array. The removed component and any statements only it referenced are automatically garbage-collected.
|
|
162
|
+
|
|
163
|
+
### Patch size guide
|
|
164
|
+
- Changing a title or label: 1 statement
|
|
165
|
+
- Adding a component: 2-3 statements (the new component + parent update)
|
|
166
|
+
- Removing a component: 1 statement (re-declare parent without the removed child)
|
|
167
|
+
- Adding a filter + wiring to query: 3-5 statements
|
|
168
|
+
- Restructuring into tabs: 5-10 statements
|
|
169
|
+
|
|
170
|
+
### Rules
|
|
171
|
+
- Reuse existing statement names exactly — do not rename
|
|
172
|
+
- Do NOT re-emit unchanged statements — the runtime keeps them
|
|
173
|
+
- A typical edit patch is 1-10 statements, not 20+
|
|
174
|
+
- If the existing code already satisfies the request, output only the root statement
|
|
175
|
+
- NEVER output the entire program as a patch. Only output what actually changes
|
|
176
|
+
- If you are about to output more than 10 statements, reconsider — most edits need fewer`}function am(e,t){const n=[`1. \`root = ${e}(...)\` — UI shell appears immediately`];if(t.supportsExpressions){n.push("2. $variable declarations — state ready for bindings"),t.toolCalls&&n.push("3. Query statements — defaults resolve immediately so components render with data");const r=n.length;n.push(`${r+1}. Component definitions — fill in with data already available`),n.push(`${r+2}. Data values — leaf content last`)}else n.push("2. Component definitions — fill in as they stream"),n.push("3. Data values — leaf content last");return`## Hoisting & Streaming (CRITICAL)
|
|
177
|
+
|
|
178
|
+
openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.
|
|
179
|
+
|
|
180
|
+
During streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal — structure first, then data fills in.
|
|
181
|
+
|
|
182
|
+
**Recommended statement order for optimal streaming:**
|
|
183
|
+
${n.join(`
|
|
184
|
+
`)}
|
|
185
|
+
|
|
186
|
+
Always write the root = ${e}(...) statement first so the UI shell appears immediately, even before child data has streamed in.`}function um(){return`## Inline Mode
|
|
187
|
+
|
|
188
|
+
You are in inline mode. You can respond in two ways:
|
|
189
|
+
|
|
190
|
+
### 1. Code response (when the user wants to CREATE or CHANGE the UI)
|
|
191
|
+
Wrap openui-lang code in triple-backtick fences. You can include explanatory text before/after:
|
|
192
|
+
|
|
193
|
+
Here's your dashboard:
|
|
194
|
+
|
|
195
|
+
\`\`\`openui-lang
|
|
196
|
+
root = RootComp([header, content])
|
|
197
|
+
header = SomeHeader("Title")
|
|
198
|
+
content = SomeContent("Hello world")
|
|
199
|
+
\`\`\`
|
|
200
|
+
|
|
201
|
+
I created a simple layout with a header.
|
|
202
|
+
|
|
203
|
+
### 2. Text-only response (when the user asks a QUESTION)
|
|
204
|
+
If the user asks "what is this?", "explain the chart", "how does this work", etc. — respond with plain text. Do NOT output any openui-lang code. The existing dashboard stays unchanged.
|
|
205
|
+
|
|
206
|
+
### Rules
|
|
207
|
+
- When the user asks for changes, output ONLY the changed/new statements in a fenced block
|
|
208
|
+
- When the user asks a question, respond with text only — NO code. The dashboard stays unchanged.
|
|
209
|
+
- The parser extracts code from fences automatically. Text outside fences is shown as chat.`}function cm(){return`## Data Workflow
|
|
210
|
+
|
|
211
|
+
When tools are available, follow this workflow:
|
|
212
|
+
1. FIRST: Call the most relevant tool to inspect the real data shape before generating code
|
|
213
|
+
2. Use Query() for READ operations (data that should stay live) — NEVER hardcode tool results as literal arrays or objects
|
|
214
|
+
3. Use Mutation() for WRITE operations (create, update, delete) — triggered by button clicks via @Run(mutationRef)
|
|
215
|
+
4. Use the real data from step 1 as condensed Query defaults (3-5 rows) so the UI renders immediately
|
|
216
|
+
5. Use @-prefixed builtins (@Count, @Filter, @Sort, @Sum) on Query results for KPIs and aggregations — the runtime evaluates these live on every refresh
|
|
217
|
+
6. Hardcoded arrays are ONLY for static display data (labels, options) where no tool exists
|
|
218
|
+
|
|
219
|
+
WRONG — you called a tool and got data back, but you inlined the results:
|
|
220
|
+
\`\`\`
|
|
221
|
+
openCount = 2
|
|
222
|
+
item1 = SomeComp("first item title")
|
|
223
|
+
item2 = SomeComp("second item title")
|
|
224
|
+
list = SomeList([item1, item2])
|
|
225
|
+
chart = SomeChart(["A", "B"], [12, 8])
|
|
226
|
+
\`\`\`
|
|
227
|
+
This is static — it shows stale data and won't update. Creating item1, item2, item3... manually is ALWAYS wrong when a tool exists.
|
|
228
|
+
|
|
229
|
+
RIGHT — use Query() for live data, Mutation() for writes, @builtins to derive values:
|
|
230
|
+
\`\`\`
|
|
231
|
+
data = Query("tool_name", {}, {rows: []})
|
|
232
|
+
openCount = @Count(@Filter(data.rows, "field", "==", "value"))
|
|
233
|
+
list = @Each(data.rows, "item", SomeComp(item.title, item.field))
|
|
234
|
+
createResult = Mutation("create_tool", {title: $title})
|
|
235
|
+
submitBtn = Button("Create", Action([@Run(createResult), @Run(data), @Reset($title)]))
|
|
236
|
+
\`\`\`
|
|
237
|
+
Everything derives from the Query — when data refreshes, the entire dashboard updates automatically.`}function lm(e,t){const n=[`1. root = ${e}(...) is the FIRST line (for optimal streaming).`,"2. Every referenced name is defined. Every defined name (other than root) is reachable from root."];return t.toolCalls&&n.push("3. Every Query result is referenced by at least one component."),t.bindings&&n.push(`${t.toolCalls?"4":"3"}. Every $binding appears in at least one component or expression.`),t.toolCalls&&t.bindings&&n.push("5. Every visible filter $binding appears in at least one Query args object."),`## Important Rules
|
|
238
|
+
- Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)
|
|
239
|
+
|
|
240
|
+
## Final Verification
|
|
241
|
+
Before finishing, walk your output and verify:
|
|
242
|
+
${n.join(`
|
|
243
|
+
`)}`}function fm(e){let t="";if(e.inputSchema){const o=e.inputSchema.properties,s=e.inputSchema.required??[];o&&Object.keys(o).length>0&&(t=Object.entries(o).map(([i,a])=>`${i}${s.includes(i)?"":"?"}: ${Ft(a)}`).join(", "))}let n="";e.outputSchema&&(n=` → ${Ft(e.outputSchema)}`);let r=`- ${e.name}(${t})${n}`;return e.description&&(r+=`
|
|
244
|
+
${e.description}`),r}function dm(e){const t=[],n=[],r=[];for(const s of e)typeof s=="string"?n.push(s):r.push(s);t.push("## Available Tools"),t.push(""),t.push("Use these with Query() for read operations or Mutation() for write operations. The LLM decides which is appropriate based on the tool's purpose."),t.push("");for(const s of n)t.push(`- ${s}`);for(const s of r)t.push(fm(s));const o=r.filter(s=>s.outputSchema);if(o.length>0){t.push(""),t.push("### Default values for Query results"),t.push(""),t.push("Use these shapes as minimal Query defaults:");for(const s of o){const i=vi(s.outputSchema);t.push(`- ${s.name}: \`${JSON.stringify(i)}\``)}}return t.push(""),t.push("CRITICAL: Use ONLY the tools listed above in Query() and Mutation() calls. Do NOT invent or guess tool names. If the user asks for functionality that doesn't match any available tool, use realistic mock data instead of fabricating a tool call."),t.join(`
|
|
245
|
+
`)}const Si=/[:|] @[A-Z]/;function pm(e,t){const n=["## Component Signatures","","Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming."];if(t.usesActionExpression){const o=[...wi(t).map(s=>s.name),...Object.keys(e.actions??{})].map(s=>`@${s}`);n.push(`Props typed \`ActionExpression\` accept one @step, or Action([@steps...]) for several. See the Action section for available steps (${o.join(", ")}).`),Object.values(e.components).some(s=>Si.test(s.signature??""))&&n.push("Props typed like `@OpenUrl | @ToAssistant` accept only the steps listed.")}(t.bindings||Object.values(e.components).some(o=>o.signature?.includes("$binding")))&&n.push("Props marked `$binding<type>` accept a `$variable` reference for two-way binding.");const r=o=>o.description?`${o.signature} — ${o.description}`:o.signature;if(e.componentGroups?.length){const o=new Set;for(const i of e.componentGroups){n.push("",`### ${i.name}`);for(const a of i.components){if(o.has(a))continue;const u=e.components[a];u&&(o.add(a),n.push(r(u)))}if(i.notes?.length)for(const a of i.notes)n.push(a)}const s=Object.keys(e.components).filter(i=>!o.has(i));if(s.length){n.push("","### Other");for(const i of s){const a=e.components[i];n.push(r(a))}}}else{n.push("");for(const[,o]of Object.entries(e.components))n.push(r(o))}return n.join(`
|
|
246
|
+
`)}function mm(e){const t=e.root??"Root",n=!!e.tools?.length,r=e.toolCalls??n,o=e.bindings??r,s=r||o,i=Object.values(e.components).some(p=>p.signature?.includes("ActionExpression")||Si.test(p.signature??"")),a=[];a.push(e.preamble??Xp),a.push(""),a.push(em(t,{supportsExpressions:s,bindings:o})),a.push(""),a.push(pm(e,{toolCalls:r,bindings:o,usesActionExpression:i}));const u=Object.values(e.functions??{}).map(Lt);e.builtinFunctions??s?(a.push(""),a.push(tm(u,r))):u.length&&(a.push(""),a.push(`## Built-in Functions
|
|
247
|
+
|
|
248
|
+
${u.join(`
|
|
249
|
+
`)}`)),r&&(a.push(""),a.push(nm()),a.push(""),a.push(rm()));const c=Object.values(e.actions??{}).map(p=>`- ${Lt(p)}`);i?(a.push(""),a.push(om({toolCalls:r,bindings:o},c))):c.length&&(a.push(""),a.push(`${_i}
|
|
250
|
+
|
|
251
|
+
Pass one step, or Action([...]) with several steps, as a button's action.
|
|
252
|
+
|
|
253
|
+
Available steps:
|
|
254
|
+
${c.join(`
|
|
255
|
+
`)}`)),r&&o&&(a.push(""),a.push(sm())),r&&(a.push(""),a.push(cm())),e.tools?.length&&(a.push(""),a.push(dm(e.tools))),a.push(""),a.push(am(t,{supportsExpressions:s,toolCalls:r}));const l=[...e.examples??[],...e.toolExamples??[]];if(l.length){a.push(""),a.push("## Examples"),a.push("");for(const p of l)a.push(p),a.push("")}if(e.editMode&&(a.push(""),a.push(im())),e.inlineMode&&(a.push(""),a.push(um())),a.push(lm(t,{toolCalls:r,bindings:o})),e.additionalRules?.length){a.push("");for(const p of e.additionalRules)a.push(`- ${p}`)}return a.join(`
|
|
256
|
+
`)}function en(e){return fr(e.props,e.name),lr(e.props,e.name),{...e,ref:e.props}}function wo(e,t){const n={};for(const[r,o]of Object.entries(e))n[r]={signature:Ht(r,o.props,void 0,t),description:o.description};return n}function So(e,t){const n=Object.entries(e);if(!n.length)return;const r={};for(const[o,s]of n)r[o]={signature:Ht(o,s.params,"returns"in s?s.returns:void 0,t),description:s.description};return r}let ko=0;function hm(){return typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID():(ko+=1,`openui-lib-${Date.now().toString(36)}-${ko.toString(36)}`)}function hr(e){const t={},n=bs(),r=hm();for(const d of e.components)n.add(d.props,{id:d.name}),t[d.name]=d;for(const[d,m]of Object.entries(mi))t[d]||n.add(m,{id:d});if(e.root&&!t[e.root]){const d=Object.keys(t).join(", ");throw new Error(`[createLibrary] Root component "${e.root}" was not found in components. Available components: ${d}`)}const o=new Set(Object.keys(t)),s=(d,m)=>{if(Ut(m)||st(m)||o.has(m))throw new Error(`[createLibrary] ${d} "${m}" collides with a built-in, component, function, or action of the same name. Rename it.`);o.add(m)},i={};for(const d of e.functions??[])s("Function",d.name),i[d.name]=d;const a={};for(const d of e.actions??[])s("Action",d.name),a[d.name]=d,n.add(d.ref,{id:d.name});const u=()=>{const d=So(i,n),m=So(a,n);return{...d?{functions:d}:{},...m?{actions:m}:{}}},c={components:t,componentGroups:e.componentGroups,functions:i,actions:a,root:e.root,id:e.id,__libraryId:r,prompt(d){return mm({root:e.root,components:wo(t,n),componentGroups:e.componentGroups,...u(),...d})},toSpec(){return{root:e.root,components:wo(t,n),componentGroups:e.componentGroups,...u(),schema:f(),...e.id!==void 0?{id:e.id}:{}}},toJSONSchema(){return f()},extend(d){return hr(kp(e,d))}};function l(d){const{$schema:m,$defs:h,...y}=ao(d,{metadata:n});return y}function p(d){const m=Object.entries(d);if(m.length)return Object.fromEntries(m.map(([h,y])=>[h,{description:y.description,params:l(y.params),..."returns"in y&&y.returns?{returns:l(y.returns)}:{}}]))}function f(){const d=P(Object.fromEntries(Object.entries(t).map(([_,v])=>[_,v.props]))),m=ao(d,{metadata:n});for(const[_,v]of Object.entries(t)){const E=m.$defs?.[_];E&&v.description&&(E.description=v.description)}const h=p(i);h&&(m.functions=h);const y=p(a);return y&&(m.actions=y),m}return c}const bn="]]>openui:",gm=/^\]\]>openui:([a-z]+)(?:\?(.*))?$/,ym=/([^\n])(?=\]\]>openui:content(?:\?|\r?\n|$))/g,bm=/[^\n](\]\]>[a-z:]*)$/,$o=e=>{try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}};function vm(e=""){const t={};for(const n of e.split("&")){const r=n.indexOf("="),o=$o(r===-1?n:n.slice(0,r));o&&(t[o]=r===-1?"":$o(n.slice(r+1)))}return t}function _m(e,{streaming:t}={}){let n=e.replace(ym,`$1
|
|
257
|
+
`);const r=t?bm.exec(n):null;r&&`${bn}content`.startsWith(r[1])&&(n=n.slice(0,r.index+1));const o=n.split(`
|
|
258
|
+
`),s=o[o.length-1],i=t&&s!==""&&(s.startsWith(bn)||bn.startsWith(s));i&&o.pop();const a=[{kind:null,attributes:{},lines:[]}],u=()=>{const y=a[a.length-1].lines;y.length&&(y[y.length-1]=y[y.length-1].replace(/\r$/,""))};let c=-1;for(const[y,_]of o.entries()){const v=gm.exec(_.replace(/\r$/,""));if(!v){a[a.length-1].lines.push(_);continue}if(u(),v[1]==="end"){if(c=a.length-1,y===o.length-2&&o[y+1]==="")break;continue}a.push({kind:v[1],attributes:vm(v[2]),lines:[]})}i&&u();const l=a.map(y=>y.kind),p=Math.max(0,l.lastIndexOf("content")),f=l.lastIndexOf("context");let d=f>p?a[f].lines.join(`
|
|
259
|
+
`):null;try{typeof d=="string"&&(d=JSON.parse(d))}catch{}const m=a[p],h=c>=p;return{content:m.lines.join(`
|
|
260
|
+
`),context:d,attributes:m.attributes,end:h}}function ge(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return t.type==="element"&&typeof t.typeName=="string"&&typeof t.props=="object"&&t.props!==null&&typeof t.partial=="boolean"}let ht=(function(e){return e.ContinueConversation="continue_conversation",e.OpenUrl="open_url",e})({});function wm(e){switch(e.k){case"StateRef":case"RuntimeRef":case"BinOp":case"UnaryOp":case"Ternary":case"Member":case"Index":case"Assign":return!0;default:return!1}}const Sm=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function Ae(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Sm.has(e.k)}function gr(e,t){const n=r=>{switch(t(r),r.k){case"Comp":r.args.forEach(n),Object.values(r.mappedProps??{}).forEach(n);break;case"Arr":r.els.forEach(n);break;case"Obj":r.entries.forEach(([,o])=>n(o));break;case"BinOp":n(r.left),n(r.right);break;case"UnaryOp":n(r.operand);break;case"Ternary":n(r.cond),n(r.then),n(r.else);break;case"Member":n(r.obj);break;case"Index":n(r.obj),n(r.index);break;case"Assign":n(r.value);break}};n(e)}function Bt(e){return e==null?{k:"Null"}:typeof e=="string"?{k:"Str",v:e}:typeof e=="number"?{k:"Num",v:e}:typeof e=="boolean"?{k:"Bool",v:e}:Array.isArray(e)?{k:"Arr",els:e.map(Bt)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,Bt(n)])}:{k:"Null"}}function Cn(e){switch(e.k){case"Str":case"Num":case"Bool":return{v:e.v};case"Null":return{v:null};case"Arr":{const t=[];for(const n of e.els){const r=Cn(n);if(!r)return;t.push(r.v)}return{v:t}}case"Obj":{const t={};for(const[n,r]of e.entries){const o=Cn(r);if(!o)return;t[n]=o.v}return{v:t}}default:return}}const km=1,Oo=2,jo=3,vn=4,Ge=5,_n=6,gt=7,xo=8,$m=9;function Zn(e){let t=0;const n=()=>e[t]??{t:13},r=()=>{const f=n();return t++,f},o=f=>{n().t===f&&t++};function s(f){switch(f.t){case 34:return km;case 32:return Oo;case 31:return jo;case 25:case 26:return vn;case 27:case 28:case 29:case 30:return Ge;case 20:case 21:return _n;case 22:case 23:case 24:return gt;case 19:case 3:return $m;default:return 0}}function i(f=0){let d=a();for(;s(n())>f;)d=u(d);return d}function a(){const f=n();if(f.t===14)return r(),{k:"Str",v:f.v};if(f.t===15)return r(),{k:"Num",v:f.v};if(f.t===10)return r(),{k:"Bool",v:!0};if(f.t===11)return r(),{k:"Bool",v:!1};if(f.t===12)return r(),{k:"Null"};if(f.t===3)return l();if(f.t===5)return p();if(f.t===18){const d=f.v;return r(),n().t===9?(r(),{k:"Assign",target:d,value:i(0)}):{k:"StateRef",n:d}}if(f.t===17){const d=f.v;return e[t+1]?.t===1&&(!Ut(d)||d==="Action")?c():(r(),{k:"Ref",n:d})}if(f.t===35){if(e[t+1]?.t===1){const d=c();return d.k==="Comp"&&!Ut(d.name)&&(d.fn=!0),d}return r(),{k:"Ref",n:f.v}}if(f.t===16)return r(),{k:"Ref",n:f.v};if(f.t===33)return r(),{k:"UnaryOp",op:"!",operand:i(xo)};if(f.t===21)return r(),{k:"UnaryOp",op:"-",operand:i(xo)};if(f.t===1){r();const d=i(0);return o(2),d}return r(),{k:"Null"}}function u(f){const d=n();if(d.t===20)return r(),{k:"BinOp",op:"+",left:f,right:i(_n)};if(d.t===21)return r(),{k:"BinOp",op:"-",left:f,right:i(_n)};if(d.t===22)return r(),{k:"BinOp",op:"*",left:f,right:i(gt)};if(d.t===23)return r(),{k:"BinOp",op:"/",left:f,right:i(gt)};if(d.t===24)return r(),{k:"BinOp",op:"%",left:f,right:i(gt)};if(d.t===25)return r(),{k:"BinOp",op:"==",left:f,right:i(vn)};if(d.t===26)return r(),{k:"BinOp",op:"!=",left:f,right:i(vn)};if(d.t===27)return r(),{k:"BinOp",op:">",left:f,right:i(Ge)};if(d.t===28)return r(),{k:"BinOp",op:"<",left:f,right:i(Ge)};if(d.t===29)return r(),{k:"BinOp",op:">=",left:f,right:i(Ge)};if(d.t===30)return r(),{k:"BinOp",op:"<=",left:f,right:i(Ge)};if(d.t===31)return r(),{k:"BinOp",op:"&&",left:f,right:i(jo)};if(d.t===32)return r(),{k:"BinOp",op:"||",left:f,right:i(Oo)};if(d.t===34){r();const m=i(0);return o(8),{k:"Ternary",cond:f,then:m,else:i(0)}}if(d.t===19){r();const m=n();return{k:"Member",obj:f,field:m.t===16||m.t===17||m.t===14||m.t===15?(r(),String(m.v)):m.t===18?(r(),m.v.replace(/^\$/,"")):(r(),"?")}}if(d.t===3){r();const m=i(0);return o(4),{k:"Index",obj:f,index:m}}return f}function c(){const f=n().v;r(),o(1);const d=[];for(;n().t!==2&&n().t!==13;)d.push(i(0)),n().t===7&&r();return o(2),{k:"Comp",name:f,args:d}}function l(){r();const f=[];for(;n().t!==4&&n().t!==13;)f.push(i(0)),n().t===7&&r();return o(4),{k:"Arr",els:f}}function p(){r();const f=[];for(;n().t!==6&&n().t!==13;){const d=n(),m=d.t===16||d.t===14||d.t===17||d.t===15?(r(),String(d.v)):d.t===18?(r(),d.v.replace(/^\$/,"")):(r(),"?");o(8),f.push([m,i(0)]),n().t===7&&r()}return o(6),{k:"Obj",entries:f}}return i(0)}function Mn(e){const t=[];let n=0;const r=e.length;for(;n<r;){for(;n<r&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=r)break;const o=e[n];if(o===`
|
|
261
|
+
`){t.push({t:0}),n++;continue}if(o==="("){t.push({t:1}),n++;continue}if(o===")"){t.push({t:2}),n++;continue}if(o==="["){t.push({t:3}),n++;continue}if(o==="]"){t.push({t:4}),n++;continue}if(o==="{"){t.push({t:5}),n++;continue}if(o==="}"){t.push({t:6}),n++;continue}if(o===","){t.push({t:7}),n++;continue}if(o===":"){t.push({t:8}),n++;continue}if(o==="="){n+1<r&&e[n+1]==="="?(t.push({t:25}),n+=2):(t.push({t:9}),n++);continue}if(o==="!"){n+1<r&&e[n+1]==="="?(t.push({t:26}),n+=2):(t.push({t:33}),n++);continue}if(o===">"){n+1<r&&e[n+1]==="="?(t.push({t:29}),n+=2):(t.push({t:27}),n++);continue}if(o==="<"){n+1<r&&e[n+1]==="="?(t.push({t:30}),n+=2):(t.push({t:28}),n++);continue}if(o==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:31}),n+=2):(t.push({t:31}),n++);continue}if(o==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:32}),n+=2):(t.push({t:32}),n++);continue}if(o==="."){t.push({t:19}),n++;continue}if(o==="?"){t.push({t:34}),n++;continue}if(o==="+"){t.push({t:20}),n++;continue}if(o==="*"){t.push({t:22}),n++;continue}if(o==="/"){t.push({t:23}),n++;continue}if(o==="%"){t.push({t:24}),n++;continue}if(o==='"'){const a=n;n++;let u=!1;for(;n<r;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,u=!0;break}else n++;const c=e.slice(a,n);try{const l=u?c:c+'"';t.push({t:14,v:JSON.parse(l)})}catch{const l=c.replace(/^"|"$/g,"");t.push({t:14,v:l})}continue}if(o==="'"){n++;let a="";for(;n<r;)if(e[n]==="\\"){if(n++,n<r){const u=e[n];u==="'"?a+="'":u==="\\"?a+="\\":u==="n"?a+=`
|
|
262
|
+
`:u==="t"?a+=" ":a+=u,n++}}else if(e[n]==="'"){n++;break}else a+=e[n],n++;t.push({t:14,v:a});continue}if(o==="-"){const a=t.length>0?t[t.length-1]:null;if(!(!(a!=null&&(a.t===15||a.t===14||a.t===16||a.t===17||a.t===2||a.t===4||a.t===10||a.t===11||a.t===12||a.t===18||a.t===35))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:21}),n++;continue}}const s=o>="0"&&o<="9",i=o==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(s||i){const a=n;for(e[n]==="-"&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&e[n]==="."&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&(e[n]==="e"||e[n]==="E"))for(n++,n<r&&(e[n]==="+"||e[n]==="-")&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:15,v:+e.slice(a,n)});continue}if(o==="$"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){const a=n;for(n++;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:18,v:e.slice(a,n)});continue}if(o>="a"&&o<="z"||o>="A"&&o<="Z"||o==="_"){const a=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;const u=e.slice(a,n);if(u==="true"){t.push({t:10});continue}if(u==="false"){t.push({t:11});continue}if(u==="null"){t.push({t:12});continue}const c=o>="A"&&o<="Z"?17:16;t.push({t:c,v:u});continue}if(o==="@"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){n++;const a=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:35,v:e.slice(a,n)});continue}n++}return t.push({t:13}),t}const Om=["string","number","boolean"],jm={},xm=[];function yr(e){return Array.isArray(e)?"array":typeof e}function ki(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function $i(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function Oi(e){if(Array.isArray(e.enum))return{enumValues:e.enum};if("const"in e)return{enumValues:[e.const]};switch(e.type){case"string":return{expectedType:"string"};case"number":case"integer":return{expectedType:"number"};case"boolean":return{expectedType:"boolean"};default:return{}}}function qt(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function Am(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=ki(t);if(n)return n;const r=Oi(t);return r.enumValues?r.enumValues.map(o=>JSON.stringify(o)).join("|"):r.expectedType?r.expectedType:typeof t.type=="string"?t.type:void 0}function ji(e,t){return`${e}(${t.map(n=>{const r=Am(n.schema),o=n.required?`${n.name}*`:n.name;return r?`${o}: ${r}`:o}).join(", ")})`}function Em(e,t){const n=typeof e;return t.enumValues?!Om.includes(n)||t.enumValues.includes(e)?null:{expected:`one of [${t.enumValues.map(r=>JSON.stringify(r)).join(", ")}]`,actual:JSON.stringify(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:yr(e)}:null}function zm(e,t,n){switch(n.code){case"type-mismatch":return`field "${t}" expects ${n.expected} but got ${n.actual}`;case"missing-required":return`missing required field "${t}"${n.signature?` — signature: ${n.signature}`:""}`;case"null-required":return`required field "${t}" cannot be null${n.signature?` — signature: ${n.signature}`:""}`;case"unknown-component":return`Unknown component "${e}" — not found in catalog or builtins${n.available?.length?`. Available components: ${n.available.join(", ")}`:""}`;case"inline-reserved":return`${e}() must be declared as a top-level statement, not used inline as a value`;case"excess-args":return`${e} takes ${n.declared} arg(s), got ${n.got} (${n.got-n.declared} excess dropped)`;case"unknown-function":return`Unknown function "@${e}": not a built-in or action step. The call evaluates to null`;case"no-root":return n.reason==="not-component"?"root does not evaluate to a component":n.reason==="fallback"?`No root statement. Rendering the first statement that calls the root component ${e}`:e?`No root statement, and no statement calls the root component ${e}`:"No root statement"}}function H(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:zm(t,n,r),statementId:e.currentStatementId,...r.code==="no-root"&&r.reason==="fallback"&&{severity:"warning"}})}const Y=Symbol("invalid");function br(e,t){return t!==void 0?t:e?Y:void 0}function Im(e,t,n,r,o){return $i(t)?!1:typeof t.type=="string"||Array.isArray(t.enum)||"const"in t?(H(o,n,r,{code:"type-mismatch",expected:typeof t.type=="string"?t.type:"a literal value",actual:`component "${e.typeName}"`}),!0):!1}function xi(e){return(e.anyOf??e.oneOf??[e]).map(ki)}function Tm(e,t){const n=xi(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function Rm(e,t,n,r,o){if(typeof e!="object"||Array.isArray(e))return H(o,n,r,{code:"type-mismatch",expected:"object",actual:yr(e)}),Y;const s=e;let i;const a=t.properties&&typeof t.properties=="object"?t.properties:jm,u=Array.isArray(t.required)?t.required:xm;let c=!1;if(!o.partial)for(const l of u){const p=l in s;if(!p||s[l]==null){const f=qt(a[l]);if(f!==void 0){(i??={...s})[l]=f;continue}H(o,n,`${r}/${l}`,{code:p?"null-required":"missing-required"}),c=!0}}for(const l of Object.keys(a)){if(!(l in s))continue;const p=a[l];let f=it(s[l],p,n,`${r}/${l}`,o);if(f===Y&&(f=br(u.includes(l),qt(p)),f===Y)){c=!0;continue}f!==s[l]&&(i??={...s},f===void 0?delete i[l]:i[l]=f)}return c?Y:i??s}function Nm(e,t,n,r,o){if(!Array.isArray(e))return H(o,n,r,{code:"type-mismatch",expected:"array",actual:yr(e)}),Y;const s=t.items;if(!s||typeof s!="object"||Array.isArray(s))return e;let i;for(let a=0;a<e.length;a++){const u=it(e[a],s,n,`${r}/${a}`,o);u!==e[a]&&!i&&(i=e.slice(0,a)),i&&u!==Y&&i.push(u)}return i??e}function Pm(e,t,n,r,o){const s=Oi(t);if(s.expectedType==null&&s.enumValues==null||s.enumValues&&o.partial)return!1;const i=Em(e,s);return i?(H(o,n,r,{code:"type-mismatch",...i}),!0):!1}function it(e,t,n,r,o){if(!t||typeof t!="object"||Array.isArray(t))return e;const s=t;if(e==null||Ae(e))return e;if(ge(e))return Im(e,s,n,r,o)?Y:e;if($i(s))return Tm(s,o)?(H(o,n,r,{code:"type-mismatch",expected:xi(s).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),Y):e;const i=s.type;return i==="object"?Rm(e,s,n,r,o):i==="array"?Nm(e,s,n,r,o):Pm(e,s,n,r,o)?Y:e}function St(e){if(e==null||typeof e!="object")return!1;if(Ae(e))return!0;if(Array.isArray(e))return e.some(St);if(ge(e))return Object.values(e.props).some(St);const t=e;return Array.isArray(t.steps)?!0:Object.values(t).some(St)}function Ai(e,t,n){if(t.visited.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;if(!t.syms.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;const r=t.syms.get(e);if(t.unreached?.delete(e),r.k==="Comp"&&st(r.name))return{k:"RuntimeRef",n:e,refType:r.name===Me.Mutation?"mutation":"query"};t.visited.add(e);const o=t.currentStatementId;t.currentStatementId=e;try{const s=n==="value"?Fe(r,t):Dn(r,t);return n==="value"&&ge(s)&&(s.statementId=e),s}finally{t.currentStatementId=o,t.visited.delete(e)}}function Jt(e,t){return Xt(t.cat).has(e)||st(e)}function tn(e,t){const n={};for(let r=0;r<t.length&&r<e.length;r++)n[t[r].name]=e[r];return n}function Ei(e,t,n,r){const{params:o}=n;t.length>o.length&&H(r,e,"",{code:"excess-args",declared:o.length,got:t.length});const s=tn(t,o);let i=!1;const a=r.errors.length;for(const u of o){const c=s[u.name],l=c?Cn(c):{v:void 0};if(!l)continue;if(l.v==null){if(!u.required||u.defaultValue!==void 0)continue;H(r,e,`/${u.name}`,{code:c?"null-required":"missing-required",signature:ji(e,o)}),i=!0;continue}let p=it(l.v,u.schema,e,`/${u.name}`,r);p===Y&&(p=br(u.required,u.defaultValue)),p===Y?i=!0:p===void 0?delete s[u.name]:p!==l.v&&(s[u.name]=Bt(p))}return n.kind==="action"&&r.errors.length>a&&(i=!0),i?null:s}function zi(e,t,n){const r=e.args.map(n),o=Xt(t.cat).get(e.name);if(!o||o.lazy)return{...e,args:r};const s=o.builtin?tn(r,o.params):Ei(e.name,r,o,t);return s?{...e,args:r,mappedProps:s}:o.kind==="action"?{k:"Comp",name:"Action",args:[{k:"Arr",els:[]}]}:{k:"Null"}}function Ao(e,t,n){const r=t.currentStatementId;t.currentStatementId=n;const o=new Set;for(const s of e)gr(s,i=>{if(i.k!=="Comp"||o.has(i))return;o.add(i);const a=Xt(t.cat).get(i.name);!a||a.lazy||(i.mappedProps=(a.builtin?null:Ei(i.name,i.args,a,t))??tn(i.args,a.params))});t.currentStatementId=r}function Ii(e,t,n){const r=Xt(t.cat).get(e.name);if(r?.kind!=="function"||!r.lazy||e.args.length<3)return null;const o=e.args[1],s=o.k==="Ref"?o.n:o.k==="Str"?o.v:null;if(!s)return null;const i=new Set(n);i.add(s);const a=e.args.map((u,c)=>c===1?u:ee(u,t,i));return{...e,args:a}}function ee(e,t,n){switch(e.k){case"Ref":return n.has(e.n)?e:Ai(e.n,t,"expr");case"Ph":return e;case"Comp":{if(e.fn&&!Jt(e.name,t))return H(t,e.name,"",{code:"unknown-function"}),{k:"Null"};const r=Ii(e,t,n);if(r)return r;if(Jt(e.name,t))return zi(e,t,i=>ee(i,t,n));const o=e.args.map(i=>ee(i,t,n)),s=t.cat?.get(e.name);if(s){const i={};for(let a=0;a<s.params.length&&a<o.length;a++)i[s.params[a].name]=o[a];return{...e,args:o,mappedProps:i}}return H(t,e.name,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(r=>ee(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,ee(o,t,n)])};case"BinOp":return{...e,left:ee(e.left,t,n),right:ee(e.right,t,n)};case"UnaryOp":return{...e,operand:ee(e.operand,t,n)};case"Ternary":return{...e,cond:ee(e.cond,t,n),then:ee(e.then,t,n),else:ee(e.else,t,n)};case"Member":return{...e,obj:ee(e.obj,t,n)};case"Index":return{...e,obj:ee(e.obj,t,n),index:ee(e.index,t,n)};case"Assign":return{...e,value:ee(e.value,t,n)};default:return e}}function Dn(e,t){return ee(e,t,new Set)}function Fe(e,t){switch(e.k){case"Ref":return Ai(e.n,t,"value");case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"Arr":{const n=[];for(const r of e.els){if(r.k==="Ph")continue;const o=Fe(r,t);o===null&&(r.k==="Comp"||r.k==="Ref")||n.push(o)}return n}case"Obj":{const n={};for(const[r,o]of e.entries)n[r]=Fe(o,t);return n}case"Comp":{const{name:n,args:r}=e;if(e.fn&&!Jt(n,t))return H(t,n,"",{code:"unknown-function"}),null;if(st(n))return H(t,n,"",{code:"inline-reserved"}),null;if(Jt(n,t)){const a=Ii(e,t,new Set);return a||zi(e,t,u=>Dn(u,t))}const o=t.cat?.get(n),s={};if(o){let a=!1;for(let c=0;c<o.params.length&&c<r.length;c++){const l=o.params[c],p=Fe(r[c],t);if(s[l.name]=p,l.schema===void 0)continue;let f=it(p,l.schema,n,`/${l.name}`,t);f===Y&&(f=br(l.required,l.defaultValue),f===Y?a=!0:f===void 0&&delete s[l.name]),f!==Y&&f!==void 0&&(s[l.name]=f)}r.length>o.params.length&&H(t,n,"",{code:"excess-args",declared:o.params.length,got:r.length});const u=o.params.filter(c=>c.required&&(!(c.name in s)||s[c.name]===null));if(u.length){const c=u.filter(l=>l.defaultValue!==void 0?(s[l.name]=l.defaultValue,!1):!0);if(c.length){for(const l of c)H(t,n,`/${l.name}`,{code:l.name in s?"null-required":"missing-required",signature:ji(n,o.params)});return null}}if(a)return null}else return H(t,n,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),null;const i=Object.values(s).some(a=>St(a));return{type:"element",typeName:n,props:s,partial:t.partial,hasDynamicProps:i}}default:return wm(e)?Dn(e,t):e}}function Ti(e){const t=[];let n=!1,r=!1;for(let s=0;s<e.length;s++){const i=e[s];if(r){r=!1;continue}if(i==="\\"&&n){r=!0;continue}if(n){i===n&&(n=!1);continue}if(i==='"'||i==="'"){n=i;continue}i==="("||i==="["||i==="{"?t.push(i):(i===")"&&t[t.length-1]==="("||i==="]"&&t[t.length-1]==="["||i==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(n||t.length>0))return{text:e,wasIncomplete:!1};let o=e;n&&(r&&(o+="\\"),o+=n);for(let s=t.length-1;s>=0;s--)o+=t[s]==="("?")":t[s]==="["?"]":"}";return{text:o,wasIncomplete:!0}}function Un(e){const t=[];let n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===0;)n++;if(n>=e.length||e[n].t===13)break;const r=e[n];if(r.t!==16&&r.t!==17&&r.t!==18){for(;n<e.length&&e[n].t!==0&&e[n].t!==13;)n++;continue}const o=r.v,s=r.t;if(n++,n>=e.length||e[n].t!==9){for(;n<e.length&&e[n].t!==0&&e[n].t!==13;)n++;continue}n++;const i=[];let a=0,u=0;for(;n<e.length&&e[n].t!==13;){const c=e[n].t;if(c===0&&a<=0&&u<=0){let l=n+1;for(;l<e.length&&e[l].t===0;)l++;const p=l<e.length?e[l].t:13;if(p===34||p===8&&u>0){n++;continue}break}if(c===0){n++;continue}c===1||c===3||c===5?a++:(c===2||c===4||c===6)&&a>0?a--:c===34&&a===0?u++:c===8&&a===0&&u>0&&u--,i.push(e[n++])}i.length&&t.push({id:o,idTokenType:s,tokens:i})}return t}function Vt(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function Ri(e){if(!Ae(e))return[];const t=new Set;return gr(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function Fn(e,t){if(t.k==="Comp"&&t.name===Me.Query){const n=Ri(t.args[1]);return{kind:"query",id:e.id,call:{callee:Me.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===Me.Mutation?{kind:"mutation",id:e.id,call:{callee:Me.Mutation,args:t.args},expr:t}:e.idTokenType===18?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function Cm(e,t,n){const r={},o=[],s=[];for(const i of e)switch(i.kind){case"state":r[i.id]=Fe(i.init,t);break;case"query":Ao(i.call.args,t,i.id),o.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null,defaultsAST:i.call.args[2]??null,refreshAST:i.call.args[3]??null,deps:i.deps,complete:!0});break;case"mutation":Ao(i.call.args,t,i.id),s.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null});break}for(const i of e){const a=i.kind==="state"?[i.init]:i.kind==="value"?[i.expr]:i.kind==="query"||i.kind==="mutation"?i.call.args:[];for(const u of a)for(const c of Ri(u))c===n?.name&&n.stmts.has(i)||c in r||(r[c]=null)}return{stateDeclarations:r,queryStatements:o,mutationStatements:s}}const Eo="root";function vr(e){return e?.k==="Comp"&&!e.fn&&!Ut(e.name)&&!st(e.name)}function Zm(e,t){if(e.has(Eo))return{id:Eo,fallback:!1};for(const n of e.values())if(n.kind==="value"&&vr(n.expr)&&n.expr.name===t)return{id:n.id,fallback:!0};return null}function Mm(e,t){const n=new Set;for(;e?.k==="Ref"&&!n.has(e.n);)n.add(e.n),e=t.get(e.n);return vr(e)}function Dm(e){let t=!1;return gr(e,n=>{vr(n)&&(t=!0)}),t}function kt(e,t,n,r,o,s,i){const a=Zm(e,s),u=new Map;for(const[O,k]of e)u.set(O,k.kind==="state"?k.init:k.expr);const c=[],l=[],p=new Set;for(const[O,k]of e)O!==a?.id&&(k.kind==="state"||k.kind==="query"||k.kind==="mutation"||p.add(O));const f={syms:u,cat:o,errors:l,unres:c,visited:new Set,partial:n,currentStatementId:a?.id,unreached:p};let d=null,m;if(a){const O=Fe(u.get(a.id),f);ge(O)?(d=O,d.statementId=a.id):Ae(O)&&Dm(O)&&(m=O)}const{stateDeclarations:h,queryStatements:y,mutationStatements:_}=Cm(t,f,i);f.currentStatementId=a?.id;const v=s??"";a?!d&&!m&&!Mm(u.get(a.id),u)?H(f,v,"",{code:"no-root",reason:"not-component"}):a.fallback&&H(f,v,"",{code:"no-root",reason:d?"fallback":"missing"}):H(f,v,"",{code:"no-root",reason:"missing"});const E=a?[...p]:[];return{root:d,...m?{rootExpression:m}:{},meta:{incomplete:n,unresolved:c,orphaned:E,statementCount:r,errors:l},stateDeclarations:h,queryStatements:y,mutationStatements:_}}function zo(e,t){if(e[t]!=='"')return t;let n=t+1;for(;n<e.length;){const r=e[n];if(r==="\\")n+=2;else{if(r==='"')return n+1;n++}}return n}function Um(e){const t=[];let n=0;for(;n<e.length;){let r=-1;for(;n<e.length;){const a=zo(e,n);if(a>n){n=a;continue}if(e[n]==="`"&&n+1<e.length&&e[n+1]==="`"&&n+2<e.length&&e[n+2]==="`"){r=n;break}n++}if(r===-1)break;let o=r+3;for(;o<e.length&&e[o]!==`
|
|
263
|
+
`;)o++;if(o>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}o++;let s=-1,i=o;for(;i<e.length;){const a=zo(e,i);if(a>i){i=a;continue}if(e[i]==="`"&&i+1<e.length&&e[i+1]==="`"&&i+2<e.length&&e[i+2]==="`"){s=i;break}i++}s!==-1?(t.push(e.slice(o,s)),n=s+3):(t.push(e.slice(o)),n=e.length)}if(t.length>0)return t.join(`
|
|
264
|
+
`);if(e.startsWith("```")){let r=3;for(;r<e.length&&e[r]!==`
|
|
265
|
+
`;)r++;const o=r<e.length?r+1:3,s=e.slice(o),i=s.lastIndexOf("```");return i!==-1?s.slice(0,i):s}return e}function Fm(e){let t=!1;return e.split(`
|
|
266
|
+
`).map(n=>{for(let r=0;r<n.length;r++){const o=n[r];if(t){if(o==="\\"&&r+1<n.length){r++;continue}o===t&&(t=!1);continue}if(o==='"'||o==="'"){t=o;continue}if(o==="/"&&n[r+1]==="/"||o==="#")return n.substring(0,r).trimEnd()}return n}).join(`
|
|
267
|
+
`)}function Ni(e){return Fm(Um(e.trim())).trim()}function Lm(e,t,n){const r=Ni(e);if(!r)return Vt();const{text:o,wasIncomplete:s}=Ti(r),i=Un(Mn(o));if(!i.length)return Vt(s);const a=new Map;for(const u of i){const c=Fn(u,Zn(u.tokens));a.set(u.id,c)}return kt(a,[...a.values()],s,a.size,t,n)}function Bm(e,t){let n="",r="",o=0;const s=new Map;let i=0;function a(f){const d=f.trim();if(d)for(const m of Un(Mn(d))){const h=Fn(m,Zn(m.tokens));s.set(m.id,h),i++}}function u(){const f=Ni(n);f.startsWith(r.slice(0,o))||(o=0,s.clear(),i=0),r=f}function c(){let f=0,d=0,m=!1,h=!1,y=o;for(let _=o;_<r.length;_++){const v=r[_];if(h){h=!1;continue}if(v==="\\"&&m){h=!0;continue}if(m){v===m&&(m=!1);continue}if(v==='"'||v==="'"){m=v;continue}if(v==="("||v==="["||v==="{")f++;else if(v===")"||v==="]"||v==="}")f=Math.max(0,f-1);else if(v==="?"&&f===0)d++;else if(v===":"&&f===0&&d>0)d--;else if(v===`
|
|
268
|
+
`&&f<=0&&d<=0){let E=_+1;for(;E<r.length&&(r[E]===" "||r[E]===" "||r[E]==="\r"||r[E]===`
|
|
269
|
+
`);)E++;if(E<r.length&&(r[E]==="?"||r[E]===":"&&d>0))continue;const O=r.slice(y,_).trim();O&&a(O),y=_+1,o=_+1}}return y}function l(f=!1){u();const d=c(),m=r.slice(d).trim();if(!m)return i===0?Vt():kt(s,[...s.values()],!1,i,e,t);const{text:h,wasIncomplete:y}=Ti(m),_=Un(Mn(h));if(!_.length)return i===0?Vt(y):kt(s,[...s.values()],y,i,e,t);const v=new Map(s),E=new Set;for(const $ of _){if(s.has($.id)&&y)continue;const C=Fn($,Zn($.tokens));v.set($.id,C),E.add(C)}const O=f?void 0:/\$\w+$/.exec(n)?.[0],k=O&&m.endsWith(O)&&!new RegExp(`\\${O}(?!\\w)`).test(m.slice(0,-O.length))?O:void 0;return kt(v,[...v.values()],y,i+_.length,e,t,k?{name:k,stmts:E}:void 0)}function p(){n="",r="",o=0,s.clear(),i=0}return{push(f,d){return n+=f,l(d)},set(f,d){(f.length<n.length||!f.startsWith(n))&&p();const m=f.slice(n.length);return m&&(n+=m),l(d)},getResult:l}}function Ln(e,t){if(!e||typeof e!="object")return e;const n=e.$ref;if(typeof n=="string")return t.has(n)?Ln(t.get(n),t):e;const r=Array.isArray(e)?[...e]:{...e};let o=!1;for(const[s,i]of Object.entries(r))r[s]=Ln(i,t),o||=r[s]!==i;return o?r:e}function wn(e,t){const n=e.properties??{},r=e.required??[];return Object.keys(n).map(o=>({name:o,required:r.includes(o),defaultValue:qt(n[o]),schema:t.size?Ln(n[o],t):n[o]}))}function Pi(e){const t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(const o of[...Object.keys(mi),...Object.keys(e.actions??{})]){const s=e.$defs?.[o];s&&!n?.has(o)&&r.set(`#/$defs/${o}`,s)}for(const[o,s]of Object.entries(e.$defs??{}))(n?!n.has(o):r.has(`#/$defs/${o}`))||t.set(o,{params:wn(s,r)});t.callDefs=new Map(ot);for(const[o,s]of Object.entries(e.functions??{}))t.callDefs.set(o,{kind:"function",params:wn(s.params,r)});for(const[o,s]of Object.entries(e.actions??{}))t.callDefs.set(o,{kind:"action",params:wn(s.params,r)});return t}function qm(e,t){const n=Pi(e);return{parse(r){const o=Yp();try{const s=Lm(r,n,t);return Gp(o,s),s}catch(s){throw Hp(o),s}}}}function Jm(e,t){return Bm(Pi(e),t)}function Vm(e,t){if(!t?.properties)return;const n=new Set(t.required??[]);return`Signature: ${e}(${Object.keys(t.properties).map(r=>n.has(r)?`${r}*`:r).join(", ")}) — * marks required`}function Km(e,t,n){return e.map(r=>{const o={source:"parser",code:r.code,message:r.message,component:r.component,path:r.path||void 0,statementId:r.statementId,...r.severity&&{severity:r.severity}};return r.code==="unknown-component"&&n.length?o.hint=`Available components: ${n.join(", ")}`:r.code==="missing-required"||r.code==="null-required"?o.hint=Vm(r.component,t.$defs?.[r.component]):r.code==="inline-reserved"&&(o.hint=`Declare as a top-level statement: myVar = ${r.component}(...)`),o})}function Ci(e){return typeof e=="object"&&e!==null&&e.__reactive==="assign"}function Z(e,t,n){switch(e.k){case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"StateRef":return t.extraScope?.[e.n]??t.getState(e.n);case"Ref":case"RuntimeRef":return t.resolveRef(e.n);case"Arr":return e.els.map(r=>Z(r,t));case"Obj":return Object.fromEntries(e.entries.map(([r,o])=>[r,Z(o,t)]));case"Comp":{const r=fi[e.name];if(r)return r.lazy?Xm(e.name,e.args,t,n):r.fn(_r(e,t));if(Tp(e.name))return Ym(e,t);const o=t.functions;if(o&&Object.prototype.hasOwnProperty.call(o,e.name))return Wm(e.name,o[e.name],e,t);const s=t.actions;if(s&&Object.prototype.hasOwnProperty.call(s,e.name)){const i=s[e.name],a=Mi(e,t,i.params);if(Di(a,i.params))return{steps:[]};const u=Bn(a,i.params,e.name,"",t,!0);if(u===Y)return{steps:[]};const c={type:"custom_action",name:e.name,params:u};return Ui.add(c),{steps:[c]}}if(e.mappedProps){const i=n?.library.components[e.name],a={};for(const[c,l]of Object.entries(e.mappedProps)){const p=i?.props?.shape?.[c];l.k==="StateRef"&&p&&Ue(p)?a[c]={__reactive:"assign",target:l.n,expr:{k:"StateRef",n:"$value"}}:l.k==="StateRef"?a[c]=n?t.getState(l.n):l:a[c]=Z(l,t,n)}const u={type:"element",typeName:e.name,props:a,partial:!1,hasDynamicProps:!0};if(n)for(const[c,l]of Object.entries(a))ge(l)?a[c]=Kt(l,t,n):Array.isArray(l)&&(a[c]=l.map(p=>ge(p)?Kt(p,t,n):p));return u}return console.warn(`[openui] Unexpected unmapped Comp node: ${e.name}`),null}case"BinOp":{if(e.op==="&&"){const s=Z(e.left,t);return s&&Z(e.right,t)}if(e.op==="||"){const s=Z(e.left,t);return s||Z(e.right,t)}const r=Z(e.left,t),o=Z(e.right,t);switch(e.op){case"+":return typeof r=="string"||typeof o=="string"?String(r??"")+String(o??""):R(r)+R(o);case"-":return R(r)-R(o);case"*":return R(r)*R(o);case"/":return R(o)===0?0:R(r)/R(o);case"%":return R(o)===0?0:R(r)%R(o);case"==":return r==o;case"!=":return r!=o;case">":return R(r)>R(o);case"<":return R(r)<R(o);case">=":return R(r)>=R(o);case"<=":return R(r)<=R(o);default:return null}}case"UnaryOp":return e.op==="!"?!Z(e.operand,t):e.op==="-"?-R(Z(e.operand,t)):null;case"Ternary":return Z(e.cond,t)?Z(e.then,t):Z(e.else,t);case"Member":{const r=Z(e.obj,t);return r==null?null:Array.isArray(r)?e.field==="length"?r.length:r.map(o=>o?.[e.field]??null):r[e.field]}case"Index":{const r=Z(e.obj,t),o=Z(e.index,t);return r==null||o==null?null:Array.isArray(r)?r[R(o)]:r[String(o)]}case"Assign":return{__reactive:"assign",target:e.target,expr:e.value}}}function Kt(e,t,n){if(e.hasDynamicProps===!1)return e;const r=n.library.components[e.typeName],o={};for(const[s,i]of Object.entries(e.props)){const a=r?.props?.shape?.[s];o[s]=Zi(i,t,n,a)}return{...e,props:o}}function Zi(e,t,n,r){return Li(e,t,n,r,{recurseElement:o=>Kt(o,t,n),recurse:(o,s)=>Zi(o,t,n,s)})}function _r(e,t,n=ot.get(e.name)?.params??[]){const r=e.mappedProps??tn(e.args,n),o={};for(const s in r)o[s]=Z(r[s],t);return o}function Mi(e,t,n){const r=_r(e,t,Object.keys(n.properties??{}).map(o=>({name:o,required:!1})));for(const o in r)r[o]===null&&!n.required?.includes(o)&&delete r[o];return r}function Bn(e,t,n,r,o,s=!1){const i={errors:[],partial:!1},a=it(e,t,n,r,i);for(const u of i.errors)o.reportError?.(`@${n}: ${u.message}`);return s&&i.errors.length>0?Y:a}function Di(e,t){return!!t.required?.some(n=>e[n]==null&&qt(t.properties?.[n])===void 0)}function Wm(e,t,n,r){const o=Mi(n,r,t.params);if(Di(o,t.params))return null;const s=Bn(o,t.params,e,"",r);if(s===Y)return null;let i;try{i=t.fn(s)}catch(u){return r.reportError?.(`@${e} threw: ${u instanceof Error?u.message:String(u)}`),null}if(!t.returns)return i;const a=Bn(i,t.returns,e,"/returns",r);return a===Y?null:a??null}function wr(e){return typeof e=="object"&&e!==null&&Array.isArray(e.steps)}function Qm(e){return Fi({steps:e.flatMap(t=>wr(t)?t.steps:t!=null&&typeof t=="object"&&"type"in t?[t]:[])})}const Ui=new WeakSet;function Fi(e){const t=n=>n?.type!=="custom_action"||Ui.has(n);return e.steps.every(t)?e:{...e,steps:e.steps.filter(t)}}function Ym(e,t){const{name:n,args:r}=e;if(n==="Action"){const i=r.length>0?Z(r[0],t):[];return Qm(Array.isArray(i)?i:[])}const o=gi[n],s=o.step?o.step(_r(e,t)):Gm(n,r);return{steps:s?[s]:[]}}function Gm(e,t){switch(e){case"Run":{const n=t[0];return n?.k!=="RuntimeRef"?null:{type:ve.Run,statementId:n.n,refType:n.refType}}case"Set":return t.length<2||t[0].k!=="StateRef"?null:{type:ve.Set,target:t[0].n,valueAST:t[1]};case"Reset":{const n=t.filter(r=>r.k==="StateRef").map(r=>r.n);return n.length===0?null:{type:ve.Reset,targets:n}}default:return null}}function ie(e,t,n){switch(e.k){case"Ref":return e.n===t?Bt(n):e;case"Member":if(Ae(e.obj)){const r=ie(e.obj,t,n);if(r.k==="Obj"){const o=r.entries.find(([s])=>s===e.field);if(o)return o[1]}return{...e,obj:r}}return e;case"Index":return{...e,obj:Ae(e.obj)?ie(e.obj,t,n):e.obj,index:Ae(e.index)?ie(e.index,t,n):e.index};case"BinOp":return{...e,left:ie(e.left,t,n),right:ie(e.right,t,n)};case"UnaryOp":return{...e,operand:ie(e.operand,t,n)};case"Ternary":return{...e,cond:ie(e.cond,t,n),then:ie(e.then,t,n),else:ie(e.else,t,n)};case"Arr":return{...e,els:e.els.map(r=>ie(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,ie(o,t,n)])};case"Comp":{const r=s=>ie(s,t,n),o={...e,args:e.args.map(r)};return e.mappedProps&&(o.mappedProps=Hm(e.mappedProps,r)),o}case"Assign":return{...e,value:ie(e.value,t,n)};default:return e}}function Hm(e,t){const n={};for(const r in e)n[r]=t(e[r]);return n}function Xm(e,t,n,r){if(e==="Each"){if(t.length<3)return[];const o=Z(t[0],n);if(!Array.isArray(o))return[];const s=t[1].k==="Ref"?t[1].n:t[1].k==="Str"?t[1].v:null;if(!s)return[];const i=t[2];return o.map((a,u)=>{const c=ie(i,s,a),l={...n,resolveRef:f=>f===s?a:n.resolveRef(f)},p=Z(c,l,r);return r&&ge(p)?Kt(p,l,r):p})}return null}function Li(e,t,n,r,o){const s=eh(e,t,n,r,o);return wr(s)?Fi(s):s}function eh(e,t,n,r,o){if(e==null||typeof e!="object")return e;if(Ae(e)){if(e.k==="StateRef"&&r&&Ue(r))return{__reactive:"assign",target:e.n,expr:{k:"StateRef",n:"$value"}};const a=Z(e,t,n);return ge(a)?o.recurseElement(a):Array.isArray(a)?a.map(u=>ge(u)?o.recurseElement(u):u):Ci(a)&&!(r&&Ue(r))?t.getState(a.target)??null:a}if(typeof e=="string"&&r&&Ue(r))return e;if(Array.isArray(e))return e.map(a=>o.recurse(a,r));if(ge(e))return o.recurseElement(e);if(wr(e))return e;const s=e;let i=!1;for(const a of Object.values(s))if(typeof a=="object"&&a!==null){i=!0;break}if(i){const a={};for(const[u,c]of Object.entries(s))a[u]=o.recurse(c,r);return a}return e}function qn(e,t){if(e.hasDynamicProps===!1)return e;const n={library:t.library},r=t.library.components[e.typeName],o={};let s="";const i=u=>{t.errors?.push({source:"runtime",code:"runtime-error",component:e.typeName,statementId:e.statementId,message:`Evaluating prop "${s}" on ${e.typeName} failed: ${u}`,hint:`Check the expression used for prop "${s}"`})},a=t.ctx.functions||t.ctx.actions?{...t,ctx:{...t.ctx,reportError:i}}:t;for(const[u,c]of Object.entries(e.props)){s=u;const l=r?.props?.shape?.[s];try{o[s]=Bi(c,a,n,l)}catch(p){o[s]=c,i(p instanceof Error?p.message:String(p))}}return{...e,props:o}}function th(e,t){if(e.root)return qn(e.root,t);if(!e.rootExpression)return null;const n=Z(e.rootExpression,t.ctx,{library:t.library});return ge(n)?qn(n,t):(t.errors?.push({source:"runtime",code:"no-root",statementId:"root",message:"root does not evaluate to a component"}),null)}function Bi(e,t,n,r){return Li(e,t.ctx,n,r,{recurseElement:o=>qn(o,t),recurse:(o,s)=>Bi(o,t,n,s)})}var Jn=class extends Error{toolErrorText;constructor(e){super(`MCP tool error: ${e||"Unknown error"}`),this.name="McpToolError",this.toolErrorText=e}};function nh(e){if(e.isError){const n=e.content?.filter(r=>r.type==="text").map(r=>r.text).join(`
|
|
270
|
+
`);throw new Jn(n||"Unknown error")}if(e.structuredContent!=null)return e.structuredContent;const t=e.content?.filter(n=>n.type==="text").map(n=>n.text??"");if(t?.length){const n=t.join("");try{return JSON.parse(n)}catch{return n}}return null}var Vn=class extends Error{toolName;availableTools;constructor(e,t=[]){super(`[openui] No handler for tool "${e}". Available: ${t.join(", ")||"(none)"}`),this.name="ToolNotFoundError",this.toolName=e,this.availableTools=t}};function Io(e){return JSON.stringify(e,(t,n)=>{if(n&&typeof n=="object"&&!Array.isArray(n)){const r={};for(const o of Object.keys(n).sort())r[o]=n[o];return r}if(n===void 0)return"__undefined__";if(typeof n=="number"){if(Number.isNaN(n))return"__NaN__";if(n===1/0)return"__Inf__";if(n===-1/0)return"__-Inf__"}return n})}function rh(e,t,n){const r=n!=null?"::"+Io(n):"";return e+"::"+Io(t)+r}function oh(e){const t=new Map,n=new Map,r=new Map,o=new Set;let s={__openui_loading:[],__openui_refetching:[],__openui_errors:[]},i=JSON.stringify(s),a=!1,u=0;function c(){const j={__openui_loading:[],__openui_refetching:[],__openui_errors:[]};for(const[z,S]of t){const x=r.get(S.cacheKey);if(x&&x.data!==void 0)j[z]=x.data;else if(S.prevCacheKey){const M=r.get(S.prevCacheKey);M&&M.data!==void 0?j[z]=M.data:j[z]=S.defaults}else j[z]=S.defaults;S.loading&&(j.__openui_loading.push(z),S.everFetched&&j.__openui_refetching.push(z)),S.error&&j.__openui_errors.push(S.error)}for(const[z,S]of n)j[z]=S.result,S.error&&j.__openui_errors.push(S.error);try{const z=JSON.stringify(j);if(z===i)return!1;s=j,i=z}catch{s=j,i=""}return!0}function l(){for(const j of[...o])j()}async function p(j,z){if(!e)return;const S=t.get(z);if(!S)return;const x=j,M=S.toolName,G=S.args;let U=r.get(x);U?U.inFlight=!0:(U={data:void 0,inFlight:!0},r.set(x,U)),S.loading=!0,c(),l();try{const F=await e.callTool(M,G??{});if(a)return;const L=t.get(z);if(!L||L.cacheKey!==x){U.inFlight=!1;return}if(U.data=F??null,L.everFetched=!0,L.error=void 0,L.prevCacheKey&&L.prevCacheKey!==x){const ut=L.prevCacheKey;L.prevCacheKey=void 0,f(ut)}}catch(F){const L=t.get(z);L&&L.cacheKey===x&&(F instanceof Vn?L.error={source:"query",code:"tool-not-found",message:`Query tool "${M}" not found`,statementId:z,component:"Query",toolName:M,hint:F.availableTools.length?`Available tools: ${F.availableTools.join(", ")}`:void 0}:F instanceof Jn?L.error={source:"query",code:"mcp-error",message:`Query "${M}" returned an error: ${F.toolErrorText}`,statementId:z,component:"Query",toolName:M}:L.error={source:"query",code:"tool-error",message:`Query "${M}" failed: ${F instanceof Error?F.message:String(F)}`,statementId:z,component:"Query",toolName:M}),console.error(`Query "${M}" failed:`,F)}finally{U.inFlight=!1;const F=t.get(z);F&&F.cacheKey===x?(F.loading=!1,c()&&l(),F.needsRefetch&&(F.needsRefetch=!1,p(F.cacheKey,z))):c()&&l()}}function f(j){for(const z of t.values())if(z.cacheKey===j||z.prevCacheKey===j)return;r.delete(j)}function d(j){if(a)return;const z=new Set(j.map(S=>S.statementId));for(const[S,x]of t)z.has(S)||(x.timer&&clearInterval(x.timer),t.delete(S),f(x.cacheKey),x.prevCacheKey&&f(x.prevCacheKey));for(const S of j){if(!S.complete)continue;const x=rh(S.toolName,S.args,S.deps),M=t.get(S.statementId);M?(M.cacheKey!==x&&(M.prevCacheKey=M.cacheKey),M.toolName=S.toolName,M.args=S.args,M.defaults=S.defaults,M.cacheKey=x):t.set(S.statementId,{toolName:S.toolName,args:S.args,defaults:S.defaults,cacheKey:x,loading:!1,everFetched:!1,refreshInterval:0,needsRefetch:!1});const G=t.get(S.statementId),U=r.get(x),F=U&&U.data!==void 0&&!U.inFlight;e&&!F&&!U?.inFlight&&p(x,S.statementId);const L=S.refreshInterval??0;L!==G.refreshInterval&&(G.timer&&(clearInterval(G.timer),G.timer=void 0),L>0&&(G.timer=setInterval(()=>{a||!e||r.get(G.cacheKey)?.inFlight||p(G.cacheKey,S.statementId)},L*1e3)),G.refreshInterval=L)}c()&&l()}function m(j){const z=t.get(j);if(!z)return null;const S=r.get(z.cacheKey);if(S&&S.data!==void 0)return S.data;if(z.prevCacheKey){const x=r.get(z.prevCacheKey);if(x&&x.data!==void 0)return x.data}return z.defaults}function h(j){return t.get(j)?.loading??!1}function y(){for(const j of t.values())if(j.loading)return!0;return!1}function _(j){if(a||!e)return;const z=j?.length?j.filter(S=>t.has(S)):[...t.keys()];for(const S of z){const x=t.get(S);x&&(r.get(x.cacheKey)?.inFlight?x.needsRefetch=!0:p(x.cacheKey,S))}}function v(j){const z=new Set(j.map(S=>S.statementId));for(const S of n.keys())z.has(S)||n.delete(S);for(const S of j){const x=n.get(S.statementId);x?x.toolName!==S.toolName&&(x.toolName=S.toolName,x.result={status:"idle",data:null,error:null},x.error=void 0):n.set(S.statementId,{toolName:S.toolName,result:{status:"idle"}})}c()&&l()}async function E(j,z,S){if(a||!e)return!1;const x=n.get(j);if(!x||x.result.status==="loading")return!1;const M=u;x.result={status:"loading"},c(),l();let G=!1;try{const U=await e.callTool(x.toolName,z);if(a||M!==u)return!1;x.result={status:"success",data:U},x.error=void 0,G=!0}catch(U){if(a||M!==u)return!1;const F=U instanceof Error?U.message:String(U);x.result={status:"error",error:F},U instanceof Vn?x.error={source:"mutation",code:"tool-not-found",message:`Mutation tool "${x.toolName}" not found`,statementId:j,component:"Mutation",toolName:x.toolName,hint:U.availableTools.length?`Available tools: ${U.availableTools.join(", ")}`:void 0}:U instanceof Jn?x.error={source:"mutation",code:"mcp-error",message:`Mutation "${x.toolName}" returned an error: ${U.toolErrorText}`,statementId:j,component:"Mutation",toolName:x.toolName}:x.error={source:"mutation",code:"tool-error",message:`Mutation "${x.toolName}" failed: ${F}`,statementId:j,component:"Mutation",toolName:x.toolName}}return c(),l(),G&&S?.length&&_(S),G}function O(j){return n.get(j)?.result??null}function k(j){return o.add(j),()=>o.delete(j)}function $(){return s}function C(){a=!1}function fe(){a=!0,u++,o.clear();for(const j of t.values())j.timer&&(clearInterval(j.timer),j.timer=void 0),j.refreshInterval=0,j.loading=!1,j.needsRefetch=!1;n.clear()}return{evaluateQueries:d,getResult:m,isLoading:h,isAnyLoading:y,invalidate:_,registerMutations:v,fireMutation:E,getMutationResult:O,subscribe:k,getSnapshot:$,activate:C,dispose:fe}}function sh(e,t,n,r,o,s){if(Ci(t)&&n&&r){const{target:i,expr:a}=t;return{name:e,value:n.get(i),setValue:u=>{const l=Z(a,{...r,extraScope:{$value:u}});n.set(i,l)},isReactive:!0}}return{name:e,value:o(e)??t,setValue:i=>s(e,i),isReactive:!1}}function ih(){const e=new Map,t=new Set,n=new Set;let r={};function o(){const f=[...n];for(const d of f)d()}function s(){r=Object.fromEntries(e)}function i(f){return e.get(f)}function a(f,d,m){m?.pristine?t.add(f):t.delete(f);const h=e.get(f);if(!Object.is(h,d)){if(d&&h&&typeof d=="object"&&typeof h=="object"&&!Array.isArray(d)&&!Array.isArray(h)){const y=Object.keys(d),_=Object.keys(h);if(y.length===_.length&&y.every(v=>Object.is(d[v],h[v])))return}e.set(f,d),s(),o()}}function u(f){return n.add(f),()=>{n.delete(f)}}function c(){return r}function l(f,d){let m=!1;for(const h of Object.keys(d))t.delete(h),(!e.has(h)||!Object.is(e.get(h),d[h]))&&(e.set(h,d[h]),m=!0);for(const h of Object.keys(f))e.has(h)?t.has(h)&&!Object.is(e.get(h),f[h])&&(e.set(h,f[h]),m=!0):(e.set(h,f[h]),t.add(h),m=!0);m&&(s(),o())}function p(){e.clear(),t.clear(),n.clear(),r={}}return{get:i,set:a,subscribe:u,getSnapshot:c,initialize:l,dispose:p}}const To="all";function ah(){const e=new Map,t=(s,i)=>{try{s(i)}catch(a){console.error("[@openuidev/observability] listener threw",a)}},n=(s,i)=>{let a=e.get(s);return a||(a=new Set,e.set(s,a)),a.add(i),()=>{a.delete(i)}},r=(s,i)=>{const a={level:s,timestamp:Date.now(),detail:i},u=new Set;e.get(s)?.forEach(c=>u.add(c)),e.get(To)?.forEach(c=>u.add(c)),u.forEach(c=>t(c,a))},o=r;return o.listen=(s,i)=>{const a=(Array.isArray(s)?s:[s]).map(u=>n(u,i));return()=>a.forEach(u=>u())},o.listenAll=s=>n(To,s),o.info=s=>r("info",s),o.warn=s=>r("warning",s),o.error=s=>r("error",s),o}const uh=Symbol.for("openui.observability"),ch=globalThis,Ro=ch[uh]??=ah();function lh(e){return e.id??e.root??Object.keys(e.components).sort().join(",")}function fh(e){return qi(hr(e))}let dh=0;function qi(e,t=lh(e)){const n=e.extend;return Object.assign(e,{extend:(r=>qi(n(r),`${t}:extend-${++dh}`))})}const Ji=w.createContext(null);function nn(){const e=w.useContext(Ji);if(!e)throw new Error("useOpenUI must be used within a <Renderer /> component.");return e}function ph(){return nn().renderNode}function mh(){return nn().triggerAction}const Vi=w.createContext(void 0);function Ki(){return w.useContext(Vi)}const hh="]]>openui:scripts",gh=/^\]\]>openui:content(?:\?.*)?\r?$(\n?)/m,yh=/^\]\]>openui:scripts(?=\?|\r?$)/gm;function No(e){let t="",n=!1;for(let r=0;r<e.length;r++){const o=e[r];if(t)n?n=!1:o==="\\"?n=!0:o===t&&(t="");else if(o==="#"||o==="/"&&e[r+1]==="/"){const s=e.indexOf(`
|
|
271
|
+
`,r);if(s<0)return-1;r=s}else if(o==='"'||o==="'")t=o;else if(e.startsWith("]]>",r))return r}return-1}function bh(e,t){try{const{count:n}=JSON.parse(e),r=JSON.parse(t);if(!Array.isArray(r)||!Number.isSafeInteger(n)||n!==r.length)return null;const o=new Set;for(const s of r){if(!s||typeof s.name!="string"||!s.name||typeof s.code!="string"||o.has(s.name))return null;o.add(s.name)}return{names:o,revision:JSON.stringify(r.map(s=>({name:s.name,code:s.code})).sort((s,i)=>s.name.localeCompare(i.name)))}}catch{return null}}function Wi(e,t){const n=e??"",r=gh.exec(n),o=!!r&&(!t||r[1]===`
|
|
272
|
+
`),{content:s,attributes:i,end:a}=_m(n.replace(yh,"$& "),{streaming:t});let u=s,c=!1,l=null;const p=No(u);if(p>=0&&u.startsWith(hh,p)){c=!0;const m=u.indexOf(`
|
|
273
|
+
`,p);let h=u.length;if(m>=0){const v=No(u.slice(m+1));v>=0&&(h=m+1+v),l=bh(u.slice(p+17,m),u.slice(m+1,h))}const y=p>0?u.slice(0,p).replace(/\r?\n$/,""):"",_=u.slice(h);u=_?`${y}
|
|
274
|
+
${_}`:y}const f={};if(!o&&!c&&!a)return{program:u,metadata:f,scripts:new Set,complete:!0,isBundle:!1,error:void 0};o&&i.name!==void 0&&(f.name=i.name);const d=c&&!l?"Invalid scripts bundle":void 0;return{program:u,metadata:f,scripts:l?.names??new Set,complete:!d&&(a||!t||!o),isBundle:!0,error:t?void 0:d,...l?.names.size?{scriptRevision:l.revision}:{}}}function vh({response:e,isStreaming:t,result:n,evaluatedResult:r,library:o,querySnapshot:s,parseExceptionRef:i,runtimeErrorsRef:a,renderErrorsRef:u,onError:c}){const l=w.useRef([]),[p,f]=w.useState(0),d=w.useRef(""),m=w.useRef(c);return m.current=c,w.useEffect(()=>{if(t){l.current=[],d.current!==""&&(d.current="",m.current?.([]));return}const h=[];i.current&&h.push(i.current),e&&!n?.meta.statementCount&&!i.current&&h.push({source:"parser",code:"parse-failed",message:"Response could not be parsed as valid openui-lang",hint:`The entire response must be valid openui-lang code starting with root = ${o.root??"Root"}(...)`}),n?.meta.errors.length&&h.push(...Km(n.meta.errors,o.toJSONSchema(),Object.keys(o.components))),h.push(...a.current),h.push(...u.current),u.current=[],h.push(...s.__openui_errors??[]),l.current=h;const y=JSON.stringify(h);if(y!==d.current){if(d.current=y,f(_=>_+1),m.current)m.current(h);else if(h.length>0)for(const _ of h)console.warn(`[openui] ${_.source}/${_.code}: ${_.message}`)}},[t,e,n,r,s,o,i,a,u]),{errorsRef:l,errorRevision:p}}const Po="react-lang:stream",_h="streaming",Qi="settled";let Co=0;function wh(){return typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID():(Co+=1,`openui-lang-${Date.now().toString(36)}-${Co.toString(36)}`)}function Yi(){return{id:null,updateIndex:0,lastResponse:null,hasPublishedStreamingSnapshot:!1,settled:!1,lastSettledErrorKey:null,startedAt:null,durationMs:null}}function Zo(e,t=Date.now()){e.startedAt??=t,e.settled&&(e.durationMs??=Math.max(0,t-e.startedAt));const n=e.durationMs??Math.max(0,t-e.startedAt);return{startedAt:e.startedAt,elapsedMs:n,...e.durationMs!=null?{durationMs:e.durationMs}:{}}}function Sh(e,t,n,r=null,o=wh){return t?(e.settled&&Object.assign(e,Yi()),e.id??=o(),e.hasPublishedStreamingSnapshot&&e.lastResponse===n?null:(e.hasPublishedStreamingSnapshot=!0,e.lastResponse=n,e.updateIndex+=1,{id:e.id,phase:_h,updateIndex:e.updateIndex})):!e.id||e.settled&&(r===null||e.lastSettledErrorKey===r)?null:(e.updateIndex+=1,e.settled=!0,e.lastSettledErrorKey=r,{id:e.id,phase:Qi,updateIndex:e.updateIndex})}function Mo(e){if(e)return{incomplete:e.meta.incomplete,unresolved:e.meta.unresolved,orphaned:e.meta.orphaned,statementCount:e.meta.statementCount}}function kh({response:e,isStreaming:t,result:n,errorsRef:r,errorRevision:o,publish:s=!0,__libraryId:i}){const a=w.useRef(Yi());w.useEffect(()=>{if(!s)return;const u=r.current,c=t?null:JSON.stringify(u),l=Sh(a.current,t,e,c),p=i!==void 0?{__libraryId:i}:{};if(t){l&&Ro.info({id:l.id,kind:Po,phase:l.phase,updateIndex:l.updateIndex,response:e,responseLength:e?.length??0,parser:Mo(n),...Zo(a.current),...p,message:"OpenUI Lang is streaming"});return}l?.phase==="settled"&&Ro(u.length>0?"error":"info",{id:l.id,kind:Po,phase:Qi,updateIndex:l.updateIndex,response:e,responseLength:e?.length??0,parser:Mo(n),errors:u,errorCount:u.length,...Zo(a.current),...p,message:u.length>0?`OpenUI Lang settled with ${u.length} error${u.length===1?"":"s"}`:"OpenUI Lang settled"})},[s,t,e,n,r,o,i])}function Sn(e){return e&&typeof e=="object"&&!Array.isArray(e)&&"value"in e?e.value:e}function $h({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:o,initialState:s,toolProvider:i,onError:a,publishObservability:u},c){const l=w.useMemo(()=>Wi(e,n),[e,n]),p=n||!l.complete||!!l.error,f=l.isBundle&&p,d=w.useRef({revision:null,names:new Set});p||(d.current={revision:"scriptRevision"in l?l.scriptRevision??null:null,names:l.scripts});const m=d.current.revision,h=d.current.names,y=w.useMemo(()=>t.toJSONSchema(),[t]),_=w.useMemo(()=>Jm(y,t.root),[y,t.root]),v=w.useMemo(()=>Object.fromEntries(Object.entries(y.functions??{}).flatMap(([T,I])=>{const N=t.functions?.[T]?.fn;return N?[[T,{...I,fn:N}]]:[]})),[y,t.functions]),E=w.useRef(null),O=w.useMemo(()=>{if(E.current=l.error?{source:"parser",code:"parse-failed",message:l.error}:null,!l.program)return null;try{return _.set(l.program,!n)}catch(T){return E.current={source:"parser",code:"parse-exception",message:`Parser crashed: ${T instanceof Error?T.message:String(T)}`,hint:"The response may contain syntax the parser cannot handle"},null}},[_,l.program,l.error,n]),k=w.useMemo(()=>ih(),[]),$=w.useMemo(()=>oh(i??null),[i]);w.useEffect(()=>($.activate(),()=>$.dispose()),[$]);const C=w.useRef(!1),fe=w.useRef(Symbol());w.useEffect(()=>{if(!O?.stateDeclarations&&!s)return;const T=`${JSON.stringify(O?.stateDeclarations)}::${JSON.stringify(s)}`;if(fe.current===T)return;fe.current=T;const I={};if(s)for(const[N,te]of Object.entries(s))N.startsWith("$")?I[N]=te:k.set(N,te);C.current=!0,k.initialize(O?.stateDeclarations??{},I),C.current=!1},[O?.stateDeclarations,k,s]);const j=w.useSyncExternalStore(k.subscribe,k.getSnapshot,k.getSnapshot),z=w.useSyncExternalStore($.subscribe,$.getSnapshot,$.getSnapshot),S=w.useMemo(()=>({getState:T=>Sn(k.get(T)),resolveRef:T=>{const I=$.getMutationResult(T);return I||$.getResult(T)},functions:v,actions:y.actions}),[k,$,v,y.actions]);w.useEffect(()=>{if(p)return;const T=(O?.queryStatements??[]).map(I=>{const N={},te=I.toolAST?Z(I.toolAST,S):"";if(I.deps)for(const Ie of I.deps)N[Ie]=j[Ie];return h.has(te)&&(N.__openuiScriptRevision=m),{statementId:I.statementId,toolName:te,args:I.argsAST?Z(I.argsAST,S):null,defaults:I.defaultsAST?Z(I.defaultsAST,S):null,refreshInterval:I.refreshAST?Z(I.refreshAST,S):void 0,deps:Object.keys(N).length>0?N:void 0,complete:I.complete}});$.evaluateQueries(T)},[p,O?.queryStatements,S,$,j,m,h]),w.useEffect(()=>{if(p)return;const T=(O?.mutationStatements??[]).map(I=>({statementId:I.statementId,toolName:I.toolAST?Z(I.toolAST,S):""}));$.registerMutations(T)},[p,O?.mutationStatements,S,$]);const x=w.useRef({onAction:r,onStateUpdate:o});x.current={onAction:r,onStateUpdate:o};const M=w.useRef(O);M.current=O;const G=w.useRef(null);w.useEffect(()=>(G.current=k.getSnapshot(),k.subscribe(()=>{const T=k.getSnapshot();C.current||T===G.current||(G.current=null,x.current.onStateUpdate?.(T))})),[k]);const U=w.useCallback((T,I)=>{if(!T)return Sn(k.get(I));const N=k.get(T);if(!(!N||typeof N!="object"||Array.isArray(N)))return Sn(N[I])},[k]),F=w.useCallback((T,I,N,te,Ie=!0)=>{const Q={value:te,componentType:I};if(!T)k.set(N,Q);else{const se=k.get(T),be=se&&typeof se=="object"&&!Array.isArray(se)?se:{};k.set(T,{...be,[N]:Q})}Ie&&x.current.onStateUpdate?.(k.getSnapshot())},[k]),L=w.useCallback(T=>{if(T){const I=k.get(T);if(I&&typeof I=="object"&&!Array.isArray(I))return{[T]:I}}return k.getSnapshot()},[k]),ut=w.useCallback(async(T,I,N)=>{if(f)return;const{onAction:te}=x.current;if(N&&!("steps"in N)){const Q=L(I),se=N.type||ht.ContinueConversation;if(y.actions&&Object.prototype.hasOwnProperty.call(y.actions,se))return;const be={...N.params||{}};N.url&&(be.url=N.url),N.context&&(be.context=N.context),te?.({type:se,params:be,humanFriendlyMessage:T,formState:Q,formName:I});return}const Ie=N;if(Ie?.steps){for(const Q of Ie.steps)switch(Q.type){case ve.Run:if(Q.refType==="mutation"){const se=M.current?.mutationStatements?.find(ga=>ga.statementId===Q.statementId),be=se?.argsAST?Z(se.argsAST,S):{};if(!await $.fireMutation(Q.statementId,be))return}else $.invalidate([Q.statementId]);break;case ve.ToAssistant:te?.({type:ht.ContinueConversation,params:Q.context!==void 0?{context:Q.context}:{},humanFriendlyMessage:Q.message,formState:L(I),formName:I});break;case ve.OpenUrl:te?.({type:ht.OpenUrl,params:{url:Q.url},humanFriendlyMessage:"",formState:L(I),formName:I});break;case"custom_action":te?.({type:Q.name,params:Q.params,humanFriendlyMessage:"",formState:L(I),formName:I});break;case ve.Set:{if(!Q.valueAST){console.warn(`[openui] Set action for ${Q.target} has no valueAST — skipping`);break}const se=Z(Q.valueAST,S);k.set(Q.target,se);break}case ve.Reset:{const se=M.current?.stateDeclarations??{};for(const be of Q.targets)k.set(be,se[be]??null,{pristine:!0});break}}return}te?.({type:ht.ContinueConversation,params:{},humanFriendlyMessage:T,formState:L(I),formName:I})},[f,$,S,L,k,y.actions]),Or=w.useRef([]),jr=w.useRef(n);jr.current=n;const xr=w.useCallback(T=>{jr.current||Or.current.push(T)},[]),sn=z.__openui_loading.length>0||n&&f&&(O?.queryStatements.length??0)>0,an=w.useMemo(()=>z.__openui_errors.filter(T=>T.source==="query"),[z]),da=w.useCallback(()=>{f||$.invalidate(an.map(T=>T.statementId))},[f,$,an]),un=w.useRef([]),Ar=w.useMemo(()=>{if(!O?.root&&!O?.rootExpression)return O;const T=[],I={ctx:S,library:t,store:k,errors:T};try{const N=th(O,I);return un.current=T,{...O,root:N}}catch(N){const te=N instanceof Error?N.message:String(N);return T.push({source:"runtime",code:"runtime-error",message:`Prop evaluation failed: ${te}`}),un.current=T,O}},[O,S,t,k,j,z]),pa=w.useMemo(()=>({library:t,renderNode:c,triggerAction:ut,isStreaming:p,getFieldValue:U,setFieldValue:F,store:k,evaluationContext:S,reportError:xr,isQueryLoading:sn}),[t,c,p,sn,ut,U,F,k,S,xr]),{errorsRef:ma,errorRevision:ha}=vh({response:l.program,isStreaming:n,result:O,evaluatedResult:Ar,library:t,querySnapshot:z,parseExceptionRef:E,runtimeErrorsRef:un,renderErrorsRef:Or,onError:a});return kh({response:l.program,isStreaming:n,result:O,errorsRef:ma,errorRevision:ha,publish:u,__libraryId:t.__libraryId}),{result:Ar,parseResult:O,contextValue:pa,isQueryLoading:sn,queryErrors:an,retryQueries:da}}var Oh=class extends w.Component{lastValidChildren=null;constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){this.state.hasError||(this.lastValidChildren=this.props.children)}componentDidUpdate(e){this.state.hasError||(this.lastValidChildren=this.props.children),this.state.hasError&&e.children!==this.props.children&&this.setState({hasError:!1})}componentDidCatch(e){const t=this.props.componentName??"Unknown";this.props.onError?.({source:"runtime",code:"render-error",component:t,message:`Component ${t} render failed: ${e.message}`})}render(){return this.state.hasError?this.lastValidChildren:this.props.children}};function Gi(e){if(e==null)return null;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map((t,n)=>g.jsx(w.Fragment,{children:Gi(t)},n));if(typeof e=="object"&&e!==null){const t=e;if(t.type==="element")return g.jsx(Sr,{node:t})}return null}function Sr({node:e}){const{library:t,reportError:n}=nn(),r=t.components[e.typeName]?.component;return r?g.jsx(Oh,{componentName:e.typeName,onError:n,children:g.jsx(jh,{el:e,Comp:r})}):null}function jh({el:e,Comp:t}){const n=ph();return g.jsx(t,{props:e.props,renderNode:n,statementId:e.statementId})}let Do=!1;function xh(){if(Do||typeof document>"u")return;Do=!0;const e=document.createElement("style");e.textContent="@keyframes openui-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(e)}const Hi=()=>g.jsx("div",{role:"status","aria-label":"Loading data",style:{position:"absolute",top:8,right:8,width:16,height:16,border:"2px solid #e5e7eb",borderTopColor:"#3b82f6",borderRadius:"50%",animation:"openui-spin 0.6s linear infinite",zIndex:10}});function Xi({response:e,library:t,isStreaming:n=!1,onAction:r,onStateUpdate:o,initialState:s,onParseResult:i,toolProvider:a,queryLoader:u,children:c,onError:l,publishObservability:p}){w.useInsertionEffect(()=>{xh()},[]);const f=w.useRef(i);f.current=i;const d=w.useRef(a);d.current=a;const m=w.useRef({async callTool(C,fe){const j=d.current??null;if(j==null)throw new Error("[openui] toolProvider is null");if(typeof j.callTool=="function")return nh(await j.callTool({name:C,arguments:fe}));const z=j,S=z[C];if(!S)throw new Vn(C,Object.keys(z));return S(fe)}}),{result:h,parseResult:y,contextValue:_,isQueryLoading:v,queryErrors:E,retryQueries:O}=$h({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:o,initialState:s,toolProvider:a!=null?m.current:null,onError:l,publishObservability:p},Gi);w.useEffect(()=>{f.current?.(y)},[y]);const k=w.useMemo(()=>({isLoading:v,errors:E,retry:O,isRetrying:E.length>0&&v}),[v,E,O]),$={root:h?.root??null,query:k,queryLoader:u};return g.jsx(Ji.Provider,{value:_,children:g.jsx(ea.Provider,{value:$,children:c})})}const ea=w.createContext(null);function rn(){const e=w.useContext(ea);if(!e)throw new Error("Renderer slots must be used within Renderer.Root or Renderer.");return e}function ta(){return rn().query}function Ah({style:e,hidden:t,...n}){const{root:r,query:o}=rn();return r?g.jsx("div",{...n,"aria-busy":o.isLoading,hidden:t||o.errors.length>0,style:{opacity:o.isLoading?.7:1,transition:"opacity 0.2s ease",...e},children:g.jsx(Sr,{node:r})}):null}function Eh({children:e}){const{query:{isLoading:t,errors:n},queryLoader:r}=rn();return!t||n.length>0?null:g.jsx(g.Fragment,{children:e===void 0?r??g.jsx(Hi,{}):e})}function zh({children:e}){const{errors:t}=ta();return t.length===0?null:g.jsx(g.Fragment,{children:e})}function Ih({children:e,onClick:t,disabled:n,...r}){const{retry:o,isLoading:s,errors:i}=ta(),a=n||s||i.length===0;return g.jsx("button",{type:"button",...r,disabled:a,onClick:u=>{a||u.defaultPrevented||(t?.(u),u.defaultPrevented||o())},children:e})}function Th(){const{root:e,query:t,queryLoader:n}=rn();return e?g.jsxs("div",{"aria-busy":t.isLoading,style:{position:"relative"},children:[t.isLoading&&(n??g.jsx(Hi,{})),g.jsx("div",{style:{opacity:t.isLoading?.7:1,transition:"opacity 0.2s ease"},children:g.jsx(Sr,{node:e})})]}):null}function Rh({children:e,...t}){return g.jsx(Xi,{...t,children:e===void 0?g.jsx(Th,{}):e})}const Kn=Object.assign(Rh,{Root:Xi,Content:Ah,QueryLoading:Eh,QueryError:zh,Retry:Ih});function Nh(e,t){const n=nn(),r=Ki();return sh(e,t,n.store??null,n.evaluationContext??null,o=>n.getFieldValue(r,o),(o,s)=>n.setFieldValue(r,void 0,o,s))}w.createContext(null);const na=w.createContext(null);function ra(){const e=w.useContext(na);if(!e)throw new Error("Preview slots must be used within WithPreviewRenderer.Root or WithPreviewRenderer.");return e}function oa(){return ra().state}function sa({open:e,defaultOpen:t=!1,onOpenChange:n,onMetadata:r,children:o,...s}){const[i,a]=w.useState(t),u=e??i,c=s.isStreaming===!0,l=w.useId(),p=w.useMemo(()=>Wi(s.response,c),[s.response,c]).metadata.name,f=w.useMemo(()=>p===void 0?{}:{name:p},[p]),d=w.useRef(r);d.current=r,w.useEffect(()=>{d.current?.(f)},[f]);const m=w.useCallback(v=>{v!==u&&(e===void 0&&a(v),n?.(v))},[e,u,n]),h=w.useCallback(()=>m(!0),[m]),y=w.useCallback(()=>m(!1),[m]),_=w.useMemo(()=>({metadata:f,isOpen:u,isStreaming:c,contentId:l,open:h,close:y}),[f,u,c,l,h,y]);return g.jsx(na.Provider,{value:{state:_,rendererProps:s},children:o})}function ia({children:e,onClick:t,disabled:n,...r}){const{metadata:o,isOpen:s,isStreaming:i,contentId:a,open:u,close:c}=oa();return g.jsx("button",{type:"button",...r,disabled:n,"aria-expanded":s,"aria-controls":s?a:void 0,onClick:l=>{n||l.defaultPrevented||(t?.(l),l.defaultPrevented||(s?c:u)())},children:e===void 0?`${o.name||"Untitled artifact"}${i?" (generating…)":""}`:e})}function aa({children:e,onClick:t,disabled:n,...r}){const{metadata:o,close:s}=oa();return g.jsx("button",{type:"button",...r,disabled:n,onClick:i=>{n||i.defaultPrevented||(t?.(i),i.defaultPrevented||s())},children:e===void 0?`Close ${o.name||"Untitled artifact"}`:e})}function ua({children:e,style:t,...n}){const{state:r,rendererProps:o}=ra();return r.isOpen?g.jsx("section",{"aria-label":r.metadata.name||"Untitled artifact",...n,id:r.contentId,style:{position:"relative",...t},children:e===void 0?g.jsxs(g.Fragment,{children:[g.jsx(aa,{}),g.jsx(Kn,{...o})]}):g.jsx(Kn,{...o,children:e})}):null}function Ph({children:e,...t}){return g.jsx(sa,{...t,children:e===void 0?g.jsxs(g.Fragment,{children:[g.jsx(ia,{}),g.jsx(ua,{})]}):e})}Object.assign(Ph,{Root:sa,Trigger:ia,Content:ua,Close:aa});const Uo=oe().max(16e3),W=oe().max(160),$t=oe().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),Ch=Ke([oe().max(4e3),re().finite(),wt(),Dd()]),Te={Text:P({content:Uo}),Metric:P({label:W,value:W,detail:W.optional()}),Callout:P({title:W,content:Uo,tone:De(["info","success","warning"]).optional()}),Table:P({columns:ae(W).min(1).max(12),rows:ae(ae(Ch).max(12)).max(300),caption:W.optional()}),Chart:P({title:W,labels:ae(W).min(1).max(30),series:ae(P({name:W,values:ae(re().finite()).max(30)})).min(1).max(6),kind:De(["bar","line"]).optional()}),Checklist:P({title:W,items:ae(P({label:W,detail:W.optional(),done:wt()})).max(30)}),Input:P({name:$t,label:W,placeholder:W.optional(),required:wt().optional()}),Select:P({name:$t,label:W,options:ae(W).min(1).max(50),required:wt().optional()}),Checkbox:P({name:$t,label:W}),Button:P({label:W,action:Ip().optional()}),Resource:P({label:W,kind:De(["file","link"]),target:oe().max(4096),description:W.optional()})},ca=Object.entries(Te).map(([e,t])=>en({name:e,props:t,component:null,description:{Text:"Markdown prose using the shared preview renderer.",Metric:"A known metric with label, value and optional context.",Callout:"An important explanation; tone info/success/warning.",Table:"A comparison table with horizontally scrollable, filterable and sortable rows.",Chart:"A chart of supplied factual values. Do not invent values.",Checklist:"Explicitly reported checklist items, never inferred Agent activity.",Input:"Text field inside Form; name must be unique in that form.",Select:"Selection field inside Form.",Checkbox:"Checkbox inside Form.",Button:"Clickable action. @ToAssistant(message) continues this same conversation; inside Form also sends the form values.",Resource:"User-opened file preview or external web link. Use an authorized absolute path for files."}[e]})),kr=Ke(ca.map(e=>e.ref)),$r=en({name:"Form",description:"User question form. Include Input/Select/Checkbox and a Button with @ToAssistant. Never nest forms.",props:P({name:$t,title:W,fields:ae(kr).max(30)}),component:null}),la=en({name:"Card",description:"A titled result card, with text, metrics, charts, tables or a form.",props:P({title:W,content:ae(Ke([kr,$r.ref])).max(30)}),component:null}),Zh=en({name:"Stack",description:"Root vertical layout of answer components.",props:P({content:ae(Ke([kr,$r.ref,la.ref])).max(40)}),component:null}),Ot=hr({id:"termdock-chat@1",root:"Stack",components:[...ca,$r,la,Zh]}),Xe=(e,t)=>JSON.stringify(e)===JSON.stringify(t),kn=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function Wn(e,t,n){return Xe(e,t)?n:!kn(e)||!kn(t)||!kn(n)?t:Object.fromEntries([...new Set([...Object.keys(n),...Object.keys(t)])].filter(r=>!["__proto__","prototype","constructor"].includes(r)).map(r=>[r,Wn(e[r],t[r],n[r])]))}function Mh(e,t,n,r){const o=`termdock:chat-ui:${ba()?.targetPeerId||location.origin}:${e}:${t}`,s=n||{revision:0,values:{}},i=w.useRef({base:s,values:s.values,saving:!1,waiters:[],live:!0,blocked:!1,enabled:r});i.current.enabled=r;const[a,u]=w.useState(s.values),[c,l]=w.useState(""),[p,f]=w.useState(""),[d,m]=w.useState(0);w.useEffect(()=>{i.current.live=!0;try{const _=JSON.parse(sessionStorage.getItem(o)||"null");_?.values&&_?.base&&r&&(i.current.values=Wn(_.base.values,_.values,s.values),u(i.current.values),m(v=>v+1))}catch{}return()=>{i.current.live=!1}},[o]),w.useEffect(()=>{!n||n.revision<=i.current.base.revision||i.current.saving||!Xe(i.current.values,i.current.base.values)||(i.current.base=n,i.current.values=n.values,u(n.values))},[n]);const h=w.useCallback(_=>{const v=i.current;if(!(!v.enabled||Xe(_,v.values))){v.values=_,v.blocked=!1,l("正在保存…"),f("");try{sessionStorage.setItem(o,JSON.stringify({base:v.base,values:_}))}catch{}m(E=>E+1)}},[o]),y=w.useCallback(async function _(){const v=i.current;if(!v.enabled||!v.live||v.blocked)return!1;if(v.saving)return await new Promise($=>v.waiters.push($)),_();if(Xe(v.values,v.base.values))return!0;const E=v.values,O=v.base,k=Er();v.saving=!0;try{const $=await fetch(`/api/terminal/${encodeURIComponent(e)}/chat/${encodeURIComponent(t)}/state`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({revision:O.revision,values:E}),signal:AbortSignal.timeout(15e3)}),C=await $.json();if(!v.live||!v.enabled||Er()!==k)return!1;if($.status===409&&C.state){v.values=Wn(O.values,v.values,C.state.values),v.base=C.state,v.blocked=!0,u(v.values);try{sessionStorage.setItem(o,JSON.stringify({base:v.base,values:v.values}))}catch{}throw new Error("其他客户端更新了填写内容,你的修改已保留,请确认后重新保存。")}if(!$.ok)throw new Error("暂时无法保存,填写内容已保留。");return v.base=C,Xe(E,v.values)?(l("已保存"),sessionStorage.removeItem(o)):m(fe=>fe+1),f(""),!0}catch($){return v.live&&(v.blocked=!0,l(""),f($ instanceof Error?$.message:"暂时无法保存,填写内容已保留。")),!1}finally{v.saving=!1,v.waiters.splice(0).forEach($=>$())}},[e,t,o]);return w.useEffect(()=>{if(!r)return;const _=setTimeout(()=>{y()},350);return()=>clearTimeout(_)},[d,r,y]),{hydration:a,update:h,save:y,status:c,error:p,retry:()=>{i.current.blocked=!1,y()}}}const yt=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function Dh(e,t){const n=new Map,r=(u,c)=>{if(Array.isArray(u)){u.forEach(l=>r(l,c));return}if(yt(u)&&u.type==="element"&&yt(u.props)){const l=u.props,p=u.typeName==="Form"?String(l.name):c;["Input","Select","Checkbox"].includes(String(u.typeName))&&(!e.formName||p===e.formName)&&n.set(String(l.name),String(l.label)),Object.values(l).forEach(f=>r(f,p))}};r(t);const o=e.formState||{},s=e.formName&&yt(o[e.formName])?o[e.formName]:o,i=[...n].flatMap(([u,c])=>{const l=s[u],p=yt(l)&&"value"in l?l.value:l;return p==null||p===""?[]:[`${c}:${typeof p=="boolean"?p?"是":"否":typeof p=="string"||typeof p=="number"?String(p):""}`]}),a=e.params.context;return[e.humanFriendlyMessage||"提交填写内容",i.length?i.join(`
|
|
275
|
+
`):"",typeof a=="string"?a:""].filter(Boolean).join(`
|
|
276
|
+
|
|
277
|
+
`)}const Fo="min-h-11 w-full min-w-0 rounded-xl border border-border bg-background px-3 py-2 text-base outline-none focus:ring-2 focus:ring-ring disabled:opacity-60 sm:text-sm",at="inline-flex min-h-11 items-center justify-center gap-2 rounded-xl border border-border px-4 py-2 text-sm hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40",Uh=w.lazy(()=>Lo(()=>import("./RightSidebar-CwXIBpEw.js").then(e=>e.R),__vite__mapDeps([2,3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32])).then(e=>({default:e.FilePreview}))),on=w.createContext({canWrite:!1,resource:e=>{}});function fa({columns:e,rows:t,caption:n}){const[r,o]=w.useState(""),[s,i]=w.useState(),a=w.useMemo(()=>{const u=t.filter(c=>!r||c.some(l=>String(l??"").toLocaleLowerCase().includes(r.toLocaleLowerCase())));return s?u.slice().sort((c,l)=>s.direction*(typeof c[s.column]=="number"&&typeof l[s.column]=="number"?Number(c[s.column])-Number(l[s.column]):String(c[s.column]??"").localeCompare(String(l[s.column]??""),void 0,{numeric:!0}))):u},[t,r,s]);return g.jsxs("div",{className:"min-w-0 space-y-2",children:[n&&g.jsx("p",{className:"text-sm font-medium",children:n}),t.length>5&&g.jsxs("label",{className:"flex max-w-sm items-center gap-2 rounded-xl border border-border px-3 text-muted-foreground",children:[g.jsx(Aa,{size:15}),g.jsx("input",{"aria-label":"筛选表格",className:"min-h-11 min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none",value:r,onChange:u=>o(u.target.value),placeholder:"筛选内容…"})]}),g.jsxs("div",{role:"region","aria-label":"交互表格,可横向滚动",tabIndex:0,className:"max-w-full overflow-x-auto rounded-xl border border-border [touch-action:pan-x_pan-y]",children:[g.jsxs("table",{className:"w-full text-left text-sm",children:[g.jsx("thead",{className:"bg-surface-2",children:g.jsx("tr",{children:e.map((u,c)=>g.jsx("th",{"aria-sort":s?.column===c?s.direction===1?"ascending":"descending":"none",className:"whitespace-nowrap border-b border-border px-3 py-2 font-medium",children:g.jsxs("button",{type:"button",className:"inline-flex min-h-9 items-center gap-2 text-left",onClick:()=>i({column:c,direction:s?.column===c?-s.direction:1}),children:[u,g.jsx(Ia,{size:12,className:"text-muted-foreground"})]})},c))})}),g.jsx("tbody",{children:a.map((u,c)=>g.jsx("tr",{className:"border-b border-border/40 last:border-0",children:e.map((l,p)=>g.jsx("td",{className:"min-w-28 max-w-sm whitespace-pre-wrap break-words px-3 py-3 align-top",children:String(u[p]??"")},p))},c))})]}),!a.length&&g.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"没有匹配的内容"})]})]})}function Fh({title:e,labels:t,series:n,kind:r="bar"}){const[o,s]=w.useState([]),i=n.filter(h=>!o.includes(h.name)),a=i.flatMap(h=>h.values),u=Math.min(0,...a),c=Math.max(1,...a),l=c-u||1,p=h=>{if(Number.isFinite(l))return 190-(h-u)/l*164;const y=Math.max(Math.abs(u),Math.abs(c));return 190-(h/y-u/y)/(c/y-u/y)*164},f=["var(--primary)","var(--accent)","var(--warning)","var(--tmux)","var(--destructive)","var(--foreground)"],d=Math.max(440,t.length*55),m=(d-60)/t.length;return g.jsxs("figure",{className:"min-w-0 space-y-3",children:[g.jsx("figcaption",{className:"text-sm font-medium",children:e}),g.jsx("div",{className:"flex flex-wrap gap-2",children:n.map((h,y)=>g.jsxs("button",{type:"button","aria-pressed":!o.includes(h.name),className:`${at} min-h-9 px-2 text-xs ${o.includes(h.name)?"opacity-40":""}`,onClick:()=>s(_=>_.includes(h.name)?_.filter(v=>v!==h.name):[..._,h.name]),children:[g.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:f[y%f.length]}}),h.name]},y))}),g.jsx("div",{role:"region","aria-label":`${e},可横向滚动`,tabIndex:0,className:"max-w-full overflow-x-auto",children:g.jsxs("svg",{role:"img","aria-label":e,viewBox:`0 0 ${d} 230`,className:"h-60 min-w-full",style:{minWidth:d},children:[g.jsx("line",{x1:"40",x2:d-8,y1:p(0),y2:p(0),stroke:"var(--border)"}),g.jsx("text",{x:"4",y:"22",fill:"var(--muted-foreground)",fontSize:"11",children:c.toLocaleString()}),i.map(h=>{const y=n.indexOf(h),_=f[y%f.length];return r==="line"?g.jsxs("g",{children:[g.jsx("polyline",{fill:"none",stroke:_,strokeWidth:"2.5",points:h.values.slice(0,t.length).map((v,E)=>`${40+m*(E+.5)},${p(v)}`).join(" ")}),h.values.slice(0,t.length).map((v,E)=>g.jsx("circle",{cx:40+m*(E+.5),cy:p(v),r:"4",fill:_,children:g.jsxs("title",{children:[t[E]," · ",h.name,": ",v]})},E))]},y):g.jsx("g",{children:h.values.slice(0,t.length).map((v,E)=>g.jsx("rect",{x:40+m*E+m*.15+m*.7/Math.max(1,i.length)*i.indexOf(h),y:Math.min(p(0),p(v)),width:m*.7/Math.max(1,i.length)-2,height:Math.max(1,Math.abs(p(v)-p(0))),rx:"3",fill:_,children:g.jsxs("title",{children:[t[E]," · ",h.name,": ",v]})},E))},y)}),t.map((h,y)=>g.jsxs("text",{x:40+m*(y+.5),y:"216",textAnchor:"middle",fill:"var(--muted-foreground)",fontSize:"11",children:[h.length>9?h.slice(0,8)+"…":h,g.jsx("title",{children:h})]},y))]})}),g.jsxs("details",{className:"text-xs text-muted-foreground",children:[g.jsx("summary",{className:"cursor-pointer py-2",children:"查看数据"}),g.jsx(fa,{columns:["项目",...n.map(h=>h.name)],rows:t.map((h,y)=>[h,...n.map(_=>_.values[y]??null)])})]})]})}function Lh({type:e,props:t}){const{canWrite:n}=w.useContext(on),r=String(t.name),o=String(t.label),s=Nh(r,e==="Checkbox"?!1:"");return e==="Checkbox"?g.jsxs("label",{className:"flex min-h-11 items-center gap-3 text-sm",children:[g.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-primary",disabled:!n,checked:s.value===!0,onChange:i=>s.setValue(i.target.checked)}),o]}):g.jsxs("label",{className:"block space-y-2 text-sm",children:[g.jsxs("span",{children:[o,t.required?g.jsx("span",{className:"ml-1 text-muted-foreground",children:"*"}):null]}),e==="Select"?g.jsxs("select",{className:Fo,disabled:!n,required:t.required===!0,value:typeof s.value=="string"?s.value:"",onChange:i=>s.setValue(i.target.value),children:[g.jsx("option",{value:"",children:"请选择"}),t.options.map(i=>g.jsx("option",{children:i},i))]}):g.jsx("input",{className:Fo,type:"text",disabled:!n,required:t.required===!0,maxLength:8e3,value:typeof s.value=="string"?s.value:"",placeholder:String(t.placeholder||""),onChange:i=>s.setValue(i.target.value)})]})}function Bh({props:e}){const{canWrite:t}=w.useContext(on),n=mh(),r=Ki();return g.jsx("button",{type:"button","data-ui-submit":!0,className:`${at} bg-primary text-primary-foreground hover:opacity-90`,disabled:!t,onClick:o=>{o.currentTarget.form&&!o.currentTarget.form.reportValidity()||n(String(e.label),r,e.action)},children:String(e.label)})}function qh({props:e}){const{resource:t}=w.useContext(on),n=String(e.target),r=String(e.label);let o;try{const a=new URL(n);["http:","https:"].includes(a.protocol)&&!a.username&&!a.password&&(o=a)}catch{}const s=g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-primary",children:e.kind==="file"?g.jsx(Oa,{size:18}):g.jsx(Ea,{size:18})}),g.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[g.jsx("span",{className:"block break-words font-medium",children:r}),!!e.description&&g.jsx("span",{className:"mt-1 block break-words text-xs text-muted-foreground",children:String(e.description)})]})]}),i=`${at} w-full justify-start py-3`;return e.kind==="link"&&o?g.jsx("a",{className:i,href:o.href,target:"_blank",rel:"noopener noreferrer",children:s}):g.jsx("button",{type:"button",className:i,disabled:e.kind!=="file"||!/^(?:\/|[a-zA-Z]:[\\/])/.test(n),onClick:()=>t(n),children:s})}function Jh({name:e,props:t,renderNode:n}){if(e==="Button"?Te.Button.omit({action:!0}).parse(t):e in Te&&Te[e].parse(t),e==="Text")return g.jsx(jt,{content:String(t.content)});if(e==="Metric")return g.jsxs("div",{className:"rounded-xl border border-border bg-surface/60 p-4",children:[g.jsx("p",{className:"text-xs text-muted-foreground",children:String(t.label)}),g.jsx("p",{className:"mt-2 break-words text-2xl font-semibold tabular-nums",children:String(t.value)}),!!t.detail&&g.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:String(t.detail)})]});if(e==="Callout")return g.jsxs("aside",{className:`rounded-xl border-l-2 bg-surface p-4 ${t.tone==="warning"?"border-warning":t.tone==="success"?"border-primary":"border-accent"}`,children:[g.jsx("p",{className:"mb-2 text-sm font-medium",children:String(t.title)}),g.jsx(jt,{content:String(t.content)})]});if(e==="Table")return g.jsx(fa,{...Te.Table.parse(t)});if(e==="Chart")return g.jsx(Fh,{...Te.Chart.parse(t)});if(e==="Checklist"){const r=Te.Checklist.parse(t);return g.jsxs("section",{className:"space-y-3",children:[g.jsx("h4",{className:"text-sm font-medium",children:r.title}),g.jsx("ul",{className:"space-y-3",children:r.items.map((o,s)=>g.jsxs("li",{className:"flex gap-3",children:[o.done?g.jsx(ka,{size:17,className:"mt-0.5 shrink-0 text-primary"}):g.jsx(xa,{size:17,className:"mt-0.5 shrink-0 text-muted-foreground"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("p",{className:"text-sm",children:o.label}),o.detail&&g.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:o.detail})]})]},s))})]})}return e==="Input"||e==="Select"||e==="Checkbox"?g.jsx(Lh,{type:e,props:t}):e==="Button"?g.jsx(Bh,{props:t}):e==="Resource"?g.jsx(qh,{props:t}):e==="Form"?g.jsx(Vi.Provider,{value:String(t.name),children:g.jsxs("form",{className:"space-y-4 rounded-xl border border-border bg-surface/50 p-4",onSubmit:r=>{r.preventDefault(),r.currentTarget.querySelector("[data-ui-submit]")?.click()},children:[g.jsx("h4",{className:"text-sm font-medium",children:String(t.title)}),n(t.fields)]})}):e==="Card"?g.jsxs("section",{className:"min-w-0 space-y-4 rounded-2xl border border-border bg-surface/40 p-4 sm:p-5",children:[g.jsx("h3",{className:"text-base font-semibold",children:String(t.title)}),n(t.content)]}):g.jsx("div",{className:"min-w-0 space-y-4",children:n(t.content)})}const Vh=fh({id:Ot.id,root:Ot.root,components:Object.values(Ot.components).map(e=>({...e,component:t=>g.jsx(Jh,{...t,name:e.name})}))}),Kh=qm(Ot.toJSONSchema());function Wh({path:e,close:t,sessionId:n,canWrite:r}){const o=w.useRef(null),[s,i]=w.useState(null),[a,u]=w.useState(""),[c,l]=w.useState(null);_a(o,!0,t);const p=async(f,d)=>{if(!r){u("此会话仅允许查看");return}await $a(f,n,()=>o.current?.isConnected===!0,d)?t():u("暂时无法添加到输入框,请稍后重试。")};return ja.createPortal(g.jsx("div",{"data-sidebar-gesture-ignore":!0,className:"fixed inset-0 z-modal-backdrop flex items-center justify-center bg-[var(--app-backdrop)] p-2 sm:p-6",onMouseDown:f=>{f.target===f.currentTarget&&t()},children:g.jsxs("div",{ref:o,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"文件预览",className:"z-modal-panel flex h-[90dvh] w-full max-w-5xl flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground",children:[g.jsxs("header",{className:"flex min-h-14 shrink-0 items-center gap-3 border-b border-border px-4",children:[g.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",title:e,children:e.split(/[\\/]/).pop()}),g.jsx("button",{type:"button","aria-label":"关闭文件预览",className:at,onClick:t,children:g.jsx(wa,{size:17})})]}),g.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[a&&g.jsx("p",{role:"alert",className:"px-4 py-2 text-xs text-destructive",children:a}),g.jsx(w.Suspense,{fallback:g.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"正在读取文件…"}),children:g.jsx(Uh,{filePath:e,onInsertReference:(f,d,m)=>{p(Sa(f,null),m)},onInsertText:(f,d,m)=>{p(f,m)},onReferenceCopied:l,isMobile:window.innerWidth<640,markdownOutlineOpen:!1,markdownImageLightboxOpen:!1,lineRange:s,onLineRangeChange:i,insertedReferenceKey:null,copiedReferenceKey:c})})]})]})}),document.body)}function ug({message:e,sessionId:t,canWrite:n,onAction:r}){const o=e.ui,[s,i]=w.useState(!1),[a,u]=w.useState(""),[c,l]=w.useState(!1),[p,f]=w.useState(),d=w.useMemo(()=>{try{return Kh.parse(o.code)}catch{return null}},[o.code]),m=o.version===1&&d?.root&&!d.meta.incomplete&&!d.meta.errors.length&&!d.meta.unresolved.length&&d.meta.statementCount<=256&&!d.queryStatements.length&&!d.mutationStatements.length,h=Mh(t,e.id,e.uiState,n&&!!m&&!s),y=async _=>{if(!n||c)return;if(_.type==="open_url"){try{const E=new URL(String(_.params.url));if(!["https:","http:"].includes(E.protocol)||E.username||E.password)throw new Error;window.open(E.href,"_blank","noopener,noreferrer")}catch{u("链接无效,请通过消息确认地址。")}return}if(_.type!=="continue_conversation"){u("此操作暂不可用,请通过消息说明你的选择。");return}const v=Dh(_,d?.root||null);l(!0),u("");try{if(!await h.save()){u("请先保存填写内容,再提交。");return}await r(v)||u("暂时无法提交,请稍后重试。")}finally{l(!1)}};return!m||s?g.jsxs("div",{className:"space-y-2",children:[g.jsx(jt,{content:e.content}),g.jsx("p",{className:"text-xs text-muted-foreground",children:"已显示文字说明"})]}):g.jsx(va,{fallback:g.jsx(jt,{content:e.content}),children:g.jsx(on.Provider,{value:{canWrite:n&&!c,resource:f},children:g.jsxs("div",{"data-chat-rich-content":!0,className:"min-w-0 space-y-3",children:[g.jsx(Kn,{library:Vh,response:o.code,initialState:h.hydration,onStateUpdate:h.update,onAction:_=>{y(_)},onError:_=>{_.some(v=>v.severity!=="warning")&&i(!0)},toolProvider:null,publishObservability:!1}),h.error?g.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-2 text-xs text-destructive",children:[g.jsx("span",{children:h.error}),g.jsx("button",{type:"button",className:`${at} min-h-9 text-foreground`,disabled:!n,onClick:h.retry,children:"重新保存"})]}):h.status&&g.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:h.status}),a&&g.jsx("p",{role:"alert",className:"text-xs text-destructive",children:a}),c&&g.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"正在提交…"}),p&&g.jsx(Wh,{path:p,sessionId:t,canWrite:n,close:()=>f(void 0)})]})})})}export{ug as ChatRichContent};
|