termdock 1.4.354 → 1.4.356
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-D9CMPmet.js → AndroidMirrorView-DW9oRr0w.js} +3 -3
- package/dist/client/assets/AndroidMirrorView-DW9oRr0w.js.br +0 -0
- package/dist/client/assets/AndroidMirrorView-DW9oRr0w.js.gz +0 -0
- package/dist/client/assets/App-DEZ2i9ZZ.js +178 -0
- package/dist/client/assets/App-DEZ2i9ZZ.js.br +0 -0
- package/dist/client/assets/App-DEZ2i9ZZ.js.gz +0 -0
- package/dist/client/assets/{ArchitecturePanel-Dlnd9PH-.js → ArchitecturePanel-Bf4b-6An.js} +3 -3
- package/dist/client/assets/ArchitecturePanel-Bf4b-6An.js.br +0 -0
- package/dist/client/assets/ArchitecturePanel-Bf4b-6An.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DO_zJfZr.js +2 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DO_zJfZr.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DO_zJfZr.js.gz +0 -0
- package/dist/client/assets/ChatRichContent-Cu1E1cJ8.js +277 -0
- package/dist/client/assets/ChatRichContent-Cu1E1cJ8.js.br +0 -0
- package/dist/client/assets/ChatRichContent-Cu1E1cJ8.js.gz +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-BhmpSEbf.js +1 -0
- package/dist/client/assets/CollaborationMainWorkspace-BhmpSEbf.js.br +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-BhmpSEbf.js.gz +0 -0
- package/dist/client/assets/{CollaborationTaskContent-GMhtQgeq.js → CollaborationTaskContent-CX0Aqdi2.js} +1 -1
- package/dist/client/assets/{ComputerControlView-VNUyl2Gb.js → ComputerControlView-DjQLzn10.js} +4 -4
- package/dist/client/assets/ComputerControlView-DjQLzn10.js.br +0 -0
- package/dist/client/assets/ComputerControlView-DjQLzn10.js.gz +0 -0
- package/dist/client/assets/DagPlayground-CPYwfryM.js +1 -0
- package/dist/client/assets/DagPlayground-CPYwfryM.js.br +0 -0
- package/dist/client/assets/DagPlayground-CPYwfryM.js.gz +0 -0
- package/dist/client/assets/{DiffLab-CKBHu65J.js → DiffLab-ptw96Q_4.js} +1 -1
- package/dist/client/assets/DiffLab-ptw96Q_4.js.br +0 -0
- package/dist/client/assets/DiffLab-ptw96Q_4.js.gz +0 -0
- package/dist/client/assets/DiffReview-12E2zWyL.js +1 -0
- package/dist/client/assets/DiffReview-12E2zWyL.js.br +0 -0
- package/dist/client/assets/DiffReview-12E2zWyL.js.gz +0 -0
- package/dist/client/assets/{DiffReviewLab--PbhIP71.js → DiffReviewLab-eEi3y-0G.js} +2 -2
- package/dist/client/assets/DiffReviewLab-eEi3y-0G.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-eEi3y-0G.js.gz +0 -0
- package/dist/client/assets/{DiffViewer-Cg3GhKcU.js → DiffViewer-DqcQxp4Q.js} +1 -1
- package/dist/client/assets/DiffViewer-DqcQxp4Q.js.br +0 -0
- package/dist/client/assets/DiffViewer-DqcQxp4Q.js.gz +0 -0
- package/dist/client/assets/GitLoadingSkeleton-DYrDIDF1.js +1 -0
- package/dist/client/assets/GitLoadingSkeleton-DYrDIDF1.js.br +0 -0
- package/dist/client/assets/GitLoadingSkeleton-DYrDIDF1.js.gz +0 -0
- package/dist/client/assets/{MarkdownPreview-b_bwDNcY.js → MarkdownPreview-CsJGsDRL.js} +2 -2
- package/dist/client/assets/MarkdownPreview-CsJGsDRL.js.br +0 -0
- package/dist/client/assets/MarkdownPreview-CsJGsDRL.js.gz +0 -0
- package/dist/client/assets/{ModelPreview-C9nka14O.js → ModelPreview-DjtHLlqP.js} +3 -3
- package/dist/client/assets/ModelPreview-DjtHLlqP.js.br +0 -0
- package/dist/client/assets/ModelPreview-DjtHLlqP.js.gz +0 -0
- package/dist/client/assets/{RecordingSaveDialog-1YvzwTzo.js → RecordingSaveDialog-DUtwgIME.js} +1 -1
- package/dist/client/assets/RecordingSaveDialog-DUtwgIME.js.br +0 -0
- package/dist/client/assets/RecordingSaveDialog-DUtwgIME.js.gz +0 -0
- package/dist/client/assets/{RightSidebar-CCk8ovoK.js → RightSidebar-BltjUFwI.js} +20 -20
- package/dist/client/assets/RightSidebar-BltjUFwI.js.br +0 -0
- package/dist/client/assets/RightSidebar-BltjUFwI.js.gz +0 -0
- package/dist/client/assets/SessionChatView-CdKfHRp8.js +13 -0
- package/dist/client/assets/SessionChatView-CdKfHRp8.js.br +0 -0
- package/dist/client/assets/SessionChatView-CdKfHRp8.js.gz +0 -0
- package/dist/client/assets/SessionResourceSidebar-DmQOydhf.js +2 -0
- package/dist/client/assets/SessionResourceSidebar-DmQOydhf.js.br +0 -0
- package/dist/client/assets/SessionResourceSidebar-DmQOydhf.js.gz +0 -0
- package/dist/client/assets/TodoWorkspace-Bh1C035B.js +1 -0
- package/dist/client/assets/TodoWorkspace-Bh1C035B.js.br +0 -0
- package/dist/client/assets/TodoWorkspace-Bh1C035B.js.gz +0 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-CTqKSsYV.js → abnfDiagram-VCTEODGH-Cvf_KWZ0.js} +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-Cvf_KWZ0.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-Cvf_KWZ0.js.gz +0 -0
- package/dist/client/assets/app-DuUnqxq-.js +37 -0
- package/dist/client/assets/app-DuUnqxq-.js.br +0 -0
- package/dist/client/assets/app-DuUnqxq-.js.gz +0 -0
- package/dist/client/assets/{arc-CcvWcKBR.js → arc-UvdowQOf.js} +1 -1
- package/dist/client/assets/arc-UvdowQOf.js.br +0 -0
- package/dist/client/assets/arc-UvdowQOf.js.gz +0 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-B_2ae8Tt.js → architectureDiagram-5GKGNRK7-DotsbCCA.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-DotsbCCA.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-DotsbCCA.js.gz +0 -0
- package/dist/client/assets/{arrow-down-DaWRHIlh.js → arrow-down-FGzRy9D-.js} +1 -1
- package/dist/client/assets/{arrow-up-DE9Z7GTI.js → arrow-up-DNkfesW0.js} +1 -1
- package/dist/client/assets/{blockDiagram-I7D4REHJ-CGXUOwJg.js → blockDiagram-I7D4REHJ-CoOfSG4k.js} +1 -1
- package/dist/client/assets/blockDiagram-I7D4REHJ-CoOfSG4k.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-CoOfSG4k.js.gz +0 -0
- package/dist/client/assets/{c4Diagram-7LVT6UL2-BSU3omYQ.js → c4Diagram-7LVT6UL2-BAfjgs8B.js} +1 -1
- package/dist/client/assets/c4Diagram-7LVT6UL2-BAfjgs8B.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-BAfjgs8B.js.gz +0 -0
- package/dist/client/assets/channel-BzMU9Wks.js +1 -0
- package/dist/client/assets/{chevron-left-ZgHOf4aC.js → chevron-left-xqARwD-7.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-B67WsCJN.js → chunk-2Q5K7J3B-DiiQ7BvG.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-B8k7JXrn.js → chunk-5VM5RSS4-CczSK8wW.js} +1 -1
- package/dist/client/assets/{chunk-F27PBJKO-CP85XeHB.js → chunk-F27PBJKO-BI3Di4Ve.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-BI3Di4Ve.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-BI3Di4Ve.js.gz +0 -0
- package/dist/client/assets/{chunk-IMKFNOWR-BjTbac0d.js → chunk-IMKFNOWR-Cvvs1wmn.js} +1 -1
- package/dist/client/assets/chunk-IMKFNOWR-Cvvs1wmn.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-Cvvs1wmn.js.gz +0 -0
- package/dist/client/assets/{chunk-JWPE2WC7-vEdRTCxh.js → chunk-JWPE2WC7-lrJRD9WA.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-BI8tSW7F.js → chunk-POPQ4Y6H-CnPC9D8B.js} +1 -1
- package/dist/client/assets/{chunk-SVP7TREG-Dde8KTpr.js → chunk-SVP7TREG-BZfMhm64.js} +1 -1
- package/dist/client/assets/chunk-SVP7TREG-BZfMhm64.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-BZfMhm64.js.gz +0 -0
- package/dist/client/assets/{chunk-TICWLB2K-DIBgH5zV.js → chunk-TICWLB2K-DmkEaRK3.js} +1 -1
- package/dist/client/assets/chunk-TICWLB2K-DmkEaRK3.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-DmkEaRK3.js.gz +0 -0
- package/dist/client/assets/{chunk-XXDRQBXY-LSjj35mz.js → chunk-XXDRQBXY-BP9Lccpe.js} +1 -1
- package/dist/client/assets/circle-DGZOpG8V.js +1 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-DtAtEoWU.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-DtAtEoWU.js +1 -0
- package/dist/client/assets/{clipboard-BGpbRBdi.js → clipboard-rLx5CzbY.js} +1 -1
- package/dist/client/assets/clipboardText-cZXParp1.js +1 -0
- package/dist/client/assets/clipboardText-cZXParp1.js.br +0 -0
- package/dist/client/assets/clipboardText-cZXParp1.js.gz +0 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-v4utSIkX.js → cose-bilkent-JH36ORCC-0xPYMc2z.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-0xPYMc2z.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-0xPYMc2z.js.gz +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-BdbtIufa.js → cynefin-OW5HDTMX-BQ7-lCHm.js} +1 -1
- package/dist/client/assets/cynefin-OW5HDTMX-BQ7-lCHm.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-BQ7-lCHm.js.gz +0 -0
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-B9EVx2-N.js → cynefinDiagram-5FMLGOSQ-CazHuSj1.js} +1 -1
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CazHuSj1.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CazHuSj1.js.gz +0 -0
- package/dist/client/assets/{dagre-GXQ25YYZ-Do2YjWuC.js → dagre-GXQ25YYZ-CJNgsyHQ.js} +1 -1
- package/dist/client/assets/dagre-GXQ25YYZ-CJNgsyHQ.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-CJNgsyHQ.js.gz +0 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-BnJa3bbo.js → diagram-S7CK7UJ4-D4xXIj1P.js} +1 -1
- package/dist/client/assets/diagram-S7CK7UJ4-D4xXIj1P.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-D4xXIj1P.js.gz +0 -0
- package/dist/client/assets/{diagram-UQ7AKVKN-C09N8-nE.js → diagram-UQ7AKVKN-BWhpL-35.js} +1 -1
- package/dist/client/assets/diagram-UQ7AKVKN-BWhpL-35.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-BWhpL-35.js.gz +0 -0
- package/dist/client/assets/{diagram-VSXAHHWV-mMv3O2zK.js → diagram-VSXAHHWV-DG9A7EgJ.js} +1 -1
- package/dist/client/assets/diagram-VSXAHHWV-DG9A7EgJ.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-DG9A7EgJ.js.gz +0 -0
- package/dist/client/assets/{diagram-VX7I27RA-B0aepUKS.js → diagram-VX7I27RA-L5PSvynM.js} +1 -1
- package/dist/client/assets/diagram-VX7I27RA-L5PSvynM.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-L5PSvynM.js.gz +0 -0
- package/dist/client/assets/{diagram-Z3DM3KII-BstqsbCO.js → diagram-Z3DM3KII-moBH7ruR.js} +1 -1
- package/dist/client/assets/diagram-Z3DM3KII-moBH7ruR.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-moBH7ruR.js.gz +0 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-CPINc9LK.js → ebnfDiagram-PWID7BFC-DEiGgcRP.js} +1 -1
- package/dist/client/assets/ebnfDiagram-PWID7BFC-DEiGgcRP.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-DEiGgcRP.js.gz +0 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-dUgaGLHP.js → erDiagram-RLTQ6QDP-BboIleYi.js} +1 -1
- package/dist/client/assets/erDiagram-RLTQ6QDP-BboIleYi.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-BboIleYi.js.gz +0 -0
- package/dist/client/assets/external-link-AZ3wjUg5.js +1 -0
- package/dist/client/assets/{flowDiagram-HODETNUW-4ottFlnS.js → flowDiagram-HODETNUW-COxz7Rda.js} +1 -1
- package/dist/client/assets/flowDiagram-HODETNUW-COxz7Rda.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-COxz7Rda.js.gz +0 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CZOkoivd.js → ganttDiagram-EL5Y4UJY-_XdRvgyZ.js} +1 -1
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-_XdRvgyZ.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-_XdRvgyZ.js.gz +0 -0
- package/dist/client/assets/{git-compare-C7n2uha2.js → git-compare-90v75Jal.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-kh9xx53r.js → gitGraphDiagram-WWUBYQGX-CBb9xBNW.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CBb9xBNW.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CBb9xBNW.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-bfj9dYEg.css → index-nIgxJ6I3.css} +1 -1
- package/dist/client/assets/index-nIgxJ6I3.css.br +0 -0
- package/dist/client/assets/{index-bfj9dYEg.css.gz → index-nIgxJ6I3.css.gz} +0 -0
- package/dist/client/assets/{infoDiagram-27XIBGKW-zRkMruS-.js → infoDiagram-27XIBGKW-DjLdeNZi.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-DPntAz12.js → ishikawaDiagram-5VMMS53U-Bcr-lhIE.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-Bcr-lhIE.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-Bcr-lhIE.js.gz +0 -0
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-B074bD6a.js → journeyDiagram-3NMN7TZE-3vK6s9Pq.js} +1 -1
- package/dist/client/assets/journeyDiagram-3NMN7TZE-3vK6s9Pq.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-3vK6s9Pq.js.gz +0 -0
- package/dist/client/assets/{kanban-definition-UXKFOSKX-wPbpE7ij.js → kanban-definition-UXKFOSKX-DqDYDca0.js} +1 -1
- package/dist/client/assets/kanban-definition-UXKFOSKX-DqDYDca0.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-DqDYDca0.js.gz +0 -0
- package/dist/client/assets/{layout-D-nTHjVE.js → layout-C7_WwzCP.js} +1 -1
- package/dist/client/assets/layout-C7_WwzCP.js.br +0 -0
- package/dist/client/assets/layout-C7_WwzCP.js.gz +0 -0
- package/dist/client/assets/{linear-BVxgfw5H.js → linear-BQCRhl6P.js} +1 -1
- package/dist/client/assets/linear-BQCRhl6P.js.br +0 -0
- package/dist/client/assets/linear-BQCRhl6P.js.gz +0 -0
- package/dist/client/assets/{link-D-fkBp5k.js → link-Cq14tNBm.js} +3 -3
- package/dist/client/assets/link-Cq14tNBm.js.br +0 -0
- package/dist/client/assets/link-Cq14tNBm.js.gz +0 -0
- package/dist/client/assets/{list-tree-DKTcSR9r.js → list-tree-C281zrdg.js} +1 -1
- package/dist/client/assets/{loader-circle-DZn9iP0u.js → loader-circle-Df0zpx5N.js} +1 -1
- package/dist/client/assets/{maximize-2-dFjMEqgh.js → maximize-2-CovPxWdw.js} +1 -1
- package/dist/client/assets/{mermaid.core-D89ctjDO.js → mermaid.core-DGsccxt-.js} +5 -5
- package/dist/client/assets/mermaid.core-DGsccxt-.js.br +0 -0
- package/dist/client/assets/mermaid.core-DGsccxt-.js.gz +0 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-1TrbOKNK.js → mindmap-definition-YA3MSWOX-l0eF1PQE.js} +1 -1
- package/dist/client/assets/mindmap-definition-YA3MSWOX-l0eF1PQE.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-l0eF1PQE.js.gz +0 -0
- package/dist/client/assets/{passwordBootstrap-8XHlXyYk.js → passwordBootstrap-B5VzheZz.js} +2 -2
- package/dist/client/assets/passwordBootstrap-B5VzheZz.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-B5VzheZz.js.gz +0 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-CJYo1Bz4.js → pegDiagram-XKGWAZYB-fRrxGIDM.js} +1 -1
- package/dist/client/assets/pegDiagram-XKGWAZYB-fRrxGIDM.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-fRrxGIDM.js.gz +0 -0
- package/dist/client/assets/{pieDiagram-E7YTZNPT-DyE6_2FS.js → pieDiagram-E7YTZNPT-B-EBa3qN.js} +1 -1
- package/dist/client/assets/pieDiagram-E7YTZNPT-B-EBa3qN.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-B-EBa3qN.js.gz +0 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-OgNN7-oZ.js → quadrantDiagram-AXDQQJYC-Dj4e6f4h.js} +1 -1
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-Dj4e6f4h.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-Dj4e6f4h.js.gz +0 -0
- package/dist/client/assets/{quote-QwQvV6RF.js → quote-COQfrXhi.js} +1 -1
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-Dmqw_B10.js → railroadDiagram-O6MQD6OU-CEMppxTC.js} +1 -1
- package/dist/client/assets/railroadDiagram-O6MQD6OU-CEMppxTC.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-CEMppxTC.js.gz +0 -0
- package/dist/client/assets/{rdpSession-tgxFIJYE.js → rdpSession-C5rS-ImV.js} +1 -1
- package/dist/client/assets/rdpSession-C5rS-ImV.js.br +0 -0
- package/dist/client/assets/rdpSession-C5rS-ImV.js.gz +0 -0
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-nZK7--1f.js → requirementDiagram-BXWQKSXE-Dri1k4_x.js} +1 -1
- package/dist/client/assets/requirementDiagram-BXWQKSXE-Dri1k4_x.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-Dri1k4_x.js.gz +0 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-Db_TVWjx.js → sankeyDiagram-P5KCCOFB-CMsL_tYL.js} +1 -1
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-CMsL_tYL.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-CMsL_tYL.js.gz +0 -0
- package/dist/client/assets/search-Dg6HWygj.js +1 -0
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-B7TK9j0_.js → sequenceDiagram-WJ2MYXX4-4_4hZtOd.js} +1 -1
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-4_4hZtOd.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-4_4hZtOd.js.gz +0 -0
- package/dist/client/assets/{settings-2-9tlRImVo.js → settings-2-iGqzPez0.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-roX-pGgF.js → sizeCapture-INFHLROL-3QA6qj2j.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-3QA6qj2j.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-3QA6qj2j.js.gz +0 -0
- package/dist/client/assets/{stateDiagram-D77RDMKH-BdBm0h1F.js → stateDiagram-D77RDMKH-90IFPhD9.js} +1 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-90IFPhD9.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-90IFPhD9.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CH-yvmL4.js +1 -0
- package/dist/client/assets/sun-BAMMjiA8.js +1 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-DUulb0LD.js → swimlanes-42K2YHIH-BuHieVWC.js} +1 -1
- package/dist/client/assets/swimlanes-42K2YHIH-BuHieVWC.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-BuHieVWC.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-P_rDqbtg.js +8 -0
- package/dist/client/assets/{syntaxHighlight-Bgt0lmWx.js → syntaxHighlight-Cz6TPDW9.js} +1 -1
- package/dist/client/assets/syntaxHighlight-Cz6TPDW9.js.br +0 -0
- package/dist/client/assets/syntaxHighlight-Cz6TPDW9.js.gz +0 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-CIQuxjVB.js → timeline-definition-24CTP7MA-C7FpaNwf.js} +1 -1
- package/dist/client/assets/timeline-definition-24CTP7MA-C7FpaNwf.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-C7FpaNwf.js.gz +0 -0
- package/dist/client/assets/{triangle-alert-LpKfIn7N.js → triangle-alert-Oj-OsZDw.js} +1 -1
- package/dist/client/assets/{unplug-CLBg6VOD.js → unplug-DN2SNXUL.js} +1 -1
- package/dist/client/assets/{vennDiagram-4TSXK5OY-CMRFApvJ.js → vennDiagram-4TSXK5OY-CxoHHVcs.js} +1 -1
- package/dist/client/assets/vennDiagram-4TSXK5OY-CxoHHVcs.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-CxoHHVcs.js.gz +0 -0
- package/dist/client/assets/{videoCompression-DjyAuV3i.js → videoCompression-rr2lu3uy.js} +1 -1
- package/dist/client/assets/videoCompression-rr2lu3uy.js.br +0 -0
- package/dist/client/assets/videoCompression-rr2lu3uy.js.gz +0 -0
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-BEb3x-zl.js → wardleyDiagram-VM6X3IG4-B4Hsh-Ad.js} +1 -1
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-B4Hsh-Ad.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-B4Hsh-Ad.js.gz +0 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-DUvoeYl2.js → xychartDiagram-S5SC5T6Z-CghzsxQv.js} +1 -1
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-CghzsxQv.js.br +0 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-DUvoeYl2.js.gz → xychartDiagram-S5SC5T6Z-CghzsxQv.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 +14 -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 +14 -7
- package/dist/server/federation/routeInvitations.js +5 -1
- 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/scripts/ensure-node-pty.cjs +22 -7
- package/scripts/postinstall.mjs +5 -4
- package/dist/client/assets/AndroidMirrorView-D9CMPmet.js.br +0 -0
- package/dist/client/assets/AndroidMirrorView-D9CMPmet.js.gz +0 -0
- package/dist/client/assets/App-CqLXOAnv.js +0 -178
- package/dist/client/assets/App-CqLXOAnv.js.br +0 -0
- package/dist/client/assets/App-CqLXOAnv.js.gz +0 -0
- package/dist/client/assets/ArchitecturePanel-Dlnd9PH-.js.br +0 -0
- package/dist/client/assets/ArchitecturePanel-Dlnd9PH-.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-BYb27GTC.js +0 -2
- package/dist/client/assets/ChangeWalkthroughPanel-BYb27GTC.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-BYb27GTC.js.gz +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-BJ_pbIlW.js +0 -1
- package/dist/client/assets/CollaborationMainWorkspace-BJ_pbIlW.js.br +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-BJ_pbIlW.js.gz +0 -0
- package/dist/client/assets/ComputerControlView-VNUyl2Gb.js.br +0 -0
- package/dist/client/assets/ComputerControlView-VNUyl2Gb.js.gz +0 -0
- package/dist/client/assets/DagPlayground-Bzu6gfYW.js +0 -1
- package/dist/client/assets/DagPlayground-Bzu6gfYW.js.br +0 -0
- package/dist/client/assets/DagPlayground-Bzu6gfYW.js.gz +0 -0
- package/dist/client/assets/DiffLab-CKBHu65J.js.br +0 -0
- package/dist/client/assets/DiffLab-CKBHu65J.js.gz +0 -0
- package/dist/client/assets/DiffReview-DAUBgpsh.js +0 -1
- package/dist/client/assets/DiffReview-DAUBgpsh.js.br +0 -0
- package/dist/client/assets/DiffReview-DAUBgpsh.js.gz +0 -0
- package/dist/client/assets/DiffReviewLab--PbhIP71.js.br +0 -0
- package/dist/client/assets/DiffReviewLab--PbhIP71.js.gz +0 -0
- package/dist/client/assets/DiffViewer-Cg3GhKcU.js.br +0 -0
- package/dist/client/assets/DiffViewer-Cg3GhKcU.js.gz +0 -0
- package/dist/client/assets/GitLoadingSkeleton-ieGTuTuO.js +0 -1
- package/dist/client/assets/GitLoadingSkeleton-ieGTuTuO.js.br +0 -0
- package/dist/client/assets/GitLoadingSkeleton-ieGTuTuO.js.gz +0 -0
- package/dist/client/assets/MarkdownPreview-b_bwDNcY.js.br +0 -0
- package/dist/client/assets/MarkdownPreview-b_bwDNcY.js.gz +0 -0
- package/dist/client/assets/ModelPreview-C9nka14O.js.br +0 -0
- package/dist/client/assets/ModelPreview-C9nka14O.js.gz +0 -0
- package/dist/client/assets/RecordingSaveDialog-1YvzwTzo.js.br +0 -0
- package/dist/client/assets/RecordingSaveDialog-1YvzwTzo.js.gz +0 -0
- package/dist/client/assets/RightSidebar-CCk8ovoK.js.br +0 -0
- package/dist/client/assets/RightSidebar-CCk8ovoK.js.gz +0 -0
- package/dist/client/assets/SessionChatView-DORRzcNq.js +0 -13
- package/dist/client/assets/SessionChatView-DORRzcNq.js.br +0 -0
- package/dist/client/assets/SessionChatView-DORRzcNq.js.gz +0 -0
- package/dist/client/assets/SessionResourceSidebar-De0sHmdG.js +0 -2
- package/dist/client/assets/SessionResourceSidebar-De0sHmdG.js.br +0 -0
- package/dist/client/assets/SessionResourceSidebar-De0sHmdG.js.gz +0 -0
- package/dist/client/assets/TodoWorkspace-BHHT954s.js +0 -1
- package/dist/client/assets/TodoWorkspace-BHHT954s.js.br +0 -0
- package/dist/client/assets/TodoWorkspace-BHHT954s.js.gz +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-CTqKSsYV.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-CTqKSsYV.js.gz +0 -0
- package/dist/client/assets/app-stNRNTO-.js +0 -37
- package/dist/client/assets/app-stNRNTO-.js.br +0 -0
- package/dist/client/assets/app-stNRNTO-.js.gz +0 -0
- package/dist/client/assets/arc-CcvWcKBR.js.br +0 -0
- package/dist/client/assets/arc-CcvWcKBR.js.gz +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-B_2ae8Tt.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-B_2ae8Tt.js.gz +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-CGXUOwJg.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-CGXUOwJg.js.gz +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-BSU3omYQ.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-BSU3omYQ.js.gz +0 -0
- package/dist/client/assets/channel-CREmT4wq.js +0 -1
- package/dist/client/assets/chunk-F27PBJKO-CP85XeHB.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-CP85XeHB.js.gz +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-BjTbac0d.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-BjTbac0d.js.gz +0 -0
- package/dist/client/assets/chunk-SVP7TREG-Dde8KTpr.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-Dde8KTpr.js.gz +0 -0
- package/dist/client/assets/chunk-TICWLB2K-DIBgH5zV.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-DIBgH5zV.js.gz +0 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-CTHA5GVu.js +0 -1
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-CTHA5GVu.js +0 -1
- package/dist/client/assets/clipboardText-B0NK9NMn.js +0 -1
- package/dist/client/assets/clipboardText-B0NK9NMn.js.br +0 -0
- package/dist/client/assets/clipboardText-B0NK9NMn.js.gz +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-v4utSIkX.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-v4utSIkX.js.gz +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-BdbtIufa.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-BdbtIufa.js.gz +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-B9EVx2-N.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-B9EVx2-N.js.gz +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-Do2YjWuC.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-Do2YjWuC.js.gz +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-BnJa3bbo.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-BnJa3bbo.js.gz +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-C09N8-nE.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-C09N8-nE.js.gz +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-mMv3O2zK.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-mMv3O2zK.js.gz +0 -0
- package/dist/client/assets/diagram-VX7I27RA-B0aepUKS.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-B0aepUKS.js.gz +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-BstqsbCO.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-BstqsbCO.js.gz +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-CPINc9LK.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-CPINc9LK.js.gz +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-dUgaGLHP.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-dUgaGLHP.js.gz +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-4ottFlnS.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-4ottFlnS.js.gz +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-CZOkoivd.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-CZOkoivd.js.gz +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-kh9xx53r.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-kh9xx53r.js.gz +0 -0
- package/dist/client/assets/index-bfj9dYEg.css.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-DPntAz12.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-DPntAz12.js.gz +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-B074bD6a.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-B074bD6a.js.gz +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-wPbpE7ij.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-wPbpE7ij.js.gz +0 -0
- package/dist/client/assets/layout-D-nTHjVE.js.br +0 -0
- package/dist/client/assets/layout-D-nTHjVE.js.gz +0 -0
- package/dist/client/assets/linear-BVxgfw5H.js.br +0 -0
- package/dist/client/assets/linear-BVxgfw5H.js.gz +0 -0
- package/dist/client/assets/link-D-fkBp5k.js.br +0 -0
- package/dist/client/assets/link-D-fkBp5k.js.gz +0 -0
- package/dist/client/assets/mermaid.core-D89ctjDO.js.br +0 -0
- package/dist/client/assets/mermaid.core-D89ctjDO.js.gz +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-1TrbOKNK.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-1TrbOKNK.js.gz +0 -0
- package/dist/client/assets/passwordBootstrap-8XHlXyYk.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-8XHlXyYk.js.gz +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-CJYo1Bz4.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-CJYo1Bz4.js.gz +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-DyE6_2FS.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-DyE6_2FS.js.gz +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-OgNN7-oZ.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-OgNN7-oZ.js.gz +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Dmqw_B10.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Dmqw_B10.js.gz +0 -0
- package/dist/client/assets/rdpSession-tgxFIJYE.js.br +0 -0
- package/dist/client/assets/rdpSession-tgxFIJYE.js.gz +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-nZK7--1f.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-nZK7--1f.js.gz +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-Db_TVWjx.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-Db_TVWjx.js.gz +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-B7TK9j0_.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-B7TK9j0_.js.gz +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-roX-pGgF.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-roX-pGgF.js.gz +0 -0
- package/dist/client/assets/sparkles-B64EiCUM.js +0 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-BdBm0h1F.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-BdBm0h1F.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-ClZ2Tfz8.js +0 -1
- package/dist/client/assets/sun-BFxiDkET.js +0 -1
- package/dist/client/assets/swimlanes-42K2YHIH-DUulb0LD.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-DUulb0LD.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CGI6rSok.js +0 -8
- package/dist/client/assets/syntaxHighlight-Bgt0lmWx.js.br +0 -0
- package/dist/client/assets/syntaxHighlight-Bgt0lmWx.js.gz +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-CIQuxjVB.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-CIQuxjVB.js.gz +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-CMRFApvJ.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-CMRFApvJ.js.gz +0 -0
- package/dist/client/assets/videoCompression-DjyAuV3i.js.br +0 -0
- package/dist/client/assets/videoCompression-DjyAuV3i.js.gz +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-BEb3x-zl.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-BEb3x-zl.js.gz +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-DUvoeYl2.js.br +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-BltjUFwI.js","assets/app-DuUnqxq-.js","assets/dnd-BCFAPC0L.js","assets/terminal-Dea8wJF3.js","assets/index-nIgxJ6I3.css","assets/MarkdownPreview-CsJGsDRL.js","assets/use-gesture-react.esm-DYpdiE_k.js","assets/swiper-DJjq1TYT.js","assets/swiper-C2J0D0kV.css","assets/syntaxHighlight-Cz6TPDW9.js","assets/list-tree-C281zrdg.js","assets/GitLoadingSkeleton-DYrDIDF1.js","assets/RecordingSaveDialog-DUtwgIME.js","assets/gestureArbiter-DszagC-d.js","assets/arrow-up-DNkfesW0.js","assets/DiffReview-12E2zWyL.js","assets/DiffViewer-DqcQxp4Q.js","assets/git-compare-90v75Jal.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-Oj-OsZDw.js","assets/ChangeWalkthroughPanel-DO_zJfZr.js","assets/chevron-left-xqARwD-7.js","assets/maximize-2-CovPxWdw.js","assets/AndroidMirrorView-DW9oRr0w.js","assets/v4-EwEgHOG0.js","assets/unplug-DN2SNXUL.js","assets/circle-DGZOpG8V.js","assets/loader-circle-Df0zpx5N.js","assets/search-Dg6HWygj.js","assets/arrow-down-FGzRy9D-.js","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{aV as ba,a5 as Bo,cg as g,dm as va,aY as Er,o as _a,eb as wa,a4 as Sa,ao as ka,C as $a,d1 as Oa,p as ja}from"./app-DuUnqxq-.js";import{b as w,r as xa}from"./dnd-BCFAPC0L.js";import{C as jt}from"./SessionChatView-CdKfHRp8.js";import{C as Aa}from"./circle-DGZOpG8V.js";import{S as Ea}from"./search-Dg6HWygj.js";import{E as za}from"./external-link-AZ3wjUg5.js";import"./react-XDCjal2T.js";import"./terminal-Dea8wJF3.js";import"./quote-COQfrXhi.js";import"./clipboardText-cZXParp1.js";import"./loader-circle-Df0zpx5N.js";import"./arrow-down-FGzRy9D-.js";import"./arrow-up-DNkfesW0.js";const Ia=[["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"}]],Ta=ba("arrow-down-up",Ia),Ra=globalThis;Ra[Symbol.for("openui.devtools.autoMount")]=!0;const Na=2e3;function Pa(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 Ca(e){return $n(e?.OPENUI_TELEMETRY_DISABLED)||$n(e?.DO_NOT_TRACK)}function Za(e){return $n(e?.OPENUI_RUNTIME_TELEMETRY_ENABLED)&&!Ca(e)}function qo(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=>Yo(n)).join(t)}function jn(e,t){return typeof t=="bigint"?t.toString():t}class Ma{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 Ma(e)}function Da(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 Ua(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 Jo(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ke(e){return Jo(e._zod.def)??e._zod.def.shape}function Vo(e,t,n){Object.defineProperty(e,t,{get(){const r=n();return $e(this,t,r),r},enumerable:!0,configurable:!0})}function Ko(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?Vo(e,s,()=>{const a=t._zod.def.shape[s];return r?r(a,s):a}):Ko(e,s,r?r(i.value,s):i.value))}}function Fa(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Vo(e,n,()=>t[n]):Ko(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 La(e){return JSON.stringify(e)}function Ba(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Wo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function xt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const qa=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 Qo(e){return Le(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Ja=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 Yo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Va(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const Go={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]},Ka={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Wa(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 Qa(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 Ya(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:Ho(e,t)}))}function Ho(e,t){const n={};return Ce(n,e,Reflect.ownKeys(ke(e))),Fa(n,t),n}function Ga(e,t){if(!Le(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Oe(e,ue(e._zod.def,{shape:Ho(e,t)}))}function Ha(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 Xa(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 eu(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 tu=/[\uD800-\uDBFF]/;function Gn(e){const t=e.length;if(!tu.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 nu(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 ru(e,t){for(const n in t){const r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):ou(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 Xo(e,t,n){return ze(e,t,n,!1)}function es(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 ou(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 su(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}let cn,xe=!1;const iu={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,iu);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 au(e,t,n,r){const o=su(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 uu="~constantCatch";function cu(e){const t=()=>e;return t[uu]=!0,t}var Nr;const ln={value:void 0,enumerable:!1};let Pr="captureStackTrace"in Error?Error:null;function lu(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),ru(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?lu(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 ts 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 fu(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,jn,2)),e.message}function du(e){this._zod.message=e}const pu={get:fu,set:du,enumerable:!0,configurable:!0},fn={value:void 0,enumerable:!1},Cr=new WeakSet([Object.prototype,Error.prototype]),mu=(e,t)=>{e.name="$ZodError",fn.value=t,Object.defineProperty(e,"issues",fn),fn.value=void 0,Object.defineProperty(e,"message",pu);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})}}))},hu=b("$ZodError",mu);function gu(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 yu(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?gu(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function bu(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 Wo(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 Wo(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?ns(e,s.issues,o):{success:!0,data:s.value}};function ns(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?ns(e,s.issues,o):{success:!0,data:s.value}},vu=Symbol.for("zod.compile.invalid"),_u=Symbol.for("zod.compile.fallback"),wu=((e,t,n)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==vu)return!0;if(r.definite===!0&&n===void 0)return!1}return Su(e,t,n)});function Su(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[_u]=!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 ku=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},$u=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},Ou=e=>{const t=Xn(e),n=(r,o,s,i)=>t(r,o,s,Qt(n,i));return n},ju=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},xu=e=>{const t=er(e),n=async(r,o,s,i)=>await t(r,o,s,Qt(n,i));return n},Au=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return tr(e)(t,n,o)},Eu=e=>(t,n,r)=>tr(e)(t,n,r),zu=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return nr(e)(t,n,o)},Iu=e=>async(t,n,r)=>nr(e)(t,n,r),Tu=/^[cC][0-9a-z]{6,}$/,Ru=/^[0-9a-z]+$/,Nu=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Pu=/^[0-9a-vA-V]{20}$/,Cu=/^[A-Za-z0-9]{27}$/,Zu=/^[a-zA-Z0-9_-]{21}$/;function Mu(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Du=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Uu=/^([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)$/,Fu=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Lu="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Bu(){return new RegExp(Lu,"u")}const qu=/^(?:(?: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])$/,Ju=/^(([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}|:))$/,Vu=/^((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])$/,Ku=/^(([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])$/,Wu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qu=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Yu=/^https?$/,Gu=/^\+[1-9]\d{6,14}$/,rs="(?:(?:\\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 Hu(e){return new RegExp(`^${e}$`)}const Xu=Hu(rs);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 ec(e){return new RegExp(`^${An(e)}$`)}function tc(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(`^${rs}T(?:${r})$`)}const nc=/^[\s\S]{0,}$/,rc=/^-?\d+$/,rr=/^-?\d+(?:\.\d+)?$/,oc=/^(?:true|false)$/i,sc=/^null$/i,ic=/^[^A-Z]*$/,ac=/^[^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!Da(t)&&t.length!==void 0},At={number:"number",bigint:"bigint",object:"date"},os=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})}}),ss=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})}}),uc=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):Ua(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})}}),cc=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]=Go[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})}}),lc=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})}}),fc=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})}}),dc=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=()=>{})}),pc=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})}}),mc=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ic),Yt.init(e,t)}),hc=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ac),Yt.init(e,t)}),gc=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})}}),yc=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})}}),bc=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})}}),vc=b("$ZodCheckOverwrite",(e,t)=>{le.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class _c{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 wc={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=wc;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(eu(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 Xo(this,"~standard",as(this))},set"~standard"(e){ze(this,"~standard",e)}}),is=(e,t)=>e.issues.length?{issues:e.issues.map(n=>Ee(n,t,_e()))}:{value:e.value};async function Sc(e,t){const n={async:!0};return is(await e._zod.run({value:t,issues:[]},n),n)}function as(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return is(r,n)}catch{}return Sc(e,t)},vendor:"zod",version:1}}const sr=b("$ZodString",(e,t)=>{q.init(e,t),e._zod.pattern=t.pattern??nc,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)}),kc=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Uu),V.init(e,t)}),$c=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)}),Oc=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Fu),V.init(e,t)}),us=1,Et=2;function cs(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function jc(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?cs(e)||Et:xc(e,t)}function xc(e,t){if(!t.normalize&&t.protocol?.source===Yu.source&&!/^https?:\/\//i.test(e))return us;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 Ac=/[\t\n\r]/g;function Mr(e){return e.replace(Ac,"")}function Ec(e,t){return t.lastIndex=0,t.test(e.hostname)}function zc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const Ic=b("$ZodURL",(e,t)=>{V.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=jc(r,t);if(o===us){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&&!Ec(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&&!zc(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})}}}),Tc=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Bu()),V.init(e,t)}),Rc=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?Zu:Mu(t.length)),V.init(e,t)}),Nc=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Tu),V.init(e,t)}),Pc=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ru),V.init(e,t)}),Cc=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Nu),V.init(e,t)}),Zc=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Pu),V.init(e,t)}),Mc=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cu),V.init(e,t)}),Dc=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=tc(t)),V.init(e,t)}),Uc=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Xu),V.init(e,t)}),Fc=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ec(t)),V.init(e,t)}),Lc=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Du),V.init(e,t)}),Bc=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=qu),V.init(e,t)}),qc=/^[0-9a-fA-F:.]+$/;function ls(e){return qc.test(e)?cs(`http://[${e}]`):!1}const Jc=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ju),V.init(e,t),e._zod.check=n=>{ls(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Vc=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Vu),V.init(e,t)});function Kc(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:ls(n)}const Wc=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ku),V.init(e,t),e._zod.check=n=>{Kc(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function fs(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const ds=/^[0-9a-zA-Z+/]*={0,2}$/,Qc=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ds),V.init(e,t),e._zod.check=n=>{fs(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),ir=/^[A-Za-z0-9_-]*$/;function Yc(e){if(!ir.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return fs(n)}const Gc=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ir),V.init(e,t),e._zod.check=n=>{Yc(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Hc=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Gu),V.init(e,t)});function Xc(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 el=b("$ZodJWT",(e,t)=>{V.init(e,t),e._zod.check=n=>{Xc(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ps=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}}),tl=b("$ZodNumberFormat",(e,t)=>{cc.init(e,t),ps.init(e,t)}),nl=b("$ZodBoolean",(e,t)=>{q.init(e,t),e._zod.pattern=oc,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}}),rl=b("$ZodNull",(e,t)=>{q.init(e,t),e._zod.pattern=sc,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}}),ol=b("$ZodAny",(e,t)=>{q.init(e,t),e._zod.parse=n=>n}),sl=b("$ZodUnknown",(e,t)=>{q.init(e,t),e._zod.parse=n=>n}),il=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 al(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 ul=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 cl=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},al(e,ul)});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 ll=[];function ms(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ll,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=Va(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function hs(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 fl=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(()=>ms(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?hs(f,p,c,l,o.value,e,m===!0):f.length?Promise.all(f).then(()=>c):c}}),dl=b("$ZodObjectJIT",(e,t)=>{fl.init(e,t);const n=e._zod.parse,r=Qn(()=>ms(t)),o=ye.memoizer,s=d=>{const m=r.value,h=m.symbolKeys,y=new _c(["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)}]`:La(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&&qa.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?hs([],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 pl=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)}}),ml=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 hl=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}}),gl=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=>Ja.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}}),yl=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}}),bl=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 ts(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 gs=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)}}),vl=b("$ZodExactOptional",(e,t)=>{gs.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)}),_l=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)}),wl=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 Sl=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))}),kl=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 $l=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)}}),Ol=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 jl=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 xl=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 Al extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const zn="~memo",Wr=[];function ys(e){return e!==null&&typeof e=="object"}function dn(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const bs=new WeakMap,He=0,vt=1,et=2;function _t(e,t,n){const r=bs.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=Jo(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),El(e,o)}function El(e,t){return t!==vt&&bs.set(e,t===et),t}function zl(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let lt;const ft=[],Il={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"&&Rl(s,o.value))throw new Al;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(!ys(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=zl(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 Tl(){return Il}function Rl(e,t){const n=e[zn]?.backEdges;return n!==void 0&&ys(t)&&n.has(t)}const Nl=()=>{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=nu(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 ${Yo(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 Pl(){return{localeError:Nl()}}var Qr;class Cl{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 vs(){return new Cl}(Qr=globalThis).__zod_globalRegistry??(Qr.__zod_globalRegistry=vs());const Ne=globalThis.__zod_globalRegistry;function _s(e){return e.checks&&(e.checks=[...e.checks]),e}function Zl(e,t){return new e(_s({type:"string",...A(t)}))}function Ml(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...A(t)})}function Dl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...A(t)})}function Ul(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...A(t)})}function Fl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(t)})}function Ll(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(t)})}function Bl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(t)})}function ql(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...A(t)})}function Jl(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...A(t)})}function Vl(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(t)})}function Kl(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...A(t)})}function Wl(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(t)})}function Ql(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...A(t)})}function Yl(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...A(t)})}function Gl(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(t)})}function Hl(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(t)})}function Xl(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(t)})}function ef(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(t)})}function tf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(t)})}function nf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...A(t)})}function rf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...A(t)})}function of(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...A(t)})}function sf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...A(t)})}function af(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(t)})}function uf(e,t){return new e({type:"string",format:"date",check:"string_format",...A(t)})}function cf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...A(t)})}function lf(e,t){return new e({type:"string",format:"duration",check:"string_format",...A(t)})}function ff(e,t){return new e(_s({type:"number",checks:[],...A(t)}))}function df(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...A(t)})}function pf(e,t){return new e({type:"boolean",...A(t)})}function mf(e,t){return new e({type:"null",...A(t)})}function hf(e){return new e({type:"any"})}function gf(e){return new e({type:"unknown"})}function yf(e,t){return new e({type:"never",...A(t)})}function Yr(e,t){return new os({check:"less_than",...A(t),value:e,inclusive:!1})}function pn(e,t){return new os({check:"less_than",...A(t),value:e,inclusive:!0})}function Gr(e,t){return new ss({check:"greater_than",...A(t),value:e,inclusive:!1})}function mn(e,t){return new ss({check:"greater_than",...A(t),value:e,inclusive:!0})}function Hr(e,t){return new uc({check:"multiple_of",...A(t),value:e})}function ws(e,t){return new lc({check:"max_length",...A(t),maximum:e})}function It(e,t){return new fc({check:"min_length",...A(t),minimum:e})}function Ss(e,t){return new dc({check:"length_equals",...A(t),length:e})}function bf(e,t){return new pc({check:"string_format",format:"regex",...A(t),pattern:e})}function vf(e){return new mc({check:"string_format",format:"lowercase",...A(e)})}function _f(e){return new hc({check:"string_format",format:"uppercase",...A(e)})}function wf(e,t){return new gc({check:"string_format",format:"includes",...A(t),includes:e})}function Sf(e,t){return new yc({check:"string_format",format:"starts_with",...A(t),prefix:e})}function kf(e,t){return new bc({check:"string_format",format:"ends_with",...A(t),suffix:e})}function Ve(e){return new vc({check:"overwrite",tx:e})}function $f(e){return Ve(t=>t.normalize(e))}function Of(){return Ve(e=>e.trim())}function jf(){return Ve(e=>e.toLowerCase())}function xf(){return Ve(e=>e.toUpperCase())}function Af(){return Ve(e=>Ba(e))}function Ef(e,t,n){return new e({type:"array",element:t,...A(n)})}function zf(e,t,n){return new e({type:"custom",check:"custom",fn:t,...A(n)})}function If(e,t){const n=Tf(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 Tf(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 ks(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;ks(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 $s=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(!$s.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 Rf(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const o of $s)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())ks(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)??[])Rf(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 Nf=(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)},Os=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},js=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},xs=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},As=(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)=>{As(t,n.format);const[r,o]=e[n.format];qe(t,"minimum",r),Je(t,"maximum",o)},Pf={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)=>Os(e,t.value),number_format:so(Go),bigint_format:so(Ka),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)=>{As(e,t.format),t.pattern&&js(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)=>xs(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)Pf[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&&Os(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&xs(t,o.mime);for(const s of o.patterns??[])js(t,s);return t}const Cf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Zf=new Map([[ds,Wu],[ir,Qu]]),Es=e=>Zf.get(e)??e,zs=(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=Cf[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(Es);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}))])}},Is=(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:_}))])}},Ts=(e,t,n,r)=>{n.type="boolean"},Mf=(e,t,n,r)=>{X(e,t,n,r,"BigInt cannot be represented in JSON Schema")},Df=(e,t,n,r)=>{X(e,t,n,r,"Symbols cannot be represented in JSON Schema")},Rs=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Uf=(e,t,n,r)=>{X(e,t,n,r,"Undefined cannot be represented in JSON Schema")},Ff=(e,t,n,r)=>{X(e,t,n,r,"Void cannot be represented in JSON Schema")},Ns=(e,t,n,r)=>{n.not={}},Ps=(e,t,n,r)=>{},Cs=(e,t,n,r)=>{},Lf=(e,t,n,r)=>{X(e,t,n,r,"Date cannot be represented in JSON Schema")},Zs=(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},Ms=(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},Bf=(e,t,n,r)=>{X(e,t,n,r,"NaN cannot be represented in JSON Schema")},qf=(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},Jf=(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})))},Vf=(e,t,n,r)=>{n.type="boolean"},Ds=(e,t,n,r)=>{X(e,t,n,r,"Custom types cannot be represented in JSON Schema")},Kf=(e,t,n,r)=>{X(e,t,n,r,"Function types cannot be represented in JSON Schema")},Us=(e,t,n,r)=>{X(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Wf=(e,t,n,r)=>{X(e,t,n,r,"Map cannot be represented in JSON Schema")},Qf=(e,t,n,r)=>{X(e,t,n,r,"Set cannot be represented in JSON Schema")},Fs=(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 Ls=(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)},Bs=(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},qs=(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)},Yf=(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:rc).source)),d}const Rn=new WeakMap;function Gf(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 Js=(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,Es(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(()=>Gf(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))}},Vs=(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"}]},Ks=(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 Ws(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 Qs=(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=Ws(o.defaultValue,e,t,n,r);i!==ar&&(n.default=i)},Ys=(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=Ws(o.defaultValue,e,t,n,r);i!==ar&&(n._prefault=i)},Gs=(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},Hs=(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},Xs=(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},Hf=(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},Xf=(e,t,n,r)=>{const o=e._zod.innerType;B(o,t,r);const s=t.seen.get(e);s.ref=o},io={string:zs,number:Is,boolean:Ts,bigint:Mf,symbol:Df,null:Rs,undefined:Uf,void:Ff,never:Ns,any:Ps,unknown:Cs,date:Lf,enum:Zs,literal:Ms,nan:Bf,template_literal:qf,file:Jf,success:Vf,custom:Ds,function:Kf,transform:Us,map:Wf,set:Qf,array:Fs,object:Ls,union:Bs,intersection:qs,tuple:Yf,record:Js,nullable:Vs,nonoptional:Ks,default:Qs,prefault:Ys,catch:Gs,pipe:Hs,readonly:Xs,promise:Hf,optional:ur,lazy:Xf};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 ed=(e,t)=>{hu.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);uo.has(n)||(uo.add(n),dt(n,"format",r=>o=>bu(r,o)),dt(n,"flatten",r=>o=>yu(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",ed,void 0,{Parent:Error}),td=Xn(me),nd=er(me),rd=tr(me),od=nr(me),sd=$u(me),id=Ou(me),ad=ju(me),ud=xu(me),cd=Au(me),ld=Eu(me),fd=zu(me),dd=Iu(me);function pd(){ye.localeError||_e(Pl())}function Gt(){ye.memoizer||_e({memoizer:Tl()})}const J=b("ZodType",(e,t)=>(pd(),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(pp(e,t))},superRefine(e,t){return this.check(mp(e,t))},overwrite(e){return this.check(Ve(e))},optional(){return po(this)},exactOptional(){return ep(this)},nullable(){return mo(this)},nullish(){return po(mo(this))},nonoptional(e){return ip(this,e)},array(){return ae(this)},or(e){return Ke([this,e])},and(e){return Qd(this,e)},transform(e){return ho(this,Xd(e))},default(e){return rp(this,e)},prefault(e){return sp(this,e)},catch(e){return up(this,e)},pipe(e){return ho(this,e)},readonly(){return fp(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 Xo(this,"~standard",{...as(this),jsonSchema:{input:Pt(this,"input"),output:Pt(this,"output")}})},set"~standard"(e){ze(this,"~standard",e)},parse:function e(t,n){return td(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await nd(this,t,n,{callee:e})},safeParse(e,t){return rd(this,e,t)},async safeParseAsync(e,t){return od(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ze(this,"spa",e)},validate(e,t){return wu(this,e,t)},validateAsync(e,t){return ku(this,e,t)},encode:function e(t,n){return sd(this,t,n,{callee:e})},decode:function e(t,n){return id(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ad(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ud(this,t,n,{callee:e})},safeEncode(e,t){return cd(this,e,t)},safeDecode(e,t){return ld(this,e,t)},async safeEncodeAsync(e,t){return fd(this,e,t)},async safeDecodeAsync(e,t){return dd(this,e,t)},toJSONSchema(e){return Nf(this,{})(e)},get description(){return Ne.get(this)?.description},get _def(){return this._zod.def}}),ei=b("_ZodString",(e,t)=>{sr.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zs(e,n,r)},es({format:e=>pe(e).format??null,minLength:e=>pe(e).minimum??null,maxLength:e=>pe(e).maximum??null},{regex(...e){return this.check(bf(...e))},includes(...e){return this.check(wf(...e))},startsWith(...e){return this.check(Sf(...e))},endsWith(...e){return this.check(kf(...e))},min(...e){return this.check(It(...e))},max(...e){return this.check(ws(...e))},length(...e){return this.check(Ss(...e))},nonempty(...e){return this.check(It(1,...e))},lowercase(e){return this.check(vf(e))},uppercase(e){return this.check(_f(e))},trim(){return this.check(Of())},normalize(...e){return this.check($f(...e))},toLowerCase(){return this.check(jf())},toUpperCase(){return this.check(xf())},slugify(){return this.check(Af())}})),md=b("ZodString",(e,t)=>{sr.init(e,t),ei.init(e,t)},{email(e){return this.check(Ml(vd,e))},url(e){return this.check(ql(wd,e))},jwt(e){return this.check(sf(Cd,e))},emoji(e){return this.check(Jl(Sd,e))},guid(e){return this.check(Dl(_d,e))},uuid(e){return this.check(Ul(pt,e))},uuidv4(e){return this.check(Fl(pt,e))},uuidv6(e){return this.check(Ll(pt,e))},uuidv7(e){return this.check(Bl(pt,e))},nanoid(e){return this.check(Vl(kd,e))},cuid(e){return this.check(Kl($d,e))},cuid2(e){return this.check(Wl(Od,e))},ulid(e){return this.check(Ql(jd,e))},base64(e){return this.check(nf(Rd,e))},base64url(e){return this.check(rf(Nd,e))},xid(e){return this.check(Yl(xd,e))},ksuid(e){return this.check(Gl(Ad,e))},ipv4(e){return this.check(Hl(Ed,e))},ipv6(e){return this.check(Xl(zd,e))},cidrv4(e){return this.check(ef(Id,e))},cidrv6(e){return this.check(tf(Td,e))},e164(e){return this.check(of(Pd,e))},datetime(e){return this.check(af(hd,e))},date(e){return this.check(uf(gd,e))},time(e){return this.check(cf(yd,e))},duration(e){return this.check(lf(bd,e))}});function oe(e){return Zl(md,e)}const K=b("ZodStringFormat",(e,t)=>{V.init(e,t),ei.init(e,t)}),hd=b("ZodISODateTime",(e,t)=>{Dc.init(e,t),K.init(e,t)}),gd=b("ZodISODate",(e,t)=>{Uc.init(e,t),K.init(e,t)}),yd=b("ZodISOTime",(e,t)=>{Fc.init(e,t),K.init(e,t)}),bd=b("ZodISODuration",(e,t)=>{Lc.init(e,t),K.init(e,t)}),vd=b("ZodEmail",(e,t)=>{Oc.init(e,t),K.init(e,t)}),_d=b("ZodGUID",(e,t)=>{kc.init(e,t),K.init(e,t)}),pt=b("ZodUUID",(e,t)=>{$c.init(e,t),K.init(e,t)}),wd=b("ZodURL",(e,t)=>{Ic.init(e,t),K.init(e,t)}),Sd=b("ZodEmoji",(e,t)=>{Tc.init(e,t),K.init(e,t)}),kd=b("ZodNanoID",(e,t)=>{Rc.init(e,t),K.init(e,t)}),$d=b("ZodCUID",(e,t)=>{Nc.init(e,t),K.init(e,t)}),Od=b("ZodCUID2",(e,t)=>{Pc.init(e,t),K.init(e,t)}),jd=b("ZodULID",(e,t)=>{Cc.init(e,t),K.init(e,t)}),xd=b("ZodXID",(e,t)=>{Zc.init(e,t),K.init(e,t)}),Ad=b("ZodKSUID",(e,t)=>{Mc.init(e,t),K.init(e,t)}),Ed=b("ZodIPv4",(e,t)=>{Bc.init(e,t),K.init(e,t)}),zd=b("ZodIPv6",(e,t)=>{Jc.init(e,t),K.init(e,t)}),Id=b("ZodCIDRv4",(e,t)=>{Vc.init(e,t),K.init(e,t)}),Td=b("ZodCIDRv6",(e,t)=>{Wc.init(e,t),K.init(e,t)}),Rd=b("ZodBase64",(e,t)=>{Qc.init(e,t),K.init(e,t)}),Nd=b("ZodBase64URL",(e,t)=>{Gc.init(e,t),K.init(e,t)}),Pd=b("ZodE164",(e,t)=>{Hc.init(e,t),K.init(e,t)}),Cd=b("ZodJWT",(e,t)=>{el.init(e,t),K.init(e,t)}),ti=b("ZodNumber",(e,t)=>{ps.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Is(e,n,r,o),e.isFinite=!0},es({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 ff(ti,e)}const Zd=b("ZodNumberFormat",(e,t)=>{tl.init(e,t),ti.init(e,t)});function co(e){return df(Zd,e)}const Md=b("ZodBoolean",(e,t)=>{nl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ts(e,n,r)});function wt(e){return pf(Md,e)}const Dd=b("ZodNull",(e,t)=>{rl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rs(e,n,r)});function Ud(e){return mf(Dd,e)}const Fd=b("ZodAny",(e,t)=>{ol.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ps()});function Se(){return hf(Fd)}const Ld=b("ZodUnknown",(e,t)=>{sl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cs()});function lo(){return gf(Ld)}const Bd=b("ZodNever",(e,t)=>{il.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ns(e,n,r)});function qd(e){return yf(Bd,e)}const Jd=b("ZodArray",(e,t)=>{Gt(),cl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fs(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(ws(e,t))},length(e,t){return this.check(Ss(e,t))},unwrap(){return this.element}});function ae(e,t){return Ef(Jd,e,t)}const Vd=b("ZodObject",(e,t)=>{Gt(),dl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ls(e,n,r,o),au(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:qd()}))},strip(){return this.clone(ue(this._zod.def,{catchall:void 0}))},extend(e){return Ya(this,e)},safeExtend(e){return Ga(this,e)},merge(e){return Ha(this,e)},pick(e){return Wa(this,e)},omit(e){return Qa(this,e)},partial(...e){return Tr(ni,this,e[0])},exactPartial(...e){return Tr(ri,this,e[0],"exactPartial")},required(...e){return Xa(oi,this,e[0])}});function P(e,t){const n={type:"object",shape:e??{},...A(t)};return new Vd(n)}const Kd=b("ZodUnion",(e,t)=>{pl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bs(e,n,r,o),e.options=t.options});function Ke(e,t){return new Kd({type:"union",options:e,...A(t)})}const Wd=b("ZodIntersection",(e,t)=>{ml.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qs(e,n,r,o)});function Qd(e,t){return new Wd({type:"intersection",left:e,right:t})}const fo=b("ZodRecord",(e,t)=>{Gt(),hl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Js(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Yd(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)=>{gl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Zs(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 Gd=b("ZodLiteral",(e,t)=>{yl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ms(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 Gd({type:"literal",values:Array.isArray(e)?e:[e],...A(t)})}const Hd=b("ZodTransform",(e,t)=>{Gt(),bl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Us(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ts(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 Xd(e){return new Hd({type:"transform",transform:e})}const ni=b("ZodOptional",(e,t)=>{gs.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 ni({type:"optional",innerType:e})}const ri=b("ZodExactOptional",(e,t)=>{vl.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 ep(e){return new ri({type:"optional",innerType:e})}const tp=b("ZodNullable",(e,t)=>{_l.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 mo(e){return new tp({type:"nullable",innerType:e})}const np=b("ZodDefault",(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,e.removeDefault=e.unwrap});function rp(e,t){return new np({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Qo(t)}})}const op=b("ZodPrefault",(e,t)=>{Sl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ys(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sp(e,t){return new op({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Qo(t)}})}const oi=b("ZodNonOptional",(e,t)=>{kl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ks(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ip(e,t){return new oi({type:"nonoptional",innerType:e,...A(t)})}const ap=b("ZodCatch",(e,t)=>{$l.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function up(e,t){return new ap({type:"catch",innerType:e,catchValue:typeof t=="function"?t:cu(t)})}const cp=b("ZodPipe",(e,t)=>{Ol.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hs(e,n,r,o),e.in=t.in,e.out=t.out});function ho(e,t){return new cp({type:"pipe",in:e,out:t})}const lp=b("ZodReadonly",(e,t)=>{jl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function fp(e){return new lp({type:"readonly",innerType:e})}const dp=b("ZodCustom",(e,t)=>{xl.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ds(e,n,r,o)});function pp(e,t={}){return zf(dp,e,t)}function mp(e,t){return If(e,t)}const si=new WeakSet;function hp(e){si.add(e)}function Ue(e){return typeof e=="object"&&e!==null&&si.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 gp(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 ii(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 ai(e){return dr(We(e))==="array"}function yp(e){const t=ce(We(e));if(t?.type==="array")return t.element??t.innerType}function bp(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 vp(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 _p(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=wp(We(e),t);if(r)return n?`$binding<${r}>`:r}function wp(e,t){const n=typeof e=="object"&&e!==null&&Zt.get(e);if(n)return`@${n}`;const r=vp(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(ai(e)){const u=yp(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=bp(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=_p(e);return a?`{${Object.entries(a).map(([u,c])=>{const l=ii(c)?"?":"",p=Re(c,t);return p?`${u}${l}: ${p}`:`${u}${l}`}).join(", ")}}`:"any"}function Sp(e,t){return Object.entries(e).map(([n,r])=>({name:n,isOptional:ii(r),isArray:ai(r),typeAnnotation:Re(r,t)}))}function kp(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=kp(e,Sp(t._zod.def.shape,r)),s=n&&Re(n,r);return s?`${o} → ${s}`:o}const he=e=>{throw new Error(`[extend] ${e}`)};function $p(e,t){const n=Op(e,t.components),r=xp(n,jp(n));return{...e,id:void 0,components:Ep(n,r),componentGroups:Ip(e.componentGroups,n.removed),functions:[...e.functions??[],...t.functions?.add??[]],actions:[...e.actions??[],...t.actions?.add??[]]}}function Op(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 jp({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 xp(e,t){const n=new Map;for(const[r,o]of e.slotRequests)for(const s of o){const i=Ap(s,r,t,e.byName),a=n.get(i)??[];a.includes(r)||n.set(i,[...a,r])}return n}function Ap(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 Ep(e,t){const{byName:n,nameOf:r,removed:o}=e,s=new Map(n),i=new Map;for(const l of zp(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 $=ci(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 zp({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))ui(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 ui(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"&&ci(s,i,a=>ui(a,t,n,r))}}function ci(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));gp(n,r),Ue(n)&&hp(r);const o=Ne.get(n);return o&&Ne.add(r,o),r}function Ip(e,t){return e?.map(n=>({...n,components:n.components.filter(r=>!t.has(r))})).filter(n=>n.components.length)}function li(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 li(e.params,e.name),e.returns&&fr(e.returns,e.name),e}function Ye(e){li(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()}),fi=[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}],di=Object.fromEntries(fi.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 pi=()=>P({type:cr("open_url"),url:oe()}),mi=()=>P({type:cr("continue_conversation"),context:oe().optional()}),mr=Ke([pi(),mi(),P({type:oe(),params:Yd(oe(),Se()).optional()})]);lr(mr,"ActionExpression");function Tp(){return mr}const Dt={OpenUrl:{ref:Pn("OpenUrl",pi())},ToAssistant:{ref:Pn("ToAssistant",mi())}},hi={ActionExpression:mr,OpenUrl:Dt.OpenUrl.ref,ToAssistant:Dt.ToAssistant.ref},gi=[{...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}],yi=Object.fromEntries(gi.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([...fi.map(e=>[e.name,vo("function",e)]),...gi.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 Rp(e,t){return ot.get(e)?.kind==="action"||!1}const Me={Query:"Query",Mutation:"Mutation"};function st(e){return e in Me}const Np="lang_core_parser_parse_used",bi=.1,Pp="1.0.1",_o=Symbol.for("@openuidev/lang-core/telemetry/v1");async function Cp(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 Zp(){const e=globalThis.process;if(!(!e||typeof e!="object"))return e}function Mp(){const e=globalThis;return e.navigator?.product==="ReactNative"||!!(e.window&&e.document)}function Dp(){const e=globalThis.WorkerGlobalScope;return!!(e&&e.prototype.isPrototypeOf(globalThis))}function Up(){if(Mp())return;const e=globalThis,t=Zp();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(!Dp()&&(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 Fp(e){const t=e?.NODE_ENV;return t==="production"||t==="development"||t==="test"?t:"unknown"}function Lp(){const e=globalThis;return e[_o]??={runtimeId:globalThis.crypto.randomUUID()},e[_o]}function Bp(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 qp(e){if(!e)return;const t=await Bp(e)||e.env?.REPOSITORY_URL||e.cwd?.();return t&&qo(t)||void 0}function Jp(e){const t=qo(e);return t?Cp(t):Promise.reject(new TypeError("Repository identifier is empty"))}function Vp(e,t){return t.name!=="node"?Promise.resolve(void 0):(e.projectHash??=Promise.resolve().then(()=>qp(t.process)).then(n=>n?Jp(n):void 0).catch(()=>{}),e.projectHash)}async function Kp(e){if(!e.env)return{id:null,isCI:!1};try{const t=await Bo(()=>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 Wp(e,t,n){const r=Pa(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(Na)})}function Qp(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 Yp(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,...Qp(e)}}async function vi(e,t){const{state:n,runtime:r,environment:o}=e,[s,i]=await Promise.all([Vp(n,r),Kp(r)]);await Wp(Np,{distinct_id:n.runtimeId,$process_person_profile:!1,event_id:globalThis.crypto.randomUUID(),telemetry_schema_version:1,sdk_name:"@openuidev/lang-core",sdk_version:Pp,api_surface:"parser.parse",runtime:r.name,runtime_version:r.version,environment:o,ci:i.isCI,...i.id?{ci_name:i.id}:{},sample_rate:bi,...t,...s?{project_hash_version:1,project_hash:s}:{}},r)}function Gp(){try{const e=Up();if(!e||typeof globalThis.fetch!="function"||typeof globalThis.crypto?.randomUUID!="function"||typeof globalThis.AbortSignal?.timeout!="function")return;const t=e.env;return!Za(t)||Math.random()>=bi?void 0:{state:Lp(),runtime:e,environment:Fp(t)}}catch{return}}function Hp(e,t){if(e)try{const n=Yp(t);Promise.resolve().then(()=>vi(e,n)).catch(()=>{})}catch{}}function Xp(e){if(e)try{Promise.resolve().then(()=>vi(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 _i(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]=_i(s);return r}return{}}return null}const em="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 tm(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 nm(e,t){const n=[...Object.values(di).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 rm(){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 om(){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 wi="## Action — Button Behavior";function Si(e){return Object.values(yi).filter(t=>t.name==="Run"?e.toolCalls:t.name==="Set"||t.name==="Reset"?e.bindings:!0)}function sm(e,t){const n=[...Si(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)"),`${wi}
|
|
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 im(){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 am(){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 um(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 cm(){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 lm(){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 fm(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 dm(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 pm(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(dm(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=_i(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 ki=/[:|] @[A-Z]/;function mm(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=[...Si(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=>ki.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 hm(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")||ki.test(p.signature??"")),a=[];a.push(e.preamble??em),a.push(""),a.push(tm(t,{supportsExpressions:s,bindings:o})),a.push(""),a.push(mm(e,{toolCalls:r,bindings:o,usesActionExpression:i}));const u=Object.values(e.functions??{}).map(Lt);e.builtinFunctions??s?(a.push(""),a.push(nm(u,r))):u.length&&(a.push(""),a.push(`## Built-in Functions
|
|
247
|
+
|
|
248
|
+
${u.join(`
|
|
249
|
+
`)}`)),r&&(a.push(""),a.push(rm()),a.push(""),a.push(om()));const c=Object.values(e.actions??{}).map(p=>`- ${Lt(p)}`);i?(a.push(""),a.push(sm({toolCalls:r,bindings:o},c))):c.length&&(a.push(""),a.push(`${wi}
|
|
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(im())),r&&(a.push(""),a.push(lm())),e.tools?.length&&(a.push(""),a.push(pm(e.tools))),a.push(""),a.push(um(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(am())),e.inlineMode&&(a.push(""),a.push(cm())),a.push(fm(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 gm(){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=vs(),r=gm();for(const d of e.components)n.add(d.props,{id:d.name}),t[d.name]=d;for(const[d,m]of Object.entries(hi))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 hm({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($p(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:",ym=/^\]\]>openui:([a-z]+)(?:\?(.*))?$/,bm=/([^\n])(?=\]\]>openui:content(?:\?|\r?\n|$))/g,vm=/[^\n](\]\]>[a-z:]*)$/,$o=e=>{try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}};function _m(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 wm(e,{streaming:t}={}){let n=e.replace(bm,`$1
|
|
257
|
+
`);const r=t?vm.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=ym.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:_m(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 Sm(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 km=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:km.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 $m=1,Oo=2,jo=3,vn=4,Ge=5,_n=6,gt=7,xo=8,Om=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 $m;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 Om;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 jm=["string","number","boolean"],xm={},Am=[];function yr(e){return Array.isArray(e)?"array":typeof e}function $i(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function Oi(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function ji(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 Em(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=$i(t);if(n)return n;const r=ji(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 xi(e,t){return`${e}(${t.map(n=>{const r=Em(n.schema),o=n.required?`${n.name}*`:n.name;return r?`${o}: ${r}`:o}).join(", ")})`}function zm(e,t){const n=typeof e;return t.enumValues?!jm.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 Im(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:Im(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 Tm(e,t,n,r,o){return Oi(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 Ai(e){return(e.anyOf??e.oneOf??[e]).map($i)}function Rm(e,t){const n=Ai(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function Nm(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:xm,u=Array.isArray(t.required)?t.required:Am;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 Pm(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 Cm(e,t,n,r,o){const s=ji(t);if(s.expectedType==null&&s.enumValues==null||s.enumValues&&o.partial)return!1;const i=zm(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 Tm(e,s,n,r,o)?Y:e;if(Oi(s))return Rm(s,o)?(H(o,n,r,{code:"type-mismatch",expected:Ai(s).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),Y):e;const i=s.type;return i==="object"?Nm(e,s,n,r,o):i==="array"?Pm(e,s,n,r,o):Cm(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 Ei(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 zi(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:xi(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 Ii(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):zi(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:zi(i.name,i.args,a,t))??tn(i.args,a.params))});t.currentStatementId=r}function Ti(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:Ei(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=Ti(e,t,n);if(r)return r;if(Jt(e.name,t))return Ii(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 Ei(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=Ti(e,t,new Set);return a||Ii(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:xi(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 Sm(e)?Dn(e,t):e}}function Ri(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 Ni(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=Ni(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 Zm(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 Ni(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 Mm(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 Dm(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 Um(e){let t=!1;return gr(e,n=>{vr(n)&&(t=!0)}),t}function kt(e,t,n,r,o,s,i){const a=Mm(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)&&Um(O)&&(m=O)}const{stateDeclarations:h,queryStatements:y,mutationStatements:_}=Zm(t,f,i);f.currentStatementId=a?.id;const v=s??"";a?!d&&!m&&!Dm(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 Fm(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 Lm(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 Pi(e){return Lm(Fm(e.trim())).trim()}function Bm(e,t,n){const r=Pi(e);if(!r)return Vt();const{text:o,wasIncomplete:s}=Ri(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 qm(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=Pi(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}=Ri(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 Ci(e){const t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(const o of[...Object.keys(hi),...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 Jm(e,t){const n=Ci(e);return{parse(r){const o=Gp();try{const s=Bm(r,n,t);return Hp(o,s),s}catch(s){throw Xp(o),s}}}}function Vm(e,t){return qm(Ci(e),t)}function Km(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 Wm(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=Km(r.component,t.$defs?.[r.component]):r.code==="inline-reserved"&&(o.hint=`Declare as a top-level statement: myVar = ${r.component}(...)`),o})}function Zi(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=di[e.name];if(r)return r.lazy?eh(e.name,e.args,t,n):r.fn(_r(e,t));if(Rp(e.name))return Gm(e,t);const o=t.functions;if(o&&Object.prototype.hasOwnProperty.call(o,e.name))return Qm(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=Di(e,t,i.params);if(Ui(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 Fi.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]=Mi(i,t,n,a)}return{...e,props:o}}function Mi(e,t,n,r){return Bi(e,t,n,r,{recurseElement:o=>Kt(o,t,n),recurse:(o,s)=>Mi(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 Di(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 Ui(e,t){return!!t.required?.some(n=>e[n]==null&&qt(t.properties?.[n])===void 0)}function Qm(e,t,n,r){const o=Di(n,r,t.params);if(Ui(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 Ym(e){return Li({steps:e.flatMap(t=>wr(t)?t.steps:t!=null&&typeof t=="object"&&"type"in t?[t]:[])})}const Fi=new WeakSet;function Li(e){const t=n=>n?.type!=="custom_action"||Fi.has(n);return e.steps.every(t)?e:{...e,steps:e.steps.filter(t)}}function Gm(e,t){const{name:n,args:r}=e;if(n==="Action"){const i=r.length>0?Z(r[0],t):[];return Ym(Array.isArray(i)?i:[])}const o=yi[n],s=o.step?o.step(_r(e,t)):Hm(n,r);return{steps:s?[s]:[]}}function Hm(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=Xm(e.mappedProps,r)),o}case"Assign":return{...e,value:ie(e.value,t,n)};default:return e}}function Xm(e,t){const n={};for(const r in e)n[r]=t(e[r]);return n}function eh(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 Bi(e,t,n,r,o){const s=th(e,t,n,r,o);return wr(s)?Li(s):s}function th(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):Zi(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]=qi(c,a,n,l)}catch(p){o[s]=c,i(p instanceof Error?p.message:String(p))}}return{...e,props:o}}function nh(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 qi(e,t,n,r){return Bi(e,t.ctx,n,r,{recurseElement:o=>qn(o,t),recurse:(o,s)=>qi(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 rh(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 oh(e,t,n){const r=n!=null?"::"+Io(n):"";return e+"::"+Io(t)+r}function sh(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=oh(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 ih(e,t,n,r,o,s){if(Zi(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 ah(){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 uh(){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 ch=Symbol.for("openui.observability"),lh=globalThis,Ro=lh[ch]??=uh();function fh(e){return e.id??e.root??Object.keys(e.components).sort().join(",")}function dh(e){return Ji(hr(e))}let ph=0;function Ji(e,t=fh(e)){const n=e.extend;return Object.assign(e,{extend:(r=>Ji(n(r),`${t}:extend-${++ph}`))})}const Vi=w.createContext(null);function nn(){const e=w.useContext(Vi);if(!e)throw new Error("useOpenUI must be used within a <Renderer /> component.");return e}function mh(){return nn().renderNode}function hh(){return nn().triggerAction}const Ki=w.createContext(void 0);function Wi(){return w.useContext(Ki)}const gh="]]>openui:scripts",yh=/^\]\]>openui:content(?:\?.*)?\r?$(\n?)/m,bh=/^\]\]>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 vh(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 Qi(e,t){const n=e??"",r=yh.exec(n),o=!!r&&(!t||r[1]===`
|
|
272
|
+
`),{content:s,attributes:i,end:a}=wm(n.replace(bh,"$& "),{streaming:t});let u=s,c=!1,l=null;const p=No(u);if(p>=0&&u.startsWith(gh,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=vh(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 _h({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(...Wm(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",wh="streaming",Yi="settled";let Co=0;function Sh(){return typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID():(Co+=1,`openui-lang-${Date.now().toString(36)}-${Co.toString(36)}`)}function Gi(){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 kh(e,t,n,r=null,o=Sh){return t?(e.settled&&Object.assign(e,Gi()),e.id??=o(),e.hasPublishedStreamingSnapshot&&e.lastResponse===n?null:(e.hasPublishedStreamingSnapshot=!0,e.lastResponse=n,e.updateIndex+=1,{id:e.id,phase:wh,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:Yi,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 $h({response:e,isStreaming:t,result:n,errorsRef:r,errorRevision:o,publish:s=!0,__libraryId:i}){const a=w.useRef(Gi());w.useEffect(()=>{if(!s)return;const u=r.current,c=t?null:JSON.stringify(u),l=kh(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:Yi,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 Oh({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:o,initialState:s,toolProvider:i,onError:a,publishObservability:u},c){const l=w.useMemo(()=>Qi(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(()=>Vm(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(()=>ah(),[]),$=w.useMemo(()=>sh(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(ya=>ya.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]),pa=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=nh(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]),ma=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:ha,errorRevision:ga}=_h({response:l.program,isStreaming:n,result:O,evaluatedResult:Ar,library:t,querySnapshot:z,parseExceptionRef:E,runtimeErrorsRef:un,renderErrorsRef:Or,onError:a});return $h({response:l.program,isStreaming:n,result:O,errorsRef:ha,errorRevision:ga,publish:u,__libraryId:t.__libraryId}),{result:Ar,parseResult:O,contextValue:ma,isQueryLoading:sn,queryErrors:an,retryQueries:pa}}var jh=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 Hi(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:Hi(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(jh,{componentName:e.typeName,onError:n,children:g.jsx(xh,{el:e,Comp:r})}):null}function xh({el:e,Comp:t}){const n=mh();return g.jsx(t,{props:e.props,renderNode:n,statementId:e.statementId})}let Do=!1;function Ah(){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 Xi=()=>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 ea({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(()=>{Ah()},[]);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 rh(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}=Oh({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:o,initialState:s,toolProvider:a!=null?m.current:null,onError:l,publishObservability:p},Hi);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(Vi.Provider,{value:_,children:g.jsx(ta.Provider,{value:$,children:c})})}const ta=w.createContext(null);function rn(){const e=w.useContext(ta);if(!e)throw new Error("Renderer slots must be used within Renderer.Root or Renderer.");return e}function na(){return rn().query}function Eh({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 zh({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(Xi,{}):e})}function Ih({children:e}){const{errors:t}=na();return t.length===0?null:g.jsx(g.Fragment,{children:e})}function Th({children:e,onClick:t,disabled:n,...r}){const{retry:o,isLoading:s,errors:i}=na(),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 Rh(){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(Xi,{})),g.jsx("div",{style:{opacity:t.isLoading?.7:1,transition:"opacity 0.2s ease"},children:g.jsx(Sr,{node:e})})]}):null}function Nh({children:e,...t}){return g.jsx(ea,{...t,children:e===void 0?g.jsx(Rh,{}):e})}const Kn=Object.assign(Nh,{Root:ea,Content:Eh,QueryLoading:zh,QueryError:Ih,Retry:Th});function Ph(e,t){const n=nn(),r=Wi();return ih(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 ra=w.createContext(null);function oa(){const e=w.useContext(ra);if(!e)throw new Error("Preview slots must be used within WithPreviewRenderer.Root or WithPreviewRenderer.");return e}function sa(){return oa().state}function ia({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(()=>Qi(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(ra.Provider,{value:{state:_,rendererProps:s},children:o})}function aa({children:e,onClick:t,disabled:n,...r}){const{metadata:o,isOpen:s,isStreaming:i,contentId:a,open:u,close:c}=sa();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 ua({children:e,onClick:t,disabled:n,...r}){const{metadata:o,close:s}=sa();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 ca({children:e,style:t,...n}){const{state:r,rendererProps:o}=oa();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(ua,{}),g.jsx(Kn,{...o})]}):g.jsx(Kn,{...o,children:e})}):null}function Ch({children:e,...t}){return g.jsx(ia,{...t,children:e===void 0?g.jsxs(g.Fragment,{children:[g.jsx(aa,{}),g.jsx(ca,{})]}):e})}Object.assign(Ch,{Root:ia,Trigger:aa,Content:ca,Close:ua});const Uo=oe().max(16e3),W=oe().max(160),$t=oe().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),Zh=Ke([oe().max(4e3),re().finite(),wt(),Ud()]),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(Zh).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:Tp().optional()}),Resource:P({label:W,kind:De(["file","link"]),target:oe().max(4096),description:W.optional()})},la=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(la.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}),fa=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}),Mh=en({name:"Stack",description:"Root vertical layout of answer components.",props:P({content:ae(Ke([kr,$r.ref,fa.ref])).max(40)}),component:null}),Ot=hr({id:"termdock-chat@1",root:"Stack",components:[...la,$r,fa,Mh]}),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 Dh(e,t,n,r){const o=`termdock:chat-ui:${va()?.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 Uh(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",Lo="grid min-w-0 grid-cols-[repeat(auto-fit,minmax(min(100%,12rem),1fr))] gap-x-6 gap-y-4 [&>*:not([data-chat-metric])]:col-span-full",Fh=w.lazy(()=>Bo(()=>import("./RightSidebar-BltjUFwI.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 da({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(Ea,{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",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-1 font-medium",children:g.jsxs("button",{type:"button",className:"group inline-flex min-h-11 items-center gap-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:min-h-9",onClick:()=>i({column:c,direction:s?.column===c?-s.direction:1}),children:[u,g.jsx(Ta,{size:12,className:s?.column===c?"text-primary":"text-muted-foreground opacity-50 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-visible:opacity-100"})]})},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-40 max-w-sm whitespace-pre-wrap break-words px-3 py-3 align-top leading-6 sm:py-2.5",children:String(u[p]??"")},p))},c))})]}),!a.length&&g.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"没有匹配的内容"})]})]})}function Lh({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(da,{columns:["项目",...n.map(h=>h.name)],rows:t.map((h,y)=>[h,...n.map(_=>_.values[y]??null)])})]})]})}function Bh({type:e,props:t}){const{canWrite:n}=w.useContext(on),r=String(t.name),o=String(t.label),s=Ph(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 qh({props:e}){const{canWrite:t}=w.useContext(on),n=hh(),r=Wi();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 Jh({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(ja,{size:18}):g.jsx(za,{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 Vh({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("dl",{"data-chat-metric":!0,className:"min-w-0 space-y-1 py-1",children:[g.jsx("dt",{className:"text-xs text-muted-foreground",children:String(t.label)}),g.jsxs("dd",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[g.jsx("span",{className:"break-words text-xl font-semibold leading-7 tabular-nums",children:String(t.value)}),!!t.detail&&g.jsx("span",{className:"text-xs leading-5 text-muted-foreground",children:String(t.detail)})]})]});if(e==="Callout")return g.jsxs("aside",{className:`min-w-0 rounded-r-lg border-l-2 bg-surface px-3 py-2.5 ${t.tone==="warning"?"border-warning":t.tone==="success"?"border-primary":"border-accent"}`,children:[g.jsx("p",{className:"mb-1 text-xs font-medium",children:String(t.title)}),g.jsx(jt,{content:String(t.content)})]});if(e==="Table")return g.jsx(da,{...Te.Table.parse(t)});if(e==="Chart")return g.jsx(Lh,{...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($a,{size:17,className:"mt-0.5 shrink-0 text-primary"}):g.jsx(Aa,{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(Bh,{type:e,props:t}):e==="Button"?g.jsx(qh,{props:t}):e==="Resource"?g.jsx(Jh,{props:t}):e==="Form"?g.jsx(Ki.Provider,{value:String(t.name),children:g.jsxs("form",{className:"w-full max-w-2xl space-y-4 rounded-xl border border-border bg-surface 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-3",children:[g.jsx("h3",{className:"text-base font-semibold leading-6",children:String(t.title)}),g.jsx("div",{className:Lo,children:n(t.content)})]}):g.jsx("div",{className:`${Lo} gap-y-6`,children:n(t.content)})}const Kh=dh({id:Ot.id,root:Ot.root,components:Object.values(Ot.components).map(e=>({...e,component:t=>g.jsx(Vh,{...t,name:e.name})}))}),Wh=Jm(Ot.toJSONSchema());function Qh({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);wa(o,!0,t);const p=async(f,d)=>{if(!r){u("此会话仅允许查看");return}await Oa(f,n,()=>o.current?.isConnected===!0,d)?t():u("暂时无法添加到输入框,请稍后重试。")};return xa.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(Sa,{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(Fh,{filePath:e,onInsertReference:(f,d,m)=>{p(ka(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 cg({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 Wh.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=Dh(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=Uh(_,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(_a,{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:Kh,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(Qh,{path:p,sessionId:t,canWrite:n,close:()=>f(void 0)})]})})})}export{cg as ChatRichContent};
|