artideck 0.0.1-alpha.0 → 1.113.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -0
- package/LICENSE +4 -0
- package/README.md +205 -5
- package/bin/ryugi.cjs +9 -0
- package/dist/cli.cjs +994 -0
- package/dist/document-engine.cjs +1796 -0
- package/dist/loro_wasm_bg.wasm +0 -0
- package/dist/output-bootstrap.cjs +921 -0
- package/dist/runtime/Figtree-OFL.txt +93 -0
- package/dist/runtime/Geist-Mono-OFL.txt +92 -0
- package/dist/runtime/Goeist-OFL.txt +97 -0
- package/dist/runtime/deck/23I4SOAX-ByvRw0YV.js +263 -0
- package/dist/runtime/deck/26H2HVXD-bLsHUJg0.js +595 -0
- package/dist/runtime/deck/2IZ5MNOH-BMwid8pT.js +161 -0
- package/dist/runtime/deck/2P3CZEXH-CDGTr1B1.js +263 -0
- package/dist/runtime/deck/3E5HRNYT-DWV6YnPn.js +1328 -0
- package/dist/runtime/deck/3JIRLDUO-BxW79znC.js +489 -0
- package/dist/runtime/deck/5MJ3UKSG-CZlIMh9R.js +470 -0
- package/dist/runtime/deck/5THPTBWS-BCdZFhV1.js +32 -0
- package/dist/runtime/deck/7WLXJQOR-CjURryg_.js +22 -0
- package/dist/runtime/deck/A255FCTW-BsKVHooW.js +796 -0
- package/dist/runtime/deck/AM43MQ64-Ctg0tPg5.js +279 -0
- package/dist/runtime/deck/AOZTNTMC-BFmaehsA.js +563 -0
- package/dist/runtime/deck/AQNLM6KG-BaXA1Iyk.js +1264 -0
- package/dist/runtime/deck/BNU2RHQB-xTFbJFq5.js +181 -0
- package/dist/runtime/deck/C5HTQT3I-gSZhc4E5.js +168 -0
- package/dist/runtime/deck/CPKRWH5G-BWHn4GAl.js +1339 -0
- package/dist/runtime/deck/CUVCMPQX-CWb0Dm80.js +1235 -0
- package/dist/runtime/deck/D4V2MWCI-DU3TsZxx.js +24 -0
- package/dist/runtime/deck/DHKBVIA3-D7oUDJiJ.js +39 -0
- package/dist/runtime/deck/DKTLEL5E-CJdweuKi.js +35 -0
- package/dist/runtime/deck/DUZNPW7S-DbhjhetM.js +103 -0
- package/dist/runtime/deck/E3FWOBN4-BtJPMX8M.js +488 -0
- package/dist/runtime/deck/E65FQMJL-Dd_2fyME.js +21 -0
- package/dist/runtime/deck/FTXIJQGB-AHnjjGOa.js +226 -0
- package/dist/runtime/deck/G3MDBVQH-2qSadYZr.js +24 -0
- package/dist/runtime/deck/G3OATVW2-1h3YkBu7.js +1567 -0
- package/dist/runtime/deck/IV52FOAS-Zn4UzH4N.js +1404 -0
- package/dist/runtime/deck/JTJEEBDN-YkCHY8Zf.js +52 -0
- package/dist/runtime/deck/K7FUICZ3-CGPZ7izx.js +795 -0
- package/dist/runtime/deck/LHH2HHRB-B29BDRKn.js +356 -0
- package/dist/runtime/deck/MSPQPZZY-D8T12kEI.js +688 -0
- package/dist/runtime/deck/OB6ZFVKF-BXfQ4FMH.js +242 -0
- package/dist/runtime/deck/PLTZDMI2-Bt_th5t6.js +1 -0
- package/dist/runtime/deck/R7EPXMMD-Biy1Rh6R.js +1079 -0
- package/dist/runtime/deck/RVARI57O-DHZR7iMv.js +9 -0
- package/dist/runtime/deck/SPBWZ4VS-Ce9sEW6_.js +75 -0
- package/dist/runtime/deck/SR7OOV3Q-DnX0KpAd.js +1017 -0
- package/dist/runtime/deck/STAXBNH4-C4TCtjfh.js +22 -0
- package/dist/runtime/deck/SXFARSFO-DO8JeDyL.js +405 -0
- package/dist/runtime/deck/TC77ISAL-ByLfgcrY.js +1135 -0
- package/dist/runtime/deck/TYIQQHVC-TRfAzv7p.js +1859 -0
- package/dist/runtime/deck/TZUXETIT-B8gqbld-.js +776 -0
- package/dist/runtime/deck/U7N72BGE-BuZ4vKTn.js +519 -0
- package/dist/runtime/deck/UFPIB6EZ-4MlZnCrF.js +475 -0
- package/dist/runtime/deck/UO52YEYL-Bq22hG5W.js +146 -0
- package/dist/runtime/deck/VIK3ONSK-D_kEzfgj.js +445 -0
- package/dist/runtime/deck/VVVO4ZVP-CpABiIqr.js +166 -0
- package/dist/runtime/deck/WRGXZO53-UB13aRTu.js +947 -0
- package/dist/runtime/deck/X5SG7MGC-BfmHie-r.js +296 -0
- package/dist/runtime/deck/XLHPVVFU-B_uzIt_G.js +51 -0
- package/dist/runtime/deck/XXYPNCD5-CgyfByXb.js +183 -0
- package/dist/runtime/deck/Z6WRYFJC-Cxt5GIGU.js +416 -0
- package/dist/runtime/deck/ZI2QNEGF-zbLA5j2H.js +1414 -0
- package/dist/runtime/deck/code-Dzzx958k.js +786 -0
- package/dist/runtime/deck/diagram-D4QtUYG0.js +1095 -0
- package/dist/runtime/deck/embed-ByYr4D5y.js +94 -0
- package/dist/runtime/deck/magic-move-QHEhTESo.js +864 -0
- package/dist/runtime/deck/math-CyFe6hk1.js +21956 -0
- package/dist/runtime/deck/open-BwthTmko.js +788 -0
- package/dist/runtime/icons/a.json +1 -0
- package/dist/runtime/icons/b.json +1 -0
- package/dist/runtime/icons/c.json +1 -0
- package/dist/runtime/icons/d.json +1 -0
- package/dist/runtime/icons/e.json +1 -0
- package/dist/runtime/icons/f.json +1 -0
- package/dist/runtime/icons/g.json +1 -0
- package/dist/runtime/icons/h.json +1 -0
- package/dist/runtime/icons/i.json +1 -0
- package/dist/runtime/icons/index.json +1 -0
- package/dist/runtime/icons/j.json +1 -0
- package/dist/runtime/icons/k.json +1 -0
- package/dist/runtime/icons/l.json +1 -0
- package/dist/runtime/icons/m.json +1 -0
- package/dist/runtime/icons/n.json +1 -0
- package/dist/runtime/icons/o.json +1 -0
- package/dist/runtime/icons/p.json +1 -0
- package/dist/runtime/icons/q.json +1 -0
- package/dist/runtime/icons/r.json +1 -0
- package/dist/runtime/icons/s.json +1 -0
- package/dist/runtime/icons/t.json +1 -0
- package/dist/runtime/icons/u.json +1 -0
- package/dist/runtime/icons/v.json +1 -0
- package/dist/runtime/icons/w.json +1 -0
- package/dist/runtime/icons/x.json +1 -0
- package/dist/runtime/icons/z.json +1 -0
- package/dist/runtime/robots.txt +9 -0
- package/dist/runtime/ryugi-deck.js +4097 -0
- package/dist/runtime/ryugi-icons.js +47 -0
- package/dist/runtime/ryugi-mockup.js +558 -0
- package/dist/runtime/ryugi-preview-bridge.js +2 -0
- package/dist/runtime/ryugi-report.js +65827 -0
- package/dist/runtime/ryugi-storyboard.js +55 -0
- package/dist/runtime/ryugi-ui.js +90 -0
- package/dist/runtime/ryugi-whiteboard-embed.js +11904 -0
- package/dist/viewer/AgentDock-DO3wjCT6.js +2 -0
- package/dist/viewer/ArtboardLayout-CWx1_DVU.js +14 -0
- package/dist/viewer/ArtboardLayout-DLyi-yDq.css +1 -0
- package/dist/viewer/ArtifactList-DtgRku6l.js +2 -0
- package/dist/viewer/ArtifactModal-BU_PR8k8.css +1 -0
- package/dist/viewer/ArtifactModal-DfZqI4AY.js +1 -0
- package/dist/viewer/BottomSheet-DHasPJPu.js +1 -0
- package/dist/viewer/Canvas-C5NJh3wF.js +1 -0
- package/dist/viewer/CommentPopover-GqGMqaHP.js +1 -0
- package/dist/viewer/DocumentExportMenu-8sZID_nO.js +1 -0
- package/dist/viewer/DocumentLayout-CJ59MGXp.js +2 -0
- package/dist/viewer/DocumentPage-CcmkTxH-.js +5 -0
- package/dist/viewer/DocumentPage-DGJI3MRN.css +1 -0
- package/dist/viewer/DotGrid-DKKr_PyM.js +1 -0
- package/dist/viewer/DraggablePanel-BuFi6njZ.js +1 -0
- package/dist/viewer/DropdownMenu-CM7q1CMp.js +1 -0
- package/dist/viewer/Figtree-OFL.txt +93 -0
- package/dist/viewer/Geist-Mono-OFL.txt +92 -0
- package/dist/viewer/GeistMono-BoRIzn25.woff2 +0 -0
- package/dist/viewer/Goeist-OFL.txt +97 -0
- package/dist/viewer/GroupVerdict-DeeQUfkG.js +1 -0
- package/dist/viewer/HtmlLayout-vlPq4J9Y.js +1 -0
- package/dist/viewer/Input-CVcfIqt2.js +1 -0
- package/dist/viewer/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/viewer/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/viewer/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/viewer/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/viewer/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/viewer/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/viewer/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/viewer/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/viewer/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/viewer/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/viewer/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/viewer/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/viewer/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/viewer/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/viewer/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/viewer/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/viewer/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/viewer/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/viewer/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/viewer/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/viewer/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/viewer/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/viewer/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/viewer/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/viewer/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/viewer/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/viewer/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/viewer/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/viewer/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/viewer/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/viewer/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/viewer/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/viewer/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/viewer/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/viewer/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/viewer/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/viewer/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/viewer/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/viewer/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/viewer/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/viewer/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/viewer/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/viewer/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/viewer/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/viewer/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/viewer/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/viewer/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/viewer/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/viewer/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/viewer/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/viewer/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/viewer/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/viewer/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/viewer/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/viewer/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/viewer/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/viewer/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/viewer/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/viewer/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/viewer/MenuSubmenuTrigger-BczoxS9k.js +1 -0
- package/dist/viewer/MotionConfigContext-HC2vqcJO.js +1 -0
- package/dist/viewer/PhoneArtboardBar-BK3M_psy.js +1 -0
- package/dist/viewer/PlaybackIcon-D-vfZnSv.js +1 -0
- package/dist/viewer/Popover-O6mMCn1S.js +1 -0
- package/dist/viewer/PreviewArtifactLayout-KGeS-A9y.js +1 -0
- package/dist/viewer/PreviewLayout-C5knCbv-.js +2 -0
- package/dist/viewer/ReportLayout-BD1bNPfi.js +5 -0
- package/dist/viewer/RyugiMark-Dyu4ej9h.js +1 -0
- package/dist/viewer/Segmented-Clhtb1CD.js +1 -0
- package/dist/viewer/SelectScrollUpArrow-CTGOrluu.js +1 -0
- package/dist/viewer/SlidesLayout-8j14xYA-.js +12 -0
- package/dist/viewer/SlidesLayout-Bjds2UXz.css +1 -0
- package/dist/viewer/SnapshotDocument-CnqXgo4y.js +1 -0
- package/dist/viewer/SplitFrame-CQ3lXrch.js +1 -0
- package/dist/viewer/StoryboardLayout-ayS9S6Ff.js +1 -0
- package/dist/viewer/StoryboardRender--NOzkhyN.js +1 -0
- package/dist/viewer/ThreadView-OBDIwTkP.js +1 -0
- package/dist/viewer/Tooltip-DX1QlxEQ.js +1 -0
- package/dist/viewer/VerifyLayout-B9e4RHAZ.css +1 -0
- package/dist/viewer/VerifyLayout-Usn3NkOU.js +1 -0
- package/dist/viewer/VirtualizedEditor-uWe43zaI-C5Sahl_l.js +1 -0
- package/dist/viewer/VirtualizedRenderer-C_d95FXi-BpaHPQz0.js +1 -0
- package/dist/viewer/WarningsBadge-DGnz2zmy.js +1 -0
- package/dist/viewer/WhiteboardEditor-DrHOvXez-JWa5PVHK.js +22 -0
- package/dist/viewer/WhiteboardLayout-Dd8Uh61C.js +4 -0
- package/dist/viewer/WhiteboardLayout-SRFXrlmW.css +1 -0
- package/dist/viewer/WritingCursor-CRzyzaVO.js +1 -0
- package/dist/viewer/agentLook-CU806djA.js +1 -0
- package/dist/viewer/apl-gfMMiTNf.js +1 -0
- package/dist/viewer/app-icon-6WJOuhLx.svg +1 -0
- package/dist/viewer/app-icon-Bm9-i4yr.png +0 -0
- package/dist/viewer/arrow-up-right-0KreI6kY.js +1 -0
- package/dist/viewer/artifact-list-B9KTDzUh.js +1 -0
- package/dist/viewer/asciiarmor-C_eisQCp.js +1 -0
- package/dist/viewer/asn1-DCl_8MCW.js +1 -0
- package/dist/viewer/asterisk-BEn0Cwpx.js +1 -0
- package/dist/viewer/auto-publish-GJrN3H-Y.js +1 -0
- package/dist/viewer/backlinks-C_k8-LL2.js +1 -0
- package/dist/viewer/bem-vbke-3KC.js +1 -0
- package/dist/viewer/brainfuck-D5EjA2JK.js +1 -0
- package/dist/viewer/channel-CF9EHtSL.js +4 -0
- package/dist/viewer/chevron-left-C5itNrp5.js +1 -0
- package/dist/viewer/chevron-right-xNdXLJg6.js +1 -0
- package/dist/viewer/clapperboard-BfpJ7tpa.js +1 -0
- package/dist/viewer/clike-xvONpD0Z.js +1 -0
- package/dist/viewer/clojure-BflJGmDX.js +1 -0
- package/dist/viewer/cloud-upload-D8TpApTr.js +1 -0
- package/dist/viewer/cmake-84nbDH0I.js +1 -0
- package/dist/viewer/cobol-DHLQUbN7.js +1 -0
- package/dist/viewer/code-DnmQyGiF.js +1 -0
- package/dist/viewer/code-xml-c9QCqmhY.js +1 -0
- package/dist/viewer/coffeescript-De_zI4J0.js +1 -0
- package/dist/viewer/comments-DUAz1Q9X.js +1 -0
- package/dist/viewer/commonlisp-DgAKBe0r.js +1 -0
- package/dist/viewer/crop-encode-C1SdKlik.js +1 -0
- package/dist/viewer/crystal-Bl6YKCG_.js +1 -0
- package/dist/viewer/css-CnaYoQib.js +1 -0
- package/dist/viewer/cssVar.stylex-CGbpAC1Y.js +1 -0
- package/dist/viewer/cypher-p9eYesGn.js +1 -0
- package/dist/viewer/d-DWkQyNnU.js +1 -0
- package/dist/viewer/default-Ckb1jcnl.js +4 -0
- package/dist/viewer/diff-ChtP43wD.js +1 -0
- package/dist/viewer/dist-B0qXxOuX.js +1 -0
- package/dist/viewer/dist-B3-vnt93.js +1 -0
- package/dist/viewer/dist-BDGp5lli.js +6 -0
- package/dist/viewer/dist-BHga6o7i.js +1 -0
- package/dist/viewer/dist-BNB-dtd1.js +1 -0
- package/dist/viewer/dist-BWDri6GH.js +1 -0
- package/dist/viewer/dist-B_dCTH8c.js +9 -0
- package/dist/viewer/dist-BaGZx4vf.js +1 -0
- package/dist/viewer/dist-Bgia1wnJ.js +11 -0
- package/dist/viewer/dist-C4H1ECie.js +1 -0
- package/dist/viewer/dist-CJucIoCR.js +1 -0
- package/dist/viewer/dist-CiMWQRhQ.js +1 -0
- package/dist/viewer/dist-Cj74Rdec.js +1 -0
- package/dist/viewer/dist-CsBIrCGx.js +1 -0
- package/dist/viewer/dist-CyHqzrxc.js +1 -0
- package/dist/viewer/dist-CzD--XrY.js +1 -0
- package/dist/viewer/dist-D4as0PD-.js +1 -0
- package/dist/viewer/dist-DTD3yXBi.js +1 -0
- package/dist/viewer/dist-Dfck1z2n.js +23 -0
- package/dist/viewer/dist-Dmr_aVAS.js +1 -0
- package/dist/viewer/dist-Dn_o36dG.js +2 -0
- package/dist/viewer/dist-DxngwfWH.js +1 -0
- package/dist/viewer/dist-_D5xLBBO.js +1 -0
- package/dist/viewer/dist-vsF0cCGK.js +1 -0
- package/dist/viewer/dockerfile-DJkHQgkl.js +1 -0
- package/dist/viewer/dtd-DTF72YNO.js +1 -0
- package/dist/viewer/dylan-S7ucR4pR.js +1 -0
- package/dist/viewer/ebnf-D4c0_ac3.js +1 -0
- package/dist/viewer/ecl-BVIeWmwY.js +1 -0
- package/dist/viewer/editor-DHJQC-c0.js +397 -0
- package/dist/viewer/eiffel-BEjRio4Q.js +1 -0
- package/dist/viewer/elements-CmGVWYag.js +1 -0
- package/dist/viewer/elm-Cshzl8qu.js +1 -0
- package/dist/viewer/embed-src-CmyqZplg.js +1 -0
- package/dist/viewer/erlang-BV0c4Hdn.js +1 -0
- package/dist/viewer/external-link-D382oEvK.js +1 -0
- package/dist/viewer/factor-LKH5gN8L.js +1 -0
- package/dist/viewer/fcl-ClOhbFR7.js +1 -0
- package/dist/viewer/figtree-latin-ext-wght-normal-DCwSJGxG.woff2 +0 -0
- package/dist/viewer/figtree-latin-wght-normal-D_ZTVpCC.woff2 +0 -0
- package/dist/viewer/film-A6SU1RGC.js +1 -0
- package/dist/viewer/fit-BgVy5mbn.js +1 -0
- package/dist/viewer/folder-BViSPo7g.js +1 -0
- package/dist/viewer/forth-D6RzAl64.js +1 -0
- package/dist/viewer/fortran-Bt6PBEDR.js +1 -0
- package/dist/viewer/gas-BHEdbvp9.js +1 -0
- package/dist/viewer/gherkin-oBAE_ms0.js +1 -0
- package/dist/viewer/github-dark-C895GGrm.js +1 -0
- package/dist/viewer/github-light-B4HDwToD.js +1 -0
- package/dist/viewer/groovy-CUrWKPia.js +1 -0
- package/dist/viewer/haskell-BRsoo5mP.js +1 -0
- package/dist/viewer/haxe-DjVOVvNP.js +1 -0
- package/dist/viewer/http-CLVgA2GD.js +1 -0
- package/dist/viewer/icons-BwlHhLMH.js +1 -0
- package/dist/viewer/idl-BUZw3wgd.js +1 -0
- package/dist/viewer/imperative-D1UIq_CR.js +1 -0
- package/dist/viewer/index.css +1 -0
- package/dist/viewer/index.html +75 -0
- package/dist/viewer/index.js +2 -0
- package/dist/viewer/index2.css +1 -0
- package/dist/viewer/index3.css +1 -0
- package/dist/viewer/index4.css +1 -0
- package/dist/viewer/index5.css +6655 -0
- package/dist/viewer/is-html-element-DvgHo_1h.js +1 -0
- package/dist/viewer/javascript-lS2r2ifg.js +1 -0
- package/dist/viewer/jsx-runtime-LKYXHABd.js +1 -0
- package/dist/viewer/julia-CQfgDRfP.js +1 -0
- package/dist/viewer/katex-DuZJ-tFh.js +257 -0
- package/dist/viewer/lib-DJrc3aG3.js +3 -0
- package/dist/viewer/livescript-BXxG0Yva.js +1 -0
- package/dist/viewer/local-CvTEMav_.js +1 -0
- package/dist/viewer/local-split-host-DOfRlsgx.js +1 -0
- package/dist/viewer/lua-DPCEkfD_.js +1 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-100-DLPe7tEt.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-101-d3VsZKWT.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-102-ClzJuLq6.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-103-DuDnQ6K-.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-104-kPGW3Eem.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-105-BzD54h-0.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-106-BQ7fIzlx.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-107-D8tDfFHI.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-108-tGhkpwep.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-109-7SMVSrly.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-110-_uDKrFed.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-111-Bio825RE.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-112-D2ee0i-C.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-113-JPFVDrga.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-114-BcfxYA4w.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-115-B1HeeOsd.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-116-hY12tXpq.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-117-BvuZwmre.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-118-tzvs_H7j.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-119-J2DWuYDN.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-21-pDubCJV5.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-22-ChAPMpqp.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-23-BBx3oNpT.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-24-CYt-Oagk.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-25-Cx3j-ZUv.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-26-B9AfZ3LL.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-27-Bh2s9MNE.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-28-C02JPoKP.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-29-T_tbUGhk.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-30-DMfyNzhz.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-31-DFfdzbkg.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-32-Bs1fz2iW.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-33-cpB96OkZ.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-34-BhinPYWX.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-35-D_njRQqA.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-36-DqXlLE3t.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-37-j5LbvMph.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-38-oO4jWdKm.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-39-CabsX4rw.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-4-PatS3YHh.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-40-yrLg3C3e.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-41-DBXmCQhc.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-42-Bqij_UiQ.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-43-D3kp0Ntc.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-44-B_BNGvK4.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-45-CZc0cQWs.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-46-CHQX5Kd9.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-47-Ci8gLrHA.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-48-run3ugD3.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-49-DgfiUb6u.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-5-B0CtGbX_.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-50-CdCG-POr.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-51-L2okeQZ2.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-52-BZAqyGJW.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-53-B0xWqLeU.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-54-BZVQX-EA.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-55-093mkIUJ.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-56-CbhWG8G-.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-57-pLQuvo6c.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-58-BHhoY50x.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-59-D1_6DuIQ.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-6-BnAelmYU.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-60-HDBIuLTZ.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-61-C-c13SeU.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-62-kHRVOhZ2.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-63-C0MCsvFv.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-64-DZekguCj.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-65-CtP6c3IU.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-66-DLVWoMSf.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-67-BVuOnayH.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-68-DpxQ6Mnx.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-69-qesBxLmC.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-70-BBt1xN7h.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-71-BWqZacwB.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-72-B1wP_Yst.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-73-C99T7jNZ.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-74-DrUTsWBe.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-75-C4M5XXQe.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-76-Bq8spVWF.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-77-D9vNupE2.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-78-D6th7Gnu.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-79-bezM85cS.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-80-DD8pnhG2.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-81-N6jtSyBs.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-82-D6c180bZ.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-83-em17AadM.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-84-CJ8gdrMK.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-85-9PPGO1eB.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-86-CjWPf-u5.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-87-8D_X_yOC.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-88-9vtKFPBx.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-89-BhE5jAKX.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-90-D2Npfm5E.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-91-C6Ft1-Eu.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-97-CaExyQP9.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-98-CPoVbsUd.woff2 +0 -0
- package/dist/viewer/lxgwwenkaiscreen-subset-99-ZUQZGVgH.woff2 +0 -0
- package/dist/viewer/mathematica-u8YMmbU0.js +1 -0
- package/dist/viewer/maximize-2-Bc0lXBg6.js +1 -0
- package/dist/viewer/mbox-BEMVcqjs.js +1 -0
- package/dist/viewer/message-square-Yl8PoPy_.js +1 -0
- package/dist/viewer/mirc-C9zpzAZU.js +1 -0
- package/dist/viewer/mllike-B45xgp2S.js +1 -0
- package/dist/viewer/modelica-CqHI_q-D.js +1 -0
- package/dist/viewer/monitor-DRrnx_H5.js +1 -0
- package/dist/viewer/motion-Cy65kd7X.js +1 -0
- package/dist/viewer/mouse-pointer-2-B-OF_fcG.js +1 -0
- package/dist/viewer/mscgen-qgSLujhx.js +1 -0
- package/dist/viewer/mumps-BSzj6Xyz.js +1 -0
- package/dist/viewer/nginx-C-ORUuei.js +1 -0
- package/dist/viewer/nsis-viPvXFiq.js +1 -0
- package/dist/viewer/ntriples-CzMBulkp.js +1 -0
- package/dist/viewer/octave-D2Q8cUp1.js +1 -0
- package/dist/viewer/oz-BwTct_5T.js +1 -0
- package/dist/viewer/pages-DWkRbog-.js +1 -0
- package/dist/viewer/pascal-Dp_KdFgX.js +1 -0
- package/dist/viewer/pen-tool-BfwjhXQW.js +1 -0
- package/dist/viewer/perl-BkSkiI9m.js +1 -0
- package/dist/viewer/pig-AF4Hwhju.js +1 -0
- package/dist/viewer/play-6FAfeM1L.js +1 -0
- package/dist/viewer/plugin-_bGVeqI0-DZgj9wju.js +2 -0
- package/dist/viewer/plus-DZJ2BVkK.js +1 -0
- package/dist/viewer/powershell-D8WpQPaX.js +1 -0
- package/dist/viewer/preference-oNdcNeml.js +1 -0
- package/dist/viewer/presentation-DXrcAbwM.js +1 -0
- package/dist/viewer/preview.html +28 -0
- package/dist/viewer/preview.js +1 -0
- package/dist/viewer/printDocument-CUNshxwb.js +1 -0
- package/dist/viewer/properties-C357ku5U.js +1 -0
- package/dist/viewer/protobuf-D1ij_kNL.js +1 -0
- package/dist/viewer/pug-BqCHZ5xT.js +1 -0
- package/dist/viewer/puppet-BZyAS7I4.js +1 -0
- package/dist/viewer/python-B_1Jd8HM.js +1 -0
- package/dist/viewer/q-B9NhS7L_.js +1 -0
- package/dist/viewer/r-CxDmU1I4.js +1 -0
- package/dist/viewer/react-DlmbjZJV.js +1 -0
- package/dist/viewer/read-marks-CVVWpIvf.js +1 -0
- package/dist/viewer/ref-Bj5JiHki.js +1 -0
- package/dist/viewer/robots.txt +9 -0
- package/dist/viewer/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/viewer/rounds-BLj-tfMG.js +1 -0
- package/dist/viewer/route-Csi4PU7w.js +64 -0
- package/dist/viewer/route-messages-DeWSMVNI.js +1 -0
- package/dist/viewer/rpm-gpDK5sbt.js +1 -0
- package/dist/viewer/ruby-ChfNwlCY.js +1 -0
- package/dist/viewer/ruler-CYb0HZGT.js +1 -0
- package/dist/viewer/sas-C2OyD2Y6.js +1 -0
- package/dist/viewer/scheme-D9qYN0V5.js +1 -0
- package/dist/viewer/search-DTrfkTpJ.js +1 -0
- package/dist/viewer/selection-BWCQd_Fn.js +1 -0
- package/dist/viewer/settings-Ccw15Eyz.js +1 -0
- package/dist/viewer/shell-DwuoZtxw.js +1 -0
- package/dist/viewer/shims-s-YVfIlz.js +1 -0
- package/dist/viewer/sieve-tLWDfEkZ.js +1 -0
- package/dist/viewer/simple-mode-DXiLM1-G.js +1 -0
- package/dist/viewer/sliders-horizontal-CuS3-UwA.js +1 -0
- package/dist/viewer/smalltalk-BLp5-jwC.js +1 -0
- package/dist/viewer/snap-B7T8Fi-t.js +1 -0
- package/dist/viewer/solr-B78wSQJQ.js +1 -0
- package/dist/viewer/sparql-Dz-mlCAC.js +1 -0
- package/dist/viewer/split-DYwwKqIa.js +2 -0
- package/dist/viewer/spreadsheet-CTIncYxj.js +1 -0
- package/dist/viewer/sql-DuQMFDvy.js +1 -0
- package/dist/viewer/stable-CwENW2fR.js +1 -0
- package/dist/viewer/stex-DNzd62Q_.js +1 -0
- package/dist/viewer/store-D3ROW536.js +1 -0
- package/dist/viewer/stringifyLocale-D0juOOnH.js +1 -0
- package/dist/viewer/styles-clvPUBbJ.js +1 -0
- package/dist/viewer/stylus-BOVgKnng.js +1 -0
- package/dist/viewer/swift-DKB6_1j6.js +1 -0
- package/dist/viewer/table-2-D90vZ04E.js +1 -0
- package/dist/viewer/tcl-BGfruO1u.js +1 -0
- package/dist/viewer/text-align-start-CRhecbJR.js +1 -0
- package/dist/viewer/textile-C4jVoHG1.js +1 -0
- package/dist/viewer/tiddlywiki-VlUiK86J.js +1 -0
- package/dist/viewer/tiki-CvUEFusT.js +1 -0
- package/dist/viewer/toml-BPTmHmyx.js +1 -0
- package/dist/viewer/transport-CSbo3sV6.js +1 -0
- package/dist/viewer/troff-C2dAgh7P.js +1 -0
- package/dist/viewer/ttcn-PPSTk1ow.js +1 -0
- package/dist/viewer/ttcn-cfg-2b4Gb5sE.js +1 -0
- package/dist/viewer/turtle-Cx3rYX2g.js +1 -0
- package/dist/viewer/type-icons-CxYXZlMj.js +1 -0
- package/dist/viewer/types-BCsOeYI6.js +1 -0
- package/dist/viewer/underline-CT_nGhA9.js +1 -0
- package/dist/viewer/undo-2-B-JiyKIl.js +1 -0
- package/dist/viewer/upload-DffL3XsM.js +1 -0
- package/dist/viewer/url-D8qiZRqE.js +29 -0
- package/dist/viewer/useArtifactFeed-1e4jVUAL.js +1 -0
- package/dist/viewer/useArtifactSocket-wqYKSfgz.js +1 -0
- package/dist/viewer/useAssetBase-4Ut9QhBI.js +1 -0
- package/dist/viewer/useLayerZIndex-D4jsmz12.js +1 -0
- package/dist/viewer/useMedia-CFebB4XU.js +1 -0
- package/dist/viewer/useSandboxFrame-CJmSnwgG.js +1 -0
- package/dist/viewer/useStoryboardData-aWqqHGVH.js +1 -0
- package/dist/viewer/useTypeFavicon-yXOsFZBx.js +1 -0
- package/dist/viewer/vb-BthdM_4N.js +1 -0
- package/dist/viewer/vbscript-D9f6rSsU.js +1 -0
- package/dist/viewer/velocity-CqftRsjg.js +1 -0
- package/dist/viewer/verilog-CjI9Y6RI.js +1 -0
- package/dist/viewer/vhdl-kS471soi.js +1 -0
- package/dist/viewer/video-DKoRqEZW.js +1 -0
- package/dist/viewer/view-ClWzCAjM.js +3 -0
- package/dist/viewer/viewport-CFJHn_Y6--n1vZkKz.js +1 -0
- package/dist/viewer/webidl-D5jiJvOU.js +1 -0
- package/dist/viewer/xquery-BKJx4mf9.js +1 -0
- package/dist/viewer/yacas-CXXgtw0p.js +1 -0
- package/dist/viewer/z80-Co3PbHdE.js +1 -0
- package/dist/viewer/zoom-out-DsmGFv1v.js +1 -0
- package/package.json +125 -19
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,994 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r=Object.setPrototypeOf({},null);for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n&1||t(r,Symbol.toStringTag,{value:`Module`}),n&2?r:Object.preventExtensions(r)},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let u=require("node:crypto");u=l(u,1);let d=require("node:fs");d=l(d,1);let f=require("node:path");f=l(f,1);let p=require("node:child_process"),m=require("node:readline");m=l(m,1);let h=require("node:os");h=l(h,1);let g=require("node:util"),_=require("node:net");_=l(_,1);let v=require("node:url"),y=require("node:process");y=l(y,1);let b=require("node:tty");var x=`1.113.1`,S=`3fb61bfe80dc`;const C=e=>{let t=process.env.RYUGI_PROCESS_TAG?.trim();return`Ryugi ${e} (${x}${t?` · ${t}`:``})`},w=process.platform!==`win32`;function T(e,...t){w&&(process.title=[C(e),...t].join(` `))}const E=/^(\s*<doc) ryugi-attribution="([A-Za-z0-9_-]+)"(?=[\s>])/,ee=e=>(0,u.createHash)(`sha256`).update(e).digest(`hex`);function te(e){let t=E.exec(e);if(!t)return{};try{let n=JSON.parse(Buffer.from(t[2],`base64url`).toString()),r=n.digest===ee(e.replace(E,`$1`));return{...typeof n.createdBy==`string`&&{createdBy:n.createdBy},...r&&typeof n.modifiedBy==`string`&&{modifiedBy:n.modifiedBy},...r&&typeof n.model==`string`&&{model:n.model}}}catch{return{}}}function ne(e,t){let n=e.replace(E,`$1`);if(!t.createdBy&&!t.modifiedBy)return n;if(!/^\s*<doc[\s>]/.test(n))throw Error(`Expected a <doc> root.`);let r=Buffer.from(JSON.stringify({...t,digest:ee(n)})).toString(`base64url`);return n.replace(/^(\s*<doc)/,`$1 ryugi-attribution="`+r+`"`)}const re=[`https://ryugi.innei.dev`];function D(e){let t=e.replace(/\/+$/,``);return re.includes(t)?`https://artideck.dev`:t}const ie=e=>D(e.RYUGI_CLOUD_ORIGIN||`https://artideck.dev`);function ae(){return process.platform===`win32`?``:((0,p.spawnSync)(`ps`,[`-o`,`command=`,`-p`,String(process.ppid)],{encoding:`utf8`}).stdout??``).trim()}function O(e,t){try{let n=JSON.stringify({at:(/* @__PURE__ */ new Date()).toISOString(),...t,by:{pid:process.pid,ppid:process.ppid,parent:ae(),cwd:process.cwd(),argv:process.argv.slice(2)}});if(d.default.mkdirSync(e.home,{recursive:!0,mode:448}),d.default.appendFileSync(e.events,`${n}\n`),d.default.statSync(e.events).size>524288){let t=d.default.readFileSync(e.events,`utf8`).trim().split(`
|
|
3
|
+
`).slice(-1e3);d.default.writeFileSync(e.events,`${t.join(`
|
|
4
|
+
`)}\n`)}}catch{}}const k=[`artboard`,`document`,`html`,`whiteboard`,`verify`,`slides`,`report`,`storyboard`],A={artboard:`canvas.json`,document:`doc.xml`,html:`index.html`,whiteboard:`scene.excalidraw`,verify:`verify.xml`,slides:`index.html`,report:`report.tsx`,storyboard:`storyboard.xml`};({...A});const oe=[`html`,`image`,`video`],j=e=>e.type===`image`||e.type===`video`;var M=class extends Error{fields;code;constructor(e,t={},n=1){super(e),this.fields=t,this.code=n}};function se(e){let t=``;try{t=d.default.realpathSync(h.default.homedir())}catch{}let n=[];for(let r=e;n.push(r),!d.default.existsSync(f.default.join(r,`.git`))||r===t&&e!==t;r=f.default.dirname(r))if(f.default.dirname(r)===r)return e;return n.find(e=>d.default.existsSync(f.default.join(e,`.ryugi`,`artifacts`)))??n.at(-1)}function ce(e){let t;try{if(t=d.default.realpathSync(f.default.resolve(e)),!d.default.statSync(t).isDirectory())throw Error(`Not a directory`)}catch{throw new M(`Project directory not found: ${e}`)}t=se(t);let n=f.default.join(t,`.ryugi`,`artifacts`),r=f.default.join(n,`.state`);return{project:t,root:n,state:r,pid:f.default.join(r,`server.pid`),log:f.default.join(r,`server.log`),serverId:f.default.join(r,`server-instance-id`),info:f.default.join(r,`server-info`),version:f.default.join(r,`server-version`),owners:f.default.join(r,`owners`),stopped:f.default.join(r,`server-stopped`),lock:f.default.join(r,`start.lock`)}}const le=()=>process.env.RYUGI_ARTIFACTS_COMMAND||`adeck`,ue=RegExp(`^(${k.join(`|`)})/[a-z0-9][a-z0-9-]*$`),de=`--artifact must be <type>/<id>: type ${k.slice(0,-1).join(`, `)} or ${k.at(-1)}; id of lowercase letters, digits and hyphens`,fe=e=>new Promise(t=>setTimeout(t,e));function pe(e){try{return process.kill(e,0),!0}catch(e){return e.code===`EPERM`}}function me(e){try{return d.default.readFileSync(`/proc/${e}/cmdline`,`utf8`).split(`\0`)}catch{}let t=(0,p.spawnSync)(`ps`,[`-ww`,`-p`,String(e),`-o`,`command=`],{encoding:`utf8`});if(t.status===0&&t.stdout.trim())return t.stdout.trim().split(/\s+/);let n=(0,p.spawnSync)(`ps`,[`-f`,`-p`,String(e)],{encoding:`utf8`});if(n.status!==0)return null;let r=n.stdout.split(`
|
|
5
|
+
`).slice(1).join(` `).trim();return r?r.split(/\s+/):null}const he=e=>/^"(?:node|ryugi-daemon(?:-[\w-]+)?)\.exe"/i.test(e.trim());function ge(e){let t=(0,p.spawnSync)(`tasklist`,[`/FI`,`PID eq ${e}`,`/FO`,`CSV`,`/NH`],{encoding:`utf8`,windowsHide:!0});return t.status===0?t.stdout:``}function _e(e,t,n={platform:process.platform,tasklist:ge}){return pe(e)?n.platform===`win32`?he(n.tasklist(e)):me(e)?.includes(`--artifacts-server-id=${t}`)??!1:!1}async function N(e,t){for(let n=0;n<t&&pe(e);n+=100)await fe(100);return!pe(e)}const P=e=>{try{return d.default.readFileSync(e,`utf8`).replace(/[\r\n]+$/,``)}catch{return null}},F={claude:`Claude Code`,"claude-code":`Claude Code`,cowork:`Claude Cowork`,codex:`Codex`,cursor:`Cursor`,"cursor-cli":`Cursor`,gemini:`Gemini CLI`,"gemini-cli":`Gemini CLI`,grok:`Grok`,"grok-cli":`Grok`,"github-copilot":`GitHub Copilot`,"github-copilot-cli":`GitHub Copilot`,kilo:`Kilo Code`,omp:`OMP`,"oh-my-pi":`OMP`,pi:`Pi`,dsh:`DeepSeek Harness`,opencode:`OpenCode`,"qwen-code":`Qwen Code`,antigravity:`Antigravity`,augment:`Augment`,"augment-cli":`Augment`,goose:`Goose`,amp:`Amp`,cline:`Cline`,roo:`Roo Code`,devin:`Devin`,replit:`Replit`,v0:`v0`};[...new Set(Object.values(F))];const ve=[[`omp`,e=>!!e.OMPCODE],[`grok`,e=>!!(e.GROK_AGENT||e.GROK_SESSION_ID)],[`cowork`,e=>!!e.CLAUDE_CODE_IS_COWORK],[`kilo`,e=>!!e.KILO],[`codex`,e=>!!(e.CODEX_THREAD_ID||e.CODEX_SANDBOX||e.CODEX_CI)],[`cursor`,e=>!!(e.CURSOR_AGENT||e.CURSOR_TRACE_ID)],[`gemini`,e=>!!e.GEMINI_CLI],[`github-copilot`,e=>!!e.COPILOT_CLI],[`opencode`,e=>e.OPENCODE===`1`||!!e.OPENCODE_CLIENT],[`qwen-code`,e=>!!e.QWEN_CODE],[`antigravity`,e=>!!e.ANTIGRAVITY_AGENT],[`augment`,e=>!!e.AUGMENT_AGENT],[`cline`,e=>!!e.CLINE_ACTIVE],[`roo`,e=>!!e.ROO_ACTIVE],[`claude`,e=>!!(e.CLAUDECODE||e.CLAUDE_CODE)]],ye=[`RYUGI_WRITER_AGENT`,`AI_AGENT`,`AGENT`,`OMPCODE`,`GROK_AGENT`,`GROK_SESSION_ID`,`CLAUDE_CODE_IS_COWORK`,`KILO`,`CODEX_THREAD_ID`,`CODEX_SANDBOX`,`CODEX_CI`,`CURSOR_AGENT`,`CURSOR_TRACE_ID`,`GEMINI_CLI`,`COPILOT_CLI`,`OPENCODE`,`OPENCODE_CLIENT`,`QWEN_CODE`,`ANTIGRAVITY_AGENT`,`AUGMENT_AGENT`,`CLINE_ACTIVE`,`ROO_ACTIVE`,`CLAUDECODE`,`CLAUDE_CODE`],be=e=>e?.trim().split(/[@_]/)[0]?.toLowerCase()||void 0,xe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Se(e){let t=I(e),n=t===F.claude?`claude`:t===F.codex?`codex`:t===F.antigravity?`antigravity`:null;if(!n)return null;let r=n===`claude`?e.CLAUDE_CODE_SESSION_ID:n===`codex`?e.CODEX_THREAD_ID||e.CODEX_SESSION_ID:e.ANTIGRAVITY_CONVERSATION_ID;return!r||!xe.test(r)?null:{host:n,id:r}}function Ce(e,t){if(e!==`pi`)return F[e]??e;let n=be(t.AI_AGENT);return n===`dsh`?F.dsh:n===`omp`||n===`oh-my-pi`||t.OMPCODE?F.omp:F.pi}function I(e){if(e.RYUGI_WRITER_AGENT)return e.RYUGI_WRITER_AGENT;if(e.RYUGI_WRITER_HOST)return Ce(e.RYUGI_WRITER_HOST,e);let t=e.RYUGI_ARTIFACTS_COMMAND?.match(/ --ryugi-session ([0-9a-f-]{36}):[0-9a-f-]{36}(?: |$)/i)?.[1];if(t&&t===e.CODEX_THREAD_ID)return F.codex;if(e.CLAUDE_CODE_IS_COWORK)return F.cowork;let n=be(e.AI_AGENT);if(n)return F[n]??n;let r=ve.find(([,t])=>t(e))?.[0];if(r)return F[r];let i=be(e.AGENT);if(i&&!/^(?:1|true|yes)$/.test(i))return F[i]??i}const we=/* @__PURE__ */ RegExp(`^[a-z0-9][a-z0-9-]*$`),Te=/* @__PURE__ */ RegExp(`^(?:[\\w-]{21}|[a-f0-9]{32})$`);function Ee(e){let t=``,n=new Uint8Array(e*2);for(;t.length<e;){crypto.getRandomValues(n);for(let r of n)if(!(r>=248)&&(t+=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`[r%62],t.length===e))break}return t}const De=()=>Ee(21),Oe=e=>we.test(e),ke=e=>Te.test(e),Ae=e=>k.includes(e);function je(e,t,n){if(!Ae(t)||!Oe(n))return null;let r=f.default.join(e,t,n);try{return d.default.statSync(r).isDirectory()?r:null}catch{return null}}function Me(e){let t=f.default.join(e,`.artifact-id`),n;try{n=d.default.readFileSync(t,`utf8`).trim()}catch(r){if(r.code!==`ENOENT`)throw r;n=De();try{d.default.writeFileSync(t,`${n}\n`,{flag:`wx`})}catch(t){if(t.code!==`EEXIST`)throw t;return Me(e)}}if(!ke(n))throw Error(`Invalid artifact ID in ${t}`);return n}function Ne(e){try{return d.default.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name).sort()}catch{return[]}}function Pe(e){let t=[],n=[];for(let r of Ne(e))if(!r.startsWith(`.`)){if(!Ae(r))n.push(`unknown artifact type directory: ${r}/ (known: ${k.join(`, `)})`);else for(let i of Ne(f.default.join(e,r)))Oe(i)?t.push({type:r,id:i,dir:f.default.join(e,r,i)}):n.push(`invalid artifact id: ${r}/${i} (use lowercase letters, digits and hyphens)`)}return{artifacts:t,warnings:n}}function Fe(e,t=Oe){let[n,r]=e.split(`/`);return!n||!r||!Ae(n)||!t(r)?null:{type:n,id:r}}function Ie(e,t){let n=0,r;try{r=d.default.readdirSync(e,{withFileTypes:!0})}catch{return n}for(let i of r){if(i.name.startsWith(`.`)||i.name===t)continue;let r=f.default.join(e,i.name);try{n=Math.max(n,i.isDirectory()?Ie(r):d.default.statSync(r).mtimeMs)}catch{continue}}return n}function Le(e,t,n){if(!Ae(t)||!Oe(n))throw Error(`Invalid artifact locator`);let r=f.default.join(e,t,n);return d.default.mkdirSync(r,{recursive:!0}),`/${t}/${Me(r)}`}const Re=(0,g.promisify)(p.execFile);function ze(e,t){return e===`darwin`?{bin:`open`,args:[t]}:e===`win32`?{bin:`cmd`,args:[`/c`,`start`,`""`,t]}:e===`linux`||e===`freebsd`||e===`openbsd`?{bin:`xdg-open`,args:[t]}:null}const Be=String.raw`
|
|
6
|
+
function run(urls) {
|
|
7
|
+
function key(url) {
|
|
8
|
+
return String(url).split(/[?#]/)[0].replace(/^(https?:\/\/)127\.0\.0\.1:/, '$1localhost:').replace(/\/$/, '');
|
|
9
|
+
}
|
|
10
|
+
var targets = urls.map(key);
|
|
11
|
+
var ids = ['company.thebrowser.dia', 'com.google.Chrome', 'com.apple.Safari'];
|
|
12
|
+
var unknown = false;
|
|
13
|
+
for (var a = 0; a < ids.length; a++) {
|
|
14
|
+
var app;
|
|
15
|
+
try { app = Application(ids[a]); if (!app.running()) continue; } catch (e) { continue; }
|
|
16
|
+
try {
|
|
17
|
+
var windows = app.windows();
|
|
18
|
+
for (var w = 0; w < windows.length; w++) {
|
|
19
|
+
var tabs = windows[w].tabs();
|
|
20
|
+
for (var t = 0; t < tabs.length; t++) {
|
|
21
|
+
if (targets.indexOf(key(tabs[t].url())) === -1) continue;
|
|
22
|
+
try {
|
|
23
|
+
if (ids[a] === 'company.thebrowser.dia') app.focus(tabs[t]);
|
|
24
|
+
else {
|
|
25
|
+
if (ids[a] === 'com.apple.Safari') windows[w].currentTab = tabs[t];
|
|
26
|
+
else windows[w].activeTabIndex = t + 1;
|
|
27
|
+
windows[w].index = 1;
|
|
28
|
+
}
|
|
29
|
+
app.activate();
|
|
30
|
+
} catch (e) { console.log('Could not focus the existing browser tab: ' + e.message); }
|
|
31
|
+
return 'found';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
} catch (e) { unknown = true; }
|
|
35
|
+
}
|
|
36
|
+
return unknown ? 'unknown' : 'missing';
|
|
37
|
+
}`;async function Ve(e,t=[]){if(process.platform===`darwin`){let{stdout:n,stderr:r}=await Re(`osascript`,[`-l`,`JavaScript`,`-e`,Be,e,...t],{timeout:5e3});if(r.trim()&&console.error(r.trim()),n.trim()===`found`)return;if(n.trim()!==`missing`)throw Error(`Could not inspect existing browser tabs; open the artifact link manually.`)}let n=ze(process.platform,e);n&&await Re(n.bin,n.args)}function He(e=process.env,t=h.default.homedir()){let n=e.RYUGI_SERVER_HOME||f.default.join(t,`.ryugi`,`server`);return{home:n,events:f.default.join(n,`hub-events.log`),pid:f.default.join(n,`server.pid`),serverId:f.default.join(n,`server-instance-id`),info:f.default.join(n,`server-info`),log:f.default.join(n,`server.log`),version:f.default.join(n,`server-version`),lock:f.default.join(n,`start.lock`),key:f.default.join(n,`key`),projects:f.default.join(n,`projects.json`),settings:f.default.join(n,`settings.json`),stopped:f.default.join(n,`server-stopped`)}}function Ue(e){d.default.mkdirSync(e,{recursive:!0,mode:448}),d.default.chmodSync(e,448)}const We=e=>{let t=e;return!!t&&typeof t.dir==`string`&&f.default.isAbsolute(t.dir)&&Number.isFinite(t.registeredAt)&&Number.isFinite(t.lastUsedAt)};function Ge(e){try{let t=JSON.parse(d.default.readFileSync(e,`utf8`));return Array.isArray(t.projects)?t.projects.filter(We):[]}catch{return[]}}const Ke=e=>f.default.join(e,`.ryugi`,`artifacts`);function qe(e=process.env,t=process.platform,n=process.getuid?.()??-1,r=h.default.tmpdir()){return e.RYUGI_RUNTIME_DIR?f.default.join(e.RYUGI_RUNTIME_DIR,`servers`):t===`win32`?f.default.join(r,`ryugi`,`servers`):`/tmp/ryugi-${n}/servers`}const Je=(e,t)=>f.default.join(e,`${u.default.createHash(`sha256`).update(t).digest(`hex`).slice(0,16)}.json`);function Ye(e){if(process.platform!==`win32`)for(let t of[f.default.dirname(e),e]){let e=d.default.lstatSync(t);if(!e.isDirectory()||e.uid!==process.getuid()||e.mode&18)throw Error(`Unsafe registry directory: ${t}`)}}function Xe(e){try{let t=JSON.parse(d.default.readFileSync(e,`utf8`));return typeof t.project!=`string`||typeof t.root!=`string`||typeof t.serverId!=`string`||!Number.isInteger(t.pid)||!Number.isFinite(t.startedAt)||t.root!==f.default.join(t.project,`.ryugi`,`artifacts`)?null:t}catch{return null}}function Ze(e){let t;try{Ye(e),t=d.default.readdirSync(e)}catch{return[]}return t.filter(e=>e.endsWith(`.json`)).flatMap(t=>Xe(f.default.join(e,t))??[])}function Qe(e,t){let n=Je(e,t.project);Xe(n)?.serverId===t.serverId&&d.default.rmSync(n,{force:!0})}const $e=/^[a-z][a-z0-9-]{0,63}$/;function et(){let e=process.env.RYUGI_PACKAGE;if(e)return $e.test(e)?e:void 0;if(typeof __dirname==`string`)try{let{name:e}=JSON.parse(d.default.readFileSync(f.default.join(__dirname,`..`,`package.json`),`utf8`));return typeof e==`string`&&$e.test(e)?e:void 0}catch{return}}const tt=et(),nt={"X-Ryugi-Version":x,...tt?{"X-Ryugi-Package":tt}:{}},rt=/* @__PURE__ */ new Set([`darwin-arm64`,`linux-x64`,`linux-arm64`]),it=/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/,at=e=>it.test(e);async function ot(e,t,n,r,i,a){let o=`${n.replace(/\/+$/,``)}/v${t}/${e}`,s=await r(o,{signal:i});if(!s.ok)throw Object.assign(/* @__PURE__ */ Error(`could not download ${e} ${t}: HTTP ${s.status}`),{status:s.status});let c=Number(s.headers.get(`content-length`))||void 0;a?.(0,c);let l=[],d=0,f=s.body?.getReader();for(let e=await f?.read();e&&!e.done;e=await f?.read())l.push(Buffer.from(e.value)),d+=e.value.length,a?.(d,c);let p=Buffer.concat(l),m=await r(`${o}.sha256`,{signal:i});if(!m.ok)throw Object.assign(/* @__PURE__ */ Error(`could not download the sha256 for ${e}: HTTP ${m.status}`),{status:m.status});if((await m.text()).trim().split(/\s+/)[0]?.toLowerCase()!==u.default.createHash(`sha256`).update(p).digest(`hex`))throw Error(`${e} failed its sha256 check; nothing was installed`);return p}function st(e,t){d.default.mkdirSync(f.default.dirname(e),{recursive:!0,mode:448});let n=`${e}.${process.pid}.tmp`;d.default.writeFileSync(n,t,{mode:493}),d.default.chmodSync(n,493),d.default.renameSync(n,e)}const ct=e=>f.default.join(e,`.ryugi`,`hook`),lt=(e,t)=>f.default.join(ct(e),t),ut=(e,t)=>rt.has(`${e}-${t}`)?`ryugi-hook-${e}-${t}`:null;function dt(e){try{return d.default.statSync(e).isFile()&&!!(d.default.statSync(e).mode&73)}catch{return!1}}function ft(e,t){try{let n=JSON.parse(d.default.readFileSync(e,`utf8`));return t-n.at<(n.status===404?5:60)*6e4}catch{return!1}}function pt(e,t){try{return d.default.writeFileSync(e,String(process.pid),{flag:`wx`}),!0}catch{}try{return t-d.default.statSync(e).mtimeMs<3e5?!1:(d.default.rmSync(e,{force:!0}),d.default.writeFileSync(e,String(process.pid),{flag:`wx`}),!0)}catch{return!1}}async function mt(e){let t=ut(e.platform,e.arch);if(!t||!at(e.version))return{status:`skipped`};let n=e.now??Date.now(),r=lt(e.home,e.version),i=f.default.join(r,`ryugi-hook`);if(dt(i))return{status:`present`};d.default.mkdirSync(r,{recursive:!0,mode:448});let a=f.default.join(r,`.failed`);if(!e.retry&&ft(a,n))return{status:`skipped`,error:`the last download failed; it is retried later`};let o=f.default.join(r,`.lock`);if(!pt(o,n))return{status:`skipped`,error:`another download is in progress`};let s=AbortSignal.timeout(e.timeoutMs??6e4);try{let n=process.env.RYUGI_HOOK_RELEASE_BASE||`https://github.com/Innei/ryugi/releases/download`;return st(i,await ot(t,e.version,n,e.fetch,s,e.onProgress)),d.default.rmSync(a,{force:!0}),{status:`installed`}}catch(t){let r=t.status??null;return d.default.writeFileSync(a,JSON.stringify({at:n,status:r})),{status:`failed`,error:s.aborted?`the download of ryugi-hook ${e.version} timed out`:t.message}}finally{d.default.rmSync(o,{force:!0})}}const ht=(e,t)=>f.default.resolve(e)===f.default.join(t,`.ryugi`,`server`),gt=e=>e===`win32`?`ryugi-daemon.exe`:`ryugi-daemon`,_t=(e,t)=>`ryugi-daemon-${e}-${t}${e===`win32`?`.exe`:``}`;function vt(e){return ht(e.serverHome,e.home)?f.default.join(e.home,`.ryugi`,`bin`,gt(e.platform)):f.default.join(e.serverHome,`bin`,gt(e.platform))}function yt(e){let t=(0,p.spawnSync)(e,[`--version`],{encoding:`utf8`,timeout:5e3}),n=/^ryugi-daemon (\S+)(?: \(src ([^)]+)\))?/.exec(t.stdout??``);return t.status!==0||!n?null:{version:n[1],...n[2]?{source:n[2]}:{}}}const bt=(e,t)=>!!e&&(t.daemonSource?e.source===t.daemonSource:e.version===t.version);async function xt(e){let t=e.timeoutMs??18e4,n=AbortSignal.timeout(t);try{return await ot(_t(e.platform,e.arch),e.version,e.env.RYUGI_DAEMON_RELEASE_BASE||`https://github.com/Innei/ryugi/releases/download`,e.fetch,n)}catch(e){throw n.aborted?Error(`the download timed out after ${t/1e3} s`,{cause:e}):e}}var St=class extends Error{};async function Ct(e,t){let n=e.env.RYUGI_DAEMON_BIN;if(n){if(!d.default.existsSync(n))throw new St(`RYUGI_DAEMON_BIN names ${n}, which does not exist`);return n}let r=vt(e);if(!at(e.version)){let t=[f.default.join(e.cliDir,gt(e.platform)),r].find(e=>d.default.existsSync(e));if(t)return t;throw new St(`This ryugi is a local build (${e.version||`no version`}), so there is no ryugi-daemon release to download for it. Build one with \`cargo build --manifest-path daemon/Cargo.toml\` and set RYUGI_DAEMON_BIN to it.`)}return d.default.existsSync(r)&&bt(yt(r),e)||(t?.(),st(r,await xt(e).catch(t=>{throw new St(`Could not download ryugi-daemon ${e.version} for ${e.platform}-${e.arch}: ${t.message}. The hub runs from that binary and there is no other way to start it; check the network, or set RYUGI_DAEMON_BIN to a ryugi-daemon build.`)}))),r}const wt=`dev.ryugi.daemon`,Tt=`ryugi-daemon.service`,Et=`--launch=`,Dt=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`);function Ot(e){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
38
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
39
|
+
<plist version="1.0">
|
|
40
|
+
<dict>
|
|
41
|
+
<key>Label</key>
|
|
42
|
+
<string>${wt}</string>
|
|
43
|
+
<key>ProgramArguments</key>
|
|
44
|
+
<array>
|
|
45
|
+
<string>${Dt(e.binary)}</string>
|
|
46
|
+
<string>hub</string>
|
|
47
|
+
<string>${Dt(`${Et}${e.launch}`)}</string>
|
|
48
|
+
</array>
|
|
49
|
+
<key>KeepAlive</key>
|
|
50
|
+
<dict>
|
|
51
|
+
<key>SuccessfulExit</key>
|
|
52
|
+
<false/>
|
|
53
|
+
</dict>
|
|
54
|
+
<key>ThrottleInterval</key>
|
|
55
|
+
<integer>5</integer>
|
|
56
|
+
<key>RunAtLoad</key>
|
|
57
|
+
<true/>
|
|
58
|
+
<key>AbandonProcessGroup</key>
|
|
59
|
+
<true/>
|
|
60
|
+
<key>ProcessType</key>
|
|
61
|
+
<string>Standard</string>
|
|
62
|
+
<key>EnvironmentVariables</key>
|
|
63
|
+
<dict>
|
|
64
|
+
<key>PATH</key>
|
|
65
|
+
<string>${Dt(e.path)}</string>
|
|
66
|
+
</dict>
|
|
67
|
+
<key>StandardErrorPath</key>
|
|
68
|
+
<string>${Dt(e.log)}</string>
|
|
69
|
+
<key>StandardOutPath</key>
|
|
70
|
+
<string>${Dt(e.log)}</string>
|
|
71
|
+
</dict>
|
|
72
|
+
</plist>
|
|
73
|
+
`}const kt=e=>`"${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`).replaceAll(`%`,`%%`)}"`;function At(e){let t=e.log.replaceAll(`%`,`%%`);return`[Unit]
|
|
74
|
+
Description=Ryugi hub
|
|
75
|
+
|
|
76
|
+
[Service]
|
|
77
|
+
ExecStart=${kt(e.binary)} hub ${kt(`${Et}${e.launch}`)}
|
|
78
|
+
Restart=on-failure
|
|
79
|
+
RestartSec=5
|
|
80
|
+
KillMode=process
|
|
81
|
+
Environment=${kt(`PATH=${e.path}`)}
|
|
82
|
+
StandardOutput=append:${t}
|
|
83
|
+
StandardError=append:${t}
|
|
84
|
+
|
|
85
|
+
[Install]
|
|
86
|
+
WantedBy=default.target
|
|
87
|
+
`}const jt=(e,t)=>{if(e.status!==0)throw Error(`${t} failed: ${e.stderr.trim()}`)},Mt=e=>{try{return d.default.readFileSync(e,`utf8`)}catch{return null}},Nt=e=>{let t=Mt(e);return t!==null&&!t.includes(Et)},Pt=(e,t)=>{d.default.mkdirSync(f.default.dirname(e),{recursive:!0}),d.default.writeFileSync(e,t)};function Ft(e){let t=`gui/${e.uid}/${wt}`,n=f.default.join(e.home,`Library`,`LaunchAgents`,`${wt}.plist`),r=f.default.join(e.serverHome,`${wt}.plist`),i=e=>e?n:r;return{file:i,kind:`agent`,check:()=>null,disable:()=>{},legacy:()=>Nt(n),render:Ot,write:e=>(Pt(i(e.autostart),Ot(e)),d.default.rmSync(i(!e.autostart),{force:!0}),i(e.autostart)),load:n=>{e.run(`launchctl`,[`bootout`,t]),jt(e.run(`launchctl`,[`bootstrap`,`gui/${e.uid}`,i(n)]),`launchctl bootstrap`)},unload:()=>{e.run(`launchctl`,[`bootout`,t])},linger:()=>void 0}}function It(e){let t=(...t)=>e.run(`systemctl`,[`--user`,...t]),n,r=()=>n??=t(`show-environment`),i=()=>{let t=r();return t.status===0?/^XDG_CONFIG_HOME=(.+)$/m.exec(t.stdout??``)?.[1]??f.default.join(e.home,`.config`):e.configHome??f.default.join(e.home,`.config`)},a=()=>f.default.join(i(),`systemd`,`user`,Tt);return{file:a,kind:`service`,check:()=>{let e=r();return e.status===0?null:`systemd user services are not available here (systemctl --user: ${e.stderr.trim()||`failed`})`},disable:()=>{t(`disable`,Tt)},legacy:()=>Nt(a()),render:At,write:e=>(Pt(a(),At(e)),a()),load:e=>{jt(t(`daemon-reload`),`systemctl --user daemon-reload`),e?jt(t(`enable`,Tt),`systemctl --user enable ${Tt}`):t(`disable`,Tt),jt(t(`restart`,Tt),`systemctl --user restart ${Tt}`)},unload:()=>{t(`stop`,Tt)},linger:()=>{let t=e.run(`loginctl`,[`enable-linger`]);return t.status===0?{enabled:!0}:{enabled:!1,error:t.stderr.trim()||`exit ${t.status}`}}}}function Lt(e){return e.platform===`darwin`?Ft(e):e.platform===`linux`?It(e):null}const Rt={darwin:[`arm64`],linux:[`x64`,`arm64`]},zt=e=>e>=11904;function Bt(e,t){let n=0;for(let r of e)n+=t*(zt(r.codePointAt(0))?1:.56);return n}function Vt(e,t,n){return e.split(`
|
|
88
|
+
`).reduce((e,r)=>e+Math.max(1,Math.ceil(Bt(r,t)/n)),0)}function Ht(e,t){let n=e.boards.map(e=>t[e]).filter(e=>!!e),r=n[0];if(!r)return null;let i=Math.min(...n.map(e=>e.x)),a=Math.min(...n.map(e=>e.y)),o=Math.max(...n.map(e=>e.x+e.w)),s=Math.max(...n.map(e=>e.y+e.h));return{page:r.page,x:i-48,y:a-144,w:o-i+96,h:s-a+144+48}}const Ut=e=>Math.ceil(Bt(e,40)+80+28+16);function Wt(e){if(e.kind===`condition`)return{x:e.x,y:e.y,w:Ut(e.text),h:96};if(e.kind===`sticky`){let t=e.w??240,n=Vt(e.text,18,Math.max(1,t-32));return{x:e.x,y:e.y,w:t,h:n*27+32}}let t=Gt(e),n=Kt(e);return n?{...t,w:e.w??Math.max(t.w,n.w),h:t.h+n.gap+n.h}:t}function Gt(e){let t=e.size??96,n=t*1.15;return e.w===void 0?{x:e.x,y:e.y,w:Bt(e.text,t),h:n}:{x:e.x,y:e.y,w:e.w,h:Vt(e.text,t,e.w)*n}}function Kt(e){if(e.kind!==`title`||!e.description)return null;let t=e.size??96,n=Math.max(18,Math.round(t*.4)),r=Math.min(e.w??1/0,n*40),i=Math.max(...e.description.split(`
|
|
89
|
+
`).map(e=>Bt(e,n)));return{size:n,maxWidth:r,gap:t*.25,w:Math.min(r,i),h:Vt(e.description,n,r)*n*1.5}}function qt(e,t){let n={minX:t.x,minY:t.y,maxX:t.x+t.w,maxY:t.y+t.h};return e?{minX:Math.min(e.minX,n.minX),minY:Math.min(e.minY,n.minY),maxX:Math.max(e.maxX,n.maxX),maxY:Math.max(e.maxY,n.maxY)}:n}function Jt(e){let t={},n=e=>t[e]??={groups:{},notes:{},bounds:null};for(let t of e.pages)n(t.id);for(let t of Object.values(e.boards)){let e=n(t.page);e.bounds=qt(e.bounds,{...t,y:t.y-48,h:t.h+48})}for(let[t,r]of Object.entries(e.groups??{})){let i=Ht(r,e.boards);if(!i)continue;let{page:a,...o}=i,s=n(a);s.groups[t]=o,s.bounds=qt(s.bounds,o)}for(let[t,r]of Object.entries(e.notes??{})){let e=Wt(r),i=n(r.page);i.notes[t]=e,i.bounds=qt(i.bounds,e)}return{pages:t}}const Yt=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,Xt=[`x`,`y`,`w`,`h`],Zt=[`file`,`page`,...Xt],Qt=[`src`,`page`,...Xt],$t=e=>j(e)?e.src??``:e.file,en=e=>j(e)?`src`:`file`,L=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function tn(e){if(!L(e))return[`canvas.json must be a JSON object`];let t=[];if(Array.isArray(e.pages)||t.push(`"pages" must be an array`),L(e.boards)||t.push(`"boards" must be an object`),e.groups!==void 0&&!L(e.groups)&&t.push(`"groups" must be an object`),e.notes!==void 0&&!L(e.notes)&&t.push(`"notes" must be an object`),e.edges!==void 0&&!L(e.edges)&&t.push(`"edges" must be an object`),e.focus===void 0||L(e.focus)&&typeof e.focus.target==`string`||t.push(`"focus" must be { "target": <id> }`),e.building!==void 0&&typeof e.building!=`boolean`&&t.push(`"building" must be a boolean`),e.writing===void 0||typeof e.writing==`string`&&e.writing||t.push(`"writing" must be a board id`),L(e.notes))for(let[n,r]of Object.entries(e.notes))L(r)&&r.color!==void 0&&(typeof r.color!=`string`||!/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(r.color))&&t.push(`note "${n}" color must be #RGB or #RRGGBB`);if(L(e.boards))for(let[n,r]of Object.entries(e.boards))L(r)&&r.trim!==void 0&&typeof r.trim!=`boolean`&&t.push(`board "${n}" field "trim" must be a boolean`),L(r)&&r.interactive!==void 0&&typeof r.interactive!=`boolean`&&t.push(`board "${n}" field "interactive" must be a boolean`),L(r)&&r.fit!==void 0&&typeof r.fit!=`boolean`&&t.push(`board "${n}" field "fit" must be a boolean`),L(r)&&r.type!==void 0&&!oe.includes(r.type)&&t.push(`board "${n}" field "type" must be "html", "image" or "video"`);if(L(e.edges))for(let[n,r]of Object.entries(e.edges))!L(r)||typeof r.from!=`string`||typeof r.to!=`string`?t.push(`edge "${n}" needs string "from" and "to"`):r.label!==void 0&&typeof r.label!=`string`&&t.push(`edge "${n}" field "label" must be a string`);if(L(e.groups))for(let[n,r]of Object.entries(e.groups)){L(r)&&r.verify!==void 0&&typeof r.verify!=`boolean`&&t.push(`group "${n}" field "verify" must be a boolean`);for(let e of[`from`,`capturedAt`])L(r)&&r[e]!==void 0&&typeof r[e]!=`string`&&t.push(`group "${n}" field "${e}" must be a string`);L(r)&&r.choose!==void 0&&typeof r.choose!=`boolean`&&t.push(`group "${n}" field "choose" must be a boolean`)}if(t.length>0)return t;e.pages.forEach((e,n)=>{L(e)&&typeof e.id==`string`&&typeof e.name==`string`||t.push(`pages[${n}] needs string "id" and "name"`)});for(let[n,r]of Object.entries(e.boards))if(!L(r))t.push(`board "${n}" must be an object`);else{for(let e of j(r)?Qt:Zt)r[e]===void 0&&t.push(`board "${n}" is missing "${e}"`);for(let e of Xt)r[e]!==void 0&&typeof r[e]!=`number`&&t.push(`board "${n}" field "${e}" must be a number`);for(let e of[`file`,`src`,`page`])r[e]!==void 0&&typeof r[e]!=`string`&&t.push(`board "${n}" field "${e}" must be a string`)}for(let[n,r]of Object.entries(e.groups??{}))!L(r)||!Array.isArray(r.boards)||r.boards.some(e=>typeof e!=`string`)?t.push(`group "${n}" needs a "boards" array`):(r.recommend!==void 0&&!r.boards.includes(r.recommend)&&t.push(`group "${n}" recommends "${String(r.recommend)}", which is not one of its boards`),r.choose===!0&&r.verify===!0&&t.push(`group "${n}" cannot be both "choose" and "verify"`));for(let[n,r]of Object.entries(e.notes??{}))!L(r)||r.kind!==`title`&&r.kind!==`sticky`&&r.kind!==`condition`?t.push(`note "${n}" needs "kind" "title", "sticky" or "condition"`):typeof r.x!=`number`||typeof r.y!=`number`||typeof r.text!=`string`||typeof r.page!=`string`?t.push(`note "${n}" needs numeric "x", "y" and string "text", "page"`):r.description!==void 0&&r.kind!==`title`?t.push(`note "${n}" is a ${r.kind}: only a title takes "description"`):r.description!==void 0&&typeof r.description!=`string`&&t.push(`note "${n}" needs a string "description"`);return t}function nn(e){let t=[],n=Object.entries(e.edges??{}),r=e.notes??{},i=t=>e.boards[t]?.page??r[t]?.page,a=t=>!!e.boards[t]||r[t]?.kind===`condition`,o=/* @__PURE__ */ new Map,s=/* @__PURE__ */ new Map,c=/* @__PURE__ */ new Map;for(let[l,u]of n){let n=!0;for(let i of/* @__PURE__ */ new Set([u.from,u.to]))if(e.boards[i]&&r[i])t.push(`edge "${l}" end "${i}" names both a board and a note`),n=!1;else if(a(i))continue;else r[i]||e.groups?.[i]?(t.push(`edge "${l}" end "${i}" is not a board or condition`),n=!1):(t.push(`edge "${l}" references unknown board or condition "${i}"`),n=!1);if([...u.label??``].length>32&&t.push(`edge "${l}" label is longer than 32 characters`),!n)continue;if(u.from===u.to){t.push(`edge "${l}" starts and ends at "${u.from}"`);continue}if(i(u.from)!==i(u.to)){t.push(`edge "${l}" connects different pages`);continue}let d=JSON.stringify([u.from,u.to]),f=o.get(d);f===void 0?(o.set(d,l),s.set(u.to,(s.get(u.to)??0)+1),c.set(u.from,(c.get(u.from)??0)+1),r[u.from]?.kind===`condition`&&!u.label?.trim()&&t.push(`edge "${l}" leaves condition "${u.from}" and needs a "label"`)):t.push(`edges "${f}" and "${l}" both connect "${u.from}" to "${u.to}"`)}for(let[n,i]of Object.entries(r))i.kind!==`condition`||e.boards[n]||(s.get(n)||t.push(`condition "${n}" has no incoming edge`),(c.get(n)??0)<2&&t.push(`condition "${n}" needs at least two outgoing edges`));return t}function rn(e,t,n){return!n||!t||t.toLowerCase()!==n.toLowerCase()?null:`"${e}" must not repeat the artifact slug "${n}"`}function an(e,t,n={}){let r=tn(e);if(r.length>0)return r;let i=e,a=[],o=rn(`title`,typeof i.title==`string`?i.title.trim():``,n.artifact);o&&a.push(o);let s=new Set(i.pages.map(e=>e.id)),c=Object.entries(i.boards),l=Object.entries(i.groups??{}),u=Object.entries(i.notes??{});for(let[e,r]of c){s.has(r.page)||a.push(`board "${e}" uses unknown page "${r.page}"`);let i=$t(r);i.startsWith(`pages/`)?t(i)||(n.pending?.add(e),n.allowPending||a.push(`board "${e}" file not found: ${i}`)):a.push(`board "${e}" ${en(r)} must start with "pages/": ${i}`);let o=r.props;o!==void 0&&(j(r)?a.push(`board "${e}" is ${r.type===`image`?`an image`:`a video`} board: only an HTML board takes "props"`):L(o)?JSON.stringify(o).length>4096&&a.push(`board "${e}" "props" must be at most 4096 characters of JSON`):a.push(`board "${e}" field "props" must be an object`))}for(let e=0;e<c.length;e++)for(let t=e+1;t<c.length;t++){let[n,r]=c[e],[i,o]=c[t];r.page===o.page&&Yt(r,o)&&a.push(`boards "${n}" and "${i}" overlap`)}let d=[];for(let[e,t]of l){for(let n of t.boards)i.boards[n]||a.push(`group "${e}" references unknown board "${n}"`);new Set(t.boards.map(e=>i.boards[e]?.page).filter(Boolean)).size>1?a.push(`group "${e}" spans several pages`):d.push([e,Ht(t,i.boards)])}for(let e=0;e<d.length;e++)for(let t=e+1;t<d.length;t++){let[n,r]=d[e],[i,o]=d[t];r&&o&&r.page===o.page&&Yt(r,o)&&a.push(`groups "${n}" and "${i}" overlap`)}let f=new Set(l.flatMap(([,e])=>e.boards));for(let[e,t]of u){if(!s.has(t.page)){a.push(`note "${e}" uses unknown page "${t.page}"`);continue}t.kind===`title`&&Bt(t.text,1)>40&&a.push(`title "${e}" is too long: keep "text" to one short line (40 full-width or about 70 Latin characters) and move the rest to "description"`);let n=Wt(t);if(t.kind===`title`)for(let[r,i]of d)i&&i.page===t.page&&Yt(n,i)&&a.push(`title "${e}" overlaps group "${r}"`);for(let[r,i]of c)t.kind===`title`&&f.has(r)||i.page===t.page&&Yt(n,i)&&a.push(`${t.kind} "${e}" covers board "${r}"`)}a.push(...nn(i)),i.activePage!==void 0&&!s.has(i.activePage)&&a.push(`activePage "${i.activePage}" is not a page`);let p=i.focus?.target;return i.writing!==void 0&&!i.boards[i.writing]&&a.push(`writing target "${i.writing}" is not a board`),p===void 0||i.boards[p]||i.groups?.[p]||i.notes?.[p]||a.push(`focus target "${p}" is not a board, group or note`),a}const on=`main`,sn=`pages.json`,cn=`pages`,ln=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,un=e=>typeof e==`string`&&e.length<=64&&ln.test(e),dn=e=>e===`main`?`scene.excalidraw`:`${cn}/${e}.excalidraw`,fn=e=>{if(typeof e!=`object`||!e)return null;let{id:t,name:n,deleted:r}=e;return typeof t==`string`?{id:t,...typeof n==`string`&&n.trim()?{name:n.trim()}:{},...r===!0?{deleted:!0}:{}}:null};function pn(e){if(e===null)return{pages:[]};let t;try{t=JSON.parse(e)}catch{return{pages:[],error:`pages.json is not valid JSON`}}let n=t?.pages;return Array.isArray(n)?{pages:n.map(fn).filter(e=>e!==null)}:{pages:[],error:`pages.json needs a "pages" array`}}function mn(e,t){let n=[],r=/* @__PURE__ */ new Set,i=[];for(let t of e)un(t.id)?r.has(t.id)?n.push(`pages.json: page ${t.id} is listed twice; only the first is kept`):(r.add(t.id),i.push(t)):n.push(`pages.json: page id "${t.id}" must be lowercase letters, digits and hyphens`);let a=i.findIndex(e=>e.id===on);i.length>0&&a!==0&&n.push(`pages.json: main is always the first page; it was moved to the top`);let o=a===-1?{id:on}:i.splice(a,1)[0];o.deleted&&n.push(`pages.json: main can’t be deleted; its "deleted" is ignored`);let{deleted:s,...c}=o,l=[c,...i];for(let e of t)un(e)&&e!==`main`&&!r.has(e)&&(r.add(e),l.push({id:e}),n.push(`pages/${e}.excalidraw is not in pages.json; add it there`));return l.length>50&&n.push(`pages.json lists ${l.length} pages; only the first 50 are used`),{pages:l.slice(0,50),warnings:n}}function hn(e,t){let n=f.default.resolve(e,`.${f.default.sep}${t}`);return!n.startsWith(e+f.default.sep)||f.default.relative(e,n).split(f.default.sep).some(e=>e.startsWith(`.`))?null:n}const gn=(e,t)=>e.toLowerCase().startsWith(`${t.toLowerCase()}${f.default.sep}`);function _n(e,t,n){let r=hn(e,t);if(!r)return null;let i,a;try{i=d.default.realpathSync(r),a=d.default.realpathSync(n)}catch{return null}return gn(i,a)&&d.default.statSync(i).isFile()?i:null}const vn=(e,t)=>_n(e,t,f.default.join(e,`pages`));function yn(e){let t;try{t=d.default.readFileSync(f.default.join(e,A.artboard),`utf8`)}catch{return{warning:`canvas.json not found`}}try{return{raw:JSON.parse(t)}}catch(e){return{warning:`canvas.json is not valid JSON: ${e.message}`}}}function bn(e,t){let n={},r,i=-1/0;for(let[a,o]of Object.entries(t.boards)){let t=vn(e,o.file);if(!t)n[o.file]=0;else try{let e=d.default.statSync(t);if(j(o)){n[o.file]=e.size>0?e.mtimeMs:0;continue}let s=d.default.readFileSync(t,`utf8`),c=/<(?:!doctype|html)\b/i.test(s),l=s.trim().length>0&&(!c||/<\/html>\s*(?:<!--[\s\S]*?-->\s*)*$/i.test(s));n[o.file]=l?e.mtimeMs:0,!l&&e.mtimeMs>=i&&(r=a,i=e.mtimeMs)}catch{n[o.file]=0}}return{versions:n,writing:r}}function xn(e){let{raw:t,warning:n}=yn(e);if(n)return{canvas:null,warnings:[n],pending:[],layout:null,versions:{}};try{let n=tn(t);if(n.length>0)return{canvas:null,warnings:n,pending:[],layout:null,versions:{}};let r={...t};r.boards=Object.fromEntries(Object.entries(r.boards).map(([e,t])=>[e,j(t)?{...t,file:t.src??``}:t]));let{versions:i,writing:a}=bn(e,r),o=/* @__PURE__ */ new Set;for(let[e,t]of Object.entries(r.boards))i[t.file]||o.add(e);return r.building=o.size>0,delete r.writing,a&&(r.writing=a),{canvas:r,warnings:an(r,t=>vn(e,t)!==null,{artifact:f.default.basename(e),pending:o,allowPending:!0}),pending:[...o].sort(),layout:Jt(r),versions:i}}catch(e){return{canvas:null,warnings:[`canvas.json could not be checked: ${e.message}`],pending:[],layout:null,versions:{}}}}function Sn(e,t){d.default.mkdirSync(f.default.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;d.default.writeFileSync(n,`${JSON.stringify(t,null,2)}\n`,{mode:384}),d.default.renameSync(n,e)}const Cn=e=>f.default.join(e,`settings.json`);function wn(e){try{let t=JSON.parse(d.default.readFileSync(Cn(e),`utf8`));return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}const Tn=e=>wn(e).sessionControl===!0;function En(e,t){d.default.mkdirSync(e,{recursive:!0,mode:448}),Sn(Cn(e),{...wn(e),sessionControl:t})}const Dn=/^(RYUGI_|ARTIFACTS_|XDG_|LC_)|^(HOME|USER|LOGNAME|SHELL|LANG|TMPDIR|PATH|NODE_EXTRA_CA_CERTS|SSL_CERT_FILE|SSL_CERT_DIR)$|_proxy$|_PROXY$/,On=e=>f.default.join(e.home,`launch.json`),kn=(e,t)=>[`hub`,`--artifacts-server-id=${e}`,...t?[`--port=${t}`]:[]];function An(e,t){let n={...process.env,ARTIFACTS_HOST:e,ARTIFACTS_URL_HOST:t,RYUGI_NODE:process.execPath,RYUGI_DOCUMENT_ENGINE:f.default.join(__dirname,`document-engine.cjs`),RYUGI_VIEWER_DIR:f.default.join(__dirname,`viewer`),RYUGI_RUNTIME_ASSETS_DIR:f.default.join(__dirname,`runtime`),...tt?{RYUGI_PACKAGE:tt}:{}};process.env.RYUGI_ARTIFACTS_COMMAND&&(n.RYUGI_ARTIFACTS_LAUNCHER=process.env.RYUGI_ARTIFACTS_COMMAND);for(let e of[`RYUGI_WRITER_HOST`,`RYUGI_WRITER_AGENT`,`RYUGI_ARTIFACTS_OWNER`,`RYUGI_ARTIFACTS_VERSION`,`RYUGI_ARTIFACTS_COMMAND`,`ARTIFACTS_OPEN_CMD`,`ARTIFACTS_ROOT`])delete n[e];return n}function jn(e,t){let n=Object.fromEntries(Object.entries(t.env).filter(e=>Dn.test(e[0])&&e[1]!==void 0)),r=On(e),i=`${r}.${process.pid}.tmp`;d.default.writeFileSync(i,`${JSON.stringify({args:t.args,env:n},null,2)}\n`,{mode:384}),d.default.renameSync(i,r),d.default.rmSync(f.default.join(e.home,`hub-start-failures`),{force:!0})}function Mn(e){try{let t=JSON.parse(d.default.readFileSync(On(e),`utf8`));return Array.isArray(t.args)&&t.env&&typeof t.env==`object`?{args:t.args,env:t.env}:null}catch{return null}}const Nn=[`RYUGI_NODE`,`RYUGI_DOCUMENT_ENGINE`,`RYUGI_VIEWER_DIR`,`RYUGI_RUNTIME_ASSETS_DIR`];function Pn(e,t){let n=Mn(e);return!n||Nn.some(e=>n.env[e]!==t[e])}function Fn(e,t){let n=e.args.filter(e=>!e.startsWith(`--artifacts-server-id=`));return{...e,args:[n[0]??`hub`,`--artifacts-server-id=${t}`,...n.slice(1)]}}const In=(e,t)=>{let n=(0,p.spawnSync)(e,t,{encoding:`utf8`});return{status:n.status,stderr:n.stderr||(n.error?.message??``),stdout:n.stdout??``}},Ln=(e,t=In)=>({configHome:process.env.XDG_CONFIG_HOME||void 0,home:h.default.homedir(),platform:process.platform,run:t,serverHome:e.home,uid:process.getuid?.()??0});function Rn(e){if(!ht(e.home,h.default.homedir()))return null;let t=Lt(Ln(e));return t&&!t.check()?t:null}const zn=e=>{let t=e?Number(e):NaN;return Number.isFinite(t)&&t>0?t:void 0};async function Bn(e,t){try{return await Ct({arch:process.arch,cliDir:__dirname,daemonSource:S||void 0,env:process.env,fetch,home:h.default.homedir(),platform:process.platform,serverHome:e.home,timeoutMs:zn(process.env.RYUGI_DAEMON_DOWNLOAD_TIMEOUT_MS),version:t})}catch(e){throw e instanceof St?new M(e.message):e}}function Vn(e,t){let n=Rn(e);if(!n)return!1;let r=n.legacy();r&&En(e.home,!0);let i=r||Tn(e.home);try{return n.write({autostart:i,binary:t,launch:On(e),log:e.log,path:process.env.PATH??`/usr/bin:/bin`}),n.load(i),!0}catch{return!1}}const Hn=1e4,Un=((e,t)=>{let n=process.env[e]?Number(process.env[e]):NaN;return Number.isFinite(n)&&n>=0?n:t})(`RYUGI_START_ALIVE_MS`,1e3),Wn=(e,t)=>e.split(`
|
|
90
|
+
`).find(e=>e.includes(`"${t}"`));async function Gn(e,t,n,r){jn(e,n);try{d.default.renameSync(e.log,`${e.log}.1`)}catch{}let i;if(!Vn(e,t)){let r=d.default.openSync(e.log,`w`),a=(0,p.spawn)(t,n.args,{env:n.env,detached:!0,windowsHide:!0,stdio:[`ignore`,r,r]});d.default.closeSync(r),a.unref(),i=a.pid,d.default.writeFileSync(e.pid,`${a.pid}\n`)}for(let t=0;t<Hn;t+=100){let t=P(e.log)??``,n=Wn(t,`server-started`);if(n){let t=JSON.parse(n),a=i??t.pid;a&&d.default.writeFileSync(e.pid,`${a}\n`);for(let e=0;e<Un;e+=100){if(a&&!pe(a))throw new M(`Server started but was killed. Retry in a persistent terminal with: ${r}`);await fe(100)}return{info:t}}let a=Wn(t,`server-error`);if(a)return{failed:JSON.parse(a)};let o=Wn(t,`server-standing-down`);if(o){let e=JSON.parse(o);return{failed:{type:`server-error`,error:`Another hub (pid ${e.pid}, port ${e.port}) already serves this machine; stop it and retry`}}}await fe(100)}throw new M(`Server failed to start within ${Hn/1e3} seconds`)}function Kn(e=process.env){return e.RYUGI_TOKEN?.trim()||null}function qn(e,t,n=process.env,r){let i=r?.trim()||Kn(n);if(i)return{origin:t,token:i,login:null,source:`env`};let a=Yn(e,t);return a?{...a,source:`store`}:null}function Jn(e,t,n){return t===`win32`&&e.APPDATA?f.default.join(e.APPDATA,`ryugi`,`credentials.json`):f.default.join(e.XDG_CONFIG_HOME||f.default.join(n,`.config`),`ryugi`,`credentials.json`)}function Yn(e,t){let n;try{n=JSON.parse(d.default.readFileSync(e,`utf8`))}catch{return null}if(typeof n!=`object`||!n)return null;let{origin:r,token:i,login:a}=n;return typeof r!=`string`||typeof i!=`string`||typeof a!=`string`||D(r)!==D(t)?null:{origin:t,token:i,login:a}}function Xn(e){let t=Jn(process.env,process.platform,h.default.homedir());if(qn(t,ie(process.env)))return;let n=f.default.join(f.default.dirname(t),`login-hint-shown`);try{d.default.mkdirSync(f.default.dirname(n),{recursive:!0,mode:448}),d.default.writeFileSync(n,`1
|
|
91
|
+
`,{flag:`wx`,mode:384})}catch(e){if(e.code===`EEXIST`)return}return{message:`Recommended: sign in to Artideck Cloud to share artifacts and review them from other devices. Sign-in is optional; local work can continue.`,command:`${process.env.RYUGI_ARTIFACTS_COMMAND||`npx artideck`} publish --login --from hint`,projectDir:e,agentInstruction:`Briefly pass this recommendation to your human partner and offer to run command in projectDir. It prints a code and an address; they confirm the code on any device signed in to Artideck Cloud, such as their phone. Continue the current task without waiting for sign-in.`}}const Zn=[`add`,`reply`,`resolve`,`choose`,`submit`,`answer`,`note`,`pass`,`reject`,`waive`];function Qn(){if(process.stdin.isTTY)return``;try{return d.default.readFileSync(0,`utf8`)}catch{return``}}function $n(e){let t=(e.text??Qn()).trim();if(!t)throw new M(`The message is empty: pass --text <text> or pipe it on stdin`);return t}function er(e,t){if(e===void 0)return;let n=Number(e);if(!Number.isFinite(n))throw new M(`${t} must be a number`);return n}var tr='# Artboard writing\n\nWrite `canvas.json` and board HTML/media under `pages/`. Re-read canvas before each edit; preserve human edits, stable IDs and positions. Never edit comments.json or `.state/`.\n\n## Writing order\n\nNew artboard or round: apply canvas changes as soon as the structure is ready, before composing a large HTML batch. Scripts and batch writes are fine: canvas first, then HTML with the focus group first; other boards may run in parallel. Existing board content edits need HTML only unless layout, grouping, metadata or focus changes.\n\n## canvas.json\n\n```json\n{\n "version": 1,\n "title": "Delivery settings",\n "activePage": "settings",\n "pages": [{ "id": "settings", "name": "Settings" }],\n "boards": {\n "q1-a": {\n "file": "pages/settings/retry.html",\n "page": "settings",\n "x": 0,\n "y": 0,\n "w": 640,\n "h": 400,\n "title": "Fixed delay",\n "props": { "strategy": "fixed" }\n },\n "q1-b": {\n "file": "pages/settings/retry.html",\n "page": "settings",\n "x": 720,\n "y": 0,\n "w": 640,\n "h": 400,\n "title": "Exponential",\n "props": { "strategy": "exponential" }\n }\n },\n "groups": {\n "q1": { "title": "Retry strategy", "boards": ["q1-a", "q1-b"], "choose": true, "recommend": "q1-b" }\n },\n "notes": {\n "round-one": {\n "kind": "title",\n "page": "settings",\n "x": 0,\n "y": -480,\n "text": "Delivery settings · round 1",\n "description": "Pick how a failed delivery is retried. Comment on a board, or answer in the terminal."\n }\n }\n}\n```\n\n- **Title**: readable, distinct from the slug.\n- **Boards**: HTML boards require file/page/x/y/w/h; title/interactive are optional. Media boards use type:"image"|"video" and src instead of file.\n- **Props**: options of one choice that differ only in a few values (a token, a copy line, a state) are one file. So are options that are the same page with a part added, removed or restyled (an extra line, button or section): props switch those parts (`"recs": true`) and carry their copy. Options that arrange the page differently (navigation moved, regions reordered or regrouped) get their own files and no props, even when much of their content repeats; the parts they share (top bar, table styles, a scene script) go in one stylesheet or script under `pages/` that each file links, never into `tokens.css`. Each board passes what differs as `props`, a JSON object of at most 4096 characters, which the page reads as `window.ryugiProps` before its own scripts run. Props carry only an option\'s departures from `tokens.css` and the page\'s own defaults: CSS variables keyed by their name, other values by what they set. Values that differ per mode go one level down under `light` and `dark`, mode first, then variable: `"short": { "file": "pages/pay/button.html", "props": { "label": "Pay", "light": { "--button-bg": "#2563eb" }, "dark": { "--button-bg": "#3b82f6" } }, ... }`. A value no token holds yet goes into `tokens.css` with a default that changes nothing and still combines with other values (`0 0 0 0 transparent` for a shadow, `transparent` for a colour); props override it. New props reload that board and leave only it for Check. Comment threads and selected nodes include their board\'s props: read them with the file.\n- **Resources**: relative paths under pages/; other directories are not served. Limits: 8MB per media file, 20MB per artboard. Video: mp4(H.264)/webm. Verify clips trim idle ends with one second context and retain originals; trim:false preserves timing/narration. Check recordings/pending before handoff.\n- **Tokens**: the product\'s current tokens live in one `pages/tokens.css`, linked by every board; never copy token values into each board. Light values sit on `:root, [data-appearance="light"]`, dark ones under `[data-appearance="dark"]`, the attribute the mockup shell also carries, so a light half inside a dark one keeps its own values; a light-only product writes no dark block. An option that changes a token passes only the new value, as props, and its page sets each mode\'s props as CSS variables on the element carrying that mode\'s `data-appearance`; the option showing current values passes none and reads `window.ryugiProps` as `{}`.\n- **Groups** contain board IDs from one page: plain groups organize, choose:true + recommend:<member> asks a choice, verify:true + from:<environment/build> + capturedAt:<real ISO capture time> asks a verdict. Never combine choose and verify. A group\'s title is its short question; the round\'s title note names the round, so the two never repeat each other.\n- **Notes** require kind (title/sticky/condition), page/x/y/text; sticky w defaults to 240, optional color is #RGB/#RRGGBB.\n- **Titles** name a round or area in one short line: at most 40 full-width or about 70 Latin characters, size defaults to 96. Everything that explains it (what changed, how to answer, where to start) goes in the title\'s `description`, drawn smaller under it and wrapped at 40 characters, or at the title\'s w when that is narrower. A description makes the note taller: keep boards clear of its whole rectangle.\n- **Edges** connect boards that follow one another: see Flows.\n- **Opening view**: activePage is the opening default; existing readers keep their page. Top-level `focus` `{target:<board/group/note>}` guides first ready content/phone question without resetting open camera/drafts. Share ?page=<id> for a new area.\n- **Spacing** is explicit, measured between board rectangles: 80px horizontal board gap, 160px row gap; group frame 144px above and 48px outside boards. Leave 240px vertically/200px horizontally between groups; notes >=80px clear.\n- **Placing a round**: read `.state/artboard/<id>/layout.json` for actual group/note rectangles and page bounds first. The round\'s title goes at y 0 on an empty page, else at maxY+120. At the default size 96 a title is 110.4 tall, plus 24 and 57 per description line (40 full-width or about 70 Latin characters a line). The round\'s first row of boards starts at title y + title height + 80 + 144, rounded up to a whole pixel. Mixed full-width and Latin text wraps less predictably: after the first Check, read the title\'s height from `layout.json` and move the boards if it differs.\n- **Sizes**: desktop1280x800, phone402x874, tablet834x1194, component640x400. A board at any other size (a component, a long page) takes the height its content needs when Check runs, growing or shrinking, and what sits below its row moves with it, so leave its h to Check; `"fit": false` keeps its h. Without agent-browser Check only grows boards. A device size keeps its h. Content taller or wider than its frame is `W_BOARD_CLIPPED`: fix the size or the content. A page whose height comes from the viewport (vh, 100%) only grows once: give it a height of its own.\n\n## Flows\n\nWhen boards are steps of one path (an action on one screen opens the next, a condition forks, an error leads back), draw the path: connect them with `edges` and use condition notes for branches. Boards that are options to compare stay unconnected in a group. The viewer routes lines and keeps them attached when nodes move. Edit `edges` to change connections.\n\n```json\n{\n "version": 1,\n "title": "Publish flow",\n "pages": [{ "id": "flow", "name": "Flow" }],\n "boards": {\n "artboard": { "file": "pages/flow/artboard.html", "page": "flow", "x": 0, "y": 0, "w": 1280, "h": 800, "title": "Artboard" },\n "sign-in": { "file": "pages/flow/sign-in.html", "page": "flow", "x": 2308, "y": 1200, "w": 1280, "h": 800, "title": "Sign in" },\n "share": { "file": "pages/flow/share.html", "page": "flow", "x": 4068, "y": 0, "w": 1280, "h": 800, "title": "Share panel" }\n },\n "notes": {\n "signed-in": { "kind": "condition", "page": "flow", "x": 1760, "y": 328, "text": "Signed in?" }\n },\n "edges": {\n "publish": { "from": "artboard", "to": "signed-in", "label": "Click Publish" },\n "yes": { "from": "signed-in", "to": "share", "label": "Yes" },\n "no": { "from": "signed-in", "to": "sign-in", "label": "No" },\n "done": { "from": "sign-in", "to": "share", "label": "Signed in" }\n }\n}\n```\n\nEdge `from`/`to` reference board or condition IDs on one page; boards and notes share an ID space. Optional `label`: one line, at most 32 characters. Conditions require page/x/y/text, one incoming edge and at least two outgoing edges, each labelled. They are 96px tall, text-width, without wrapping.\n\nLay out flows on a grid with 480px between connected boards and on each side of a condition. Align a condition with a board at `y + (h - 48) / 2 - 48` (the name strip is 48px). Keep the main path on one row and branches below, clear of other boards.\n\nFix `edge "<id>" crosses board "<id>"` notices by moving boards or conditions; lines cannot be routed by hand. Conditions must not cover boards.\n\n## Board HTML\n\nWrite complete HTML ending `</html>` (last when streaming), with the board\'s own CSS/scripts inline, linking only `tokens.css`, the shared files above and CDN libraries, html/body margin0. Any npm library loads from a CDN with its version pinned; nothing is preloaded, so use one instead of hand-writing its equivalent. Missing or unfinished files stay pending. Use native, accessible labelled controls with visible state changes. Static by default, though a shared script may render the markup options share; interactive:true enables PLAY.\n\nEach board/expanded view has independent iframe state: use memory, no localStorage/sessionStorage/cookies. Keep shared-state flows in one board; relative links stay inside its iframe. Replay, HTML edits and page changes/reloads reset prototype state; selected/playing/tweaked frames stay mounted on the same page.\n\n`ryugi-icon name="copy" size="18"` supplies Lucide icons; label actions. Find names with `adeck icons <english words>` (`adeck icons delete trash`); Check names unknown ones. For JS-only icons add meta name="ryugi-icons" content="1" and await custom element definition.\n\n## Feedback\n\nChoice lifecycle: title notes define rounds. Read comment list --sections threads,groups,rounds --detail; act only on submitted rounds and read their threads. If human answered in terminal, record actual picks with comment choose and comment submit --round <id>. Withdrawal means wait. Add next round below, not over the old one. Documents can reference groups/boards using inline ref; preserve referenced keys.\n\nMarked comments: each `marked` line describes one mark. A box on an image or video board can end with `· at t=<s>` (the video frame) and `· crop <path>`: open that JPEG with your image reader before acting; it shows what the box covers.\n\nVerify lifecycle: put screen evidence in new verify groups with real from/capturedAt and language-matched titles/stickies. Record pass/reject only on human instruction. On rejection, repair behavior, replace evidence (resets pending), reply and leave the thread open; passing closes it. Preserve passed evidence unless asked. Command-output claims/gaps belong in a verify report. Run Check after writing; clear pending/warnings before claiming ready and inspect screenshots/recordings for visual claims.\n\n`browser_not_run:<board>` means no browser has loaded that board since its file, or a file under `pages/` that is not a board, last changed; the bare `browser_not_run` beside these only says that some board has not run, and clears with them. When the machine has agent-browser (`adeck doctor` lists it), Check loads those boards itself before it answers. Otherwise boards load only on the open page and near the view: open the artboard, go to each page Check lists under `Show` (`?page=<id>`), bring those boards into view, then run Check again. Editing one board or moving boards keeps the other boards\' results; editing a file several boards share sends all of them back, and a browser showing them reloads and reruns them on its own. With neither, report Check as incomplete.\n\n## Selection and node IDs\n\nFor "here", "selected", Inspector changes or a node ID (`hero-2#7`), read `.state/artboard/<id>/selection.json`:\n\n- `selected`: file, CSS path from body, text, html, tweaks (`property/from/value`); `more` counts omitted nodes.\n- `boards`, `notes`: selected canvas IDs, omitted when empty.\n- `tweaks`: Inspector changes outside the selection.\n- `removed`: elements the human deleted in the preview, omitted when empty; delete each from its file/path unless they say otherwise.\n- `nodes`: all node IDs with file/path; query only the requested ID, never dump the list.\n\n```bash\njq \'{selected, more, boards, notes, tweaks, removed}\' \'.ryugi/artifacts/.state/artboard/<id>/selection.json\'\n```\n\nFor a typed ID: `jq \'.nodes[] | select(.id == "hero-2#7")\' …/selection.json`. A harness-attached selection carries the same data. Edit its file/path; Inspector tweaks become source only when you write them. IDs renumber on every board reload/edit: resolve against current nodes and ask for a fresh ID before a later edit to that board.\n\n## Author-declared parameters\n\nExpose deliberate controls with one JSON declaration before any JS that reads it. The viewer supplies Parameters; phone uses defaults. Inspector Tweaks remain CSS overrides.\n\n```html\n<script type="application/json" data-ryugi-tweaks>\n {\n "version": 1,\n "controls": { "accent": { "type": "color", "default": "#b45309" } }\n }\n<\/script>\n```\n\nEach control needs `type` and `default`; optional `label` defaults to its key, `section` groups controls. Keys: letter first, then letters/digits/underscores/hyphens, <=64 characters, unique ignoring case.\n\n| Type | Values and extra fields |\n| --------- | ----------------------------------------------------------------- |\n| `color` | Six-digit hex; optional `options` list supplies swatches |\n| `range` | Number; requires `min` and `max`; `step` defaults to 1 |\n| `number` | Finite number; optional `min`, `max`, `step` |\n| `boolean` | `true` or `false` |\n| `enum` | String; `options` is a list of strings or `{value,label}` objects |\n| `text` | String, at most 512 characters |\n\nDefaults/updates must match type, bounds, step and options. Limits: 32 controls, 32 choices per control. Invalid JSON/defaults or duplicate declarations show a Parameters error.\n\nValues set `--tweak-<key>` and `data-tweak-<key>` on `<html>`; numbers are unitless (`calc(var(--tweak-radius, 12) * 1px)`). `window.ryugiTweaks` gives a typed snapshot; `document` emits `ryugi-tweaks` with all updated values in `event.detail`. Keep ordinary copy literal; expose text controls only for cross-cutting values or requested editable copy.\n\nControl changes and Reset apply without reload, preserving unrelated app state. Canvas/expanded instances share values per board; other boards are independent. Replay, source edits and page switches retain valid overrides; untouched defaults follow source changes, removed/invalid overrides fall back to defaults. Viewer refresh resets to defaults. Reset affects parameters only; preview values never write HTML or publish.\n\nTest the host Parameters control, each value, Reset, Replay and expanded view before claiming it works; appearance changes must preserve in-progress interactions.\n';const nr=e=>t=>{let n=e===`pass`&&!!t.all;if(!n&&!t.group)throw new M(e===`pass`?`comment pass needs --group <groupId>, or --all`:`comment reject needs --group <groupId>`);let r=e===`reject`?$n(t):t.text?.trim();return{op:`verdict`,verdict:e,...n?{all:!0}:{group:t.group},...r?{text:r}:{}}},rr={authoring:tr,phoneScreens:!0,review:{sections:[`groups`,`rounds`]},commentActions:{pass:nr(`pass`),reject:nr(`reject`),choose:e=>{if(!e.group)throw new M(`comment choose needs --group <groupId>`);if(!e.clear&&!e.board)throw new M(`comment choose needs --board <boardId>, or --clear`);return{op:`choose`,group:e.group,board:e.clear?null:e.board}},submit:e=>{if(!e.round)throw new M(`comment submit needs --round <roundId>`);return{op:`submit`,round:e.round,submit:!e.withdraw}},add:e=>{if(!e.board)throw new M(`comment add on an artboard needs --board <boardId>`);let t=er(e.x,`--x`),n=er(e.y,`--y`);return{op:`add`,board:e.board,...t===void 0?{}:{x:t},...n===void 0?{}:{y:n},text:$n(e)}}}},ir=/^[a-z0-9][a-z0-9-]{0,63}$/,ar=e=>e.type===`ask`;function or(e,t){return{id:e.askId,blockId:t,...e.recommend?{recommend:e.recommend}:{},...e.placeholder?{placeholder:e.placeholder}:{},options:e.options.map(({value:e,label:t})=>({value:e,label:t}))}}function sr(e){let t=[],n=(e,r)=>{ar(e)&&t.push(or(e,r));for(let t of e.children??[])n(t,r)};for(let t of e.root.children)n(t,t.$?.blockId??``);return t}const cr=e=>e===null||typeof e==`string`&&e.length<=2e4;function lr(e){let t={};if(e.ask!==void 0){if(typeof e.ask!=`string`||!ir.test(e.ask))return null;t.ask=e.ask}if(e.choice!==void 0){if(!cr(e.choice))return null;t.choice=e.choice}if(e.answer!==void 0){if(!cr(e.answer))return null;t.answer=e.answer}if(e.note!==void 0){if(e.note!==!0)return null;t.note=!0}if(e.submit!==void 0){if(typeof e.submit!=`boolean`)return null;t.submit=e.submit}if(e.asks!==void 0){if(!Array.isArray(e.asks)||!e.asks.every(e=>typeof e==`string`))return null;t.asks=e.asks}if(e.remote!==void 0){if(e.remote!==!0)return null;t.remote=!0}if(e.of!==void 0){if(typeof e.of!=`string`)return null;t.of=e.of}return t}const ur=(e,t)=>JSON.stringify(lr(e))===JSON.stringify(lr(t)),dr=e=>e.messages.find(e=>!e.deleted);function fr(e,t){return e.map((e,t)=>({thread:e,index:t,message:dr(e)})).filter(e=>e.message&&t(e.thread.anchor)).sort((e,t)=>e.message.at.localeCompare(t.message.at)||e.index-t.index)}function pr(e){let t=new Set(fr(e,e=>e.submit===!1&&e.of!==void 0).map(e=>e.thread.anchor.of));return fr(e,e=>e.submit===!0).map(({thread:e,message:n})=>({id:e.id,at:n.at,asks:e.anchor.asks??[],withdrawn:t.has(e.id)}))}function mr(e,t){let n=new Set(pr(t).filter(e=>!e.withdrawn).flatMap(e=>e.asks)),r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map;for(let{thread:e,message:n}of fr(t,e=>e.ask!==void 0&&e.note===void 0))e.anchor.remote?i.set(e.anchor.ask,[...i.get(e.anchor.ask)??[],{anchor:e.anchor,name:n.name}]):r.set(e.anchor.ask,e.anchor);let a=/* @__PURE__ */ new Set;for(let[e,t]of i){if(r.has(e))continue;let n=t[0].anchor;t.every(({anchor:e})=>(e.choice??null)===(n.choice??null)&&(e.answer??null)===(n.answer??null))&&(r.set(e,t.at(-1).anchor),a.add(e))}let o=/* @__PURE__ */ new Map;for(let{thread:e,message:n}of fr(t,e=>e.ask!==void 0&&e.note===!0))o.set(e.anchor.ask,{text:n.text,by:n.name});let s=new Set(e.map(e=>e.id)),c=[.../* @__PURE__ */ new Set([...r.keys(),...i.keys(),...o.keys()])].filter(e=>!s.has(e)).map(e=>({id:e,blockId:``,options:[]}));return[...e,...c].map(e=>{let t=r.get(e.id),c=o.get(e.id),l=!s.has(e.id),u=new Set(e.options.map(e=>e.value)),d=t?.choice??null,f=d!==null&&(l||u.has(d))?d:null,p=t?.answer?.trim()?t.answer:null,m=f!==null||p!==null,h=!m&&e.recommend!==void 0,g=m?f:e.recommend??null,_=l?`orphan`:c?`settled`:n.has(e.id)||a.has(e.id)?`submitted`:`draft`,v=i.get(e.id)?.map(({anchor:e,name:t})=>({...t?{name:t}:{},choice:e.choice??null,text:e.answer?.trim()?e.answer:null}));return{id:e.id,blockId:e.blockId,state:_,...e.recommend?{recommend:e.recommend}:{},...e.placeholder?{placeholder:e.placeholder}:{},options:e.options,choice:g,text:p,byRecommendation:h,changed:m&&(p!==null||f!==e.recommend),...c?{note:c.text,...c.by?{noteBy:c.by}:{}}:{},...d!==null&&f===null?{staleChoice:d}:{},...v?{others:v}:{}}})}const hr=e=>typeof e==`string`&&e.length>0&&e.length<=200;function gr(e){if(typeof e!=`object`||!e)return null;let t=e;return t.kind===`node`?hr(t.id)?{kind:`node`,id:t.id}:null:t.kind===`edge`&&hr(t.from)&&hr(t.to)&&typeof t.index==`number`&&Number.isSafeInteger(t.index)&&t.index>=0?{kind:`edge`,from:t.from,to:t.to,index:t.index}:null}function _r(e,t){return!e||!t?e===t:e.kind===`node`?t.kind===`node`&&e.id===t.id:t.kind===`edge`&&e.from===t.from&&e.to===t.to&&e.index===t.index}const vr=e=>e.blockIds??[e.blockId],yr=e=>typeof e==`object`&&!!e,br={read:e=>{if(!yr(e)||typeof e.blockId!=`string`||!e.blockId)return null;let{blockIds:t,textRanges:n}=e,r=e.diagram===void 0?void 0:gr(e.diagram);if(r===null||r&&(t!==void 0||n!==void 0)||t!==void 0&&(!Array.isArray(t)||!t.length||t[0]!==e.blockId||!t.every(e=>typeof e==`string`&&e.length>0&&e.length<=100)||new Set(t).size!==t.length))return null;let i=lr(e);if(!i)return null;let a=t??[e.blockId];return n!==void 0&&(!Array.isArray(n)||n.length!==a.length||!n.every((e,t)=>yr(e)&&e.blockId===a[t]&&typeof e.quote==`string`&&e.quote.length<=2e4&&typeof e.start==`number`&&Number.isSafeInteger(e.start)&&e.start>=0&&Number.isSafeInteger(e.start+e.quote.length)))?null:{blockId:e.blockId,...t?{blockIds:t}:{},...r?{diagram:r}:{},quote:typeof e.quote==`string`?e.quote:``,...n?{textRanges:n.map(({blockId:e,quote:t,start:n})=>({blockId:e,quote:t,start:n}))}:{},...i}},same:(e,t)=>ur(e,t)&&e.quote===t.quote&&_r(e.diagram,t.diagram)&&vr(e).length===vr(t).length&&vr(e).every((e,n)=>e===vr(t)[n])&&e.textRanges?.length===t.textRanges?.length&&(e.textRanges??[]).every((e,n)=>{let r=t.textRanges?.[n];return e.blockId===r?.blockId&&e.quote===r.quote&&e.start===r.start}),missing:`a new thread needs anchor.blockId; dropped it`};function xr(e){let t=JSON.parse(e);if(!yr(t))throw Error(`comments.json must be an object`);if(!Array.isArray(t.threads))throw Error(`threads must be an array`);return t.threads.forEach((e,t)=>{if(!yr(e))throw Error(`threads[${t}] must be an object`);if(e.messages!==void 0&&!Array.isArray(e.messages))throw Error(`threads[${t}].messages must be an array`);if(!e.id&&!yr(e.anchor))throw Error(`threads[${t}] needs an anchor`)}),t}const Sr=e=>!!e.id&&(e.author===`human`||e.author===`agent`)&&typeof e.text==`string`&&typeof e.at==`string`;function Cr(e,t=br){let n=[];for(let r of e.threads){let e=t.read(r.anchor);if(!r.id||!e||!r.statusAt||r.status!==`open`&&r.status!==`resolved`)continue;let i=(r.messages??[]).filter(Sr),a=r.statusBy===`human`||r.statusBy===`agent`?{statusBy:r.statusBy}:{};n.push({id:r.id,anchor:e,status:r.status,statusAt:r.statusAt,...a,...typeof r.statusName==`string`&&{statusName:r.statusName},messages:i})}return{version:1,threads:n}}const wr=[`claude`,`codex`],Tr=e=>wr.includes(e);function Er(e){try{let t=JSON.parse(d.default.readFileSync(f.default.join(e,`prompt.json`),`utf8`));return typeof t.xml!=`string`||typeof t.markdown!=`string`||typeof t.at!=`number`||!Tr(t.harness)?null:{xml:t.xml,markdown:t.markdown,at:t.at,harness:t.harness}}catch{return null}}const Dr=/* @__PURE__ */ new Set([`br`,`hr`,`img`]),Or=/<(\/?)([a-z][\w-]*)\b[^>]*?(\/?)>/gi,kr=[[`<![CDATA[`,`]]>`],[`<!--`,`-->`]];function Ar(e){let t=``,n=0;for(;n<e.length;){let r=kr.map(([t,r])=>({close:r,index:e.indexOf(t,n)})).filter(({index:e})=>e!==-1).sort((e,t)=>e.index-t.index)[0];if(!r)return t+e.slice(n);t+=e.slice(n,r.index);let i=e.indexOf(r.close,r.index);if(i===-1)return t;n=i+r.close.length}return t}function jr(e){let t=[];for(let n of Ar(e).matchAll(Or)){let[,e,r,i]=n,a=r.toLowerCase();if(e){let e=t.pop();if(e!==a)return e?`</${a}> closes <${e}>`:`</${a}> has no opening tag`}else!i&&!Dr.has(a)&&t.push(a)}let n=t.at(-1);return n?`<${n}> is never closed`:null}const Mr=/^assets\/[\w-][\w.-]*\.html$/;function Nr(e){let t=0;for(;t<e.length;){let n=Math.min(t+65536,e.length);crypto.getRandomValues(e.subarray(t,n)),t=n}}function Pr(e){if(e|=0,e<0)throw RangeError(`Wrong ID size`);let t=Buffer.allocUnsafe(e);return Nr(t),t}function Fr(e,t,n){let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i|=0;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}return(i=t)=>{if(!i)return``;let a=``,o=Math.ceil(409.6*i/r);for(;;){let t=n(o),s=o;for(;s--;)if(t[s]<r&&(a+=e[t[s]%e.length],a.length>=i))return a}}}function Ir(e,t=21){if(typeof e!=`string`||!e||e.length>256)return Fr(e,t,Pr);for(let n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return Fr(e,t,Pr);let n=Uint8Array.from(e,e=>e.charCodeAt(0)),r=e.length,i=(2<<31-Math.clz32(r-1|1))-1,a=``,o=0,s=0;return(e=t)=>{if(e|=0,e<0)throw RangeError(`Wrong ID size`);if(e===0)return``;if(o+e>a.length){let t=Math.max(s,e);s=Math.min(t*16,32768);let c=Buffer.allocUnsafe(t);if(i===r-1){Nr(c);for(let e=0;e<t;e++)c[e]=n[c[e]&i]}else{let e=Buffer.allocUnsafe(Math.ceil(1.6*(i+1)*t/r)),a=0;for(;a<t;){Nr(e);for(let o=0;o<e.length;o++){let s=e[o]&i;if(s<r&&(c[a++]=n[s],a===t))break}}}a=c.toString(`latin1`),o=0}return o+=e,a.substring(o-e,o)}}Ir(`57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9`);var Lr=null;function Rr(e){Lr=e}function zr(e){if(!Lr)throw Error(`@haklex/rich-litexml: parseHTML implementation not registered. Import from the main entry (@haklex/rich-litexml), not a deep submodule path.`);return Lr(e)}function Br(e){let t=e.getAttribute(`id`);return t?{$:{blockId:t}}:{}}var Vr={direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1};function Hr(e){e.registerReader(`p`,(e,t)=>({type:`paragraph`,...Br(e),children:t.parseChildren(e),...Vr}));for(let t=1;t<=6;t++)e.registerReader(`h${t}`,(e,n)=>({type:`heading`,tag:`h${t}`,...Br(e),children:n.parseChildren(e),...Vr}));e.registerReader(`blockquote`,(e,t)=>{let n=e.getAttribute(`attribution`),r=e.getAttribute(`rich`)!==null||n!==null,i={...Br(e),children:t.parseChildren(e),...Vr};return r?{type:`rich-quote`,attribution:n?.trim()?n:null,...i}:{type:`quote`,...i}}),e.registerReader(`hr`,e=>({type:`horizontalrule`,...Br(e),version:1})),e.registerReader(`ul`,(e,t)=>({type:`list`,listType:e.getAttribute(`type`)===`check`?`check`:`bullet`,tag:`ul`,start:1,...Br(e),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`ol`,(e,t)=>({type:`list`,listType:`number`,tag:`ol`,start:Number(e.getAttribute(`start`)??1),...Br(e),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`li`,(e,t)=>{let n=e.getAttribute(`checked`);return{type:`listitem`,...Br(e),...n===null?{}:{checked:n===`true`},children:t.parseChildren(e),...Vr,value:1}}),e.registerReader(`a`,(e,t)=>({type:`link`,url:e.getAttribute(`href`)??``,target:e.getAttribute(`target`)??null,title:e.getAttribute(`title`)??null,rel:e.getAttribute(`rel`),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`table`,(e,t)=>({type:`table`,...Br(e),children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`tr`,(e,t)=>({type:`tablerow`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`th`,(e,t)=>({type:`tablecell`,headerState:1,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`td`,(e,t)=>({type:`tablecell`,headerState:0,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}))}var Ur=`abcdefghijklmnopqrstuvwxyz0123456789`,Wr=Ir(Ur,10),Gr=Ir(Ur,6),Kr=Ir(Ur,6),qr=Ir(Ur,8),Jr=Ir(Ur,8);function Yr(e){let t=e.getAttribute(`id`);return t?{$:{blockId:t}}:{}}function Xr(e,t){let n=e.getAttribute(t);return n===null?void 0:Number(n)}var Zr=/* @__PURE__ */ new Set([`align-left`,`align-right`,`float-left`,`float-right`]);function Qr(e){let t=Xr(e,`display-width`);return t!==void 0&&Number.isFinite(t)&&t>=10&&t<=100?t:void 0}function $r(e,t){let n=Xr(e,t);return n!==void 0&&Number.isFinite(n)&&n>0?Math.round(n):void 0}function ei(e){let t=Qr(e);if(t!==void 0)return{displayWidth:t};let n=$r(e,`fixed-width`);if(n!==void 0)return{fixedWidth:n};let r=$r(e,`fixed-height`);return r===void 0?{}:{fixedHeight:r}}function ti(e){let t=e.getAttribute(`layout`);return t!==null&&Zr.has(t)?t:void 0}var ni=/* @__PURE__ */ new Set([`auto`,`1:1`,`4:3`,`16:9`,`3:4`]),ri=/* @__PURE__ */ new Set([`cover`,`contain`]);function ii(e){let t=e.getAttribute(`aspect`);return t!==null&&ni.has(t)?t:`auto`}function ai(e){let t=e.getAttribute(`fit`);return t!==null&&ri.has(t)?t:`cover`}function oi(e){let t=Xr(e,`max-item-height`);return t!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function si(e){for(let t of e.childNodes)if(t.nodeType===8){let e=t.nodeValue??``;if(e.startsWith(`[CDATA[`)&&e.endsWith(`]]`))return e.slice(7,-2)}return null}function ci(e){return si(e)??e.textContent??``}function li(e){e.registerReader(`img`,e=>e.parentElement?.tagName.toLowerCase()!==`gallery`&&{type:`image`,...Yr(e),src:e.getAttribute(`src`)??``,altText:e.getAttribute(`alt`)??``,width:Xr(e,`width`),height:Xr(e,`height`),caption:e.getAttribute(`caption`)??void 0,thumbhash:e.getAttribute(`thumbhash`)??void 0,accent:e.getAttribute(`accent`)??void 0,...ei(e),layout:ti(e),version:1}),e.registerReader(`video`,e=>({type:`video`,...Yr(e),src:e.getAttribute(`src`)??``,poster:e.getAttribute(`poster`)??void 0,width:Xr(e,`width`),height:Xr(e,`height`),version:1})),e.registerReader(`attachment`,e=>({type:`file`,...Yr(e),src:e.getAttribute(`src`)??``,name:e.getAttribute(`name`)??``,size:Xr(e,`size`),mimeType:e.getAttribute(`mime-type`)??void 0,ext:e.getAttribute(`ext`)??void 0,display:e.getAttribute(`display`)===`inline`?`inline`:`block`,version:1})),e.registerReader(`link-card`,e=>({type:`link-card`,...Yr(e),url:e.getAttribute(`url`)??``,source:e.getAttribute(`source`)??void 0,title:e.getAttribute(`title`)??void 0,description:e.getAttribute(`description`)??void 0,favicon:e.getAttribute(`favicon`)??void 0,image:e.getAttribute(`image`)??void 0,version:1})),e.registerReader(`embed`,e=>({type:`embed`,...Yr(e),url:e.getAttribute(`url`)??``,source:e.getAttribute(`source`)??null,version:1})),e.registerReader(`codeblock`,e=>({type:`code-block`,...Yr(e),code:ci(e),language:e.getAttribute(`lang`)??``,version:1})),e.registerReader(`mermaid`,e=>({type:`mermaid`,...Yr(e),diagram:ci(e),version:1})),e.registerReader(`math`,e=>{if(e.getAttribute(`display`)===`block`)return{type:`katex-block`,...Yr(e),equation:ci(e),version:1};let t=e.getAttribute(`color`);return{type:`katex-inline`,equation:ci(e),...t?{color:t}:{},version:1}}),e.registerReader(`alert`,(e,t)=>{let n={root:{type:`root`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}};return{type:`alert-quote`,...Yr(e),alertType:e.getAttribute(`type`)??`note`,content:n,version:1}}),e.registerReader(`banner`,(e,t)=>{let n={root:{type:`root`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}};return{type:`banner`,...Yr(e),bannerType:e.getAttribute(`type`)??`note`,content:n,version:1}}),e.registerReader(`nested-doc`,(e,t)=>{let n={root:{type:`root`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1}};return{type:`nested-doc`,...Yr(e),content:n,version:1}}),e.registerReader(`details`,(e,t)=>({type:`details`,...Yr(e),summary:e.getAttribute(`summary`)??``,open:e.getAttribute(`open`)===`true`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,version:1})),e.registerReader(`spoiler`,(e,t)=>({type:`spoiler`,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1})),e.registerReader(`ruby`,(e,t)=>({type:`ruby`,reading:e.getAttribute(`rt`)??``,children:t.parseChildren(e),direction:`ltr`,format:``,indent:0,textFormat:0,textStyle:``,version:1})),e.registerReader(`mention`,e=>({type:`mention`,platform:e.getAttribute(`platform`)??``,handle:e.getAttribute(`handle`)??``,displayName:e.textContent||void 0,version:1})),e.registerReader(`tag`,e=>({type:`tag`,text:e.textContent??``,format:0,detail:0,mode:`normal`,style:``,version:1})),e.registerReader(`comment`,e=>({type:`comment`,text:e.textContent??``,format:0,detail:0,mode:`normal`,style:``,version:1})),e.registerReader(`footnote`,e=>({type:`footnote`,identifier:e.getAttribute(`ref`)??``,version:1})),e.registerReader(`footnote-section`,e=>{let t={};for(let n of e.children)if(n.tagName.toLowerCase()===`def`){let e=n.getAttribute(`ref`)??``;t[e]=n.textContent??``}return{type:`footnote-section`,...Yr(e),definitions:t,version:1}}),e.registerReader(`gallery`,e=>{let t=[];for(let n of e.children)n.tagName.toLowerCase()===`img`&&t.push({src:n.getAttribute(`src`)??``,alt:n.getAttribute(`alt`)??void 0});return{type:`gallery`,...Yr(e),images:t,layout:e.getAttribute(`layout`)??`grid`,aspect:ii(e),fit:ai(e),maxItemHeight:oi(e),version:1}}),e.registerReader(`excalidraw`,e=>({type:`excalidraw`,...Yr(e),snapshot:si(e)||e.getAttribute(`snapshot`)||e.textContent?.trim()||``,version:1})),e.registerReader(`chart`,e=>({type:`chart`,...Yr(e),spec:ci(e).trim(),version:1})),e.registerReader(`dynamic`,e=>{let t={},n=(si(e)??e.textContent??``).trim();if(n)try{let e=JSON.parse(n);e&&typeof e==`object`&&!Array.isArray(e)&&(t=e)}catch{}return{type:`dynamic`,...Yr(e),url:e.getAttribute(`url`)??``,props:t,initialHeight:Xr(e,`initial-height`)??320,version:1}}),e.registerReader(`grid`,(e,t)=>{let n=[];for(let r of e.children)if(r.tagName.toLowerCase()===`cell`){let e=t.parseChildren(r);n.push({root:{type:`root`,children:e,direction:`ltr`,format:``,indent:0,version:1}})}return{type:`grid-container`,...Yr(e),cols:Xr(e,`cols`)??2,gap:e.getAttribute(`gap`)??`16px`,cells:n,version:1}}),e.registerReader(`agent-diff`,e=>({type:`agent-diff`,...Yr(e),opType:e.getAttribute(`op`)??`insert`,diffEntryId:e.getAttribute(`entry`)??``,version:1})),e.registerReader(`code-snippet`,e=>{let t=[];for(let n of e.children)n.tagName.toLowerCase()===`file`&&t.push({filename:n.getAttribute(`name`)??``,code:ci(n),language:n.getAttribute(`lang`)??``});return{type:`code-snippet`,...Yr(e),files:t,version:1}}),e.registerReader(`steps`,(e,t)=>{let n=[];for(let r of e.children)r.tagName.toLowerCase()===`step`&&n.push({id:r.getAttribute(`id`)||`s_${Jr()}`,title:r.getAttribute(`title`)??``,content:{root:{type:`root`,children:t.parseChildren(r),direction:`ltr`,format:``,indent:0,version:1}}});return{type:`steps`,...Yr(e),steps:n,version:1}}),e.registerReader(`chat`,e=>{let t=e.getAttribute(`variant`)===`user-user`?`user-user`:`user-agent`,n=[],r=[];for(let t of e.children){let e=t.tagName.toLowerCase();if(e===`participants`)for(let e of t.children){if(e.tagName.toLowerCase()!==`participant`)continue;let t=e.getAttribute(`kind`)===`agent`?`agent`:`user`;n.push({id:e.getAttribute(`id`)||`p_${Kr()}`,kind:t,name:e.getAttribute(`name`)||void 0,avatar:e.getAttribute(`avatar`)||void 0})}else if(e===`messages`)for(let e of t.children)e.tagName.toLowerCase()===`message`&&r.push({id:e.getAttribute(`id`)||`m_${qr()}`,participantId:e.getAttribute(`participant`)??``,content:e.textContent??``})}return{type:`chat`,...Yr(e),variant:t,participants:n,messages:r,version:1}}),e.registerReader(`poll`,e=>{let t=``,n=[];for(let r of e.children){let e=r.tagName.toLowerCase();if(e===`question`)t=r.textContent??``;else if(e===`option`){let e=r.getAttribute(`id`)||`o_${Gr()}`;n.push({id:e,label:r.textContent??``})}}let r=e.getAttribute(`mode`)===`multiple`?`multiple`:`single`,i=e.getAttribute(`close-at`),a=e.getAttribute(`show-results`),o=a===`always`||a===`after-vote`||a===`after-close`?a:void 0;return{type:`poll`,...Yr(e),pollId:e.getAttribute(`poll-id`)||`p_${Wr()}`,question:t,options:n,mode:r,...i?{closeAt:i}:{},...o?{showResults:o}:{},version:1}})}var ui=class{constructor(){this.writers=/* @__PURE__ */ new Map,this.readers=/* @__PURE__ */ new Map}registerWriter(e,t){this.writers.set(e,t)}registerReader(e,t){this.readers.set(e.toLowerCase(),t)}getWriter(e){return this.writers.get(e)}getReader(e){return this.readers.get(e.toLowerCase())}};function di(e){return e.$?.blockId?{id:e.$.blockId}:{}}function fi(e){e.registerWriter(`paragraph`,(e,t)=>{let n=e;return{tag:`p`,attrs:di(n),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`heading`,(e,t)=>{let n=e;return{tag:n.tag??`h1`,attrs:di(n),children:t.serializeChildren(n.children??[])}});let t=(e,t)=>{let n=e,r={...di(n)};return n.type===`rich-quote`&&((typeof n.attribution==`string`?n.attribution.trim():``)===``?r.rich=`true`:r.attribution=n.attribution),{tag:`blockquote`,attrs:r,children:t.serializeChildren(n.children??[])}};e.registerWriter(`quote`,t),e.registerWriter(`rich-quote`,t),e.registerWriter(`horizontalrule`,e=>({tag:`hr`,attrs:di(e),selfClosing:!0})),e.registerWriter(`list`,(e,t)=>{let n=e,r=n.listType===`number`?`ol`:`ul`,i={...di(n)};return n.listType===`check`&&(i.type=`check`),{tag:r,attrs:i,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`listitem`,(e,t)=>{let n=e,r={...di(n)};return n.checked!==void 0&&(r.checked=String(n.checked)),{tag:`li`,attrs:r,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`link`,(e,t)=>{let n=e,r={href:typeof n.url==`string`?n.url:``};return typeof n.target==`string`&&n.target!==``&&(r.target=n.target),typeof n.title==`string`&&n.title!==``&&(r.title=n.title),typeof n.rel==`string`&&n.rel!==``&&(r.rel=n.rel),{tag:`a`,attrs:r,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`autolink`,(e,t)=>{let n=e;return{tag:`a`,attrs:{href:n.url??``},children:t.serializeChildren(n.children??[])}}),e.registerWriter(`table`,(e,t)=>{let n=e;return{tag:`table`,attrs:di(n),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`tablerow`,(e,t)=>{let n=e;return{tag:`tr`,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`tablecell`,(e,t)=>{let n=e;return{tag:n.headerState===1?`th`:`td`,children:t.serializeChildren(n.children??[])}})}function pi(e){return e.$?.blockId?{id:e.$.blockId}:{}}function mi(e){let t={};for(let[n,r]of Object.entries(e))r!=null&&r!==``&&(t[n]=String(r));return t}function hi(e){e.registerWriter(`image`,e=>{let t=e;return{tag:`img`,attrs:mi({...pi(t),src:t.src,alt:t.altText,width:t.width==null?void 0:String(t.width),height:t.height==null?void 0:String(t.height),caption:t.caption,thumbhash:t.thumbhash,accent:t.accent,"display-width":t.displayWidth==null?void 0:String(t.displayWidth),"fixed-width":t.fixedWidth==null?void 0:String(t.fixedWidth),"fixed-height":t.fixedHeight==null?void 0:String(t.fixedHeight),layout:t.layout}),selfClosing:!0}}),e.registerWriter(`video`,e=>{let t=e;return{tag:`video`,attrs:mi({...pi(t),src:t.src,poster:t.poster}),selfClosing:!0}}),e.registerWriter(`file`,e=>{let t=e;return{tag:`attachment`,attrs:mi({...pi(t),src:t.src,name:t.name,size:t.size==null?void 0:String(t.size),"mime-type":t.mimeType,ext:t.ext,display:t.display===`inline`?`inline`:void 0}),selfClosing:!0}}),e.registerWriter(`link-card`,e=>{let t=e;return{tag:`link-card`,attrs:mi({...pi(t),url:t.url,source:t.source,title:t.title,description:t.description,favicon:t.favicon,image:t.image}),selfClosing:!0}}),e.registerWriter(`embed`,e=>{let t=e;return{tag:`embed`,attrs:mi({...pi(t),url:t.url,source:t.source}),selfClosing:!0}}),e.registerWriter(`code-block`,e=>{let t=e;return{tag:`codeblock`,attrs:mi({...pi(t),lang:t.language}),children:[t.code??``]}}),e.registerWriter(`mermaid`,e=>{let t=e;return{tag:`mermaid`,attrs:pi(t),children:[t.diagram??``]}}),e.registerWriter(`katex-block`,e=>{let t=e;return{tag:`math`,attrs:{...pi(t),display:`block`},children:[t.equation??``]}}),e.registerWriter(`katex-inline`,e=>{let t=e,n={};return t.color&&(n.color=t.color),{tag:`math`,attrs:Object.keys(n).length>0?n:void 0,children:[t.equation??``]}}),e.registerWriter(`alert-quote`,(e,t)=>{let n=e;return{tag:`alert`,attrs:mi({...pi(n),type:n.alertType}),children:t.serializeNestedState(n.content)}}),e.registerWriter(`banner`,(e,t)=>{let n=e;return{tag:`banner`,attrs:mi({...pi(n),type:n.bannerType}),children:t.serializeNestedState(n.content)}}),e.registerWriter(`nested-doc`,(e,t)=>{let n=e;return{tag:`nested-doc`,attrs:pi(n),children:t.serializeNestedState(n.content??n.contentState)}}),e.registerWriter(`excalidraw`,e=>{let t=e;return t.snapshot?/^(?:https?:\/\/|blob:|ref:)\S+$/.test(t.snapshot.trim())?{tag:`excalidraw`,attrs:mi(pi(t)),children:[t.snapshot.trim()]}:{tag:`excalidraw`,attrs:mi(pi(t)),children:[{cdata:t.snapshot}]}:{tag:`excalidraw`,attrs:mi(pi(t)),selfClosing:!0}}),e.registerWriter(`chart`,e=>{let t=e,n=typeof t.spec==`string`?t.spec:``;return n?{tag:`chart`,attrs:mi(pi(t)),children:[{cdata:n}]}:{tag:`chart`,attrs:mi(pi(t)),selfClosing:!0}}),e.registerWriter(`dynamic`,e=>{let t=e,n=mi({...pi(t),url:t.url,"initial-height":t.initialHeight==null?void 0:String(t.initialHeight)});return!t.props||Object.keys(t.props).length===0?{tag:`dynamic`,attrs:n,selfClosing:!0}:{tag:`dynamic`,attrs:n,children:[{cdata:JSON.stringify(t.props)}]}}),e.registerWriter(`grid-container`,(e,t)=>{let n=e,r=(n.cells??[]).map(e=>({tag:`cell`,children:t.serializeNestedState(e)}));return{tag:`grid`,attrs:mi({...pi(n),cols:n.cols==null?void 0:String(n.cols),gap:n.gap}),children:r}}),e.registerWriter(`agent-diff`,e=>{let t=e;return{tag:`agent-diff`,attrs:mi({...pi(t),op:t.opType,entry:t.diffEntryId}),selfClosing:!0}}),e.registerWriter(`details`,(e,t)=>{let n=e;return{tag:`details`,attrs:mi({...pi(n),summary:n.summary,open:n.open==null?void 0:String(n.open)}),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`spoiler`,(e,t)=>{let n=e;return{tag:`spoiler`,children:t.serializeChildren(n.children??[])}}),e.registerWriter(`ruby`,(e,t)=>{let n=e;return{tag:`ruby`,attrs:mi({rt:n.reading}),children:t.serializeChildren(n.children??[])}}),e.registerWriter(`mention`,e=>{let t=e;return{tag:`mention`,attrs:mi({platform:t.platform,handle:t.handle}),children:[t.displayName??t.handle??``]}}),e.registerWriter(`tag`,e=>({tag:`tag`,children:[e.text??``]})),e.registerWriter(`comment`,e=>({tag:`comment`,children:[e.text??``]})),e.registerWriter(`footnote`,e=>({tag:`footnote`,attrs:{ref:e.identifier??``},selfClosing:!0})),e.registerWriter(`footnote-section`,e=>{let t=e,n=t.definitions??{},r=Object.entries(n).map(([e,t])=>({tag:`def`,attrs:{ref:e},children:[t]}));return{tag:`footnote-section`,attrs:pi(t),children:r}}),e.registerWriter(`gallery`,e=>{let t=e,n=(t.images??[]).map(e=>({tag:`img`,attrs:mi({src:e.src,alt:e.alt}),selfClosing:!0}));return{tag:`gallery`,attrs:mi({...pi(t),layout:t.layout,aspect:t.aspect&&t.aspect!==`auto`?t.aspect:void 0,fit:t.fit&&t.fit!==`cover`?t.fit:void 0,"max-item-height":t.maxItemHeight==null?void 0:String(t.maxItemHeight)}),children:n}}),e.registerWriter(`code-snippet`,e=>{let t=e,n=(t.files??[]).map(e=>({tag:`file`,attrs:mi({name:e.filename,lang:e.language}),children:[e.code??``]}));return{tag:`code-snippet`,attrs:pi(t),children:n}}),e.registerWriter(`steps`,(e,t)=>{let n=e,r=(n.steps??[]).map(e=>({tag:`step`,attrs:mi({id:e.id,title:e.title}),children:t.serializeNestedState(e.content)}));return{tag:`steps`,attrs:pi(n),children:r}}),e.registerWriter(`chat`,e=>{let t=e,n={tag:`participants`,children:(t.participants??[]).map(e=>({tag:`participant`,attrs:mi({id:e.id,kind:e.kind,name:e.name,avatar:e.avatar}),children:[]}))},r={tag:`messages`,children:(t.messages??[]).map(e=>({tag:`message`,attrs:mi({id:e.id,participant:e.participantId}),children:[e.content??``]}))};return{tag:`chat`,attrs:mi({...pi(t),variant:t.variant}),children:[n,r]}}),e.registerWriter(`poll`,e=>{let t=e,n=(t.options??[]).map(e=>({tag:`option`,attrs:mi({id:e.id}),children:[e.label??``]}));return{tag:`poll`,attrs:mi({...pi(t),"poll-id":t.pollId,mode:t.mode,"close-at":t.closeAt,"show-results":t.showResults}),children:[{tag:`question`,children:[t.question??``]},...n]}})}function gi(){let e=new ui;return fi(e),Hr(e),hi(e),li(e),e}var _i={b:1,strong:1,i:2,em:2,s:4,del:4,strike:4,u:8,code:16,sub:32,sup:64,mark:128};function vi(e){return e.toLowerCase()in _i}function yi(e){return _i[e.toLowerCase()]??0}var bi=/* @__PURE__ */ new Set([`b`,`i`,`u`,`s`,`code`,`sub`,`sup`,`mark`,`strong`,`em`,`del`,`strike`,`a`,`mention`,`tag`,`spoiler`,`ruby`,`math`,`footnote`,`comment`,`br`,`img`]);function xi(e){return bi.has(e.toLowerCase())}var Si=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),Ci=/<([\w-]+)((?:\s+[\w-]+(?:\s*=\s*(?:"[^"]*"|'[^']*'))?)*)\s*\/>/g,wi=`<![CDATA[`,Ti=`]]>`;function Ei(e){return e.replaceAll(Ci,(e,t,n)=>Si.has(t.toLowerCase())?e:`<${t}${n}></${t}>`)}function Di(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(wi,n);if(r<0){t.push(Ei(e.slice(n)));break}t.push(Ei(e.slice(n,r)));let i=e.indexOf(Ti,r+9);if(i<0){t.push(e.slice(r));break}t.push(e.slice(r,i+3)),n=i+3}return t.join(``)}function Oi(e){return zr(`<!DOCTYPE html><html><body>${Di(e)}</body></html>`)}function ki(e,t){let n=Oi(e),r=n.querySelector(`doc`)??n.body;return{root:{type:`root`,children:Mi(t).parseChildren(r),direction:`ltr`,format:``,indent:0,version:1}}}var Ai=/* @__PURE__ */ new Set([`doc`,`fragment`,`root`,`ul`,`ol`,`table`,`tr`,`blockquote`,`alert`,`banner`,`details`,`nested-doc`,`gallery`,`codeblock`,`code-snippet`,`footnote-section`,`grid`,`cell`,`steps`,`step`,`excalidraw`]);function ji(e){return Ai.has(e.tagName.toLowerCase())}function Mi(e){let t={parseChildren(n){let r=[...n.children].some(e=>!xi(e.tagName)),i=ji(n)||r,a=[],o=``,s=()=>{if(o===``)return;if(i&&o.trim()===``){o=``;return}let e=i?o.replace(/^\s*\n[ \t]*/,``).replace(/\n\s*$/,``):o;a.push(Ii(e,0)),o=``};for(let r of n.childNodes)if(r.nodeType===3)o+=r.textContent??``;else if(r.nodeType===1){s();let n=Ni(r,e,t,0);n&&(Array.isArray(n)?a.push(...n):a.push(n))}return s(),a},parseNestedState(t){return ki(t,e)}};return t}function Ni(e,t,n,r){let i=e.tagName.toLowerCase();if(vi(i))return Pi(e,t,n,r|yi(i));if(i===`br`)return{type:`linebreak`,version:1};if(i===`node`)return Fi(e);let a=t.getReader(i);if(a){let t=a(e,n);if(t!==!1)return t}return n.parseChildren(e)}function Pi(e,t,n,r){let i=[],a=``,o=()=>{a!==``&&(i.push(Ii(a,r)),a=``)};for(let s of e.childNodes)if(s.nodeType===3)a+=s.textContent??``;else if(s.nodeType===1){o();let e=Ni(s,t,n,r);e&&(Array.isArray(e)?i.push(...e):i.push(e))}return o(),i}function Fi(e){let t=e.getAttribute(`type`)??`unknown`,n=e.getAttribute(`id`),r=e.getAttribute(`data`),i=r?JSON.parse(r):{};return{type:t,...n?{$:{blockId:n}}:{},...i,version:1}}function Ii(e,t){return{type:`text`,text:e,format:t,detail:0,mode:`normal`,style:``,version:1}}const Li=Symbol(`changed`),Ri=Symbol(`classList`),zi=Symbol(`CustomElements`),Bi=Symbol(`content`),Vi=Symbol(`dataset`),Hi=Symbol(`doctype`),Ui=Symbol(`DOMParser`),R=Symbol(`end`),Wi=Symbol(`EventTarget`),Gi=Symbol(`globals`),Ki=Symbol(`image`),qi=Symbol(`mime`),Ji=Symbol(`MutationObserver`),z=Symbol(`next`),Yi=Symbol(`ownerElement`),Xi=Symbol(`prev`),Zi=Symbol(`private`),Qi=Symbol(`sheet`),$i=Symbol(`start`),ea=Symbol(`style`),ta=Symbol(`upgrade`),na=Symbol(`value`),ra=/* @__PURE__ */ new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),ia=String.fromCodePoint??(e=>{let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t});function aa(e){return e>=55296&&e<=57343||e>1114111?65533:ra.get(e)??e}function oa(e){let t=typeof atob==`function`?atob(e):typeof Buffer.from==`function`?Buffer.from(e,`base64`).toString(`binary`):new Buffer(e,`base64`).toString(`binary`),n=t.length&-2,r=new Uint16Array(n/2);for(let e=0,i=0;e<n;e+=2){let n=t.charCodeAt(e),a=t.charCodeAt(e+1);r[i++]=n|a<<8}return r}const sa=/* #__PURE__ */ oa(`QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBRAFKAU0B8iFvbgxhZABpAGwAO4DHAMdAcgBjAAhhbiJpbnQAAKAwIm8AdAAKYQABZG5ZAV0BaSJsbGEAuGB0I2VyRG90ALdg8gA5AWkAp2NyImNsZQAAAkRNUFRwAXQBeQF9AW8AdAAAoJkiaSJudXMAAKCWIuwhdXMAoJUiaSJtZXMAAKCXIm8AAAFjc4cBlAFrKndpc2VDb250b3VySW50ZWdyYWwAAKAyImUjQ3VybHkAAAFEUZwBpAFvJXVibGVRdW90ZQAAoB0gdSJvdGUAAKAZIAACbG5wdbABtgHNAdgBbwBuAGWgNyIAoHQqgAFnaXQAvAHBAcUB8iJ1ZW50AKBhIm4AdAAAoC8i7yV1ckludGVncmFsAKAuIgABZnLRAdMBAKACIe8iZHVjdACgECJuLnRlckNsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbAAAoDMi7yFzcwCgLypjAHIAAOA12J7ccABDoNMiYQBwAACgTSKABURKU1phY2VmaW9zAAsCEgIVAhgCGwIsAjQCOQI9AnMCfwNvoEUh9CJyYWhkAKARKWMAeQACZGMAeQAFZGMAeQAPZIABZ3JzACECJQIoAuchZXIAoCEgcgAAoKEhaAB2AACg5CoAAWF5MAIzAvIhb24OYRRkbAB0oAciYQCUY3IAAOA12AfdAAFhZkECawIAAWNtRQJnAvIjaXRpY2FsAAJBREdUUAJUAl8CYwJjInV0ZQC0YG8AdAFZAloC2WJiJGxlQWN1dGUA3WJyImF2ZQBgYGkibGRlANxi7yFuZACgxCJmJWVyZW50aWFsRAAAoEYhcAR9AgAAAAAAAIECjgIAABoDZgAA4DXYO91EoagAhQKJAm8AdAAAoNwgcSJ1YWwAAKBQIuIhbGUAA0NETFJVVpkCqAK1Au8C/wIRA28AbgB0AG8AdQByAEkAbgB0AGUAZwByAGEA7ADEAW8AdAKvAgAAAACwAqhgbiNBcnJvdwAAoNMhAAFlb7kC0AJmAHQAgAFBUlQAwQLGAs0CciJyb3cAAKDQIekkZ2h0QXJyb3cAoNQhZQDlACsCbgBnAAABTFLWAugC5SFmdAABQVLcAuECciJyb3cAAKD4J+kkZ2h0QXJyb3cAoPon6SRnaHRBcnJvdwCg+SdpImdodAAAAUFU9gL7AnIicm93AACg0iFlAGUAAKCoInAAQQIGAwAAAAALA3Iicm93AACg0SFvJHduQXJyb3cAAKDVIWUlcnRpY2FsQmFyAACgJSJuAAADQUJMUlRhJAM2AzoDWgNxA3oDciJyb3cAAKGTIUJVLAMwA2EAcgAAoBMpcCNBcnJvdwAAoPUhciJldmUAEWPlIWZ00gJDAwAASwMAAFIDaSVnaHRWZWN0b3IAAKBQKWUkZVZlY3RvcgAAoF4p5SJjdG9yQqC9IWEAcgAAoFYpaSJnaHQA1AFiAwAAaQNlJGVWZWN0b3IAAKBfKeUiY3RvckKgwSFhAHIAAKBXKWUAZQBBoKQiciJyb3cAAKCnIXIAcgBvAPcAtAIAAWN0gwOHA3IAAOA12J/c8iFvaxBhAAhOVGFjZGZnbG1vcHFzdHV4owOlA6kDsAO/A8IDxgPNA9ID8gP9AwEEFAQeBCAEJQRHAEphSAA7gNAA0EBjAHUAdABlADuAyQDJQIABYWl5ALYDuQO+A/Ihb24aYXIAYwA7gMoAykAtZG8AdAAWYXIAAOA12AjdcgBhAHYAZQA7gMgAyEDlIm1lbnQAoAgiAAFhcNYD2QNjAHIAEmF0AHkAUwLhAwAAAADpA20lYWxsU3F1YXJlAACg+yVlJ3J5U21hbGxTcXVhcmUAAKCrJQABZ3D2A/kDbwBuABhhZgAA4DXYPN3zImlsb26VY3UAAAFhaQYEDgRsAFSgdSppImxkZQAAoEIi7CNpYnJpdW0AoMwhAAFjaRgEGwRyAACgMCFtAACgcyphAJdjbQBsADuAywDLQAABaXApBC0E8yF0cwCgAyLvJG5lbnRpYWxFAKBHIYACY2Zpb3MAPQQ/BEMEXQRyBHkAJGRyAADgNdgJ3WwibGVkAFMCTAQAAAAAVARtJWFsbFNxdWFyZQAAoPwlZSdyeVNtYWxsU3F1YXJlAACgqiVwA2UEAABpBAAAAABtBGYAAOA12D3dwSFsbACgACLyI2llcnRyZgCgMSFjAPIAcQQABkpUYWJjZGZnb3JzdIgEiwSOBJMElwSkBKcEqwStBLIE5QTqBGMAeQADZDuAPgA+QO0hbWFkoJMD3GNyImV2ZQAeYYABZWl5AJ0EoASjBOQhaWwiYXIAYwAcYRNkbwB0ACBhcgAA4DXYCt0AoNkicABmAADgNdg+3eUiYXRlcgADRUZHTFNUvwTIBM8E1QTZBOAEcSJ1YWwATKBlIuUhc3MAoNsidSRsbEVxdWFsAACgZyJyI2VhdGVyAACgoirlIXNzAKB3IuwkYW50RXF1YWwAoH4qaSJsZGUAAKBzImMAcgAA4DXYotwAoGsiAARBYWNmaW9zdfkE/QQFBQgFCwUTBSIFKwVSIkRjeQAqZAABY3QBBQQFZQBrAMdiXmDpIXJjJGFyAACgDCFsJWJlcnRTcGFjZQAAoAsh8AEYBQAAGwVmAACgDSHpJXpvbnRhbExpbmUAoAAlAAFjdCYFKAXyABIF8iFvayZhbQBwAEQBMQU5BW8AdwBuAEgAdQBtAPAAAAFxInVhbAAAoE8iAAdFSk9hY2RmZ21ub3N0dVMFVgVZBVwFYwVtBXAFcwV6BZAFtgXFBckFzQVjAHkAFWTsIWlnMmFjAHkAAWRjAHUAdABlADuAzQDNQAABaXlnBWwFcgBjADuAzgDOQBhkbwB0ADBhcgAAoBEhcgBhAHYAZQA7gMwAzEAAoREhYXB/BYsFAAFjZ4MFhQVyACphaSNuYXJ5SQAAoEghbABpAGUA8wD6AvQBlQUAAKUFZaAsIgABZ3KaBZ4F8iFhbACgKyLzI2VjdGlvbgCgwiJpI3NpYmxlAAABQ1SsBbEFbyJtbWEAAKBjIGkibWVzAACgYiCAAWdwdAC8Bb8FwwVvAG4ALmFmAADgNdhA3WEAmWNjAHIAAKAQIWkibGRlAChh6wHSBQAA1QVjAHkABmRsADuAzwDPQIACY2Zvc3UA4QXpBe0F8gX9BQABaXnlBegFcgBjADRhGWRyAADgNdgN3XAAZgAA4DXYQd3jAfcFAAD7BXIAAOA12KXc8iFjeQhk6yFjeQRkgANISmFjZm9zAAwGDwYSBhUGHQYhBiYGYwB5ACVkYwB5AAxk8CFwYZpjAAFleRkGHAbkIWlsNmEaZHIAAOA12A7dcABmAADgNdhC3WMAcgAA4DXYptyABUpUYWNlZmxtb3N0AD0GQAZDBl4GawZkB2gHcAd0B80H2gdjAHkACWQ7gDwAPECAAmNtbnByAEwGTwZSBlUGWwb1IXRlOWHiIWRhm2NnAACg6ifsI2FjZXRyZgCgEiFyAACgniGAAWFleQBkBmcGagbyIW9uPWHkIWlsO2EbZAABZnNvBjQHdAAABUFDREZSVFVWYXKABp4GpAbGBssG3AYDByEHwQIqBwABbnKEBowGZyVsZUJyYWNrZXQAAKDoJ/Ihb3cAoZAhQlKTBpcGYQByAACg5CHpJGdodEFycm93AKDGIWUjaWxpbmcAAKAII28A9QGqBgAAsgZiJWxlQnJhY2tldAAAoOYnbgDUAbcGAAC+BmUkZVZlY3RvcgAAoGEp5SJjdG9yQqDDIWEAcgAAoFkpbCJvb3IAAKAKI2kiZ2h0AAABQVbSBtcGciJyb3cAAKCUIeUiY3RvcgCgTikAAWVy4AbwBmUAAKGjIkFW5gbrBnIicm93AACgpCHlImN0b3IAoFopaSNhbmdsZQBCorIi+wYAAAAA/wZhAHIAAKDPKXEidWFsAACgtCJwAIABRFRWAAoHEQcYB+8kd25WZWN0b3IAoFEpZSRlVmVjdG9yAACgYCnlImN0b3JCoL8hYQByAACgWCnlImN0b3JCoLwhYQByAACgUilpAGcAaAB0AGEAcgByAG8A9wDMAnMAAANFRkdMU1Q/B0cHTgdUB1gHXwfxJXVhbEdyZWF0ZXIAoNoidSRsbEVxdWFsAACgZiJyI2VhdGVyAACgdiLlIXNzAKChKuwkYW50RXF1YWwAoH0qaSJsZGUAAKByInIAAOA12A/dZaDYIuYjdGFycm93AKDaIWkiZG90AD9hgAFucHcAege1B7kHZwAAAkxSbHKCB5QHmwerB+UhZnQAAUFSiAeNB3Iicm93AACg9SfpJGdodEFycm93AKD3J+kkZ2h0QXJyb3cAoPYn5SFmdAABYXLcAqEHaQBnAGgAdABhAHIAcgBvAPcA5wJpAGcAaAB0AGEAcgByAG8A9wDuAmYAAOA12EPdZQByAAABTFK/B8YHZSRmdEFycm93AACgmSHpJGdodEFycm93AKCYIYABY2h0ANMH1QfXB/IAWgYAoLAh8iFva0FhAKBqIgAEYWNlZmlvc3XpB+wH7gf/BwMICQgOCBEIcAAAoAUpeQAcZAABZGzyB/kHaSR1bVNwYWNlAACgXyBsI2ludHJmAACgMyFyAADgNdgQ3e4jdXNQbHVzAKATInAAZgAA4DXYRN1jAPIA/gecY4AESmFjZWZvc3R1ACEIJAgoCDUIgQiFCDsKQApHCmMAeQAKZGMidXRlAENhgAFhZXkALggxCDQI8iFvbkdh5CFpbEVhHWSAAWdzdwA7CGEIfQjhInRpdmWAAU1UVgBECEwIWQhlJWRpdW1TcGFjZQAAoAsgaABpAAABY25SCFMIawBTAHAAYQBjAOUASwhlAHIAeQBUAGgAaQDuAFQI9CFlZAABR0xnCHUIcgBlAGEAdABlAHIARwByAGUAYQB0AGUA8gDrBGUAcwBzAEwAZQBzAPMA2wdMImluZQAKYHIAAOA12BHdAAJCbnB0jAiRCJkInAhyImVhawAAoGAgwiZyZWFraW5nU3BhY2WgYGYAAKAVIUOq7CqzCMIIzQgAAOcIGwkAAAAAAAAtCQAAbwkAAIcJAACdCcAJGQoAADQKAAFvdbYIvAjuI2dydWVudACgYiJwIkNhcAAAoG0ibyh1YmxlVmVydGljYWxCYXIAAKAmIoABbHF4ANII1wjhCOUibWVudACgCSL1IWFsVKBgImkibGRlAADgQiI4A2kic3RzAACgBCJyI2VhdGVyAACjbyJFRkdMU1T1CPoIAgkJCQ0JFQlxInVhbAAAoHEidSRsbEVxdWFsAADgZyI4A3IjZWF0ZXIAAOBrIjgD5SFzcwCgeSLsJGFudEVxdWFsAOB+KjgDaSJsZGUAAKB1IvUhbXBEASAJJwnvI3duSHVtcADgTiI4A3EidWFsAADgTyI4A2UAAAFmczEJRgn0JFRyaWFuZ2xlQqLqIj0JAAAAAEIJYQByAADgzyk4A3EidWFsAACg7CJzAICibiJFR0xTVABRCVYJXAlhCWkJcSJ1YWwAAKBwInIjZWF0ZXIAAKB4IuUhc3MA4GoiOAPsJGFudEVxdWFsAOB9KjgDaSJsZGUAAKB0IuUic3RlZAABR0x1CX8J8iZlYXRlckdyZWF0ZXIA4KIqOAPlI3NzTGVzcwDgoSo4A/IjZWNlZGVzAKGAIkVTjwmVCXEidWFsAADgryo4A+wkYW50RXF1YWwAoOAiAAFlaaAJqQl2JmVyc2VFbGVtZW50AACgDCLnJWh0VHJpYW5nbGVCousitgkAAAAAuwlhAHIAAODQKTgDcSJ1YWwAAKDtIgABcXXDCeAJdSNhcmVTdQAAAWJwywnVCfMhZXRF4I8iOANxInVhbAAAoOIi5SJyc2V0ReCQIjgDcSJ1YWwAAKDjIoABYmNwAOYJ8AkNCvMhZXRF4IIi0iBxInVhbAAAoIgi4yJlZWRzgKGBIkVTVAD6CQAKBwpxInVhbAAA4LAqOAPsJGFudEVxdWFsAKDhImkibGRlAADgfyI4A+UicnNldEXggyLSIHEidWFsAACgiSJpImxkZQCAoUEiRUZUACIKJwouCnEidWFsAACgRCJ1JGxsRXF1YWwAAKBHImkibGRlAACgSSJlJXJ0aWNhbEJhcgAAoCQiYwByAADgNdip3GkAbABkAGUAO4DRANFAnWMAB0VhY2RmZ21vcHJzdHV2XgphCmgKcgp2CnoKgQqRCpYKqwqtCrsKyArNCuwhaWdSYWMAdQB0AGUAO4DTANNAAAFpeWwKcQpyAGMAO4DUANRAHmRiImxhYwBQYXIAAOA12BLdcgBhAHYAZQA7gNIA0kCAAWFlaQCHCooKjQpjAHIATGFnAGEAqWNjInJvbgCfY3AAZgAA4DXYRt3lI25DdXJseQABRFGeCqYKbyV1YmxlUXVvdGUAAKAcIHUib3RlAACgGCAAoFQqAAFjbLEKtQpyAADgNdiq3GEAcwBoADuA2ADYQGkAbAHACsUKZABlADuA1QDVQGUAcwAAoDcqbQBsADuA1gDWQGUAcgAAAUJQ0wrmCgABYXLXCtoKcgAAoD4gYQBjAAABZWvgCuIKAKDeI2UAdAAAoLQjYSVyZW50aGVzaXMAAKDcI4AEYWNmaGlsb3JzAP0KAwsFCwkLCwsMCxELIwtaC3IjdGlhbEQAAKACInkAH2RyAADgNdgT3WkApmOgY/Ujc01pbnVzsWAAAWlwFQsgC24AYwBhAHIAZQBwAGwAYQBuAOUACgVmAACgGSGAobsqZWlvACoLRQtJC+MiZWRlc4CheiJFU1QANAs5C0ALcSJ1YWwAAKCvKuwkYW50RXF1YWwAoHwiaSJsZGUAAKB+Im0AZQAAoDMgAAFkcE0LUQv1IWN0AKAPIm8jcnRpb24AYaA3ImwAAKAdIgABY2leC2ILcgAA4DXYq9yoYwACVWZvc2oLbwtzC3cLTwBUADuAIgAiQHIAAOA12BTdcABmAACgGiFjAHIAAOA12KzcAAZCRWFjZWZoaW9yc3WPC5MLlwupC7YL2AvbC90LhQyTDJoMowzhIXJyAKAQKUcAO4CuAK5AgAFjbnIAnQugC6ML9SF0ZVRhZwAAoOsncgB0oKAhbAAAoBYpgAFhZXkArwuyC7UL8iFvblhh5CFpbFZhIGR2oBwhZSJyc2UAAAFFVb8LzwsAAWxxwwvIC+UibWVudACgCyL1JGlsaWJyaXVtAKDLIXAmRXF1aWxpYnJpdW0AAKBvKXIAAKAcIW8AoWPnIWh0AARBQ0RGVFVWYewLCgwQDDIMNwxeDHwM9gIAAW5y8Av4C2clbGVCcmFja2V0AACg6SfyIW93AKGSIUJM/wsDDGEAcgAAoOUhZSRmdEFycm93AACgxCFlI2lsaW5nAACgCSNvAPUBFgwAAB4MYiVsZUJyYWNrZXQAAKDnJ24A1AEjDAAAKgxlJGVWZWN0b3IAAKBdKeUiY3RvckKgwiFhAHIAAKBVKWwib29yAACgCyMAAWVyOwxLDGUAAKGiIkFWQQxGDHIicm93AACgpiHlImN0b3IAoFspaSNhbmdsZQBCorMiVgwAAAAAWgxhAHIAAKDQKXEidWFsAACgtSJwAIABRFRWAGUMbAxzDO8kd25WZWN0b3IAoE8pZSRlVmVjdG9yAACgXCnlImN0b3JCoL4hYQByAACgVCnlImN0b3JCoMAhYQByAACgUykAAXB1iQyMDGYAAKAdIe4kZEltcGxpZXMAoHAp6SRnaHRhcnJvdwCg2yEAAWNongyhDHIAAKAbIQCgsSHsJGVEZWxheWVkAKD0KYAGSE9hY2ZoaW1vcXN0dQC/DMgMzAzQDOIM5gwKDQ0NFA0ZDU8NVA1YDQABQ2PDDMYMyCFjeSlkeQAoZEYiVGN5ACxkYyJ1dGUAWmEAorwqYWVpedgM2wzeDOEM8iFvbmBh5CFpbF5hcgBjAFxhIWRyAADgNdgW3e8hcnQAAkRMUlXvDPYM/QwEDW8kd25BcnJvdwAAoJMhZSRmdEFycm93AACgkCHpJGdodEFycm93AKCSIXAjQXJyb3cAAKCRIechbWGjY+EkbGxDaXJjbGUAoBgicABmAADgNdhK3XICHw0AAAAAIg10AACgGiLhIXJlgKGhJUlTVQAqDTINSg3uJXRlcnNlY3Rpb24AoJMidQAAAWJwNw1ADfMhZXRFoI8icSJ1YWwAAKCRIuUicnNldEWgkCJxInVhbAAAoJIibiJpb24AAKCUImMAcgAA4DXYrtxhAHIAAKDGIgACYmNtcF8Nag2ODZANc6DQImUAdABFoNAicSJ1YWwAAKCGIgABY2huDYkNZSJlZHMAgKF7IkVTVAB4DX0NhA1xInVhbAAAoLAq7CRhbnRFcXVhbACgfSJpImxkZQAAoH8iVABoAGEA9ADHCwCgESIAodEiZXOVDZ8NciJzZXQARaCDInEidWFsAACghyJlAHQAAKDRIoAFSFJTYWNmaGlvcnMAtQ27Db8NyA3ODdsN3w3+DRgOHQ4jDk8AUgBOADuA3gDeQMEhREUAoCIhAAFIY8MNxg1jAHkAC2R5ACZkAAFidcwNzQ0JYKRjgAFhZXkA1A3XDdoN8iFvbmRh5CFpbGJhImRyAADgNdgX3QABZWnjDe4N8gHoDQAA7Q3lImZvcmUAoDQiYQCYYwABY27yDfkNayNTcGFjZQAA4F8gCiDTInBhY2UAoAkg7CFkZYChPCJFRlQABw4MDhMOcSJ1YWwAAKBDInUkbGxFcXVhbAAAoEUiaSJsZGUAAKBIInAAZgAA4DXYS93pI3BsZURvdACg2yAAAWN0Jw4rDnIAAOA12K/c8iFva2Zh4QpFDlYOYA5qDgAAbg5yDgAAAAAAAAAAAAB5DnwOqA6zDgAADg8RDxYPGg8AAWNySA5ODnUAdABlADuA2gDaQHIAb6CfIeMhaXIAoEkpcgDjAVsOAABdDnkADmR2AGUAbGEAAWl5Yw5oDnIAYwA7gNsA20AjZGIibGFjAHBhcgAA4DXYGN1yAGEAdgBlADuA2QDZQOEhY3JqYQABZGl/Dp8OZQByAAABQlCFDpcOAAFhcokOiw5yAF9gYQBjAAABZWuRDpMOAKDfI2UAdAAAoLUjYSVyZW50aGVzaXMAAKDdI28AbgBQoMMi7CF1cwCgjiIAAWdwqw6uDm8AbgByYWYAAOA12EzdAARBREVUYWRwc78O0g7ZDuEOBQPqDvMOBw9yInJvdwDCoZEhyA4AAMwOYQByAACgEilvJHduQXJyb3cAAKDFIW8kd25BcnJvdwAAoJUhcSV1aWxpYnJpdW0AAKBuKWUAZQBBoKUiciJyb3cAAKClIW8AdwBuAGEAcgByAG8A9wAQA2UAcgAAAUxS+Q4AD2UkZnRBcnJvdwAAoJYh6SRnaHRBcnJvdwCglyFpAGyg0gNvAG4ApWPpIW5nbmFjAHIAAOA12LDcaSJsZGUAaGFtAGwAO4DcANxAgAREYmNkZWZvc3YALQ8xDzUPNw89D3IPdg97D4AP4SFzaACgqyJhAHIAAKDrKnkAEmThIXNobKCpIgCg5ioAAWVyQQ9DDwCgwSKAAWJ0eQBJD00Paw9hAHIAAKAWIGmgFiDjIWFsAAJCTFNUWA9cD18PZg9hAHIAAKAjIukhbmV8YGUkcGFyYXRvcgAAoFgnaSJsZGUAAKBAItQkaGluU3BhY2UAoAogcgAA4DXYGd1wAGYAAOA12E3dYwByAADgNdix3GQiYXNoAACgqiKAAmNlZm9zAI4PkQ+VD5kPng/pIXJjdGHkIWdlAKDAInIAAOA12BrdcABmAADgNdhO3WMAcgAA4DXYstwAAmZpb3OqD64Prw+0D3IAAOA12BvdnmNwAGYAAOA12E/dYwByAADgNdiz3IAEQUlVYWNmb3N1AMgPyw/OD9EP2A/gD+QP6Q/uD2MAeQAvZGMAeQAHZGMAeQAuZGMAdQB0AGUAO4DdAN1AAAFpedwP3w9yAGMAdmErZHIAAOA12BzdcABmAADgNdhQ3WMAcgAA4DXYtNxtAGwAeGEABEhhY2RlZm9z/g8BEAUQDRAQEB0QIBAkEGMAeQAWZGMidXRlAHlhAAFheQkQDBDyIW9ufWEXZG8AdAB7YfIBFRAAABwQbwBXAGkAZAB0AOgAVAhhAJZjcgAAoCghcABmAACgJCFjAHIAAOA12LXc4QtCEEkQTRAAAGcQbRByEAAAAAAAAAAAeRCKEJcQ8hD9EAAAGxEhETIROREAAD4RYwB1AHQAZQA7gOEA4UByImV2ZQADYYCiPiJFZGl1eQBWEFkQWxBgEGUQAOA+IjMDAKA/InIAYwA7gOIA4kB0AGUAO4C0ALRAMGRsAGkAZwA7gOYA5kByoGEgAOA12B7dcgBhAHYAZQA7gOAA4EAAAWVwfBCGEAABZnCAEIQQ8yF5bQCgNSHoAIMQaABhALFjAAFhcI0QWwAAAWNskRCTEHIAAWFnAACgPypkApwQAAAAALEQAKInImFkc3ajEKcQqRCuEG4AZAAAoFUqAKBcKmwib3BlAACgWCoAoFoqAKMgImVsbXJzersQvRDAEN0Q5RDtEACgpCllAACgICJzAGQAYaAhImEEzhDQENIQ1BDWENgQ2hDcEACgqCkAoKkpAKCqKQCgqykAoKwpAKCtKQCgrikAoK8pdAB2oB8iYgBkoL4iAKCdKQABcHTpEOwQaAAAoCIixWDhIXJyAKB8IwABZ3D1EPgQbwBuAAVhZgAA4DXYUt0Ao0giRWFlaW9wBxEJEQ0RDxESERQRAKBwKuMhaXIAoG8qAKBKImQAAKBLInMAJ2DyIW94ZaBIIvEADhFpAG4AZwA7gOUA5UCAAWN0eQAmESoRKxFyAADgNdi23CpgbQBwAGWgSCLxAPgBaQBsAGQAZQA7gOMA40BtAGwAO4DkAORAAAFjaUERRxFvAG4AaQBuAPQA6AFuAHQAAKARKgAITmFiY2RlZmlrbG5vcHJzdWQRaBGXEZ8RpxGrEdIR1hErEjASexKKEn0RThNbE3oTbwB0AACg7SoAAWNybBGJEWsAAAJjZXBzdBF4EX0RghHvIW5nAKBMInAjc2lsb24A9mNyImltZQAAoDUgaQBtAGWgPSJxAACgzSJ2AY0RkRFlAGUAAKC9ImUAZABnoAUjZQAAoAUjcgBrAHSgtSPiIXJrAKC2IwABb3mjEaYRbgDnAHcRMWTxIXVvAKAeIIACY21wcnQAtBG5Eb4RwRHFEeEhdXPloDUi5ABwInR5dgAAoLApcwDpAH0RbgBvAPUA6gCAAWFodwDLEcwRzhGyYwCgNiHlIWVuAKBsInIAAOA12B/dZwCAA2Nvc3R1dncA4xHyEQUSEhIhEiYSKRKAAWFpdQDpEesR7xHwAKMFcgBjAACg7yVwAACgwyKAAWRwdAD4EfwRABJvAHQAAKAAKuwhdXMAoAEqaSJtZXMAAKACKnECCxIAAAAADxLjIXVwAKAGKmEAcgAAoAUm8iNpYW5nbGUAAWR1GhIeEu8hd24AoL0lcAAAoLMlcCJsdXMAAKAEKmUA5QBCD+UAkg9hInJvdwAAoA0pgAFha28ANhJoEncSAAFjbjoSZRJrAIABbHN0AEESRxJNEm8jemVuZ2UAAKDrKXEAdQBhAHIA5QBcBPIjaWFuZ2xlgKG0JWRscgBYElwSYBLvIXduAKC+JeUhZnQAoMIlaSJnaHQAAKC4JWsAAKAjJLEBbRIAAHUSsgFxEgAAcxIAoJIlAKCRJTQAAKCTJWMAawAAoIglAAFlb38ShxJx4D0A5SD1IWl2AOBhIuUgdAAAoBAjAAJwdHd4kRKVEpsSnxJmAADgNdhT3XSgpSJvAG0AAKClIvQhaWUAoMgiAAZESFVWYmRobXB0dXayEsES0RLgEvcS+xIKExoTHxMjEygTNxMAAkxSbHK5ErsSvRK/EgCgVyUAoFQlAKBWJQCgUyUAolAlRFVkdckSyxLNEs8SAKBmJQCgaSUAoGQlAKBnJQACTFJsctgS2hLcEt4SAKBdJQCgWiUAoFwlAKBZJQCjUSVITFJobHLrEu0S7xLxEvMS9RIAoGwlAKBjJQCgYCUAoGslAKBiJQCgXyVvAHgAAKDJKQACTFJscgITBBMGEwgTAKBVJQCgUiUAoBAlAKAMJQCiACVEVWR1EhMUExYTGBMAoGUlAKBoJQCgLCUAoDQlaSJudXMAAKCfIuwhdXMAoJ4iaSJtZXMAAKCgIgACTFJsci8TMRMzEzUTAKBbJQCgWCUAoBglAKAUJQCjAiVITFJobHJCE0QTRhNIE0oTTBMAoGolAKBhJQCgXiUAoDwlAKAkJQCgHCUAAWV2UhNVE3YA5QD5AGIAYQByADuApgCmQAACY2Vpb2ITZhNqE24TcgAA4DXYt9xtAGkAAKBPIG0A5aA9IogRbAAAoVwAYmh0E3YTAKDFKfMhdWIAoMgnbAF+E4QTbABloCIgdAAAoCIgcAAAoU4iRWWJE4sTAKCuKvGgTyI8BeEMqRMAAN8TABQDFB8UAAAjFDQUAAAAAIUUAAAAAI0UAAAAANcU4xT3FPsUAACIFQAAlhWAAWNwcgCuE7ET1RP1IXRlB2GAoikiYWJjZHMAuxO/E8QTzhPSE24AZAAAoEQqciJjdXAAAKBJKgABYXXIE8sTcAAAoEsqcAAAoEcqbwB0AACgQCoA4CkiAP4AAWVv2RPcE3QAAKBBIO4ABAUAAmFlaXXlE+8T9RP4E/AB6hMAAO0TcwAAoE0qbwBuAA1hZABpAGwAO4DnAOdAcgBjAAlhcABzAHOgTCptAACgUCpvAHQAC2GAAWRtbgAIFA0UEhRpAGwAO4C4ALhAcCJ0eXYAAKCyKXQAAIGiADtlGBQZFKJAcgBkAG8A9ABiAXIAAOA12CDdgAFjZWkAKBQqFDIUeQBHZGMAawBtoBMn4SFyawCgEyfHY3IAAKPLJUVjZWZtcz8UQRRHFHcUfBSAFACgwykAocYCZWxGFEkUcQAAoFciZQBhAlAUAAAAAGAUciJyb3cAAAFsclYUWhTlIWZ0AKC6IWkiZ2h0AACguyGAAlJTYWNkAGgUaRRrFG8UcxSuYACgyCRzAHQAAKCbIukhcmMAoJoi4SFzaACgnSJuImludAAAoBAqaQBkAACg7yrjIWlyAKDCKfUhYnN1oGMmaQB0AACgYybsApMUmhS2FAAAwxRvAG4AZaA6APGgVCKrAG0CnxQAAAAAoxRhAHSgLABAYAChASJmbKcUqRTuABMNZQAAAW14rhSyFOUhbnQAoAEiZQDzANIB5wG6FAAAwBRkoEUibwB0AACgbSpuAPQAzAGAAWZyeQDIFMsUzhQA4DXYVN1vAOQA1wEAgakAO3MeAdMUcgAAoBchAAFhb9oU3hRyAHIAAKC1IXMAcwAAoBcnAAFjdeYU6hRyAADgNdi43AABYnDuFPIUZaDPKgCg0SploNAqAKDSKuQhb3QAoO8igANkZWxwcnZ3AAYVEBUbFSEVRBVlFYQV4SFycgABbHIMFQ4VAKA4KQCgNSlwAhYVAAAAABkVcgAAoN4iYwAAoN8i4SFycnCgtiEAoD0pgKIqImJjZG9zACsVMBU6FT4VQRVyImNhcAAAoEgqAAFhdTQVNxVwAACgRipwAACgSipvAHQAAKCNInIAAKBFKgDgKiIA/gACYWxydksVURVuFXMVcgByAG2gtyEAoDwpeQCAAWV2dwBYFWUVaRVxAHACXxUAAAAAYxVyAGUA4wAXFXUA4wAZFWUAZQAAoM4iZSJkZ2UAAKDPImUAbgA7gKQApEBlI2Fycm93AAABbHJ7FX8V5SFmdACgtiFpImdodAAAoLchZQDkAG0VAAFjaYsVkRVvAG4AaQBuAPQAkwFuAHQAAKAxImwiY3R5AACgLSOACUFIYWJjZGVmaGlqbG9yc3R1d3oAuBW7Fb8V1RXgFegV+RUKFhUWHxZUFlcWZRbFFtsW7xb7FgUXChdyAPIAtAJhAHIAAKBlKQACZ2xyc8YVyhXOFdAV5yFlcgCgICDlIXRoAKA4IfIA9QxoAHagECAAoKMiawHZFd4VYSJyb3cAAKAPKWEA4wBfAgABYXnkFecV8iFvbg9hNGQAoUYhYW/tFfQVAAFnciEC8RVyAACgyiF0InNlcQAAoHcqgAFnbG0A/xUCFgUWO4CwALBAdABhALRjcCJ0eXYAAKCxKQABaXIOFhIW8yFodACgfykA4DXYId1hAHIAAAFschsWHRYAoMMhAKDCIYACYWVnc3YAKBauAjYWOhY+Fm0AAKHEIm9zLhY0Fm4AZABzoMQi9SFpdACgZiZhIm1tYQDdY2kAbgAAoPIiAKH3AGlvQxZRFmQAZQAAgfcAO29KFksW90BuI3RpbWVzAACgxyJuAPgAUBZjAHkAUmRjAG8CXhYAAAAAYhZyAG4AAKAeI28AcAAAoA0jgAJscHR1dwBuFnEWdRaSFp4W7CFhciRgZgAA4DXYVd0AotkCZW1wc30WhBaJFo0WcQBkoFAibwB0AACgUSJpIm51cwAAoDgi7CF1cwCgFCLxInVhcmUAoKEiYgBsAGUAYgBhAHIAdwBlAGQAZwDlANcAbgCAAWFkaAClFqoWtBZyAHIAbwD3APUMbwB3AG4AYQByAHIAbwB3APMA8xVhI3Jwb29uAAABbHK8FsAWZQBmAPQAHBZpAGcAaAD0AB4WYgHJFs8WawBhAHIAbwD3AJILbwLUFgAAAADYFnIAbgAAoB8jbwBwAACgDCOAAWNvdADhFukW7BYAAXJ55RboFgDgNdi53FVkbAAAoPYp8iFvaxFhAAFkcvMW9xZvAHQAAKDxImkA5qC/JVsSAAFhaP8WAhdyAPIANQNhAPIA1wvhIm5nbGUAoKYpAAFjaQ4XEBd5AF9k5yJyYXJyAKD/JwAJRGFjZGVmZ2xtbm9wcXJzdHV4MRc4F0YXWxcyBF4XaRd5F40XrBe0F78X2RcVGCEYLRg1GEAYAAFEbzUXgRZvAPQA+BUAAWNzPBdCF3UAdABlADuA6QDpQPQhZXIAoG4qAAJhaW95TRdQF1YXWhfyIW9uG2FyAGOgViI7gOoA6kDsIW9uAKBVIk1kbwB0ABdhAAFEcmIXZhdvAHQAAKBSIgDgNdgi3XKhmipuF3QXYQB2AGUAO4DoAOhAZKCWKm8AdAAAoJgqgKGZKmlscwCAF4UXhxfuInRlcnMAoOcjAKATIWSglSpvAHQAAKCXKoABYXBzAJMXlheiF2MAcgATYXQAeQBzogUinxcAAAAAoRdlAHQAAKAFInAAMaADIDMBqRerFwCgBCAAoAUgAAFnc7AXsRdLYXAAAKACIAABZ3C4F7sXbwBuABlhZgAA4DXYVt2AAWFscwDFF8sXzxdyAHOg1SJsAACg4yl1AHMAAKBxKmkAAKG1A2x21RfYF28AbgC1Y/VjAAJjc3V24BfoF/0XEBgAAWlv5BdWF3IAYwAAoFYiaQLuFwAAAADwF+0ADQThIW50AAFnbPUX+Rd0AHIAAKCWKuUhc3MAoJUqgAFhZWkAAxgGGAoYbABzAD1gcwB0AACgXyJ2AESgYSJEAACgeCrwImFyc2wAoOUpAAFEYRkYHRhvAHQAAKBTInIAcgAAoHEpgAFjZGkAJxgqGO0XcgAAoC8hbwD0AIwCAAFhaDEYMhi3YzuA8ADwQAABbXI5GD0YbAA7gOsA60BvAACgrCCAAWNpcABGGEgYSxhsACFgcwD0ACwEAAFlb08YVxhjAHQAYQB0AGkAbwDuABoEbgBlAG4AdABpAGEAbADlADME4Ql1GAAAgRgAAIMYiBgAAAAAoRilGAAAqhgAALsYvhjRGAAA1xgnGWwAbABpAG4AZwBkAG8AdABzAGUA8QBlF3kARGRtImFsZQAAoEAmgAFpbHIAjRiRGJ0Y7CFpZwCgA/tpApcYAAAAAJoYZwAAoAD7aQBnAACgBPsA4DXYI93sIWlnAKAB++whaWcA4GYAagCAAWFsdACvGLIYthh0AACgbSZpAGcAAKAC+24AcwAAoLElbwBmAJJh8AHCGAAAxhhmAADgNdhX3QABYWvJGMwYbADsAGsEdqDUIgCg2SphI3J0aW50AACgDSoAAWFv2hgiGQABY3PeGB8ZsQPnGP0YBRkSGRUZAAAdGbID7xjyGPQY9xj5GAAA+xg7gL0AvUAAoFMhO4C8ALxAAKBVIQCgWSEAoFshswEBGQAAAxkAoFQhAKBWIbQCCxkOGQAAAAAQGTuAvgC+QACgVyEAoFwhNQAAoFghtgEZGQAAGxkAoFohAKBdITgAAKBeIWwAAKBEIHcAbgAAoCIjYwByAADgNdi73IAIRWFiY2RlZmdpamxub3JzdHYARhlKGVoZXhlmGWkZkhmWGZkZnRmgGa0ZxhnLGc8Z4BkjGmygZyIAoIwqgAFjbXAAUBlTGVgZ9SF0ZfVhbQBhAOSgswM6FgCghipyImV2ZQAfYQABaXliGWUZcgBjAB1hM2RvAHQAIWGAoWUibHFzAMYEcBl6GfGhZSLOBAAAdhlsAGEAbgD0AN8EgKF+KmNkbACBGYQZjBljAACgqSpvAHQAb6CAKmyggioAoIQqZeDbIgD+cwAAoJQqcgAA4DXYJN3noGsirATtIWVsAKA3IWMAeQBTZIChdyJFYWoApxmpGasZAKCSKgCgpSoAoKQqAAJFYWVztBm2Gb0ZwhkAoGkicABwoIoq8iFveACgiipxoIgq8aCIKrUZaQBtAACg5yJwAGYAAOA12FjdYQB2AOUAYwIAAWNp0xnWGXIAAKAKIW0AAKFzImVs3BneGQCgjioAoJAqAIM+ADtjZGxxco0E6xn0GfgZ/BkBGgABY2nvGfEZAKCnKnIAAKB6Km8AdAAAoNci0CFhcgCglSl1ImVzdAAAoHwqgAJhZGVscwAKGvQZFhrVBCAa8AEPGgAAFBpwAHIAbwD4AFkZcgAAoHgpcQAAAWxxxAQbGmwAZQBzAPMASRlpAO0A5AQAAWVuJxouGnIjdG5lcXEAAOBpIgD+xQAsGgAFQWFiY2Vma29zeUAaQxpmGmoabRqDGocalhrCGtMacgDyAMwCAAJpbG1yShpOGlAaVBpyAHMA8ABxD2YAvWBpAGwA9AASBQABZHJYGlsaYwB5AEpkAKGUIWN3YBpkGmkAcgAAoEgpAKCtIWEAcgAAoA8h6SFyYyVhgAFhbHIAcxp7Gn8a8iF0c3WgZSZpAHQAAKBlJuwhaXAAoCYg4yFvbgCguSJyAADgNdgl3XMAAAFld4wakRphInJvdwAAoCUpYSJyb3cAAKAmKYACYW1vcHIAnxqjGqcauhq+GnIAcgAAoP8h9CFodACgOyJrAAABbHKsGrMaZSRmdGFycm93AACgqSHpJGdodGFycm93AKCqIWYAAOA12Fnd4iFhcgCgFSCAAWNsdADIGswa0BpyAADgNdi93GEAcwDoAGka8iFvaydhAAFicNca2xr1IWxsAKBDIOghZW4AoBAg4Qr2GgAA/RoAAAgbExsaGwAAIRs7GwAAAAA+G2IbmRuVG6sbAACyG80b0htjAHUAdABlADuA7QDtQAChYyBpeQEbBhtyAGMAO4DuAO5AOGQAAWN4CxsNG3kANWRjAGwAO4ChAKFAAAFmcssCFhsA4DXYJt1yAGEAdgBlADuA7ADsQIChSCFpbm8AJxsyGzYbAAFpbisbLxtuAHQAAKAMKnQAAKAtIuYhaW4AoNwpdABhAACgKSHsIWlnM2GAAWFvcABDG1sbXhuAAWNndABJG0sbWRtyACthgAFlbHAAcQVRG1UbaQBuAOUAyAVhAHIA9AByBWgAMWFmAACgtyJlAGQAtWEAoggiY2ZvdGkbbRt1G3kb4SFyZQCgBSFpAG4AdKAeImkAZQAAoN0pZABvAPQAWxsAoisiY2VscIEbhRuPG5QbYQBsAACguiIAAWdyiRuNG2UAcgDzACMQ4wCCG2EicmhrAACgFyryIW9kAKA8KgACY2dwdJ8boRukG6gbeQBRZG8AbgAvYWYAAOA12FrdYQC5Y3UAZQBzAHQAO4C/AL9AAAFjabUbuRtyAADgNdi+3G4AAKIIIkVkc3bCG8QbyBvQAwCg+SJvAHQAAKD1Inag9CIAoPMiaaBiIOwhZGUpYesB1hsAANkbYwB5AFZkbAA7gO8A70AAA2NmbW9zdeYb7hvyG/Ub+hsFHAABaXnqG+0bcgBjADVhOWRyAADgNdgn3eEhdGg3YnAAZgAA4DXYW93jAf8bAAADHHIAAOA12L/c8iFjeVhk6yFjeVRkAARhY2ZnaGpvcxUcGhwiHCYcKhwtHDAcNRzwIXBhdqC6A/BjAAFleR4cIRzkIWlsN2E6ZHIAAOA12CjdciJlZW4AOGFjAHkARWRjAHkAXGRwAGYAAOA12FzdYwByAADgNdjA3IALQUJFSGFiY2RlZmdoamxtbm9wcnN0dXYAXhxtHHEcdRx5HN8cBx0dHTwd3B3tHfEdAR4EHh0eLB5FHrwewx7hHgkfPR9LH4ABYXJ0AGQcZxxpHHIA8gBvB/IAxQLhIWlsAKAbKeEhcnIAoA4pZ6BmIgCgiyphAHIAAKBiKWMJjRwAAJAcAACVHAAAAAAAAAAAAACZHJwcAACmHKgcrRwAANIc9SF0ZTph7SJwdHl2AKC0KXIAYQDuAFoG4iFkYbtjZwAAoegnZGyhHKMcAKCRKeUAiwYAoIUqdQBvADuAqwCrQHIAgKOQIWJmaGxwc3QAuhy/HMIcxBzHHMoczhxmoOQhcwAAoB8pcwAAoB0p6wCyGnAAAKCrIWwAAKA5KWkAbQAAoHMpbAAAoKIhAKGrKmFl1hzaHGkAbAAAoBkpc6CtKgDgrSoA/oABYWJyAOUc6RztHHIAcgAAoAwpcgBrAACgcicAAWFr8Rz4HGMAAAFla/Yc9xx7YFtgAAFlc/wc/hwAoIspbAAAAWR1Ax0FHQCgjykAoI0pAAJhZXV5Dh0RHRodHB3yIW9uPmEAAWRpFR0YHWkAbAA8YewAowbiAPccO2QAAmNxcnMkHScdLB05HWEAAKA2KXUAbwDyoBwgqhEAAWR1MB00HeghYXIAoGcpcyJoYXIAAKBLKWgAAKCyIQCiZCJmZ3FzRB1FB5Qdnh10AIACYWhscnQATh1WHWUdbB2NHXIicm93AHSgkCFhAOkAzxxhI3Jwb29uAAABZHVeHWId7yF3bgCgvSFwAACgvCHlJGZ0YXJyb3dzAKDHIWkiZ2h0AIABYWhzAHUdex2DHXIicm93APOglCGdBmEAcgBwAG8AbwBuAPMAzgtxAHUAaQBnAGEAcgByAG8A9wBlGugkcmVldGltZXMAoMsi8aFkIk0HAACaHWwAYQBuAPQAXgcAon0qY2Rnc6YdqR2xHbcdYwAAoKgqbwB0AG+gfypyoIEqAKCDKmXg2iIA/nMAAKCTKoACYWRlZ3MAwB3GHcod1h3ZHXAAcAByAG8A+ACmHG8AdAAAoNYicQAAAWdxzx3SHXQA8gBGB2cAdADyAHQcdADyAFMHaQDtAGMHgAFpbHIA4h3mHeod8yFodACgfClvAG8A8gDKBgDgNdgp3UWgdiIAoJEqYQH1Hf4dcgAAAWR1YB35HWygvCEAoGopbABrAACghCVjAHkAWWQAomoiYWNodAweDx4VHhkecgDyAGsdbwByAG4AZQDyAGAW4SFyZACgaylyAGkAAKD6JQABaW8hHiQe5CFvdEBh9SFzdGGgsCPjIWhlAKCwIwACRWFlczMeNR48HkEeAKBoInAAcKCJKvIhb3gAoIkqcaCHKvGghyo0HmkAbQAAoOYiAARhYm5vcHR3elIeXB5fHoUelh6mHqsetB4AAW5yVh5ZHmcAAKDsJ3IAAKD9IXIA6wCwBmcAgAFsbXIAZh52Hnse5SFmdAABYXKIB2weaQBnAGgAdABhAHIAcgBvAPcAkwfhInBzdG8AoPwnaQBnAGgAdABhAHIAcgBvAPcAmgdwI2Fycm93AAABbHKNHpEeZQBmAPQAxhxpImdodAAAoKwhgAFhZmwAnB6fHqIecgAAoIUpAOA12F3ddQBzAACgLSppIm1lcwAAoDQqYQGvHrMecwB0AACgFyLhAIoOZaHKJbkeRhLuIWdlAKDKJWEAcgBsoCgAdAAAoJMpgAJhY2htdADMHs8e1R7bHt0ecgDyAJ0GbwByAG4AZQDyANYWYQByAGSgyyEAoG0pAKAOIHIAaQAAoL8iAANhY2hpcXTrHu8e1QfzHv0eBh/xIXVvAKA5IHIAAOA12MHcbQDloXIi+h4AAPweAKCNKgCgjyoAAWJ19xwBH28AcqAYIACgGiDyIW9rQmEAhDwAO2NkaGlscXJCBhcfxh0gHyQfKB8sHzEfAAFjaRsfHR8AoKYqcgAAoHkqcgBlAOUAkx3tIWVzAKDJIuEhcnIAoHYpdSJlc3QAAKB7KgABUGk1HzkfYQByAACglillocMlAgdfEnIAAAFkdUIfRx9zImhhcgAAoEop6CFhcgCgZikAAWVuTx9WH3IjdG5lcXEAAOBoIgD+xQBUHwAHRGFjZGVmaGlsbm9wc3VuH3Ifoh+rH68ftx+7H74f5h/uH/MfBwj/HwsgxCFvdACgOiIAAmNscHJ5H30fiR+eH3IAO4CvAK9AAAFldIEfgx8AoEImZaAgJ3MAZQAAoCAnc6CmIXQAbwCAoaYhZGx1AJQfmB+cH28AdwDuAHkDZQBmAPQA6gbwAOkO6yFlcgCgriUAAW95ph+qH+0hbWEAoCkqPGThIXNoAKAUIOElc3VyZWRhbmdsZQCgISJyAADgNdgq3W8AAKAnIYABY2RuAMQfyR/bH3IAbwA7gLUAtUBhoiMi0B8AANMf1x9zAPQAKxFpAHIAAKDwKm8AdAA7gLcAt0B1AHMA4qESIh4TAADjH3WgOCIAoCoqYwHqH+0fcAAAoNsq8gB+GnAAbAB1APMACAgAAWRw9x/7H+UhbHMAoKciZgAA4DXYXt0AAWN0AyAHIHIAAOA12MLc8CFvcwCgPiJsobwDECAVIPQiaW1hcACguCJhAPAAEyAADEdMUlZhYmNkZWZnaGlqbG1vcHJzdHV2dzwgRyBmIG0geSCqILgg2iDeIBEhFSEyIUMhTSFQIZwhnyHSIQAiIyKLIrEivyIUIwABZ3RAIEMgAODZIjgD9uBrItIgBwmAAWVsdABNIF8gYiBmAHQAAAFhclMgWCByInJvdwAAoM0h6SRnaHRhcnJvdwCgziEA4NgiOAP24Goi0iBfCekkZ2h0YXJyb3cAoM8hAAFEZHEgdSDhIXNoAKCvIuEhc2gAoK4igAJiY25wdACCIIYgiSCNIKIgbABhAACgByL1IXRlRGFnAADgICLSIACiSSJFaW9wlSCYIJwgniAA4HAqOANkAADgSyI4A3MASWFyAG8A+AAyCnUAcgBhoG4mbADzoG4mmwjzAa8gAACzIHAAO4CgAKBAbQBwAOXgTiI4AyoJgAJhZW91eQDBIMogzSDWINkg8AHGIAAAyCAAoEMqbwBuAEhh5CFpbEZhbgBnAGSgRyJvAHQAAOBtKjgDcAAAoEIqPWThIXNoAKATIACjYCJBYWRxc3jpIO0g+SD+IAIhDCFyAHIAAKDXIXIAAAFocvIg9SBrAACgJClvoJch9wAGD28AdAAA4FAiOAN1AGkA9gC7CAABZWkGIQohYQByAACgKCntAN8I6SFzdPOgBCLlCHIAAOA12CvdAAJFZXN0/wgcISshLiHxoXEiIiEAABMJ8aFxIgAJAAAnIWwAYQBuAPQAEwlpAO0AGQlyoG8iAKBvIoABQWFwADghOyE/IXIA8gBeIHIAcgAAoK4hYQByAACg8ipzogsiSiEAAAAAxwtkoPwiAKD6ImMAeQBaZIADQUVhZGVzdABcIV8hYiFmIWkhkyGWIXIA8gBXIADgZiI4A3IAcgAAoJohcgAAoCUggKFwImZxcwBwIYQhjiF0AAABYXJ1IXohcgByAG8A9wBlIWkAZwBoAHQAYQByAHIAbwD3AD4h8aFwImAhAACKIWwAYQBuAPQAZwlz4H0qOAMAoG4iaQDtAG0JcqBuImkA5aDqIkUJaQDkADoKAAFwdKMhpyFmAADgNdhf3YCBrAA7aW4AriGvIcchrEBuAIChCSJFZHYAtyG6Ib8hAOD5IjgDbwB0AADg9SI4A+EB1gjEIcYhAKD3IgCg9iJpAHagDCLhAagJzyHRIQCg/iIAoP0igAFhb3IA2CHsIfEhcgCAoSYiYXN0AOAh5SHpIWwAbABlAOwAywhsAADg/SrlIADgAiI4A2wiaW50AACgFCrjoYAi9yEAAPohdQDlAJsJY+CvKjgDZaCAIvEAkwkAAkFhaXQHIgoiFyIeInIA8gBsIHIAcgAAoZshY3cRIhQiAOAzKTgDAOCdITgDZyRodGFycm93AACgmyFyAGkA5aDrIr4JgANjaGltcHF1AC8iPCJHIpwhTSJQIloigKGBImNlcgA2Iv0JOSJ1AOUABgoA4DXYw9zvIXJ0bQKdIQAAAABEImEAcgDhAOEhbQBloEEi8aBEIiYKYQDyAMsIcwB1AAABYnBWIlgi5QDUCeUA3wmAAWJjcABgInMieCKAoYQiRWVzAGci7glqIgDgxSo4A2UAdABl4IIi0iBxAPGgiCJoImMAZaCBIvEA/gmAoYUiRWVzAH8iFgqCIgDgxio4A2UAdABl4IMi0iBxAPGgiSKAIgACZ2lscpIilCKaIpwi7AAMCWwAZABlADuA8QDxQOcAWwlpI2FuZ2xlAAABbHKkIqoi5SFmdGWg6iLxAEUJaSJnaHQAZaDrIvEAvgltoL0DAKEjAGVzuCK8InIAbwAAoBYhcAAAoAcggARESGFkZ2lscnMAziLSItYi2iLeIugi7SICIw8j4SFzaACgrSLhIXJyAKAEKXAAAOBNItIg4SFzaACgrCIAAWV04iLlIgDgZSLSIADgPgDSIG4iZmluAACg3imAAUFldADzIvci+iJyAHIAAKACKQDgZCLSIHLgPADSIGkAZQAA4LQi0iAAAUF0BiMKI3IAcgAAoAMp8iFpZQDgtSLSIGkAbQAA4Dwi0iCAAUFhbgAaIx4jKiNyAHIAAKDWIXIAAAFociMjJiNrAACgIylvoJYh9wD/DuUhYXIAoCcpUxJqFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVCMAAF4jaSN/I4IjjSOeI8AUAAAAAKYjwCMAANoj3yMAAO8jHiQvJD8kRCQAAWNzVyNsFHUAdABlADuA8wDzQAABaXlhI2cjcgBjoJoiO4D0APRAPmSAAmFiaW9zAHEjdCN3I3EBeiNzAOgAdhTsIWFjUWF2AACgOCrvIWxkAKC8KewhaWdTYQABY3KFI4kjaQByAACgvykA4DXYLN1vA5QjAAAAAJYjAACcI24A22JhAHYAZQA7gPIA8kAAoMEpAAFibaEjjAphAHIAAKC1KQACYWNpdKwjryO6I70jcgDyAFkUAAFpcrMjtiNyAACgvinvIXNzAKC7KW4A5QDZCgCgwCmAAWFlaQDFI8gjyyNjAHIATWFnAGEAyWOAAWNkbgDRI9Qj1iPyIW9uv2MAoLYpdQDzAHgBcABmAADgNdhg3YABYWVsAOQj5yPrI3IAAKC3KXIAcAAAoLkpdQDzAHwBAKMoImFkaW9zdvkj/CMPJBMkFiQbJHIA8gBeFIChXSplZm0AAyQJJAwkcgBvoDQhZgAAoDQhO4CqAKpAO4C6ALpA5yFvZgCgtiJyAACgVipsIm9wZQAAoFcqAKBbKoABY2xvACMkJSQrJPIACCRhAHMAaAA7gPgA+EBsAACgmCJpAGwBMyQ4JGQAZQA7gPUA9UBlAHMAYaCXInMAAKA2Km0AbAA7gPYA9kDiIWFyAKA9I+EKXiQAAHokAAB8JJQkAACYJKkkAAAAALUkEQsAAPAkAAAAAAQleiUAAIMlcgCAoSUiYXN0AGUkbyQBCwCBtgA7bGokayS2QGwAZQDsABgDaQJ1JAAAAAB4JG0AAKDzKgCg/Sp5AD9kcgCAAmNpbXB0AIUkiCSLJJkSjyRuAHQAJWBvAGQALmBpAGwAAKAwIOUhbmsAoDEgcgAA4DXYLd2AAWltbwCdJKAkpCR2oMYD1WNtAGEA9AD+B24AZQAAoA4m9KHAA64kAAC0JGMjaGZvcmsAAKDUItZjAAFhdbgkxCRuAAABY2u9JMIkawBooA8hAKAOIfYAaRpzAACkKwBhYmNkZW1zdNMkIRPXJNsk4STjJOck6yTjIWlyAKAjKmkAcgAAoCIqAAFvdYsW3yQAoCUqAKByKm4AO4CxALFAaQBtAACgJip3AG8AAKAnKoABaXB1APUk+iT+JO4idGludACgFSpmAADgNdhh3W4AZAA7gKMAo0CApHoiRWFjZWlub3N1ABMlFSUYJRslTCVRJVklSSV1JQCgsypwAACgtyp1AOUAPwtjoK8qgKJ6ImFjZW5zACclLSU0JTYlSSVwAHAAcgBvAPgAFyV1AHIAbAB5AGUA8QA/C/EAOAuAAWFlcwA8JUElRSXwInByb3gAoLkqcQBxAACgtSppAG0AAKDoImkA7QBEC20AZQDzoDIgIguAAUVhcwBDJVclRSXwAEAlgAFkZnAATwtfJXElgAFhbHMAZSVpJW0l7CFhcgCgLiPpIW5lAKASI/UhcmYAoBMjdKAdIu8AWQvyIWVsAKCwIgABY2l9JYElcgAA4DXYxdzIY24iY3NwAACgCCAAA2Zpb3BzdZElKxuVJZolnyWkJXIAAOA12C7dcABmAADgNdhi3XIiaW1lAACgVyBjAHIAAOA12MbcgAFhZW8AqiW6JcAldAAAAWVpryW2JXIAbgBpAG8AbgDzABkFbgB0AACgFipzAHQAZaA/APEACRj0AG0LgApBQkhhYmNkZWZoaWxtbm9wcnN0dXgA4yXyJfYl+iVpJpAmpia9JtUm5ib4JlonaCdxJ3UnnietJ7EnyCfiJ+cngAFhcnQA6SXsJe4lcgDyAJkM8gD6AuEhaWwAoBwpYQByAPIA3BVhAHIAAKBkKYADY2RlbnFydAAGJhAmEyYYJiYmKyZaJgABZXUKJg0mAOA9IjEDdABlAFVhaQDjACAN7SJwdHl2AKCzKWcAgKHpJ2RlbAAgJiImJCYAoJIpAKClKeUA9wt1AG8AO4C7ALtAcgAApZIhYWJjZmhscHN0dz0mQCZFJkcmSiZMJk4mUSZVJlgmcAAAoHUpZqDlIXMAAKAgKQCgMylzAACgHinrALka8ACVHmwAAKBFKWkAbQAAoHQpbAAAoKMhAKCdIQABYWleJmImaQBsAACgGilvAG6gNiJhAGwA8wB2C4ABYWJyAG8mciZ2JnIA8gAvEnIAawAAoHMnAAFha3omgSZjAAABZWt/JoAmfWBdYAABZXOFJocmAKCMKWwAAAFkdYwmjiYAoI4pAKCQKQACYWV1eZcmmiajJqUm8iFvbllhAAFkaZ4moSZpAGwAV2HsAA8M4gCAJkBkAAJjbHFzrSawJrUmuiZhAACgNylkImhhcgAAoGkpdQBvAPKgHSCjAWgAAKCzIYABYWNnAMMm0iaUC2wAgKEcIWlwcwDLJs4migxuAOUAoAxhAHIA9ADaC3QAAKCtJYABaWxyANsm3ybjJvMhaHQAoH0pbwBvAPIANgwA4DXYL90AAWFv6ib1JnIAAAFkde8m8SYAoMEhbKDAIQCgbCl2oMED8WOAAWducwD+Jk4nUCdoAHQAAANhaGxyc3QKJxInISc1Jz0nRydyInJvdwB0oJIhYQDpAFYmYSNycG9vbgAAAWR1GiceJ28AdwDuAPAmcAAAoMAh5SFmdAABYWgnJy0ncgByAG8AdwDzAAkMYQByAHAAbwBvAG4A8wATBGklZ2h0YXJyb3dzAACgySFxAHUAaQBnAGEAcgByAG8A9wBZJugkcmVldGltZXMAoMwiZwDaYmkAbgBnAGQAbwB0AHMAZQDxABwYgAFhaG0AYCdjJ2YncgDyAAkMYQDyABMEAKAPIG8idXN0AGGgsSPjIWhlAKCxI+0haWQAoO4qAAJhYnB0fCeGJ4knmScAAW5ygCeDJ2cAAKDtJ3IAAKD+IXIA6wAcDIABYWZsAI8nkieVJ3IAAKCGKQDgNdhj3XUAcwAAoC4qaSJtZXMAAKA1KgABYXCiJ6gncgBnoCkAdAAAoJQp7yJsaW50AKASKmEAcgDyADwnAAJhY2hxuCe8J6EMwCfxIXVvAKA6IHIAAOA12MfcAAFidYAmxCdvAPKgGSCoAYABaGlyAM4n0ifWJ3IAZQDlAE0n7SFlcwCgyiJpAIChuSVlZmwAXAxjEt4n9CFyaQCgzinsInVoYXIAoGgpAKAeIWENBSgJKA0oSyhVKIYoAACLKLAoAAAAAOMo5ygAABApJCkxKW0pcSmHKaYpAACYKgAAAACxKmMidXRlAFthcQB1AO8ABR+ApHsiRWFjZWlucHN5ABwoHignKCooLygyKEEoRihJKACgtCrwASMoAAAlKACguCpvAG4AYWF1AOUAgw1koLAqaQBsAF9hcgBjAF1hgAFFYXMAOCg6KD0oAKC2KnAAAKC6KmkAbQAAoOki7yJsaW50AKATKmkA7QCIDUFkbwB0AGKixSKRFgAAAABTKACgZiqAA0FhY21zdHgAYChkKG8ocyh1KHkogihyAHIAAKDYIXIAAAFocmkoayjrAJAab6CYIfcAzAd0ADuApwCnQGkAO2D3IWFyAKApKW0AAAFpbn4ozQBuAHUA8wDOAHQAAKA2J3IA7+A12DDdIxkAAmFjb3mRKJUonSisKHIAcAAAoG8mAAFoeZkonChjAHkASWRIZHIAdABtAqUoAAAAAKgoaQDkAFsPYQByAGEA7ABsJDuArQCtQAABZ22zKLsobQBhAAChwwNmdroouijCY4CjPCJkZWdsbnByAMgozCjPKNMo1yjaKN4obwB0AACgairxoEMiCw5FoJ4qAKCgKkWgnSoAoJ8qZQAAoEYi7CF1cwCgJCrhIXJyAKByKWEAcgDyAPwMAAJhZWl07Sj8KAEpCCkAAWxz8Sj4KGwAcwBlAHQAbQDpAH8oaABwAACgMyrwImFyc2wAoOQpAAFkbFoPBSllAACgIyNloKoqc6CsKgDgrCoA/oABZmxwABUpGCkfKfQhY3lMZGKgLwBhoMQpcgAAoD8jZgAA4DXYZN1hAAABZHIoKRcDZQBzAHWgYCZpAHQAAKBgJoABY3N1ADYpRilhKQABYXU6KUApcABzoJMiAOCTIgD+cABzoJQiAOCUIgD+dQAAAWJwSylWKQChjyJlcz4NUCllAHQAZaCPIvEAPw0AoZAiZXNIDVspZQB0AGWgkCLxAEkNAKGhJWFmZilbBHIAZQFrKVwEAKChJWEAcgDyAAMNAAJjZW10dyl7KX8pgilyAADgNdjI3HQAbQDuAM4AaQDsAAYpYQByAOYAVw0AAWFyiimOKXIA5qAGJhESAAFhbpIpoylpImdodAAAAWVwmSmgKXAAcwBpAGwAbwDuANkXaADpAKAkcwCvYIACYmNtbnAArin8KY4NJSooKgCkgiJFZGVtbnByc7wpvinCKcgpzCnUKdgp3CkAoMUqbwB0AACgvSpkoIYibwB0AACgwyr1IWx0AKDBKgABRWXQKdIpAKDLKgCgiiLsIXVzAKC/KuEhcnIAoHkpgAFlaXUA4inxKfQpdAAAoYIiZW7oKewpcQDxoIYivSllAHEA8aCKItEpbQAAoMcqAAFicPgp+ikAoNUqAKDTKmMAgKJ7ImFjZW5zAAcqDSoUKhYqRihwAHAAcgBvAPgAIyh1AHIAbAB5AGUA8QCDDfEAfA2AAWFlcwAcKiIqPShwAHAAcgBvAPgAPChxAPEAOShnAACgaiYApoMiMTIzRWRlaGxtbnBzPCo/KkIqRSpHKlIqWCpjKmcqaypzKncqO4C5ALlAO4CyALJAO4CzALNAAKDGKgABb3NLKk4qdAAAoL4qdQBiAACg2CpkoIcibwB0AACgxCpzAAABb3VdKmAqbAAAoMknYgAAoNcq4SFycgCgeyn1IWx0AKDCKgABRWVvKnEqAKDMKgCgiyLsIXVzAKDAKoABZWl1AH0qjCqPKnQAAKGDImVugyqHKnEA8aCHIkYqZQBxAPGgiyJwKm0AAKDIKgABYnCTKpUqAKDUKgCg1iqAAUFhbgCdKqEqrCpyAHIAAKDZIXIAAAFocqYqqCrrAJUab6CZIfcAxQf3IWFyAKAqKWwAaQBnADuA3wDfQOELzyrZKtwq6SrsKvEqAAD1KjQrAAAAAAAAAAAAAEwrbCsAAHErvSsAAAAAAADRK3IC1CoAAAAA2CrnIWV0AKAWI8RjcgDrAOUKgAFhZXkA4SrkKucq8iFvbmVh5CFpbGNhQmRvAPQAIg5sInJlYwAAoBUjcgAA4DXYMd0AAmVpa2/7KhIrKCsuK/IBACsAAAkrZQAAATRm6g0EK28AcgDlAOsNYQBzorgDECsAAAAAEit5AG0A0WMAAWNuFislK2sAAAFhcxsrIStwAHAAcgBvAPgAFw5pAG0AAKA8InMA8AD9DQABYXMsKyEr8AAXDnIAbgA7gP4A/kDsATgrOyswG2QA5QBnAmUAcwCAgdcAO2JkAEMrRCtJK9dAYaCgInIAAKAxKgCgMCqAAWVwcwBRK1MraSvhAAkh4qKkIlsrXysAAAAAYytvAHQAAKA2I2kAcgAAoPEqb+A12GXdcgBrAACg2irhAHgociJpbWUAAKA0IIABYWlwAHYreSu3K2QA5QC+DYADYWRlbXBzdACFK6MrmiunK6wrsCuzK24iZ2xlAACitSVkbHFykCuUK5ornCvvIXduAKC/JeUhZnRloMMl8QACBwCgXCJpImdodABloLkl8QBdDG8AdAAAoOwlaSJudXMAAKA6KuwhdXMAoDkqYgAAoM0p6SFtZQCgOyrlInppdW0AoOIjgAFjaHQAwivKK80rAAFyecYrySsA4DXYydxGZGMAeQBbZPIhb2tnYQABaW/UK9creAD0ANERaCJlYWQAAAFsct4r5ytlAGYAdABhAHIAcgBvAPcAXQbpJGdodGFycm93AKCgIQAJQUhhYmNkZmdobG1vcHJzdHV3CiwNLBEsHSwnLDEsQCxLLFIsYix6LIQsjyzLLOgs7Sz/LAotcgDyAAkDYQByAACgYykAAWNyFSwbLHUAdABlADuA+gD6QPIACQ1yAOMBIywAACUseQBeZHYAZQBtYQABaXkrLDAscgBjADuA+wD7QENkgAFhYmgANyw6LD0scgDyANEO7CFhY3FhYQDyAOAOAAFpckQsSCzzIWh0AKB+KQDgNdgy3XIAYQB2AGUAO4D5APlAYQFWLF8scgAAAWxyWixcLACgvyEAoL4hbABrAACggCUAAWN0Zix2LG8CbCwAAAAAcyxyAG4AZaAcI3IAAKAcI28AcAAAoA8jcgBpAACg+CUAAWFsfiyBLGMAcgBrYTuAqACoQAABZ3CILIssbwBuAHNhZgAA4DXYZt0AA2FkaGxzdZksniynLLgsuyzFLHIAcgBvAPcACQ1vAHcAbgBhAHIAcgBvAPcA2A5hI3Jwb29uAAABbHKvLLMsZQBmAPQAWyxpAGcAaAD0AF0sdQDzAKYOaQAAocUDaGzBLMIs0mNvAG4AxWPwI2Fycm93cwCgyCGAAWNpdADRLOEs5CxvAtcsAAAAAN4scgBuAGWgHSNyAACgHSNvAHAAAKAOI24AZwBvYXIAaQAAoPklYwByAADgNdjK3IABZGlyAPMs9yz6LG8AdAAAoPAi7CFkZWlhaQBmoLUlAKC0JQABYW0DLQYtcgDyAMosbAA7gPwA/EDhIm5nbGUAoKcpgAdBQkRhY2RlZmxub3Byc3oAJy0qLTAtNC2bLZ0toS2/LcMtxy3TLdgt3C3gLfwtcgDyABADYQByAHag6CoAoOkqYQBzAOgA/gIAAW5yOC08LechcnQAoJwpgANla25wcnN0AJkpSC1NLVQtXi1iLYItYQBwAHAA4QAaHG8AdABoAGkAbgDnAKEXgAFoaXIAoSmzJFotbwBwAPQAdCVooJUh7wD4JgABaXVmLWotZwBtAOEAuygAAWJwbi14LXMjZXRuZXEAceCKIgD+AODLKgD+cyNldG5lcQBx4IsiAP4A4MwqAP4AAWhyhi2KLWUAdADhABIraSNhbmdsZQAAAWxyki2WLeUhZnQAoLIiaSJnaHQAAKCzInkAMmThIXNoAKCiIoABZWxyAKcttC24LWKiKCKuLQAAAACyLWEAcgAAoLsicQAAoFoi7CFpcACg7iIAAWJ0vC1eD2EA8gBfD3IAAOA12DPddAByAOkAlS1zAHUAAAFicM0t0C0A4IIi0iAA4IMi0iBwAGYAAOA12GfdcgBvAPAAWQt0AHIA6QCaLQABY3XkLegtcgAA4DXYy9wAAWJw7C30LW4AAAFFZXUt8S0A4IoiAP5uAAABRWV/LfktAOCLIgD+6SJnemFnAKCaKYADY2Vmb3BycwANLhAuJS4pLiMuLi40LukhcmN1YQABZGkULiEuAAFiZxguHC5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg`),ca=/* #__PURE__ */ oa(`AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg`);var la;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.FLAG13=8192]=`FLAG13`,e[e.BRANCH_LENGTH=8064]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(la||={});var ua;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(ua||={});function da(e){return e>=ua.ZERO&&e<=ua.NINE}function fa(e){return e>=ua.UPPER_A&&e<=ua.UPPER_F||e>=ua.LOWER_A&&e<=ua.LOWER_F}function pa(e){return e>=ua.UPPER_A&&e<=ua.UPPER_Z||e>=ua.LOWER_A&&e<=ua.LOWER_Z||da(e)}function ma(e){return e===ua.EQUALS||pa(e)}var ha;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(ha||={});var ga;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(ga||={});var _a=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=ha.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=ga.Strict,this.runConsumed=0}startEntity(e){this.decodeMode=e,this.state=ha.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(e,t){switch(this.state){case ha.EntityStart:return e.charCodeAt(t)===ua.NUM?(this.state=ha.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=ha.NamedEntity,this.stateNamedEntity(e,t));case ha.NumericStart:return this.stateNumericStart(e,t);case ha.NumericDecimal:return this.stateNumericDecimal(e,t);case ha.NumericHex:return this.stateNumericHex(e,t);case ha.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|32)===ua.LOWER_X?(this.state=ha.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=ha.NumericDecimal,this.stateNumericDecimal(e,t))}stateNumericHex(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(da(n)||fa(n)){let e=n<=ua.NINE?n-ua.ZERO:(n|32)-ua.LOWER_A+10;this.result=this.result*16+e,this.consumed++,t++}else return this.emitNumericEntity(n,3)}return-1}stateNumericDecimal(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(da(n))this.result=this.result*10+(n-ua.ZERO),this.consumed++,t++;else return this.emitNumericEntity(n,2)}return-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===ua.SEMI)this.consumed+=1;else if(this.decodeMode===ga.Strict)return 0;return this.emitCodePoint(aa(this.result),this.consumed),this.errors&&(e!==ua.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&la.VALUE_LENGTH)>>14;for(;t<e.length;){if(i===0&&(r&la.FLAG13)!==0){let a=(r&la.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let n=r&la.JUMP_TABLE;if(e.charCodeAt(t)!==n)return this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}for(;this.runConsumed<a;){if(t>=e.length)return-1;let r=this.runConsumed-1,i=n[this.treeIndex+1+(r>>1)],a=r%2==0?i&255:i>>8&255;if(e.charCodeAt(t)!==a)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(a>>1),r=n[this.treeIndex],i=(r&la.VALUE_LENGTH)>>14}if(t>=e.length)break;let a=e.charCodeAt(t);if(a===ua.SEMI&&i!==0&&(r&la.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);if(this.treeIndex=va(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===ga.Attribute&&(i===0||ma(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&la.VALUE_LENGTH)>>14,i!==0){if(a===ua.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==ga.Strict&&(r&la.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}t++,this.excess++}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&la.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~(la.VALUE_LENGTH|la.FLAG13):r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case ha.NamedEntity:return this.result!==0&&(this.decodeMode!==ga.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ha.NumericDecimal:return this.emitNumericEntity(0,2);case ha.NumericHex:return this.emitNumericEntity(0,3);case ha.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ha.EntityStart:return 0}}};function va(e,t,n,r){let i=(t&la.BRANCH_LENGTH)>>7,a=t&la.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=i+1>>1,s=0,c=i-1;for(;s<=c;){let t=s+c>>>1,i=e[n+(t>>1)]>>(t&1)*8&255;if(i<r)s=t+1;else if(i>r)c=t-1;else return e[n+o+t]}return-1}var B;(function(e){e[e.Tab=9]=`Tab`,e[e.NewLine=10]=`NewLine`,e[e.FormFeed=12]=`FormFeed`,e[e.CarriageReturn=13]=`CarriageReturn`,e[e.Space=32]=`Space`,e[e.ExclamationMark=33]=`ExclamationMark`,e[e.Number=35]=`Number`,e[e.Amp=38]=`Amp`,e[e.SingleQuote=39]=`SingleQuote`,e[e.DoubleQuote=34]=`DoubleQuote`,e[e.Dash=45]=`Dash`,e[e.Slash=47]=`Slash`,e[e.Zero=48]=`Zero`,e[e.Nine=57]=`Nine`,e[e.Semi=59]=`Semi`,e[e.Lt=60]=`Lt`,e[e.Eq=61]=`Eq`,e[e.Gt=62]=`Gt`,e[e.Questionmark=63]=`Questionmark`,e[e.UpperA=65]=`UpperA`,e[e.LowerA=97]=`LowerA`,e[e.UpperF=70]=`UpperF`,e[e.LowerF=102]=`LowerF`,e[e.UpperZ=90]=`UpperZ`,e[e.LowerZ=122]=`LowerZ`,e[e.LowerX=120]=`LowerX`,e[e.OpeningSquareBracket=91]=`OpeningSquareBracket`})(B||={});var V;(function(e){e[e.Text=1]=`Text`,e[e.BeforeTagName=2]=`BeforeTagName`,e[e.InTagName=3]=`InTagName`,e[e.InSelfClosingTag=4]=`InSelfClosingTag`,e[e.BeforeClosingTagName=5]=`BeforeClosingTagName`,e[e.InClosingTagName=6]=`InClosingTagName`,e[e.AfterClosingTagName=7]=`AfterClosingTagName`,e[e.BeforeAttributeName=8]=`BeforeAttributeName`,e[e.InAttributeName=9]=`InAttributeName`,e[e.AfterAttributeName=10]=`AfterAttributeName`,e[e.BeforeAttributeValue=11]=`BeforeAttributeValue`,e[e.InAttributeValueDq=12]=`InAttributeValueDq`,e[e.InAttributeValueSq=13]=`InAttributeValueSq`,e[e.InAttributeValueNq=14]=`InAttributeValueNq`,e[e.BeforeDeclaration=15]=`BeforeDeclaration`,e[e.InDeclaration=16]=`InDeclaration`,e[e.InProcessingInstruction=17]=`InProcessingInstruction`,e[e.BeforeComment=18]=`BeforeComment`,e[e.CDATASequence=19]=`CDATASequence`,e[e.InSpecialComment=20]=`InSpecialComment`,e[e.InCommentLike=21]=`InCommentLike`,e[e.BeforeSpecialS=22]=`BeforeSpecialS`,e[e.BeforeSpecialT=23]=`BeforeSpecialT`,e[e.SpecialStartSequence=24]=`SpecialStartSequence`,e[e.InSpecialTag=25]=`InSpecialTag`,e[e.InEntity=26]=`InEntity`})(V||={});function ya(e){return e===B.Space||e===B.NewLine||e===B.Tab||e===B.FormFeed||e===B.CarriageReturn}function ba(e){return e===B.Slash||e===B.Gt||ya(e)}function xa(e){return e>=B.LowerA&&e<=B.LowerZ||e>=B.UpperA&&e<=B.UpperZ}var Sa;(function(e){e[e.NoValue=0]=`NoValue`,e[e.Unquoted=1]=`Unquoted`,e[e.Single=2]=`Single`,e[e.Double=3]=`Double`})(Sa||={});const Ca={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97]),XmpEnd:new Uint8Array([60,47,120,109,112])};var wa=class{constructor({xmlMode:e=!1,decodeEntities:t=!0},n){this.cbs=n,this.state=V.Text,this.buffer=``,this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=V.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=e,this.decodeEntities=t,this.entityDecoder=new _a(e?ca:sa,(e,t)=>this.emitCodePoint(e,t))}reset(){this.state=V.Text,this.buffer=``,this.sectionStart=0,this.index=0,this.baseState=V.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(e){this.offset+=this.buffer.length,this.buffer=e,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(e){e===B.Lt||!this.decodeEntities&&this.fastForwardTo(B.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=V.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===B.Amp&&this.startEntity()}stateSpecialStartSequence(e){let t=this.sequenceIndex===this.currentSequence.length;if(!(t?ba(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!t){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=V.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===B.Gt||ya(e)){let t=this.index-this.currentSequence.length;if(this.sectionStart<t){let e=this.index;this.index=t,this.cbs.ontext(this.sectionStart,t),this.index=e}this.isSpecial=!1,this.sectionStart=t+2,this.stateInClosingTagName(e);return}this.sequenceIndex=0}(e|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===Ca.TitleEnd?this.decodeEntities&&e===B.Amp&&this.startEntity():this.fastForwardTo(B.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=Number(e===B.Lt)}stateCDATASequence(e){e===Ca.Cdata[this.sequenceIndex]?++this.sequenceIndex===Ca.Cdata.length&&(this.state=V.InCommentLike,this.currentSequence=Ca.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=V.InDeclaration,this.stateInDeclaration(e))}fastForwardTo(e){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===e)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(e){e===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===Ca.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=V.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):e!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(e){return this.xmlMode?!ba(e):xa(e)}startSpecial(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=V.SpecialStartSequence}stateBeforeTagName(e){if(e===B.ExclamationMark)this.state=V.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===B.Questionmark)this.state=V.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){let t=e|32;this.sectionStart=this.index,this.state=this.xmlMode?V.InTagName:t===Ca.ScriptEnd[2]?V.BeforeSpecialS:t===Ca.TitleEnd[2]||t===Ca.XmpEnd[2]?V.BeforeSpecialT:V.InTagName}else e===B.Slash?this.state=V.BeforeClosingTagName:(this.state=V.Text,this.stateText(e))}stateInTagName(e){ba(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=V.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateBeforeClosingTagName(e){ya(e)||(e===B.Gt?this.state=V.Text:(this.state=this.isTagStartChar(e)?V.InClosingTagName:V.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(e){(e===B.Gt||ya(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=V.AfterClosingTagName,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){(e===B.Gt||this.fastForwardTo(B.Gt))&&(this.state=V.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(e){e===B.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=V.InSpecialTag,this.sequenceIndex=0):this.state=V.Text,this.sectionStart=this.index+1):e===B.Slash?this.state=V.InSelfClosingTag:ya(e)||(this.state=V.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(e){e===B.Gt?(this.cbs.onselfclosingtag(this.index),this.state=V.Text,this.sectionStart=this.index+1,this.isSpecial=!1):ya(e)||(this.state=V.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateInAttributeName(e){(e===B.Eq||ba(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=V.AfterAttributeName,this.stateAfterAttributeName(e))}stateAfterAttributeName(e){e===B.Eq?this.state=V.BeforeAttributeValue:e===B.Slash||e===B.Gt?(this.cbs.onattribend(Sa.NoValue,this.sectionStart),this.sectionStart=-1,this.state=V.BeforeAttributeName,this.stateBeforeAttributeName(e)):ya(e)||(this.cbs.onattribend(Sa.NoValue,this.sectionStart),this.state=V.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(e){e===B.DoubleQuote?(this.state=V.InAttributeValueDq,this.sectionStart=this.index+1):e===B.SingleQuote?(this.state=V.InAttributeValueSq,this.sectionStart=this.index+1):ya(e)||(this.sectionStart=this.index,this.state=V.InAttributeValueNq,this.stateInAttributeValueNoQuotes(e))}handleInAttributeValue(e,t){e===t||!this.decodeEntities&&this.fastForwardTo(t)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(t===B.DoubleQuote?Sa.Double:Sa.Single,this.index+1),this.state=V.BeforeAttributeName):this.decodeEntities&&e===B.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(e){this.handleInAttributeValue(e,B.DoubleQuote)}stateInAttributeValueSingleQuotes(e){this.handleInAttributeValue(e,B.SingleQuote)}stateInAttributeValueNoQuotes(e){ya(e)||e===B.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Sa.Unquoted,this.index),this.state=V.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===B.Amp&&this.startEntity()}stateBeforeDeclaration(e){e===B.OpeningSquareBracket?(this.state=V.CDATASequence,this.sequenceIndex=0):this.state=e===B.Dash?V.BeforeComment:V.InDeclaration}stateInDeclaration(e){(e===B.Gt||this.fastForwardTo(B.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=V.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(e===B.Gt||this.fastForwardTo(B.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=V.Text,this.sectionStart=this.index+1)}stateBeforeComment(e){e===B.Dash?(this.state=V.InCommentLike,this.currentSequence=Ca.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=V.InDeclaration}stateInSpecialComment(e){(e===B.Gt||this.fastForwardTo(B.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=V.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){let t=e|32;t===Ca.ScriptEnd[3]?this.startSpecial(Ca.ScriptEnd,4):t===Ca.StyleEnd[3]?this.startSpecial(Ca.StyleEnd,4):(this.state=V.InTagName,this.stateInTagName(e))}stateBeforeSpecialT(e){switch(e|32){case Ca.TitleEnd[3]:this.startSpecial(Ca.TitleEnd,4);break;case Ca.TextareaEnd[3]:this.startSpecial(Ca.TextareaEnd,4);break;case Ca.XmpEnd[3]:this.startSpecial(Ca.XmpEnd,4);break;default:this.state=V.InTagName,this.stateInTagName(e)}}startEntity(){this.baseState=this.state,this.state=V.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?ga.Strict:this.baseState===V.Text||this.baseState===V.InSpecialTag?ga.Legacy:ga.Attribute)}stateInEntity(){let e=this.index-this.offset,t=this.entityDecoder.write(this.buffer,e);if(t>=0)this.state=this.baseState,t===0&&--this.index;else{if(e<this.buffer.length&&this.buffer.charCodeAt(e)===B.Amp){this.state=this.baseState,--this.index;return}this.index=this.offset+this.buffer.length-1}}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===V.Text||this.state===V.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===V.InAttributeValueDq||this.state===V.InAttributeValueSq||this.state===V.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){let e=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case V.Text:this.stateText(e);break;case V.SpecialStartSequence:this.stateSpecialStartSequence(e);break;case V.InSpecialTag:this.stateInSpecialTag(e);break;case V.CDATASequence:this.stateCDATASequence(e);break;case V.InAttributeValueDq:this.stateInAttributeValueDoubleQuotes(e);break;case V.InAttributeName:this.stateInAttributeName(e);break;case V.InCommentLike:this.stateInCommentLike(e);break;case V.InSpecialComment:this.stateInSpecialComment(e);break;case V.BeforeAttributeName:this.stateBeforeAttributeName(e);break;case V.InTagName:this.stateInTagName(e);break;case V.InClosingTagName:this.stateInClosingTagName(e);break;case V.BeforeTagName:this.stateBeforeTagName(e);break;case V.AfterAttributeName:this.stateAfterAttributeName(e);break;case V.InAttributeValueSq:this.stateInAttributeValueSingleQuotes(e);break;case V.BeforeAttributeValue:this.stateBeforeAttributeValue(e);break;case V.BeforeClosingTagName:this.stateBeforeClosingTagName(e);break;case V.AfterClosingTagName:this.stateAfterClosingTagName(e);break;case V.BeforeSpecialS:this.stateBeforeSpecialS(e);break;case V.BeforeSpecialT:this.stateBeforeSpecialT(e);break;case V.InAttributeValueNq:this.stateInAttributeValueNoQuotes(e);break;case V.InSelfClosingTag:this.stateInSelfClosingTag(e);break;case V.InDeclaration:this.stateInDeclaration(e);break;case V.BeforeDeclaration:this.stateBeforeDeclaration(e);break;case V.BeforeComment:this.stateBeforeComment(e);break;case V.InProcessingInstruction:this.stateInProcessingInstruction(e);break;case V.InEntity:this.stateInEntity()}this.index++}this.cleanup()}finish(){this.state===V.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){let e=this.buffer.length+this.offset;this.sectionStart>=e||(this.state===V.InCommentLike?this.currentSequence===Ca.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===V.InTagName||this.state===V.BeforeAttributeName||this.state===V.BeforeAttributeValue||this.state===V.AfterAttributeName||this.state===V.InAttributeName||this.state===V.InAttributeValueSq||this.state===V.InAttributeValueDq||this.state===V.InAttributeValueNq||this.state===V.InClosingTagName||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,t){this.baseState!==V.Text&&this.baseState!==V.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.onattribentity(e)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.ontextentity(e,this.sectionStart))}};const Ta=/* @__PURE__ */ new Set([`input`,`option`,`optgroup`,`select`,`button`,`datalist`,`textarea`]),Ea=/* @__PURE__ */ new Set([`p`]),Da=/* @__PURE__ */ new Set([`thead`,`tbody`]),Oa=/* @__PURE__ */ new Set([`dd`,`dt`]),ka=/* @__PURE__ */ new Set([`rt`,`rp`]),Aa=/* @__PURE__ */ new Map([[`tr`,/* @__PURE__ */ new Set([`tr`,`th`,`td`])],[`th`,/* @__PURE__ */ new Set([`th`])],[`td`,/* @__PURE__ */ new Set([`thead`,`th`,`td`])],[`body`,/* @__PURE__ */ new Set([`head`,`link`,`script`])],[`li`,/* @__PURE__ */ new Set([`li`])],[`p`,Ea],[`h1`,Ea],[`h2`,Ea],[`h3`,Ea],[`h4`,Ea],[`h5`,Ea],[`h6`,Ea],[`select`,Ta],[`input`,Ta],[`output`,Ta],[`button`,Ta],[`datalist`,Ta],[`textarea`,Ta],[`option`,/* @__PURE__ */ new Set([`option`])],[`optgroup`,/* @__PURE__ */ new Set([`optgroup`,`option`])],[`dd`,Oa],[`dt`,Oa],[`address`,Ea],[`article`,Ea],[`aside`,Ea],[`blockquote`,Ea],[`details`,Ea],[`div`,Ea],[`dl`,Ea],[`fieldset`,Ea],[`figcaption`,Ea],[`figure`,Ea],[`footer`,Ea],[`form`,Ea],[`header`,Ea],[`hr`,Ea],[`main`,Ea],[`nav`,Ea],[`ol`,Ea],[`pre`,Ea],[`section`,Ea],[`table`,Ea],[`ul`,Ea],[`rt`,ka],[`rp`,ka],[`tbody`,Da],[`tfoot`,Da]]),ja=/* @__PURE__ */ new Set([`area`,`base`,`basefont`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`img`,`input`,`isindex`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),Ma=/* @__PURE__ */ new Set([`math`,`svg`]),Na=/* @__PURE__ */ new Set([`mi`,`mo`,`mn`,`ms`,`mtext`,`annotation-xml`,`foreignobject`,`desc`,`title`]),Pa=/\s|\//;var Fa=class{constructor(e,t={}){var n,r;this.options=t,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname=``,this.attribname=``,this.attribvalue=``,this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=e??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=t.lowerCaseTags??this.htmlMode,this.lowerCaseAttributeNames=t.lowerCaseAttributeNames??this.htmlMode,this.recognizeSelfClosing=t.recognizeSelfClosing??!this.htmlMode,this.tokenizer=new(t.Tokenizer??wa)(this.options,this),this.foreignContext=[!this.htmlMode],(r=(n=this.cbs).onparserinit)==null||r.call(n,this)}ontext(e,t){var n,r;let i=this.getSlice(e,t);this.endIndex=t-1,(r=(n=this.cbs).ontext)==null||r.call(n,i),this.startIndex=t}ontextentity(e,t){var n,r;this.endIndex=t-1,(r=(n=this.cbs).ontext)==null||r.call(n,ia(e)),this.startIndex=t}isVoidElement(e){return this.htmlMode&&ja.has(e)}onopentagname(e,t){this.endIndex=t;let n=this.getSlice(e,t);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)}emitOpenTag(e){var t,n,r,i;this.openTagStart=this.startIndex,this.tagname=e;let a=this.htmlMode&&Aa.get(e);if(a)for(;this.stack.length>0&&a.has(this.stack[0]);){let e=this.stack.shift();(n=(t=this.cbs).onclosetag)==null||n.call(t,e,!0)}this.isVoidElement(e)||(this.stack.unshift(e),this.htmlMode&&(Ma.has(e)?this.foreignContext.unshift(!0):Na.has(e)&&this.foreignContext.unshift(!1))),(i=(r=this.cbs).onopentagname)==null||i.call(r,e),this.cbs.onopentag&&(this.attribs={})}endOpenTag(e){var t,n;this.startIndex=this.openTagStart,this.attribs&&=((n=(t=this.cbs).onopentag)==null||n.call(t,this.tagname,this.attribs,e),null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=``}onopentagend(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1}onclosetag(e,t){var n,r,i,a,o,s,c,l;this.endIndex=t;let u=this.getSlice(e,t);if(this.lowerCaseTagNames&&(u=u.toLowerCase()),this.htmlMode&&(Ma.has(u)||Na.has(u))&&this.foreignContext.shift(),this.isVoidElement(u))this.htmlMode&&u===`br`&&((a=(i=this.cbs).onopentagname)==null||a.call(i,`br`),(s=(o=this.cbs).onopentag)==null||s.call(o,`br`,{},!0),(l=(c=this.cbs).onclosetag)==null||l.call(c,`br`,!1));else{let e=this.stack.indexOf(u);if(e!==-1)for(let t=0;t<=e;t++){let i=this.stack.shift();(r=(n=this.cbs).onclosetag)==null||r.call(n,i,t!==e)}else this.htmlMode&&u===`p`&&(this.emitOpenTag(`p`),this.closeCurrentTag(!0))}this.startIndex=t+1}onselfclosingtag(e){this.endIndex=e,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)}closeCurrentTag(e){var t,n;let r=this.tagname;this.endOpenTag(e),this.stack[0]===r&&((n=(t=this.cbs).onclosetag)==null||n.call(t,r,!e),this.stack.shift())}onattribname(e,t){this.startIndex=e;let n=this.getSlice(e,t);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n}onattribdata(e,t){this.attribvalue+=this.getSlice(e,t)}onattribentity(e){this.attribvalue+=ia(e)}onattribend(e,t){var n,r;this.endIndex=t,(r=(n=this.cbs).onattribute)==null||r.call(n,this.attribname,this.attribvalue,e===Sa.Double?`"`:e===Sa.Single?`'`:e===Sa.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=``}getInstructionName(e){let t=e.search(Pa),n=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n}ondeclaration(e,t){this.endIndex=t;let n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){let e=this.getInstructionName(n);this.cbs.onprocessinginstruction(`!${e}`,`!${n}`)}this.startIndex=t+1}onprocessinginstruction(e,t){this.endIndex=t;let n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){let e=this.getInstructionName(n);this.cbs.onprocessinginstruction(`?${e}`,`?${n}`)}this.startIndex=t+1}oncomment(e,t,n){var r,i,a,o;this.endIndex=t,(i=(r=this.cbs).oncomment)==null||i.call(r,this.getSlice(e,t-n)),(o=(a=this.cbs).oncommentend)==null||o.call(a),this.startIndex=t+1}oncdata(e,t,n){var r,i,a,o,s,c,l,u,d,f;this.endIndex=t;let p=this.getSlice(e,t-n);!this.htmlMode||this.options.recognizeCDATA?((i=(r=this.cbs).oncdatastart)==null||i.call(r),(o=(a=this.cbs).ontext)==null||o.call(a,p),(c=(s=this.cbs).oncdataend)==null||c.call(s)):((u=(l=this.cbs).oncomment)==null||u.call(l,`[CDATA[${p}]]`),(f=(d=this.cbs).oncommentend)==null||f.call(d)),this.startIndex=t+1}onend(){var e,t;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let e=0;e<this.stack.length;e++)this.cbs.onclosetag(this.stack[e],!0)}(t=(e=this.cbs).onend)==null||t.call(e)}reset(){var e,t,n,r;(t=(e=this.cbs).onreset)==null||t.call(e),this.tokenizer.reset(),this.tagname=``,this.attribname=``,this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(r=(n=this.cbs).onparserinit)==null||r.call(n,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(e){this.reset(),this.end(e)}getSlice(e,t){for(;e-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let n=this.buffers[0].slice(e-this.bufferOffset,t-this.bufferOffset);for(;t-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,t-this.bufferOffset);return n}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(e){var t,n;this.ended?(n=(t=this.cbs).onerror)==null||n.call(t,/* @__PURE__ */ Error(`.write() after done!`)):(this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++))}end(e){var t,n;this.ended?(n=(t=this.cbs).onerror)==null||n.call(t,/* @__PURE__ */ Error(`.end() after done!`)):(e&&this.write(e),this.ended=!0,this.tokenizer.end())}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(e){this.write(e)}done(e){this.end(e)}},Ia=/* @__PURE__ */ s({CDATA:()=>Ka,Comment:()=>Ha,Directive:()=>Va,Doctype:()=>qa,ElementType:()=>La,Root:()=>za,Script:()=>Ua,Style:()=>Wa,Tag:()=>Ga,Text:()=>Ba,isTag:()=>Ra}),La;(function(e){e.Root=`root`,e.Text=`text`,e.Directive=`directive`,e.Comment=`comment`,e.Script=`script`,e.Style=`style`,e.Tag=`tag`,e.CDATA=`cdata`,e.Doctype=`doctype`})(La||={});function Ra(e){return e.type===La.Tag||e.type===La.Script||e.type===La.Style}const za=La.Root,Ba=La.Text,Va=La.Directive,Ha=La.Comment,Ua=La.Script,Wa=La.Style,Ga=La.Tag,Ka=La.CDATA,qa=La.Doctype;var Ja=class{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return uo(this,e)}},Ya=class extends Ja{constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},Xa=class extends Ya{constructor(){super(...arguments),this.type=La.Text}get nodeType(){return 3}},Za=class extends Ya{constructor(){super(...arguments),this.type=La.Comment}get nodeType(){return 8}},Qa=class extends Ya{constructor(e,t){super(t),this.name=e,this.type=La.Directive}get nodeType(){return 1}},$a=class extends Ja{constructor(e){super(),this.children=e}get firstChild(){return this.children[0]??null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}},eo=class extends $a{constructor(){super(...arguments),this.type=La.CDATA}get nodeType(){return 4}},to=class extends $a{constructor(){super(...arguments),this.type=La.Root}get nodeType(){return 9}},no=class extends $a{constructor(e,t,n=[],r=e===`script`?La.Script:e===`style`?La.Style:La.Tag){super(n),this.name=e,this.attribs=t,this.type=r}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>({name:e,value:this.attribs[e],namespace:this[`x-attribsNamespace`]?.[e],prefix:this[`x-attribsPrefix`]?.[e]}))}};function ro(e){return Ra(e)}function io(e){return e.type===La.CDATA}function ao(e){return e.type===La.Text}function oo(e){return e.type===La.Comment}function so(e){return e.type===La.Directive}function co(e){return e.type===La.Root}function lo(e){return Object.prototype.hasOwnProperty.call(e,`children`)}function uo(e,t=!1){let n;if(ao(e))n=new Xa(e.data);else if(oo(e))n=new Za(e.data);else if(ro(e)){let r=t?fo(e.children):[],i=new no(e.name,{...e.attribs},r);r.forEach(e=>e.parent=i),e.namespace!=null&&(i.namespace=e.namespace),e[`x-attribsNamespace`]&&(i[`x-attribsNamespace`]={...e[`x-attribsNamespace`]}),e[`x-attribsPrefix`]&&(i[`x-attribsPrefix`]={...e[`x-attribsPrefix`]}),n=i}else if(io(e)){let r=t?fo(e.children):[],i=new eo(r);r.forEach(e=>e.parent=i),n=i}else if(co(e)){let r=t?fo(e.children):[],i=new to(r);r.forEach(e=>e.parent=i),e[`x-mode`]&&(i[`x-mode`]=e[`x-mode`]),n=i}else if(so(e)){let t=new Qa(e.name,e.data);e[`x-name`]!=null&&(t[`x-name`]=e[`x-name`],t[`x-publicId`]=e[`x-publicId`],t[`x-systemId`]=e[`x-systemId`]),n=t}else throw Error(`Not implemented yet: ${e.type}`);return n.startIndex=e.startIndex,n.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function fo(e){let t=e.map(e=>uo(e,!0));for(let e=1;e<t.length;e++)t[e].prev=t[e-1],t[e-1].next=t[e];return t}const po={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};var mo=class{constructor(e,t,n){this.dom=[],this.root=new to(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof t==`function`&&(n=t,t=po),typeof e==`object`&&(t=e,e=void 0),this.callback=e??null,this.options=t??po,this.elementCB=n??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new to(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;let e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,t){let n=new no(e,t,void 0,this.options.xmlMode?La.Tag:void 0);this.addNode(n),this.tagStack.push(n)}ontext(e){let{lastNode:t}=this;if(t&&t.type===La.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{let t=new Xa(e);this.addNode(t),this.lastNode=t}}oncomment(e){if(this.lastNode&&this.lastNode.type===La.Comment){this.lastNode.data+=e;return}let t=new Za(e);this.addNode(t),this.lastNode=t}oncommentend(){this.lastNode=null}oncdatastart(){let e=new Xa(``),t=new eo([e]);this.addNode(t),e.parent=t,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,t){let n=new Qa(e,t);this.addNode(n)}handleCallback(e){if(typeof this.callback==`function`)this.callback(e,this.dom);else if(e)throw e}addNode(e){let t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null}};const ho=/["&'<>$\x80-\uFFFF]/g,go=/* @__PURE__ */ new Map([[34,`"`],[38,`&`],[39,`'`],[60,`<`],[62,`>`]]),_o=String.prototype.codePointAt==null?(e,t)=>(e.charCodeAt(t)&64512)==55296?(e.charCodeAt(t)-55296)*1024+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t):(e,t)=>e.codePointAt(t);function vo(e){let t=``,n=0,r;for(;(r=ho.exec(e))!==null;){let i=r.index,a=e.charCodeAt(i),o=go.get(a);o===void 0?(t+=`${e.substring(n,i)}&#x${_o(e,i).toString(16)};`,n=ho.lastIndex+=Number((a&64512)==55296)):(t+=e.substring(n,i)+o,n=i+1)}return t+e.substr(n)}function yo(e,t){return function(n){let r,i=0,a=``;for(;r=e.exec(n);)i!==r.index&&(a+=n.substring(i,r.index)),a+=t.get(r[0].charCodeAt(0)),i=r.index+1;return a+n.substring(i)}}const bo=yo(/["&\u00A0]/g,/* @__PURE__ */ new Map([[34,`"`],[38,`&`],[160,` `]])),xo=yo(/[&<>\u00A0]/g,/* @__PURE__ */ new Map([[38,`&`],[60,`<`],[62,`>`],[160,` `]])),So=new Map((/* @__PURE__ */ `altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`)).map(e=>[e.toLowerCase(),e])),Co=new Map((/* @__PURE__ */ `definitionURL.attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`)).map(e=>[e.toLowerCase(),e])),wo=/* @__PURE__ */ new Set([`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`]);function To(e){return e.replace(/"/g,`"`)}function Eo(e,t){if(!e)return;let n=(t.encodeEntities??t.decodeEntities)===!1?To:t.xmlMode||t.encodeEntities!==`utf8`?vo:bo;return Object.keys(e).map(r=>{let i=e[r]??``;return t.xmlMode===`foreign`&&(r=Co.get(r)??r),!t.emptyAttrs&&!t.xmlMode&&i===``?r:`${r}="${n(i)}"`}).join(` `)}const Do=/* @__PURE__ */ new Set([`area`,`base`,`basefont`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`img`,`input`,`isindex`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Oo(e,t={}){let n=`length`in e?e:[e],r=``;for(let e=0;e<n.length;e++)r+=ko(n[e],t);return r}function ko(e,t){switch(e.type){case za:return Oo(e.children,t);case qa:case Va:return No(e);case Ha:return Io(e);case Ka:return Fo(e);case Ua:case Wa:case Ga:return Mo(e,t);case Ba:return Po(e,t)}}const Ao=/* @__PURE__ */ new Set([`mi`,`mo`,`mn`,`ms`,`mtext`,`annotation-xml`,`foreignObject`,`desc`,`title`]),jo=/* @__PURE__ */ new Set([`svg`,`math`]);function Mo(e,t){t.xmlMode===`foreign`&&(e.name=So.get(e.name)??e.name,e.parent&&Ao.has(e.parent.name)&&(t={...t,xmlMode:!1})),!t.xmlMode&&jo.has(e.name)&&(t={...t,xmlMode:`foreign`});let n=`<${e.name}`,r=Eo(e.attribs,t);return r&&(n+=` ${r}`),e.children.length===0&&(t.xmlMode?t.selfClosingTags!==!1:t.selfClosingTags&&Do.has(e.name))?(t.xmlMode||(n+=` `),n+=`/>`):(n+=`>`,e.children.length>0&&(n+=Oo(e.children,t)),(t.xmlMode||!Do.has(e.name))&&(n+=`</${e.name}>`)),n}function No(e){return`<${e.data}>`}function Po(e,t){let n=e.data||``;return(t.encodeEntities??t.decodeEntities)!==!1&&!(!t.xmlMode&&e.parent&&wo.has(e.parent.name))&&(n=t.xmlMode||t.encodeEntities!==`utf8`?vo(n):xo(n)),n}function Fo(e){return`<![CDATA[${e.children[0].data}]]>`}function Io(e){return`<!--${e.data}-->`}function Lo(e,t){return Oo(e,t)}function Ro(e,t){return lo(e)?e.children.map(e=>Lo(e,t)).join(``):``}function zo(e){return Array.isArray(e)?e.map(zo).join(``):ro(e)?e.name===`br`?`
|
|
92
|
+
`:zo(e.children):io(e)?zo(e.children):ao(e)?e.data:``}function Bo(e){return Array.isArray(e)?e.map(Bo).join(``):lo(e)&&!oo(e)?Bo(e.children):ao(e)?e.data:``}function Vo(e){return Array.isArray(e)?e.map(Vo).join(``):lo(e)&&(e.type===La.Tag||io(e))?Vo(e.children):ao(e)?e.data:``}function Ho(e){return lo(e)?e.children:[]}function Uo(e){return e.parent||null}function Wo(e){let t=Uo(e);if(t!=null)return Ho(t);let n=[e],{prev:r,next:i}=e;for(;r!=null;)n.unshift(r),{prev:r}=r;for(;i!=null;)n.push(i),{next:i}=i;return n}function Go(e,t){return e.attribs?.[t]}function Ko(e,t){return e.attribs!=null&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&e.attribs[t]!=null}function qo(e){return e.name}function Jo(e){let{next:t}=e;for(;t!==null&&!ro(t);)({next:t}=t);return t}function Yo(e){let{prev:t}=e;for(;t!==null&&!ro(t);)({prev:t}=t);return t}function Xo(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){let t=e.parent.children,n=t.lastIndexOf(e);n>=0&&t.splice(n,1)}e.next=null,e.prev=null,e.parent=null}function Zo(e,t){let n=t.prev=e.prev;n&&(n.next=t);let r=t.next=e.next;r&&(r.prev=t);let i=t.parent=e.parent;if(i){let n=i.children;n[n.lastIndexOf(e)]=t,e.parent=null}}function Qo(e,t){if(Xo(t),t.next=null,t.parent=e,e.children.push(t)>1){let n=e.children[e.children.length-2];n.next=t,t.prev=n}else t.prev=null}function $o(e,t){Xo(t);let{parent:n}=e,r=e.next;if(t.next=r,t.prev=e,e.next=t,t.parent=n,r){if(r.prev=t,n){let e=n.children;e.splice(e.lastIndexOf(r),0,t)}}else n&&n.children.push(t)}function es(e,t){if(Xo(t),t.parent=e,t.prev=null,e.children.unshift(t)!==1){let n=e.children[1];n.prev=t,t.next=n}else t.next=null}function ts(e,t){Xo(t);let{parent:n}=e;if(n){let r=n.children;r.splice(r.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=n,t.prev=e.prev,t.next=e,e.prev=t}function ns(e,t,n=!0,r=1/0){return rs(e,Array.isArray(t)?t:[t],n,r)}function rs(e,t,n,r){let i=[],a=[Array.isArray(t)?t:[t]],o=[0];for(;;){if(o[0]>=a[0].length){if(o.length===1)return i;a.shift(),o.shift();continue}let t=a[0][o[0]++];if(e(t)&&(i.push(t),--r<=0))return i;n&&lo(t)&&t.children.length>0&&(o.unshift(0),a.unshift(t.children))}}function is(e,t){return t.find(e)}function as(e,t,n=!0){let r=Array.isArray(t)?t:[t];for(let t=0;t<r.length;t++){let i=r[t];if(ro(i)&&e(i))return i;if(n&&lo(i)&&i.children.length>0){let t=as(e,i.children,!0);if(t)return t}}return null}function os(e,t){return(Array.isArray(t)?t:[t]).some(t=>ro(t)&&e(t)||lo(t)&&os(e,t.children))}function ss(e,t){let n=[],r=[Array.isArray(t)?t:[t]],i=[0];for(;;){if(i[0]>=r[0].length){if(r.length===1)return n;r.shift(),i.shift();continue}let t=r[0][i[0]++];ro(t)&&e(t)&&n.push(t),lo(t)&&t.children.length>0&&(i.unshift(0),r.unshift(t.children))}}const cs={tag_name(e){return typeof e==`function`?t=>ro(t)&&e(t.name):e===`*`?ro:t=>ro(t)&&t.name===e},tag_type(e){return typeof e==`function`?t=>e(t.type):t=>t.type===e},tag_contains(e){return typeof e==`function`?t=>ao(t)&&e(t.data):t=>ao(t)&&t.data===e}};function ls(e,t){return typeof t==`function`?n=>ro(n)&&t(n.attribs[e]):n=>ro(n)&&n.attribs[e]===t}function us(e,t){return n=>e(n)||t(n)}function ds(e){let t=Object.keys(e).map(t=>{let n=e[t];return Object.prototype.hasOwnProperty.call(cs,t)?cs[t](n):ls(t,n)});return t.length===0?null:t.reduce(us)}function fs(e,t){let n=ds(e);return!n||n(t)}function ps(e,t,n,r=1/0){let i=ds(e);return i?ns(i,t,n,r):[]}function ms(e,t,n=!0){return Array.isArray(t)||(t=[t]),as(ls(`id`,e),t,n)}function hs(e,t,n=!0,r=1/0){return ns(cs.tag_name(e),t,n,r)}function gs(e,t,n=!0,r=1/0){return ns(ls(`class`,e),t,n,r)}function _s(e,t,n=!0,r=1/0){return ns(cs.tag_type(e),t,n,r)}function vs(e){let t=e.length;for(;--t>=0;){let n=e[t];if(t>0&&e.lastIndexOf(n,t-1)>=0)e.splice(t,1);else for(let r=n.parent;r;r=r.parent)if(e.includes(r)){e.splice(t,1);break}}return e}var ys;(function(e){e[e.DISCONNECTED=1]=`DISCONNECTED`,e[e.PRECEDING=2]=`PRECEDING`,e[e.FOLLOWING=4]=`FOLLOWING`,e[e.CONTAINS=8]=`CONTAINS`,e[e.CONTAINED_BY=16]=`CONTAINED_BY`})(ys||={});function bs(e,t){let n=[],r=[];if(e===t)return 0;let i=lo(e)?e:e.parent;for(;i;)n.unshift(i),i=i.parent;for(i=lo(t)?t:t.parent;i;)r.unshift(i),i=i.parent;let a=Math.min(n.length,r.length),o=0;for(;o<a&&n[o]===r[o];)o++;if(o===0)return ys.DISCONNECTED;let s=n[o-1],c=s.children,l=n[o],u=r[o];return c.indexOf(l)>c.indexOf(u)?s===t?ys.FOLLOWING|ys.CONTAINED_BY:ys.FOLLOWING:s===e?ys.PRECEDING|ys.CONTAINS:ys.PRECEDING}function xs(e){return e=e.filter((e,t,n)=>!n.includes(e,t+1)),e.sort((e,t)=>{let n=bs(e,t);return n&ys.PRECEDING?-1:n&ys.FOLLOWING?1:0}),e}function Ss(e){let t=Os(js,e);return t?t.name===`feed`?Cs(t):ws(t):null}function Cs(e){let t=e.children,n={type:`atom`,items:hs(`entry`,t).map(e=>{let{children:t}=e,n={media:Ds(t)};As(n,`id`,`id`,t),As(n,`title`,`title`,t);let r=Os(`link`,t)?.attribs.href;r&&(n.link=r);let i=ks(`summary`,t)||ks(`content`,t);i&&(n.description=i);let a=ks(`updated`,t);return a&&(n.pubDate=new Date(a)),n})};As(n,`id`,`id`,t),As(n,`title`,`title`,t);let r=Os(`link`,t)?.attribs.href;r&&(n.link=r),As(n,`description`,`subtitle`,t);let i=ks(`updated`,t);return i&&(n.updated=new Date(i)),As(n,`author`,`email`,t,!0),n}function ws(e){let t=Os(`channel`,e.children)?.children??[],n={type:e.name.substr(0,3),id:``,items:hs(`item`,e.children).map(e=>{let{children:t}=e,n={media:Ds(t)};As(n,`id`,`guid`,t),As(n,`title`,`title`,t),As(n,`link`,`link`,t),As(n,`description`,`description`,t);let r=ks(`pubDate`,t)||ks(`dc:date`,t);return r&&(n.pubDate=new Date(r)),n})};As(n,`title`,`title`,t),As(n,`link`,`link`,t),As(n,`description`,`description`,t);let r=ks(`lastBuildDate`,t);return r&&(n.updated=new Date(r)),As(n,`author`,`managingEditor`,t,!0),n}const Ts=[`url`,`type`,`lang`],Es=[`fileSize`,`bitrate`,`framerate`,`samplingrate`,`channels`,`duration`,`height`,`width`];function Ds(e){return hs(`media:content`,e).map(e=>{let{attribs:t}=e,n={medium:t.medium,isDefault:!!t.isDefault};for(let e of Ts)t[e]&&(n[e]=t[e]);for(let e of Es)t[e]&&(n[e]=parseInt(t[e],10));return t.expression&&(n.expression=t.expression),n})}function Os(e,t){return hs(e,t,!0,1)[0]}function ks(e,t,n=!1){return Bo(hs(e,t,n,1)).trim()}function As(e,t,n,r,i=!1){let a=ks(n,r,i);a&&(e[t]=a)}function js(e){return e===`rss`||e===`feed`||e===`rdf:RDF`}var Ms=/* @__PURE__ */ s({DocumentPosition:()=>ys,append:()=>$o,appendChild:()=>Qo,compareDocumentPosition:()=>bs,existsOne:()=>os,filter:()=>ns,find:()=>rs,findAll:()=>ss,findOne:()=>as,findOneChild:()=>is,getAttributeValue:()=>Go,getChildren:()=>Ho,getElementById:()=>ms,getElements:()=>ps,getElementsByClassName:()=>gs,getElementsByTagName:()=>hs,getElementsByTagType:()=>_s,getFeed:()=>Ss,getInnerHTML:()=>Ro,getName:()=>qo,getOuterHTML:()=>Lo,getParent:()=>Uo,getSiblings:()=>Wo,getText:()=>zo,hasAttrib:()=>Ko,hasChildren:()=>lo,innerText:()=>Vo,isCDATA:()=>io,isComment:()=>oo,isDocument:()=>co,isTag:()=>ro,isText:()=>ao,nextElementSibling:()=>Jo,prepend:()=>ts,prependChild:()=>es,prevElementSibling:()=>Yo,removeElement:()=>Xo,removeSubsets:()=>vs,replaceElement:()=>Zo,testElement:()=>fs,textContent:()=>Bo,uniqueSort:()=>xs}),Ns=/* @__PURE__ */ s({DefaultHandler:()=>mo,DomHandler:()=>mo,DomUtils:()=>Ms,ElementType:()=>Ia,Parser:()=>Fa,QuoteType:()=>Sa,Tokenizer:()=>wa,createDocumentStream:()=>Is,createDomStream:()=>Ls,getFeed:()=>Ss,parseDOM:()=>Fs,parseDocument:()=>Ps,parseFeed:()=>zs});function Ps(e,t){let n=new mo(void 0,t);return new Fa(n,t).end(e),n.root}function Fs(e,t){return Ps(e,t).children}function Is(e,t,n){let r=new mo(t=>e(t,r.root),t,n);return new Fa(r,t)}function Ls(e,t,n){return new Fa(new mo(e,t,n),t)}const Rs={xmlMode:!0};function zs(e,t=Rs){return Ss(Fs(e,t))}const Bs=/* @__PURE__ */ new Set(/* @__PURE__ */ `ARTICLE.ASIDE.BLOCKQUOTE.BODY.BR.BUTTON.CANVAS.CAPTION.COL.COLGROUP.DD.DIV.DL.DT.EMBED.FIELDSET.FIGCAPTION.FIGURE.FOOTER.FORM.H1.H2.H3.H4.H5.H6.LI.UL.OL.P`.split(`.`)),Vs=`http://www.w3.org/2000/svg`,{assign:Hs,create:Us,defineProperties:Ws,entries:Gs,getOwnPropertyDescriptors:Ks,keys:qs,setPrototypeOf:Js}=Object,Ys=String,Xs=e=>e.nodeType===1?e[R]:e,Zs=({ownerDocument:e})=>e[qi].ignoreCase,Qs=(e,t)=>{e[z]=t,t[Xi]=e},$s=(e,t,n)=>{Qs(e,t),Qs(Xs(t),n)},ec=(e,t,n,r)=>{Qs(e,t),Qs(Xs(n),r)},tc=(e,t,n)=>{Qs(e,t),Qs(t,n)},nc=({localName:e,ownerDocument:t})=>t[qi].ignoreCase?e.toUpperCase():e,rc=(e,t)=>{e&&(e[z]=t),t&&(t[Xi]=e)},ic=(e,t)=>{let n=e.createDocumentFragment(),r=e.createElement(``);r.innerHTML=t;let{firstChild:i,lastChild:a}=r;if(i){ec(n,i,a,n[R]);let e=i;do e.parentNode=n;while(e!==a&&(e=Xs(e)[z]))}return n},ac=/* @__PURE__ */ new WeakMap;let oc=!1;const sc=/* @__PURE__ */ new WeakMap,cc=/* @__PURE__ */ new WeakMap,lc=(e,t,n,r)=>{oc&&cc.has(e)&&e.attributeChangedCallback&&e.constructor.observedAttributes.includes(t)&&e.attributeChangedCallback(t,n,r)},uc=(e,t)=>n=>{if(cc.has(n)){let r=cc.get(n);r.connected!==t&&n.isConnected===t&&(r.connected=t,e in n&&n[e]())}},dc=uc(`connectedCallback`,!0),fc=e=>{if(oc){dc(e),ac.has(e)&&(e=ac.get(e).shadowRoot);let{[z]:t,[R]:n}=e;for(;t!==n;)t.nodeType===1&&dc(t),t=t[z]}},pc=uc(`disconnectedCallback`,!1),mc=e=>{if(oc){pc(e),ac.has(e)&&(e=ac.get(e).shadowRoot);let{[z]:t,[R]:n}=e;for(;t!==n;)t.nodeType===1&&pc(t),t=t[z]}};var hc=class{constructor(e){this.ownerDocument=e,this.registry=/* @__PURE__ */ new Map,this.waiting=/* @__PURE__ */ new Map,this.active=!1}define(e,t,n={}){let{ownerDocument:r,registry:i,waiting:a}=this;if(i.has(e))throw Error(`unable to redefine `+e);if(sc.has(t))throw Error(`unable to redefine the same class: `+t);this.active=oc=!0;let{extends:o}=n;sc.set(t,{ownerDocument:r,options:{is:o?e:``},localName:o||e});let s=o?t=>t.localName===o&&t.getAttribute(`is`)===e:t=>t.localName===e;if(i.set(e,{Class:t,check:s}),a.has(e)){for(let n of a.get(e))n(t);a.delete(e)}r.querySelectorAll(o?`${o}[is="${e}"]`:e).forEach(this.upgrade,this)}upgrade(e){if(cc.has(e))return;let{ownerDocument:t,registry:n}=this,r=e.getAttribute(`is`)||e.localName;if(n.has(r)){let{Class:i,check:a}=n.get(r);if(a(e)){let{attributes:n,isConnected:a}=e;for(let t of n)e.removeAttributeNode(t);let o=Gs(e);for(let[t]of o)delete e[t];Js(e,i.prototype),t[ta]={element:e,values:o},new i(t,r),cc.set(e,{connected:a});for(let t of n)e.setAttributeNode(t);a&&e.connectedCallback&&e.connectedCallback()}}}whenDefined(e){let{registry:t,waiting:n}=this;return new Promise(r=>{t.has(e)?r(t.get(e).Class):(n.has(e)||n.set(e,[]),n.get(e).push(r))})}get(e){let t=this.registry.get(e);return t&&t.Class}getName(e){if(sc.has(e)){let{localName:t}=sc.get(e);return t}return null}};const{Parser:gc}=Ns,_c=(e,t,n)=>{let r=e[R];return t.parentNode=e,$s(r[Xi],t,r),n&&t.nodeType===1&&fc(t),t},vc=(e,t,n,r,i)=>{n[na]=r,n.ownerElement=e,tc(t[Xi],n,t),n.name===`class`&&(e.className=r),i&&lc(e,n.name,null,r)},yc=(e,t,n)=>{let{active:r,registry:i}=e[zi],a=e,o=null,s=!1,c=new gc({onprocessinginstruction(t,n){t.toLowerCase()===`!doctype`&&(e.doctype=n.slice(t.length).trim())},onopentag(n,s){let c=!0;if(t){if(o)a=_c(a,e.createElementNS(Vs,n),r),a.ownerSVGElement=o,c=!1;else if(n===`svg`||n===`SVG`)o=e.createElementNS(Vs,n),a=_c(a,o,r),c=!1;else if(r){let e=n.includes(`-`)?n:s.is||``;if(e&&i.has(e)){let{Class:t}=i.get(e);a=_c(a,new t,r),delete s.is,c=!1}}}c&&(a=_c(a,e.createElement(n),!1));let l=a[R];for(let t of qs(s))vc(a,l,e.createAttribute(t),s[t],r)},oncomment(t){_c(a,e.createComment(t),r)},ontext(t){s?_c(a,e.createCDATASection(t),r):_c(a,e.createTextNode(t),r)},oncdatastart(){s=!0},oncdataend(){s=!1},onclosetag(){t&&a===o&&(o=null),a=a.parentNode}},{lowerCaseAttributeNames:!1,decodeEntities:!0,xmlMode:!t});return c.write(n),c.end(),e},bc=/* @__PURE__ */ new Map,xc=(e,t)=>{for(let n of[].concat(e))bc.set(n,t),bc.set(n.toUpperCase(),t)},Sc=({[z]:e,[R]:t},n)=>{for(;e!==t;){switch(e.nodeType){case 2:Cc(e,n);break;case 3:case 8:case 4:wc(e,n);break;case 1:Dc(e,n),e=Xs(e);break;case 10:Ec(e,n)}e=e[z]}let r=n.length-1,i=n[r];typeof i==`number`&&i<0?n[r]+=-1:n.push(-1)},Cc=(e,t)=>{t.push(2,e.name);let n=e[na].trim();n&&t.push(n)},wc=(e,t)=>{let n=e[na];n.trim()&&t.push(e.nodeType,n)},Tc=(e,t)=>{t.push(e.nodeType),Sc(e,t)},Ec=({name:e,publicId:t,systemId:n},r)=>{r.push(10,e),t&&r.push(t),n&&r.push(n)},Dc=(e,t)=>{t.push(1,e.localName),Sc(e,t)},Oc=(e,t,n,r,i,a,o)=>({type:e,target:t,addedNodes:r,removedNodes:i,attributeName:a,oldValue:o,previousSibling:n?.previousSibling||null,nextSibling:n?.nextSibling||null}),kc=(e,t,n,r,i,a)=>{if(!r||r.includes(n)){let{callback:r,records:o,scheduled:s}=e;o.push(Oc(`attributes`,t,null,[],[],n,i?a:void 0)),s||(e.scheduled=!0,Promise.resolve().then(()=>{e.scheduled=!1,r(o.splice(0),e)}))}},Ac=(e,t,n)=>{let{ownerDocument:r}=e,{active:i,observers:a}=r[Ji];if(i){for(let i of a)for(let[a,{childList:o,subtree:s,attributes:c,attributeFilter:l,attributeOldValue:u}]of i.nodes)if(o){if(s&&(a===r||a.contains(e))||!s&&a.children.includes(e)){kc(i,e,t,l,u,n);break}}else if(c&&a===e){kc(i,e,t,l,u,n);break}}},jc=(e,t)=>{let{ownerDocument:n}=e,{active:r,observers:i}=n[Ji];if(r){for(let r of i)for(let[i,{subtree:a,childList:o,characterData:s}]of r.nodes)if(o&&(t&&(i===t||a&&i.contains(t))||!t&&(a&&(i===n||/* c8 ignore next */i.contains(e))||!a&&i[s?`childNodes`:`children`].includes(e)))){let{callback:n,records:a,scheduled:o}=r;a.push(Oc(`childList`,i,e,t?[]:[e],t?[e]:[])),o||(r.scheduled=!0,Promise.resolve().then(()=>{r.scheduled=!1,n(a.splice(0),r)}));break}}};var Mc=class{constructor(e){let t=/* @__PURE__ */ new Set;this.observers=t,this.active=!1,this.class=class{constructor(e){this.callback=e,this.nodes=/* @__PURE__ */ new Map,this.records=[],this.scheduled=!1}disconnect(){this.records.splice(0),this.nodes.clear(),t.delete(this),e[Ji].active=!!t.size}observe(n,r={subtree:!1,childList:!1,attributes:!1,attributeFilter:null,attributeOldValue:!1,characterData:!1}){(`attributeOldValue`in r||`attributeFilter`in r)&&(r.attributes=!0),r.childList=!!r.childList,r.subtree=!!r.subtree,this.nodes.set(n,r),t.add(this),e[Ji].active=!0}takeRecords(){return this.records.splice(0)}}}};const Nc=/* @__PURE__ */ new Set(/* @__PURE__ */ `allowfullscreen.allowpaymentrequest.async.autofocus.autoplay.checked.class.contenteditable.controls.default.defer.disabled.draggable.formnovalidate.hidden.id.ismap.itemscope.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.selected.style.truespeed`.split(`.`)),Pc=(e,t)=>{let{[na]:n,name:r}=t;t.ownerElement=e,tc(e,t,e[z]),r===`class`&&(e.className=n),Ac(e,r,null),lc(e,r,null,n)},Fc=(e,t)=>{let{[na]:n,name:r}=t;Qs(t[Xi],t[z]),t.ownerElement=t[Xi]=t[z]=null,r===`class`&&(e[Ri]=null),Ac(e,r,n),lc(e,r,n,null)},Ic={get(e,t){return e.hasAttribute(t)},set(e,t,n){n?e.setAttribute(t,``):e.removeAttribute(t)}},Lc={get(e,t){return parseFloat(e.getAttribute(t)||0)},set(e,t,n){e.setAttribute(t,n)}},H={get(e,t){return e.getAttribute(t)||``},set(e,t,n){e.setAttribute(t,n)}},Rc=/* @__PURE__ */ new WeakMap;function zc(e,t){return typeof t==`function`?t.call(e.target,e):t.handleEvent(e),e._stopImmediatePropagationFlag}function Bc({currentTarget:e,target:t}){let n=Rc.get(e);if(n&&n.has(this.type)){let r=n.get(this.type);this.eventPhase=e===t?this.AT_TARGET:this.BUBBLING_PHASE,this.currentTarget=e,this.target=t;for(let[e,t]of r)if(t&&t.once&&r.delete(e),zc(this,e))break;return delete this.currentTarget,delete this.target,this.cancelBubble}}var Vc=class{constructor(){Rc.set(this,/* @__PURE__ */ new Map)}_getParent(){return null}addEventListener(e,t,n){let r=Rc.get(this);r.has(e)||r.set(e,/* @__PURE__ */ new Map),r.get(e).set(t,n)}removeEventListener(e,t){let n=Rc.get(this);if(n.has(e)){let r=n.get(e);r.delete(t)&&!r.size&&n.delete(e)}}dispatchEvent(e){let t=this;for(e.eventPhase=e.CAPTURING_PHASE;t;)t.dispatchEvent&&e._path.push({currentTarget:t,target:this}),t=e.bubbles&&t._getParent&&t._getParent();return e._path.some(Bc,e),e._path=[],e.eventPhase=e.NONE,!e.defaultPrevented}},Hc=class extends Array{item(e){return e<this.length?this[e]:null}};const Uc=({parentNode:e})=>{let t=0;for(;e;)t++,e=e.parentNode;return t};var Wc=class extends Vc{static get ELEMENT_NODE(){return 1}static get ATTRIBUTE_NODE(){return 2}static get TEXT_NODE(){return 3}static get CDATA_SECTION_NODE(){return 4}static get COMMENT_NODE(){return 8}static get DOCUMENT_NODE(){return 9}static get DOCUMENT_FRAGMENT_NODE(){return 11}static get DOCUMENT_TYPE_NODE(){return 10}constructor(e,t,n){super(),this.ownerDocument=e,this.localName=t,this.nodeType=n,this.parentNode=null,this[z]=null,this[Xi]=null}get ELEMENT_NODE(){return 1}get ATTRIBUTE_NODE(){return 2}get TEXT_NODE(){return 3}get CDATA_SECTION_NODE(){return 4}get COMMENT_NODE(){return 8}get DOCUMENT_NODE(){return 9}get DOCUMENT_FRAGMENT_NODE(){return 11}get DOCUMENT_TYPE_NODE(){return 10}get baseURI(){let e=this.nodeType===9?this:this.ownerDocument;if(e){let t=e.querySelector(`base`);if(t)return t.getAttribute(`href`);let{location:n}=e.defaultView;if(n)return n.href}return null}
|
|
93
|
+
/* c8 ignore start */
|
|
94
|
+
get isConnected(){return!1}get nodeName(){return this.localName}get parentElement(){return null}get previousSibling(){return null}get previousElementSibling(){return null}get nextSibling(){return null}get nextElementSibling(){return null}get childNodes(){return new Hc}get firstChild(){return null}get lastChild(){return null}get nodeValue(){return null}set nodeValue(e){}get textContent(){return null}set textContent(e){}normalize(){}cloneNode(){return null}contains(){return!1}insertBefore(e,t){return e}appendChild(e){return e}replaceChild(e,t){return t}removeChild(e){return e}toString(){return``}
|
|
95
|
+
/* c8 ignore stop */
|
|
96
|
+
hasChildNodes(){return!!this.lastChild}isSameNode(e){return this===e}compareDocumentPosition(e){let t=0;if(this!==e){let n=Uc(this),r=Uc(e);if(n<r)t+=4,this.contains(e)&&(t+=16);else if(r<n)t+=2,e.contains(this)&&(t+=8);else if(n&&r){let{childNodes:n}=this.parentNode;n.indexOf(this)<n.indexOf(e)?t+=4:t+=2}n&&r||(t+=32,t+=1)}return t}isEqualNode(e){if(this===e)return!0;if(this.nodeType===e.nodeType){switch(this.nodeType){case 9:case 11:{let t=this.childNodes,n=e.childNodes;return t.length===n.length&&t.every((e,t)=>e.isEqualNode(n[t]))}}return this.toString()===e.toString()}return!1}_getParent(){return this.parentNode}getRootNode(){let e=this;for(;e.parentNode;)e=e.parentNode;return e}};const{replace:Gc}=``,Kc=/[<>&\xA0]/g,qc={"\xA0":` `,"&":`&`,"<":`<`,">":`>`},Jc=e=>qc[e],Yc=e=>Gc.call(e,Kc,Jc),Xc=/"/g;var Zc=class e extends Wc{constructor(e,t,n=``){super(e,t,2),this.ownerElement=null,this.name=Ys(t),this[na]=Ys(n),this[Li]=!1}get value(){return this[na]}set value(e){let{[na]:t,name:n,ownerElement:r}=this;this[na]=Ys(e),this[Li]=!0,r&&(Ac(r,n,t),lc(r,n,t,this[na]))}cloneNode(){let{ownerDocument:t,name:n,[na]:r}=this;return new e(t,n,r)}toString(){let{name:e,[na]:t}=this;return Nc.has(e)&&!t?Zs(this)?e:`${e}=""`:`${e}="${(Zs(this)?t:Yc(t)).replace(Xc,`"`)}"`}toJSON(){let e=[];return Cc(this,e),e}};const Qc=({ownerDocument:e,parentNode:t})=>{for(;t;){if(t===e)return!0;t=t.parentNode||t.host}return!1},$c=({parentNode:e})=>{if(e)switch(e.nodeType){case 9:case 11:return null}return e},el=({[Xi]:e})=>{switch(e?e.nodeType:0){case-1:return e[$i];case 3:case 8:case 4:return e}return null},tl=e=>{let t=Xs(e)[z];return t&&(t.nodeType===-1?null:t)},nl=e=>{let t=tl(e);for(;t&&t.nodeType!==1;)t=tl(t);return t},rl=e=>{let t=el(e);for(;t&&t.nodeType!==1;)t=el(t);return t},il=(e,t)=>{let n=e.createDocumentFragment();return n.append(...t),n},al=(e,t)=>{let{ownerDocument:n,parentNode:r}=e;r&&r.insertBefore(il(n,t),e)},ol=(e,t)=>{let{ownerDocument:n,parentNode:r}=e;r&&r.insertBefore(il(n,t),Xs(e)[z])},sl=(e,t)=>{let{ownerDocument:n,parentNode:r}=e;r&&(t.includes(e)&&sl(e,[e=e.cloneNode()]),r.insertBefore(il(n,t),e),e.remove())},cl=(e,t,n)=>{let{parentNode:r,nodeType:i}=t;(e||n)&&(rc(e,n),t[Xi]=null,Xs(t)[z]=null),r&&(t.parentNode=null,jc(t,r),i===1&&mc(t))};var ll=class extends Wc{constructor(e,t,n,r){super(e,t,n),this[na]=Ys(r)}get isConnected(){return Qc(this)}get parentElement(){return $c(this)}get previousSibling(){return el(this)}get nextSibling(){return tl(this)}get previousElementSibling(){return rl(this)}get nextElementSibling(){return nl(this)}before(...e){al(this,e)}after(...e){ol(this,e)}replaceWith(...e){sl(this,e)}remove(){cl(this[Xi],this,this[z])}
|
|
97
|
+
/* c8 ignore start */
|
|
98
|
+
get data(){return this[na]}set data(e){this[na]=Ys(e),jc(this,this.parentNode)}get nodeValue(){return this.data}set nodeValue(e){this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}get length(){return this.data.length}substringData(e,t){return this.data.substr(e,t)}appendData(e){this.data+=e}insertData(e,t){let{data:n}=this;this.data=n.slice(0,e)+t+n.slice(e)}deleteData(e,t){let{data:n}=this;this.data=n.slice(0,e)+n.slice(e+t)}replaceData(e,t,n){let{data:r}=this;this.data=r.slice(0,e)+n+r.slice(e+t)}
|
|
99
|
+
/* c8 ignore stop */
|
|
100
|
+
toJSON(){let e=[];return wc(this,e),e}},ul=class e extends ll{constructor(e,t=``){super(e,`#cdatasection`,4,t)}cloneNode(){let{ownerDocument:t,[na]:n}=this;return new e(t,n)}toString(){return`<![CDATA[${this[na]}]]>`}},dl=class e extends ll{constructor(e,t=``){super(e,`#comment`,8,t)}cloneNode(){let{ownerDocument:t,[na]:n}=this;return new e(t,n)}toString(){return`<!--${this[na]}-->`}};function fl(){return!0}function pl(){return!1}var U;(function(e){e.Attribute=`attribute`,e.Pseudo=`pseudo`,e.PseudoElement=`pseudo-element`,e.Tag=`tag`,e.Universal=`universal`,e.Adjacent=`adjacent`,e.Child=`child`,e.Descendant=`descendant`,e.Parent=`parent`,e.Sibling=`sibling`,e.ColumnCombinator=`column-combinator`})(U||={});var ml;(function(e){e.Any=`any`,e.Element=`element`,e.End=`end`,e.Equals=`equals`,e.Exists=`exists`,e.Hyphen=`hyphen`,e.Not=`not`,e.Start=`start`})(ml||={});const hl=/^[^#\\]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\u00B0-\uFFFF-])+/,gl=/\\([\da-f]{1,6}\s?|(\s)|.)/gi;var W;(function(e){e[e.LeftParenthesis=40]=`LeftParenthesis`,e[e.RightParenthesis=41]=`RightParenthesis`,e[e.LeftSquareBracket=91]=`LeftSquareBracket`,e[e.RightSquareBracket=93]=`RightSquareBracket`,e[e.Comma=44]=`Comma`,e[e.Period=46]=`Period`,e[e.Colon=58]=`Colon`,e[e.SingleQuote=39]=`SingleQuote`,e[e.DoubleQuote=34]=`DoubleQuote`,e[e.Plus=43]=`Plus`,e[e.Tilde=126]=`Tilde`,e[e.QuestionMark=63]=`QuestionMark`,e[e.ExclamationMark=33]=`ExclamationMark`,e[e.Slash=47]=`Slash`,e[e.Equal=61]=`Equal`,e[e.Dollar=36]=`Dollar`,e[e.Pipe=124]=`Pipe`,e[e.Circumflex=94]=`Circumflex`,e[e.Asterisk=42]=`Asterisk`,e[e.GreaterThan=62]=`GreaterThan`,e[e.LessThan=60]=`LessThan`,e[e.Hash=35]=`Hash`,e[e.LowerI=105]=`LowerI`,e[e.LowerS=115]=`LowerS`,e[e.BackSlash=92]=`BackSlash`,e[e.Space=32]=`Space`,e[e.Tab=9]=`Tab`,e[e.NewLine=10]=`NewLine`,e[e.FormFeed=12]=`FormFeed`,e[e.CarriageReturn=13]=`CarriageReturn`})(W||={});const _l=/* @__PURE__ */ new Map([[W.Tilde,ml.Element],[W.Circumflex,ml.Start],[W.Dollar,ml.End],[W.Asterisk,ml.Any],[W.ExclamationMark,ml.Not],[W.Pipe,ml.Hyphen]]),vl=/* @__PURE__ */ new Set([`has`,`not`,`matches`,`is`,`where`,`host`,`host-context`]),yl=/* @__PURE__ */ new Set([`before`,`after`,`first-line`,`first-letter`]);function bl(e){switch(e.type){case U.Adjacent:case U.Child:case U.Descendant:case U.Parent:case U.Sibling:case U.ColumnCombinator:return!0;case U.Attribute:case U.Pseudo:case U.PseudoElement:case U.Tag:case U.Universal:return!1}}const xl=/* @__PURE__ */ new Set([`contains`,`icontains`]);function Sl(e,t,n){let r=Number.parseInt(t,16)-65536;return Number.isNaN(r)||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)}function Cl(e){return e.replace(gl,Sl)}function wl(e){return e===W.SingleQuote||e===W.DoubleQuote}function Tl(e){return e===W.Space||e===W.Tab||e===W.NewLine||e===W.FormFeed||e===W.CarriageReturn}function El(e){let t=[],n=Dl(t,`${e}`,0);if(n<e.length)throw Error(`Unmatched selector: ${e.slice(n)}`);return t}function Dl(e,t,n){let r=[];function i(e){let r=t.slice(n+e).match(hl);if(!r)throw Error(`Expected name, found ${t.slice(n)}`);let[i]=r;return n+=e+i.length,Cl(i)}function a(e){for(n+=e;n<t.length&&Tl(t.charCodeAt(n));)n++}function o(){n+=1;let e=n;for(let r=1;n<t.length;n++)switch(t.charCodeAt(n)){case W.BackSlash:n+=1;break;case W.LeftParenthesis:r+=1;break;case W.RightParenthesis:if(--r,r===0)return Cl(t.slice(e,n++))}throw Error(`Parenthesis not matched`)}function s(){if(r.length>0&&bl(r[r.length-1]))throw Error(`Did not expect successive traversals.`)}function c(e){r.length>0&&r[r.length-1].type===U.Descendant?r[r.length-1].type=e:(s(),r.push({type:e}))}function l(e,t){r.push({type:U.Attribute,name:e,action:t,value:i(1),namespace:null,ignoreCase:`quirks`})}function u(){if(r.length>0&&r[r.length-1].type===U.Descendant&&r.pop(),r.length===0)throw Error(`Empty sub-selector`);e.push(r)}if(a(0),t.length===n)return n;loop:for(;n<t.length;){let e=t.charCodeAt(n);switch(e){case W.Space:case W.Tab:case W.NewLine:case W.FormFeed:case W.CarriageReturn:(r.length===0||r[0].type!==U.Descendant)&&(s(),r.push({type:U.Descendant})),a(1);break;case W.GreaterThan:c(U.Child),a(1);break;case W.LessThan:c(U.Parent),a(1);break;case W.Tilde:c(U.Sibling),a(1);break;case W.Plus:c(U.Adjacent),a(1);break;case W.Period:l(`class`,ml.Element);break;case W.Hash:l(`id`,ml.Equals);break;case W.LeftSquareBracket:{a(1);let e,o=null;t.charCodeAt(n)===W.Pipe?e=i(1):t.startsWith(`*|`,n)?(o=`*`,e=i(2)):(e=i(0),t.charCodeAt(n)===W.Pipe&&t.charCodeAt(n+1)!==W.Equal&&(o=e,e=i(1))),a(0);let s=ml.Exists,c=_l.get(t.charCodeAt(n));if(c){if(s=c,t.charCodeAt(n+1)!==W.Equal)throw Error("Expected `=`");a(2)}else t.charCodeAt(n)===W.Equal&&(s=ml.Equals,a(1));let l=``,u=null;if(s!==`exists`){if(wl(t.charCodeAt(n))){let e=t.charCodeAt(n);n+=1;let r=n;for(;n<t.length&&t.charCodeAt(n)!==e;)n+=t.charCodeAt(n)===W.BackSlash?2:1;if(t.charCodeAt(n)!==e)throw Error(`Attribute value didn't end`);l=Cl(t.slice(r,n)),n+=1}else{let e=n;for(;n<t.length&&!Tl(t.charCodeAt(n))&&t.charCodeAt(n)!==W.RightSquareBracket;)n+=t.charCodeAt(n)===W.BackSlash?2:1;l=Cl(t.slice(e,n))}switch(a(0),t.charCodeAt(n)|32){case W.LowerI:u=!0,a(1);break;case W.LowerS:u=!1,a(1)}}if(t.charCodeAt(n)!==W.RightSquareBracket)throw Error(`Attribute selector didn't terminate`);n+=1;let d={type:U.Attribute,name:e,action:s,value:l,namespace:o,ignoreCase:u};r.push(d);break}case W.Colon:{if(t.charCodeAt(n+1)===W.Colon){r.push({type:U.PseudoElement,name:i(2).toLowerCase(),data:t.charCodeAt(n)===W.LeftParenthesis?o():null});break}let e=i(1).toLowerCase();if(yl.has(e)){r.push({type:U.PseudoElement,name:e,data:null});break}let a=null;if(t.charCodeAt(n)===W.LeftParenthesis){if(vl.has(e)){if(wl(t.charCodeAt(n+1)))throw Error(`Pseudo-selector ${e} cannot be quoted`);if(a=[],n=Dl(a,t,n+1),t.charCodeAt(n)!==W.RightParenthesis)throw Error(`Missing closing parenthesis in :${e} (${t})`);n+=1}else{if(a=o(),xl.has(e)){let e=a.charCodeAt(0);e===a.charCodeAt(a.length-1)&&wl(e)&&(a=a.slice(1,-1))}a=Cl(a)}}r.push({type:U.Pseudo,name:e,data:a});break}case W.Comma:u(),r=[],a(1);break;default:{if(t.startsWith(`/*`,n)){let e=t.indexOf(`*/`,n+2);if(e===-1)throw Error(`Comment was not terminated`);n=e+2,r.length===0&&a(0);break}let o=null,s;if(e===W.Asterisk)n+=1,s=`*`;else if(e===W.Pipe){if(s=``,t.charCodeAt(n+1)===W.Pipe){c(U.ColumnCombinator),a(2);break}}else if(hl.test(t.slice(n)))s=i(0);else break loop;t.charCodeAt(n)===W.Pipe&&t.charCodeAt(n+1)!==W.Pipe&&(o=s,t.charCodeAt(n+1)===W.Asterisk?(s=`*`,n+=2):s=i(1)),r.push(s===`*`?{type:U.Universal,namespace:o}:{type:U.Tag,name:s,namespace:o})}}}return u(),n}var Ol;(function(e){e.Root=`root`,e.Text=`text`,e.Directive=`directive`,e.Comment=`comment`,e.Script=`script`,e.Style=`style`,e.Tag=`tag`,e.CDATA=`cdata`,e.Doctype=`doctype`})(Ol||={});function kl(e){return e.type===Ol.Tag||e.type===Ol.Script||e.type===Ol.Style}const Al=Ol.Root,jl=Ol.Text,Ml=Ol.Directive,Nl=Ol.Comment,Pl=Ol.Script,Fl=Ol.Style,Il=Ol.Tag,Ll=Ol.CDATA;Ol.Doctype;function Rl(e){return kl(e)}function zl(e){return e.type===Ol.CDATA}function Bl(e){return e.type===Ol.Text}function Vl(e){return e.type===Ol.Comment}function Hl(e){return Object.hasOwn(e,`children`)}function Ul(e,t,n=!0,r=1/0){return Wl(e,Array.isArray(t)?t:[t],n,r)}function Wl(e,t,n,r){let i=[],a=[Array.isArray(t)?t:[t]],o=[0];for(;;){if(o[0]>=a[0].length){if(o.length===1)return i;a.shift(),o.shift();continue}let t=a[0][o[0]++];if(e(t)&&(i.push(t),--r<=0))return i;n&&Hl(t)&&t.children.length>0&&(o.unshift(0),a.unshift(t.children))}}function Gl(e,t,n=!0){let r=Array.isArray(t)?t:[t];for(let t of r){if(Rl(t)&&e(t))return t;if(n&&Hl(t)&&t.children.length>0){let n=Gl(e,t.children,!0);if(n)return n}}return null}function Kl(e,t){return(Array.isArray(t)?t:[t]).some(t=>Rl(t)&&e(t)||Hl(t)&&Kl(e,t.children))}function ql(e,t){let n=[],r=[Array.isArray(t)?t:[t]],i=[0];for(;;){if(i[0]>=r[0].length){if(r.length===1)return n;r.shift(),i.shift();continue}let t=r[0][i[0]++];Rl(t)&&e(t)&&n.push(t),Hl(t)&&t.children.length>0&&(i.unshift(0),r.unshift(t.children))}}const Jl={tag_name(e){return typeof e==`function`?t=>Rl(t)&&e(t.name):e===`*`?Rl:t=>Rl(t)&&t.name===e},tag_type(e){return typeof e==`function`?t=>e(t.type):t=>t.type===e},tag_contains(e){return typeof e==`function`?t=>Bl(t)&&e(t.data):t=>Bl(t)&&t.data===e}};function Yl(e,t){return typeof t==`function`?n=>Rl(n)&&t(n.attribs[e]):n=>Rl(n)&&n.attribs[e]===t}function Xl(e,t){return n=>e(n)||t(n)}function Zl(e){let t=Object.keys(e).map(t=>{let n=e[t];return Object.hasOwn(Jl,t)?Jl[t](n):Yl(t,n)});return t.length===0?null:t.reduce(Xl)}function Ql(e,t){let n=Zl(e);return!n||n(t)}function $l(e,t,n,r=1/0){let i=Zl(e);return i?Ul(i,t,n,r):[]}function eu(e,t,n=!0){return Array.isArray(t)||(t=[t]),Gl(Yl(`id`,e),t,n)}function tu(e,t,n=!0,r=1/0){return Ul(Jl.tag_name(e),t,n,r)}function nu(e,t,n=!0,r=1/0){return Ul(Yl(`class`,e),t,n,r)}function ru(e,t,n=!0,r=1/0){return Ul(Jl.tag_type(e),t,n,r)}function iu(e){return e===34?`"`:e===38?`&`:e===39?`'`:e===60?`<`:e===62?`>`:` `}const au=/["&'<>\u0080-\uFFFF]/g;function ou(e){return e>=128||e>=32&&e<64&&(1342177476>>>e&1)==1}function su(e){let{length:t}=e,n,r=0,i=0;for(;i<t;){let a=e.charCodeAt(i);if(!ou(a)){let n=Math.min(i+32,t),r=i+1;for(;r<n&&!ou(e.charCodeAt(r));)r++;if(r<n){i=r;continue}if(r>=t||(au.lastIndex=r,!au.test(e)))break;i=au.lastIndex-1;continue}if(n===void 0?n=e.substring(0,i):r!==i&&(n+=e.substring(r,i)),a<64){n+=iu(a),r=i+=1;continue}let o=e.codePointAt(i);n+=`&#x${o.toString(16)};`,o!==a&&i++,r=i+=1}return n===void 0?e:(r<t&&(n+=e.substr(r)),n)}function cu(e,t){if(e.lastIndex=0,!e.test(t))return t;let n=``,r=0;do{let i=e.lastIndex-1;r!==i&&(n+=t.substring(r,i));let a=t.charCodeAt(i);n+=iu(a),r=i+1}while(e.test(t));return n+t.substring(r)}const lu=/["&\u{A0}]/gu;function uu(e){return cu(lu,e)}const du=/[&<>\u{A0}]/gu;function fu(e){return cu(du,e)}const pu=new Map(`altGlyph altGlyphDef altGlyphItem animateColor animateMotion animateTransform clipPath feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence foreignObject glyphRef linearGradient radialGradient textPath`.split(` `).map(e=>[e.toLowerCase(),e])),mu=new Map(`definitionURL attributeName attributeType baseFrequency baseProfile calcMode clipPathUnits diffuseConstant edgeMode filterUnits glyphRef gradientTransform gradientUnits kernelMatrix kernelUnitLength keyPoints keySplines keyTimes lengthAdjust limitingConeAngle markerHeight markerUnits markerWidth maskContentUnits maskUnits numOctaves pathLength patternContentUnits patternTransform patternUnits pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits refX refY repeatCount repeatDur requiredExtensions requiredFeatures specularConstant specularExponent spreadMethod startOffset stdDeviation stitchTiles surfaceScale systemLanguage tableValues targetX targetY textLength viewBox viewTarget xChannelSelector yChannelSelector zoomAndPan`.split(` `).map(e=>[e.toLowerCase(),e])),hu=new Set(`style script xmp iframe noembed noframes plaintext noscript`.split(` `)),gu=new Set(`area base basefont br col command embed frame hr img input isindex keygen link meta param source track wbr`.split(` `)),_u=/* @__PURE__ */ new Set([`svg`,`math`]),vu=new Set(`mi mo mn ms mtext annotation-xml foreignObject desc title`.split(` `));function yu(e,t={}){let n=`length`in e?e:[e],r=t.xmlMode??!1,i=``;for(let e=0;e<n.length;e++)i+=xu(n[e],t,r);return i}function bu(e,t,n){let r=``;for(let i=0;i<e.length;i++)r+=xu(e[i],t,n);return r}function xu(e,t,n){switch(e.type){case Al:return bu(e.children,t,n);case Ml:return`<${e.data}>`;case Nl:return`<!--${e.data}-->`;case Ll:return`<![CDATA[${e.children[0].data}]]>`;case Pl:case Fl:case Il:return Su(e,t,n);case jl:{let r=e,i=r.data||``;return(t.encodeEntities??t.decodeEntities)!==!1&&!(!n&&r.parent&&hu.has(r.parent.name))?n||t.encodeEntities!==`utf8`?su(i):fu(i):i}}}function Su(e,t,n){n===`foreign`&&(e.name=pu.get(e.name)??e.name,e.parent&&vu.has(e.parent.name)&&(n=!1)),!n&&_u.has(e.name)&&(n=`foreign`);let{name:r,children:i}=e,a=!n&&gu.has(r),o=`<${r}${wu(e.attribs,t,n)}`;return i.length===0&&(n?t.selfClosingTags!==!1:t.selfClosingTags&&a)?o+=n?`/>`:` />`:(o+=`>`,i.length>0&&(o+=bu(i,t,n)),a||(o+=`</${r}>`)),o}function Cu(e){return e.replaceAll(`"`,`"`)}function wu(e,t,n){if(!e)return``;let r=(t.encodeEntities??t.decodeEntities)===!1?Cu:n||t.encodeEntities!==`utf8`?su:uu,i=n===`foreign`,a=!!(t.emptyAttrs??n),o=``;for(let t in e){if(!Object.hasOwn(e,t))continue;let n=e[t],s=i?mu.get(t)??t:t;o+=!a&&(n==null||n===``)?` ${s}`:` ${s}="${r(n==null?``:String(n))}"`}return o}function Tu(e,t){return yu(e,t)}function Eu(e,t){return Hl(e)?e.children.map(e=>Tu(e,t)).join(``):``}function Du(e){return Array.isArray(e)?e.map(Du).join(``):Rl(e)?e.name===`br`?`
|
|
101
|
+
`:Du(e.children):zl(e)?Du(e.children):Bl(e)?e.data:``}function Ou(e){return Array.isArray(e)?e.map(Ou).join(``):Hl(e)&&!Vl(e)?Ou(e.children):Bl(e)?e.data:``}function ku(e){return Array.isArray(e)?e.map(ku).join(``):Hl(e)&&(e.type===Ol.Tag||zl(e))?ku(e.children):Bl(e)?e.data:``}function Au(e){let t=Iu(zu,e);return t?t.name===`feed`?ju(t):Mu(t):null}function ju(e){let t=e.children,n={type:`atom`,items:tu(`entry`,t).map(e=>{let{children:t}=e,n={media:Fu(t)};Ru(n,`id`,`id`,t),Ru(n,`title`,`title`,t);let r=Iu(`link`,t)?.attribs.href;r&&(n.link=r);let i=Lu(`summary`,t)||Lu(`content`,t);i&&(n.description=i);let a=Lu(`updated`,t);return a&&(n.pubDate=new Date(a)),n})};Ru(n,`id`,`id`,t),Ru(n,`title`,`title`,t);let r=Iu(`link`,t)?.attribs.href;r&&(n.link=r),Ru(n,`description`,`subtitle`,t);let i=Lu(`updated`,t);return i&&(n.updated=new Date(i)),Ru(n,`author`,`email`,t,!0),n}function Mu(e){let t=Iu(`channel`,e.children)?.children??[],n={type:e.name.substr(0,3),id:``,items:tu(`item`,e.children).map(e=>{let{children:t}=e,n={media:Fu(t)};Ru(n,`id`,`guid`,t),Ru(n,`title`,`title`,t),Ru(n,`link`,`link`,t),Ru(n,`description`,`description`,t);let r=Lu(`pubDate`,t)||Lu(`dc:date`,t);return r&&(n.pubDate=new Date(r)),n})};Ru(n,`title`,`title`,t),Ru(n,`link`,`link`,t),Ru(n,`description`,`description`,t);let r=Lu(`lastBuildDate`,t);return r&&(n.updated=new Date(r)),Ru(n,`author`,`managingEditor`,t,!0),n}const Nu=[`url`,`type`,`lang`],Pu=[`fileSize`,`bitrate`,`framerate`,`samplingrate`,`channels`,`duration`,`height`,`width`];function Fu(e){return tu(`media:content`,e).map(e=>{let{attribs:t}=e,n={medium:t.medium,isDefault:!!t.isDefault};for(let e of Nu)t[e]&&(n[e]=t[e]);for(let e of Pu)t[e]&&(n[e]=Number.parseInt(t[e],10));return t.expression&&(n.expression=t.expression),n})}function Iu(e,t){return tu(e,t,!0,1)[0]}function Lu(e,t,n=!1){return Ou(tu(e,t,n,1)).trim()}function Ru(e,t,n,r,i=!1){let a=Lu(n,r,i);a&&(e[t]=a)}function zu(e){return e===`rss`||e===`feed`||e===`rdf:RDF`}function Bu(e){let t=e.length;for(;--t>=0;){let n=e[t];if(t>0&&e.lastIndexOf(n,t-1)>=0)e.splice(t,1);else for(let r=n.parent;r;r=r.parent)if(e.includes(r)){e.splice(t,1);break}}return e}var Vu;(function(e){e[e.DISCONNECTED=1]=`DISCONNECTED`,e[e.PRECEDING=2]=`PRECEDING`,e[e.FOLLOWING=4]=`FOLLOWING`,e[e.CONTAINS=8]=`CONTAINS`,e[e.CONTAINED_BY=16]=`CONTAINED_BY`})(Vu||={});function Hu(e,t){let n=[],r=[];if(e===t)return 0;let i=Hl(e)?e:e.parent;for(;i;)n.unshift(i),i=i.parent;for(i=Hl(t)?t:t.parent;i;)r.unshift(i),i=i.parent;let a=Math.min(n.length,r.length),o=0;for(;o<a&&n[o]===r[o];)o++;if(o===0)return Vu.DISCONNECTED;let s=n[o-1],c=s.children,l=n[o],u=r[o];return c.indexOf(l)>c.indexOf(u)?s===t?Vu.FOLLOWING|Vu.CONTAINED_BY:Vu.FOLLOWING:s===e?Vu.PRECEDING|Vu.CONTAINS:Vu.PRECEDING}function Uu(e){return e=e.filter((e,t,n)=>!n.includes(e,t+1)),e.sort((e,t)=>{let n=Hu(e,t);return n&Vu.PRECEDING?-1:n&Vu.FOLLOWING?1:0}),e}function Wu(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){let t=e.parent.children,n=t.lastIndexOf(e);n!==-1&&t.splice(n,1)}e.next=null,e.prev=null,e.parent=null}function Gu(e,t){if(t.prev=e.prev,t.prev&&(t.prev.next=t),t.next=e.next,t.next&&(t.next.prev=t),t.parent=e.parent,t.parent){let{children:n}=t.parent,r=n.lastIndexOf(e);if(r===-1)return;n[r]=t,e.parent=null}}function Ku(e,t){if(Wu(t),t.next=null,t.parent=e,e.children.push(t)>1){let n=e.children[e.children.length-2];n.next=t,t.prev=n}else t.prev=null}function qu(e,t){Wu(t);let{parent:n}=e,r=e.next;if(t.next=r,t.prev=e,e.next=t,t.parent=n,r){if(r.prev=t,n){let e=n.children;e.splice(e.lastIndexOf(r),0,t)}}else n&&n.children.push(t)}function Ju(e,t){if(Wu(t),t.parent=e,t.prev=null,e.children.unshift(t)===1)t.next=null;else{let n=e.children[1];n.prev=t,t.next=n}}function Yu(e,t){Wu(t);let{parent:n}=e;if(n){let r=n.children;r.splice(r.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=n,t.prev=e.prev,t.next=e,e.prev=t}function Xu(e){return Hl(e)?e.children:[]}function Zu(e){return e.parent||null}function Qu(e){let t=Zu(e);if(t!=null)return Xu(t);let n=[e],{prev:r,next:i}=e;for(;r!=null;)n.unshift(r),{prev:r}=r;for(;i!=null;)n.push(i),{next:i}=i;return n}function $u(e,t){let{attribs:n}=e;return n?.[t]}function ed(e,t){let{attribs:n}=e;return n!=null&&Object.hasOwn(n,t)&&n[t]!=null}function td(e){return e.name}function nd(e){let{next:t}=e;for(;t!==null&&!Rl(t);)({next:t}=t);return t}function rd(e){let{prev:t}=e;for(;t!==null&&!Rl(t);)({prev:t}=t);return t}var id=/* @__PURE__ */ s({DocumentPosition:()=>Vu,append:()=>qu,appendChild:()=>Ku,compareDocumentPosition:()=>Hu,existsOne:()=>Kl,filter:()=>Ul,find:()=>Wl,findAll:()=>ql,findOne:()=>Gl,getAttributeValue:()=>$u,getChildren:()=>Xu,getElementById:()=>eu,getElements:()=>$l,getElementsByClassName:()=>nu,getElementsByTagName:()=>tu,getElementsByTagType:()=>ru,getFeed:()=>Au,getInnerHTML:()=>Eu,getName:()=>td,getOuterHTML:()=>Tu,getParent:()=>Zu,getSiblings:()=>Qu,getText:()=>Du,hasAttrib:()=>ed,innerText:()=>ku,nextElementSibling:()=>nd,prepend:()=>Yu,prependChild:()=>Ju,prevElementSibling:()=>rd,removeElement:()=>Wu,removeSubsets:()=>Bu,replaceElement:()=>Gu,testElement:()=>Ql,textContent:()=>Ou,uniqueSort:()=>Uu});const ad=/[-[\]{}()*+?.,\\^$|#\s]/g,od=/\s/;function sd(e){return e.replace(ad,`\\$&`)}const cd=/* @__PURE__ */ new Set(/* @__PURE__ */ `accept.accept-charset.align.alink.axis.bgcolor.charset.checked.clear.codetype.color.compact.declare.defer.dir.direction.disabled.enctype.face.frame.hreflang.http-equiv.lang.language.link.media.method.multiple.nohref.noresize.noshade.nowrap.readonly.rel.rev.rules.scope.scrolling.selected.shape.target.text.type.valign.valuetype.vlink`.split(`.`));function ld(e,t){return typeof e.ignoreCase==`boolean`?e.ignoreCase:e.ignoreCase===`quirks`?!!t.quirksMode:!t.xmlMode&&cd.has(e.name)}const ud={equals(e,t,n){let{adapter:r}=n,{name:i}=t,{value:a}=t;return ld(t,n)?(a=a.toLowerCase(),t=>{let n=r.getAttributeValue(t,i);return n!=null&&n.length===a.length&&n.toLowerCase()===a&&e(t)}):t=>r.getAttributeValue(t,i)===a&&e(t)},hyphen(e,t,n){let{adapter:r}=n,{name:i}=t,{value:a}=t,{length:o}=a;return ld(t,n)?(a=a.toLowerCase(),function(t){let n=r.getAttributeValue(t,i);return n!=null&&(n.length===o||n.charAt(o)===`-`)&&n.substr(0,o).toLowerCase()===a&&e(t)}):function(t){let n=r.getAttributeValue(t,i);return n!=null&&(n.length===o||n.charAt(o)===`-`)&&n.substr(0,o)===a&&e(t)}},element(e,t,n){let{adapter:r}=n,{name:i,value:a}=t;if(od.test(a))return pl;let o=RegExp(`(?:^|\\s)${sd(a)}(?:$|\\s)`,ld(t,n)?`i`:``);return function(t){let n=r.getAttributeValue(t,i);return n!=null&&n.length>=a.length&&o.test(n)&&e(t)}},exists(e,{name:t},{adapter:n}){return r=>n.hasAttrib(r,t)&&e(r)},start(e,t,n){let{adapter:r}=n,{name:i}=t,{value:a}=t,{length:o}=a;return o===0?pl:ld(t,n)?(a=a.toLowerCase(),t=>{let n=r.getAttributeValue(t,i);return n!=null&&n.length>=o&&n.substr(0,o).toLowerCase()===a&&e(t)}):t=>!!r.getAttributeValue(t,i)?.startsWith(a)&&e(t)},end(e,t,n){let{adapter:r}=n,{name:i}=t,{value:a}=t,o=-a.length;return o===0?pl:ld(t,n)?(a=a.toLowerCase(),t=>r.getAttributeValue(t,i)?.substr(o).toLowerCase()===a&&e(t)):t=>!!r.getAttributeValue(t,i)?.endsWith(a)&&e(t)},any(e,t,n){let{adapter:r}=n,{name:i,value:a}=t;if(a===``)return pl;if(ld(t,n)){let t=new RegExp(sd(a),`i`);return function(n){let o=r.getAttributeValue(n,i);return o!=null&&o.length>=a.length&&t.test(o)&&e(n)}}return t=>!!r.getAttributeValue(t,i)?.includes(a)&&e(t)},not(e,t,n){let{adapter:r}=n,{name:i}=t,{value:a}=t;return a===``?t=>!!r.getAttributeValue(t,i)&&e(t):ld(t,n)?(a=a.toLowerCase(),t=>{let n=r.getAttributeValue(t,i);return(n==null||n.length!==a.length||n.toLowerCase()!==a)&&e(t)}):t=>r.getAttributeValue(t,i)!==a&&e(t)}};function dd(e,t,n){let{adapter:r,xmlMode:i=!1}=n,a=[t],o=[0];for(;;){if(o[0]>=a[0].length){if(a.length===1)return null;a.shift(),o.shift();continue}let t=a[0][o[0]++];if(r.isTag(t)){if(e(t))return t;if(i||r.getName(t)!==`template`){let e=r.getChildren(t);e.length>0&&(a.unshift(e),o.unshift(0))}}}}function fd(e,t){let n=t.getSiblings(e);if(n.length<=1)return[];let r=n.indexOf(e);return r===-1||r===n.length-1?[]:n.slice(r+1).filter(t.isTag)}function pd(e,t){let n=t.getParent(e);return n!=null&&t.isTag(n)?n:null}const md=`input:is([type=text i],[type=search i],[type=url i],[type=tel i],[type=email i],[type=password i],[type=date i],[type=month i],[type=week i],[type=time i],[type=datetime-local i],[type=number i])`,hd={"any-link":`:is(a, area, link)[href]`,link:`:any-link:not(:visited)`,disabled:`:is(
|
|
102
|
+
:is(button, input, select, textarea, optgroup, option)[disabled],
|
|
103
|
+
optgroup[disabled] > option,
|
|
104
|
+
fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
|
|
105
|
+
)`,enabled:`:is(button, input, select, textarea, optgroup, option, fieldset):not(:disabled)`,checked:`:is(:is(input[type=radio], input[type=checkbox])[checked], :selected)`,required:`:is(input, select, textarea)[required]`,optional:`:is(input, select, textarea):not([required])`,"read-only":`[readonly]:is(textarea, ${md})`,"read-write":`:not([readonly]):is(textarea, ${md})`,selected:`option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)`,checkbox:`[type=checkbox]`,file:`[type=file]`,password:`[type=password]`,radio:`[type=radio]`,reset:`[type=reset]`,image:`[type=image]`,submit:`[type=submit]`,parent:`:not(:empty)`,header:`:is(h1, h2, h3, h4, h5, h6)`,button:`:is(button, input[type=button])`,input:`:is(input, textarea, select, button)`,text:`input:is(:not([type!='']), [type=text])`};function gd(e){let t=e[0],n=e[1]-1;if(n<0&&t<=0)return pl;if(t===-1)return e=>e<=n;if(t===0)return e=>e===n;if(t===1)return n<0?fl:e=>e>=n;let r=Math.abs(t),i=(n%r+r)%r;return t>1?e=>e>=n&&e%r===i:e=>e<=n&&e%r===i}const _d=/* @__PURE__ */ new Set([9,10,12,13,32]);function vd(e){switch(e=e.trim().toLowerCase(),e){case`even`:return[2,0];case`odd`:return[2,1]}let t=0,n=0,r=a(),i=o();if(t<e.length&&e.charAt(t)===`n`&&(t++,n=r*(i??1),s(),t<e.length?(r=a(),s(),i=o()):r=i=0),i===null||t<e.length)throw Error(`n-th rule couldn't be parsed ('${e}')`);return[n,r*i];function a(){switch(e.charAt(t)){case`-`:return t++,-1;case`+`:t++}return 1}function o(){let n=t,r=0;for(;t<e.length&&e.charCodeAt(t)>=48&&e.charCodeAt(t)<=57;)r=r*10+(e.charCodeAt(t)-48),t++;return t===n?null:r}function s(){for(;t<e.length&&_d.has(e.charCodeAt(t));)t++}}function yd(e){return gd(vd(e))}function bd(e,{adapter:t,cacheResults:n},r){if(n===!1||typeof WeakMap>`u`)return t=>e(t)&&r(t);let i=/* @__PURE__ */ new WeakMap;function a(e){let t=r(e);return i.set(e,t),t}return function(n){if(!e(n))return!1;if(i.has(n))return i.get(n)??!1;let r=n;do{let e=pd(r,t);if(e===null)return a(n);r=e}while(!i.has(r));return i.get(r)?a(n):!1}}function xd(e){let{context:t,rootFunc:n,...r}=e;return r}function Sd(e,t){if(t[0]!==`*`&&t[0]!==e[0])return!1;let n=1;for(let r=1;r<t.length;r++)if(t[r]!==`*`){for(;n<e.length&&e[n]!==t[r];)if(e[n++].length<=1)return!1;if(n>=e.length)return!1;n++}return!0}const Cd=/^(.+?)\s+of\s+(.+)$/is;function wd(e,t){return function(n,r,i,a,o){let{adapter:s,equals:c}=i,l=t?null:r.match(Cd),u=yd(l?l[1].trim():r);if(u===pl)return pl;let d=l&&o?o(El(l[2].trim()),xd(i),a):void 0;if(d===pl)return pl;if(u===fl&&!d)return e=>pd(e,s)!==null&&n(e);let f=d?(e,t)=>d(t):t?(e,t)=>s.getName(t)===s.getName(e):fl;return e?function(e){if(d&&!d(e))return!1;let t=s.getSiblings(e),r=0;for(let n=t.length-1;n>=0;n--){let i=t[n];if(c(e,i))break;s.isTag(i)&&f(e,i)&&r++}return u(r)&&n(e)}:function(e){if(d&&!d(e))return!1;let t=s.getSiblings(e),r=0;for(let n of t){if(c(e,n))break;s.isTag(n)&&f(e,n)&&r++}return u(r)&&n(e)}}}const Td={contains(e,t,n){let{getText:r}=n.adapter;return bd(e,n,e=>r(e).includes(t))},icontains(e,t,n){let r=t.toLowerCase(),{getText:i}=n.adapter;return bd(e,n,e=>i(e).toLowerCase().includes(r))},"nth-child":wd(!1,!1),"nth-last-child":wd(!0,!1),"nth-of-type":wd(!1,!0),"nth-last-of-type":wd(!0,!0),root(e,t,{adapter:n}){return t=>pd(t,n)===null&&e(t)},scope(e,t,n,r){let{equals:i}=n;return!r||r.length===0?Td.root(e,t,n):r.length===1?t=>i(r[0],t)&&e(t):t=>r.includes(t)&&e(t)},lang(e,t,{adapter:n}){let r=t.split(`,`).map(e=>e.trim()).filter(e=>e.length>0).map(e=>e.replace(/^['"]|['"]$/g,``).toLowerCase().split(`-`));return function(t){let i=t;for(;i!=null;){let a=n.getAttributeValue(i,`xml:lang`)??n.getAttributeValue(i,`lang`);if(a!=null){if(!a)return r.some(e=>e[0]===``)&&e(t);let n=a.toLowerCase().split(`-`);return r.some(e=>Sd(n,e))&&e(t)}let o=n.getParent(i);i=o!=null&&n.isTag(o)?o:null}return r.some(e=>e[0]===``)&&e(t)}},hover:Ed(`isHovered`),visited:Ed(`isVisited`),active:Ed(`isActive`)};function Ed(e){return function(t,n,{adapter:r}){let i=r[e];return typeof i==`function`?function(e){return i(e)&&t(e)}:pl}}const Dd=/^[ \t\r\n]*$/,Od={empty(e,{adapter:t}){let n=t.getChildren(e);return n.every(e=>!t.isTag(e))&&n.every(e=>Dd.test(t.getText(e)))},"first-child"(e,{adapter:t,equals:n}){if(t.prevElementSibling)return t.prevElementSibling(e)==null;let r=t.getSiblings(e).find(e=>t.isTag(e));return r!=null&&n(e,r)},"last-child"(e,{adapter:t,equals:n}){let r=t.getSiblings(e);for(let i=r.length-1;i>=0;i--){if(n(e,r[i]))return!0;if(t.isTag(r[i]))break}return!1},"first-of-type"(e,{adapter:t,equals:n}){let r=t.getSiblings(e),i=t.getName(e);for(let a of r){if(n(e,a))return!0;if(t.isTag(a)&&t.getName(a)===i)break}return!1},"last-of-type"(e,{adapter:t,equals:n}){let r=t.getSiblings(e),i=t.getName(e);for(let a=r.length-1;a>=0;a--){let o=r[a];if(n(e,o))return!0;if(t.isTag(o)&&t.getName(o)===i)break}return!1},"only-of-type"(e,{adapter:t,equals:n}){let r=t.getName(e);return t.getSiblings(e).every(i=>n(e,i)||!t.isTag(i)||t.getName(i)!==r)},"only-child"(e,{adapter:t,equals:n}){return t.getSiblings(e).every(r=>n(e,r)||!t.isTag(r))}};function kd(e,t,n,r){if(n===null){if(e.length>r)throw Error(`Pseudo-class :${t} requires an argument`)}else if(e.length===r)throw Error(`Pseudo-class :${t} doesn't have any arguments`)}function Ad(e){return e.type===`_flexibleDescendant`||bl(e)}function jd(e){let t=e.map(Nd);for(let n=1;n<e.length;n++){let r=t[n];if(!(r<0))for(let i=n;i>0&&r<t[i-1];i--){let n=e[i];e[i]=e[i-1],e[i-1]=n,t[i]=t[i-1],t[i-1]=r}}}function Md(e){switch(e.action){case ml.Exists:return 10;case ml.Equals:return e.name===`id`?9:8;case ml.Not:return 7;case ml.Start:return 6;case ml.End:return 6;case ml.Any:return 5;case ml.Hyphen:return 4;case ml.Element:return 3}}function Nd(e){switch(e.type){case U.Universal:return 50;case U.Tag:return 30;case U.Attribute:return Math.floor(Md(e)/(e.ignoreCase?2:1));case U.Pseudo:return e.data?e.name===`has`||e.name===`contains`||e.name===`icontains`?0:Array.isArray(e.data)?Math.max(0,Math.min(...e.data.map(e=>Math.min(...e.map(Nd))))):2:3;default:return-1}}function Pd(e){return e.type===U.Pseudo&&(e.name===`scope`||Array.isArray(e.data)&&e.data.some(e=>e.some(Pd)))}const Fd={};function Id(e){return e.some(e=>e.length>0&&(Ad(e[0])||e.some(Pd)))}const Ld=(e,t,n,r,i)=>{let a=i(t,xd(n),r);return a===fl?e:a===pl?pl:t=>a(t)&&e(t)},Rd={is:Ld,matches:Ld,where:Ld,not(e,t,n,r,i){let a=i(t,xd(n),r);return a===pl?e:a===fl?pl:t=>!a(t)&&e(t)},has(e,t,n,r,i){let{adapter:a}=n,o=xd(n);o.relativeSelector=!0;let s=t.some(e=>e.some(Ad))?[Fd]:void 0,c=Id(t),l=i(t,o,s);if(l===pl)return pl;if(s&&l!==fl)return c?t=>{if(!e(t))return!1;s[0]=t;let r=a.getChildren(t);return dd(l,l.shouldTestNextSiblings?[...r,...fd(t,a)]:r,n)!==null}:bd(e,n,e=>(s[0]=e,dd(l,a.getChildren(e),n)!==null));let u=e=>dd(l,a.getChildren(e),n)!==null;return c?t=>e(t)&&u(t):bd(e,n,u)}};function zd(e,t,n,r,i){let{name:a,data:o}=t;if(Array.isArray(o)){if(!(a in Rd))throw Error(`Unknown pseudo-class :${a}(${o})`);return Rd[a](e,o,n,r,i)}let s=n.pseudos?.[a],c=typeof s==`string`?s:hd[a];if(typeof c==`string`){if(o!=null)throw Error(`Pseudo ${a} doesn't have any arguments`);let t=El(c);return Rd.is(e,t,n,r,i)}if(typeof s==`function`)return kd(s,a,o,1),t=>s(t,o)&&e(t);if(a in Td)return Td[a](e,o,n,r,i);if(a in Od){let t=Od[a];return kd(t,a,o,2),r=>t(r,n,o)&&e(r)}throw Error(`Unknown pseudo-class :${a}`)}function Bd(e,t,n,r,i,a){let{adapter:o,equals:s,cacheResults:c}=n;switch(t.type){case U.PseudoElement:throw Error(`Pseudo-elements are not supported by css-select`);case U.ColumnCombinator:throw Error(`Column combinators are not yet supported by css-select`);case U.Attribute:if(t.namespace!=null)throw Error(`Namespaced attributes are not yet supported by css-select`);return(!n.xmlMode||n.lowerCaseAttributeNames)&&(t.name=t.name.toLowerCase()),ud[t.action](e,t,n);case U.Pseudo:return zd(e,t,n,r,i);case U.Tag:{if(t.namespace!=null)throw Error(`Namespaced tag names are not yet supported by css-select`);let{name:r}=t;return(!n.xmlMode||n.lowerCaseTags)&&(r=r.toLowerCase()),function(t){return o.getName(t)===r&&e(t)}}case U.Descendant:{if(!a||c===!1||typeof WeakMap>`u`)return function(t){let n=t;for(;n=pd(n,o);)if(e(n))return!0;return!1};let t=/* @__PURE__ */ new WeakMap;return function(n){let r=n,i;for(;r=pd(r,o);){let n=t.get(r);if(n===void 0){if(i??={matches:!1},i.matches=e(r),t.set(r,i),i.matches)return!0}else return i&&(i.matches=n.matches),n.matches}return!1}}case`_flexibleDescendant`:return function(t){let n=t;do{if(e(n))return!0;n=pd(n,o)}while(n);return!1};case U.Parent:return function(t){return o.getChildren(t).some(t=>o.isTag(t)&&e(t))};case U.Child:return function(t){let n=pd(t,o);return n!==null&&e(n)};case U.Sibling:return function(t){let n=o.getSiblings(t);for(let r of n){if(s(t,r))break;if(o.isTag(r)&&e(r))return!0}return!1};case U.Adjacent:return o.prevElementSibling?function(t){let n=o.prevElementSibling(t);return n!=null&&e(n)}:function(t){let n=o.getSiblings(t),r;for(let e of n){if(s(t,e))break;o.isTag(e)&&(r=e)}return!!r&&e(r)};case U.Universal:if(t.namespace!=null&&t.namespace!==`*`)throw Error(`Namespaced universal selectors are not yet supported by css-select`);return e}}const Vd={type:U.Descendant},Hd={type:`_flexibleDescendant`},Ud={type:U.Pseudo,name:`scope`,data:null};function Wd(e,{adapter:t},n){let r=!!n?.every(e=>e===Fd||t.isTag(e)&&pd(e,t)!==null);for(let t of e){if(!(t.length>0&&Ad(t[0])&&t[0].type!==U.Descendant)){if(r&&!t.some(Pd))t.unshift(Vd);else continue}t.unshift(Ud)}}function Gd(e,t,n){for(let t of e)jd(t);let{context:r=n,rootFunc:i=fl}=t,a=Array.isArray(r),o=r&&(Array.isArray(r)?r:[r]);if(t.relativeSelector!==!1)Wd(e,t,o);else if(e.some(e=>e.length>0&&Ad(e[0])))throw Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");let s=!1,c=pl;combineLoop:for(let n of e){if(n.length>=2){let[e,t]=n;e.type!==U.Pseudo||e.name!==`scope`||(a&&t.type===U.Descendant?n[1]=Hd:(t.type===U.Adjacent||t.type===U.Sibling)&&(s=!0))}let e=i,r=!1;for(let i of n)if(e=Bd(e,i,t,o,Gd,r),Nd(i)===0&&(r=!0),e===pl)continue combineLoop;if(e===i)return i;c=c===pl?e:Kd(c,e)}return c.shouldTestNextSiblings=s,c}function Kd(e,t){return n=>e(n)||t(n)}const qd=(e,t)=>e===t,Jd={adapter:{...id,isTag:Rl},equals:qd};function Yd(e){let t=e??Jd;return t.adapter??=Jd.adapter,t.equals??=t.adapter?.equals??qd,t}function Xd(e,t,n){let r=Yd(t),i=Zd(e,r,n);return i===pl?pl:e=>r.adapter.isTag(e)&&i(e)}function Zd(e,t,n){return Gd(typeof e==`string`?El(e):e,Yd(t),n)}function Qd(e,t,n){return(typeof t==`function`?t:Xd(t,n))(e)}const{isArray:$d}=Array,ef=({nodeType:e})=>e===1,tf=(e,t)=>t.some(t=>ef(t)&&(e(t)||tf(e,rf(t)))),nf=(e,t)=>t===`class`?e.getAttributeNode(`class`)?.value??null:e.getAttribute(t),rf=({childNodes:e})=>e,af=e=>{let{localName:t}=e;return Zs(e)?t.toLowerCase():t},of=({parentNode:e})=>e,sf=e=>{let{parentNode:t}=e;return t?rf(t):e},cf=e=>$d(e)?e.map(cf).join(``):ef(e)?cf(rf(e)):e.nodeType===3?e.data:``,lf=(e,t)=>e.hasAttribute(t),uf=e=>{let{length:t}=e;for(;t--;){let n=e[t];if(t&&-1<e.lastIndexOf(n,t-1))e.splice(t,1);else for(let{parentNode:r}=n;r;r=r.parentNode)if(e.includes(r)){e.splice(t,1);break}}return e},df=(e,t)=>{let n=[];for(let r of t)ef(r)&&(e(r)&&n.push(r),n.push(...df(e,rf(r))));return n},ff=(e,t)=>{for(let n of t)if(e(n)||(n=ff(e,rf(n))))return n;return null},pf={isTag:ef,existsOne:tf,getAttributeValue:nf,getChildren:rf,getName:af,getParent:of,getSiblings:sf,getText:cf,hasAttrib:lf,removeSubsets:uf,findAll:df,findOne:ff},mf=(e,t)=>Xd(t,{context:t.includes(`:scope`)?e:void 0,xmlMode:!Zs(e),adapter:pf}),hf=(e,t)=>Qd(e,t,{strict:!0,context:t.includes(`:scope`)?e:void 0,xmlMode:!Zs(e),adapter:pf});var gf=class e extends ll{constructor(e,t=``){super(e,`#text`,3,t)}get wholeText(){let e=[],{previousSibling:t,nextSibling:n}=this;for(;t&&t.nodeType===3;)e.unshift(t[na]),t=t.previousSibling;for(e.push(this[na]);n&&n.nodeType===3;)e.push(n[na]),n=n.nextSibling;return e.join(``)}cloneNode(){let{ownerDocument:t,[na]:n}=this;return new e(t,n)}toString(){return Yc(this[na])}};const _f=e=>e instanceof Wc,vf=(e,t,n)=>{let{ownerDocument:r}=e;for(let i of n)e.insertBefore(_f(i)?i:new gf(r,i),t)};var yf=class extends Wc{constructor(e,t,n){super(e,t,n),this[Zi]=null,this[z]=this[R]={[z]:null,[Xi]:this,[$i]:this,nodeType:-1,ownerDocument:this.ownerDocument,parentNode:null}}get childNodes(){let e=new Hc,{firstChild:t}=this;for(;t;)e.push(t),t=tl(t);return e}get children(){let e=new Hc,{firstElementChild:t}=this;for(;t;)e.push(t),t=nl(t);return e}get firstChild(){let{[z]:e,[R]:t}=this;for(;e.nodeType===2;)e=e[z];return e===t?null:e}get firstElementChild(){let{firstChild:e}=this;for(;e;){if(e.nodeType===1)return e;e=tl(e)}return null}get lastChild(){let e=this[R][Xi];switch(e.nodeType){case-1:return e[$i];case 2:return null}return e===this?null:e}get lastElementChild(){let{lastChild:e}=this;for(;e;){if(e.nodeType===1)return e;e=el(e)}return null}get childElementCount(){return this.children.length}prepend(...e){vf(this,this.firstChild,e)}append(...e){vf(this,this[R],e)}replaceChildren(...e){let{[z]:t,[R]:n}=this;for(;t!==n&&t.nodeType===2;)t=t[z];for(;t!==n;){let e=Xs(t)[z];t.remove(),t=e}e.length&&vf(this,n,e)}getElementsByClassName(e){let t=new Hc,{[z]:n,[R]:r}=this;for(;n!==r;)n.nodeType===1&&n.hasAttribute(`class`)&&n.classList.has(e)&&t.push(n),n=n[z];return t}getElementsByTagName(e){let t=new Hc,{[z]:n,[R]:r}=this;for(;n!==r;)n.nodeType===1&&(n.localName===e||nc(n)===e)&&t.push(n),n=n[z];return t}querySelector(e){let t=mf(this,e),{[z]:n,[R]:r}=this;for(;n!==r;){if(n.nodeType===1&&t(n))return n;n=n.nodeType===1&&n.localName===`template`?n[R]:n[z]}return null}querySelectorAll(e){let t=mf(this,e),n=new Hc,{[z]:r,[R]:i}=this;for(;r!==i;)r.nodeType===1&&t(r)&&n.push(r),r=r.nodeType===1&&r.localName===`template`?r[R]:r[z];return n}appendChild(e){return this.insertBefore(e,this[R])}contains(e){let t=e;for(;t&&t!==this;)t=t.parentNode;return t===this}insertBefore(e,t=null){if(e===t)return e;if(e===this)throw Error(`unable to append a node to itself`);let n=t||this[R];switch(e.nodeType){case 1:e.remove(),e.parentNode=this,$s(n[Xi],e,n),jc(e,null),fc(e);break;case 11:{let{[Zi]:t,firstChild:r,lastChild:i}=e;if(r){ec(n[Xi],r,i,n),Qs(e,e[R]),t&&t.replaceChildren();do r.parentNode=this,jc(r,null),r.nodeType===1&&fc(r);while(r!==i&&(r=tl(r)))}break}case 3:case 8:case 4:e.remove();default:e.parentNode=this,tc(n[Xi],e,n),jc(e,null)}return e}normalize(){let{[z]:e,[R]:t}=this;for(;e!==t;){let{[z]:t,[Xi]:n,nodeType:r}=e;r===3&&(e[na]?n&&n.nodeType===3&&(n.textContent+=e.textContent,e.remove()):e.remove()),e=t}}removeChild(e){if(e.parentNode!==this)throw Error(`node is not a child`);return e.remove(),e}replaceChild(e,t){let n=Xs(t)[z];return t.remove(),this.insertBefore(e,n),t}},bf=class extends yf{getElementById(e){let{[z]:t,[R]:n}=this;for(;t!==n;){if(t.nodeType===1&&t.id===e)return t;t=t[z]}return null}cloneNode(e){let{ownerDocument:t,constructor:n}=this,r=new n(t);if(e){let{[R]:t}=r;for(let n of this.childNodes)r.insertBefore(n.cloneNode(e),t)}return r}toString(){let{childNodes:e,localName:t}=this;return`<${t}>${e.join(``)}</${t}>`}toJSON(){let e=[];return Tc(this,e),e}},xf=class extends bf{constructor(e){super(e,`#document-fragment`,11)}},Sf=class e extends Wc{constructor(e,t,n=``,r=``){super(e,`#document-type`,10),this.name=t,this.publicId=n,this.systemId=r}cloneNode(){let{ownerDocument:t,name:n,publicId:r,systemId:i}=this;return new e(t,n,r,i)}toString(){let{name:e,publicId:t,systemId:n}=this,r=0<t.length,i=[e];return r&&i.push(`PUBLIC`,`"${t}"`),n.length&&(r||i.push(`SYSTEM`),i.push(`"${n}"`)),`<!DOCTYPE ${i.join(` `)}>`}toJSON(){let e=[];return Ec(this,e),e}};const Cf=e=>e.childNodes.join(``),wf=(e,t)=>{let{ownerDocument:n}=e,{constructor:r}=n,i=new r;i[zi]=n[zi];let{childNodes:a}=yc(i,Zs(e),t);e.replaceChildren(...a.map(Tf,n))};function Tf(e){switch(e.ownerDocument=this,e.nodeType){case 1:case 11:e.childNodes.forEach(Tf,this)}return e}var Ef=e=>e.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z0-9]+)([A-Z]))/g,`$2$5-$3$6`).toLowerCase();const Df=/* @__PURE__ */ new WeakMap,Of=e=>`data-${Ef(e)}`,kf=e=>e.slice(5).replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),Af={get(e,t){if(t in e)return Df.get(e).getAttribute(Of(t))},set(e,t,n){return e[t]=n,Df.get(e).setAttribute(Of(t),n),!0},deleteProperty(e,t){return t in e&&Df.get(e).removeAttribute(Of(t)),delete e[t]}};var jf=class{constructor(e){for(let{name:t,value:n}of e.attributes)/^data-/.test(t)&&(this[kf(t)]=n);return Df.set(this,e),new Proxy(this,Af)}};Js(jf.prototype,null);const{add:Mf}=Set.prototype,Nf=(e,t)=>{for(let n of t)n&&Mf.call(e,n)},Pf=({[Yi]:e,value:t})=>{let n=e.getAttributeNode(`class`);n?n.value=t:Pc(e,new Zc(e.ownerDocument,`class`,t))};var Ff=class extends Set{constructor(e){super(),this[Yi]=e;let t=e.getAttributeNode(`class`);t&&Nf(this,t.value.split(/\s+/))}get length(){return this.size}get value(){return[...this].join(` `)}add(...e){Nf(this,e),Pf(this)}contains(e){return this.has(e)}remove(...e){for(let t of e)this.delete(t);Pf(this)}toggle(e,t){if(this.has(e)){if(t)return!0;this.delete(e),Pf(this)}else if(t||arguments.length===1)return super.add(e),Pf(this),!0;return!1}replace(e,t){return this.has(e)?(this.delete(e),super.add(t),Pf(this),!0):!1}supports(){return!0}};const If=/* @__PURE__ */ new WeakMap,Lf=e=>[...e.keys()].filter(e=>e!==Zi),Rf=e=>{let t=If.get(e).getAttributeNode(`style`);if((!t||t[Li]||e.get(Zi)!==t)&&(e.clear(),t)){e.set(Zi,t);for(let n of t[na].split(/\s*;\s*/)){let[t,...r]=n.split(`:`);if(r.length>0){t=t.trim();let n=r.join(`:`).trim();t&&n&&e.set(t,n)}}}return t},zf={get(e,t){return t in Vf?e[t]:(Rf(e),t===`length`?Lf(e).length:/^\d+$/.test(t)?Lf(e)[t]:e.get(Ef(t))??``)},set(e,t,n){if(t===`cssText`)e[t]=n;else{let r=Rf(e);if(n==null?e.delete(Ef(t)):e.set(Ef(t),n),!r){let t=If.get(e);r=t.ownerDocument.createAttribute(`style`),t.setAttributeNode(r),e.set(Zi,r)}r[Li]=!1,r[na]=e.toString()}return!0}};var Bf=class extends Map{constructor(e){
|
|
106
|
+
/* c8 ignore start */
|
|
107
|
+
return super(),If.set(this,e),new Proxy(this,zf)
|
|
108
|
+
/* c8 ignore stop */
|
|
109
|
+
}get cssText(){return this.toString()}set cssText(e){If.get(this).setAttribute(`style`,e)}getPropertyValue(e){let t=this[Zi];return zf.get(t,e)}setProperty(e,t){let n=this[Zi];zf.set(n,e,t)}removeProperty(e){let t=this[Zi];zf.set(t,e,null)}[Symbol.iterator](){let e=this[Zi];Rf(e);let t=Lf(e),{length:n}=t,r=0;return{next(){let e=r===n;return{done:e,value:e?null:t[r++]}}}}get[Zi](){return this}toString(){let e=this[Zi];Rf(e);let t=[];return e.forEach(Hf,t),t.join(`;`)}};const{prototype:Vf}=Bf;function Hf(e,t){t!==Zi&&this.push(`${t}:${e}`)}function Uf(e){return e.currentTarget}var Wf=class{static get BUBBLING_PHASE(){return 3}static get AT_TARGET(){return 2}static get CAPTURING_PHASE(){return 1}static get NONE(){return 0}constructor(e,t={}){this.type=e,this.bubbles=!!t.bubbles,this.cancelBubble=!1,this._stopImmediatePropagationFlag=!1,this.cancelable=!!t.cancelable,this.eventPhase=this.NONE,this.timeStamp=Date.now(),this.defaultPrevented=!1,this.originalTarget=null,this.returnValue=null,this.srcElement=null,this.target=null,this._path=[]}get BUBBLING_PHASE(){return 3}get AT_TARGET(){return 2}get CAPTURING_PHASE(){return 1}get NONE(){return 0}preventDefault(){this.defaultPrevented=!0}composedPath(){return this._path.map(Uf)}stopPropagation(){this.cancelBubble=!0}stopImmediatePropagation(){this.stopPropagation(),this._stopImmediatePropagationFlag=!0}},Gf=class extends Array{constructor(e){super(),this.ownerElement=e}getNamedItem(e){return this.ownerElement.getAttributeNode(e)}setNamedItem(e){this.ownerElement.setAttributeNode(e),this.unshift(e)}removeNamedItem(e){let t=this.getNamedItem(e);this.ownerElement.removeAttribute(e),this.splice(this.indexOf(t),1)}item(e){return e<this.length?this[e]:null}
|
|
110
|
+
/* c8 ignore start */
|
|
111
|
+
getNamedItemNS(e,t){return this.getNamedItem(t)}setNamedItemNS(e,t){return this.setNamedItem(t)}removeNamedItemNS(e,t){return this.removeNamedItem(t)}},Kf=class extends bf{constructor(e){super(e.ownerDocument,`#shadow-root`,11),this.host=e}get innerHTML(){return Cf(this)}set innerHTML(e){wf(this,e)}};const qf={get(e,t){return t in e?e[t]:e.find(({name:e})=>e===t)}},Jf=(e,t,n)=>{if(`ownerSVGElement`in t){let r=e.createElementNS(Vs,n);return r.ownerSVGElement=t.ownerSVGElement,r}return e.createElement(n)},Yf=({localName:e,ownerDocument:t})=>t[qi].voidElements.test(e);var Xf=class extends yf{constructor(e,t){super(e,t,1),this[Ri]=null,this[Vi]=null,this[ea]=null}get isConnected(){return Qc(this)}get parentElement(){return $c(this)}get previousSibling(){return el(this)}get nextSibling(){return tl(this)}get namespaceURI(){return`http://www.w3.org/1999/xhtml`}get previousElementSibling(){return rl(this)}get nextElementSibling(){return nl(this)}before(...e){al(this,e)}after(...e){ol(this,e)}replaceWith(...e){sl(this,e)}remove(){cl(this[Xi],this,this[R][z])}get id(){return H.get(this,`id`)}set id(e){H.set(this,`id`,e)}get className(){return this.classList.value}set className(e){let{classList:t}=this;t.clear(),t.add(...Ys(e).split(/\s+/))}get nodeName(){return nc(this)}get tagName(){return nc(this)}get classList(){return this[Ri]||(this[Ri]=new Ff(this))}get dataset(){return this[Vi]||(this[Vi]=new jf(this))}getBoundingClientRect(){return{x:0,y:0,bottom:0,height:0,left:0,right:0,top:0,width:0}}get nonce(){return H.get(this,`nonce`)}set nonce(e){H.set(this,`nonce`,e)}get style(){return this[ea]||(this[ea]=new Bf(this))}get tabIndex(){return Lc.get(this,`tabindex`)||-1}set tabIndex(e){Lc.set(this,`tabindex`,e)}get slot(){return H.get(this,`slot`)}set slot(e){H.set(this,`slot`,e)}get innerText(){let e=[],{[z]:t,[R]:n}=this;for(;t!==n;)t.nodeType===3?e.push(t.textContent.replace(/\s+/g,` `)):e.length&&t[z]!=n&&Bs.has(t.tagName)&&e.push(`
|
|
112
|
+
`),t=t[z];return e.join(``)}get textContent(){let e=[],{[z]:t,[R]:n}=this;for(;t!==n;){let n=t.nodeType;(n===3||n===4)&&e.push(t.textContent),t=t[z]}return e.join(``)}set textContent(e){this.replaceChildren(),e!=null&&e!==``&&this.appendChild(new gf(this.ownerDocument,e))}get innerHTML(){return Cf(this)}set innerHTML(e){wf(this,e)}get outerHTML(){return this.toString()}set outerHTML(e){let t=this.ownerDocument.createElement(``);t.innerHTML=e,this.replaceWith(...t.childNodes)}get attributes(){let e=new Gf(this),t=this[z];for(;t.nodeType===2;)e.push(t),t=t[z];return new Proxy(e,qf)}focus(){this.dispatchEvent(new Wf(`focus`))}getAttribute(e){if(e===`class`)return this.className;let t=this.getAttributeNode(e);return t&&(Zs(this)?t.value:Yc(t.value))}getAttributeNode(e){let t=this[z];for(;t.nodeType===2;){if(t.name===e)return t;t=t[z]}return null}getAttributeNames(){let e=new Hc,t=this[z];for(;t.nodeType===2;)e.push(t.name),t=t[z];return e}hasAttribute(e){return!!this.getAttributeNode(e)}hasAttributes(){return this[z].nodeType===2}removeAttribute(e){e===`class`&&this[Ri]&&this[Ri].clear();let t=this[z];for(;t.nodeType===2;){if(t.name===e){Fc(this,t);return}t=t[z]}}removeAttributeNode(e){let t=this[z];for(;t.nodeType===2;){if(t===e){Fc(this,t);return}t=t[z]}}setAttribute(e,t){if(e===`class`)this.className=t;else{let n=this.getAttributeNode(e);n?n.value=t:Pc(this,new Zc(this.ownerDocument,e,t))}}setAttributeNode(e){let{name:t}=e,n=this.getAttributeNode(t);if(n!==e){n&&this.removeAttributeNode(n);let{ownerElement:t}=e;t&&t.removeAttributeNode(e),Pc(this,e)}return n}toggleAttribute(e,t){return this.hasAttribute(e)?t?!0:(this.removeAttribute(e),!1):t||arguments.length===1?(this.setAttribute(e,``),!0):!1}get shadowRoot(){if(ac.has(this)){let{mode:e,shadowRoot:t}=ac.get(this);if(e===`open`)return t}return null}attachShadow(e){if(ac.has(this))throw Error(`operation not supported`);let t=new Kf(this);return ac.set(this,{mode:e.mode,shadowRoot:t}),t}matches(e){return hf(this,e)}closest(e){let t=this,n=mf(t,e);for(;t&&!n(t);)t=t.parentElement;return t}insertAdjacentElement(e,t){let{parentElement:n}=this;switch(e){case`beforebegin`:if(n){n.insertBefore(t,this);break}return null;case`afterbegin`:this.insertBefore(t,this.firstChild);break;case`beforeend`:this.insertBefore(t,null);break;case`afterend`:if(n){n.insertBefore(t,this.nextSibling);break}return null}return t}insertAdjacentHTML(e,t){this.insertAdjacentElement(e,ic(this.ownerDocument,t))}insertAdjacentText(e,t){let n=this.ownerDocument.createTextNode(t);this.insertAdjacentElement(e,n)}cloneNode(e=!1){let{ownerDocument:t,localName:n}=this,r=e=>{e.parentNode=a,Qs(o,e),o=e},i=Jf(t,this,n),a=i,o=i,{[z]:s,[R]:c}=this;for(;s!==c&&(e||s.nodeType===2);){switch(s.nodeType){case-1:Qs(o,a[R]),o=a[R],a=a.parentNode;break;case 1:{let e=Jf(t,s,s.localName);r(e),a=e;break}case 2:{let t=s.cloneNode(e);t.ownerElement=a,r(t);break}case 3:case 8:case 4:r(s.cloneNode(e))}s=s[z]}return Qs(o,i[R]),i}toString(){let e=[],{[R]:t}=this,n={[z]:this},r=!1;do switch(n=n[z],n.nodeType){case 2:{let t=` `+n;switch(t){case` id`:case` class`:case` style`:break;default:e.push(t)}break}case-1:{let t=n[$i];r?(`ownerSVGElement`in t?e.push(` />`):Yf(t)?e.push(Zs(t)?`>`:` />`):e.push(`></${t.localName}>`),r=!1):e.push(`</${t.localName}>`);break}case 1:r&&e.push(`>`),n.toString===this.toString?(e.push(`<${n.localName}`),r=!0):(e.push(n.toString()),n=n[R],r=!1);break;case 3:case 8:case 4:e.push((r?`>`:``)+n),r=!1}while(n!==t);return e.join(``)}toJSON(){let e=[];return Dc(this,e),e}
|
|
113
|
+
/* c8 ignore start */
|
|
114
|
+
getAttributeNS(e,t){return this.getAttribute(t)}getElementsByTagNameNS(e,t){return this.getElementsByTagName(t)}hasAttributeNS(e,t){return this.hasAttribute(t)}removeAttributeNS(e,t){this.removeAttribute(t)}setAttributeNS(e,t,n){this.setAttribute(t,n)}setAttributeNodeNS(e){return this.setAttributeNode(e)}};const Zf=/* @__PURE__ */ new WeakMap,Qf={get(e,t){return e[t]},set(e,t,n){return e[t]=n,!0}};var $f=class extends Xf{constructor(e,t,n=null){super(e,t),this.ownerSVGElement=n}get className(){return Zf.has(this)||Zf.set(this,new Proxy({baseVal:``,animVal:``},Qf)),Zf.get(this)}
|
|
115
|
+
/* c8 ignore start */
|
|
116
|
+
set className(e){let{classList:t}=this;t.clear(),t.add(...Ys(e).split(/\s+/))}
|
|
117
|
+
/* c8 ignore stop */
|
|
118
|
+
get namespaceURI(){return`http://www.w3.org/2000/svg`}getAttribute(e){return e===`class`?[...this.classList].join(` `):super.getAttribute(e)}setAttribute(e,t){if(e===`class`)this.className=t;else if(e===`style`){let{className:e}=this;e.baseVal=e.animVal=t}super.setAttribute(e,t)}};
|
|
119
|
+
/* c8 ignore start */
|
|
120
|
+
const ep=()=>{throw TypeError(`Illegal constructor`)};function tp(){ep()}Js(tp,Zc),tp.prototype=Zc.prototype;function np(){ep()}Js(np,ul),np.prototype=ul.prototype;function rp(){ep()}Js(rp,ll),rp.prototype=ll.prototype;function ip(){ep()}Js(ip,dl),ip.prototype=dl.prototype;function ap(){ep()}Js(ap,xf),ap.prototype=xf.prototype;function op(){ep()}Js(op,Sf),op.prototype=Sf.prototype;function sp(){ep()}Js(sp,Xf),sp.prototype=Xf.prototype;function cp(){ep()}Js(cp,Wc),cp.prototype=Wc.prototype;function lp(){ep()}Js(lp,Kf),lp.prototype=Kf.prototype;function up(){ep()}Js(up,gf),up.prototype=gf.prototype;function dp(){ep()}Js(dp,$f),dp.prototype=$f.prototype;
|
|
121
|
+
/* c8 ignore stop */
|
|
122
|
+
const fp={Attr:tp,CDATASection:np,CharacterData:rp,Comment:ip,DocumentFragment:ap,DocumentType:op,Element:sp,Node:cp,ShadowRoot:lp,Text:up,SVGElement:dp},pp=/* @__PURE__ */ new WeakMap,G={get(e,t){return pp.has(e)&&pp.get(e)[t]||null},set(e,t,n){pp.has(e)||pp.set(e,{});let r=pp.get(e),i=t.slice(2);r[t]&&e.removeEventListener(i,r[t],!1),(r[t]=n)&&e.addEventListener(i,n,!1)}};var K=class extends Xf{static get observedAttributes(){return[]}constructor(e=null,t=``){super(e,t);let n=!e,r;if(n){let{constructor:n}=this;if(!sc.has(n))throw Error(`unable to initialize this Custom Element`);({ownerDocument:e,localName:t,options:r}=sc.get(n))}if(e[ta]){let{element:t,values:n}=e[ta];e[ta]=null;for(let[e,r]of n)t[e]=r;return t}n&&(this.ownerDocument=this[R].ownerDocument=e,this.localName=t,cc.set(this,{connected:!1}),r.is&&this.setAttribute(`is`,r.is))}
|
|
123
|
+
/* c8 ignore start */
|
|
124
|
+
blur(){this.dispatchEvent(new Wf(`blur`))}click(){let e=new Wf(`click`,{bubbles:!0,cancelable:!0});e.button=0,this.dispatchEvent(e)}get accessKeyLabel(){let{accessKey:e}=this;return e&&`Alt+Shift+${e}`}get isContentEditable(){return this.hasAttribute(`contenteditable`)}get contentEditable(){return Ic.get(this,`contenteditable`)}set contentEditable(e){Ic.set(this,`contenteditable`,e)}get draggable(){return Ic.get(this,`draggable`)}set draggable(e){Ic.set(this,`draggable`,e)}get hidden(){return Ic.get(this,`hidden`)}set hidden(e){Ic.set(this,`hidden`,e)}get spellcheck(){return Ic.get(this,`spellcheck`)}set spellcheck(e){Ic.set(this,`spellcheck`,e)}get accessKey(){return H.get(this,`accesskey`)}set accessKey(e){H.set(this,`accesskey`,e)}get dir(){return H.get(this,`dir`)}set dir(e){H.set(this,`dir`,e)}get lang(){return H.get(this,`lang`)}set lang(e){H.set(this,`lang`,e)}get title(){return H.get(this,`title`)}set title(e){H.set(this,`title`,e)}get onabort(){return G.get(this,`onabort`)}set onabort(e){G.set(this,`onabort`,e)}get onblur(){return G.get(this,`onblur`)}set onblur(e){G.set(this,`onblur`,e)}get oncancel(){return G.get(this,`oncancel`)}set oncancel(e){G.set(this,`oncancel`,e)}get oncanplay(){return G.get(this,`oncanplay`)}set oncanplay(e){G.set(this,`oncanplay`,e)}get oncanplaythrough(){return G.get(this,`oncanplaythrough`)}set oncanplaythrough(e){G.set(this,`oncanplaythrough`,e)}get onchange(){return G.get(this,`onchange`)}set onchange(e){G.set(this,`onchange`,e)}get onclick(){return G.get(this,`onclick`)}set onclick(e){G.set(this,`onclick`,e)}get onclose(){return G.get(this,`onclose`)}set onclose(e){G.set(this,`onclose`,e)}get oncontextmenu(){return G.get(this,`oncontextmenu`)}set oncontextmenu(e){G.set(this,`oncontextmenu`,e)}get oncuechange(){return G.get(this,`oncuechange`)}set oncuechange(e){G.set(this,`oncuechange`,e)}get ondblclick(){return G.get(this,`ondblclick`)}set ondblclick(e){G.set(this,`ondblclick`,e)}get ondrag(){return G.get(this,`ondrag`)}set ondrag(e){G.set(this,`ondrag`,e)}get ondragend(){return G.get(this,`ondragend`)}set ondragend(e){G.set(this,`ondragend`,e)}get ondragenter(){return G.get(this,`ondragenter`)}set ondragenter(e){G.set(this,`ondragenter`,e)}get ondragleave(){return G.get(this,`ondragleave`)}set ondragleave(e){G.set(this,`ondragleave`,e)}get ondragover(){return G.get(this,`ondragover`)}set ondragover(e){G.set(this,`ondragover`,e)}get ondragstart(){return G.get(this,`ondragstart`)}set ondragstart(e){G.set(this,`ondragstart`,e)}get ondrop(){return G.get(this,`ondrop`)}set ondrop(e){G.set(this,`ondrop`,e)}get ondurationchange(){return G.get(this,`ondurationchange`)}set ondurationchange(e){G.set(this,`ondurationchange`,e)}get onemptied(){return G.get(this,`onemptied`)}set onemptied(e){G.set(this,`onemptied`,e)}get onended(){return G.get(this,`onended`)}set onended(e){G.set(this,`onended`,e)}get onerror(){return G.get(this,`onerror`)}set onerror(e){G.set(this,`onerror`,e)}get onfocus(){return G.get(this,`onfocus`)}set onfocus(e){G.set(this,`onfocus`,e)}get oninput(){return G.get(this,`oninput`)}set oninput(e){G.set(this,`oninput`,e)}get oninvalid(){return G.get(this,`oninvalid`)}set oninvalid(e){G.set(this,`oninvalid`,e)}get onkeydown(){return G.get(this,`onkeydown`)}set onkeydown(e){G.set(this,`onkeydown`,e)}get onkeypress(){return G.get(this,`onkeypress`)}set onkeypress(e){G.set(this,`onkeypress`,e)}get onkeyup(){return G.get(this,`onkeyup`)}set onkeyup(e){G.set(this,`onkeyup`,e)}get onload(){return G.get(this,`onload`)}set onload(e){G.set(this,`onload`,e)}get onloadeddata(){return G.get(this,`onloadeddata`)}set onloadeddata(e){G.set(this,`onloadeddata`,e)}get onloadedmetadata(){return G.get(this,`onloadedmetadata`)}set onloadedmetadata(e){G.set(this,`onloadedmetadata`,e)}get onloadstart(){return G.get(this,`onloadstart`)}set onloadstart(e){G.set(this,`onloadstart`,e)}get onmousedown(){return G.get(this,`onmousedown`)}set onmousedown(e){G.set(this,`onmousedown`,e)}get onmouseenter(){return G.get(this,`onmouseenter`)}set onmouseenter(e){G.set(this,`onmouseenter`,e)}get onmouseleave(){return G.get(this,`onmouseleave`)}set onmouseleave(e){G.set(this,`onmouseleave`,e)}get onmousemove(){return G.get(this,`onmousemove`)}set onmousemove(e){G.set(this,`onmousemove`,e)}get onmouseout(){return G.get(this,`onmouseout`)}set onmouseout(e){G.set(this,`onmouseout`,e)}get onmouseover(){return G.get(this,`onmouseover`)}set onmouseover(e){G.set(this,`onmouseover`,e)}get onmouseup(){return G.get(this,`onmouseup`)}set onmouseup(e){G.set(this,`onmouseup`,e)}get onmousewheel(){return G.get(this,`onmousewheel`)}set onmousewheel(e){G.set(this,`onmousewheel`,e)}get onpause(){return G.get(this,`onpause`)}set onpause(e){G.set(this,`onpause`,e)}get onplay(){return G.get(this,`onplay`)}set onplay(e){G.set(this,`onplay`,e)}get onplaying(){return G.get(this,`onplaying`)}set onplaying(e){G.set(this,`onplaying`,e)}get onprogress(){return G.get(this,`onprogress`)}set onprogress(e){G.set(this,`onprogress`,e)}get onratechange(){return G.get(this,`onratechange`)}set onratechange(e){G.set(this,`onratechange`,e)}get onreset(){return G.get(this,`onreset`)}set onreset(e){G.set(this,`onreset`,e)}get onresize(){return G.get(this,`onresize`)}set onresize(e){G.set(this,`onresize`,e)}get onscroll(){return G.get(this,`onscroll`)}set onscroll(e){G.set(this,`onscroll`,e)}get onseeked(){return G.get(this,`onseeked`)}set onseeked(e){G.set(this,`onseeked`,e)}get onseeking(){return G.get(this,`onseeking`)}set onseeking(e){G.set(this,`onseeking`,e)}get onselect(){return G.get(this,`onselect`)}set onselect(e){G.set(this,`onselect`,e)}get onshow(){return G.get(this,`onshow`)}set onshow(e){G.set(this,`onshow`,e)}get onstalled(){return G.get(this,`onstalled`)}set onstalled(e){G.set(this,`onstalled`,e)}get onsubmit(){return G.get(this,`onsubmit`)}set onsubmit(e){G.set(this,`onsubmit`,e)}get onsuspend(){return G.get(this,`onsuspend`)}set onsuspend(e){G.set(this,`onsuspend`,e)}get ontimeupdate(){return G.get(this,`ontimeupdate`)}set ontimeupdate(e){G.set(this,`ontimeupdate`,e)}get ontoggle(){return G.get(this,`ontoggle`)}set ontoggle(e){G.set(this,`ontoggle`,e)}get onvolumechange(){return G.get(this,`onvolumechange`)}set onvolumechange(e){G.set(this,`onvolumechange`,e)}get onwaiting(){return G.get(this,`onwaiting`)}set onwaiting(e){G.set(this,`onwaiting`,e)}get onauxclick(){return G.get(this,`onauxclick`)}set onauxclick(e){G.set(this,`onauxclick`,e)}get ongotpointercapture(){return G.get(this,`ongotpointercapture`)}set ongotpointercapture(e){G.set(this,`ongotpointercapture`,e)}get onlostpointercapture(){return G.get(this,`onlostpointercapture`)}set onlostpointercapture(e){G.set(this,`onlostpointercapture`,e)}get onpointercancel(){return G.get(this,`onpointercancel`)}set onpointercancel(e){G.set(this,`onpointercancel`,e)}get onpointerdown(){return G.get(this,`onpointerdown`)}set onpointerdown(e){G.set(this,`onpointerdown`,e)}get onpointerenter(){return G.get(this,`onpointerenter`)}set onpointerenter(e){G.set(this,`onpointerenter`,e)}get onpointerleave(){return G.get(this,`onpointerleave`)}set onpointerleave(e){G.set(this,`onpointerleave`,e)}get onpointermove(){return G.get(this,`onpointermove`)}set onpointermove(e){G.set(this,`onpointermove`,e)}get onpointerout(){return G.get(this,`onpointerout`)}set onpointerout(e){G.set(this,`onpointerout`,e)}get onpointerover(){return G.get(this,`onpointerover`)}set onpointerover(e){G.set(this,`onpointerover`,e)}get onpointerup(){return G.get(this,`onpointerup`)}set onpointerup(e){G.set(this,`onpointerup`,e)}};const mp=`template`;var hp=class extends K{constructor(e){super(e,mp);let t=this.ownerDocument.createDocumentFragment();(this[Bi]=t)[Zi]=this}get content(){if(this.hasChildNodes()&&!this[Bi].hasChildNodes())for(let e of this.childNodes)this[Bi].appendChild(e.cloneNode(!0));return this[Bi]}};xc(mp,hp);var gp=class extends K{constructor(e,t=`html`){super(e,t)}};const{toString:_p}=K.prototype;var vp=class extends K{get innerHTML(){return this.textContent}set innerHTML(e){this.textContent=e}toString(){return _p.call(this.cloneNode()).replace(`><`,()=>`>${this.textContent}<`)}};const yp=`script`;var bp=class extends vp{constructor(e,t=yp){super(e,t)}get type(){return H.get(this,`type`)}set type(e){H.set(this,`type`,e)}get src(){return H.get(this,`src`)}set src(e){H.set(this,`src`,e)}get defer(){return Ic.get(this,`defer`)}set defer(e){Ic.set(this,`defer`,e)}get crossOrigin(){return H.get(this,`crossorigin`)}set crossOrigin(e){H.set(this,`crossorigin`,e)}get nomodule(){return Ic.get(this,`nomodule`)}set nomodule(e){Ic.set(this,`nomodule`,e)}get referrerPolicy(){return H.get(this,`referrerpolicy`)}set referrerPolicy(e){H.set(this,`referrerpolicy`,e)}get nonce(){return H.get(this,`nonce`)}set nonce(e){H.set(this,`nonce`,e)}get async(){return Ic.get(this,`async`)}set async(e){Ic.set(this,`async`,e)}get text(){return this.textContent}set text(e){this.textContent=e}};xc(yp,bp);var xp=class extends K{constructor(e,t=`frame`){super(e,t)}};const Sp=`iframe`;var Cp=class extends K{constructor(e,t=Sp){super(e,t)}
|
|
125
|
+
/* c8 ignore start */
|
|
126
|
+
get src(){return H.get(this,`src`)}set src(e){H.set(this,`src`,e)}get srcdoc(){return H.get(this,`srcdoc`)}set srcdoc(e){H.set(this,`srcdoc`,e)}get name(){return H.get(this,`name`)}set name(e){H.set(this,`name`,e)}get allow(){return H.get(this,`allow`)}set allow(e){H.set(this,`allow`,e)}get allowFullscreen(){return Ic.get(this,`allowfullscreen`)}set allowFullscreen(e){Ic.set(this,`allowfullscreen`,e)}get referrerPolicy(){return H.get(this,`referrerpolicy`)}set referrerPolicy(e){H.set(this,`referrerpolicy`,e)}get loading(){return H.get(this,`loading`)}set loading(e){H.set(this,`loading`,e)}};xc(Sp,Cp);var wp=class extends K{constructor(e,t=`object`){super(e,t)}},Tp=class extends K{constructor(e,t=`head`){super(e,t)}},Ep=class extends K{constructor(e,t=`body`){super(e,t)}},Dp=/* @__PURE__ */ o(((e,t)=>{var n={setup:function(e){var t=Object.create(this);if(e.globalObject&&t.CSSStyleSheet){var n=r(t.CSSStyleSheet)();n.prototype.__globalObject=e.globalObject,t.CSSStyleSheet=n}return t}};function r(e){return function(){var t=function(){return e.apply(this,arguments)};for(var n in Object.setPrototypeOf(t,Object.getPrototypeOf(e)),e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return e.prototype&&(t.prototype=Object.create(e.prototype)),t}}t.exports=n})),Op=/* @__PURE__ */ o((e=>{function t(e,t){return e.parentStyleSheet&&e.parentStyleSheet.__globalObject&&e.parentStyleSheet.__globalObject[t]?e.parentStyleSheet.__globalObject[t]:e.__parentStyleSheet&&e.__parentStyleSheet.__globalObject&&e.__parentStyleSheet.__globalObject[t]?e.__parentStyleSheet.__globalObject[t]:e.__globalObject&&e.__globalObject[t]?e.__globalObject[t]:typeof global<`u`&&global[t]||typeof window<`u`&&window[t]||(0,eval)(t)}function n(e,n,r,i){return new(t(e,n))(r,i)}function r(e,t,r,i){throw n(e,t,r,i)}function i(e,t,n,i,a){i||=1,a||=0,r(e,`TypeError`,`Failed to execute '`+t+`' on '`+n+`': `+i+` argument`+(i>1?`s`:``)+` required, but only `+a+` present.`)}function a(e,t,n,i,a){r(e,`DOMException`,`Failed to execute '`+t+`' on '`+n+`': Failed to parse the rule '`+i+`'.`,a||`SyntaxError`)}function o(e,t,n,i,a,o){r(e,`DOMException`,`Failed to execute '`+t+`' on '`+n+`': The index provided (`+i+`) is larger than the maximum index (`+a+`).`,o||`IndexSizeError`)}e.errorUtils={createError:n,getErrorConstructor:t,throwError:r,throwMissingArguments:i,throwParseError:a,throwIndexError:o}})),kp=/* @__PURE__ */ o((e=>{e.regexPatterns={atKeyframesRegExp:/@(-(?:\w+-)+)?keyframes/g,beforeRulePortionRegExp:/{(?!.*{)|}(?!.*})|;(?!.*;)|\*\/(?!.*\*\/)/g,beforeRuleValidationRegExp:/^[\s{};]*(\*\/\s*)?$/,forwardRuleValidationRegExp:/(?:\s|\/\*|\{|\()/,forwardImportRuleValidationRegExp:/(?:\s|\/\*|'|")/,forwardRuleClosingBraceRegExp:/{[^{}]*}|}/,forwardRuleSemicolonAndOpeningBraceRegExp:/^.*?({|;)/,cssCustomIdentifierRegExp:/^(-?[_a-zA-Z]+(\.[_a-zA-Z]+)*[_a-zA-Z0-9-]*)$/,startsWithCombinatorRegExp:/^\s*[>+~]/,atPageRuleSelectorRegExp:/^([^\s:]+)?((?::\w+)*)$/,layerRegExp:/layer\(([^)]*)\)/,layerRuleNameRegExp:/^(-?[_a-zA-Z]+(\.[_a-zA-Z]+)*[_a-zA-Z0-9-]*)$/,doubleOrMoreSpacesRegExp:/\s{2,}/g,startsWithHexEscapeRegExp:/^\\[0-9a-fA-F]/,identStartCharRegExp:/[a-zA-Z_\u00A0-\uFFFF]/,identCharRegExp:/^[a-zA-Z0-9_\-\u00A0-\uFFFF\\]/,specialCharsNeedEscapeRegExp:/[!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~\s]/,combinatorOrSeparatorRegExp:/[\s>+~,()]/,afterHexEscapeSeparatorRegExp:/[\s>+~,(){}\[\]]/,trailingSpaceSeparatorRegExp:/[\s>+~,(){}]/,endsWithHexEscapeRegExp:/\\[0-9a-fA-F]{1,6}\s+$/,basicStylePropertyValueValidationRegExp:/:(?![^(]*\))(?=(?:[^'"]|'[^']*'|"[^"]*")*$)/,attributeSelectorContentRegExp:/^([^\s=~|^$*]+)\s*(~=|\|=|\^=|\$=|\*=|=)\s*(.+)$/,pseudoElementRegExp:/::[a-zA-Z][\w-]*|:(before|after|first-line|first-letter)(?![a-zA-Z0-9_-])/,invalidCombinatorLtGtRegExp:/<>/,invalidCombinatorDoubleGtRegExp:/>>/,consecutiveCombinatorsRegExp:/[>+~]\s*[>+~]/,invalidSlottedRegExp:/(?:^|[\s>+~,\[])slotted\s*\(/i,invalidPartRegExp:/(?:^|[\s>+~,\[])part\s*\(/i,invalidCueRegExp:/(?:^|[\s>+~,\[])cue\s*\(/i,invalidCueRegionRegExp:/(?:^|[\s>+~,\[])cue-region\s*\(/i,invalidNestingPattern:/&(?![.\#\[:>\+~\s])[a-zA-Z]/,emptyPseudoClassRegExp:/:(?:is|not|where|has)\(\s*\)/,whitespaceNormalizationRegExp:/(['"])(?:\\.|[^\\])*?\1|(\r\n|\r|\n)/g,newlineRemovalRegExp:/\n/g,whitespaceAndDotRegExp:/[\s.]/,declarationOrOpenBraceRegExp:/[{;}]/,ampersandRegExp:/&/,hexEscapeSequenceRegExp:/^([0-9a-fA-F]{1,6})[ \t\r\n\f]?/,attributeCaseFlagRegExp:/^(.+?)\s+([is])$/i,prependedAmpersandRegExp:/^&\s+[:\\.]/,openBraceGlobalRegExp:/{/g,closeBraceGlobalRegExp:/}/g,scopePreludeSplitRegExp:/\s*\)\s*to\s+\(/,leadingWhitespaceRegExp:/^\s+/,doubleQuoteRegExp:/"/g,backslashRegExp:/\\/g,invalidMediaOperatorWithoutSpaceRegExp:/\)(and|or)\(/i,invalidMediaNotAfterOperatorRegExp:/\b(and|or)\s+not\b/i,invalidMediaNotIdentifierRegExp:/\)\s+not\(/i,invalidMediaNotAfterFeatureRegExp:/\)\s+not\s+/i,invalidMediaOperatorBetweenParensRegExp:/\)\s+(?!and\b|or\b)[a-z]+\s+\(/i,invalidMediaNotWithMediaTypeRegExp:/\bnot\s+[a-z][a-z0-9_-]*\s+\(/i,mediaFeatureColonRegExp:/(\(\s*)([^():]+):(\s*)([^()]*\))/g,identifierBeforeParenRegExp:/[a-z0-9_-]/i,mediaAndOperatorRegExp:/\s*\band\b\s*/gi,mediaOrOperatorRegExp:/\s*\bor\b\s*/gi,mediaNotOperatorStartRegExp:/^\s*not\s+(?=\S)/i,mediaNotOperatorRegExp:/\s+\bnot\s+(?=\S)/gi}})),Ap=/* @__PURE__ */ o((e=>{var t={};t.MediaList=function(){this.length=0},t.MediaList.prototype={constructor:t.MediaList,get mediaText(){return Array.prototype.join.call(this,`, `)},set mediaText(e){if(typeof e==`string`)for(var t=e.split(`,`).filter(function(e){return!!e}),n=this.length=t.length,r=0;r<n;r++)this[r]=t[r].trim();else if(e===null){for(var n=this.length,r=0;r<n;r++)delete this[r];this.length=0}},appendMedium:function(e){Array.prototype.indexOf.call(this,e)===-1&&(this[this.length]=e,this.length++)},deleteMedium:function(e){var t=Array.prototype.indexOf.call(this,e);t!==-1&&Array.prototype.splice.call(this,t,1)},item:function(e){return this[e]||null},toString:function(){return this.mediaText}},e.MediaList=t.MediaList})),jp=/* @__PURE__ */ o((e=>{var t={MediaList:Ap().MediaList};t.StyleSheet=function(){this.__href=null,this.__ownerNode=null,this.__title=null,this.__media=new t.MediaList,this.__parentStyleSheet=null,this.disabled=!1},Object.defineProperties(t.StyleSheet.prototype,{type:{get:function(){return`text/css`}},href:{get:function(){return this.__href}},ownerNode:{get:function(){return this.__ownerNode}},title:{get:function(){return this.__title}},media:{get:function(){return this.__media},set:function(e){typeof e==`string`?this.__media.mediaText=e:this.__media=e}},parentStyleSheet:{get:function(){return this.__parentStyleSheet}}}),e.StyleSheet=t.StyleSheet})),Mp=/* @__PURE__ */ o((e=>{var t={};t.CSSRuleList=function(){var e=[];return Object.setPrototypeOf(e,t.CSSRuleList.prototype),e},t.CSSRuleList.prototype=Object.create(Array.prototype),t.CSSRuleList.prototype.constructor=t.CSSRuleList,t.CSSRuleList.prototype.item=function(e){return this[e]||null},e.CSSRuleList=t.CSSRuleList})),Np=/* @__PURE__ */ o((e=>{var t={};t.CSSRule=function(){this.__parentRule=null,this.__parentStyleSheet=null},t.CSSRule.UNKNOWN_RULE=0,t.CSSRule.STYLE_RULE=1,t.CSSRule.CHARSET_RULE=2,t.CSSRule.IMPORT_RULE=3,t.CSSRule.MEDIA_RULE=4,t.CSSRule.FONT_FACE_RULE=5,t.CSSRule.PAGE_RULE=6,t.CSSRule.KEYFRAMES_RULE=7,t.CSSRule.KEYFRAME_RULE=8,t.CSSRule.MARGIN_RULE=9,t.CSSRule.NAMESPACE_RULE=10,t.CSSRule.COUNTER_STYLE_RULE=11,t.CSSRule.SUPPORTS_RULE=12,t.CSSRule.DOCUMENT_RULE=13,t.CSSRule.FONT_FEATURE_VALUES_RULE=14,t.CSSRule.VIEWPORT_RULE=15,t.CSSRule.REGION_STYLE_RULE=16,t.CSSRule.CONTAINER_RULE=17,t.CSSRule.LAYER_BLOCK_RULE=18,t.CSSRule.STARTING_STYLE_RULE=1002,Object.defineProperties(t.CSSRule.prototype,{constructor:{value:t.CSSRule},cssRule:{value:``,configurable:!0,enumerable:!0},cssText:{get:function(){return``},set:function(e){return e}},parentRule:{get:function(){return this.__parentRule}},parentStyleSheet:{get:function(){return this.__parentStyleSheet}},UNKNOWN_RULE:{value:0,enumerable:!0},STYLE_RULE:{value:1,enumerable:!0},CHARSET_RULE:{value:2,enumerable:!0},IMPORT_RULE:{value:3,enumerable:!0},MEDIA_RULE:{value:4,enumerable:!0},FONT_FACE_RULE:{value:5,enumerable:!0},PAGE_RULE:{value:6,enumerable:!0},KEYFRAMES_RULE:{value:7,enumerable:!0},KEYFRAME_RULE:{value:8,enumerable:!0},MARGIN_RULE:{value:9,enumerable:!0},NAMESPACE_RULE:{value:10,enumerable:!0},COUNTER_STYLE_RULE:{value:11,enumerable:!0},SUPPORTS_RULE:{value:12,enumerable:!0},DOCUMENT_RULE:{value:13,enumerable:!0},FONT_FEATURE_VALUES_RULE:{value:14,enumerable:!0},VIEWPORT_RULE:{value:15,enumerable:!0},REGION_STYLE_RULE:{value:16,enumerable:!0},CONTAINER_RULE:{value:17,enumerable:!0},LAYER_BLOCK_RULE:{value:18,enumerable:!0},STARTING_STYLE_RULE:{value:1002,enumerable:!0}}),e.CSSRule=t.CSSRule})),Pp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,parse:om().parse},n=Op().errorUtils;t.CSSGroupingRule=function(){t.CSSRule.call(this),this.__cssRules=new t.CSSRuleList},t.CSSGroupingRule.prototype=Object.create(t.CSSRule.prototype),t.CSSGroupingRule.prototype.constructor=t.CSSGroupingRule,Object.setPrototypeOf(t.CSSGroupingRule,t.CSSRule),Object.defineProperty(t.CSSGroupingRule.prototype,"cssRules",{get:function(){return this.__cssRules}}),t.CSSGroupingRule.prototype.insertRule=function(e,r){e===void 0&&r===void 0&&n.throwMissingArguments(this,`insertRule`,this.constructor.name),r===void 0&&(r=0),r=Number(r),r<0&&(r=4294967296+r),r>this.cssRules.length&&n.throwIndexError(this,`insertRule`,this.constructor.name,r,this.cssRules.length);var i=processedRuleToParse=String(e);i=i.trim().replace(/^\/\*[\s\S]*?\*\/\s*/,``);var a=this.constructor.name===`CSSStyleRule`;if(a===!1){for(var o=this;o.parentRule;)if(o=o.parentRule,o.constructor.name===`CSSStyleRule`){a=!0;break}}a&&(processedRuleToParse=`s { n { } `+i+`}`);var s=this.constructor.name===`CSSScopeRule`;s&&(processedRuleToParse=a?`s { @scope {`+i+`}}`:`@scope {`+i+`}`);var c=new t.CSSRuleList;t.parse(processedRuleToParse,{styleSheet:this.parentStyleSheet,cssRules:c}),s&&(c=a?c[0].cssRules[0].cssRules:c[0].cssRules),a&&(c=c[0].cssRules.slice(1)),c.length!==1&&(a&&c.length===0&&i.indexOf(`@font-face`)===0?n.throwError(this,`DOMException`,`Failed to execute 'insertRule' on '`+this.constructor.name+`': Only conditional nested group rules, style rules, @scope rules, @apply rules, and nested declaration rules may be nested.`,`HierarchyRequestError`):n.throwParseError(this,`insertRule`,this.constructor.name,i,`SyntaxError`));var l=c[0];if(l.constructor.name===`CSSNestedDeclarations`&&l.style.length===0&&n.throwParseError(this,`insertRule`,this.constructor.name,i,`SyntaxError`),l.constructor.name===`CSSImportRule`||l.constructor.name===`CSSNamespaceRule`){var u=l.constructor.name===`CSSImportRule`?`@import`:`@namespace`;n.throwError(this,`DOMException`,`Failed to execute 'insertRule' on '`+this.constructor.name+`': '`+u+`' rules cannot be inserted inside a group rule.`,`HierarchyRequestError`)}return l.constructor.name===`CSSLayerStatementRule`&&n.throwParseError(this,`insertRule`,this.constructor.name,i,`SyntaxError`),l.__parentRule=this,this.cssRules.splice(r,0,l),r},t.CSSGroupingRule.prototype.deleteRule=function(e){e===void 0&&n.throwMissingArguments(this,`deleteRule`,this.constructor.name),e=Number(e),e<0&&(e=4294967296+e),e>=this.cssRules.length&&n.throwIndexError(this,`deleteRule`,this.constructor.name,e,this.cssRules.length),this.cssRules[e].__parentRule=null,this.cssRules[e].__parentStyleSheet=null,this.cssRules.splice(e,1)},e.CSSGroupingRule=t.CSSGroupingRule})),Fp=/* @__PURE__ */ o((e=>{var t={CSSStyleDeclaration:sm().CSSStyleDeclaration,CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,CSSGroupingRule:Pp().CSSGroupingRule},n=kp().regexPatterns;try{t.CSSStyleDeclaration=require("cssstyle").CSSStyleDeclaration}catch{}t.CSSStyleRule=function(){t.CSSGroupingRule.call(this),this.__selectorText=``,this.__style=new t.CSSStyleDeclaration,this.__style.parentRule=this},t.CSSStyleRule.prototype=Object.create(t.CSSGroupingRule.prototype),t.CSSStyleRule.prototype.constructor=t.CSSStyleRule,Object.setPrototypeOf(t.CSSStyleRule,t.CSSGroupingRule),Object.defineProperty(t.CSSStyleRule.prototype,"type",{value:1,writable:!1}),Object.defineProperty(t.CSSStyleRule.prototype,"selectorText",{get:function(){return this.__selectorText},set:function(e){if(typeof e==`string`){var t=n.endsWithHexEscapeRegExp.test(e)?e.replace(/\s+$/,` `).trimStart():e.trim();if(t===``)return;this.__selectorText=t}},configurable:!0}),Object.defineProperty(t.CSSStyleRule.prototype,"style",{get:function(){return this.__style},set:function(e){typeof e==`string`?this.__style.cssText=e:this.__style=e},configurable:!0}),Object.defineProperty(t.CSSStyleRule.prototype,"cssText",{get:function(){var e;if(this.selectorText){var t=``;if(this.cssRules.length){var n=[` {`];this.style.cssText&&n.push(this.style.cssText),n.push(this.cssRules.reduce(function(e,t){return t.cssText!==``&&e.push(t.cssText),e},[]).join(`
|
|
127
|
+
`)),t=n.join(`
|
|
128
|
+
`)+`
|
|
129
|
+
}`}else t=` {`+(this.style.cssText?` `+this.style.cssText:``)+` }`;e=this.selectorText+t}else e=``;return e}}),e.CSSStyleRule=t.CSSStyleRule})),Ip=/* @__PURE__ */ o((e=>{var t={MediaList:Ap().MediaList,StyleSheet:jp().StyleSheet,CSSRuleList:Mp().CSSRuleList,CSSStyleRule:Fp().CSSStyleRule},n=Op().errorUtils;t.CSSStyleSheet=function(e){t.StyleSheet.call(this),this.__constructed=!0,this.__cssRules=new t.CSSRuleList,this.__ownerRule=null,e&&typeof e==`object`&&(e.baseURL&&typeof e.baseURL==`string`&&(this.__baseURL=e.baseURL),e.media&&typeof e.media==`string`&&(this.media.mediaText=e.media),typeof e.disabled==`boolean`&&(this.disabled=e.disabled))},t.CSSStyleSheet.prototype=Object.create(t.StyleSheet.prototype),t.CSSStyleSheet.prototype.constructor=t.CSSStyleSheet,Object.setPrototypeOf(t.CSSStyleSheet,t.StyleSheet),Object.defineProperty(t.CSSStyleSheet.prototype,"cssRules",{get:function(){return this.__cssRules}}),Object.defineProperty(t.CSSStyleSheet.prototype,"rules",{get:function(){return this.__cssRules}}),Object.defineProperty(t.CSSStyleSheet.prototype,"ownerRule",{get:function(){return this.__ownerRule}}),t.CSSStyleSheet.prototype.insertRule=function(e,r){e===void 0&&r===void 0&&n.throwMissingArguments(this,`insertRule`,this.constructor.name),r===void 0&&(r=0),r=Number(r),r<0&&(r=4294967296+r),r>this.cssRules.length&&n.throwIndexError(this,`insertRule`,this.constructor.name,r,this.cssRules.length);var i=String(e),a=[],o=t.parse(i,void 0,function(e){a.push(e)});o.cssRules.length!==1&&n.throwParseError(this,`insertRule`,this.constructor.name,i,`SyntaxError`);var s=o.cssRules[0];function c(e,t){for(var n=0;n<e.length;n++)if(t.indexOf(e[n].constructor.name)===-1)return n;return e.length}if(s.constructor.name===`CSSImportRule`){this.__constructed===!0&&n.throwError(this,`DOMException`,`Failed to execute 'insertRule' on '`+this.constructor.name+`': Can't insert @import rules into a constructed stylesheet.`,`SyntaxError`);var l=c(this.cssRules,[`CSSImportRule`]);l<this.cssRules.length&&this.cssRules[l].constructor.name===`CSSLayerStatementRule`&&r>l&&n.throwError(this,`DOMException`,`Failed to execute 'insertRule' on '`+this.constructor.name+`': Failed to insert the rule.`,`HierarchyRequestError`);var u=c(this.cssRules,[`CSSImportRule`]);r>u&&u<this.cssRules.length&&this.cssRules[u].constructor.name!==`CSSLayerStatementRule`&&n.throwError(this,`DOMException`,`Failed to execute 'insertRule' on '`+this.constructor.name+`': Failed to insert the rule.`,`HierarchyRequestError`)}else if(s.constructor.name===`CSSNamespaceRule`){for(var d=-1,f=0;f<this.cssRules.length;f++)if(this.cssRules[f].constructor.name===`CSSImportRule`){d=f;break}var p=c(this.cssRules,[`CSSLayerStatementRule`,`CSSImportRule`,`CSSNamespaceRule`]);d!==-1&&r<=d&&n.throwError(this,`DOMException`,`Failed to execute 'insertRule' on '`+this.constructor.name+`': Failed to insert the rule.`,`HierarchyRequestError`),p<this.cssRules.length&&n.throwError(this,`DOMException`,`Failed to execute 'insertRule' on '`+this.constructor.name+`': Failed to insert the rule.`,`InvalidStateError`),r>p&&n.throwError(this,`DOMException`,`Failed to execute 'insertRule' on '`+this.constructor.name+`': Failed to insert the rule.`,`HierarchyRequestError`)}else if(s.constructor.name!==`CSSLayerStatementRule`){var m=c(this.cssRules,[`CSSLayerStatementRule`,`CSSImportRule`,`CSSNamespaceRule`]);r<m&&n.throwError(this,`DOMException`,`Failed to execute 'insertRule' on '`+this.constructor.name+`': Failed to insert the rule.`,`HierarchyRequestError`),a.filter(function(e){return!e.isNested}).length!==0&&n.throwParseError(this,`insertRule`,this.constructor.name,i,`SyntaxError`)}return s.__parentStyleSheet=this,this.cssRules.splice(r,0,s),r},t.CSSStyleSheet.prototype.addRule=function(e,t,n){return n===void 0&&(n=this.cssRules.length),this.insertRule(e+`{`+t+`}`,n),-1},t.CSSStyleSheet.prototype.deleteRule=function(e){e===void 0&&n.throwMissingArguments(this,`deleteRule`,this.constructor.name),e=Number(e),e<0&&(e=4294967296+e),e>=this.cssRules.length&&n.throwIndexError(this,`deleteRule`,this.constructor.name,e,this.cssRules.length),this.cssRules[e]&&(this.cssRules[e].constructor.name==`CSSNamespaceRule`&&(this.cssRules.every(function(e){return[`CSSImportRule`,`CSSLayerStatementRule`,`CSSNamespaceRule`].indexOf(e.constructor.name)!==-1})||n.throwError(this,`DOMException`,`Failed to execute 'deleteRule' on '`+this.constructor.name+`': Failed to delete rule.`,`InvalidStateError`)),this.cssRules[e].constructor.name==`CSSImportRule`&&(this.cssRules[e].styleSheet.__parentStyleSheet=null),this.cssRules[e].__parentStyleSheet=null),this.cssRules.splice(e,1)},t.CSSStyleSheet.prototype.removeRule=function(e){e===void 0&&(e=0),this.deleteRule(e)},t.CSSStyleSheet.prototype.replace=function(e){var r=this.__globalObject&&this.__globalObject.Promise?this.__globalObject.Promise:Promise,i=this.__globalObject&&this.__globalObject.setTimeout?this.__globalObject.setTimeout:setTimeout,a=this;return new r(function(r,o){(!a.__constructed||a.__disallowModification)&&o(n.createError(a,`DOMException`,`Failed to execute 'replaceSync' on '`+a.constructor.name+`': Not allowed.`,`NotAllowedError`)),a.__disallowModification=!0,i(function(){var n=new t.CSSRuleList;t.parse(e,{styleSheet:a,cssRules:n});for(var i=0;i<n.length;)n[i].constructor.name===`CSSImportRule`?n.splice(i,1):i++;a.__cssRules.splice.apply(a.__cssRules,[0,a.__cssRules.length].concat(n)),delete a.__disallowModification,r(a)})})},t.CSSStyleSheet.prototype.replaceSync=function(e){var r=this;(!r.__constructed||r.__disallowModification)&&n.throwError(r,`DOMException`,`Failed to execute 'replaceSync' on '`+r.constructor.name+`': Not allowed.`,`NotAllowedError`);var i=new t.CSSRuleList;t.parse(e,{styleSheet:r,cssRules:i});for(var a=0;a<i.length;)i[a].constructor.name===`CSSImportRule`?i.splice(a,1):a++;r.__cssRules.splice.apply(r.__cssRules,[0,r.__cssRules.length].concat(i))},t.CSSStyleSheet.prototype.toString=function(){for(var e=``,t=this.cssRules,n=0;n<t.length;n++)e+=t[n].cssText+`
|
|
130
|
+
`;return e},e.CSSStyleSheet=t.CSSStyleSheet,t.parse=om().parse})),Lp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSStyleDeclaration:sm().CSSStyleDeclaration};try{t.CSSStyleDeclaration=require("cssstyle").CSSStyleDeclaration}catch{}t.CSSNestedDeclarations=function(){t.CSSRule.call(this),this.__style=new t.CSSStyleDeclaration,this.__style.parentRule=this},t.CSSNestedDeclarations.prototype=Object.create(t.CSSRule.prototype),t.CSSNestedDeclarations.prototype.constructor=t.CSSNestedDeclarations,Object.setPrototypeOf(t.CSSNestedDeclarations,t.CSSRule),Object.defineProperty(t.CSSNestedDeclarations.prototype,"type",{value:0,writable:!1}),Object.defineProperty(t.CSSNestedDeclarations.prototype,"style",{get:function(){return this.__style},set:function(e){typeof e==`string`?this.__style.cssText=e:this.__style=e}}),Object.defineProperty(t.CSSNestedDeclarations.prototype,"cssText",{get:function(){return this.style.cssText}}),e.CSSNestedDeclarations=t.CSSNestedDeclarations})),Rp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSStyleSheet:Ip().CSSStyleSheet,MediaList:Ap().MediaList},n=kp().regexPatterns;t.CSSImportRule=function(){t.CSSRule.call(this),this.__href=``,this.__media=new t.MediaList,this.__layerName=null,this.__supportsText=null,this.__styleSheet=new t.CSSStyleSheet},t.CSSImportRule.prototype=Object.create(t.CSSRule.prototype),t.CSSImportRule.prototype.constructor=t.CSSImportRule,Object.setPrototypeOf(t.CSSImportRule,t.CSSRule),Object.defineProperty(t.CSSImportRule.prototype,"type",{value:3,writable:!1}),Object.defineProperty(t.CSSImportRule.prototype,"cssText",{get:function(){var e=this.media.mediaText;return`@import url("`+this.href.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)+`")`+(this.layerName===null?``:` layer`+(this.layerName&&`(`+this.layerName+`)`))+(this.supportsText?` supports(`+this.supportsText+`)`:``)+(e?` `+e:``)+`;`}}),Object.defineProperty(t.CSSImportRule.prototype,"href",{get:function(){return this.__href}}),Object.defineProperty(t.CSSImportRule.prototype,"media",{get:function(){return this.__media},set:function(e){typeof e==`string`?this.__media.mediaText=e:this.__media=e}}),Object.defineProperty(t.CSSImportRule.prototype,"layerName",{get:function(){return this.__layerName}}),Object.defineProperty(t.CSSImportRule.prototype,"supportsText",{get:function(){return this.__supportsText}}),Object.defineProperty(t.CSSImportRule.prototype,"styleSheet",{get:function(){return this.__styleSheet}}),Object.defineProperty(t.CSSImportRule.prototype,"parse",{value:function(e){var t=0,r=``,i=``,a,o=n.layerRegExp,s=n.layerRuleNameRegExp,c=n.doubleOrMoreSpacesRegExp;function l(e){var t=e.indexOf(`supports(`);if(t!==0)return null;for(var n=0,r=t+9,i=r;i<e.length;i++)if(e[i]===`(`)n++;else if(e[i]===`)`){if(n===0)return{content:e.slice(r,i),endIndex:i};n--}return null}for(var u;u=e.charAt(t);t++)switch(u){case` `:case` `:case`\r`:case`
|
|
131
|
+
`:case`\f`:r===`after-import`?r=`url`:i+=u;break;case`@`:!r&&e.indexOf(`@import`,t)===t&&(r=`after-import`,t+=6,i=``);break;case`u`:if(r===`media`&&(i+=u),r===`url`&&e.indexOf(`url(`,t)===t){if(a=e.indexOf(`)`,t+1),a===-1)throw t+`: ")" not found`;t+=4;var d=e.slice(t,a);d[0]===d[d.length-1]&&(d[0]===`"`||d[0]===`'`)&&(d=d.slice(1,-1)),this.__href=d,t=a,r=`media`}break;case`"`:if(r===`after-import`||r===`url`){if(a=e.indexOf(`"`,t+1),!a)throw t+`: '"' not found`;this.__href=e.slice(t+1,a),t=a,r=`media`}break;case`'`:if(r===`after-import`||r===`url`){if(a=e.indexOf(`'`,t+1),!a)throw t+`: "'" not found`;this.__href=e.slice(t+1,a),t=a,r=`media`}break;case`;`:if(r===`media`&&i){var f=i.trim();if(f.indexOf(`layer`)===0){var p=f.match(o);if(p){if(p[1].trim().match(s)!==null)this.__layerName=p[1].trim(),f=f.replace(o,``).replace(c,` `).trim();else if(f){this.media.mediaText=f;return}}else this.__layerName=``,f=f.substring(5).trim()}var m=l(f);m&&(this.__supportsText=m.content.trim(),f=f.slice(0,0)+f.slice(m.endIndex+1),f=f.replace(c,` `).trim()),f&&(this.media.mediaText=f)}break;default:r===`media`&&(i+=u)}}}),e.CSSImportRule=t.CSSImportRule})),zp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSStyleSheet:Ip().CSSStyleSheet};t.CSSNamespaceRule=function(){t.CSSRule.call(this),this.__prefix=``,this.__namespaceURI=``},t.CSSNamespaceRule.prototype=Object.create(t.CSSRule.prototype),t.CSSNamespaceRule.prototype.constructor=t.CSSNamespaceRule,Object.setPrototypeOf(t.CSSNamespaceRule,t.CSSRule),Object.defineProperty(t.CSSNamespaceRule.prototype,"type",{value:10,writable:!1}),Object.defineProperty(t.CSSNamespaceRule.prototype,"cssText",{get:function(){return`@namespace`+(this.prefix&&` `+this.prefix)+` url("`+this.namespaceURI+`");`}}),Object.defineProperty(t.CSSNamespaceRule.prototype,"prefix",{get:function(){return this.__prefix}}),Object.defineProperty(t.CSSNamespaceRule.prototype,"namespaceURI",{get:function(){return this.__namespaceURI}}),Object.defineProperty(t.CSSNamespaceRule.prototype,"parse",{value:function(e){var t=``,n=``,r=e.trim();r.indexOf(`@namespace`)===0&&(r=r.slice(10).trim()),r.charAt(r.length-1)===`;`&&(r=r.slice(0,-1).trim());var i=r.match(/^(?:([a-zA-Z_][a-zA-Z0-9_-]*)\s+)?(?:url\(\s*(?:(['"])(.*?)\2\s*|([^)]*?))\s*\)|(['"])(.*?)\5)$/);if(i)i[1]&&(t=i[1]),i[3]===void 0?i[4]===void 0?i[6]!==void 0&&(n=i[6]):n=i[4].trim():n=i[3],this.__prefix=t,this.__namespaceURI=n;else throw new DOMException(`Invalid @namespace rule`,`InvalidStateError`)}}),e.CSSNamespaceRule=t.CSSNamespaceRule})),Bp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,CSSGroupingRule:Pp().CSSGroupingRule};t.CSSConditionRule=function(){t.CSSGroupingRule.call(this),this.__conditionText=``},t.CSSConditionRule.prototype=Object.create(t.CSSGroupingRule.prototype),t.CSSConditionRule.prototype.constructor=t.CSSConditionRule,Object.setPrototypeOf(t.CSSConditionRule,t.CSSGroupingRule),Object.defineProperty(t.CSSConditionRule.prototype,"conditionText",{get:function(){return this.__conditionText}}),e.CSSConditionRule=t.CSSConditionRule})),Vp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,CSSGroupingRule:Pp().CSSGroupingRule,CSSConditionRule:Bp().CSSConditionRule,MediaList:Ap().MediaList};t.CSSMediaRule=function(){t.CSSConditionRule.call(this),this.__media=new t.MediaList},t.CSSMediaRule.prototype=Object.create(t.CSSConditionRule.prototype),t.CSSMediaRule.prototype.constructor=t.CSSMediaRule,Object.setPrototypeOf(t.CSSMediaRule,t.CSSConditionRule),Object.defineProperty(t.CSSMediaRule.prototype,"type",{value:4,writable:!1}),Object.defineProperties(t.CSSMediaRule.prototype,{media:{get:function(){return this.__media},set:function(e){typeof e==`string`?this.__media.mediaText=e:this.__media=e},configurable:!0,enumerable:!0},conditionText:{get:function(){return this.media.mediaText}},cssText:{get:function(){var e=``,t=[` {`];return this.cssRules.length&&t.push(this.cssRules.reduce(function(e,t){return t.cssText!==``&&e.push(t.cssText),e},[]).join(`
|
|
132
|
+
`)),e=t.join(`
|
|
133
|
+
`)+`
|
|
134
|
+
}`,`@media `+this.media.mediaText+e}}}),e.CSSMediaRule=t.CSSMediaRule})),Hp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule};t.CSSCounterStyleRule=function(){t.CSSRule.call(this),this.name=``,this.__props=``},t.CSSCounterStyleRule.prototype=Object.create(t.CSSRule.prototype),t.CSSCounterStyleRule.prototype.constructor=t.CSSCounterStyleRule,Object.setPrototypeOf(t.CSSCounterStyleRule,t.CSSRule),Object.defineProperty(t.CSSCounterStyleRule.prototype,"type",{value:11,writable:!1}),Object.defineProperty(t.CSSCounterStyleRule.prototype,"cssText",{get:function(){return`@counter-style `+this.name+` { `+this.__props+` }`}}),Object.defineProperty(t.CSSCounterStyleRule.prototype,"parse",{value:function(e){var t=e.match(/@counter-style\s+([^\s{]+)\s*\{([^]*)\}/);if(t){this.name=t[1];var n=t[2];this.__props=n.trim().replace(/\n/g,` `).replace(/(['"])(?:\\.|[^\\])*?\1|(\s{2,})/g,function(e,t){return t?e:` `})}}}),e.CSSCounterStyleRule=t.CSSCounterStyleRule})),Up=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule};t.CSSPropertyRule=function(){t.CSSRule.call(this),this.__name=``,this.__syntax=``,this.__inherits=!1,this.__initialValue=null},t.CSSPropertyRule.prototype=Object.create(t.CSSRule.prototype),t.CSSPropertyRule.prototype.constructor=t.CSSPropertyRule,Object.setPrototypeOf(t.CSSPropertyRule,t.CSSRule),Object.defineProperty(t.CSSPropertyRule.prototype,"type",{value:0,writable:!1}),Object.defineProperty(t.CSSPropertyRule.prototype,"cssText",{get:function(){var e=`@property `+this.name+` {`;return this.syntax!==``&&(e+=` syntax: "`+this.syntax.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)+`";`),e+=` inherits: `+(this.inherits?`true`:`false`)+`;`,this.initialValue!==null&&(e+=` initial-value: `+this.initialValue+`;`),e+=` }`,e}}),Object.defineProperty(t.CSSPropertyRule.prototype,"name",{get:function(){return this.__name}}),Object.defineProperty(t.CSSPropertyRule.prototype,"syntax",{get:function(){return this.__syntax}}),Object.defineProperty(t.CSSPropertyRule.prototype,"inherits",{get:function(){return this.__inherits}}),Object.defineProperty(t.CSSPropertyRule.prototype,"initialValue",{get:function(){return this.__initialValue}}),Object.defineProperty(t.CSSPropertyRule.prototype,"parse",{value:function(e){var t=e.match(/@property\s+(--[^\s{]+)\s*\{([^]*)\}/);if(!t)return!1;this.__name=t[1];var n=t[2],r=n.match(/syntax\s*:\s*(['"])([^]*?)\1\s*;/);if(!r||(this.__syntax=r[2],this.__syntax===``))return!1;var i=n.match(/inherits\s*:\s*(true|false)\s*;/);if(!i)return!1;this.__inherits=i[1]===`true`;var a=n.match(/initial-value\s*:\s*([^;]+);/);if(a)this.__initialValue=a[1].trim();else if(this.__syntax!==`*`)return!1;return!0}}),e.CSSPropertyRule=t.CSSPropertyRule})),Wp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,CSSGroupingRule:Pp().CSSGroupingRule,CSSConditionRule:Bp().CSSConditionRule};t.CSSContainerRule=function(){t.CSSConditionRule.call(this)},t.CSSContainerRule.prototype=Object.create(t.CSSConditionRule.prototype),t.CSSContainerRule.prototype.constructor=t.CSSContainerRule,Object.setPrototypeOf(t.CSSContainerRule,t.CSSConditionRule),Object.defineProperty(t.CSSContainerRule.prototype,"type",{value:17,writable:!1}),Object.defineProperties(t.CSSContainerRule.prototype,{cssText:{get:function(){var e=``,t=[` {`];return this.cssRules.length&&t.push(this.cssRules.reduce(function(e,t){return t.cssText!==``&&e.push(t.cssText),e},[]).join(`
|
|
135
|
+
`)),e=t.join(`
|
|
136
|
+
`)+`
|
|
137
|
+
}`,`@container `+this.conditionText+e}},containerName:{get:function(){var e=this.conditionText.trim().split(/\s+/);return e.length>1&&e[0]!==`(`&&!e[0].startsWith(`(`)?e[0]:``}},containerQuery:{get:function(){var e=this.conditionText.trim().split(/\s+/);return e.length>1&&e[0]!==`(`&&!e[0].startsWith(`(`)?e.slice(1).join(` `):this.conditionText}}}),e.CSSContainerRule=t.CSSContainerRule})),Gp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,CSSGroupingRule:Pp().CSSGroupingRule,CSSConditionRule:Bp().CSSConditionRule};t.CSSSupportsRule=function(){t.CSSConditionRule.call(this)},t.CSSSupportsRule.prototype=Object.create(t.CSSConditionRule.prototype),t.CSSSupportsRule.prototype.constructor=t.CSSSupportsRule,Object.setPrototypeOf(t.CSSSupportsRule,t.CSSConditionRule),Object.defineProperty(t.CSSSupportsRule.prototype,"type",{value:12,writable:!1}),Object.defineProperty(t.CSSSupportsRule.prototype,"cssText",{get:function(){var e=``,t=[` {`];return this.cssRules.length&&t.push(this.cssRules.reduce(function(e,t){return t.cssText!==``&&e.push(t.cssText),e},[]).join(`
|
|
138
|
+
`)),e=t.join(`
|
|
139
|
+
`)+`
|
|
140
|
+
}`,`@supports `+this.conditionText+e}}),e.CSSSupportsRule=t.CSSSupportsRule})),Kp=/* @__PURE__ */ o((e=>{var t={CSSStyleDeclaration:sm().CSSStyleDeclaration,CSSRule:Np().CSSRule};try{t.CSSStyleDeclaration=require("cssstyle").CSSStyleDeclaration}catch{}t.CSSFontFaceRule=function(){t.CSSRule.call(this),this.__style=new t.CSSStyleDeclaration,this.__style.parentRule=this},t.CSSFontFaceRule.prototype=Object.create(t.CSSRule.prototype),t.CSSFontFaceRule.prototype.constructor=t.CSSFontFaceRule,Object.setPrototypeOf(t.CSSFontFaceRule,t.CSSRule),Object.defineProperty(t.CSSFontFaceRule.prototype,"type",{value:5,writable:!1}),Object.defineProperty(t.CSSFontFaceRule.prototype,"style",{get:function(){return this.__style},set:function(e){typeof e==`string`?this.__style.cssText=e:this.__style=e}}),Object.defineProperty(t.CSSFontFaceRule.prototype,"cssText",{get:function(){return`@font-face {`+(this.style.cssText?` `+this.style.cssText:``)+` }`}}),e.CSSFontFaceRule=t.CSSFontFaceRule})),qp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList};t.CSSHostRule=function(){t.CSSRule.call(this),this.cssRules=new t.CSSRuleList},t.CSSHostRule.prototype=Object.create(t.CSSRule.prototype),t.CSSHostRule.prototype.constructor=t.CSSHostRule,Object.setPrototypeOf(t.CSSHostRule,t.CSSRule),Object.defineProperty(t.CSSHostRule.prototype,"type",{value:1001,writable:!1}),Object.defineProperty(t.CSSHostRule.prototype,"cssText",{get:function(){var e=``,t=[` {`];return this.cssRules.length&&t.push(this.cssRules.reduce(function(e,t){return t.cssText!==``&&e.push(t.cssText),e},[]).join(`
|
|
141
|
+
`)),e=t.join(`
|
|
142
|
+
`)+`
|
|
143
|
+
}`,`@host`+e}}),e.CSSHostRule=t.CSSHostRule})),Jp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,CSSGroupingRule:Pp().CSSGroupingRule};t.CSSStartingStyleRule=function(){t.CSSGroupingRule.call(this)},t.CSSStartingStyleRule.prototype=Object.create(t.CSSGroupingRule.prototype),t.CSSStartingStyleRule.prototype.constructor=t.CSSStartingStyleRule,Object.setPrototypeOf(t.CSSStartingStyleRule,t.CSSGroupingRule),Object.defineProperty(t.CSSStartingStyleRule.prototype,"type",{value:1002,writable:!1}),Object.defineProperty(t.CSSStartingStyleRule.prototype,"cssText",{get:function(){var e=``,t=[` {`];return this.cssRules.length&&t.push(this.cssRules.reduce(function(e,t){return t.cssText!==``&&e.push(t.cssText),e},[]).join(`
|
|
144
|
+
`)),e=t.join(`
|
|
145
|
+
`)+`
|
|
146
|
+
}`,`@starting-style`+e}}),e.CSSStartingStyleRule=t.CSSStartingStyleRule})),Yp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSStyleDeclaration:sm().CSSStyleDeclaration};try{t.CSSStyleDeclaration=require("cssstyle").CSSStyleDeclaration}catch{}t.CSSKeyframeRule=function(){t.CSSRule.call(this),this.keyText=``,this.__style=new t.CSSStyleDeclaration,this.__style.parentRule=this},t.CSSKeyframeRule.prototype=Object.create(t.CSSRule.prototype),t.CSSKeyframeRule.prototype.constructor=t.CSSKeyframeRule,Object.setPrototypeOf(t.CSSKeyframeRule,t.CSSRule),Object.defineProperty(t.CSSKeyframeRule.prototype,"type",{value:8,writable:!1}),Object.defineProperty(t.CSSKeyframeRule.prototype,"style",{get:function(){return this.__style},set:function(e){typeof e==`string`?this.__style.cssText=e:this.__style=e}}),Object.defineProperty(t.CSSKeyframeRule.prototype,"cssText",{get:function(){return this.keyText+` {`+(this.style.cssText?` `+this.style.cssText:``)+` }`}}),e.CSSKeyframeRule=t.CSSKeyframeRule})),Xp=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,parse:om().parse},n=Op().errorUtils;t.CSSKeyframesRule=function(){t.CSSRule.call(this),this.name=``,this.cssRules=new t.CSSRuleList,this._setupIndexedAccess();var e=this,n=this.cssRules.push,r=this.cssRules.splice;Object.defineProperty(this.cssRules,"push",{value:function(){var t=n.apply(this,arguments);return e._setupIndexedAccess(),t},writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(this.cssRules,"splice",{value:function(){var t=r.apply(this,arguments);return e._setupIndexedAccess(),t},writable:!0,enumerable:!1,configurable:!0})},t.CSSKeyframesRule.prototype=Object.create(t.CSSRule.prototype),t.CSSKeyframesRule.prototype.constructor=t.CSSKeyframesRule,Object.setPrototypeOf(t.CSSKeyframesRule,t.CSSRule),Object.defineProperty(t.CSSKeyframesRule.prototype,"type",{value:7,writable:!1}),Object.defineProperty(t.CSSKeyframesRule.prototype,"cssText",{get:function(){var e=``,t=[` {`];this.cssRules.length&&t.push(this.cssRules.reduce(function(e,t){return t.cssText!==``&&e.push(t.cssText),e},[]).join(`
|
|
147
|
+
`)),e=t.join(`
|
|
148
|
+
`)+`
|
|
149
|
+
}`;var n=[`initial`,`inherit`,`revert`,`revert-layer`,`unset`,`none`].includes(this.name)?`"`+this.name+`"`:this.name;return`@`+(this._vendorPrefix||``)+`keyframes `+n+e}}),t.CSSKeyframesRule.prototype.appendRule=function(e){arguments.length===0&&n.throwMissingArguments(this,`appendRule`,`CSSKeyframesRule`);var r;try{var i=t.parse(`@keyframes temp { `+e+` }`);if(i.cssRules.length>0&&i.cssRules[0].cssRules.length>0)r=i.cssRules[0].cssRules[0];else throw Error(`Failed to parse keyframe rule`)}catch{n.throwParseError(this,`appendRule`,`CSSKeyframesRule`,e)}r.__parentRule=this,this.cssRules.push(r)},t.CSSKeyframesRule.prototype.deleteRule=function(e){arguments.length===0&&n.throwMissingArguments(this,`deleteRule`,`CSSKeyframesRule`);for(var t=this._normalizeKeyText(e),r=0;r<this.cssRules.length;r++){var i=this.cssRules[r];if(this._normalizeKeyText(i.keyText)===t){i.__parentRule=null,this.cssRules.splice(r,1);return}}},t.CSSKeyframesRule.prototype.findRule=function(e){arguments.length===0&&n.throwMissingArguments(this,`findRule`,`CSSKeyframesRule`);for(var t=this._normalizeKeyText(e),r=this.cssRules.length-1;r>=0;r--){var i=this.cssRules[r];if(this._normalizeKeyText(i.keyText)===t)return i}return null},t.CSSKeyframesRule.prototype._normalizeKeyText=function(e){if(!e)return``;var t=e.toString().trim().toLowerCase();return t===`from`?`0%`:t===`to`?`100%`:t},typeof Symbol<`u`&&Symbol.iterator&&(t.CSSKeyframesRule.prototype[Symbol.iterator]=function(){var e=0,t=this.cssRules;return{next:function(){return e<t.length?{value:t[e++],done:!1}:{done:!0}}}}),t.CSSKeyframesRule.prototype._setupIndexedAccess=function(){for(var e=0;e<1e3&&this.hasOwnProperty(e);e++)delete this[e];for(var e=0;e<this.cssRules.length;e++)(function(e){Object.defineProperty(this,e,{get:function(){return this.cssRules[e]},enumerable:!1,configurable:!0})}).call(this,e);Object.defineProperty(this,"length",{get:function(){return this.cssRules.length},enumerable:!1,configurable:!0})},e.CSSKeyframesRule=t.CSSKeyframesRule})),Zp=/* @__PURE__ */ o((e=>{var t={};t.CSSValue=function(){},t.CSSValue.prototype={constructor:t.CSSValue,set cssText(e){var t=this._getConstructorName();throw Error(`DOMException: property "cssText" of "`+t+`" is readonly and can not be replaced with "`+e+`"!`)},get cssText(){var e=this._getConstructorName();throw Error(`getter "cssText" of "`+e+`" is not implemented!`)},_getConstructorName:function(){return this.constructor.toString().match(/function\s([^\(]+)/)[1]}},e.CSSValue=t.CSSValue})),Qp=/* @__PURE__ */ o((e=>{var t={CSSValue:Zp().CSSValue};t.CSSValueExpression=function(e,t){this._token=e,this._idx=t},t.CSSValueExpression.prototype=Object.create(t.CSSValue.prototype),t.CSSValueExpression.prototype.constructor=t.CSSValueExpression,Object.setPrototypeOf(t.CSSValueExpression,t.CSSValue),t.CSSValueExpression.prototype.parse=function(){for(var e=this._token,t=this._idx,n=``,r=``,i=``,a,o=[];;++t){if(n=e.charAt(t),n===``){i=`css expression error: unfinished expression!`;break}switch(n){case`(`:o.push(n),r+=n;break;case`)`:o.pop(n),r+=n;break;case`/`:(a=this._parseJSComment(e,t))?a.error?i=`css expression error: unfinished comment in expression!`:t=a.idx:(a=this._parseJSRexExp(e,t))?(t=a.idx,r+=a.text):r+=n;break;case`'`:case`"`:a=this._parseJSString(e,t,n),a?(t=a.idx,r+=a.text):r+=n;break;default:r+=n}if(i||o.length===0)break}return i?{error:i}:{idx:t,expression:r}},t.CSSValueExpression.prototype._parseJSComment=function(e,t){var n=e.charAt(t+1),r;if(n===`/`||n===`*`){var i=t,a,o;return n===`/`?o=`
|
|
150
|
+
`:n===`*`&&(o=`*/`),a=e.indexOf(o,i+1+1),a===-1?{error:`css expression error: unfinished comment in expression!`}:(a=a+o.length-1,r=e.substring(t,a+1),{idx:a,text:r})}return!1},t.CSSValueExpression.prototype._parseJSString=function(e,t,n){var r=this._findMatchedIdx(e,t,n),i;return r!==-1&&(i=e.substring(t,r+n.length),{idx:r,text:i})},t.CSSValueExpression.prototype._parseJSRexExp=function(e,t){var n=e.substring(0,t).replace(/\s+$/,``);return[/^$/,/\($/,/\[$/,/\!$/,/\+$/,/\-$/,/\*$/,/\/\s+/,/\%$/,/\=$/,/\>$/,/<$/,/\&$/,/\|$/,/\^$/,/\~$/,/\?$/,/\,$/,/delete$/,/in$/,/instanceof$/,/new$/,/typeof$/,/void$/].some(function(e){return e.test(n)})?this._parseJSString(e,t,`/`):!1},t.CSSValueExpression.prototype._findMatchedIdx=function(e,t,n){for(var r=t,i,a=-1;;){if(i=e.indexOf(n,r+1),i===-1){i=a;break}var o=e.substring(t+1,i).match(/\\+$/);if(!o||o[0]%2==0)break;r=i}return e.indexOf(`
|
|
151
|
+
`,t+1)<i&&(i=a),i},e.CSSValueExpression=t.CSSValueExpression})),$p=/* @__PURE__ */ o((e=>{var t={};t.MatcherList=function(){this.length=0},t.MatcherList.prototype={constructor:t.MatcherList,get matcherText(){return Array.prototype.join.call(this,`, `)},set matcherText(e){for(var t=e.split(`,`),n=this.length=t.length,r=0;r<n;r++)this[r]=t[r].trim()},appendMatcher:function(e){Array.prototype.indexOf.call(this,e)===-1&&(this[this.length]=e,this.length++)},deleteMatcher:function(e){var t=Array.prototype.indexOf.call(this,e);t!==-1&&Array.prototype.splice.call(this,t,1)}},e.MatcherList=t.MatcherList})),em=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,MatcherList:$p().MatcherList};t.CSSDocumentRule=function(){t.CSSRule.call(this),this.matcher=new t.MatcherList,this.cssRules=new t.CSSRuleList},t.CSSDocumentRule.prototype=Object.create(t.CSSRule.prototype),t.CSSDocumentRule.prototype.constructor=t.CSSDocumentRule,Object.setPrototypeOf(t.CSSDocumentRule,t.CSSRule),Object.defineProperty(t.CSSDocumentRule.prototype,"type",{value:10,writable:!1}),Object.defineProperty(t.CSSDocumentRule.prototype,"cssText",{get:function(){for(var e=[],t=0,n=this.cssRules.length;t<n;t++)e.push(this.cssRules[t].cssText);return`@-moz-document `+this.matcher.matcherText+` {`+(e.length?`
|
|
152
|
+
`+e.join(`
|
|
153
|
+
`):``)+`
|
|
154
|
+
}`}}),e.CSSDocumentRule=t.CSSDocumentRule})),tm=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,CSSGroupingRule:Pp().CSSGroupingRule};t.CSSScopeRule=function(){t.CSSGroupingRule.call(this),this.__start=null,this.__end=null},t.CSSScopeRule.prototype=Object.create(t.CSSGroupingRule.prototype),t.CSSScopeRule.prototype.constructor=t.CSSScopeRule,Object.setPrototypeOf(t.CSSScopeRule,t.CSSGroupingRule),Object.defineProperties(t.CSSScopeRule.prototype,{type:{value:0,writable:!1},cssText:{get:function(){var e=``,t=[` {`];return this.cssRules.length&&t.push(this.cssRules.reduce(function(e,t){return t.cssText!==``&&e.push(t.cssText),e},[]).join(`
|
|
155
|
+
`)),e=t.join(`
|
|
156
|
+
`)+`
|
|
157
|
+
}`,`@scope`+(this.start?` (`+this.start+`)`:``)+(this.end?` to (`+this.end+`)`:``)+e},configurable:!0,enumerable:!0},start:{get:function(){return this.__start}},end:{get:function(){return this.__end}}}),e.CSSScopeRule=t.CSSScopeRule})),nm=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,CSSGroupingRule:Pp().CSSGroupingRule};t.CSSLayerBlockRule=function(){t.CSSGroupingRule.call(this),this.name=``},t.CSSLayerBlockRule.prototype=Object.create(t.CSSGroupingRule.prototype),t.CSSLayerBlockRule.prototype.constructor=t.CSSLayerBlockRule,Object.setPrototypeOf(t.CSSLayerBlockRule,t.CSSRule),Object.defineProperty(t.CSSLayerBlockRule.prototype,"type",{value:18,writable:!1}),Object.defineProperties(t.CSSLayerBlockRule.prototype,{cssText:{get:function(){var e=``,t=[` {`];return this.cssRules.length&&t.push(this.cssRules.reduce(function(e,t){return t.cssText!==``&&e.push(t.cssText),e},[]).join(`
|
|
158
|
+
`)),e=t.join(`
|
|
159
|
+
`)+`
|
|
160
|
+
}`,`@layer`+(this.name?` `+this.name:``)+e}}}),e.CSSLayerBlockRule=t.CSSLayerBlockRule})),rm=/* @__PURE__ */ o((e=>{var t={CSSRule:Np().CSSRule};t.CSSLayerStatementRule=function(){t.CSSRule.call(this),this.nameList=[]},t.CSSLayerStatementRule.prototype=Object.create(t.CSSRule.prototype),t.CSSLayerStatementRule.prototype.constructor=t.CSSLayerStatementRule,Object.setPrototypeOf(t.CSSLayerStatementRule,t.CSSRule),Object.defineProperty(t.CSSLayerStatementRule.prototype,"type",{value:0,writable:!1}),Object.defineProperties(t.CSSLayerStatementRule.prototype,{cssText:{get:function(){return`@layer `+this.nameList.join(`, `)+`;`}}}),e.CSSLayerStatementRule=t.CSSLayerStatementRule})),im=/* @__PURE__ */ o((e=>{var t={CSSStyleDeclaration:sm().CSSStyleDeclaration,CSSRule:Np().CSSRule,CSSRuleList:Mp().CSSRuleList,CSSGroupingRule:Pp().CSSGroupingRule},n=kp().regexPatterns;try{t.CSSStyleDeclaration=require("cssstyle").CSSStyleDeclaration}catch{}t.CSSPageRule=function(){t.CSSGroupingRule.call(this),this.__style=new t.CSSStyleDeclaration,this.__style.parentRule=this},t.CSSPageRule.prototype=Object.create(t.CSSGroupingRule.prototype),t.CSSPageRule.prototype.constructor=t.CSSPageRule,Object.setPrototypeOf(t.CSSPageRule,t.CSSGroupingRule),Object.defineProperty(t.CSSPageRule.prototype,"type",{value:6,writable:!1}),Object.defineProperty(t.CSSPageRule.prototype,"selectorText",{get:function(){return this.__selectorText},set:function(e){if(typeof e==`string`){var t=e.trim();if(t===``){this.__selectorText=``;return}var r=n.atPageRuleSelectorRegExp,i=n.cssCustomIdentifierRegExp,a=t.match(r);if(a){var o=a[1]||``,s=a[2]||``;if(o&&!i.test(o))return;if(s){for(var c=s.split(`:`).filter(function(e){return e}),l=[`left`,`right`,`first`,`blank`],u=!0,d=0;d<c.length;d++)if(l.indexOf(c[d].toLowerCase())===-1){u=!1;break}if(!u)return}this.__selectorText=o+s.toLowerCase()}}}}),Object.defineProperty(t.CSSPageRule.prototype,"style",{get:function(){return this.__style},set:function(e){typeof e==`string`?this.__style.cssText=e:this.__style=e}}),Object.defineProperty(t.CSSPageRule.prototype,"cssText",{get:function(){var e=``;if(this.cssRules.length){var t=[` {`];this.style.cssText&&t.push(this.style.cssText),t.push(this.cssRules.reduce(function(e,t){return t.cssText!==``&&e.push(t.cssText),e},[]).join(`
|
|
161
|
+
`)),e=t.join(`
|
|
162
|
+
`)+`
|
|
163
|
+
}`}else e=` {`+(this.style.cssText?` `+this.style.cssText:``)+` }`;return`@page`+(this.selectorText?` `+this.selectorText:``)+e}}),e.CSSPageRule=t.CSSPageRule})),am=/* @__PURE__ */ o((()=>{try{CSSOM.CSSStyleDeclaration=require("cssstyle").CSSStyleDeclaration}catch{}})),om=/* @__PURE__ */ o((e=>{var t={},n=kp().regexPatterns;t.parse=function(e,r,i){i=i===!0?console&&console.error:i;var a=0,o=`before-selector`,s,c=``,l=0,u=!1,d={name:!0,"before-name":!0,selector:!0,value:!0,"value-parenthesis":!0,atRule:!0,"importRule-begin":!0,importRule:!0,"namespaceRule-begin":!0,namespaceRule:!0,atBlock:!0,containerBlock:!0,conditionBlock:!0,counterStyleBlock:!0,propertyBlock:!0,"documentRule-begin":!0,scopeBlock:!0,layerBlock:!0,pageBlock:!0},f;r&&r.styleSheet?f=r.styleSheet:(f=r&&r.globalObject&&r.globalObject.CSSStyleSheet?new r.globalObject.CSSStyleSheet:new t.CSSStyleSheet,f.__constructed=!1);var p=r&&r.cssRules?{cssRules:r.cssRules}:f;if(r&&r.ownerNode){f.__ownerNode=r.ownerNode;var m=r.ownerNode.media||r.ownerNode.getAttribute&&r.ownerNode.getAttribute(`media`);m&&(f.media.mediaText=m);var h=r.ownerNode.title||r.ownerNode.getAttribute&&r.ownerNode.getAttribute(`title`);h&&(f.__title=h)}r&&r.ownerRule&&(f.__ownerRule=r.ownerRule);var g=p,_,v=[],y,b,x=``,S,C,w,T,E,ee,te,ne,re,D,ie,ae,O,k,A,oe,j,M,se={},ce=0,le={},ue={},de={};function fe(e){return e.__parseId||=++ce,e.__parseId}var pe=0,me={};function he(e){if(!me[e]){var t=e===`@import`?F:P;me[e]=new RegExp(e+t.source,t.flags)}return me[e]}var ge=n.atKeyframesRegExp,_e=n.beforeRulePortionRegExp,N=n.beforeRuleValidationRegExp,P=n.forwardRuleValidationRegExp,F=n.forwardImportRuleValidationRegExp,ve=new RegExp(_e.source,_e.flags),ye=n.forwardRuleClosingBraceRegExp,be=n.forwardRuleSemicolonAndOpeningBraceRegExp,xe=n.cssCustomIdentifierRegExp,Se=n.startsWithCombinatorRegExp,Ce=n.atPageRuleSelectorRegExp,I=n.startsWithHexEscapeRegExp,we=n.identStartCharRegExp,Te=n.identCharRegExp,Ee=n.specialCharsNeedEscapeRegExp,De=n.combinatorOrSeparatorRegExp,Oe=n.afterHexEscapeSeparatorRegExp,ke=n.trailingSpaceSeparatorRegExp,Ae=n.endsWithHexEscapeRegExp,je=n.attributeSelectorContentRegExp,Me=n.pseudoElementRegExp,Ne=n.invalidCombinatorLtGtRegExp,Pe=n.invalidCombinatorDoubleGtRegExp,Fe=n.consecutiveCombinatorsRegExp,Ie=n.invalidSlottedRegExp,Le=n.invalidPartRegExp,Re=n.invalidCueRegExp,ze=n.invalidCueRegionRegExp,Be=n.invalidNestingPattern,Ve=n.emptyPseudoClassRegExp,He=n.whitespaceNormalizationRegExp,Ue=n.newlineRemovalRegExp,We=n.whitespaceAndDotRegExp,Ge=n.declarationOrOpenBraceRegExp,Ke=n.ampersandRegExp,qe=n.hexEscapeSequenceRegExp,Je=n.attributeCaseFlagRegExp,Ye=n.prependedAmpersandRegExp,Xe=n.openBraceGlobalRegExp,Ze=n.closeBraceGlobalRegExp,Qe=n.scopePreludeSplitRegExp,$e=n.leadingWhitespaceRegExp,et=n.doubleQuoteRegExp,tt=n.backslashRegExp,nt=n.invalidMediaOperatorWithoutSpaceRegExp,rt=n.invalidMediaNotAfterOperatorRegExp,it=n.invalidMediaNotIdentifierRegExp,at=n.invalidMediaNotAfterFeatureRegExp,ot=n.invalidMediaOperatorBetweenParensRegExp,st=n.invalidMediaNotWithMediaTypeRegExp,ct=n.mediaFeatureColonRegExp,lt=n.identifierBeforeParenRegExp,ut=n.mediaAndOperatorRegExp,dt=n.mediaOrOperatorRegExp,ft=n.mediaNotOperatorStartRegExp,pt=n.mediaNotOperatorRegExp;function mt(e){for(var t=0;t<e.length;t++){var n=e[t];if((n===`;`||n===`}`)&&e.substring(0,t).indexOf(`{`)===-1){for(var r=n,i=t+1;i<e.length&&/\s/.test(e[i]);)r+=e[i],i++;var a=[r];return a.index=t,a.input=e,a}}return null}function ht(e,t){t||=0;var n=e.indexOf(`{`,t);if(n===-1)return null;for(var r=0,i=n;i<e.length;i++)if(e[i]===`{`)r++;else if(e[i]===`}`&&(r--,r===0))return{0:e.slice(n,i+1),index:n,input:e};return null}function gt(t,n,r){var i=ht(n,r);if(i){var a=i.index+i[0].length;t+=a,e.charAt(t)===`}`&&--t}else t+=n.length;return t}function _t(e){var t=e.split(Qe);t.length===2&&(t[0]+=`)`,t[1]=`(`+t[1]);var n=t[0]&&t[0].charAt(0)===`(`&&t[0].charAt(t[0].length-1)===`)`,r=t[1]&&t[1].charAt(0)===`(`&&t[1].charAt(t[1].length-1)===`)`,i=!n&&!r&&t[0].indexOf(`to (`)===0&&t[0].charAt(t[0].length-1)===`)`,a=``,o=``;return n&&(a=t[0].slice(1,-1).trim()),r&&(o=t[1].slice(1,-1).trim()),i&&(o=t[0].slice(4,-1).trim()),{startSelector:a,endSelector:o,hasStart:n,hasEnd:r,hasOnlyEnd:i}}function vt(e){return Me.test(e)}function yt(e,t,n){for(var r=0,i=0,a=!1,o=!1,s=!1,c=n?[]:null,l=0;l<e.length;l++){var u=e[l];if(u===`\\`){var d=L(e,l);if(d>0){l+=d-1;continue}}if(a)u===`'`&&(a=!1);else if(o)u===`"`&&(o=!1);else if(t&&s)u===`]`?s=!1:u===`'`?a=!0:u===`"`&&(o=!0);else if(t&&u===`[`)s=!0;else if(u===`'`)a=!0;else if(u===`"`)o=!0;else if(u===`(`)n?c.push(`(`):r++;else if(u===`)`){if(n){if(!c.length||c.pop()!==`(`)return!1}else if(r--,r<0)return!1}else if(u===`[`)i++;else if(u===`]`&&(i--,i<0))return!1}return n?c.length===0&&i===0&&!a&&!o&&!s:r===0&&i===0&&!a&&!o}function bt(e){return!yt(e,!1,!1)}function xt(e){return!!(Ne.test(e)||Pe.test(e)||Fe.test(e))}function St(e){for(var t=[Ie,Le,Re,ze],n=0;n<t.length;n++)if(t[n].test(e))return!0;return!1}function Ct(e){return Be.test(e)}function wt(){if(g===p)return!0;var e=!1,n=!1;if(g.constructor.name===`CSSStyleRule`?e=!0:(g instanceof t.CSSScopeRule||g instanceof t.CSSConditionRule)&&(n=!0),!e)for(var r=0;r<v.length;r++){if(v[r].constructor.name===`CSSStyleRule`){e=!0;break}(v[r]instanceof t.CSSScopeRule||v[r]instanceof t.CSSConditionRule)&&(n=!0)}return n&&!e}function Tt(t,n,r){var i=!1,s=he(t),c=Math.min(100,e.length-a),l=e.slice(a,a+c);if(!(r&&g!==p)&&l.search(s)===0){var u=Math.max(0,pe),d=e.slice(u,a),f=d.match(ve),m=f?u+d.lastIndexOf(f[f.length-1]):u;e.slice(m,a).search(N)===0&&(i=!0,pe=m)}if(i&&t===`@scope`){var h=l.indexOf(`{`);if(h!==-1){var _=l.slice(0,h).trim(),v=_.slice(6).trim();if(v.length>0){var y=_t(v),b=y.startSelector,x=y.endSelector,S=y.hasStart,C=y.hasEnd,w=y.hasOnlyEnd;(S&&b===``||C&&x===``||w&&x===``||b&&vt(b)||x&&vt(x)||b&&bt(b)||x&&bt(x)||b&&xt(b)||x&&xt(x)||b&&St(b)||x&&St(x)||!S&&!w)&&(i=!1)}}}if(i&&t===`@page`){var h=l.indexOf(`{`);if(h!==-1){var _=l.slice(0,h).trim(),v=_.slice(5).trim();if(v.length>0){var T=v.trim();if(T!==``){var E=T.match(Ce);if(E){var ee=E[1]||``,te=E[2]||``;if(ee&&(xe.test(ee)||(i=!1)),te){for(var ne=te.split(`:`).filter(function(e){return e}),re=[`left`,`right`,`first`,`blank`],D=!0,ie=0;ie<ne.length;ie++)if(re.indexOf(ne[ie].toLowerCase())===-1){D=!1;break}D||(i=!1)}}else i=!1}}}}if(i)n.call(this);else{var ae=mt(l);if(ae&&g!==p){var O=ae[0].indexOf(`;`);a+=ae.index+O;return}if(t===`@layer`){var k=l.match(be);if(k&&k[1]===`;`){a+=k.index+k[0].length,o=`before-selector`;return}}a=gt(a,l),o=`before-selector`}}function Et(e){return/[a-zA-Z_\u00A0-\uFFFF]/.test(e)}function Dt(e){return/[a-zA-Z0-9_\u00A0-\uFFFF\-]/.test(e)}function Ot(e){if(!e||e.length===0)return!1;var t=0,n=e.length,r=!1;function i(){if(t<n&&e[t]===`\\`){var r=L(e,t);if(r>0)return t+=r,!0}return!1}function a(){for(var r=t;t<n;)if(i())continue;else if(Dt(e[t]))t++;else break;return t>r}function o(){var r=t;return t<n&&e[t]===`*`?t++:t<n&&(Et(e[t])||e[t]===`\\`)&&a(),t<n&&e[t]===`|`?(t++,!0):(t=r,!1)}function s(){if(t>=n||e[t]!==`(`)return!1;t++;for(var r=1,i=!1,a=``;t<n&&r>0;){var o=e[t];o===`\\`&&t+1<n?t+=2:!i&&(o===`"`||o===`'`)?(i=!0,a=o,t++):i&&o===a?(i=!1,t++):!i&&o===`(`?(r++,t++):(!i&&o===`)`&&r--,t++)}return r===0}for(;t<n;){for(var c=!1,l=t;t<n&&/\s/.test(e[t]);)t++;if(t>l)r=!0;else if(t<n&&/[>+~]/.test(e[t]))for(t++,r=!0;t<n&&/\s/.test(e[t]);)t++;else{if(t<n&&e[t]===`&`)t++,r=!0,c=!0;else if(t<n&&e[t]===`.`)t++,a()&&(r=!0,c=!0);else if(t<n&&e[t]===`#`)t++,a()&&(r=!0,c=!0);else if(t<n&&e[t]===`:`)t++,t<n&&e[t]===`:`&&t++,a()&&(s(),r=!0,c=!0);else if(t<n&&e[t]===`[`){t++;for(var u=1;t<n&&u>0;)if(e[t]===`\\`)t+=2;else if(e[t]===`'`){for(t++;t<n&&e[t]!==`'`;)e[t]===`\\`?t+=2:t++;t<n&&t++}else if(e[t]===`"`){for(t++;t<n&&e[t]!==`"`;)e[t]===`\\`?t+=2:t++;t<n&&t++}else e[t]===`[`?(u++,t++):(e[t]===`]`&&u--,t++);u===0&&(r=!0,c=!0)}else t<n&&(Et(e[t])||e[t]===`\\`||e[t]===`*`||e[t]===`|`||e[t]===`-`)&&(o(),t<n&&e[t]===`*`?(t++,r=!0,c=!0):t<n&&(Et(e[t])||e[t]===`\\`||e[t]===`-`)&&a()&&(r=!0,c=!0));if(!c&&t===l)return!1}}return r}function kt(e){if(e.length>1e4||!yt(e,!0,!0)||xt(e)||St(e)||Ct(e))return!1;for(var t=[`lang`,`dir`,`nth-child`,`nth-last-child`,`nth-of-type`,`nth-last-of-type`],n=0;n<e.length;n++)if(e[n]===`:`){n++,n<e.length&&e[n]===`:`&&n++;for(var r=n;n<e.length&&/[a-zA-Z0-9\-]/.test(e[n]);)n++;if(n===r)continue;var i=e.substring(r,n).toLowerCase();if(n<e.length&&e[n]===`(`){n++;for(var a=n,o=1;n<e.length&&o>0;)e[n]===`\\`?n+=2:e[n]===`(`?(o++,n++):(e[n]===`)`&&o--,n++);if(o===0){for(var s=e.substring(a,n-1),c=0;c<t.length;c++)if(i===t[c]&&/['"]/.test(s))return!1}}}return Ot(e)}function At(e){for(var t=[],n=0;n<e.length;n++)if(e[n]===`:`){var r=n;n++,n<e.length&&e[n]===`:`&&n++;for(var i=n;n<e.length&&/[a-zA-Z\-]/.test(e[n]);)n++;if(n===i)continue;var a=e.substring(i,n);if(n<e.length&&e[n]===`(`){n++;for(var o=n,s=1,c=!1,l=!1;n<e.length&&s>0;){var u=e[n];u===`\\`?n+=2:u===`'`&&!l?(c=!c,n++):u===`"`&&!c?(l=!l,n++):u===`(`&&!c&&!l?(s++,n++):(u===`)`&&!c&&!l&&s--,n++)}if(s===0){var d=e.substring(o,n-1),f=e.substring(r,n);t.push([f,a,d,r])}n--}}return t}function jt(e){for(var t=0,n=``,r=[],i=!1,a=!1,o=0,s;o<e.length;o++)s=e.charAt(o),s===`\\`&&o+1<e.length?(n+=s,o++,n+=e.charAt(o)):s===`'`&&!a?(i=!i,n+=s):s===`"`&&!i?(a=!a,n+=s):!i&&!a?s===`(`?(t++,n+=s):s===`)`?(t--,n+=s):s===`,`&&t===0?(n.trim()&&r.push(n.trim()),n=``):n+=s:n+=s;var c=n.trim();if(c){var l=Ae.test(n);r.push(l?n.replace($e,``):c)}return r}var Mt={},Nt={not:!0,is:!0,has:!0,where:!0};function Pt(e){if(Mt.hasOwnProperty(e))return Mt[e];for(var t=At(e),n=0;n<t.length;n++){var r=t[n][1];if(Nt.hasOwnProperty(r)){for(var i=jt(t[n][2]),a=!1,o=0;o<i.length;o++)if(Ke.test(i[o])){a=!0;break}if(a)continue;for(var s=0;s<i.length;s++){var c=i[s];if(!Mt.hasOwnProperty(c)){var l=Pt(c);if(Mt[c]=l,!l)return Mt[e]=!1,!1}else if(!Mt[c])return Mt[e]=!1,!1}}}var u=kt(e);return Mt[e]=u,u}function Ft(e){for(var t=-1,n=!1,r=!1,i=!1,a=0;a<e.length;a++){var o=e[a];if(o===`\\`){var s=L(e,a);if(s>0){a+=s-1;continue}}if(r)o===`'`&&(r=!1);else if(i)o===`"`&&(i=!1);else if(n)o===`]`?n=!1:o===`'`?r=!0:o===`"`&&(i=!0);else if(o===`[`)n=!0;else if(o===`|`&&!n){t=a;break}}if(t===-1)return!0;var c=e.substring(0,t);return c===`*`||c===``||se.hasOwnProperty(c)}function It(e){for(var t=``,n=0,r=``,i=!1,a=0,o=!1,s=!1;n<e.length;){var c=e[n];if(c===`[`&&!i)i=!0,a=1,t+=c,n++,o=!1,s=!1;else if(i){if(c===`[`&&a++,c===`]`&&(a--,a===0&&(i=!1)),c===`\\`&&n+1<e.length){var l=L(e,n);t+=e.substr(n,l),n+=l}else t+=c,n++;s=!1}else{if(c===`\\`){var l=L(e,n);if(l>0){var u=e.substr(n,l),d=Rt(u),f=I.test(u)&&u[l-1]===` `;r=e[n+l]||``;var p=!1,m=!1;if(o){if(Zt(d))p=!0,m=!0;else if(d===`-`){var h=e.substring(n+l);p=!(h&&Te.test(h[0]))}else we.test(d)||(p=!0)}else Ee.test(d)&&(p=!0);if(p){if(m){var g=d.charCodeAt(0),_=g.toString(16);t+=`\\`+_,Qt(r)||!r||Oe.test(r)?(t+=` `,s=!1):s=!0}else t+=`\\`+d,s=!1}else s&&!f&&en(d)&&(t+=` `),t+=d,f&&(!r||Oe.test(r))&&(t+=` `),s=!1;n+=l,o&&=d===`-`;continue}}if(c===`.`||c===`#`)t+=c,o=!0,s=!1,n++;else if(c===`-`&&o)t+=c,o=!0,s=!1,n++;else if(Zt(c)&&o){var g=c.charCodeAt(0),_=g.toString(16);t+=`\\`+_,r=e[n+1]||``,Qt(r)||!r||Oe.test(r)?(t+=` `,s=!1):s=!0,o=!1,n++}else c===`:`||De.test(c)?(c===` `&&s&&t[t.length-1]===` `||(t+=c),o=!1,s=!1,n++):$t(c)&&s?(t+=` `+c,o=!1,s=!1,n++):c===` `&&s?(r=e[n+1]||``,(!r||ke.test(r))&&(t+=c),o=!1,s=!1,n++):(t+=c,o=!1,s=!1,n++)}}return t}function Lt(e){for(var t=``,n=0;n<e.length;n++){if(e[n]===`\\`&&n+1<e.length){var r=L(e,n);if(r>0){var i=Rt(e.substr(n,r));t+=i,n+=r-1;continue}}t+=e[n]}return t}function Rt(e){if(e.length<2||e[0]!==`\\`)return e;var t=e.substring(1),n=t.match(qe);if(n){var r=parseInt(n[1],16);if(r>65535){r-=65536;var i=55296+(r>>10),a=56320+(r&1023);return String.fromCharCode(i,a)}return String.fromCharCode(r)}return t[0]||``}function zt(e){for(var t=``,n=0;n<e.length;)if(e[n]===`[`){t+=`[`,n++;for(var r=``,i=1;n<e.length&&i>0;)if(e[n]===`\\`&&n+1<e.length)r+=e.substring(n,n+2),n+=2;else{if(e[n]===`[`&&i++,e[n]===`]`&&(i--,i===0))break;r+=e[n],n++}var a=Vt(r);if(a===null)return null;t+=a,n<e.length&&e[n]===`]`&&(t+=`]`,n++)}else t+=e[n],n++;return t}function Bt(e,t,n,r,i){if(e.length<2)return null;for(var a=1,o=!1;a<e.length;)if(e[a]===`\\`&&a+1<e.length){var s=L(e,a);a+=s}else{if(e[a]===t){o=a===e.length-1;break}a++}if(!o)return null;var c=Lt(e.slice(1,-1)).replace(et,`\\"`);return n+r+`"`+c+`"`+(i?` `+i:``)}function Vt(e){var t=e.match(je);if(!t)return e;var n=t[1],r=t[2],i=t[3].trim(),a=i.match(Je),o=a?a[1]:i,s=a?a[2]:``,c=o.trim(),l=c[0];if(l===`"`)return Bt(c,`"`,n,r,s);if(l===`'`)return Bt(c,`'`,n,r,s);for(var u=!1,d=0;d<c.length;d++){var f=c[d];if(f===`\\`&&d+1<c.length){var p=L(c,d);if(p>0){d+=p-1;continue}}if(Ee.test(f)){u=!0;break}}if(u)return null;var m=Lt(c).replace(tt,`\\\\`).replace(et,`\\"`);return n+r+`"`+m+`"`+(s?` `+s:``)}function Ht(e){var t=e.replace(He,function(e,t,n){return n?` `:e});return t=It(t),t=zt(t),t===null?``:Ut(t)}function Ut(e,t){if(t===void 0&&(t=0),t>10)return e;var n=At(e);if(n.length===0)return e;for(var r=e,i=n.length-1;i>=0;i--){var a=n[i][1];if(Nt.hasOwnProperty(a)){for(var o=n[i][0],s=n[i][2],c=n[i][3],l=jt(s),u=!1,d=0;d<l.length;d++)if(Ke.test(l[d])){u=!0;break}if(u)continue;for(var f=jt(Ut(s,t+1)),p=[],m=0;m<f.length;m++){var h=f[m];kt(h)&&p.push(h)}var g=p.join(`, `),_=`:`+a+`(`+g+`)`;r=r.substring(0,c)+_+r.substring(c+o.length)}}return r}function Wt(e){for(var t=0;t<e.length;t++){var n=e[t];if(n===`'`)for(t++;t<e.length;)if(e[t]===`\\`&&t+1<e.length)t+=2;else{if(e[t]===`'`)break;if(e[t]===`\r`||e[t]===`
|
|
164
|
+
`)return!0;t++}else if(n===`"`)for(t++;t<e.length;)if(e[t]===`\\`&&t+1<e.length)t+=2;else{if(e[t]===`"`)break;if(e[t]===`\r`||e[t]===`
|
|
165
|
+
`)return!0;t++}}return!1}function Gt(e){if(!e||e.trim()===``||Ve.test(e)||Wt(e))return!1;for(var t=jt(e),n=0;n<t.length;n++){var r=t[n].trim();if(!Pt(r)||!Ft(r))return!1}return!0}function Kt(e){v.push(e)}function qt(t,n){var r=e.substring(0,a).split(`
|
|
166
|
+
`),o=r.length,s=r.pop().length+1,c=/* @__PURE__ */ Error(t+` (line `+o+`, char `+s+`)`);c.line=o,c.char=s,c.styleSheet=f,c.isNested=!!n;try{throw c}catch(e){i&&i(e)}}function Jt(t){var n=e.slice(a).match(ye);n&&(a+=n.index+n[0].length-1),S=null,c=``,u=!1,o=t}function Yt(e){return`.:#&*[\\`.indexOf(e)!==-1}function Xt(e){return`
|
|
167
|
+
\r`.indexOf(e)!==-1}function Zt(e){var t=e.charCodeAt(0);return t>=48&&t<=57}function Qt(e){if(!e)return!1;var t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function $t(e){if(!e)return!1;var t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122}function en(e){var t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}function L(e,t){if(e[t]!==`\\`||t+1>=e.length)return 0;var n=e[t+1];if(Qt(n)){for(var r=1;r<6&&t+1+r<e.length&&Qt(e[t+1+r]);)r++;return t+1+r<e.length&&Xt(e[t+1+r])?1+r+1:1+r}return 2}function tn(e,t){for(var n=0;n<e.length;n++){if(e[n]===`\\`){var r=L(e,n);if(r>0){n+=r-1;continue}}if(e[n]===t)return!0}return!1}function nn(e){return nt.test(e)||rt.test(e)||it.test(e)||at.test(e)||ot.test(e)||st.test(e)}function rn(e){if(nn(e))return`not all`;var t=e;return t=t.replace(ct,function(e,n,r,i,a){var o=t.lastIndexOf(e),s=o>0?t.charAt(o-1):``;return lt.test(s)?e:n+r+`: `+a}),t=t.replace(ut,` and `),t=t.replace(dt,` or `),t=t.replace(ft,`not `),t=t.replace(pt,` not `),t.trim()}for(var an=e.length-1,on=an,sn;sn=e.charAt(a);a++){if(a===an)switch(o){case`importRule`:case`namespaceRule`:case`layerBlock`:sn!==`;`&&(e+=`;`,an+=1);break;case`value`:if(sn!==`}`){e+=sn===`;`?`}`:`;`,an+=1;break}case`name`:case`before-name`:e+=sn===`}`?` `:`}`,an+=1;break;case`before-selector`:if(sn!==`}`&&g!==f){e+=`}`,an+=1;break}}if(sn===`\\`&&a+1<e.length){var cn=L(e,a);if(cn>0){c+=e.substr(a,cn),a+=cn-1;continue}}switch(sn){case` `:case` `:case`\r`:case`
|
|
168
|
+
`:case`\f`:d[o]&&(c+=sn);break;case`"`:s=a+1;do s=e.indexOf(`"`,s)+1,s||(qt(`Unmatched "`),(o===`selector`||o===`atRule`)&&(u=!0));while(e[s-2]===`\\`);if(s===0)break;switch(c+=e.slice(a,s),a=s-1,o){case`before-value`:o=`value`;break;case`importRule-begin`:o=`importRule`,a===an&&(e+=`;`);break;case`namespaceRule-begin`:o=`namespaceRule`,a===an&&(e+=`;`)}break;case`'`:s=a+1;do s=e.indexOf(`'`,s)+1,s||(qt(`Unmatched '`),(o===`selector`||o===`atRule`)&&(u=!0));while(e[s-2]===`\\`);if(s===0)break;switch(c+=e.slice(a,s),a=s-1,o){case`before-value`:o=`value`;break;case`importRule-begin`:o=`importRule`;break;case`namespaceRule-begin`:o=`namespaceRule`}break;case`/`:e.charAt(a+1)===`*`?(a+=2,s=e.indexOf(`*/`,a),s===-1?(a=e.length-1,c=``):a=s+1):c+=sn,o===`importRule-begin`&&(c+=` `,o=`importRule`),o===`namespaceRule-begin`&&(c+=` `,o=`namespaceRule`);break;case`@`:if(j&&(S&&S.constructor.name===`CSSNestedDeclarations`&&g.cssRules.push(S),S!==j&&j.parentRule&&j.parentRule.constructor.name===`CSSStyleRule`&&(S=j.parentRule)),e.indexOf(`@-moz-document`,a)===a){Tt(`@-moz-document`,function(){o=`documentRule-begin`,D=new t.CSSDocumentRule,D.__starts=a,a+=13}),c=``;break}if(e.indexOf(`@media`,a)===a){Tt(`@media`,function(){o=`atBlock`,C=new t.CSSMediaRule,C.__starts=a,a+=5}),c=``;break}if(e.indexOf(`@container`,a)===a){Tt(`@container`,function(){o=`containerBlock`,w=new t.CSSContainerRule,w.__starts=a,a+=9}),c=``;break}if(e.indexOf(`@counter-style`,a)===a){c=``;var ln=!wt();Tt(`@counter-style`,function(){o=`counterStyleBlock`,T=new t.CSSCounterStyleRule,T.__starts=a,a+=13},ln);break}if(e.indexOf(`@property`,a)===a){c=``;var ln=!wt();Tt(`@property`,function(){o=`propertyBlock`,E=new t.CSSPropertyRule,E.__starts=a,a+=8},ln);break}if(e.indexOf(`@scope`,a)===a){Tt(`@scope`,function(){o=`scopeBlock`,O=new t.CSSScopeRule,O.__starts=a,a+=5}),c=``;break}if(e.indexOf(`@layer`,a)===a){Tt(`@layer`,function(){o=`layerBlock`,A=new t.CSSLayerBlockRule,A.__starts=a,a+=5}),c=``;break}if(e.indexOf(`@page`,a)===a){Tt(`@page`,function(){o=`pageBlock`,k=new t.CSSPageRule,k.__starts=a,a+=4}),c=``;break}if(e.indexOf(`@supports`,a)===a){Tt(`@supports`,function(){o=`conditionBlock`,ee=new t.CSSSupportsRule,ee.__starts=a,a+=8}),c=``;break}if(e.indexOf(`@host`,a)===a){Tt(`@host`,function(){o=`hostRule-begin`,a+=4,ie=new t.CSSHostRule,ie.__starts=a}),c=``;break}if(e.indexOf(`@starting-style`,a)===a){Tt(`@starting-style`,function(){o=`startingStyleRule-begin`,a+=14,ae=new t.CSSStartingStyleRule,ae.__starts=a}),c=``;break}if(e.indexOf(`@import`,a)===a){c=``,Tt(`@import`,function(){o=`importRule-begin`,a+=6,c+=`@import`},!0);break}if(e.indexOf(`@namespace`,a)===a){c=``,Tt(`@namespace`,function(){o=`namespaceRule-begin`,a+=9,c+=`@namespace`},!0);break}if(e.indexOf(`@font-face`,a)===a){c=``;var ln=!wt();Tt(`@font-face`,function(){o=`fontFaceRule-begin`,a+=9,ne=new t.CSSFontFaceRule,ne.__starts=a},ln);break}ge.lastIndex=a;var un=ge.exec(e);if(un&&un.index===a){o=`keyframesRule-begin`,re=new t.CSSKeyframesRule,re.__starts=a,re._vendorPrefix=un[1],a+=un[0].length-1,c=``;break}o===`selector`&&(o=`atRule`),c+=sn;break;case`{`:if(g===p&&(j=null),o===`before-selector`){qt(`Unexpected {`),a=gt(a,e.slice(a));break}if(o===`selector`||o===`atRule`){if(!j&&tn(c,`;`)){var dn=e.slice(a).match(ye);if(dn){S=null,c=``,o=`before-selector`,a+=dn.index+dn[0].length;break}}if(S||(S=new t.CSSStyleRule,S.__starts=a),u){Jt(`before-selector`);break}var fn=_;_&&(S.__parentRule=_,Kt(_)),g=_=S;var pn=Ht(c.trim());fn&&fn.constructor.name===`CSSStyleRule`?S.selectorText=jt(pn).map(function(e){return e.indexOf(`&`)===-1||Se.test(e)?`& `+e:e}).join(`, `):S.selectorText=jt(pn).join(`, `),S.style.__starts=a,S.__parentStyleSheet=f,c=``,o=`before-name`}else if(o===`atBlock`)C.media.mediaText=rn(c.trim()),_&&(C.__parentRule=_,Kt(_),_.constructor.name===`CSSStyleRule`&&!j&&(j=_)),g=_=C,Kt(C),C.__parentStyleSheet=f,S&&S.constructor.name===`CSSStyleRule`&&S.__parentRule||(S=null),c=``,o=`before-selector`;else if(o===`containerBlock`)w.__conditionText=rn(c.trim()),_&&(w.__parentRule=_,Kt(_),_.constructor.name===`CSSStyleRule`&&!j&&(j=_)),g=_=w,Kt(w),w.__parentStyleSheet=f,S=null,c=``,o=`before-selector`;else if(o===`counterStyleBlock`){var mn=c.trim().replace(Ue,``);mn.length>0&&!We.test(mn)&&(T.name=mn,_&&(T.__parentRule=_),T.__parentStyleSheet=f,S=T),c=``}else if(o===`propertyBlock`){var hn=c.trim().replace(Ue,``);hn.indexOf(`--`)===0&&(E.__name=hn,_&&(E.__parentRule=_),E.__parentStyleSheet=f,S=E),c=``}else if(o===`conditionBlock`)ee.__conditionText=rn(c.trim()),_&&(ee.__parentRule=_,Kt(_),_.constructor.name===`CSSStyleRule`&&!j&&(j=_)),g=_=ee,Kt(ee),ee.__parentStyleSheet=f,S=null,c=``,o=`before-selector`;else if(o===`scopeBlock`){var gn=_t(c.trim());gn.hasStart&&(O.__start=gn.startSelector),gn.hasEnd&&(O.__end=gn.endSelector),gn.hasOnlyEnd&&(O.__end=gn.endSelector),_&&(O.__parentRule=_,Kt(_),_.constructor.name===`CSSStyleRule`&&!j&&(j=_)),g=_=O,Kt(O),O.__parentStyleSheet=f,S=null,c=``,o=`before-selector`}else if(o===`layerBlock`)A.name=c.trim(),(A.name.length===0||A.name.match(xe)!==null)&&(_&&(A.__parentRule=_,Kt(_),_.constructor.name===`CSSStyleRule`&&!j&&(j=_)),g=_=A,Kt(A),A.__parentStyleSheet=f),S=null,c=``,o=`before-selector`;else if(o===`pageBlock`)k.selectorText=c.trim(),_&&(k.__parentRule=_,Kt(_)),g=_=k,k.__parentStyleSheet=f,S=k,c=``,o=`before-name`;else if(o===`hostRule-begin`)_&&Kt(_),g=_=ie,Kt(ie),ie.__parentStyleSheet=f,c=``,o=`before-selector`;else if(o===`startingStyleRule-begin`)_&&(ae.__parentRule=_,Kt(_),_.constructor.name===`CSSStyleRule`&&!j&&(j=_)),g=_=ae,Kt(ae),ae.__parentStyleSheet=f,S=null,c=``,o=`before-selector`;else if(o===`fontFaceRule-begin`)_&&(ne.__parentRule=_),ne.__parentStyleSheet=f,S=ne,c=``,o=`before-name`;else if(o===`keyframesRule-begin`)re.name=c.trim(),_&&(Kt(_),re.__parentRule=_),re.__parentStyleSheet=f,g=_=re,c=``,o=`keyframeRule-begin`;else if(o===`keyframeRule-begin`)S=new t.CSSKeyframeRule,S.keyText=c.trim(),S.__starts=a,c=``,o=`before-name`;else if(o===`documentRule-begin`)D.matcher.matcherText=c.trim(),_&&(Kt(_),D.__parentRule=_),g=_=D,Kt(D),D.__parentStyleSheet=f,c=``,o=`before-selector`;else if(o===`before-name`||o===`name`){if(S.constructor.name===`CSSFontFaceRule`||S.constructor.name===`CSSKeyframeRule`||S.constructor.name===`CSSPageRule`&&_===S){var dn=e.slice(a).match(ye);if(dn){a+=dn.index+dn[0].length-1,c=``,o=`before-name`;break}}if(S.constructor.name===`CSSNestedDeclarations`?(S.style.length&&(_.cssRules.push(S),S.__parentRule=_,S.__parentStyleSheet=f),Kt(_)):(g=_=S,Kt(_),S.__parentStyleSheet=f),S=new t.CSSStyleRule,u){Jt(`before-name`);break}var pn=Ht(c.trim());_.constructor.name===`CSSScopeRule`||_.constructor.name!==`CSSStyleRule`&&_.parentRule===null?S.selectorText=jt(pn).join(`, `):S.selectorText=jt(pn).map(function(e){return e.indexOf(`&`)===-1||Se.test(e)?`& `+e:e}).join(`, `),S.style.__starts=a-c.length,S.__parentRule=_,(_.constructor.name===`CSSStyleRule`||_.constructor.name===`CSSScopeRule`)&&(j=S),S.__parentStyleSheet=f,g=_=S,c=``,o=`before-name`}break;case`:`:if(o===`name`){var _n=e.slice(a).match(Ge);_n&&_n[0]===`{`?c+=sn:(b=c.trim(),c=``,o=`before-value`)}else c+=sn;break;case`(`:if(o===`value`){if(c.trim()===`expression`){var vn=new t.CSSValueExpression(e,a).parse();vn.error?qt(vn.error):(c+=vn.expression,a=vn.idx)}else o=`value-parenthesis`,l=1,c+=sn}else o===`value-parenthesis`&&l++,c+=sn;break;case`)`:o===`value-parenthesis`&&(l--,l===0&&(o=`value`)),c+=sn;break;case`!`:o===`value`&&e.indexOf(`!important`,a)===a?(x=`important`,a+=9):c+=sn;break;case`;`:switch(o){case`before-value`:case`before-name`:qt(`Unexpected ;`),c=``,o=`before-name`;break;case`value`:S.style.setProperty(b,c.trim(),x,qt),x=``,c=``,o=`before-name`;break;case`atRule`:c=``,o=`before-selector`;break;case`importRule`:var yn=p.cssRules.length===0||p.cssRules.some(function(e){return[`CSSImportRule`,`CSSLayerStatementRule`].indexOf(e.constructor.name)!==-1});yn&&(te=new t.CSSImportRule,r&&r.globalObject&&r.globalObject.CSSStyleSheet&&(te.__styleSheet=new r.globalObject.CSSStyleSheet),te.styleSheet.__constructed=!1,te.__parentStyleSheet=te.styleSheet.__parentStyleSheet=f,te.parse(c+sn),p.cssRules.push(te)),c=``,o=`before-selector`;break;case`namespaceRule`:var yn=p.cssRules.length===0||p.cssRules.every(function(e){return[`CSSImportRule`,`CSSLayerStatementRule`,`CSSNamespaceRule`].indexOf(e.constructor.name)!==-1});if(yn)try{var bn=new t.CSSNamespaceRule;bn.parse(c+sn),M=bn,M.__parentStyleSheet=f,p.cssRules.push(M),M.prefix&&(se[M.prefix]=M.namespaceURI)}catch(e){qt(e.message)}c=``,o=`before-selector`;break;case`layerBlock`:var xn=c.trim().split(`,`).map(function(e){return e.trim()}),Sn=xn.some(function(e){return e.trim().match(xe)===null}),Cn=!1;if(_)for(var wn=_;wn;){if(wn.constructor.name===`CSSStyleRule`){Cn=!0;break}wn=wn.__parentRule}!Sn&&!Cn&&(oe=new t.CSSLayerStatementRule,oe.__parentStyleSheet=f,oe.__starts=A.__starts,oe.__ends=a,oe.nameList=xn,_?(oe.__parentRule=_,_.cssRules.push(oe)):p.cssRules.push(oe)),c=``,o=`before-selector`;break;default:c+=sn}break;case`}`:if(o===`counterStyleBlock`){T.name&&(T.parse(`@counter-style `+T.name+` { `+c+` }`),T.__ends=a+1,T.__parentRule?T.__parentRule.cssRules.push(T):p.cssRules.push(T)),T.__parentRule&&(g=T.__parentRule),S=null,c=``,o=`before-selector`;break}if(o===`propertyBlock`){E.__name&&E.parse(`@property `+E.__name+` { `+c+` }`)&&(E.__ends=a+1,E.__parentRule?E.__parentRule.cssRules.push(E):p.cssRules.push(E)),E.__parentRule&&(g=E.__parentRule),S=null,c=``,o=`before-selector`;break}switch(o){case`value`:S.style.setProperty(b,c.trim(),x,qt),x=``;case`before-value`:case`before-name`:case`name`:if(S.__ends=a+1,_===S&&(_=v.pop()),_&&(S.__parentRule=_),S.__parentStyleSheet=f,g===S&&(g=_||p),S.constructor.name===`CSSStyleRule`&&!Gt(S.selectorText)?(S===j&&(j=null),qt(`Invalid CSSStyleRule (selectorText = "`+S.selectorText+`")`,S.parentRule!==null)):S.parentRule?S.parentRule.cssRules.push(S):g.cssRules.push(S),c=``,o=g.constructor===t.CSSKeyframesRule?`keyframeRule-begin`:`before-selector`,S.constructor.name===`CSSNestedDeclarations`)g!==p&&(g.constructor.name===`CSSStyleRule`||g.constructor.name===`CSSScopeRule`)&&(j=g),S=null;else{if(S===j){var Tn=S.selectorText&&S.selectorText.trim(),En=Tn&&Tn.match(Ye),Dn=g&&g instanceof t.CSSGroupingRule;!En&&Dn?(g.constructor.name===`CSSStyleRule`||g.constructor.name===`CSSScopeRule`)&&(j=g):j=null}else j&&g instanceof t.CSSGroupingRule;S=null;break}case`keyframeRule-begin`:case`before-selector`:case`selector`:if(!_){qt(`Unexpected }`),g.cssRules.length&&g.cssRules[g.cssRules.length-1].constructor.name===`CSSStyleRule`&&(a=gt(a,e.slice(a),1));break}for(;v.length>0;)if(_=v.pop(),_!==g&&_ instanceof t.CSSGroupingRule&&(_.constructor.name!==`CSSStyleRule`||_.__parentRule)){if(j&&(g===j||j.__parentRule===g)){if(j.parentRule){y=j,g=j.parentRule;var On=fe(y);de[On]||(g.cssRules.push(y),de[On]=!0),j=g;break}y=g;var kn=v.length>0?v[v.length-1]:j;kn!==y&&kn.cssRules.push(y),g=kn,_=kn;break}y=g,_!==y&&_.cssRules.push(y);break}if(v.length===0&&g.__parentRule&&g.__parentRule.cssRules){var An=fe(g);le[An]||(g.__parentRule.cssRules.push(g),le[An]=!0)}if(v.length===0&&g.parentRule==null){g.__ends=a+1;var jn=fe(g);if(g!==p&&!ue[jn]&&(p.cssRules.push(g),ue[jn]=!0),g=p,j===_){var Mn=e.slice(j.__starts,a+1),Nn=Mn.match(Xe),Pn=Mn.match(Ze);(Nn&&Nn.length)===(Pn&&Pn.length)&&(j.__ends=a+1,j=null,_=null)}else _=null}else g=_;c=``,o=`before-selector`}break;default:switch(o){case`before-selector`:o=`selector`,(S||O)&&_?!Yt(sn)&&!Xt(sn)&&_ instanceof t.CSSGroupingRule&&(o=`before-name`,S!==_&&(S=new t.CSSNestedDeclarations,S.__starts=a)):j&&_&&_ instanceof t.CSSGroupingRule&&(Yt(sn)?(S=new t.CSSStyleRule,S.__starts=a):Xt(sn)||(o=`before-name`,_.cssRules.length||j?(g=_,(_.constructor.name===`CSSStyleRule`||_.constructor.name===`CSSScopeRule`)&&(j=_),S=new t.CSSNestedDeclarations,S.__starts=a):_.constructor.name===`CSSStyleRule`?S=_:(S=new t.CSSStyleRule,S.__starts=a)));break;case`before-name`:o=`name`;break;case`before-value`:o=`value`;break;case`importRule-begin`:o=`importRule`;break;case`namespaceRule-begin`:o=`namespaceRule`}c+=sn}if(a===on&&(g!==p||v.length>0)){var Fn=v.length;g!==p&&v.indexOf(g)===-1&&(Fn+=1);for(var In=0;In<Fn;In++)e+=`}`,an+=1}}return c.trim()!==``&&qt(`Unexpected end of input`),f},e.parse=t.parse,t.CSSStyleSheet=Ip().CSSStyleSheet,t.CSSStyleRule=Fp().CSSStyleRule,t.CSSNestedDeclarations=Lp().CSSNestedDeclarations,t.CSSImportRule=Rp().CSSImportRule,t.CSSNamespaceRule=zp().CSSNamespaceRule,t.CSSGroupingRule=Pp().CSSGroupingRule,t.CSSMediaRule=Vp().CSSMediaRule,t.CSSCounterStyleRule=Hp().CSSCounterStyleRule,t.CSSPropertyRule=Up().CSSPropertyRule,t.CSSContainerRule=Wp().CSSContainerRule,t.CSSConditionRule=Bp().CSSConditionRule,t.CSSSupportsRule=Gp().CSSSupportsRule,t.CSSFontFaceRule=Kp().CSSFontFaceRule,t.CSSHostRule=qp().CSSHostRule,t.CSSStartingStyleRule=Jp().CSSStartingStyleRule,t.CSSStyleDeclaration=sm().CSSStyleDeclaration,t.CSSKeyframeRule=Yp().CSSKeyframeRule,t.CSSKeyframesRule=Xp().CSSKeyframesRule,t.CSSValueExpression=Qp().CSSValueExpression,t.CSSDocumentRule=em().CSSDocumentRule,t.CSSScopeRule=tm().CSSScopeRule,t.CSSLayerBlockRule=nm().CSSLayerBlockRule,t.CSSLayerStatementRule=rm().CSSLayerStatementRule,t.CSSPageRule=im().CSSPageRule,am()})),sm=/* @__PURE__ */ o((e=>{var t={},n=kp().regexPatterns,r=/^(0|[1-9][0-9]*)$/;t.CSSStyleDeclaration=function(){this.length=0,this.parentRule=null,this._importants={}},t.CSSStyleDeclaration.prototype={constructor:t.CSSStyleDeclaration,getPropertyValue:function(e){return this[e]||``},setProperty:function(e,i,a,o){e===`length`||e===`parentRule`||e===`_importants`||e===`__starts`||e in t.CSSStyleDeclaration.prototype||r.test(e)||(n.basicStylePropertyValueValidationRegExp.test(i)?o&&o(`Invalid CSSStyleDeclaration property (name = "`+e+`", value = "`+i+`")`):this[e]?(Array.prototype.indexOf.call(this,e)<0&&(this[this.length]=e,this.length++),(a||!this._importants[e])&&(this.removeProperty(e),this[this.length]=e,this.length++,this[e]=i+``,this._importants[e]=a)):(this[this.length]=e,this.length++,this[e]=i+``,this._importants[e]=a))},removeProperty:function(e){if(!(e in this))return``;var t=Array.prototype.indexOf.call(this,e);if(t<0)return``;var n=this[e];return this[e]=``,Array.prototype.splice.call(this,t,1),n},getPropertyCSSValue:function(){},getPropertyPriority:function(e){return this._importants[e]||``},getPropertyShorthand:function(){},isPropertyImplicit:function(){},get cssText(){for(var e=[],t=0,n=this.length;t<n;++t){var r=this[t],i=this.getPropertyValue(r),a=this.getPropertyPriority(r);a&&=` !`+a,e[t]=r+`: `+i+a+`;`}return e.join(` `)},set cssText(e){for(var n=this.length,r;n--;)r=this[n],this[r]=``;Array.prototype.splice.call(this,0,this.length),this._importants={};var i=t.parse(`#bogus{`+e+`}`).cssRules[0].style,a=i.length;for(n=0;n<a;++n)r=i[n],this.setProperty(i[n],i.getPropertyValue(r),i.getPropertyPriority(r))}},e.CSSStyleDeclaration=t.CSSStyleDeclaration,t.parse=om().parse})),cm=/* @__PURE__ */ o((e=>{var t={CSSStyleSheet:Ip().CSSStyleSheet,CSSRule:Np().CSSRule,CSSNestedDeclarations:Lp().CSSNestedDeclarations,CSSStyleRule:Fp().CSSStyleRule,CSSGroupingRule:Pp().CSSGroupingRule,CSSConditionRule:Bp().CSSConditionRule,CSSMediaRule:Vp().CSSMediaRule,CSSContainerRule:Wp().CSSContainerRule,CSSSupportsRule:Gp().CSSSupportsRule,CSSStyleDeclaration:sm().CSSStyleDeclaration,CSSKeyframeRule:Yp().CSSKeyframeRule,CSSKeyframesRule:Xp().CSSKeyframesRule,CSSScopeRule:tm().CSSScopeRule,CSSLayerBlockRule:nm().CSSLayerBlockRule,CSSLayerStatementRule:rm().CSSLayerStatementRule};try{t.CSSStyleDeclaration=require("cssstyle").CSSStyleDeclaration}catch{}t.clone=function e(n){var r=new t.CSSStyleSheet,i=n.cssRules;if(!i)return r;for(var a=0,o=i.length;a<o;a++){var s=i[a],c=r.cssRules[a]=new s.constructor,l=s.style;if(l)for(var u=c.style=new t.CSSStyleDeclaration,d=0,f=l.length;d<f;d++){var p=l[d];u.setProperty(p,l.getPropertyValue(p),l.getPropertyPriority(p))}s.hasOwnProperty(`keyText`)&&(c.keyText=s.keyText),s.hasOwnProperty(`selectorText`)&&(c.selectorText=s.selectorText),s.hasOwnProperty(`mediaText`)&&(c.mediaText=s.mediaText),s.hasOwnProperty(`supportsText`)&&(c.supports=s.supports),s.hasOwnProperty(`conditionText`)&&(c.conditionText=s.conditionText),s.hasOwnProperty(`layerName`)&&(c.layerName=s.layerName),s.hasOwnProperty(`href`)&&(c.href=s.href),s.hasOwnProperty(`name`)&&(c.name=s.name),s.hasOwnProperty(`nameList`)&&(c.nameList=s.nameList),s.hasOwnProperty(`cssRules`)&&(c.cssRules=e(s).cssRules)}return r},e.clone=t.clone})),lm=(/* @__PURE__ */ o((e=>{e.setup=Dp().setup,Op(),kp(),e.CSSStyleDeclaration=sm().CSSStyleDeclaration,am(),e.CSSRule=Np().CSSRule,e.CSSRuleList=Mp().CSSRuleList,e.CSSNestedDeclarations=Lp().CSSNestedDeclarations,e.CSSGroupingRule=Pp().CSSGroupingRule,e.CSSCounterStyleRule=Hp().CSSCounterStyleRule,e.CSSPropertyRule=Up().CSSPropertyRule,e.CSSConditionRule=Bp().CSSConditionRule,e.CSSStyleRule=Fp().CSSStyleRule,e.MediaList=Ap().MediaList,e.CSSMediaRule=Vp().CSSMediaRule,e.CSSContainerRule=Wp().CSSContainerRule,e.CSSSupportsRule=Gp().CSSSupportsRule,e.CSSImportRule=Rp().CSSImportRule,e.CSSNamespaceRule=zp().CSSNamespaceRule,e.CSSFontFaceRule=Kp().CSSFontFaceRule,e.CSSHostRule=qp().CSSHostRule,e.CSSStartingStyleRule=Jp().CSSStartingStyleRule,e.StyleSheet=jp().StyleSheet,e.CSSStyleSheet=Ip().CSSStyleSheet,e.CSSKeyframesRule=Xp().CSSKeyframesRule,e.CSSKeyframeRule=Yp().CSSKeyframeRule,e.MatcherList=$p().MatcherList,e.CSSDocumentRule=em().CSSDocumentRule,e.CSSValue=Zp().CSSValue,e.CSSValueExpression=Qp().CSSValueExpression,e.CSSScopeRule=tm().CSSScopeRule,e.CSSLayerBlockRule=nm().CSSLayerBlockRule,e.CSSLayerStatementRule=rm().CSSLayerStatementRule,e.CSSPageRule=im().CSSPageRule,e.parse=om().parse,e.clone=cm().clone})))();const um=`style`;var dm=class extends vp{constructor(e,t=um){super(e,t),this[Qi]=null}get sheet(){let e=this[Qi];return e===null?this[Qi]=(0,lm.parse)(this.textContent):e}get innerHTML(){return super.innerHTML||``}set innerHTML(e){super.textContent=e,this[Qi]=null}get innerText(){return super.innerText||``}set innerText(e){super.textContent=e,this[Qi]=null}get textContent(){return super.textContent||``}set textContent(e){super.textContent=e,this[Qi]=null}};xc(um,dm);var fm=class extends K{constructor(e,t=`time`){super(e,t)}get dateTime(){return H.get(this,`datetime`)}set dateTime(e){H.set(this,`datetime`,e)}};xc(`time`,fm);var pm=class extends K{constructor(e,t=`fieldset`){super(e,t)}},mm=class extends K{constructor(e,t=`embed`){super(e,t)}},hm=class extends K{constructor(e,t=`hr`){super(e,t)}},gm=class extends K{constructor(e,t=`progress`){super(e,t)}},_m=class extends K{constructor(e,t=`p`){super(e,t)}},vm=class extends K{constructor(e,t=`table`){super(e,t)}},ym=class extends K{constructor(e,t=`frameset`){super(e,t)}},bm=class extends K{constructor(e,t=`li`){super(e,t)}},xm=class extends K{constructor(e,t=`base`){super(e,t)}},Sm=class extends K{constructor(e,t=`datalist`){super(e,t)}};const Cm=`input`;var wm=class extends K{constructor(e,t=Cm){super(e,t)}
|
|
169
|
+
/* c8 ignore start */
|
|
170
|
+
get autofocus(){return Ic.get(this,`autofocus`)||-1}set autofocus(e){Ic.set(this,`autofocus`,e)}get disabled(){return Ic.get(this,`disabled`)}set disabled(e){Ic.set(this,`disabled`,e)}get name(){return this.getAttribute(`name`)}set name(e){this.setAttribute(`name`,e)}get placeholder(){return this.getAttribute(`placeholder`)}set placeholder(e){this.setAttribute(`placeholder`,e)}get type(){return this.getAttribute(`type`)}set type(e){this.setAttribute(`type`,e)}get value(){return H.get(this,`value`)}set value(e){H.set(this,`value`,e)}};xc(Cm,wm);var Tm=class extends K{constructor(e,t=`param`){super(e,t)}},Em=class extends K{constructor(e,t=`media`){super(e,t)}},Dm=class extends K{constructor(e,t=`audio`){super(e,t)}},Om=class extends K{constructor(e,t=`h1`){super(e,t)}};xc([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],Om);var km=class extends K{constructor(e,t=`dir`){super(e,t)}},Am=class extends K{constructor(e,t=`quote`){super(e,t)}},jm=/* @__PURE__ */ o(((e,t)=>{var n=class{constructor(e,t){this.width=e,this.height=t}getContext(){return null}toDataURL(){return``}};t.exports={createCanvas:(e,t)=>new n(e,t)}}));const{createCanvas:Mm}=(/* @__PURE__ */ l((/* @__PURE__ */ o(((e,t)=>{
|
|
171
|
+
/* c8 ignore start */
|
|
172
|
+
try{t.exports=require("canvas")}catch{t.exports=jm()}})))(),1)).default,Nm=`canvas`;var Pm=class extends K{constructor(e,t=Nm){super(e,t),this[Ki]=Mm(300,150)}get width(){return this[Ki].width}set width(e){Lc.set(this,`width`,e),this[Ki].width=e}get height(){return this[Ki].height}set height(e){Lc.set(this,`height`,e),this[Ki].height=e}getContext(e){return this[Ki].getContext(e)}toDataURL(...e){return this[Ki].toDataURL(...e)}};xc(Nm,Pm);var Fm=class extends K{constructor(e,t=`legend`){super(e,t)}};const Im=`option`;var Lm=class extends K{constructor(e,t=Im){super(e,t)}
|
|
173
|
+
/* c8 ignore start */
|
|
174
|
+
get value(){return H.get(this,`value`)}set value(e){H.set(this,`value`,e)}
|
|
175
|
+
/* c8 ignore stop */
|
|
176
|
+
get selected(){return Ic.get(this,`selected`)}set selected(e){let t=this.parentElement?.querySelector(`option[selected]`);t&&t!==this&&(t.selected=!1),Ic.set(this,`selected`,e)}};xc(Im,Lm);var Rm=class extends K{constructor(e,t=`span`){super(e,t)}},zm=class extends K{constructor(e,t=`meter`){super(e,t)}},Bm=class extends K{constructor(e,t=`video`){super(e,t)}},Vm=class extends K{constructor(e,t=`td`){super(e,t)}};const Hm=`title`;var Um=class extends vp{constructor(e,t=Hm){super(e,t)}};xc(Hm,Um);var Wm=class extends K{constructor(e,t=`output`){super(e,t)}},Gm=class extends K{constructor(e,t=`tr`){super(e,t)}},Km=class extends K{constructor(e,t=`data`){super(e,t)}},qm=class extends K{constructor(e,t=`menu`){super(e,t)}};const Jm=`select`;var Ym=class extends K{constructor(e,t=Jm){super(e,t)}get options(){let e=new Hc,{firstElementChild:t}=this;for(;t;)t.tagName===`OPTGROUP`?e.push(...t.children):e.push(t),t=t.nextElementSibling;return e}
|
|
177
|
+
/* c8 ignore start */
|
|
178
|
+
get disabled(){return Ic.get(this,`disabled`)}set disabled(e){Ic.set(this,`disabled`,e)}get name(){return this.getAttribute(`name`)}set name(e){this.setAttribute(`name`,e)}
|
|
179
|
+
/* c8 ignore stop */
|
|
180
|
+
get value(){return this.querySelector(`option[selected]`)?.value}};xc(Jm,Ym);var Xm=class extends K{constructor(e,t=`br`){super(e,t)}};const Zm=`button`;var Qm=class extends K{constructor(e,t=Zm){super(e,t)}
|
|
181
|
+
/* c8 ignore start */
|
|
182
|
+
get disabled(){return Ic.get(this,`disabled`)}set disabled(e){Ic.set(this,`disabled`,e)}get name(){return this.getAttribute(`name`)}set name(e){this.setAttribute(`name`,e)}get type(){return this.getAttribute(`type`)}set type(e){this.setAttribute(`type`,e)}};xc(Zm,Qm);var $m=class extends K{constructor(e,t=`map`){super(e,t)}},eh=class extends K{constructor(e,t=`optgroup`){super(e,t)}},th=class extends K{constructor(e,t=`dl`){super(e,t)}};const nh=`textarea`;var rh=class extends vp{constructor(e,t=nh){super(e,t)}
|
|
183
|
+
/* c8 ignore start */
|
|
184
|
+
get disabled(){return Ic.get(this,`disabled`)}set disabled(e){Ic.set(this,`disabled`,e)}get name(){return this.getAttribute(`name`)}set name(e){this.setAttribute(`name`,e)}get placeholder(){return this.getAttribute(`placeholder`)}set placeholder(e){this.setAttribute(`placeholder`,e)}get type(){return this.getAttribute(`type`)}set type(e){this.setAttribute(`type`,e)}get value(){return this.textContent}set value(e){this.textContent=e}};xc(nh,rh);var ih=class extends K{constructor(e,t=`font`){super(e,t)}},ah=class extends K{constructor(e,t=`div`){super(e,t)}};const oh=`link`;var sh=class extends K{constructor(e,t=oh){super(e,t)}
|
|
185
|
+
/* c8 ignore start */get disabled(){return Ic.get(this,`disabled`)}set disabled(e){Ic.set(this,`disabled`,e)}get href(){return H.get(this,`href`).trim()}set href(e){H.set(this,`href`,e)}get hreflang(){return H.get(this,`hreflang`)}set hreflang(e){H.set(this,`hreflang`,e)}get media(){return H.get(this,`media`)}set media(e){H.set(this,`media`,e)}get rel(){return H.get(this,`rel`)}set rel(e){H.set(this,`rel`,e)}get type(){return H.get(this,`type`)}set type(e){H.set(this,`type`,e)}};xc(oh,sh);const ch=`slot`;var lh=class extends K{constructor(e,t=ch){super(e,t)}
|
|
186
|
+
/* c8 ignore start */
|
|
187
|
+
get name(){return this.getAttribute(`name`)}set name(e){this.setAttribute(`name`,e)}assign(){}assignedNodes(e){let t=!!this.name,n=this.getRootNode().host?.childNodes??[],r;if(r=t?[...n].filter(e=>e.slot===this.name):[...n].filter(e=>!e.slot),e?.flatten){let e=[];for(let t of r)t.localName===`slot`?e.push(...t.assignedNodes({flatten:!0})):e.push(t);r=e}return r.length?r:[...this.childNodes]}assignedElements(e){let t=this.assignedNodes(e).filter(e=>e.nodeType===1);return t.length?t:[...this.children]}};xc(ch,lh);var uh=class extends K{constructor(e,t=`form`){super(e,t)}},dh=class extends K{constructor(e,t=`img`){super(e,t)}
|
|
188
|
+
/* c8 ignore start */
|
|
189
|
+
get alt(){return H.get(this,`alt`)}set alt(e){H.set(this,`alt`,e)}get sizes(){return H.get(this,`sizes`)}set sizes(e){H.set(this,`sizes`,e)}get src(){return H.get(this,`src`)}set src(e){H.set(this,`src`,e)}get srcset(){return H.get(this,`srcset`)}set srcset(e){H.set(this,`srcset`,e)}get title(){return H.get(this,`title`)}set title(e){H.set(this,`title`,e)}get width(){return Lc.get(this,`width`)}set width(e){Lc.set(this,`width`,e)}get height(){return Lc.get(this,`height`)}set height(e){Lc.set(this,`height`,e)}};xc(`img`,dh);var fh=class extends K{constructor(e,t=`pre`){super(e,t)}},ph=class extends K{constructor(e,t=`ul`){super(e,t)}};const mh=`meta`;var hh=class extends K{constructor(e,t=mh){super(e,t)}
|
|
190
|
+
/* c8 ignore start */
|
|
191
|
+
get name(){return H.get(this,`name`)}set name(e){H.set(this,`name`,e)}get httpEquiv(){return H.get(this,`http-equiv`)}set httpEquiv(e){H.set(this,`http-equiv`,e)}get content(){return H.get(this,`content`)}set content(e){H.set(this,`content`,e)}get charset(){return H.get(this,`charset`)}set charset(e){H.set(this,`charset`,e)}get media(){return H.get(this,`media`)}set media(e){H.set(this,`media`,e)}};xc(mh,hh);var gh=class extends K{constructor(e,t=`picture`){super(e,t)}},_h=class extends K{constructor(e,t=`area`){super(e,t)}},vh=class extends K{constructor(e,t=`ol`){super(e,t)}},yh=class extends K{constructor(e,t=`caption`){super(e,t)}},bh=class extends K{constructor(e,t=`a`){super(e,t)}
|
|
192
|
+
/* c8 ignore start */get href(){return encodeURI(decodeURI(H.get(this,`href`))).trim()}set href(e){H.set(this,`href`,decodeURI(e))}get download(){return encodeURI(decodeURI(H.get(this,`download`)))}set download(e){H.set(this,`download`,decodeURI(e))}get target(){return H.get(this,`target`)}set target(e){H.set(this,`target`,e)}get type(){return H.get(this,`type`)}set type(e){H.set(this,`type`,e)}get rel(){return H.get(this,`rel`)}set rel(e){H.set(this,`rel`,e)}};xc(`a`,bh);var xh=class extends K{constructor(e,t=`label`){super(e,t)}},Sh=class extends K{constructor(e,t=`unknown`){super(e,t)}},Ch=class extends K{constructor(e,t=`mod`){super(e,t)}},wh=class extends K{constructor(e,t=`details`){super(e,t)}};const Th=`source`;var Eh=class extends K{constructor(e,t=Th){super(e,t)}
|
|
193
|
+
/* c8 ignore start */
|
|
194
|
+
get src(){return H.get(this,`src`)}set src(e){H.set(this,`src`,e)}get srcset(){return H.get(this,`srcset`)}set srcset(e){H.set(this,`srcset`,e)}get sizes(){return H.get(this,`sizes`)}set sizes(e){H.set(this,`sizes`,e)}get type(){return H.get(this,`type`)}set type(e){H.set(this,`type`,e)}};xc(Th,Eh);const Dh={HTMLElement:K,HTMLTemplateElement:hp,HTMLHtmlElement:gp,HTMLScriptElement:bp,HTMLFrameElement:xp,HTMLIFrameElement:Cp,HTMLObjectElement:wp,HTMLHeadElement:Tp,HTMLBodyElement:Ep,HTMLStyleElement:dm,HTMLTimeElement:fm,HTMLFieldSetElement:pm,HTMLEmbedElement:mm,HTMLHRElement:hm,HTMLProgressElement:gm,HTMLParagraphElement:_m,HTMLTableElement:vm,HTMLFrameSetElement:ym,HTMLLIElement:bm,HTMLBaseElement:xm,HTMLDataListElement:Sm,HTMLInputElement:wm,HTMLParamElement:Tm,HTMLMediaElement:Em,HTMLAudioElement:Dm,HTMLHeadingElement:Om,HTMLDirectoryElement:km,HTMLQuoteElement:Am,HTMLCanvasElement:Pm,HTMLLegendElement:Fm,HTMLOptionElement:Lm,HTMLSpanElement:Rm,HTMLMeterElement:zm,HTMLVideoElement:Bm,HTMLTableCellElement:Vm,HTMLTitleElement:Um,HTMLOutputElement:Wm,HTMLTableRowElement:Gm,HTMLDataElement:Km,HTMLMenuElement:qm,HTMLSelectElement:Ym,HTMLBRElement:Xm,HTMLButtonElement:Qm,HTMLMapElement:$m,HTMLOptGroupElement:eh,HTMLDListElement:th,HTMLTextAreaElement:rh,HTMLFontElement:ih,HTMLDivElement:ah,HTMLLinkElement:sh,HTMLSlotElement:lh,HTMLFormElement:uh,HTMLImageElement:dh,HTMLPreElement:fh,HTMLUListElement:ph,HTMLMetaElement:hh,HTMLPictureElement:gh,HTMLAreaElement:_h,HTMLOListElement:vh,HTMLTableCaptionElement:yh,HTMLAnchorElement:bh,HTMLLabelElement:xh,HTMLUnknownElement:Sh,HTMLModElement:Ch,HTMLDetailsElement:wh,HTMLSourceElement:Eh,HTMLTrackElement:class extends K{constructor(e,t=`track`){super(e,t)}},HTMLMarqueeElement:class extends K{constructor(e,t=`marquee`){super(e,t)}}},Oh={test:()=>!0},kh={"text/html":{docType:`<!DOCTYPE html>`,ignoreCase:!0,voidElements:/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i},"image/svg+xml":{docType:`<?xml version="1.0" encoding="utf-8"?>`,ignoreCase:!1,voidElements:Oh},"text/xml":{docType:`<?xml version="1.0" encoding="utf-8"?>`,ignoreCase:!1,voidElements:Oh},"application/xml":{docType:`<?xml version="1.0" encoding="utf-8"?>`,ignoreCase:!1,voidElements:Oh},"application/xhtml+xml":{docType:`<?xml version="1.0" encoding="utf-8"?>`,ignoreCase:!1,voidElements:Oh}};
|
|
195
|
+
/* c8 ignore start */
|
|
196
|
+
var Ah=class extends Wf{constructor(e,t={}){super(e,t),this.detail=t.detail}},jh=class extends Wf{constructor(e,t={}){super(e,t),this.inputType=t.inputType,this.data=t.data,this.dataTransfer=t.dataTransfer,this.isComposing=t.isComposing||!1,this.ranges=t.ranges}};
|
|
197
|
+
/* c8 ignore stop */
|
|
198
|
+
const Mh=e=>class extends dh{constructor(t,n){switch(super(e),arguments.length){case 1:this.height=t,this.width=t;break;case 2:this.height=n,this.width=t}}},Nh=({[$i]:e,[R]:t},n=null)=>{rc(e[Xi],t[z]);do{let r=Xs(e),i=r===t?r:r[z];n?n.insertBefore(e,n[R]):e.remove(),e=i}while(e!==t)};var Ph=class e{constructor(){this[$i]=null,this[R]=null,this.commonAncestorContainer=null}insertNode(e){this[R].parentNode.insertBefore(e,this[$i])}selectNode(e){this[$i]=e,this[R]=Xs(e)}selectNodeContents(e){this.selectNode(e),this.commonAncestorContainer=e}surroundContents(e){e.replaceChildren(this.extractContents())}setStartBefore(e){this[$i]=e}setStartAfter(e){this[$i]=e.nextSibling}setEndBefore(e){this[R]=Xs(e.previousSibling)}setEndAfter(e){this[R]=Xs(e)}cloneContents(){let{[$i]:e,[R]:t}=this,n=e.ownerDocument.createDocumentFragment();for(;e!==t;)n.insertBefore(e.cloneNode(!0),n[R]),e=Xs(e),e!==t&&(e=e[z]);return n}deleteContents(){Nh(this)}extractContents(){let e=this[$i].ownerDocument.createDocumentFragment();return Nh(this,e),e}createContextualFragment(e){let{commonAncestorContainer:t}=this,n=`ownerSVGElement`in t,r=n?t.ownerDocument:t,i=ic(r,e);if(n){let e=[...i.childNodes];i=r.createDocumentFragment(),Object.setPrototypeOf(i,$f.prototype),i.ownerSVGElement=r;for(let t of e)Object.setPrototypeOf(t,$f.prototype),t.ownerSVGElement=r,i.appendChild(t)}else this.selectNode(i);return i}cloneRange(){let t=new e;return t[$i]=this[$i],t[R]=this[R],t}};const Fh=({nodeType:e},t)=>{switch(e){case 1:return t&1;case 3:return t&4;case 8:return t&128;case 4:return t&8}return 0};var Ih=class{constructor(e,t=-1){this.root=e,this.currentNode=e,this.whatToShow=t;let{[z]:n,[R]:r}=e;if(e.nodeType===9){let{documentElement:t}=e;n=t,r=t[R]}let i=[];for(;n&&n!==r;)Fh(n,t)&&i.push(n),n=n[z];this[Zi]={i:0,nodes:i}}nextNode(){let e=this[Zi];return this.currentNode=e.i<e.nodes.length?e.nodes[e.i++]:null,this.currentNode}};const Lh=(e,t,n)=>{let{[z]:r,[R]:i}=t;return e.call({ownerDocument:t,[z]:r,[R]:i},n)},Rh=Hs({},fp,Dh,{CustomEvent:Ah,Event:Wf,EventTarget:Vc,InputEvent:jh,NamedNodeMap:Gf,NodeList:Hc}),zh=/* @__PURE__ */ new WeakMap;var Bh=class extends bf{constructor(e){super(null,`#document`,9),this[zi]={active:!1,registry:null},this[Ji]={active:!1,class:null},this[qi]=kh[e],this[Hi]=null,this[Ui]=null,this[Gi]=null,this[Ki]=null,this[ta]=null}get defaultView(){return zh.has(this)||zh.set(this,new Proxy(globalThis,{set:(e,t,n)=>{switch(t){case`addEventListener`:case`removeEventListener`:case`dispatchEvent`:this[Wi][t]=n;break;default:e[t]=n}return!0},get:(e,t)=>{switch(t){case`addEventListener`:case`removeEventListener`:case`dispatchEvent`:if(!this[Wi]){let e=this[Wi]=new Vc;e.dispatchEvent=e.dispatchEvent.bind(e),e.addEventListener=e.addEventListener.bind(e),e.removeEventListener=e.removeEventListener.bind(e)}return this[Wi][t];case`document`:return this;
|
|
199
|
+
/* c8 ignore start */
|
|
200
|
+
case`navigator`:return{userAgent:`Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36`};
|
|
201
|
+
/* c8 ignore stop */
|
|
202
|
+
case`window`:return zh.get(this);case`customElements`:return this[zi].registry||(this[zi]=new hc(this)),this[zi];case`performance`:return e.performance;case`DOMParser`:return this[Ui];case`Image`:return this[Ki]||(this[Ki]=Mh(this)),this[Ki];case`MutationObserver`:return this[Ji].class||(this[Ji]=new Mc(this)),this[Ji].class}return this[Gi]&&this[Gi][t]||Rh[t]||e[t]}})),zh.get(this)}get doctype(){let e=this[Hi];if(e)return e;let{firstChild:t}=this;return t&&t.nodeType===10?this[Hi]=t:null}set doctype(e){if(/^([a-z:]+)(\s+system|\s+public(\s+"([^"]+)")?)?(\s+"([^"]+)")?/i.test(e)){let{$1:e,$4:t,$6:n}=RegExp;this[Hi]=new Sf(this,e,t,n),tc(this,this[Hi],this[z])}}get documentElement(){return this.firstElementChild}get isConnected(){return!0}_getParent(){return this[Wi]}createAttribute(e){return new Zc(this,e)}createCDATASection(e){return new ul(this,e)}createComment(e){return new dl(this,e)}createDocumentFragment(){return new xf(this)}createDocumentType(e,t,n){return new Sf(this,e,t,n)}createElement(e){return new Xf(this,e)}createRange(){let e=new Ph;return e.commonAncestorContainer=this,e}createTextNode(e){return new gf(this,e)}createTreeWalker(e,t=-1){return new Ih(e,t)}createNodeIterator(e,t=-1){return this.createTreeWalker(e,t)}createEvent(e){let t=Us(e===`Event`?new Wf(``):new Ah(``));return t.initEvent=t.initCustomEvent=(e,n=!1,r=!1,i)=>{t.bubbles=!!n,Ws(t,{type:{value:e},canBubble:{value:n},cancelable:{value:r},detail:{value:i}})},t}cloneNode(e=!1){let{constructor:t,[zi]:n,[Hi]:r}=this,i=new t;if(i[zi]=n,e){let e=i[R],{childNodes:t}=this;for(let{length:n}=t,r=0;r<n;r++)i.insertBefore(t[r].cloneNode(!0),e);r&&(i[Hi]=t[0])}return i}importNode(e){let t=1<arguments.length&&!!arguments[1],n=e.cloneNode(t),{[zi]:r}=this,{active:i}=r,a=e=>{let{ownerDocument:t,nodeType:n}=e;e.ownerDocument=this,i&&t!==this&&n===1&&r.upgrade(e)};if(a(n),t)switch(n.nodeType){case 1:case 11:{let{[z]:e,[R]:t}=n;for(;e!==t;)e.nodeType===1&&a(e),e=e[z];break}}return n}toString(){return this.childNodes.join(``)}querySelector(e){return Lh(super.querySelector,this,e)}querySelectorAll(e){return Lh(super.querySelectorAll,this,e)}
|
|
203
|
+
/* c8 ignore start */
|
|
204
|
+
getElementsByTagNameNS(e,t){return this.getElementsByTagName(t)}createAttributeNS(e,t){return this.createAttribute(t)}createElementNS(e,t,n){return e===`http://www.w3.org/2000/svg`?new $f(this,t,null):this.createElement(t,n)}};Js(Rh.Document=function(){ep()},Bh).prototype=Bh.prototype;const Vh=(e,t,n,r)=>{if(!t&&bc.has(n))return new(bc.get(n))(e,n);let{[zi]:{active:i,registry:a}}=e;if(i){let i=t?r.is:n;if(a.has(i)){let{Class:t}=a.get(i),r=new t(e,n);return cc.set(r,{connected:!1}),r}}return new K(e,n)};var Hh=class extends Bh{constructor(){super(`text/html`)}get all(){let e=new Hc,{[z]:t,[R]:n}=this;for(;t!==n;)t.nodeType===1&&e.push(t),t=t[z];return e}get head(){let{documentElement:e}=this,{firstElementChild:t}=e;return t&&t.tagName===`HEAD`||(t=this.createElement(`head`),e.prepend(t)),t}get body(){let{head:e}=this,{nextElementSibling:t}=e;return t&&t.tagName===`BODY`||(t=this.createElement(`body`),e.after(t)),t}get title(){let{head:e}=this;return e.getElementsByTagName(`title`).at(0)?.textContent||``}set title(e){let{head:t}=this,n=t.getElementsByTagName(`title`).at(0);n?n.textContent=e:t.insertBefore(this.createElement(`title`),t.firstChild).textContent=e}createElement(e,t){let n=!!(t&&t.is),r=Vh(this,n,e,t);return n&&r.setAttribute(`is`,t.is),r}},Uh=class extends Bh{constructor(){super(`image/svg+xml`)}toString(){return this[qi].docType+super.toString()}},Wh=class extends Bh{constructor(){super(`text/xml`)}toString(){return this[qi].docType+super.toString()}},Gh=class e{parseFromString(t,n,r=null){let i=!1,a;return n===`text/html`?(i=!0,a=new Hh):a=n===`image/svg+xml`?new Uh:new Wh,a[Ui]=e,r&&(a[Gi]=r),i&&t===`...`&&(t=`<!doctype html><html><head></head><body></body></html>`),t?yc(a,i,t):a}};const{parse:Kh}=JSON,qh=(e,t=null)=>new Gh().parseFromString(e,`text/html`,t).defaultView;function Jh(){ep()}Js(Jh,Bh).prototype=Bh.prototype,Rr(e=>qh(e).document);const Yh=`spoiler`,Xh=/<!\[CDATA\[[\s\S]*?\]\]>|<!--[\s\S]*?-->/g;RegExp(`<(/?)${Yh}(?=[\\s/>])([^>]*?)(/?)>`,`gi`);function Zh(e,t){let n=``,r=0;for(let i of e.matchAll(Xh))n+=t(e.slice(r,i.index))+i[0],r=i.index+i[0].length;return n+t(e.slice(r))}function Qh(e,t,n){let r=RegExp(`<(/?)${t}(?=[\\s/>])`,`gi`);return Zh(e,e=>e.replaceAll(r,(e,t)=>t?`</${Yh}`:`<${Yh} ${n}="1"`))}const $h=`data-ryugi-ask`,eg=e=>Qh(e,`ask`,$h);function tg(e){let t=e.getReader(Yh);e.registerReader(Yh,(e,n)=>{if(!e.hasAttribute($h))return t?t(e,n):!1;let r=[...e.querySelectorAll(`option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent??``})),i=e.getAttribute(`recommend`),a=e.getAttribute(`placeholder`);return{type:`ask`,version:1,askId:e.getAttribute(`id`)??``,...i===null?{}:{recommend:i},...a?{placeholder:a}:{},options:r}}),e.registerWriter(`ask`,e=>{let t=e,n={[$h]:`1`,id:t.askId,...t.recommend?{recommend:t.recommend}:{},...t.placeholder?{placeholder:t.placeholder}:{}};return t.options.length?{tag:Yh,attrs:n,children:t.options.map(e=>({tag:`option`,attrs:{value:e.value},children:[e.label]}))}:{tag:Yh,attrs:n,selfClosing:!0}})}const ng=/<(\/?)(ask|option)\b[^>]*?(\/?)>/gi;function rg(e){let t=0;for(let n of Ar(e).matchAll(ng)){let[,e,r,i]=n;if(r.toLowerCase()===`ask`)i||(t+=e?-1:1);else if(!e&&t===0)return`<option> belongs inside <ask>`}return null}function ig(e,t){let n=e.askId;if(!ir.test(n))return`<ask> needs an id of lowercase letters, digits and hyphens`;if(t.has(n))return`<ask id="${n}"> appears twice; every question needs its own id`;t.add(n);let r=/* @__PURE__ */ new Set;for(let t of e.options){if(!t.value)return`<ask id="${n}"> has an <option> with an empty value`;if(r.has(t.value))return`<ask id="${n}"> repeats the option value "${t.value}"`;if(r.add(t.value),!t.label.trim())return`<ask id="${n}"> has an <option> with an empty label`}return e.recommend!==void 0&&!r.has(e.recommend)?`<ask id="${n}"> recommend="${e.recommend}" is not one of its option values. Allowed values: ${[...r].join(`, `)||`(none; omit recommend)`}. Example: ${r.size?`recommend="${[...r][0]}"`:`<ask id="${n}" />`}`:null}function ag(e){let t=/* @__PURE__ */ new Set,n=(e,r)=>{if(ar(e))return r===`root`?`<ask> belongs inside a paragraph, list item or table cell`:ig(e,t);for(let t of e.children??[]){let r=n(t,e.type);if(r)return r}return null};for(let t of e.root.children){let e=n(t,`root`);if(e)return e}return null}const og=[{type:`document`,refAttribute:`document`,subTargets:[`block`],splitPane:!0},{type:`artboard`,refAttribute:`artboard`,subTargets:[`group`,`board`],splitPane:!0},{type:`whiteboard`,refAttribute:`whiteboard`,subTargets:[`page`,`frame`],splitPane:!0},{type:`html`,refAttribute:`html`,subTargets:[],splitPane:!0},{type:`slides`,refAttribute:`slides`,subTargets:[`slide`],splitPane:!0},{type:`report`,refAttribute:`report`,subTargets:[`block`],splitPane:!0},{type:`storyboard`,refAttribute:`storyboard`,subTargets:[`shot`],splitPane:!0}],sg=og.map(e=>e.refAttribute),cg=[...new Set(og.flatMap(e=>e.subTargets))];function lg(e){return og.find(t=>t.type===e)??null}const ug=e=>e.type===`ref`,dg=e=>sg.filter(t=>e[t]!==void 0),fg=e=>{let t={};for(let n of sg)e[n]!==void 0&&(t[n]=e[n]);e.to&&(t.to=e.to);for(let n of cg)e[n]&&(t[n]=e[n]);return e.embed!==void 0&&(t.embed=e.embed),e.label&&(t.label=e.label),t},pg=e=>dg(e)[0]??`artboard`,mg=e=>e[pg(e)]??``,hg=e=>e.frame??(e.page?`page:${e.page}`:void 0)??e.group??e.board??e.slide??e.block??e.shot??``,gg={document:`a document`,artboard:`an artboard`,whiteboard:`a whiteboard`,html:`an html page`,slides:`a deck`,report:`a report`,storyboard:`a storyboard`},_g=[`artboard`,`whiteboard`,`document`,`html`,`slides`,`report`,`storyboard`],vg=e=>e.length===1?e[0]:`${e.slice(0,-1).join(`, `)} or ${e.at(-1)}`;function yg(e,t=`ref`,n=_g){let r=t===`ref`?`reference`:t,i=dg(e);if(i.length>1)return`<${t}> names one target: either ${vg(i.map(e=>gg[e]))}, not both`;let a=i[0];if(!a)return`<${t}> needs ${vg(n.map(e=>gg[e]))}: the slug of one in this project`;let o=e[a]??``,s=`<${t} ${a}="${o}">`;if(!n.includes(a))return`${s} names ${gg[a]}: an <${t}> takes ${vg(n.map(e=>gg[e]))}`;if(e.embed!==void 0&&a!==`whiteboard`)return`<${t} ${a}="${o}" embed="${e.embed}">: only a whiteboard reference embeds; ${gg[a]} ${r} is a chip`;if(e.embed!==void 0&&e.embed!==`true`)return`<${t} ${a}="${o}" embed="${e.embed}">: write embed="true" to embed the whiteboard, or leave embed out for a chip`;if(!Oe(o))return`${s} is not ${gg[a].replace(/ page$/,``)} slug: lowercase letters, digits and hyphens`;let c=lg(a)?.subTargets??[],l=cg.filter(t=>e[t]!==void 0);for(let e of l){if(c.includes(e))continue;let t=og.filter(t=>t.subTargets.includes(e)).map(e=>e.type),n=c.length?`${gg[a]} ${r} takes ${vg(c)}`:`${gg[a]} ${r} takes no sub-target`;return`${s} has no ${e}: ${e} belongs to ${vg(t)} ${r}s; ${n}`}return l.length>1?`${s} names either a ${l[0]} or a ${l[1]}, not both`:e.page!==void 0&&!un(e.page)?`<${t} ${a}="${o}" page="${e.page}"> is not a page id: lowercase letters, digits and hyphens`:null}const bg=`data-ryugi-ref`,xg=e=>Qh(e,`ref`,bg);function Sg(e){let t=e.getReader(Yh);e.registerReader(Yh,(e,n)=>{if(!e.hasAttribute(bg))return t?t(e,n):!1;let r={};for(let t of[...sg,`to`,...cg,`embed`]){let n=e.getAttribute(t);n!==null&&(r[t]=n)}return r.label=e.textContent??void 0,{type:`ref`,version:1,...fg(r)}}),e.registerWriter(`ref`,e=>{let t=fg(e),n={[bg]:`1`};for(let e of[...sg,`to`,...cg,`embed`]){let r=t[e];r!==void 0&&(n[e]=r)}return t.label?{tag:Yh,attrs:n,children:[t.label]}:{tag:Yh,attrs:n,selfClosing:!0}})}const Cg=e=>[...e.content?.root?.children?[e.content.root.children]:[],...(e.steps??[]).flatMap(e=>e.content?.root?.children?[e.content.root.children]:[])],wg=e=>ug(e)&&e.embed!==void 0,Tg=e=>{let t=e.type===`paragraph`&&e.children?.length===1?e.children[0]:null;return t&&ug(t)&&t.embed!==void 0?t:null};function Eg(e){let t=e.root.children.map(e=>{let t=Tg(e);return t?{...t,...e.$?{$:e.$}:{}}:e});return{...e,root:{...e.root,children:t}}}const Dg=e=>`<ref whiteboard="${e.whiteboard??``}" embed="${e.embed}">: an embedded whiteboard needs a paragraph of its own directly in the document, with nothing else in it`;function Og(e){let t=(e,r)=>{if(ug(e))return yg(e)||(e.embed===void 0?r===`root`?`<ref> belongs inside a paragraph, list item or table cell`:null:r===`root`?null:Dg(e));for(let n of e.children??[]){let r=t(n,e.type);if(r)return r}for(let t of Cg(e)){let e=n(t);if(e)return e}return null},n=e=>{for(let t of e){if(wg(t))return Dg(t);let e=n(t.children??[])??Cg(t).reduce((e,t)=>e??n(t),null);if(e)return e}return null};for(let n of e.root.children){let e=t(n,`root`);if(e)return e}return null}const kg=/* @__PURE__ */ `doc.p.h1.h2.h3.h4.h5.h6.blockquote.ul.ol.li.table.tr.th.td.hr.img.codeblock.mermaid.excalidraw.chart.math.alert.details.steps.step.footnote-section.def.dynamic.pending`.split(`.`),Ag=[`b`,`strong`,`i`,`em`,`u`,`s`,`del`,`strike`,`code`,`sub`,`sup`,`mark`,`a`,`br`,`footnote`,`ask`,`option`,`ref`],jg=/* @__PURE__ */ new Set([...kg,...Ag]),Mg=/* @__PURE__ */ new Set([`agent-diff`,`attachment`,`banner`,`chat`,`code-snippet`,`comment`,`embed`,`gallery`,`grid`,`link-card`,`mention`,`nested-doc`,`poll`,`ruby`,`spoiler`,`tag`,`video`]),Ng=gi();tg(Ng),Sg(Ng),Ng.registerReader(`pending`,e=>{let t=e.getAttribute(`id`);return{type:`pending`,...t?{$:{blockId:t}}:{},intent:e.getAttribute(`intent`)??``,version:1}}),Ng.registerWriter(`pending`,e=>{let{$:t,intent:n}=e;return{tag:`pending`,attrs:{...t?.blockId?{id:t.blockId}:{},intent:n??``},selfClosing:!0}});var Pg=class extends Error{};const Fg=/<dynamic\b[^>]*(?<!\/)>([\s\S]*?)<\/dynamic>/gi,Ig=/<footnote-section\b[\s\S]*?<\/footnote-section>/gi,Lg=/<def[\s>/]/i,Rg=/^\s*<!\[CDATA\[([\s\S]*)\]\]>\s*$/;function zg(e){for(let t of Ar(e).matchAll(Or)){let e=t[2].toLowerCase();if(!jg.has(e))return Mg.has(e)?`<${e}> is not supported in documents`:`<${e}> is not a LiteXML tag`}return null}function Bg(e){return Lg.test(Ar(e).replaceAll(Ig,``))?`<def> belongs inside <footnote-section>`:null}function Vg(e){for(let t of e.matchAll(Fg)){let e=t[1],n=(Rg.exec(e)?.[1]??e).trim();if(n){try{let e=JSON.parse(n);if(e&&typeof e==`object`&&!Array.isArray(e))continue}catch{}return`<dynamic> props must be a JSON object`}}return null}function Hg(e){return Array.isArray(e)?e.some(Hg):!e||typeof e!=`object`?!1:e.type===`pending`||Object.values(e).some(Hg)}const Ug=e=>e.some(e=>e.type!==`pending`&&Hg(e))?`<pending> must be a top-level block`:null;function Wg(e){for(let t of e){if(t.type===`dynamic`&&!Mr.test(t.url??``))return`<dynamic> url must be assets/<name>.html`;let e=Wg(t.children??[]);if(e)return e}return null}function Gg(e){let t=/^\s*<doc[\s>]/.test(e)?e:`<doc>${e}</doc>`,n=jr(t)??zg(t)??Bg(t)??rg(t)??Vg(t);if(n)throw new Pg(n);let r;try{r=Eg(ki(xg(eg(t)),Ng))}catch(e){throw new Pg(e.message)}let i=Wg(r.root.children)??Ug(r.root.children)??ag(r)??Og(r);if(i)throw new Pg(i);return r}const Kg=`任务 prompt(不是文档内容,开任务时写的):`,qg=[`document`,`html`,`artboard`,`whiteboard`,`slides`],Jg=[`group`,`board`,`frame`,`page`,`slide`],Yg=e=>typeof e==`string`?e:``;function Xg(e){let t=qg.find(t=>typeof e[t]==`string`);if(!t)return``;let n=Jg.find(t=>typeof e[t]==`string`);return`${t}/${Yg(e[t])}${n?`#${Yg(e[n])}`:``}`}function Zg(e,t){if(t&16)return`\`${e}\``;let n=e;return t&32&&(n=`<sub>${n}</sub>`),t&64&&(n=`<sup>${n}</sup>`),t&4&&(n=`~~${n}~~`),t&2&&(n=`*${n}*`),t&1&&(n=`**${n}**`),n}function Qg(e,t){return e.options.find(e=>e.value===t)?.label??t??``}function $g(e,t){let n=Yg(e.askId),r=e.options??[],i=t.get(n),a=i&&(i.state===`submitted`||i.state===`settled`);if(a&&i.staleChoice)return`[chosen (stale): ${i.staleChoice}]`;if(a&&i.text)return`[chosen: ${i.text}]`;if(a&&i.choice)return`[chosen: ${Qg({...i,options:r},i.choice)}]`;let o=Yg(e.recommend);return o?`[recommended: ${r.find(e=>e.value===o)?.label??o}]`:`[open]`}var e_=class{views;constructor(e){this.views=e}inline(e=[]){return e.map(e=>this.inlineNode(e)).join(``)}inlineNode(e){switch(e.type){case`text`:return Zg(Yg(e.text),Number(e.format)||0);case`linebreak`:return`
|
|
205
|
+
`;case`link`:return`[${this.inline(e.children)}](${Yg(e.url)})`;case`footnote`:return`[^${Yg(e.identifier)}]`;case`katex-inline`:return`$${Yg(e.equation)}$`;case`ref`:{let t=Xg(e);return`[${Yg(e.label)||t}](ryugi:${t})`}case`ask`:return $g(e,this.views);default:return e.children?this.inline(e.children):``}}blocks(e=[]){return e.map(e=>this.block(e)).filter(e=>e!==``)}document(e=[]){let t=this.blocks(e);return t.length?`${t.join(`
|
|
206
|
+
|
|
207
|
+
`)}\n`:``}nested(e){let t=e?.root;return this.blocks(t?.children).join(`
|
|
208
|
+
|
|
209
|
+
`)}block(e){switch(e.type){case`heading`:{let t=Number(Yg(e.tag).slice(1))||1,n=Yg(e.$?.blockId);return`${`#`.repeat(t)} ${this.inline(e.children)}${n?` {#${n}}`:``}`}case`paragraph`:return this.paragraph(e);case`list`:return this.list(e,``);case`table`:return this.table(e);case`quote`:return n_(this.blocks(e.children).join(`
|
|
210
|
+
|
|
211
|
+
`),`> `);case`horizontalrule`:return`---`;case`code-block`:return t_(Yg(e.language),Yg(e.code));case`mermaid`:return t_(`mermaid`,Yg(e.diagram));case`katex-block`:return`$$\n${Yg(e.equation)}\n$$`;case`alert-quote`:return n_(`[!${Yg(e.alertType).toUpperCase()}]\n${this.nested(e.content)}`,`> `);case`details`:return[`**${Yg(e.summary)}**`,...this.blocks(e.children)].join(`
|
|
212
|
+
|
|
213
|
+
`);case`steps`:return(e.steps??[]).map((e,t)=>{let n=`${t+1}. **${e.title??``}**`,r=this.nested(e.content);return r?`${n}\n${r_(r,` `)}`:n}).join(`
|
|
214
|
+
`);case`chart`:return i_(Yg(e.spec));case`image`:{let t=Yg(e.altText);return`[image: ${t?`${t} — `:``}${Yg(e.src)}]`}case`dynamic`:return`[dynamic: ${Yg(e.url)}]`;case`pending`:return`[pending: ${Yg(e.intent)}]`;case`ref`:return`[whiteboard: ${Xg(e).replace(/^whiteboard\//,``)}]`;case`footnote-section`:return Object.entries(e.definitions??{}).map(([e,t])=>`[^${e}]: ${t}`).join(`
|
|
215
|
+
`);case`excalidraw`:return`[excalidraw: ${Yg(e.src)||Yg(e.$?.blockId)}]`;default:return e.children?this.blocks(e.children).join(`
|
|
216
|
+
|
|
217
|
+
`):`[${e.type}]`}}paragraph(e){let t=e.children??[];return t.length===1&&t[0].type===`ref`&&t[0].embed?`[whiteboard: ${Xg(t[0]).replace(/^whiteboard\//,``)}]`:this.inline(t)}list(e,t){let n=Yg(e.listType),r=Number(e.start)||1,i=[],a=0;for(let o of e.children??[]){let e=o.children??[],s=e.filter(e=>e.type===`list`),c=e.filter(e=>e.type!==`list`),l=s.length>0&&c.length===0,u=l?``:n===`number`?`${r+a}. `:n===`check`?`- [${o.checked?`x`:` `}] `:`- `,d=t+` `.repeat(n===`number`?String(r+Math.max(a-1,0)).length+2:2);l||(i.push(`${t}${u}${this.inline(c)}`),a+=1);let f=l?d:t+` `.repeat(u.length);for(let e of s)i.push(this.list(e,f))}return i.join(`
|
|
218
|
+
`)}table(e){let t=(e.children??[]).map(e=>(e.children??[]).map(e=>this.blocks(e.children).join(`<br>`).replaceAll(`
|
|
219
|
+
`,`<br>`).replaceAll(`|`,`\\|`)));if(!t.length)return``;let n=Math.max(...t.map(e=>e.length)),r=e=>`| ${Array.from({length:n},(t,n)=>e[n]??``).join(` | `)} |`;return[r(t[0]),r(Array.from({length:n},()=>`---`)),...t.slice(1).map(r)].join(`
|
|
220
|
+
`)}};const t_=(e,t)=>{let n=Math.max(0,...[...t.matchAll(/^ *(`{3,})/gm)].map(e=>e[1].length)),r="`".repeat(Math.max(3,n+1));return`${r}${e}\n${t}\n${r}`},n_=(e,t)=>e.split(`
|
|
221
|
+
`).map(e=>e?`${t}${e}`:t.trimEnd()).join(`
|
|
222
|
+
`),r_=(e,t)=>e.split(`
|
|
223
|
+
`).map(e=>e&&`${t}${e}`).join(`
|
|
224
|
+
`);function i_(e){let t;try{t=JSON.parse(e)}catch{return`[chart]`}let n=t.x??``,r=t.series??[],i=e=>`| ${e.map(e=>String(e??``)).join(` | `)} |`,a=[i([n,...r.map(e=>e.label??e.key)]),i(Array.from({length:r.length+1},()=>`---`)),...(t.data??[]).map(e=>i([e[n],...r.map(t=>e[t.key])]))].join(`
|
|
225
|
+
`);return t.title?`**${t.title}**\n\n${a}`:a}const a_=e=>e.root;function o_(e,t){return new e_(new Map(t.map(e=>[e.id,e]))).document(a_(e).children)}const s_=e=>[...e.replaceAll(/\s/g,``)].length;function c_(e,t=[]){let n=new e_(new Map(t.map(e=>[e.id,e]))),r=[];for(let t of a_(e).children??[])t.type===`heading`?r.push({id:Yg(t.$?.blockId),level:Number(Yg(t.tag).slice(1))||1,title:n.inline(t.children),chars:0}):r.length&&(r.at(-1).chars+=s_(n.block(t)));return r}function l_(e){try{return Cr(xr(d.default.readFileSync(f.default.join(e,`comments.json`),`utf8`))).threads}catch{return[]}}function u_(e){let t=Gg(d.default.readFileSync(f.default.join(e,`doc.xml`),`utf8`)),n=mr(sr(t),l_(e)),r=Er(e);return{markdown:(r?`${Kg}\n\n${r.markdown}\n\n---\n\n`:``)+o_(t,n),outline:c_(t,n)}}function d_(e,t,n,r){if(e===`submit`)return{op:`submit`,submit:!t.withdraw};if(!t.ask)throw new M(`comment ${e} needs --ask <questionId>`);if(e===`note`)return{op:`note`,ask:t.ask,text:n()};let i=r?.trim();if(!t.clear&&!t.choice&&!i)throw new M(`comment answer needs --choice <value>, --text <answer>, or --clear`);return{op:`answer`,ask:t.ask,choice:t.clear?null:t.choice??null,answer:t.clear?null:i??null}}var f_='# Document writing\n\nCreate a working copy of the LiteXML outside the artifact directory. For an edit, also keep an untouched copy of the current doc.xml. Save via `write-document --artifact document/<id> --input <edited.xml>`, adding `--base <original.xml>` for edits. This records the writer at the mutation; put assets in `assets/`. Re-read immediately before each edit: the human and server edit this file too. Patch intended blocks, preserve existing IDs and human text; new blocks omit IDs and receive them from the server. Never edit `comments.json` or `.state/`. The server normalizes aliases and indentation after saving. Finish with `check`; pending merging or browser work means check again, not success.\n\nUse a closed `<doc>`. Choose blocks for the reader: diagrams show relationships, charts compare numbers, tables map exact attributes, prose explains reasons. A first draft can contain `<pending intent="What remains to investigate"/>`; fill every pending before claiming completion. Diagrams use native mermaid, or a whiteboard of this project embedded with a reference (below); never pictures of text or box drawing in code blocks.\n\nComplete block and inline vocabulary:\n\n- `h1`–`h6`, `p`, `blockquote`, `ul`/`ol` with `li`, `table`/`tr`/`th`/`td`, `hr`.\n- Inline `b i u s code sub sup mark a br`; aliases `strong em del strike`. Links use `href`. Ordered lists accept `start`; checklists use `<ul type="check"><li checked="true">Done</li></ul>`.\n- `codeblock lang="ts"`: code; use CDATA for literal XML/angle brackets. `mermaid`: native flowcharts/sequences/states. `math`: inline LaTeX, `display="block"` for a block.\n- `img src="assets/image.png" alt="…" caption="…" width="640"`: real images.\n- `alert type="note|tip|important|warning|caution"`: block children. `details summary="…" open="true"`: collapsed depth; omit open for collapsed. `steps` contains `step title="…"` with block children; titles omit numbering.\n- `footnote ref="1"` inline; `footnote-section` contains `def ref="1"` definitions.\n- `chart`: CDATA ChartSpec JSON. Required `version:1`, `type:bar|line|area|pie`, `x` category field, `series:[{key,label?}]`, `data` rows containing x and every series key. Values numbers/null, pie nonnegative. At most 6 series and 6 pie rows. Optional title/subtitle/note/source/xLabel/stacked/donut/highlight, format `{unit,compact,decimals,signed}`, y `{min,max}`, refs `[{y,label}]`. `highlight` is a `series.key` and highlights that entire series; omit it when unnecessary. With `series:[{key:"failures"}]` and rows `[{phase:"Before",failures:12},{phase:"After",failures:4}]`, `highlight:"failures"` is valid; `highlight:"After"` is invalid because it is a row/category value.\n- `dynamic url="assets/demo.html" initial-height="240"`: CDATA JSON becomes `window.ryugiProps`. Self-contained sandboxed HTML, inline scripts/styles, size by content, transparent body. Browser controls persist on HTML rewrite; changing props resets them. Runtime is incomplete until the block has run. Native HTML/CSS/JS and `ryugi-icon` work; storage/cookies do not.\n- `pending intent="…"`, inline `ask`/`option` and `ref` (below; a whiteboard `ref` can also embed as a block). Other tags are rejected.\n\n```xml\n<doc>\n <h1>Retry policy</h1>\n <p>Retry failed delivery at most <b>3</b> times.</p>\n <mermaid><![CDATA[flowchart LR\n ingress --> queue --> worker]]></mermaid>\n <p>Choose a strategy: <ask id="retry-strategy" recommend="exponential"><option value="fixed">Fixed delay</option><option value="exponential">Exponential backoff</option></ask></p>\n <details summary="Evidence"><codeblock lang="text"><![CDATA[attempts: 3]]></codeblock></details>\n</doc>\n```\n\nQuestions: `ask` is inline in p/li/table-cell paragraphs, never directly under doc. Its unique stable id is lowercase letters/digits/hyphens; never reuse an old question ID. Options contain plain text and distinct `value`s; `recommend` must name an option. No options makes an open question: `<ask id="other" placeholder="Describe it"/>`. Human picks are drafts until submitted. Read `comment list --sections threads,asks --detail`. Apply submitted answers, then `comment note --ask <id> --text <what changed>`. Every submitted question needs a note, even unanswered ones (state what was left or assumed). Record terminal answers only when actually supplied via `comment answer --ask <id> --choice <value>` or `--text`, then `comment submit`. Never invent an answer; wait after withdrawal. Changed settled answers require a human instruction and a fresh note.\n\nReferences: inline `<ref document="slug"/>`, `<ref document="slug" block="block-id"/>` (one top-level block of a document: the `id` of its `h2`, `p`, list…; name this document\'s own slug to jump within it), `<ref html="slug">label</ref>`, `<ref artboard="slug" group="q1"/>` (or board), `<ref whiteboard="slug" frame="f1"/>` (or page), `<ref slides="slug" slide="slide-id"/>` (a deck, or one slide of it). Exactly one kind, at most one allowed subtarget, lowercase slug. Optional plain text label; server adds `to` when resolved, preserve it. Missing targets, including a block the document no longer has, are warnings; clear before handoff. Keep referenced IDs stable; when changing a target, update the reference too. A reference under its section heading connects that section to its companion canvas. Live choices/verdicts belong in refs, not duplicated prose.\n\nEmbedded whiteboards: `<ref whiteboard="slug" frame="f1" embed="true"/>` draws the whiteboard in the document instead of a chip. Write it as a paragraph of its own directly under `<doc>`, e.g. `<p><ref whiteboard="sync-flow" frame="f-steps" embed="true"/></p>`; never beside text, in a list, table or quote. `frame` shows that frame cut to its box, `page` one page, neither the main page. Only whiteboard references embed. The drawing follows the whiteboard live: draw and change it on the whiteboard, not in the document; a reader clicks it to open the whole whiteboard. A missing whiteboard or frame is the same check warning as any reference.\n\nAfter editing, run the returned Check command. It names invalid blocks, chart/math/diagram errors, unresolved refs and pending dynamic work. Read complete feedback before acting; reply/resolve and acknowledge only the receipt for evidence actually used.\n';const p_=/^(.+?)->(.+?)(?:#([1-9]\d*))?$/;function m_(e){if(e.node&&e.edge)throw new M(`comment add takes --node or --edge, not both`);if(e.node)return{kind:`node`,id:e.node};if(!e.edge)return;let t=p_.exec(e.edge);if(!t)throw new M(`comment add --edge needs "<from>-><to>", with #n for the nth edge between them`);return{kind:`edge`,from:t[1],to:t[2],index:t[3]?Number(t[3])-1:0}}const h_=e=>t=>d_(e,t,()=>$n(t),t.text);function g_(e,t,n){try{let e=u_(f.default.dirname(n));return{markdown:e.markdown,rows:e.outline}}catch(e){return{warnings:[{code:`W_DOCUMENT_MARKDOWN`,message:`could not read the document as markdown, so it is shown as LiteXML: ${e.message}`}]}}}const __={authoring:f_,localGet:{key:`outline`,read:g_,columns:[{key:`id`,required:!0,positional:!0},{key:`level`,positional:!0},{key:`title`,positional:!0},{key:`chars`}]},changes:!0,review:{sections:[`asks`]},commentActions:{submit:h_(`submit`),answer:h_(`answer`),note:h_(`note`),add:e=>{if(!e.block)throw new M(`comment add needs --block <blockId>`);let t=m_(e);return{op:`add`,blockId:e.block,...t?{diagram:t}:{},...e.quote?{quote:e.quote}:{},text:$n(e)}}}},v_={authoring:'# HTML writing\n\nWrite one complete `index.html` with a descriptive `<title>`, inline or relative styles/scripts/images. The page reloads on edits. Native HTML/CSS/JavaScript works; use labelled controls and visible results. Assets stay inside this artifact directory; CDN fonts/scripts work, absolute local paths do not. Any npm library loads from a CDN with its version pinned; nothing is preloaded, so use one instead of hand-writing its equivalent. The iframe is sandboxed: localStorage/sessionStorage/cookies throw; keep state in DOM/variables. Popups, forms, downloads and clipboard work.\n\n```html\n<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>Retry explorer</title>\n </head>\n <body>\n <label>Attempts <input id="attempts" type="range" min="1" max="5" value="3" /></label>\n <output id="result"></output>\n <script>\n const input = document.getElementById(\'attempts\');\n const render = () =>\n (document.getElementById(\'result\').textContent = input.value + \' attempts\');\n input.addEventListener(\'input\', render);\n render();\n <\/script>\n </body>\n</html>\n```\n\nStable control IDs preserve human input, checks, details and scroll across rewrites. Restoration fires input/change: render from those events. Script-only state resets. Use one surface for one investigation; comparison across independent screens belongs on an artboard. Re-read files before editing; never edit comments or `.state/`.\n\nBundled UI elements require no imports. Use native HTML/CSS for layout. `ryugi-icon name="message-square" size="18"` provides Lucide kebab-case icons (stroke-width defaults 2, color currentColor); label the button, icons are decorative. Find names with `adeck icons <english words>`; unknown names become runtime warnings. For JS-only icons add `<meta name="ryugi-icons" content="1">` and await customElements.whenDefined(\'ryugi-icon\'). Preview glyphs map to the app\'s existing business icons when implementing the design.\n\nRun Check after edits. It distinguishes current static evidence from browser runtime. A closed/unloaded tab means runtime pending; open the returned URL and check again. Uncaught exceptions, rejected promises and missing relative assets are warnings; no browser run is not proof that a page works.\n\n# UI components\n\nHTML artifacts can use a small set of Lobe UI components through Web\nComponents. The artifacts server loads the runtime automatically when the page\ncontains a `<ryugi-…>` element:\n\n```html\n<ryugi-button variant="primary">Save</ryugi-button>\n```\n\nNo script tag is needed. If you create components dynamically, add\n`<meta name="ryugi-ui" content="1">` to the page so the runtime is loaded.\n\nThe runtime loads with `defer`. A page script that needs the components should\nwait for the document event:\n\n```js\ndocument.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n // custom elements are defined\n },\n { once: true },\n);\n```\n\nUse these for controls and basic display. Use plain HTML and CSS for layout;\nthere is no layout wrapper to learn.\n\n## Rules\n\n- Give every interactive control a stable `id`. The viewer restores custom\n controls across rewrites by `id`, the same way it restores native inputs.\n- Listen for `ryugi-change` on controls:\n\n ```js\n document.addEventListener(\'ryugi-change\', (event) => {\n const { value, checked } = event.detail;\n console.log(event.target.id, value, checked);\n });\n ```\n\n It bubbles. `value` is a string, number, boolean, or `null`; `checked` is\n present for checkboxes and switches.\n\n- `value` / `checked` attributes set the initial state. Read the current state\n from the element\'s `value` / `checked` property after `ryugi-ui:ready`, and\n listen for `ryugi-change` for later updates.\n- `class` styles the host; `style` is forwarded to the component as well, so\n `style="width:100%"` works. Style the host, not the component\'s internal\n classes.\n- Keep children simple. For `ryugi-button`, `ryugi-card`, `ryugi-text`,\n `ryugi-tag`, `ryugi-checkbox`, and `ryugi-badge`, the original children are\n moved into the component. `ryugi-select`, `ryugi-segmented`, and\n `ryugi-radio-group` use option children instead.\n- Do not invent a `ryugi-` tag. If a component is not listed here, use HTML.\n- `ryugi-card` already paints a surface. Do not put a background, border and\n padding on both the host and the card: pick one. For a floating panel,\n either position the host and let the card paint its own surface, or make the\n host the surface and use `variant="borderless"` without `glass`/`shadow`.\n- Components follow `prefers-color-scheme`. Set `<html data-theme="light">`\n or `data-theme="dark"` before the runtime loads to pin the whole page.\n Without an explicit theme, the runtime follows OS theme changes.\n Lobe tokens such as `--lobe-color-primary` can be overridden on the host or\n page.\n\n## Controls\n\n### Button\n\n```html\n<ryugi-button variant="primary" size="middle" icon="plus">Add</ryugi-button>\n<ryugi-button variant="outlined" loading>Working…</ryugi-button>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`), `size`\n(`small`, `middle`, `large`), `block`, `loading`, `disabled`, `shape`, `type`,\n`icon` (any Lucide kebab-case name; `refresh` and `trash` remain aliases).\nRun `node app/ryugi.cjs guide icons` for standalone icons and mapping the preview\'s\nactions to business icons when implementing the app.\n\nUses the native `click` event.\n\n### Action icon\n\n```html\n<ryugi-action-icon icon="settings" title="Settings" aria-label="Settings"></ryugi-action-icon>\n```\n\nAttributes: `icon` (same set as Button), `size`, `disabled`, `title`,\n`aria-label`. Uses the native `click` event.\n\n### Tooltip and popover\n\n```html\n<ryugi-tooltip content="Copy a private link" placement="top">\n <ryugi-icon name="copy" size="14"></ryugi-icon> Copy\n</ryugi-tooltip>\n<ryugi-popover id="sharing" content="Only people you invite can open this link.">\n Sharing details\n</ryugi-popover>\n```\n\nBoth provide a native button trigger; children are its label and decorative\nicons, not nested buttons or controls. `content` is plain text, `placement`\nsets the floating position. Tooltip opens on hover/focus; Popover opens on\nclick (`trigger="hover"` opts into hover). Tooltip also accepts `open` for\na controlled preview. Native trigger clicks still reach your handlers.\n\n### Action menu\n\n```html\n<ryugi-menu id="actions" label="More" icon="ellipsis">\n <ryugi-menu-item value="copy" icon="copy">Copy link</ryugi-menu-item>\n <ryugi-menu-item value="delete" icon="trash-2" disabled>Delete</ryugi-menu-item>\n</ryugi-menu>\n```\n\nAttributes: `label`, `icon`, `placement`, `disabled`. Items accept `value`,\n`icon`, `disabled`; their text is the label. Selecting an enabled item emits\n`ryugi-change` with its action in `event.detail.value`. Actions are not\nrestored as control values on reload.\n\n### Input\n\n```html\n<ryugi-input id="title" placeholder="Title" value="Ryugi" style="width:100%"></ryugi-input>\n```\n\nAttributes: `type`, `size` (`small`, `middle`, `large`), `variant`\n(`filled`, `outlined`, `borderless`), `allowClear`, `placeholder`, `value`,\n`disabled`, `name`, `aria-label`.\n\n### Textarea\n\n```html\n<ryugi-textarea id="notes" rows="4" placeholder="Notes" style="width:100%"></ryugi-textarea>\n```\n\nAttributes: `rows`, `size`, `variant`, `placeholder`, `value`, `disabled`,\n`name`.\n\n### Number\n\n```html\n<ryugi-input-number id="count" value="12" min="0" max="100" step="1"></ryugi-input-number>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `precision`, `controls`, `size`,\n`variant`, `placeholder`, `disabled`.\n\n### Slider\n\n```html\n<ryugi-slider id="size" value="32" min="0" max="100" step="1"></ryugi-slider>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `disabled`.\n\n### Slider with number input\n\nThe most useful control for tuning an exact value.\n\n```html\n<ryugi-slider-input id="radius" value="8" min="0" max="32" step="1"></ryugi-slider-input>\n```\n\nAttributes: `value`, `min`, `max`, `step`, `controls`, `size`, `variant`,\n`disabled`.\n\n### Switch\n\n```html\n<ryugi-switch id="dark" checked></ryugi-switch>\n```\n\nAttributes: `checked`, `loading`, `size`, `disabled`, `name`.\n\n### Checkbox\n\n```html\n<ryugi-checkbox id="compact">Compact</ryugi-checkbox>\n```\n\nAttributes: `checked`, `shape`, `size`, `disabled`, `name`. Children are the\nlabel.\n\n### Segmented\n\n```html\n<ryugi-segmented id="mode" value="grid">\n <ryugi-segment value="list">List</ryugi-segment>\n <ryugi-segment value="grid">Grid</ryugi-segment>\n <ryugi-segment value="masonry">Masonry</ryugi-segment>\n</ryugi-segmented>\n```\n\nAttributes: `value`, `size` (`small`, `middle`, `large`), `variant`\n(`filled`, `outlined`), `block`, `glass`, `shadow`, `vertical`, `disabled`.\n\n### Select\n\n```html\n<ryugi-select id="layout" value="a" placeholder="Choose layout">\n <ryugi-option value="a">Sidebar</ryugi-option>\n <ryugi-option value="b">Top tabs</ryugi-option>\n <ryugi-option value="c">Bottom rail</ryugi-option>\n</ryugi-select>\n```\n\nAttributes: `value`, `placeholder`, `size`, `variant`, `allowClear`,\n`showSearch`, `loading`, `mode` (`multiple`, `tags`), `disabled`.\n\n### Radio group\n\n```html\n<ryugi-radio-group id="density" value="comfortable">\n <ryugi-radio value="compact">Compact</ryugi-radio>\n <ryugi-radio value="comfortable">Comfortable</ryugi-radio>\n <ryugi-radio value="spacious">Spacious</ryugi-radio>\n</ryugi-radio-group>\n```\n\nAttributes: `value`, `horizontal`, `gap`, `size`, `disabled`.\n\n### Colour picker\n\n```html\n<ryugi-color-picker id="accent" value="#c56473" trigger="field"></ryugi-color-picker>\n```\n\nAttributes: `value`, `alpha`, `defaultFormat` (`hex`, `rgb`, `hsl`),\n`trigger` (`swatch`, `field`, `chip`), `size`, `disabled`.\n\n## Display\n\n### Toast\n\nHTML artifacts can call the bundled Lobe UI toast API as `window.ryugiToast`.\nIf the page has no `ryugi-` UI controls, opt in with the meta tag. Wait for\n`ryugi-ui:ready` before calling it:\n\n```html\n<meta name="ryugi-ui" content="1" />\n<button id="save" type="button">Save</button>\n<script>\n document.addEventListener(\n \'ryugi-ui:ready\',\n () => {\n document.getElementById(\'save\').addEventListener(\'click\', async () => {\n try {\n await saveDraft(); // the page\'s own operation\n window.ryugiToast.success({ id: \'save-result\', title: \'Saved\' });\n } catch {\n window.ryugiToast.error({\n id: \'save-result\',\n title: \'Save failed\',\n description: \'Try again.\',\n });\n }\n });\n },\n { once: true },\n );\n<\/script>\n```\n\nMethods: `success`, `error`, `info`, `warning`, `loading`. Each takes a string\nmessage or `{ title, description, id, duration }`. Text is rendered as text,\nnot HTML. A stable `id` refreshes the same notification instead of stacking\ncopies. The default duration is 5000ms; `duration: 0` stays until closed.\n`loading` stays until closed by default.\n\nCalls return a handle with `id` and `close()`. Use\n`window.ryugiToast.dismiss(id)` to close one, or `dismiss()` to close all.\nToasts appear at the bottom right and follow the page\'s theme. They are\ntransient: rewriting the page does not restore them. No `ryugi-toast` tag is\nneeded. Artboard pages do not load this UI runtime.\n\n### Tag\n\n```html\n<ryugi-tag variant="outlined">New</ryugi-tag>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`, `solid`), `size`,\n`shape` (`normal`, `round`), `color`, `closable`.\n\n### Alert\n\n```html\n<ryugi-alert\n type="info"\n title="Streaming"\n description="Pending boards draw as skeletons."\n></ryugi-alert>\n```\n\nAttributes: `type` (`success`, `info`, `warning`, `error`, `secondary`),\n`variant` (`soft`, `outlined`, `plain`), `title`, `description`, `showIcon`,\n`closable`. Text children are used as the title when `title` is absent.\n\n### Progress\n\n```html\n<ryugi-progress percent="64" size="small"></ryugi-progress>\n```\n\nAttributes: `percent`, `size`, `status`.\n\n### Badge\n\n```html\n<ryugi-badge count="3" status="processing"></ryugi-badge>\n<ryugi-badge count="3">\n <ryugi-avatar src="avatar.png" alt="Innei" size="32"></ryugi-avatar>\n</ryugi-badge>\n```\n\nAttributes: `count`, `dot`, `status`, `text`, `showZero`, `size`, `color`.\n\n### Avatar\n\n```html\n<ryugi-avatar src="avatar.png" alt="Innei" size="32"></ryugi-avatar>\n```\n\nAttributes: `src`, `alt`, `size`, `shape`.\n\n### Divider\n\n```html\n<ryugi-divider dashed></ryugi-divider>\n```\n\nAttributes: `orientation`, `dashed`.\n\n### Card\n\n```html\n<ryugi-card variant="outlined" shadow>\n <ryugi-text strong>Header</ryugi-text>\n <ryugi-text type="secondary">Supporting copy.</ryugi-text>\n</ryugi-card>\n```\n\nAttributes: `variant` (`filled`, `outlined`, `borderless`), `shadow`,\n`glass`, `clickable`. Children are preserved, including nested components.\n`glass`, `shadow` and `variant` paint the inner Block surface, not the host.\nIf the host supplies the panel background and padding, omit `glass`/`shadow`\nand use `variant="borderless"` so there is only one visible container.\n\n### Text\n\n```html\n<ryugi-text type="secondary">Secondary body text</ryugi-text>\n<ryugi-text strong>Strong label</ryugi-text>\n<ryugi-text code>const x = 1</ryugi-text>\n```\n\nAttributes: `type` (`secondary`, `success`, `warning`, `danger`, `info`),\n`strong`, `code`, `italic`, `underline`, `delete`, `mark`, `align`, `weight`.\n\n## Complete tuning panel\n\n```html\n<ryugi-card>\n <ryugi-text strong>Header</ryugi-text>\n <ryugi-text type="secondary">Tune the reading column.</ryugi-text>\n\n <ryugi-slider-input id="measure" value="64" min="40" max="90" step="1"></ryugi-slider-input>\n\n <ryugi-segmented id="density" value="comfortable">\n <ryugi-segment value="compact">Compact</ryugi-segment>\n <ryugi-segment value="comfortable">Comfortable</ryugi-segment>\n <ryugi-segment value="spacious">Spacious</ryugi-segment>\n </ryugi-segmented>\n\n <ryugi-switch id="dark"></ryugi-switch>\n <ryugi-tag>Live preview</ryugi-tag>\n</ryugi-card>\n\n<script>\n document.addEventListener(\'ryugi-change\', (event) => {\n document.body.dataset[event.target.id] = event.detail.value;\n });\n<\/script>\n```\n\n## Not included in the first version\n\nTabs, Modal, Drawer, Table, DatePicker, and layout\ncomponents. Use plain HTML/CSS or a later component if one is added.\n',phoneScreens:!0};var y_='## Mockup components\n\n`<ryugi-ios-shell>` draws the device and nothing else: the screen (402×874, iPhone 17), status bar, Dynamic Island, home indicator and, with `bezel`, the frame (442×914). Size phone boards to match. Never hand-draw those parts. Three system controls are built in as well: `<ryugi-ios-switch>`, `<ryugi-ios-segmented>` and `<ryugi-ios-slider>` draw the iOS switch, segmented control and slider, with the frosted knob that opens into clear glass while it is pressed, dragged or travelling; use them wherever the product shows one of these controls instead of drawing your own. Everything else on the screen (navigation bar, glass buttons, tab bar, cards, lists, inputs, sheets, a floating composer) is the product\'s own design system: write it by hand in HTML/CSS from the variables of `tokens.css`, in the product\'s own style, including its own Liquid Glass where the product uses it. Do not imitate iOS Settings rows unless the product\'s own screens look like that. The shell renders in light DOM, so selection, comments and the Inspector reach every part. The server loads it when the page contains the tag; for a shell created by script add `<meta name="ryugi-mockup" content="1">` and wait for `ryugi-mockup:ready` on `document`.\n\n```html\n<!doctype html>\n<html lang="zh">\n <head>\n <meta charset="utf-8" />\n <link rel="stylesheet" href="../tokens.css" />\n <style>\n html,\n body {\n margin: 0;\n }\n .nav {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 44px;\n padding: 0 16px;\n }\n .mark {\n font: 700 26px/32px var(--font-display);\n color: var(--color-text);\n }\n .glass {\n display: flex;\n border-radius: 22px;\n background: var(--color-glass);\n backdrop-filter: blur(16px) saturate(1.8);\n color: var(--color-text);\n }\n .glass > * {\n display: grid;\n place-items: center;\n width: 44px;\n height: 44px;\n }\n .card {\n margin: 8px 16px;\n padding: 16px;\n border-radius: var(--radius-card);\n background: var(--color-surface);\n }\n </style>\n </head>\n <body>\n <ryugi-ios-shell>\n <div class="nav">\n <span class="mark">喵旅</span>\n <span class="glass">\n <span\n ><ryugi-icon symbol="person.crop.circle" name="circle-user" size="22"></ryugi-icon\n ></span>\n <span><ryugi-icon symbol="plus" name="plus" size="22"></ryugi-icon></span>\n </span>\n </div>\n <section class="card">…</section>\n </ryugi-ios-shell>\n </body>\n</html>\n```\n\nThe variable names in the example (`--font-display`, `--radius-card`, `--color-glass`) stand for roles; use the names the product\'s own `tokens.css` defines.\n\n| Element | Attributes | Children |\n| ------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `ryugi-ios-shell` | `bezel`, `time` (9:41), `hide="status island home all"` (any of them) | the screen content: it flows from below the status bar (`--safe-top`, 62px); absolutely positioned content measures from the screen\'s top edge. `--safe-bottom` is 34px. Both stay when parts are hidden |\n| `ryugi-token-sheet` | `appearance` to show one set only | one `<script type="application/json">` |\n\nAll of them take `appearance="light|dark"`, otherwise follow the nearest `[data-appearance]`, then the system. Unknown attribute values raise a runtime warning.\n\n### iOS controls\n\n```html\n<div class="row">\n <span>自动暂停</span>\n <ryugi-ios-switch id="auto-pause" checked></ryugi-ios-switch>\n</div>\n<ryugi-ios-segmented id="range" value="week" block>\n <ryugi-ios-segment value="day">日</ryugi-ios-segment>\n <ryugi-ios-segment value="week">周</ryugi-ios-segment>\n <ryugi-ios-segment value="month">月</ryugi-ios-segment>\n</ryugi-ios-segmented>\n<ryugi-ios-slider\n id="volume"\n label="播报音量"\n value="65"\n start-icon="volume-1"\n end-icon="volume-2"\n></ryugi-ios-slider>\n```\n\n| Element | Attributes | Events |\n| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |\n| `ryugi-ios-switch` | `checked`, `disabled`, `size="sm md lg"` (track 22, 28, 36px; md), `color`, `label` and `description` beside it, `label-side="left"` | `change`, `detail.checked` |\n| `ryugi-ios-segmented` | `value`, `size="sm md lg"` (28, 32, 40px; md), `block` to fill the width; children are `<ryugi-ios-segment value>`, whose content (text, a `ryugi-icon`) is the label | `change`, `detail.value` |\n| `ryugi-ios-slider` | `value`, `min`, `max`, `step` (0, 100, 1), `size="sm md lg xl"` (track 8, 12, 18, 26px; md), `color`, `label` above with the value unless `hide-value`, `start-icon` and `end-icon` (Lucide names) | `input` while dragging, `change` when it lands, `detail.value` |\n\nThey are interactive: a tap flips the switch, the knob drags, the segmented lens can be held and dragged to another option, the slider follows the pointer, and the keyboard works. Their state is reflected in the `checked` and `value` attributes, and setting those from a script moves the control. The on colour of the switch and the filled part of the slider read `--color-accent` unless `color` names one (`#34c759`). The track, the segmented background and the selected pill follow the appearance; labels read `--color-text` and `--color-text-secondary`.\n\nIcons: `<ryugi-icon name>` is a Lucide icon; find names with `adeck icons <english words>`. Add `symbol`, an SF Symbol name (`wallet.bifold.fill`): when the local server runs on macOS it draws the symbol through the system and shows it at the symbol\'s own proportions, tinted with `currentColor`; anywhere else (other systems, Artideck Cloud, published links) the Lucide icon shows. Write both. Use `symbol` only in mockups of apps for Apple platforms; that is the condition of Apple\'s license. Symbol images are never part of `pages/` and are never published.\n\nProduct tokens live in one stylesheet (on an artboard `pages/tokens.css`), light on `:root`, dark on `[data-appearance="dark"]`. The shell\'s root carries `data-appearance`, so light and dark phones sit side by side and your content under `[data-appearance="dark"]` flips with them. The shell reads `--color-bg` (screen), `--color-text` (status bar, home indicator) and `--font-body`, falling back to iOS system values; the token sheet also reads `--color-text-secondary`, `--color-separator`, `--color-surface`, `--color-fill` and `--color-accent`. Your content reads the same variables plus the product\'s own (radius, spacing, type, glass).\n\n`ryugi-token-sheet` draws the token table from JSON that names tokens, never values; values come from the stylesheet in both appearances:\n\n```json\n{\n "groups": [\n {\n "name": "Text",\n "kind": "color",\n "tokens": [\n {\n "name": "--color-text-secondary",\n "use": "行右侧的值",\n "on": "--color-surface",\n "board": "t-color-a"\n }\n ]\n },\n {\n "name": "Type",\n "kind": "type",\n "tokens": [{ "name": "--type-body", "use": "正文", "sample": "招商银行储蓄卡" }]\n }\n ]\n}\n```\n\nKinds: `color` (swatches; with `on`, WCAG contrast per appearance flagged under 4.5:1, or 3:1 with `"large": true`), `type` (a `font` shorthand), `space`, `radius`, `size`, `shadow`, `motion` (`<duration> <easing>`, click to play). Token and group names are English; `use` and `sample` follow the product\'s language. Missing variables and broken JSON show inline errors.\n',b_="## Phone mockups\n\nEvery phone screen is a `<ryugi-ios-shell>`: it draws the 402×874 screen, status bar, Dynamic Island and home indicator, and `bezel` adds the 442×914 frame. Never hand-draw those parts, nor a switch, segmented control or slider: `<ryugi-ios-switch>`, `<ryugi-ios-segmented>` and `<ryugi-ios-slider>` are built in. Everything else on the screen is the product's own design from its `tokens.css`. Before the first phone screen or `<ryugi-token-sheet>`, read the mockup guide: `start --artifact <artifact> --help --mockup`.\n",x_='# Report writing\n\nA report is data and presentation kept apart. Each data source is a Node script that prints JSON; the report is `report.tsx`, one default-exported component built only from `@ryugi/report` that imports the data it draws.\n\n```\nreport/<id>/\n report.tsx\n sources/<source-id>/source.json\n sources/<source-id>/<script>.mjs\n data/<source-id>.json written by the hub when a source runs; never write it by hand\n assets/<file>.png images the report shows (png, jpg, gif, webp, avif, svg)\n```\n\n## Data sources\n\n`sources/<source-id>/source.json`: `{ "title": "Commits per day", "description": "main branch, last 30 days", "input": "git history of the repo", "script": "collect.mjs", "args": ["--days", "30"] }`. `title` and `script` are required; the script is a `.mjs`, `.js` or `.cjs` file in the same folder. Source ids are kebab-case.\n\nThe script runs with the project root as cwd and Node from the hub, so it can use the project\'s `node_modules`. Its env is the hub\'s env with the project\'s `.env` and `.env.local` laid over it; read secrets and machine paths from env or `args`, never write them into the script. It must print one JSON value on stdout (at most 2 MB; the whole report\'s data at most 10 MB) and exit 0 within 60 s. Do the aggregation in the script: the report only draws. A stderr line `ryugi:input <text>` replaces the input shown in the panel for that run, such as the commit the data was read at; other stderr is shown when the run fails.\n\nRun sources with `ryugi report refresh --artifact report/<id>` (all) or with `--only <source-id>` (one). The hub runs them, one run per source at a time, and writes `data/<source-id>.json`. Refresh after adding or changing a source, and before `check`. Reports fetched from someone else\'s Cloud link are read-only: never run their scripts.\n\n## report.tsx\n\n```tsx\nimport {\n BarChart,\n Grid,\n Report,\n Section,\n Stat,\n Table,\n useMemo,\n useState,\n Param,\n} from \'@ryugi/report\';\nimport days from \'./data/commits-per-day.json\';\n\nexport default function Commits() {\n const [span, setSpan] = useState(14);\n const shown = useMemo(() => days.slice(-span), [span]);\n return (\n <Report title="Ryugi commits" caption="main branch">\n <Param label="Window" min={7} max={30} unit="days" value={span} onChange={setSpan} />\n <Grid columns={3}>\n <Stat\n id="total"\n source="commits-per-day"\n title="Commits"\n value={shown.reduce((sum, day) => sum + day.commits, 0)}\n />\n </Grid>\n <Section id="daily" title="Per day">\n <BarChart\n id="per-day"\n source="commits-per-day"\n title="Commits per day"\n data={shown}\n x="date"\n series={[{ key: \'commits\', label: \'Commits\' }]}\n />\n <Table\n id="days"\n source="commits-per-day"\n title="Days"\n rows={shown}\n rowKey="date"\n columns={[{ key: \'date\' }, { key: \'commits\', align: \'right\' }]}\n />\n </Section>\n </Report>\n );\n}\n```\n\nImports come only from `@ryugi/report` and `./data/<source-id>.json` (default import; the source must exist). JSX uses SDK components only: no `div`, `img`, `a` or other native elements, no network calls, `document` / `window` / `location` / `navigator` / storage access, `globalThis`, `eval`, `Function`, `.constructor`, `import()` / `require()` or timers. Words in text and strings are fine; the check reads code. The page cannot reach the network either way. `report.tsx` stays under 64 KB; put data in a source. Derive with `useMemo` and plain expressions; keep state in `useState`.\n\nEvery Stat, chart, Table, Callout, Image and Section needs an `id`: kebab-case, unique in the report, and stable across edits, since comments and references hold on to it. Stat, charts and Table also need `source`: the source id, or a list of them, that the block\'s numbers come from; the hover chip and the sources panel read it. Write `id`, `source` and `title` as string literals.\n\nComponents:\n\n- `Report` `{ title, caption? }`: the root; `title` is the artifact\'s title.\n- `Section` `{ id?, title? }`, `Grid` `{ columns?: 1 | 2 | 3 | 4 }`, `Card`, `Stack` `{ gap? }`, `Divider`.\n- `H2`, `H3`, `Text` `{ tone?: \'muted\' }`, `List` `{ items }`, `Callout` `{ id, title?, tone?: \'info\' | \'success\' | \'warning\' | \'error\' }`.\n- `Stat` `{ id, source, title, value, unit?, delta?, format?, note? }`; `delta` is signed and shown up or down.\n- `Table` `{ id, source, title?, rows, rowKey, columns: { key, label?, align?, format? }[] }`; every row prints; a click on a row starts a comment on it.\n- `LineChart`, `BarChart`, `AreaChart`, `PieChart`, `ScatterChart` `{ id, source, title, data, x, series: { key, label?, color? }[], subtitle?, stacked?, donut?, highlight?, refs?: { label, y }[], format?, note? }`: the same chart renderer as a document\'s chart block. A `ScatterChart` needs a numeric `x` in every row. A reader clicks a point to pin it and comments on that point.\n- `Param` `{ label, value, onChange, min?, max?, step?, unit? }` (a slider with a number field when min and max are set), `Select` `{ label?, value, options, onChange }`, `Toggle` `{ label, checked, onChange }`. Printed, they show the value the reader set; a comment on a point or row records them too.\n- `Image` `{ id, src, alt, caption?, width? }`: an image file from the report folder, `src` written as a string such as `"assets/sources-panel.png"`; `alt` describes it. Copy screenshots and figures into `assets/` first; remote URLs are not allowed. Comments anchor to the image as a block.\n- `useState`, `useMemo` from `@ryugi/report`.\n\n`format` is `{ unit?, decimals?, compact?, signed? }`.\n\n## Check, comments, references\n\n`adeck check --artifact report/<id>` reports static issues (imports, native elements, missing or repeated ids, unknown sources, missing data files) and, once a browser has opened the report, render errors.\n\nComments anchor to a block, a table row or a chart point: `adeck comment add --artifact report/<id> --block <block-id> [--point <series>:<x> | --row <rowKey>]`. A comment keeps the value it was made on and which data it saw; after a refresh changes that data it is marked data changed and stays where it was.\n\nReference a report from a document with `<ref report="<id>"/>`, or one block with `<ref report="<id>" block="<block-id>"/>`. A deck names it inline with the same `<ref>`, and shows one block on a slide with `<embed report="<id>" block="<block-id>"/>`; give the blocks a deck shows a stable `id`.\n\nPublishing includes `report.tsx`, `sources/**`, `data/**` and the images under `assets/` with the report\'s visibility. Publishing is refused while a script, `report.tsx` or the data holds an absolute machine path (`/Users/…`, `/home/…`, `C:\\\\…`, not checked in data) or something that looks like a secret (`sk-…`, `ghp_…`, `AKIA…`, a private key, a value from `.env`); the refusal names the file and line.\n';function S_(e){if(!e.block)throw new M(`comment add on a report needs --block <blockId>`);if(e.point!==void 0&&e.row!==void 0)throw new M(`comment add takes --point or --row, not both`);let t;if(e.point!==void 0){let n=e.point.indexOf(`:`);if(n<=0||n===e.point.length-1)throw new M(`--point needs <series>:<x>, such as commits:Nov 2`);t={series:e.point.slice(0,n),x:e.point.slice(n+1)}}return{op:`add`,block:e.block,...t?{point:t}:{},...e.row===void 0?{}:{row:e.row},text:$n(e)}}const C_={authoring:x_,review:{sections:[]},commentActions:{add:S_}};var w_='# Slides writing\n\nWrite one complete `deck.xml` under the returned artifact directory; put images in `assets/` and reference them with relative paths. The deck is for an audience: your human partner presents it. Re-read before each edit; never edit `comments.json` or `.state/`. Finish with `check`.\n\nThe file holds what the slides say. The server compiles it into the page and adds the presentation engine, theme, code highlighting, diagrams and formulas. Only the tags and attributes below exist: there is no `class` and no `style`, and `check` reports anything else by slide and tag.\n\n```xml\n<deck title="Retry policy" lang="en">\n <slide id="cover" layout="cover">\n <kicker>Delivery · Q3</kicker>\n <h1>Retry policy</h1>\n <subtitle>Why failed deliveries now retry three times</subtitle>\n <notes>Open with last month\'s incident.</notes>\n </slide>\n\n <slide id="what-changes">\n <h2>What changes</h2>\n <ol steps="true">\n <li>At most three attempts</li>\n <li>Exponential backoff</li>\n </ol>\n </slide>\n\n <slide id="backoff" layout="code">\n <h2>Backoff</h2>\n <codeblock lang="ts" lines="1|2-3"><![CDATA[\n const delay = (attempt: number) =>\n Math.min(30_000,\n 500 * 2 ** attempt);\n ]]></codeblock>\n </slide>\n</deck>\n```\n\n## Slides\n\n- One slide is one `<slide>` directly inside `<deck>`. The deck\'s `title` is required; `lang` is optional.\n- Every slide needs a unique, stable `id` of lowercase letters, digits and hyphens. Comments and document references find a slide by its id: keep the id when you rewrite a slide, and only change it when the slide becomes a different slide. Deleting a slide orphans its comments.\n- The canvas is fixed at 1280×720. Content that leaves that box is reported by `check` as overflow, naming the slide. Fix it by cutting or splitting the slide; `zoom="0.8"` on the slide (0.3 to 1) is for the one dense slide that must stay whole.\n- While the deck is open in the viewer, `check` also names contact sheet images (`Sheet:`) that show every slide at its last step, twelve to an image, with overflowing and hidden slides marked. After editing, run `check`, open those images, and look for slides that are too full or that all look like the same template. `sheet_not_drawn` under `Pending` means the open viewer has not drawn this version yet. `Sheet: unavailable (…)` means it cannot be drawn, as for a deck holding a video or an iframe: go on without it.\n- `hidden="true"` keeps a slide in the file and out of the talk: it shows, marked, only while the deck is worked on; presenting, the audience window, the PDF and a published link never get it, and it takes no page number.\n- `<group id="evidence" title="What the data says">` inside `<deck>` gathers the slides of one part of the talk. It holds only `<slide>` and `<include>`, never another group; its `id` follows the slide id rules and is unique among slides and groups, and `title` is required. The grid view shows each group as a titled row; the audience sees nothing of it. Slides outside any group are fine, before, between or after groups.\n- `cover="<slide id>"` on `<deck>` names the slide that stands for the deck in lists and links. `check` warns when it names a slide that is missing or hidden.\n- Write XML: close every tag, quote every attribute, write `<` and `&` in text; common names such as ` `, `—` and `→` work, any other is an error, so write the character itself. Code, diagrams and formulas go in `<![CDATA[ … ]]>` so nothing in them needs escaping. CDATA ends at the first `]]>`: code that contains `]]>` comes from a file with `src`. End the file with `</deck>`.\n\n## Layouts\n\nPick the layout that fits what the slide says, and vary them: a deck of identical title-and-bullets slides reads as a template. Each layout adds a few places of its own; a place used in another layout is reported. The theme adds the page number itself.\n\n| `layout` | Use it for | Inside the slide |\n| ----------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------- |\n| `default` | A title with text, a list, a table or code | Optional `<label>`, an `<h2>`, then blocks. Omitting `layout` gives this one |\n| `cover` | The first slide | `<kicker>`, `<h1>`, `<subtitle>` |\n| `section` | The start of a new part | Optional `<label>`, then an `<h1>` or `<h2>` |\n| `statement` | One sentence the audience should remember | Optional `<label>`, an `<h2>` with the key words in `<mark>`, optional `<subtitle>` |\n| `two-cols` | Two things side by side | An `<h2>`, then exactly two `<col>`, each holding blocks |\n| `image` | Text beside a picture | One `<col>` holding the text and one `<img>`; whichever comes first is on the left |\n| `quote` | A quotation | `<quote>` and `<cite>` |\n| `fact` | One number that matters | `<big value="10–12" unit="working days"/>`, then up to three `<fact value="5 days" label="API"/>` |\n| `code` | Code as the subject of the slide | Optional `<label>`, an `<h2>` and one `<codeblock>` or one `<magic>` |\n| `end` | The last slide | An `<h1>` |\n| `none` | A slide you lay out yourself | `src` naming an HTML file; see Free HTML. No padding and no page number |\n\n```xml\n<slide id="numbers" layout="fact">\n <big value="13" unit="harnesses supported"/>\n <fact value="5" label="artifact types"/>\n <fact value="0" label="subscriptions"/>\n</slide>\n<slide id="before-after" layout="two-cols">\n <h2>Before and after</h2>\n <col>\n <h3>Before</h3>\n <p>One attempt, then a page.</p>\n </col>\n <col>\n <h3>After</h3>\n <p>Three attempts, then a page.</p>\n </col>\n</slide>\n<slide id="dashboard" layout="image">\n <col>\n <label>Result</label>\n <h2>Failures fell by half</h2>\n </col>\n <img src="assets/dashboard.png" alt="Failure rate before and after the change" frame="true"/>\n</slide>\n```\n\n## Blocks and text\n\nBlocks sit in a slide or a `<col>`: `<h1>`, `<h2>`, `<h3>`, `<p>`, `<ul>` and `<ol>` of `<li>` (a list may nest in an item), `<table>` of `<tr>` holding `<th>` or `<td>`, `<blockquote>`, `<hr/>`, `<alert type="note|tip|important|warning|caution">` holding blocks, `<img>`, `<icon>`, `<codeblock>`, `<magic>`, `<mermaid>`, `<math>`, `<html>`, `<embed>` and `<notes>`.\n\nBlocks and inline tags a document also has carry the same names here. Inside text: `<b>`/`<strong>`, `<i>`/`<em>`, `<u>`, `<s>`/`<del>`, `<sub>`, `<sup>`, `<code>`, `<mark>`, `<a href="…">`, `<br/>`, `<math>`, `<icon>` and `<ref>`.\n\n- `<img src="assets/chart.png" alt="…"/>` shows a file of the artifact directory. `frame="true"` gives a screenshot rounded corners and a shadow.\n- `<icon name="check" size="32"/>` draws an icon; `size` is in pixels.\n- `<mermaid>` holds a Mermaid diagram and `<math>` a LaTeX formula, both in CDATA. `<math>` inside text is an inline formula.\n- `<notes>` holds speaker notes, shown only to the presenter. One per slide, plain text with `<br/>` between lines.\n\n```xml\n<h2>How a delivery flows</h2>\n<mermaid><![CDATA[\n flowchart LR\n A["ingress<br/>edge"] --> B[queue] --> C[worker]\n]]></mermaid>\n<table>\n <tr><th>Attempt</th><th>Delay</th></tr>\n <tr><td>1</td><td><math>500 \\cdot 2^1</math> ms</td></tr>\n</table>\n<p><icon name="check" size="24"/> Shipped behind a flag, see <a href="https://example.com/rfc">the RFC</a>.</p>\n```\n\n## Code\n\n`<codeblock lang="ts">` is a code block, named as in a document; `<code>` is inline code inside text. Write the code in CDATA; the indentation it shares with the XML is taken off.\n\n- `lines`: stepped line highlight. Parts are separated by `|`, each one step, lines count from 1: `1`, `2-3`, `2-3,5`; `all` lights every line and `hide` hides the block for that step.\n- `src="src/retry.ts#L10-24"`: take the code from a file of the project instead of writing it, optionally only those lines. The path is relative to the project root; files outside the project, dot-files such as `.env`, and files over 512 KB are refused, and so are files named like secrets (`secrets.*`, `credentials.*`, `*.pem`, `*.key`, `*.tfstate`, `*.tfvars`, SSH keys) and files git ignores. Never show a file that holds a secret under another name. What a deck shows is published with it.\n- `numbers="true"`: line numbers. `title="src/retry.ts"`: a title above the block. `max-height="320"`: a height in pixels past which the block scrolls, following the highlighted lines. `diff="true"`: lines starting with `+` or `-` are drawn as added or removed.\n- `<magic lang="ts">` holds two or more `<step>`, each the whole code at one step, in CDATA; what stays moves into place, and each step after the first is a step of the slide.\n\n```xml\n<codeblock lang="ts" src="src/retry.ts#L10-24" numbers="true" title="src/retry.ts" lines="all|3-5"/>\n<codeblock lang="ts" diff="true"><![CDATA[\n const attempts =\n - 1;\n + 3;\n]]></codeblock>\n<magic lang="ts">\n <step><![CDATA[const delay = 500;]]></step>\n <step><![CDATA[const delay = (attempt: number) => 500 * 2 ** attempt;]]></step>\n</magic>\n```\n\n## Steps and marks\n\n- `step="true"` on a block or a list item: it appears on the next step. `steps="true"` on a `<ul>`, `<ol>`, `<table>` or `<col>` makes each item, row or block a step.\n- `step="2"` places a step by number, and `step="with"` makes it appear together with the step before it.\n- `<mark>` highlights words. `type="highlight"`, `underline`, `circle` or `strike` draws that mark; with `step` the words are there from the start and the mark is drawn on its step.\n- `morph="title"` on a block in two consecutive slides moves it from one to the other; a name is used once per slide and the pair should hold the same text.\n\n```xml\n<h2 morph="title">The <mark type="underline" step="true">retry budget</mark> is per delivery</h2>\n<p step="true">Three attempts in total.</p>\n<p step="with">The first one counts.</p>\n<ul steps="true">\n <li>500 ms</li>\n <li>1 s</li>\n</ul>\n```\n\n## Several files and free HTML\n\n- `<include src="parts/appendix.xml"/>` inside `<deck>` puts the slides of another file of the artifact directory there. That file starts with `<slides>`, holds only `<slide>`, and cannot include further files. Ids stay unique across all files.\n- `<html src="parts/demo.html"/>` is a block of HTML you write yourself, in a file of the artifact directory.\n- `<slide id="demo" layout="none" src="parts/demo.html"/>` is a whole slide of your own HTML: you own every pixel of 1280×720. It may hold `<notes>` and nothing else.\n- A free HTML file is a fragment: no page wrapper, every `<div>` closed. `data-step` on an element inside it makes that element a step. It runs in the deck\'s sandbox: no localStorage, sessionStorage or cookies.\n\n```xml\n<deck title="Retry policy">\n <slide id="live-demo" layout="none" src="parts/demo.html">\n <notes>Click through the three states.</notes>\n </slide>\n <slide id="curve">\n <h2>The backoff curve</h2>\n <html src="parts/curve.html"/>\n </slide>\n <include src="parts/appendix.xml"/>\n</deck>\n```\n\n## Other artifacts\n\n`<embed>` puts another artifact of this project on the slide. Name the target by its slug, as a document\'s `<ref>` does:\n\n- `<embed artboard="settings-page" board="q1-b"/>` shows one board of an artboard, in a box of the board\'s shape.\n- `<embed whiteboard="sync-flow" frame="f1"/>` shows one frame of a whiteboard; `page="<page id>"` instead of `frame` shows a whole page. The box takes the shape of the frame or of what is drawn on the page.\n- `<embed report="q3-revenue" block="by-month"/>` shows one block of a report at the slide\'s width and at the block\'s own height, in the deck\'s light or dark.\n- `<embed slides="launch" slide="pricing"/>` shows one slide of another deck at 1280×720, at its last step, in that deck\'s own theme. Embeds on that slide hold their place under their names: decks nest one level.\n- `<embed html="spring-curve"/>` shows an html page, at 1280×720.\n\nAn embed is live: it shows the target as it is now, changes when the target does, and can be scrolled and clicked during the talk. Its corner button opens the target nearly full screen at the embedded part, and Esc closes it. In thumbnails, PNG and PDF export and the contact sheet every embed is a picture of the target.\n\n`<ref>` names another artifact inside text, as a chip: `<ref document="retry-policy">the design</ref>`, `<ref report="q3-revenue" block="by-month"/>`, `<ref whiteboard="sync-flow" frame="f1"/>`. Every kind a document can reference can be named, with the same attributes; with no text of its own the chip shows the target\'s title. Clicking it opens the target nearly full screen; nothing opens while the slide is edited or the pen or laser is on.\n\nPublished, a deck shows the published versions of what it embeds and names. A target that is private, unpublished or gone shows to visitors as its chip text or as an unpublished artifact, never its title or a picture of it; its owner sees it. Publishing the deck offers what it embeds and names to publish with it.\n\nAn embed takes `step` and `morph` like any block. `check` warns, naming the slide, when the artifact or the part it names (board, frame, page, block, slide) is not there, and the slide shows the target\'s name in its place. A `<ref>` to a missing target is warned about the same way.\n\n```xml\n<slide id="settings" layout="two-cols">\n <h2>The settings page</h2>\n <col>\n <p>Option B keeps billing on the first screen.</p>\n </col>\n <col>\n <embed artboard="settings-page" board="q1-b"/>\n </col>\n</slide>\n```\n\n## Theme, motion and glow\n\nChange the look for the whole deck with one `<theme>` before the first slide. `name` picks the theme: `paper` (the default: warm paper, one seal-coloured accent, glow) or `mono` (black on white, monospace labels, emphasis by weight, no glow). `appearance` is `light`, `dark` or `auto`; `auto`, the default, follows the system of whoever opens the deck and prints light, so write `light` or `dark` when the room decides. Every other attribute overrides one variable of the theme, in both appearances. A deck that sets its own `paper`, `surface` or `ink` is `light` unless it names an appearance: those colours suit one appearance only. Do not restyle slide by slide.\n\n```xml\n<deck title="Retry policy">\n <theme name="paper" appearance="dark" accent="#0a7cff" transition="slide-left" fragment="rise" glow-opacity="0.6"/>\n <slide id="cover" layout="cover" transition="fade" glow="top-right" glow-seed="launch">\n <h1>Retry policy</h1>\n </slide>\n</deck>\n```\n\n| `<theme>` attribute | Values | Paper |\n| ----------------------------- | ------------------------------------------------------------ | ------------------------------- |\n| `paper`, `surface` | the slide\'s background, and that of code and cards | |\n| `ink`, `ink-2`, `ink-3` | text, secondary text, labels | |\n| `accent`, `on-accent`, `info` | the accent colour, text on it, and the second accent | |\n| `rule`, `rule-strong` | hairlines | |\n| `font`, `font-mono` | font families | |\n| `transition` | `view`, `fade-out`, `fade`, `slide-left`, `slide-up`, `none` | `view` |\n| `transition-duration` | a time | `500ms` |\n| `transition-blur` | a length | `5px` |\n| `fragment` | `blur`, `fade`, `rise` | `blur` |\n| `fragment-duration` | a time | `500ms` |\n| `fragment-blur` | a length | `3px` |\n| `glow` | `on`, `off` | `on` |\n| `glow-1`, `glow-2`, `glow-3` | colours of the three shapes | `#9440e3`, `#41d1ff`, `#dce354` |\n| `glow-fade` | the colour each shape fades to | `rgb(255 255 255 / 0.1)` |\n| `glow-opacity` | 0 to 1 | `1` |\n| `glow-blur` | a length | `70px` |\n| `glow-drift` | how long the glow takes to move to the next slide\'s place | `2500ms` |\n| `glow-hue` | an angle | `0deg` |\n| `glow-at` | a glow place | `full` |\n\nTransitions:\n\n- `view`: the slide fades out, then the next fades in, both blurred; blocks with the same `morph` on both slides move and resize between them.\n- `fade-out`: the same fade out then in, without moving blocks.\n- `fade`: both slides cross-fade.\n- `slide-left`, `slide-up`: the next slide pushes in from the right or from below; going back reverses it.\n- `none`: the slide changes at once.\n\nSteps: `blur` fades a step in from a blur, `rise` also lifts it 12px, `fade` only fades it.\n\nOn a `<slide>`:\n\n- `transition`: the transition into this slide, one of the values above.\n- `glow`: where this slide\'s glow sits: `full`, `top`, `bottom`, `left`, `right`, `top-left`, `top-right`, `bottom-left`, `bottom-right`, `center`, or `none` for no glow. Left out, the place follows the layout and changes from slide to slide.\n- `glow-seed`: any text; the same seed on the same page number always gives the same shapes.\n- `glow-opacity`: 0 to 1, this slide only.\n- `glow-hue`: degrees, this slide only.\n\n`check` reports an unknown transition or glow place and a `morph` name used twice in one slide. With reduced motion, turns are instant and the glow does not move.\n\n## Placing blocks freely\n\nA layout arranges a slide for you. When a slide must sit exactly as drawn, put `free="true"` on it: every block it holds, inside a `<col>` too, then takes `x`, `y` and `w` in slide pixels of the 1280×720 canvas, and `h` when its height matters (pictures, embeds, diagrams). The layout stays named, so its type sizes still apply, and removing `free` with the coordinates brings the layout back. A block on a free slide without `x`, `y` and `w` is reported, and so are coordinates on a slide that is not free. Later blocks sit on top of earlier ones.\n\n```xml\n<slide id="library" layout="two-cols" free="true">\n <h2 id="b4k2qz" x="96" y="80" w="520">The library</h2>\n <col>\n <p x="96" y="180" w="420" align="center" color="muted">Every artifact, one server.</p>\n </col>\n <col>\n <img x="640" y="120" w="560" h="380" src="assets/library.png" alt="The library page" frame="true"/>\n </col>\n</slide>\n```\n\n- `align="left|center|right|justify"` and `color` work on text blocks on any slide. `color` takes a theme colour, `ink|muted|faint|accent|info`, which follows the theme and its light and dark appearances, or a fixed `#RRGGBB` / `#RRGGBBAA`, which does not. Prefer the theme colours.\n- On a free slide, `w="fill"` stretches a block from its `x` to the right safe margin, and a text block may take `h`: what does not fit is clipped, unless the block also has `fit="shrink"`, which shrinks its text until it fits.\n\n### Look attributes\n\nYour human partner tunes blocks in the viewer\'s tweak panel. Each setting is one attribute on the block, on any slide; `check` reports a value outside its range and an attribute on a block that does not take it.\n\n| Attribute | Blocks | Value |\n| --------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------- |\n| `size="32"` | text | font size, 8–400 px |\n| `weight="600"` | text | 100–900 in steps of 100 |\n| `font="Avenir Next"` | text | `mono` or a font name; a font missing on another machine falls back to the theme font |\n| `leading="1.4"` | text | line height, 0.8–3 |\n| `tracking="-0.5"` | text | letter spacing, -20–100 px |\n| `pad="16"` | text, table, codeblock, code, alert, big, fact | padding, 0–200 px |\n| `fill="surface"` | all but hr, icon and html | a theme colour (`surface`, `paper`, `ink`, `muted`, `faint`, `accent`, `info`) or hex |\n| `opacity="80"` | all but html | 0–100 |\n| `radius="12"` | all but hr, icon and html | 0–360 px |\n| `border="solid"` | all but hr, icon and html | `solid`, `dashed` or `dotted`, 1 px in the theme\'s rule colour |\n| `shadow="0 8 24 #00000040"` | all but hr, icon and html | x, y, blur in px and a colour |\n\n```xml\n<slide id="promise" free="true">\n <p x="96" y="180" w="fill" h="120" fit="shrink" size="32" weight="600" fill="surface" radius="12" pad="16">Every artifact, one server.</p>\n</slide>\n```\n\nThese are deliberate choices: keep these attributes when you rewrite a block, unless changing them is the point.\n\n- An `id` on a block (letters, digits, `_` and `-`, at most 32) is how the viewer and comments know that block again. Your human partner\'s edits give blocks ids: keep every block id when you rewrite a slide, as you keep slide ids.\n\n## Rules\n\n- A talk is given offline: keep fonts, scripts and images inside the artifact directory and avoid CDNs.\n- Notes are not secret: they are hidden from viewers in the interface but remain in the page source.\n- Your human partner can edit notes in the viewer. Saving writes that slide\'s `<notes>` back as plain text lines joined by `<br/>`, replacing any markup inside it, in the file the slide is written in.\n- Keep the whole artifact under 20 MB.\n- Your human partner can edit slides in the viewer: select blocks, drag and resize them (which makes a slide `free="true"`), type into them, change their tag, alignment, colour and every look attribute, restack blocks, change a slide\'s layout, add text boxes, copy, paste and delete. Each edit rewrites the slide in `deck.xml` or its include file in place and is listed by `changes`. Re-read the file before every edit. When you write over one of their edits before you have read it, `check` warns with `W_HUMAN_EDIT_OVERWRITTEN`, naming the slide, the block and what they had set: put their edit back unless you meant to change it.\n- Your human partner can restructure the deck in the viewer\'s grid: reorder and duplicate slides, skip them, add placeholder slides, delete them, and create, rename or move groups. Each change rewrites `deck.xml` (and an include file, for a slide written there) in place, keeping the rest of the text as it was. When `check` reports `Structure: N changes by your human partner`, run `changes --artifact slides/<id>` and read them before editing the deck, so you build on their order instead of writing it back.\n\n## Feedback\n\nComments are anchored to a slide, usually to a point on it. `comment list --sections threads --detail` shows the slide id, its title, the text under the pin and the message. A comment made on selected blocks lists them as `nodes`, each with its block (`#id`, or its position on the slide) and its text: change those blocks. Edit that slide, keep its id, run `check`, then reply with what changed. A comment whose slide was deleted is listed as an orphan.\n\nRun the returned Check command after every edit. Without a browser it reports XML that does not parse, tags, attributes and values the deck cannot take, files it cannot read, missing or duplicate ids, unknown layouts, missing assets and embeds whose target is not there, each naming its slide. Slides that overflow and code, diagram or formula errors come from the browser: with no browser open the result is pending, not clean.\n';const T_=[`default`,`cover`,`section`,`statement`,`two-cols`,`image`,`quote`,`fact`,`code`,`end`,`none`],E_=/^\s*(\d+)(?:\s*-\s*(\d+))?\s*$/,D_=e=>{let t=e.trim();return t===`all`||t===`hide`?t:null};function O_(e){let t=[];for(let n of e.split(`|`)){let e=D_(n);if(e){t.push(e);continue}let r=/* @__PURE__ */ new Set;for(let e of n.split(`,`)){let t=E_.exec(e);if(!t)continue;let n=Number(t[1]),i=t[2]===void 0?n:Number(t[2]),a=Math.max(n,i);for(let e=Math.max(1,Math.min(n,i));e<=a&&!(r.size>=2e3);e++)r.add(e)}r.size&&t.push([...r].sort((e,t)=>e-t))}return t}const k_=e=>e.split(`|`).every(e=>D_(e)!==null||e.split(`,`).every(e=>{let t=E_.exec(e);return t!==null&&Number(t[1])>=1&&Number(t[2]??1)>=1})),A_=[`view`,`fade-out`,`fade`,`slide-left`,`slide-up`,`none`],j_=[`full`,`top`,`bottom`,`left`,`right`,`top-left`,`top-right`,`bottom-left`,`bottom-right`,`center`,`none`],M_=e=>A_.includes(e),N_=e=>j_.includes(e),P_=/^(?:[a-z][a-z0-9+.-]*:|\/|#)/i;function F_(e){let t=e?.trim();return!t||P_.test(t)?null:t.split(/[?#]/)[0]||null}const I_=/^[a-z0-9][a-z0-9-]*$/,L_=`((?:"[^"]*"|'[^']*'|[^'">])*)`,R_=RegExp(`<!--[\\s\\S]*?(?:-->|$)|<(script|style|textarea|template|title)\\b${L_}>([\\s\\S]*?)(?:<\\/\\1\\s*>|$)|<(\\/?)([a-zA-Z][a-zA-Z0-9-]*)${L_}>`,`gi`),z_=/([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g,B_=/reveal(?:\.min)?(?:\.esm)?\.m?js(?:[?#]|$)/i,V_={lt:`<`,gt:`>`,quot:`"`,apos:`'`,nbsp:` `,amp:`&`};function H_(e){let t=/* @__PURE__ */ new Map;for(let n of e.matchAll(z_)){let e=n[1].toLowerCase();t.has(e)||t.set(e,n[2]??n[3]??n[4]??``)}return t}function U_(e){return e.replaceAll(/<[^>]*>/g,``).replaceAll(/&(?:#(\d+)|#x([0-9a-f]+)|([a-z]+));/gi,(e,t,n,r)=>t?String.fromCodePoint(Number(t)):n?String.fromCodePoint(Number.parseInt(n,16)):V_[String(r).toLowerCase()]??e).replaceAll(/\s+/g,` `).trim().slice(0,200)}function W_(e){let t=e.toLowerCase(),n=[],r=[],i=null,a=null,o=!1,s=!1,c=0,l=/* @__PURE__ */ new Set,u=e=>{let t=F_(e);t&&l.add(t)},d=e=>{for(let t=n.length-1;t>=0;t--)if(n[t].tag===e){for(let e of n.splice(t))e.kind===`slide`&&(i=null),e.kind===`notes`&&--c;return}};R_.lastIndex=0;for(let l=R_.exec(e);l;l=R_.exec(e)){let[,f,p=``,m=``,h,g,_=``]=l;if(f){let e=f.toLowerCase();e===`title`&&!i&&a===null&&(a=U_(m)||null);let t=e===`script`?H_(p).get(`src`):void 0;u(t),e===`script`&&(B_.test(t??``)||m.includes(`Reveal.initialize`))&&(s=!0);let r=n.at(-1);e===`template`&&i&&!c&&r?.kind===`magic`&&(r.templates=(r.templates??0)+1,r.templates>1&&(i.steps+=1));continue}if(!g)continue;let v=g.toLowerCase();if(h){(v===`div`||v===`section`||v===`aside`)&&d(v);continue}let y=H_(_);u(y.get(`src`)),v===`link`&&u(y.get(`href`));let b=(y.get(`class`)??``).split(/\s+/).filter(Boolean),x=n.at(-1)?.kind;if(i&&!c){let n=y.get(`data-morph`)?.trim();if(n&&(i.morphs.has(n)&&!i.morphRepeats.includes(n)&&i.morphRepeats.push(n),i.morphs.add(n)),b.includes(`fragment`)){let e=y.get(`data-fragment-index`);e!==void 0&&i.positions.has(e)||(i.steps+=1),e!==void 0&&i.positions.add(e)}if(v===`code`&&(i.steps+=Math.max(0,O_(y.get(`data-lines`)??``).length-1)),!i.titled&&/^h[1-3]$/.test(v)){let n=t.indexOf(`</${v}`,R_.lastIndex);i.title=U_(e.slice(R_.lastIndex,n===-1?void 0:n)),i.titled=!0}}if(v===`div`){let e=`other`;!o&&x===`reveal`&&b.includes(`slides`)?(e=`slides`,o=!0):!o&&b.includes(`reveal`)?e=`reveal`:i&&b.includes(`magic-move`)&&(e=`magic`),n.push({tag:v,kind:e})}else if(v===`section`){if(x===`slides`){let e=b.find(e=>e.startsWith(`l-`)),t=e?e.slice(2):`default`;i={id:y.get(`id`)||null,layout:t,title:``,steps:0,notes:!1,nested:!1,titled:!1,unknownLayout:T_.includes(t)?null:t,transition:y.get(`data-transition`)?.trim()??null,glow:y.get(`data-glow`)?.trim()??null,morphs:/* @__PURE__ */ new Set,morphRepeats:[],positions:/* @__PURE__ */ new Set,...y.has(`data-deck-hidden`)?{hidden:!0}:{},...y.get(`data-deck-group`)?{group:y.get(`data-deck-group`)}:{}},r.push(i),n.push({tag:v,kind:`slide`})}else i&&(i.nested=!0),n.push({tag:v,kind:`other`})}else if(v===`aside`){let e=i!==null&&b.includes(`notes`);e&&(i.notes=!0,c+=1),n.push({tag:v,kind:e?`notes`:`other`})}}let f=[],p=/* @__PURE__ */ new Set,m=r.map(({nested:e,titled:t,unknownLayout:n,transition:r,glow:i,morphs:a,morphRepeats:o,positions:s,...c},l)=>{let u=c.id??void 0;c.id?I_.test(c.id)?p.has(c.id)&&f.push({code:`duplicate_id`,slide:l,id:u}):f.push({code:`invalid_id`,slide:l,id:u}):f.push({code:`missing_id`,slide:l}),c.id&&p.add(c.id),e&&f.push({code:`nested_slide`,slide:l,...u?{id:u}:{}}),n&&f.push({code:`unknown_layout`,slide:l,...u?{id:u}:{},detail:n});let d={slide:l,...u?{id:u}:{}};r!==null&&!M_(r)&&f.push({code:`unknown_transition`,...d,detail:r}),i!==null&&!N_(i)&&f.push({code:`unknown_glow`,...d,detail:i});for(let e of o)f.push({code:`duplicate_morph`,...d,detail:e});return c});return s&&f.push({code:`own_reveal`,slide:-1}),{complete:/<\/html\s*>\s*$/i.test(e),hasDeck:o,title:a,slides:m,issues:f,assets:[...l]}}const G_=new Map(Object.entries({lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`,nbsp:`\xA0`,mdash:`—`,ndash:`–`,hellip:`…`,rarr:`→`,larr:`←`,uarr:`↑`,darr:`↓`,harr:`↔`,copy:`©`,reg:`®`,trade:`™`,times:`×`,divide:`÷`,middot:`·`,bull:`•`,laquo:`«`,raquo:`»`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,deg:`°`,plusmn:`±`,le:`≤`,ge:`≥`,ne:`≠`,euro:`€`,pound:`£`,yen:`¥`})),K_=/[A-Za-z_][\w.-]*/y,q_=/\s*/y,J_=e=>`name`in e;function Y_(e,t){return e.replaceAll(/&(?:#(\d{1,7})|#x([0-9a-fA-F]{1,6})|([A-Za-z][A-Za-z0-9]*));/g,(e,n,r,i,a)=>{let o=n?Number(n):r?Number.parseInt(r,16):null;if(o!==null)return o>0&&o<=1114111?String.fromCodePoint(o):e;let s=G_.get(i);return s===void 0&&t?.(i,a),s??e})}function X_(e){return J_(e)?e.children.map(X_).join(``):e.text}function Z_(e){let t=[],n=null,r=t=>{if(!n){n=[];for(let t=e.indexOf(`
|
|
226
|
+
`);t!==-1;t=e.indexOf(`
|
|
227
|
+
`,t+1))n.push(t)}let r=0,i=n.length;for(;r<i;){let e=r+i>>1;n[e]<t?r=e+1:i=e}return r+1},i=(e,n)=>t.push({line:r(e),message:n}),a=[],o=[],s=()=>o.at(-1)?.children??a,c=/* @__PURE__ */ new Set,l=e=>(t,n)=>{c.has(t)||(c.add(t),i(e+n,`&${t}; is not an entity a deck knows: write the character itself, or & for a plain &`))},u=(t,n,r)=>{if(n<=t)return;let a=e.slice(t,n),o=r?-1:a.indexOf(`]]>`);o!==-1&&i(t+o,`a ]]> outside CDATA: the section before it ended early. Split it as ]]]]><![CDATA[> or take the code from a file`),s().push({start:t,end:n,cdata:r,text:r?a:Y_(a,l(t))})},d=0;for(;d<e.length;){let n=e.indexOf(`<`,d);if(n===-1){u(d,e.length,!1);break}if(u(d,n,!1),e.startsWith(`<!--`,n)){let t=e.indexOf(`-->`,n+4);if(t===-1){i(n,`a comment is never closed with -->`);break}d=t+3;continue}if(e.startsWith(`<![CDATA[`,n)){let t=e.indexOf(`]]>`,n+9);if(t===-1){i(n,`a CDATA section is never closed with ]]>`);break}u(n+9,t,!0),d=t+3;continue}if(e.startsWith(`<?`,n)||e.startsWith(`<!`,n)){let t=e.indexOf(`>`,n);d=t===-1?e.length:t+1;continue}if(e[n+1]===`/`){K_.lastIndex=n+2;let t=K_.exec(e)?.[0],r=e.indexOf(`>`,n);if(!t||r===-1){i(n,`a closing tag is not finished`);break}d=r+1;let a=o.length-1;for(;a>=0&&o[a].name!==t;)--a;if(a===-1&&o.length===0){i(n,`</${t}> closes nothing that is open`);continue}a!==o.length-1&&i(n,`</${t}> closes <${o.at(-1).name}>, which is still open`);for(let e of o.splice(a===-1?o.length-1:a))e.innerEnd=n,e.end=d;continue}K_.lastIndex=n+1;let a=K_.exec(e)?.[0];if(!a){i(n,`a "<" that starts no tag: write < or use CDATA`),d=n+1;continue}let c=/* @__PURE__ */ new Map,f=n+1+a.length,p=!1,m=!1;for(;f<e.length;){if(q_.lastIndex=f,f+=q_.exec(e)[0].length,e[f]===`>`){f+=1,m=!0;break}if(e.startsWith(`/>`,f)){f+=2,p=!0,m=!0;break}K_.lastIndex=f;let t=K_.exec(e)?.[0],n=t?e[f+t.length+1]:void 0;if(!t||e[f+t.length]!==`=`||n!==`"`&&n!==`'`){i(f,`<${a}> has an attribute that is not name="value"`);break}let r=f+t.length+2,o=e.indexOf(n,r);if(o===-1){i(f,`<${a}> has an attribute value that is never closed`);break}c.has(t)||c.set(t,Y_(e.slice(r,o),l(r))),f=o+1}if(!m){let r=e.indexOf(`>`,f);if((t.length===0||r===-1)&&i(n,`<${a}> is not finished`),r===-1)break;f=r+1}let h={name:a,attrs:c,children:[],start:n,end:f,innerStart:f,innerEnd:f,line:r(n),selfClosing:p};if(s().push(h),d=f,!p){if(o.length>=100){i(n,`elements are nested more than 100 deep`);break}o.push(h)}}let f=t.length>0&&d<e.length;for(let t of o)f||i(t.start,`<${t.name}> is never closed`),t.innerEnd=e.length,t.end=e.length;let p=a.filter(J_),m=a.find(e=>!J_(e)&&e.text.trim()!==``);return p.length>1?i(p[1].start,`only one root element is allowed`):m&&i(m.start,`text outside the root element`),{root:p[0]??null,errors:t}}const Q_=/* @__PURE__ */ `h1.h2.h3.p.blockquote.ul.ol.table.img.icon.alert.hr.codeblock.code.magic.mermaid.math.chart.embed.html.kicker.subtitle.label.quote.cite.big.fact`.split(`.`),$_=[`h1`,`h2`,`h3`,`p`,`blockquote`,`ul`,`ol`,`kicker`,`subtitle`,`label`,`quote`,`cite`],ev=[`ink`,`muted`,`faint`,`accent`,`info`],tv=[`left`,`center`,`right`],nv=[`x`,`y`,`w`,`h`],rv=/^[A-Za-z0-9_-]{1,32}$/,iv=e=>Q_.includes(e);function av(e){let t=/* @__PURE__ */ new Map;return e.children.filter(J_).forEach((e,n)=>{e.name===`col`?e.children.filter(J_).forEach((e,r)=>{iv(e.name)&&t.set(e,`${n}.${r}`)}):iv(e.name)&&t.set(e,String(n))}),t}const ov=ev,sv=[`surface`,`paper`,`ink`,`muted`,`faint`,`accent`,`info`],cv=[`solid`,`dashed`,`dotted`],lv=[...tv,`justify`],uv={ink:`ink`,muted:`ink-2`,faint:`ink-3`,accent:`accent`,info:`info`,surface:`surface`,paper:`paper`},dv=e=>`var(--deck-${uv[e]??e})`,fv=[`img`,`embed`,`chart`,`mermaid`,`math`,`magic`],pv=[`table`,`codeblock`,`code`,`alert`,`big`,`fact`],mv=[`hr`,`icon`],hv=[`fill`,`opacity`,`radius`,`border`,`shadow`],gv=[`font`,`weight`,`size`,`leading`,`tracking`,`fit`];function _v(e){return $_.includes(e)?[`pad`,...gv,`align`,`color`,...hv]:fv.includes(e)?[...hv]:pv.includes(e)?[`pad`,...hv]:mv.includes(e)?[`opacity`]:[]}const vv=/^#(?:[0-9a-f]{6}|[0-9a-f]{8})$/i,yv=/^[\p{L}\p{N}][\p{L}\p{N} ._-]{0,63}$/u,bv=(e,t,n)=>/^-?\d+$/.test(e)&&Number(e)>=t&&Number(e)<=n,xv=(e,t,n,r)=>RegExp(`^-?\\d+(?:\\.\\d{1,${r}})?$`).test(e)&&Number(e)>=t&&Number(e)<=n,Sv=(e,t)=>t.includes(e)||vv.test(e);function Cv(e){let t=e.split(` `);if(t.length!==4)return null;let[n,r,i,a]=t;return bv(n,-200,200)&&bv(r,-200,200)&&bv(i,0,200)&&Sv(a,sv)?[n,r,i,a]:null}const wv={pad:[e=>bv(e,0,200),`must be whole pixels from 0 to 200`],font:[e=>e===`mono`||yv.test(e),`must be mono or a font name: letters, digits, spaces, - _ . (at most 64)`],weight:[e=>bv(e,100,900)&&Number(e)%100==0,`must be 100, 200 … 900`],size:[e=>bv(e,8,400),`must be whole pixels from 8 to 400`],leading:[e=>xv(e,.8,3,2),`must be 0.8 to 3, at most two decimals`],tracking:[e=>xv(e,-20,100,1),`must be -20 to 100 pixels, at most one decimal`],fit:[e=>e===`shrink`,`must be shrink`],fill:[e=>Sv(e,sv),`must be #RRGGBB, #RRGGBBAA or ${sv.join(`, `)}`],opacity:[e=>bv(e,0,100),`must be 0 to 100`],radius:[e=>bv(e,0,360),`must be whole pixels from 0 to 360`],border:[e=>cv.includes(e),`must be ${cv.join(`, `)}`],shadow:[e=>Cv(e)!==null,`must be "x y blur colour": x and y -200 to 200, blur 0 to 200`],align:[e=>lv.includes(e),`must be ${lv.join(`, `)}`],color:[e=>Sv(e,ov),`must be #RRGGBB, #RRGGBBAA or a theme colour: ${ov.join(`, `)}`]};function Tv(e,t,n){let r=Object.hasOwn(wv,t)?wv[t]:void 0;return r?_v(e).includes(t)?r[0](n)?null:`${t}="${n}" ${r[1]}`:`<${e}> takes no ${t}`:`${t} is not a look attribute`}const Ev=e=>vv.test(e)?e:dv(e);function Dv(e,t){switch(e){case`pad`:return[[`padding`,`${t}px`]];case`font`:return[[`font-family`,t===`mono`?`var(--deck-font-mono)`:`"${t}", var(--deck-font)`]];case`weight`:return[[`font-weight`,t]];case`size`:return[[`font-size`,`${t}px`]];case`leading`:return[[`line-height`,t]];case`tracking`:return[[`letter-spacing`,`${t}px`]];case`fill`:return[[`background-color`,Ev(t)]];case`opacity`:return[[`opacity`,String(Number(t)/100)]];case`radius`:return[[`border-radius`,`${t}px`]];case`border`:return[[`border`,`1px ${t} var(--deck-rule-strong)`]];case`shadow`:{let e=Cv(t);if(!e)return[];let[n,r,i,a]=e;return[[`box-shadow`,`${n}px ${r}px ${i}px ${Ev(a)}`]]}case`color`:return[[`color`,Ev(t)]];case`align`:return[[`text-align`,t]];default:return[]}}const Ov={explicit:!1,from:/* @__PURE__ */ new Map,index:/* @__PURE__ */ new Map},kv=/^[1-9]\d?$/,Av=(e,t)=>e.name===`col`||(e.name===`ul`||e.name===`ol`)&&t.name===`li`||e.name===`table`&&t.name===`tr`&&t.children.some(e=>J_(e)&&e.name===`td`);function jv(e){return e.name===`codeblock`?Math.max(0,O_(e.attrs.get(`lines`)??``).length-1):e.name===`magic`?Math.max(0,e.children.filter(e=>J_(e)&&e.name===`step`).length-1):0}function Mv(e){let t=/* @__PURE__ */ new Set,n=e=>{let r=e.attrs.get(`step`)??``;kv.test(r)&&t.add(Number(r)-1);for(let t of e.children)J_(t)&&n(t)};return n(e),t}function Nv(e,t){let n={explicit:!1,from:/* @__PURE__ */ new Map,index:/* @__PURE__ */ new Map},r=Mv(e),i=0,a=null,o=()=>{for(;r.has(i);)i+=1;return i+=1,i-1},s=(e,r)=>{if(e.name===`notes`)return;let c=e.attrs.get(`step`)??(r?`true`:`false`),l=null;c===`true`?l=o():c===`with`?(n.explicit=!0,a===null?t.bad(e,`step`,`has no step before it to appear with`):l=a):kv.test(c)?(n.explicit=!0,l=Number(c)-1):c!==`false`&&t.bad(e,`step`,`must be true, with, or a step number from 1`),l!==null&&(n.index.set(e,l),a=l);let u=jv(e);if(u>0){n.from.set(e,o());for(let e=1;e<u;e+=1)o();a=i-1}if(e.name===`codeblock`||e.name===`magic`)return;let d=e.attrs.get(`steps`);d!==void 0&&d!==`true`&&d!==`false`&&t.bad(e,`steps`,`must be true or false`);for(let t of e.children)J_(t)&&s(t,d===`true`&&Av(e,t))};for(let t of e.children)J_(t)&&s(t,!1);return n}const Pv=/^[a-z0-9-]{1,16}$/,Fv=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,Iv={readFile:(e,t)=>({error:`${t} cannot be read here`})},Lv=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`);function Rv(e){let t=e.filter(([e,t])=>e===`style`&&t!==!0);if(t.length<2)return e;let n=t.map(([,e])=>e).join(`;`),r=e.findIndex(([e])=>e===`style`);return e.flatMap((e,t)=>e[0]===`style`?t===r?[[`style`,n]]:[]:[e])}function zv(e,{classes:t,attrs:n},r){return`<${[e,...r===void 0?[]:[`id="${Lv(r)}"`],...t.length?[`class="${t.join(` `)}"`]:[],...Rv(n).map(([e,t])=>t===!0?e:`${e}="${Lv(t)}"`)].join(` `)}>`}const Bv=/^[a-z0-9][a-z0-9-]*$/;var Vv=class{env;audience;sources;deps=[];embeds=[];issues=[];refs=[];warnings=[];id;free=!1;placed=/* @__PURE__ */ new Map;blockIds=/* @__PURE__ */ new Set;slide=-1;steps=Ov;constructor(e,t=!1,n=!1){this.env=e,this.audience=t,this.sources=n}issue(e,t,n){return{code:e,slide:this.slide,...this.id?{id:this.id}:{},...n?{tag:n}:{},detail:t}}report(e,t,n){this.issues.push(this.issue(e,t,n))}warn(e,t,n){this.warnings.push(this.issue(e,t,n))}read(e,t,n){let r=this.env.readFile(e,t);if(typeof r!=`string`)return this.report(`file`,r.error,n.name),null;let i=`${e}:${t}`;return this.deps.includes(i)||this.deps.push(i),r}bad(e,t,n){this.report(`bad_value`,`${t}="${e.attrs.get(t)??``}" ${n}`,e.name)}flag(e,t){let n=e.attrs.get(t);return n===void 0||n===`false`?!1:n===`true`||(this.bad(e,t,`must be true or false`),!1)}decor(e,t=[]){let n=this.attrs(e,[...t,`morph`,`step`,...this.blockAttrs(e)]),r=this.plain(e),i=this.steps.index.get(e);i!==void 0&&(r.classes.push(`fragment`),this.steps.explicit&&r.attrs.push([`data-fragment-index`,String(i)]));let a=e.attrs.get(`step`);this.sources&&a!==void 0&&Pv.test(a)&&r.attrs.push([`data-deck-step`,a]);let o=n.get(`morph`);return o!==void 0&&(Bv.test(o)?r.attrs.push([`data-morph`,o]):this.bad(e,`morph`,`must be lowercase letters, digits and hyphens`)),r}blockAttrs(e){return this.placed.has(e)?[`id`,...nv,..._v(e.name)]:[]}plain(e){let t={classes:[],attrs:[]},n=this.placed.get(e);if(n===void 0)return t;this.id&&this.sources&&t.attrs.push([`data-deck-src`,`${this.id}:${n}`],[`data-deck-tag`,e.name]);let r=e.attrs.get(`id`);r!==void 0&&(rv.test(r)?this.blockIds.has(r)?this.report(`bad_value`,`id="${r}" is used by another block on this slide`,e.name):(this.blockIds.add(r),this.sources&&t.attrs.push([`data-deck-id`,r])):this.bad(e,`id`,`must be letters, digits, _ and -, at most 32`));let i=this.place(e,t),a={},o=t.attrs.some(([e])=>e===`data-deck-placed`);for(let t of[`w`,`h`]){let n=e.attrs.get(t);o&&n!==void 0&&(t===`h`||n===`fill`)&&(a[t]=n)}o&&a.h!==void 0&&$_.includes(e.name)&&i.push(`overflow:hidden`);for(let n of _v(e.name)){let r=e.attrs.get(n);if(r===void 0)continue;let o=Tv(e.name,n,r);o?this.report(`bad_value`,o,e.name):n===`fit`&&!e.attrs.has(`h`)?this.report(`bad_value`,`fit="shrink" needs h on a free="true" slide`,e.name):(a[n]=r,n===`align`?t.attrs.push([`data-align`,r]):n===`color`&&ev.includes(r)?t.attrs.push([`data-color`,r]):n===`fit`?t.attrs.push([`data-deck-fit`,r]):i.push(...Dv(n,r).map(([e,t])=>`${e}:${t}`)))}return i.length&&t.attrs.push([`style`,i.join(`;`)]),this.sources&&Object.keys(a).length&&t.attrs.push([`data-deck-look`,JSON.stringify(a)]),t}place(e,t){let n=nv.filter(t=>e.attrs.has(t));if(!this.free)return n.length&&this.report(`bad_value`,`${n.join(`, `)} only work on a slide with free="true"`,e.name),[];if(![`x`,`y`,`w`].every(t=>e.attrs.has(t)))return this.report(`misplaced`,`<${e.name}> on a free="true" slide needs x, y and w`,e.name),[];let r={},i=!0;for(let t of n){let n=e.attrs.get(t);if(t===`w`&&n===`fill`)continue;let a=Number(n),o=t===`w`||t===`h`;!/^-?\d+$/.test(n)||Math.abs(a)>4e3||o&&a<=0?(this.bad(e,t,o?`must be a whole number of pixels above 0`:`must be a whole number of pixels`),i=!1):r[t]=a}if(!i)return[];let a=r.w??Math.max(1,1184-r.x),o=[`left:${r.x}px`,`top:${r.y}px`,`width:${a}px`];return r.h!==void 0&&o.push(`height:${r.h}px`),t.attrs.push([`data-deck-placed`,!0]),o}attrs(e,t){for(let n of e.attrs.keys())t.includes(n)||this.report(`unknown_attr`,n,e.name);return e.attrs}};const Hv=/^([^#]+?)(?:#L(\d+)(?:-(\d+))?)?$/,Uv=/<\/?(?:section|html|body|head)\b|<!doctype/i,Wv=/<(\/?)div\b/gi;function Gv(e,t){let n=e.attrs.get(`src`).trim(),r=Hv.exec(n);if(!r)return t.bad(e,`src`,`must be a path, optionally followed by #L10 or #L10-24`),null;let[,i,a,o]=r,s=t.read(`project`,i,e);if(s===null)return null;let c=s.replaceAll(`\r
|
|
228
|
+
`,`
|
|
229
|
+
`).replace(/\n$/,``).split(`
|
|
230
|
+
`);if(a===void 0)return c.join(`
|
|
231
|
+
`);let l=Number(a),u=o===void 0?l:Number(o);return l<1||u<l||u>c.length?(t.report(`file`,`${i} has ${c.length} lines: ${n.slice(i.length)} is not among them`,e.name),null):c.slice(l-1,u).join(`
|
|
232
|
+
`)}function Kv(e){let t=0;for(let n of e.matchAll(Wv))if(t+=n[1]?-1:1,t<0)return!0;return t!==0}function qv(e,t){let n=e.attrs.get(`src`)?.trim();if(!n)return t.bad(e,`src`,`must name an HTML file in the artifact directory`),null;let r=t.read(`artifact`,n,e);return r===null?null:Uv.test(r)||Kv(r)?(t.report(`file`,`${n} must be a fragment: no <html>, <body>, <head> or <section>, and every <div> closed`,e.name),null):r.trim()}const Jv=/^[A-Za-z0-9+#.-]{1,32}$/;function Yv(e){let t=e.replace(/^[ \t]*\n/,``).replace(/\s+$/,``).split(`
|
|
233
|
+
`),n=Math.min(...t.filter(e=>e.trim()).map(e=>/^[ \t]*/.exec(e)[0].length));return Number.isFinite(n)?t.map(e=>e.slice(n)).join(`
|
|
234
|
+
`):``}const Xv=(e,t)=>{let n=e.attrs.get(`lang`)?.trim()??`text`;return Jv.test(n)?n:(t.bad(e,`lang`,`is not a language name`),`text`)},Zv=(e,t)=>{let n=t.decor(e,[`lang`,`lines`,`numbers`,`title`,`max-height`,`diff`,`src`]),r=[],i=Xv(e,t),a=e.attrs.get(`lines`)?.trim();if(a!==void 0){if(k_(a)){r.push([`data-lines`,a]);let n=t.steps.explicit?t.steps.from.get(e):void 0;n!==void 0&&r.push([`data-step-from`,String(n)])}else t.bad(e,`lines`,`must be steps split by |, each line numbers such as 1,3-5, all or hide`)}let o=e.attrs.get(`max-height`)?.trim(),s=o!==void 0&&/^\d{2,4}$/.test(o);o!==void 0&&!s&&t.bad(e,`max-height`,`must be a number of pixels`),t.flag(e,`numbers`)&&r.push([`data-numbers`,!0]);let c=e.attrs.get(`title`)?.trim();c&&r.push([`data-title`,c]),s&&r.push([`data-max-height`,o]),t.flag(e,`diff`)&&r.push([`data-diff`,!0]);let l=Yv(X_(e)),u=e.attrs.has(`src`);u&&l&&t.report(`misplaced`,`a <codeblock> with src takes its code from the file: remove the code written in it`,`codeblock`);let d=u?Gv(e,t):l;if(d===null)return``;if(!d)return t.report(`misplaced`,`a <codeblock> has no code: write it in CDATA or name a file with src`,`codeblock`),``;let f=zv(`code`,{classes:[`language-${i}`],attrs:r});return`${zv(`pre`,n)}${f}${Lv(d)}</code></pre>`},Qv=(e,t)=>(t.report(`misplaced`,`a code block is written <codeblock>; <code> is inline code inside text`,`code`),``),$v=(e,t)=>{let n=t.decor(e,[`lang`]),r=e.children.filter(e=>J_(e)&&e.name===`step`?!0:(J_(e)&&t.report(`unknown_tag`,`<${e.name}> cannot sit in <magic>`,e.name),!1));if(r.length<2)return t.report(`misplaced`,`a <magic> needs two or more <step>; this one has ${r.length}`,`magic`),``;n.classes.unshift(`magic-move`);let i=t.steps.explicit?t.steps.from.get(e):void 0;i!==void 0&&n.attrs.unshift([`data-step-from`,String(i)]),n.attrs.unshift([`data-lang`,Xv(e,t)]);let a=r.map(e=>(t.attrs(e,[]),`<template>${Lv(Yv(X_(e)))}</template>`));return`${zv(`div`,n)}${a.join(``)}</div>`},ey=(e,t)=>{let n=t.decor(e);return n.classes.unshift(`mermaid`),`${zv(`pre`,n)}${Lv(Yv(X_(e)))}</pre>`},ty=(e,t)=>{let n=t.decor(e);return n.classes.unshift(`math`),`${zv(`div`,n)}${Lv(Yv(X_(e)))}</div>`},ny=(e,t,n,r=[])=>(e.classes.unshift(`deck-placeholder`),e.attrs.unshift([`data-kind`,t],...r),`${zv(`div`,e)}${Lv(n)}</div>`),ry=(e,t)=>{let n=X_(e).trim(),r=t.env.checkChart?.(n)??null;r&&t.report(`bad_value`,r,`chart`);let i=`Chart`;try{let e=JSON.parse(n);typeof e==`object`&&e&&typeof e.title==`string`&&(i=e.title)}catch{r||t.report(`bad_value`,`a <chart> holds a ChartSpec as JSON, in CDATA`,`chart`)}return ny(t.decor(e),`chart`,i)},iy=(e,t)=>{let n=t.decor(e,[`src`]),r=qv(e,t);return r===null?``:(n.classes.unshift(`deck-html`),`${zv(`div`,n)}${r}</div>`)},ay=[`artboard`,`whiteboard`,`html`,`report`,`slides`],oy={artboard:[`board`],whiteboard:[`frame`,`page`],report:[`block`],slides:[`slide`]},sy=/^[\w-]+$/,cy=[...sg,...cg];function ly(e){let t=yg(e,`embed`,ay);if(t)return t;let n=pg(e);if(n===`html`)return null;let r=`<embed ${n}="${mg(e)}"`,i=oy[n],a=`an <embed> shows ${i.map(e=>`one ${e}`).join(` or `)}, named with ${i.map(e=>`${e}="…"`).join(` or `)}`;if(e.group!==void 0)return`${r} group="${e.group}"> names a group: ${a}`;let o=i.find(t=>e[t]!==void 0);if(o===void 0)return`${r}> names no ${i.join(` or `)}: ${a}`;let s=e[o];return sy.test(s)?null:`${r} ${o}="${s}">: ${o}="${s}" is not an id`}function uy(e){let t=cg.find(t=>e[t]!==void 0);return[[`data-embed-slug`,mg(e)],...t?[[`data-embed-sub`,t],[`data-embed-part`,e[t]]]:[]]}const dy=e=>{let t=hg(e);return`${pg(e)}/${mg(e)}${t?`#${t}`:``}`};function fy(e,t,n){return e.classes.unshift(`deck-embed`),e.attrs.unshift([`data-kind`,pg(t)],[`data-target`,dy(t)],...uy(t),[`data-embed-to`,n.to],...n.kind===`flow`?[[`data-flow`,!0]]:[[`style`,`--embed-w:${n.w};--embed-h:${n.h}`]]),`${zv(`div`,e)}<iframe src="${Lv(n.src)}" sandbox="allow-scripts" tabindex="-1" loading="eager" title="${Lv(n.title)}"></iframe></div>`}const py=(e,t)=>{let n=t.decor(e,cy),r={};for(let t of cy){let n=e.attrs.get(t);n!==void 0&&(r[t]=n.trim())}let i=ly(r);if(i)return t.report(`bad_value`,i,`embed`),``;let a=dy(r),o=t.env.embed?.(r),s=o&&`kind`in o?o:null;t.embeds.push({slide:t.id??``,target:r,...s?{frame:s.src.split(`?`)[0]}:{}});let c=()=>t.audience?ny(n,`embed`,``):ny(n,`embed`,a,[[`data-target`,a]]);if(!o)return c();if(`missing`in o)return t.warn(`embed`,o.missing,`embed`),c();if(t.audience){let e=cg.find(e=>r[e]!==void 0);return ny(n,`embed`,``,[[`data-embed-to`,o.to],[`data-embed-kind`,pg(r)],...e?[[`data-embed-sub`,e],[`data-embed-part`,r[e]]]:[],o.kind===`flow`?[`data-flow`,``]:[`style`,`--embed-w:${o.w};--embed-h:${o.h}`]])}return fy(n,r,o)},my=[...sg,...cg],hy={document:`file-text`,artboard:`layout-dashboard`,whiteboard:`pen-tool`,html:`code`,slides:`presentation`,report:`chart-column`,storyboard:`clapperboard`};function gy(e,t,n){return`${zv(`span`,{classes:[`deck-ref`],attrs:[[`role`,`link`],[`tabindex`,`0`],...e]})}<ryugi-icon name="${hy[t]}"></ryugi-icon><span class="deck-ref-label">${Lv(n)}</span></span>`}function _y(e,t){let n=t.attrs(e,my),r={};for(let e of my){let t=n.get(e);t!==void 0&&(r[e]=t.trim())}let i=X_(e).trim();i&&(r.label=i);let a=yg(r);if(a)return t.report(`bad_value`,a,`ref`),Lv(i);t.refs.push({slide:t.id??``,target:r});let o=pg(r),s=mg(r),c=cg.find(e=>r[e]!==void 0),l=[[`data-ref-kind`,o],...t.audience?[]:[[`data-ref-slug`,s]],...c?[[`data-ref-sub`,c],[`data-ref-part`,r[c]]]:[]],u=t.env.ref?.(r),d=t.audience?i:i||s;if(!u)return gy(l,o,d);if(`missing`in u)return t.warn(`embed`,u.missing,`ref`),gy([...l,[`data-ref-missing`,!0]],o,t.audience?i:s);let f=t.audience?i:i||u.title;return gy([...l,[`data-ref-to`,u.to]],o,f)}const vy={b:`b`,strong:`strong`,i:`i`,em:`em`,u:`u`,s:`s`,del:`del`,strike:`s`,sub:`sub`,sup:`sup`,code:`code`},yy=[`h4`,`h5`,`h6`,`details`,`steps`,`excalidraw`,`footnote-section`,`footnote`,`def`,`dynamic`,`pending`,`ask`,`option`],by=e=>`<${e}> is a document block with no place on a slide`,xy=[`highlight`,`underline`,`circle`,`strike`],Sy=/^(?:https?:|mailto:|#|[^:]*$|[^/?#:]*[/?#])/i;function Cy(e,t){if(e.name===`br`)return t.attrs(e,[]),`<br>`;let n=Fv(vy,e.name);if(n)return t.attrs(e,[]),`<${n}>${Ty(e.children,t)}</${n}>`;if(e.name===`mark`){let n=t.decor(e,[`type`]),r=e.attrs.get(`type`)?.trim();return r!==void 0&&(xy.includes(r)?n.classes.unshift(`deck-mark`,`deck-mark-${r}`):t.bad(e,`type`,`must be ${xy.join(`, `)}`)),`${zv(`mark`,n)}${Ty(e.children,t)}</mark>`}if(e.name===`a`){let n=t.attrs(e,[`href`]).get(`href`)?.trim()??``,r=Ty(e.children,t);return!n||!Sy.test(n)?(t.report(`bad_value`,`href="${n}" is not a link a slide may hold`,`a`),r):`<a href="${Lv(n)}">${r}</a>`}return e.name===`icon`?wy(e,t):e.name===`ref`?_y(e,t):e.name===`math`?(t.attrs(e,[]),`<span class="math">${Lv(X_(e).trim())}</span>`):(t.report(`unknown_tag`,yy.includes(e.name)?by(e.name):`<${e.name}> is not something text may hold`,e.name),``)}function wy(e,t){let n=t.attrs(e,[`name`,`size`,...t.blockAttrs(e)]),r=n.get(`name`)?.trim()??``,i=n.get(`size`)?.trim();if(!/^[a-z0-9-]+$/.test(r))return t.report(`bad_value`,`name="${r}" is not an icon name`,`icon`),``;if(i!==void 0&&!/^\d{1,3}$/.test(i))return t.report(`bad_value`,`size="${i}" is not a number of pixels`,`icon`),`<ryugi-icon name="${r}"></ryugi-icon>`;let a=t.plain(e);return a.attrs.unshift([`name`,r],...i?[[`size`,i]]:[]),`${zv(`ryugi-icon`,a)}</ryugi-icon>`}function Ty(e,t,n){return e.map(e=>J_(e)?n?.(e)??Cy(e,t):Lv(e.text)).join(``)}const Ey=(e,t,n)=>Ty(e.children,t,n).trim(),Dy=(e,t,n)=>e.children.filter(r=>J_(r)?n.includes(r.name)?!0:(t.report(`unknown_tag`,`<${r.name}> cannot sit in <${e.name}>`,r.name),!1):(r.text.trim()&&t.report(`misplaced`,`text straight inside <${e.name}>`,e.name),!1)),Oy=e=>(t,n)=>`${zv(e,n.decor(t))}${Ey(t,n)}</${e}>`,ky=(e,t)=>`${zv(e.name,t.decor(e,[`steps`]))}${Dy(e,t,[`li`]).map(e=>`${zv(`li`,t.decor(e))}${Ey(e,t,e=>e.name===`ul`||e.name===`ol`?ky(e,t):null)}</li>`).join(``)}</${e.name}>`,Ay=(e,t)=>`${zv(`table`,t.decor(e,[`steps`]))}${Dy(e,t,[`tr`]).map(e=>`${zv(`tr`,t.decor(e))}${Dy(e,t,[`th`,`td`]).map(e=>Oy(e.name)(e,t)).join(``)}</tr>`).join(``)}</table>`,jy=(e,t)=>{let n=t.decor(e,[`src`,`alt`,`frame`]),r=e.attrs.get(`src`)?.trim()??``;return t.flag(e,`frame`)&&n.classes.push(`deck-frame`),!r||/^[a-z][a-z0-9+.-]*:/i.test(r)||r.startsWith(`/`)?(t.bad(e,`src`,`must be a file inside the artifact directory`),``):(n.attrs.unshift([`src`,r],[`alt`,e.attrs.get(`alt`)??``]),zv(`img`,n))},My=[`note`,`tip`,`important`,`warning`,`caution`],Ny={h1:Oy(`h1`),h2:Oy(`h2`),h3:Oy(`h3`),p:Oy(`p`),blockquote:Oy(`blockquote`),ul:ky,ol:ky,table:Ay,img:jy,icon:wy,alert:(e,t)=>{let n=t.decor(e,[`type`]),r=e.attrs.get(`type`)?.trim()??`note`;My.includes(r)||(t.bad(e,`type`,`must be ${My.join(`, `)}`),r=`note`),n.classes.unshift(`deck-alert`),n.attrs.unshift([`data-type`,r]);let i=Py(e,t,{},[]).map(e=>e.html);return`${zv(`div`,n)}${i.join(``)}</div>`},hr:(e,t)=>zv(`hr`,t.decor(e)),notes:(e,t)=>(t.attrs(e,[]),`<aside class="notes">${Ey(e,t)}</aside>`),codeblock:Zv,code:Qv,magic:$v,mermaid:ey,math:ty,chart:ry,embed:py,html:iy};function Py(e,t,n,r){let i=[];for(let a of e.children){if(!J_(a)){a.text.trim()&&t.report(`misplaced`,`text straight inside <${e.name}>: put it in a block such as <p>`,e.name);continue}let o=Fv(n,a.name)??Fv(Ny,a.name);if(!o){r.includes(a.name)?t.report(`misplaced`,`<${a.name}> has no place in this layout`,a.name):t.report(`unknown_tag`,yy.includes(a.name)?by(a.name):a.name===`ref`?`<ref> sits in text, such as a <p>: to show the artifact itself, use <embed>`:`<${a.name}> is not a block a slide may hold`,a.name);continue}let s=o(a,t);s&&i.push({name:a.name,html:s})}return i}const Fy=[`top`,`right`,`bottom`,`left`,`top-right`,`bottom-left`,`top-left`,`bottom-right`],Iy={cover:`full`,end:`full`,quote:`center`,fact:`center`,none:`none`};function Ly(e,t,n){let r=Fv(Iy,e);if(r===`none`||r&&r!==n)return r;let i=Fy[t%Fy.length];return i===n?Fy[(t+1)%Fy.length]:i}const Ry=[`default`,`section`,`statement`,`two-cols`,`image`,`code`],zy=(e,t)=>(n,r)=>{let i=r.decor(n);return t&&i.classes.unshift(t),`${zv(e,i)}${Ey(n,r)}</${e}>`},By=zy(`p`,`label`),Vy={kicker:zy(`p`,`kicker`),subtitle:zy(`p`,`sub`),label:By,col:(e,t)=>(t.attrs(e,[`steps`]),`<div${t.free?` data-deck-col`:``}>${Py(e,t,{label:By},[]).map(e=>e.html).join(``)}</div>`),quote:zy(`blockquote`),cite:zy(`cite`),big:(e,t)=>{let n=t.attrs(e,[`value`,`unit`,...t.blockAttrs(e)]),r=n.get(`unit`),i=t.plain(e);return i.classes.push(`big`),`${zv(`p`,i)}<b>${Lv(n.get(`value`)??``)}</b>${r===void 0?``:`<span>${Lv(r)}</span>`}</p>`},fact:(e,t)=>{let n=t.attrs(e,[`value`,`label`,...t.blockAttrs(e)]);return`${zv(`li`,t.plain(e))}<b>${Lv(n.get(`value`)??``)}</b><span>${Lv(n.get(`label`)??``)}</span></li>`}},Hy={cover:[`kicker`,`subtitle`],statement:[`subtitle`],"two-cols":[`col`],image:[`col`],quote:[`quote`,`cite`],fact:[`big`,`fact`]},Uy=Object.keys(Vy);function Wy(e,t,n){let r=[],i=null;for(let a of e)if(a.name!==t)i=null,r.push(a);else{if(!i){let e=[];i=e,r.push({name:t,get html(){return n(e.join(``))}})}i.push(a.html)}return r}function Gy(e,t,n){let r=[...Fv(Hy,t)??[],...Ry.includes(t)?[`label`]:[]],i=Py(e,n,Object.fromEntries(r.map(e=>[e,Vy[e]])),Uy),a=e=>i.filter(t=>t.name===e).length,o=(e,t)=>n.report(`misplaced`,t,e);return t===`two-cols`&&(a(`col`)!==2&&o(`col`,`a two-cols slide takes exactly two <col>`),i=Wy(i,`col`,e=>`<div class="cols">${e}</div>`)),t===`image`&&a(`col`)!==1&&o(`col`,`an image slide takes one <col> for its text, beside the <img>`),t===`fact`&&(a(`fact`)>3&&o(`fact`,`a fact slide takes at most three <fact>`),i=Wy(i,`fact`,e=>`<ul class="facts">${e}</ul>`)),i.map(e=>e.html)}const Ky=[`paper`,`mono`],qy=[`light`,`dark`,`auto`],Jy=/* @__PURE__ */ `paper.ink.ink-2.ink-3.accent.on-accent.info.rule.rule-strong.surface.font.font-mono.transition.transition-duration.transition-blur.fragment.fragment-duration.fragment-blur.glow.glow-1.glow-2.glow-3.glow-fade.glow-opacity.glow-blur.glow-drift.glow-hue.glow-at`.split(`.`),Yy=/[;{}<>\\]|\/\*|url\(|@import|expression\(/i,Xy=[`paper`,`surface`,`ink`,`ink-2`,`ink-3`],Zy={name:`paper`,appearance:`auto`,style:``};function Qy(e,t){let n={...Zy},r=[];!e.attrs.has(`appearance`)&&Xy.some(t=>e.attrs.has(t))&&(n.appearance=`light`);for(let[i,a]of e.attrs){let o=a.trim();i===`name`?Ky.includes(o)?n.name=o:t.bad(e,i,`is not a theme: use ${Ky.join(` or `)}`):i===`appearance`?qy.includes(o)?n.appearance=o:t.bad(e,i,`must be ${qy.join(`, `)}`):Jy.includes(i)?!o||Yy.test(o)?t.bad(e,i,`is not a value a theme variable may hold`):r.push(`--deck-${i}:${o}`):t.report(`unknown_attr`,i,`theme`)}return r.length&&(n.style=`:root{${r.join(`;`)}}`),n}const $y=[`id`,`layout`,`transition`,`glow`,`glow-seed`,`glow-opacity`,`glow-hue`,`zoom`,`hidden`,`src`,`free`],eb=[`glow-seed`,`glow-opacity`,`glow-hue`],tb=/^[a-z0-9][a-z0-9-]*$/,nb=/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/;function rb(e,t){let n=[];for(let r of e.children)J_(r)?r.name===`notes`?n.push(Ny.notes(r,t)):t.report(`misplaced`,`<${r.name}> beside src: a slide is either a file or blocks`,r.name):r.text.trim()&&t.report(`misplaced`,`text straight inside <slide>`,`slide`);let r=qv(e,t);return[...r===null?[]:[r],...n]}function ib(e,t,n,r,i=null){let a=r.attrs(e,$y),o={classes:[],attrs:[]},s=`default`,c=a.get(`layout`)?.trim();c!==void 0&&(tb.test(c)?(s=c,o.classes.push(`l-${c}`)):r.bad(e,`layout`,`is not a layout name`));let l=a.get(`transition`);l!==void 0&&o.attrs.push([`data-transition`,l.trim()]);let u=a.get(`glow`)?.trim(),d=u===void 0?Ly(s,t,n):N_(u)?u:null;o.attrs.push([`data-glow`,u??d]);for(let e of eb){let t=a.get(e);t!==void 0&&o.attrs.push([`data-${e}`,t.trim()])}let f=a.get(`zoom`)?.trim();if(f!==void 0){let t=Number(f);/^\d*\.?\d+$/.test(f)&&t>=.3&&t<=1?o.attrs.push([`data-zoom`,f],[`style`,`--deck-zoom:${f}`]):r.bad(e,`zoom`,`must be a number from 0.3 to 1`)}r.flag(e,`hidden`)&&o.attrs.push([`data-deck-hidden`,!0]);let p=r.flag(e,`free`);p&&a.has(`src`)?r.bad(e,`free`,`cannot be on a slide of your own HTML`):p&&o.attrs.push([`data-deck-free`,!0]),i&&o.attrs.push([`data-deck-group`,i]);let m;return a.has(`src`)&&s!==`none`?(r.bad(e,`src`,`belongs to a slide with layout="none"`),m=[]):a.has(`src`)?m=rb(e,r):(r.steps=Nv(e,r),r.free=p,r.placed=av(e),r.blockIds=/* @__PURE__ */ new Set,m=Gy(e,s,r),r.steps=Ov,r.free=!1,r.placed=/* @__PURE__ */ new Map),{glow:d,html:`${zv(`section`,o,a.get(`id`))}\n${m.join(`
|
|
235
|
+
`)}\n</section>`}}function ab(e,t=Iv,n={}){let r=new Vv(t,n.audience===!0||n.published===!0,n.sources===!0),{root:i,errors:a}=Z_(e);for(let e of a)r.report(`xml`,`line ${e.line}: ${e.message}`);i&&i.name!==`deck`&&r.report(`xml`,`the root element is <${i.name}>: a deck starts with <deck title="…">`);let o=i?.name===`deck`?i:null,s=o?r.attrs(o,[`title`,`lang`,`cover`]):/* @__PURE__ */ new Map,c=s.get(`title`)?.trim()||null,l=s.get(`lang`)?.trim();o&&l!==void 0&&!nb.test(l)&&(r.bad(o,`lang`,`is not a language tag`),l=void 0);let u=[],d=/* @__PURE__ */ new Map,f=Zy,p=!1,m=null,h=[],g=/* @__PURE__ */ new Map,_=null,v=(e,t)=>{let i=e.attrs.get(`id`),a=e.attrs.get(`hidden`)?.trim()===`true`;if(i&&!g.has(i)&&g.set(i,a),n.audience&&a)return;r.slide=u.length,r.id=i||void 0;let o=ib(e,u.length,m,r,_);m=o.glow,u.push(o.html),t&&r.id&&d.set(r.id,t),r.slide=-1,r.id=void 0},y=e=>{let t=r.attrs(e,[`src`]).get(`src`)?.trim();if(!t){r.bad(e,`src`,`must name an XML file in the artifact directory`);return}let n=r.read(`artifact`,t,e);if(n===null)return;let i=Z_(n);for(let e of i.errors)r.report(`xml`,`${t} line ${e.line}: ${e.message}`);if(i.root?.name!==`slides`)r.report(`file`,`${t} must start with <slides> and hold only <slide>`,`include`);else{r.attrs(i.root,[]);for(let e of i.root.children)J_(e)&&(e.name===`slide`?v(e,t):e.name===`include`?r.report(`misplaced`,`${t} includes another file: only the deck may include`,`include`):r.report(`unknown_tag`,`<${e.name}> cannot sit in <slides>`,e.name))}},b=e=>{let t=r.attrs(e,[`id`,`title`]),n=t.get(`id`)?.trim(),i=t.get(`title`)?.trim();n||r.report(`bad_value`,`a <group> needs an id`,`group`),i||r.report(`bad_value`,`a <group> needs a title`,`group`),n&&i&&h.push({id:n,title:i,at:u.length}),_=n||null;for(let t of e.children)J_(t)?t.name===`slide`?v(t,null):t.name===`include`?y(t):t.name===`group`?r.report(`misplaced`,`<group> cannot sit in <group>: groups do not nest`,`group`):r.report(`misplaced`,`<${t.name}> cannot sit in <group>`,t.name):t.text.trim()&&r.report(`misplaced`,`text straight inside <group>`,`group`);_=null};for(let e of o?.children??[])J_(e)?e.name===`theme`?(p||u.length?r.report(`misplaced`,`a deck takes one <theme>, before its slides`,`theme`):f=Qy(e,r),p=!0):e.name===`slide`?v(e,null):e.name===`include`?y(e):e.name===`group`?b(e):r.report(`unknown_tag`,`<${e.name}> cannot sit in <deck>`,e.name):e.text.trim()&&r.report(`misplaced`,`text straight inside <deck>`);let x=/* @__PURE__ */ new Set;for(let{id:e}of h)(g.has(e)||x.has(e))&&r.report(`bad_value`,`id="${e}" is already used in this deck`,`group`),x.add(e);let S=s.get(`cover`)?.trim()||null;return S!==null&&!g.has(S)?r.warn(`bad_value`,`cover="${S}" names no slide`):S!==null&&g.get(S)&&r.warn(`bad_value`,`cover="${S}" names a hidden slide`),{html:`<!doctype html>
|
|
236
|
+
<html${l?` lang="${Lv(l)}"`:``} data-deck-source="xml" data-deck-theme="${f.name}" data-deck-appearance="${f.appearance}">
|
|
237
|
+
<head>
|
|
238
|
+
<meta charset="utf-8">
|
|
239
|
+
<title>${Lv(c??``)}</title>${f.style?`\n<style>${f.style}</style>`:``}
|
|
240
|
+
</head>
|
|
241
|
+
<body>
|
|
242
|
+
<div class="reveal"><div class="slides">
|
|
243
|
+
${u.join(`
|
|
244
|
+
`)}
|
|
245
|
+
</div></div>
|
|
246
|
+
</body>
|
|
247
|
+
</html>
|
|
248
|
+
`,issues:r.issues,warnings:r.warnings,deps:r.deps,embeds:r.embeds,origins:d,refs:r.refs,title:c,groups:h,cover:S}}function ob({maxEntries:e=512,maxBytes:t=8388608}={}){let n=[],r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a=()=>{let e=n.at(-1);if(!e)throw Error(`no document engine is running`);return e},o=n=>{let a=/* @__PURE__ */ new Map,o=/* @__PURE__ */ new Map,s=/* @__PURE__ */ new Map,c=0,l=e=>{a.delete(e)&&(c-=e.length)},u=(n,r)=>{for(l(n),a.set(n,r),c+=n.length;a.size>1&&(a.size>e||c>t);)l(a.keys().next().value)},d=e=>{let t=[...new Set(e)].filter(e=>!a.has(e)&&!s.has(e));if(t.length){let e=Promise.resolve().then(()=>n(t)).then(e=>{let n=/* @__PURE__ */ new Set;t.forEach((t,r)=>{u(t,e[r]);for(let e of o.get(t)??[])n.add(e);o.delete(t)}),n.size&&r.forEach(e=>e([...n]))}).finally(()=>{t.forEach(e=>s.delete(e)),i.delete(e)});i.add(e);for(let n of t)s.set(n,e)}return Promise.all(e.map(e=>s.get(e))).then(()=>void 0)};return{ensure:d,get:(e,t)=>{if(a.has(e)){let t=a.get(e);return u(e,t),t}if(t){let n=o.get(e);n||o.set(e,n=/* @__PURE__ */ new Set),n.add(t)}d([e]).catch(()=>void 0)}}},s=o(e=>a().trees(e)),c=o(e=>a().checkCharts(e));return{use:e=>(n.push(e),()=>{let t=n.lastIndexOf(e);t!==-1&&n.splice(t,1)}),tree:s.get,ensure:s.ensure,chart:c.get,ensureCharts:c.ensure,idle:()=>Promise.all([...i].map(e=>e.catch(()=>void 0))).then(()=>void 0),onReady:e=>(r.add(e),()=>r.delete(e)),taskPrompt:e=>a().taskPrompt(e),open:e=>a().open(e),read:(e,t)=>a().read(e,t)}}const sb=ob();function cb(e,t){let n=je(e,`artboard`,t),r=n?xn(n).canvas:null;if(!r)return null;let i=r.groups??{};return{boards:Object.keys(r.boards??{}),groups:Object.keys(i),choices:Object.keys(i).filter(e=>i[e]?.choose)}}function lb(e,t,n){let r=e.artboard,i=t.canvasOf(r);return i?e.group&&!i.groups.includes(e.group)?`<${n} artboard="${r}" group="${e.group}">: the artboard has no group ${e.group}`:e.board&&!i.boards.includes(e.board)?`<${n} artboard="${r}" board="${e.board}">: the artboard has no board ${e.board}`:null:null}const ub=/<(\/?)([a-zA-Z][\w-]*)\b([^>]*?)(\/?)>/g,db=/\bid="([^"]+)"/,fb=e=>e.replaceAll(/<[^>]+>/g,``).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`).replaceAll(`&`,`&`).replaceAll(/\s+/g,` `).trim();function pb(e,t){let n=fb(t);if(/^h[1-6]$/.test(e))return n;let r=Array.from(n);return r.length>30?`${r.slice(0,30).join(``)}…`:n}function mb(e){let t=e.replaceAll(/<!\[CDATA\[[\s\S]*?\]\]>/g,``).replaceAll(/<ask\b[^>]*\/>|<ask\b[\s\S]*?<\/ask>/g,``),n={},r=0,i=null;for(let e of t.matchAll(ub)){let[a,o,s,c,l]=e;if(o){--r,r===1&&i&&(n[i.id]=pb(i.tag,t.slice(i.start,e.index)),i=null);continue}let u=r===1?db.exec(c)?.[1]:void 0;l?u&&(n[u]=``):(u&&(i={id:u,start:e.index+a.length,tag:s}),r+=1)}return n}const hb=/<h[1-6]\b[^>]*>([\s\S]*?)<\/h[1-6]>/i;function gb(e,t){let n;try{n=d.default.readFileSync(f.default.join(e,A.document),`utf8`)}catch{return{title:t,blocks:{},warnings:[`doc.xml not found`],version:Ie(e)}}return{title:hb.exec(n)?.[1]?.replaceAll(/<[^>]+>/g,``).trim()||t,...te(n),blocks:mb(n),warnings:[],version:Ie(e)}}function _b(e,t){let n=je(e,`document`,t);return n?gb(n,t).blocks??{}:null}function vb(e,t,n){if(!e.block)return null;let r=mg(e),i=t.documentBlocksOf(r);return i&&!Object.hasOwn(i,e.block)?`<${n} document="${r}" block="${e.block}">: the document has no block ${e.block}`:null}var yb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;(function(e){e[e.NONE=0]=`NONE`,e[e._abstract=1]=`_abstract`,e[e._accessor=2]=`_accessor`,e[e._as=3]=`_as`,e[e._assert=4]=`_assert`,e[e._asserts=5]=`_asserts`,e[e._async=6]=`_async`,e[e._await=7]=`_await`,e[e._checks=8]=`_checks`,e[e._constructor=9]=`_constructor`,e[e._declare=10]=`_declare`,e[e._enum=11]=`_enum`,e[e._exports=12]=`_exports`,e[e._from=13]=`_from`,e[e._get=14]=`_get`,e[e._global=15]=`_global`,e[e._implements=16]=`_implements`,e[e._infer=17]=`_infer`,e[e._interface=18]=`_interface`,e[e._is=19]=`_is`,e[e._keyof=20]=`_keyof`,e[e._mixins=21]=`_mixins`,e[e._module=22]=`_module`,e[e._namespace=23]=`_namespace`,e[e._of=24]=`_of`,e[e._opaque=25]=`_opaque`,e[e._out=26]=`_out`,e[e._override=27]=`_override`,e[e._private=28]=`_private`,e[e._protected=29]=`_protected`,e[e._proto=30]=`_proto`,e[e._public=31]=`_public`,e[e._readonly=32]=`_readonly`,e[e._require=33]=`_require`,e[e._satisfies=34]=`_satisfies`,e[e._set=35]=`_set`,e[e._static=36]=`_static`,e[e._symbol=37]=`_symbol`,e[e._type=38]=`_type`,e[e._unique=39]=`_unique`,e[e._using=40]=`_using`})(t||(e.ContextualKeyword=t={}))})),q=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});
|
|
249
|
+
/* istanbul ignore file */
|
|
250
|
+
var t;(function(e){e[e.PRECEDENCE_MASK=15]=`PRECEDENCE_MASK`,e[e.IS_KEYWORD=16]=`IS_KEYWORD`,e[e.IS_ASSIGN=32]=`IS_ASSIGN`,e[e.IS_RIGHT_ASSOCIATIVE=64]=`IS_RIGHT_ASSOCIATIVE`,e[e.IS_PREFIX=128]=`IS_PREFIX`,e[e.IS_POSTFIX=256]=`IS_POSTFIX`,e[e.IS_EXPRESSION_START=512]=`IS_EXPRESSION_START`,e[e.num=512]=`num`,e[e.bigint=1536]=`bigint`,e[e.decimal=2560]=`decimal`,e[e.regexp=3584]=`regexp`,e[e.string=4608]=`string`,e[e.name=5632]=`name`,e[e.eof=6144]=`eof`,e[e.bracketL=7680]=`bracketL`,e[e.bracketR=8192]=`bracketR`,e[e.braceL=9728]=`braceL`,e[e.braceBarL=10752]=`braceBarL`,e[e.braceR=11264]=`braceR`,e[e.braceBarR=12288]=`braceBarR`,e[e.parenL=13824]=`parenL`,e[e.parenR=14336]=`parenR`,e[e.comma=15360]=`comma`,e[e.semi=16384]=`semi`,e[e.colon=17408]=`colon`,e[e.doubleColon=18432]=`doubleColon`,e[e.dot=19456]=`dot`,e[e.question=20480]=`question`,e[e.questionDot=21504]=`questionDot`,e[e.arrow=22528]=`arrow`,e[e.template=23552]=`template`,e[e.ellipsis=24576]=`ellipsis`,e[e.backQuote=25600]=`backQuote`,e[e.dollarBraceL=27136]=`dollarBraceL`,e[e.at=27648]=`at`,e[e.hash=29184]=`hash`,e[e.eq=29728]=`eq`,e[e.assign=30752]=`assign`,e[e.preIncDec=32640]=`preIncDec`,e[e.postIncDec=33664]=`postIncDec`,e[e.bang=34432]=`bang`,e[e.tilde=35456]=`tilde`,e[e.pipeline=35841]=`pipeline`,e[e.nullishCoalescing=36866]=`nullishCoalescing`,e[e.logicalOR=37890]=`logicalOR`,e[e.logicalAND=38915]=`logicalAND`,e[e.bitwiseOR=39940]=`bitwiseOR`,e[e.bitwiseXOR=40965]=`bitwiseXOR`,e[e.bitwiseAND=41990]=`bitwiseAND`,e[e.equality=43015]=`equality`,e[e.lessThan=44040]=`lessThan`,e[e.greaterThan=45064]=`greaterThan`,e[e.relationalOrEqual=46088]=`relationalOrEqual`,e[e.bitShiftL=47113]=`bitShiftL`,e[e.bitShiftR=48137]=`bitShiftR`,e[e.plus=49802]=`plus`,e[e.minus=50826]=`minus`,e[e.modulo=51723]=`modulo`,e[e.star=52235]=`star`,e[e.slash=53259]=`slash`,e[e.exponent=54348]=`exponent`,e[e.jsxName=55296]=`jsxName`,e[e.jsxText=56320]=`jsxText`,e[e.jsxEmptyText=57344]=`jsxEmptyText`,e[e.jsxTagStart=58880]=`jsxTagStart`,e[e.jsxTagEnd=59392]=`jsxTagEnd`,e[e.typeParameterStart=60928]=`typeParameterStart`,e[e.nonNullAssertion=61440]=`nonNullAssertion`,e[e._break=62480]=`_break`,e[e._case=63504]=`_case`,e[e._catch=64528]=`_catch`,e[e._continue=65552]=`_continue`,e[e._debugger=66576]=`_debugger`,e[e._default=67600]=`_default`,e[e._do=68624]=`_do`,e[e._else=69648]=`_else`,e[e._finally=70672]=`_finally`,e[e._for=71696]=`_for`,e[e._function=73232]=`_function`,e[e._if=73744]=`_if`,e[e._return=74768]=`_return`,e[e._switch=75792]=`_switch`,e[e._throw=77456]=`_throw`,e[e._try=77840]=`_try`,e[e._var=78864]=`_var`,e[e._let=79888]=`_let`,e[e._const=80912]=`_const`,e[e._while=81936]=`_while`,e[e._with=82960]=`_with`,e[e._new=84496]=`_new`,e[e._this=85520]=`_this`,e[e._super=86544]=`_super`,e[e._class=87568]=`_class`,e[e._extends=88080]=`_extends`,e[e._export=89104]=`_export`,e[e._import=90640]=`_import`,e[e._yield=91664]=`_yield`,e[e._null=92688]=`_null`,e[e._true=93712]=`_true`,e[e._false=94736]=`_false`,e[e._in=95256]=`_in`,e[e._instanceof=96280]=`_instanceof`,e[e._typeof=97936]=`_typeof`,e[e._void=98960]=`_void`,e[e._delete=99984]=`_delete`,e[e._async=100880]=`_async`,e[e._get=101904]=`_get`,e[e._set=102928]=`_set`,e[e._declare=103952]=`_declare`,e[e._readonly=104976]=`_readonly`,e[e._abstract=106e3]=`_abstract`,e[e._static=107024]=`_static`,e[e._public=107536]=`_public`,e[e._private=108560]=`_private`,e[e._protected=109584]=`_protected`,e[e._override=110608]=`_override`,e[e._as=112144]=`_as`,e[e._enum=113168]=`_enum`,e[e._type=114192]=`_type`,e[e._implements=115216]=`_implements`})(t||(e.TokenType=t={}));function n(e){switch(e){case t.num:return`num`;case t.bigint:return`bigint`;case t.decimal:return`decimal`;case t.regexp:return`regexp`;case t.string:return`string`;case t.name:return`name`;case t.eof:return`eof`;case t.bracketL:return`[`;case t.bracketR:return`]`;case t.braceL:return`{`;case t.braceBarL:return`{|`;case t.braceR:return`}`;case t.braceBarR:return`|}`;case t.parenL:return`(`;case t.parenR:return`)`;case t.comma:return`,`;case t.semi:return`;`;case t.colon:return`:`;case t.doubleColon:return`::`;case t.dot:return`.`;case t.question:return`?`;case t.questionDot:return`?.`;case t.arrow:return`=>`;case t.template:return`template`;case t.ellipsis:return`...`;case t.backQuote:return"`";case t.dollarBraceL:return"${";case t.at:return`@`;case t.hash:return`#`;case t.eq:return`=`;case t.assign:return`_=`;case t.preIncDec:return`++/--`;case t.postIncDec:return`++/--`;case t.bang:return`!`;case t.tilde:return`~`;case t.pipeline:return`|>`;case t.nullishCoalescing:return`??`;case t.logicalOR:return`||`;case t.logicalAND:return`&&`;case t.bitwiseOR:return`|`;case t.bitwiseXOR:return`^`;case t.bitwiseAND:return`&`;case t.equality:return`==/!=`;case t.lessThan:return`<`;case t.greaterThan:return`>`;case t.relationalOrEqual:return`<=/>=`;case t.bitShiftL:return`<<`;case t.bitShiftR:return`>>/>>>`;case t.plus:return`+`;case t.minus:return`-`;case t.modulo:return`%`;case t.star:return`*`;case t.slash:return`/`;case t.exponent:return`**`;case t.jsxName:return`jsxName`;case t.jsxText:return`jsxText`;case t.jsxEmptyText:return`jsxEmptyText`;case t.jsxTagStart:return`jsxTagStart`;case t.jsxTagEnd:return`jsxTagEnd`;case t.typeParameterStart:return`typeParameterStart`;case t.nonNullAssertion:return`nonNullAssertion`;case t._break:return`break`;case t._case:return`case`;case t._catch:return`catch`;case t._continue:return`continue`;case t._debugger:return`debugger`;case t._default:return`default`;case t._do:return`do`;case t._else:return`else`;case t._finally:return`finally`;case t._for:return`for`;case t._function:return`function`;case t._if:return`if`;case t._return:return`return`;case t._switch:return`switch`;case t._throw:return`throw`;case t._try:return`try`;case t._var:return`var`;case t._let:return`let`;case t._const:return`const`;case t._while:return`while`;case t._with:return`with`;case t._new:return`new`;case t._this:return`this`;case t._super:return`super`;case t._class:return`class`;case t._extends:return`extends`;case t._export:return`export`;case t._import:return`import`;case t._yield:return`yield`;case t._null:return`null`;case t._true:return`true`;case t._false:return`false`;case t._in:return`in`;case t._instanceof:return`instanceof`;case t._typeof:return`typeof`;case t._void:return`void`;case t._delete:return`delete`;case t._async:return`async`;case t._get:return`get`;case t._set:return`set`;case t._declare:return`declare`;case t._readonly:return`readonly`;case t._abstract:return`abstract`;case t._static:return`static`;case t._public:return`public`;case t._private:return`private`;case t._protected:return`protected`;case t._override:return`override`;case t._as:return`as`;case t._enum:return`enum`;case t._type:return`type`;case t._implements:return`implements`;default:return``}}e.formatTokenType=n})),bb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=yb(),n=q();e.Scope=class{constructor(e,t,n){this.startTokenIndex=e,this.endTokenIndex=t,this.isFunctionScope=n}};var r=class{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f){this.potentialArrowAt=e,this.noAnonFunctionType=t,this.inDisallowConditionalTypesContext=n,this.tokensLength=r,this.scopesLength=i,this.pos=a,this.type=o,this.contextualKeyword=s,this.start=c,this.end=l,this.isType=u,this.scopeDepth=d,this.error=f}};e.StateSnapshot=r,e.default=class e{constructor(){e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),e.prototype.__init5.call(this),e.prototype.__init6.call(this),e.prototype.__init7.call(this),e.prototype.__init8.call(this),e.prototype.__init9.call(this),e.prototype.__init10.call(this),e.prototype.__init11.call(this),e.prototype.__init12.call(this),e.prototype.__init13.call(this)}__init(){this.potentialArrowAt=-1}__init2(){this.noAnonFunctionType=!1}__init3(){this.inDisallowConditionalTypesContext=!1}__init4(){this.tokens=[]}__init5(){this.scopes=[]}__init6(){this.pos=0}__init7(){this.type=n.TokenType.eof}__init8(){this.contextualKeyword=t.ContextualKeyword.NONE}__init9(){this.start=0}__init10(){this.end=0}__init11(){this.isType=!1}__init12(){this.scopeDepth=0}__init13(){this.error=null}snapshot(){return new r(this.potentialArrowAt,this.noAnonFunctionType,this.inDisallowConditionalTypesContext,this.tokens.length,this.scopes.length,this.pos,this.type,this.contextualKeyword,this.start,this.end,this.isType,this.scopeDepth,this.error)}restoreFromSnapshot(e){this.potentialArrowAt=e.potentialArrowAt,this.noAnonFunctionType=e.noAnonFunctionType,this.inDisallowConditionalTypesContext=e.inDisallowConditionalTypesContext,this.tokens.length=e.tokensLength,this.scopes.length=e.scopesLength,this.pos=e.pos,this.type=e.type,this.contextualKeyword=e.contextualKeyword,this.start=e.start,this.end=e.end,this.isType=e.isType,this.scopeDepth=e.scopeDepth,this.error=e.error}}})),xb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;(function(e){e[e.backSpace=8]=`backSpace`,e[e.lineFeed=10]=`lineFeed`,e[e.tab=9]=`tab`,e[e.carriageReturn=13]=`carriageReturn`,e[e.shiftOut=14]=`shiftOut`,e[e.space=32]=`space`,e[e.exclamationMark=33]=`exclamationMark`,e[e.quotationMark=34]=`quotationMark`,e[e.numberSign=35]=`numberSign`,e[e.dollarSign=36]=`dollarSign`,e[e.percentSign=37]=`percentSign`,e[e.ampersand=38]=`ampersand`,e[e.apostrophe=39]=`apostrophe`,e[e.leftParenthesis=40]=`leftParenthesis`,e[e.rightParenthesis=41]=`rightParenthesis`,e[e.asterisk=42]=`asterisk`,e[e.plusSign=43]=`plusSign`,e[e.comma=44]=`comma`,e[e.dash=45]=`dash`,e[e.dot=46]=`dot`,e[e.slash=47]=`slash`,e[e.digit0=48]=`digit0`,e[e.digit1=49]=`digit1`,e[e.digit2=50]=`digit2`,e[e.digit3=51]=`digit3`,e[e.digit4=52]=`digit4`,e[e.digit5=53]=`digit5`,e[e.digit6=54]=`digit6`,e[e.digit7=55]=`digit7`,e[e.digit8=56]=`digit8`,e[e.digit9=57]=`digit9`,e[e.colon=58]=`colon`,e[e.semicolon=59]=`semicolon`,e[e.lessThan=60]=`lessThan`,e[e.equalsTo=61]=`equalsTo`,e[e.greaterThan=62]=`greaterThan`,e[e.questionMark=63]=`questionMark`,e[e.atSign=64]=`atSign`,e[e.uppercaseA=65]=`uppercaseA`,e[e.uppercaseB=66]=`uppercaseB`,e[e.uppercaseC=67]=`uppercaseC`,e[e.uppercaseD=68]=`uppercaseD`,e[e.uppercaseE=69]=`uppercaseE`,e[e.uppercaseF=70]=`uppercaseF`,e[e.uppercaseG=71]=`uppercaseG`,e[e.uppercaseH=72]=`uppercaseH`,e[e.uppercaseI=73]=`uppercaseI`,e[e.uppercaseJ=74]=`uppercaseJ`,e[e.uppercaseK=75]=`uppercaseK`,e[e.uppercaseL=76]=`uppercaseL`,e[e.uppercaseM=77]=`uppercaseM`,e[e.uppercaseN=78]=`uppercaseN`,e[e.uppercaseO=79]=`uppercaseO`,e[e.uppercaseP=80]=`uppercaseP`,e[e.uppercaseQ=81]=`uppercaseQ`,e[e.uppercaseR=82]=`uppercaseR`,e[e.uppercaseS=83]=`uppercaseS`,e[e.uppercaseT=84]=`uppercaseT`,e[e.uppercaseU=85]=`uppercaseU`,e[e.uppercaseV=86]=`uppercaseV`,e[e.uppercaseW=87]=`uppercaseW`,e[e.uppercaseX=88]=`uppercaseX`,e[e.uppercaseY=89]=`uppercaseY`,e[e.uppercaseZ=90]=`uppercaseZ`,e[e.leftSquareBracket=91]=`leftSquareBracket`,e[e.backslash=92]=`backslash`,e[e.rightSquareBracket=93]=`rightSquareBracket`,e[e.caret=94]=`caret`,e[e.underscore=95]=`underscore`,e[e.graveAccent=96]=`graveAccent`,e[e.lowercaseA=97]=`lowercaseA`,e[e.lowercaseB=98]=`lowercaseB`,e[e.lowercaseC=99]=`lowercaseC`,e[e.lowercaseD=100]=`lowercaseD`,e[e.lowercaseE=101]=`lowercaseE`,e[e.lowercaseF=102]=`lowercaseF`,e[e.lowercaseG=103]=`lowercaseG`,e[e.lowercaseH=104]=`lowercaseH`,e[e.lowercaseI=105]=`lowercaseI`,e[e.lowercaseJ=106]=`lowercaseJ`,e[e.lowercaseK=107]=`lowercaseK`,e[e.lowercaseL=108]=`lowercaseL`,e[e.lowercaseM=109]=`lowercaseM`,e[e.lowercaseN=110]=`lowercaseN`,e[e.lowercaseO=111]=`lowercaseO`,e[e.lowercaseP=112]=`lowercaseP`,e[e.lowercaseQ=113]=`lowercaseQ`,e[e.lowercaseR=114]=`lowercaseR`,e[e.lowercaseS=115]=`lowercaseS`,e[e.lowercaseT=116]=`lowercaseT`,e[e.lowercaseU=117]=`lowercaseU`,e[e.lowercaseV=118]=`lowercaseV`,e[e.lowercaseW=119]=`lowercaseW`,e[e.lowercaseX=120]=`lowercaseX`,e[e.lowercaseY=121]=`lowercaseY`,e[e.lowercaseZ=122]=`lowercaseZ`,e[e.leftCurlyBrace=123]=`leftCurlyBrace`,e[e.verticalBar=124]=`verticalBar`,e[e.rightCurlyBrace=125]=`rightCurlyBrace`,e[e.tilde=126]=`tilde`,e[e.nonBreakingSpace=160]=`nonBreakingSpace`,e[e.oghamSpaceMark=5760]=`oghamSpaceMark`,e[e.lineSeparator=8232]=`lineSeparator`,e[e.paragraphSeparator=8233]=`paragraphSeparator`})(t||(e.charCodes=t={}));function n(e){return e>=t.digit0&&e<=t.digit9||e>=t.lowercaseA&&e<=t.lowercaseF||e>=t.uppercaseA&&e<=t.uppercaseF}e.isDigit=n})),Sb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(bb()),r=xb();e.isJSXEnabled,e.isTypeScriptEnabled,e.isFlowEnabled,e.state,e.input,e.nextContextId;function i(){return e.nextContextId++}e.getNextContextId=i;function a(e){if(`pos`in e){let t=s(e.pos);e.message+=` (${t.line}:${t.column})`,e.loc=t}return e}e.augmentError=a;var o=class{constructor(e,t){this.line=e,this.column=t}};e.Loc=o;function s(t){let n=1,i=1;for(let a=0;a<t;a++)e.input.charCodeAt(a)===r.charCodes.lineFeed?(n++,i=1):i++;return new o(n,i)}e.locationForIndex=s;function c(t,r,i,a){e.input=t,e.state=new n.default,e.nextContextId=1,e.isJSXEnabled=r,e.isTypeScriptEnabled=i,e.isFlowEnabled=a}e.initParser=c})),Cb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ob(),n=q(),r=xb(),i=Sb();function a(e){return i.state.contextualKeyword===e}e.isContextual=a;function o(e){let r=t.lookaheadTypeAndKeyword.call(void 0);return r.type===n.TokenType.name&&r.contextualKeyword===e}e.isLookaheadContextual=o;function s(e){return i.state.contextualKeyword===e&&t.eat.call(void 0,n.TokenType.name)}e.eatContextual=s;function c(e){s(e)||h()}e.expectContextual=c;function l(){return t.match.call(void 0,n.TokenType.eof)||t.match.call(void 0,n.TokenType.braceR)||u()}e.canInsertSemicolon=l;function u(){let e=i.state.tokens[i.state.tokens.length-1],t=e?e.end:0;for(let e=t;e<i.state.start;e++){let t=i.input.charCodeAt(e);if(t===r.charCodes.lineFeed||t===r.charCodes.carriageReturn||t===8232||t===8233)return!0}return!1}e.hasPrecedingLineBreak=u;function d(){let e=t.nextTokenStart.call(void 0);for(let t=i.state.end;t<e;t++){let e=i.input.charCodeAt(t);if(e===r.charCodes.lineFeed||e===r.charCodes.carriageReturn||e===8232||e===8233)return!0}return!1}e.hasFollowingLineBreak=d;function f(){return t.eat.call(void 0,n.TokenType.semi)||l()}e.isLineTerminator=f;function p(){f()||h(`Unexpected token, expected ";"`)}e.semicolon=p;function m(e){t.eat.call(void 0,e)||h(`Unexpected token, expected "${n.formatTokenType.call(void 0,e)}"`)}e.expect=m;function h(e=`Unexpected token`,r=i.state.start){if(i.state.error)return;let a=SyntaxError(e);a.pos=r,i.state.error=a,i.state.pos=i.input.length,t.finishToken.call(void 0,n.TokenType.eof)}e.unexpected=h})),wb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=xb();e.WHITESPACE_CHARS=[9,11,12,t.charCodes.space,t.charCodes.nonBreakingSpace,t.charCodes.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],e.skipWhiteSpace=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,e.IS_WHITESPACE=/* @__PURE__ */ new Uint8Array(65536);for(let t of e.WHITESPACE_CHARS)e.IS_WHITESPACE[t]=1})),Tb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=xb(),n=wb();function r(e){if(e<48)return e===36;if(e<58)return!0;if(e<65)return!1;if(e<91)return!0;if(e<97)return e===95;if(e<123)return!0;if(e<128)return!1;throw Error(`Should not be called with non-ASCII char code.`)}e.IS_IDENTIFIER_CHAR=/* @__PURE__ */ new Uint8Array(65536);for(let t=0;t<128;t++)e.IS_IDENTIFIER_CHAR[t]=+!!r(t);for(let t=128;t<65536;t++)e.IS_IDENTIFIER_CHAR[t]=1;for(let t of n.WHITESPACE_CHARS)e.IS_IDENTIFIER_CHAR[t]=0;e.IS_IDENTIFIER_CHAR[8232]=0,e.IS_IDENTIFIER_CHAR[8233]=0,e.IS_IDENTIFIER_START=e.IS_IDENTIFIER_CHAR.slice();for(let n=t.charCodes.digit0;n<=t.charCodes.digit9;n++)e.IS_IDENTIFIER_START[n]=0})),Eb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=yb(),n=q();e.READ_WORD_TREE=new Int32Array([-1,27,783,918,1755,2376,2862,3483,-1,3699,-1,4617,4752,4833,5130,5508,5940,-1,6480,6939,7749,8181,8451,8613,-1,8829,-1,-1,-1,54,243,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,432,-1,-1,-1,675,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,108,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,135,-1,-1,-1,-1,-1,-1,-1,-1,-1,162,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,189,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,216,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._abstract<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,270,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,297,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,324,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,351,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,378,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,405,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._accessor<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._as<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,459,-1,-1,-1,-1,-1,594,-1,-1,-1,-1,-1,-1,486,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,513,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,540,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._assert<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,567,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._asserts<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,621,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,648,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._async<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,702,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,729,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,756,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._await<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,810,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,837,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,864,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,891,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._break<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,945,-1,-1,-1,-1,-1,-1,1107,-1,-1,-1,1242,-1,-1,1350,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,972,1026,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,999,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._case<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1053,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1080,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._catch<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1134,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1161,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1188,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1215,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._checks<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1269,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1296,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1323,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._class<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1377,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1404,1620,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1431,-1,-1,-1,-1,-1,-1,(n.TokenType._const<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1458,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1485,-1,-1,-1,-1,-1,-1,-1,-1,1512,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1539,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1566,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1593,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._constructor<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1647,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1674,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1701,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1728,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._continue<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1782,-1,-1,-1,-1,-1,-1,-1,-1,-1,2349,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1809,1971,-1,-1,2106,-1,-1,-1,-1,-1,2241,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1836,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1863,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1890,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1917,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1944,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._debugger<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1998,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2025,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2052,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2079,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._declare<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2133,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2160,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2187,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2214,-1,-1,-1,-1,-1,-1,(n.TokenType._default<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2268,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2295,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2322,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._delete<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._do<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2403,-1,2484,-1,-1,-1,-1,-1,-1,-1,-1,-1,2565,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2430,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2457,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._else<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2511,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2538,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._enum<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2592,-1,-1,-1,2727,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2619,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2646,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2673,-1,-1,-1,-1,-1,-1,(n.TokenType._export<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2700,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._exports<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2754,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2781,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2808,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2835,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._extends<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2889,-1,-1,-1,-1,-1,-1,-1,2997,-1,-1,-1,-1,-1,3159,-1,-1,3213,-1,-1,3294,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2916,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2943,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2970,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._false<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3024,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3051,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3078,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3105,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3132,-1,(n.TokenType._finally<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3186,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._for<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3240,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3267,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._from<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3321,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3348,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3375,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3402,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3429,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3456,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._function<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3510,-1,-1,-1,-1,-1,-1,3564,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3537,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._get<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3591,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3618,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3645,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3672,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._global<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3726,-1,-1,-1,-1,-1,-1,3753,4077,-1,-1,-1,-1,4590,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._if<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3780,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3807,-1,-1,3996,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3834,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3861,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3888,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3915,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3942,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3969,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._implements<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4023,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4050,-1,-1,-1,-1,-1,-1,(n.TokenType._import<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._in<<1)+1,-1,-1,-1,-1,-1,4104,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4185,4401,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4131,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4158,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._infer<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4212,-1,-1,-1,-1,-1,-1,-1,4239,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4266,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4293,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4320,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4347,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4374,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._instanceof<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4428,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4455,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4482,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4509,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4536,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4563,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._interface<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._is<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4644,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4671,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4698,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4725,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._keyof<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4779,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4806,-1,-1,-1,-1,-1,-1,(n.TokenType._let<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4860,-1,-1,-1,-1,-1,4995,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4887,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4914,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4941,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4968,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._mixins<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5022,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5049,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5076,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5103,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._module<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5157,-1,-1,-1,5373,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5427,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5184,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5211,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5238,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5265,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5292,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5319,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5346,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._namespace<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5400,-1,-1,-1,(n.TokenType._new<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5454,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5481,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._null<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5535,-1,-1,-1,-1,-1,-1,-1,-1,-1,5562,-1,-1,-1,-1,5697,5751,-1,-1,-1,-1,t.ContextualKeyword._of<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5589,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5616,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5643,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5670,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._opaque<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5724,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._out<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5778,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5805,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5832,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5859,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5886,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5913,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._override<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5967,-1,-1,6345,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5994,-1,-1,-1,-1,-1,6129,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6021,-1,-1,-1,-1,-1,6048,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6075,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6102,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._private<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6156,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6183,-1,-1,-1,-1,-1,-1,-1,-1,-1,6318,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6210,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6237,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6264,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6291,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._protected<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._proto<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6372,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6399,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6426,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6453,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._public<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6507,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6534,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6696,-1,-1,6831,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6561,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6588,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6615,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6642,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6669,-1,t.ContextualKeyword._readonly<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6723,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6750,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6777,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6804,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._require<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6858,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6885,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6912,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._return<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6966,-1,-1,-1,7182,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7236,7371,-1,7479,-1,7614,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6993,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7020,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7047,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7074,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7101,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7128,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7155,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._satisfies<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7209,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._set<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7263,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7290,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7317,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7344,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._static<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7398,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7425,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7452,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._super<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7506,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7533,-1,-1,-1,-1,-1,-1,-1,-1,-1,7560,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7587,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._switch<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7641,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7668,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7695,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7722,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._symbol<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7776,-1,-1,-1,-1,-1,-1,-1,-1,-1,7938,-1,-1,-1,-1,-1,-1,8046,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7803,-1,-1,-1,-1,-1,-1,-1,-1,7857,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7830,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._this<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7884,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7911,-1,-1,-1,(n.TokenType._throw<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7965,-1,-1,-1,8019,-1,-1,-1,-1,-1,-1,7992,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._true<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._try<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8073,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8100,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._type<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8127,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8154,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._typeof<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8208,-1,-1,-1,-1,8343,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8235,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8262,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8289,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8316,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._unique<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8370,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8397,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8424,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,t.ContextualKeyword._using<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8478,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8532,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8505,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._var<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8559,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8586,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._void<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8640,8748,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8667,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8694,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8721,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._while<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8775,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8802,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._with<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8856,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8883,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8910,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8937,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n.TokenType._yield<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])})),Db=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Sb(),n=xb(),r=Tb(),i=Ob(),a=Eb(),o=q();function s(){let e=0,s=0,c=t.state.pos;for(;c<t.input.length&&(s=t.input.charCodeAt(c),!(s<n.charCodes.lowercaseA||s>n.charCodes.lowercaseZ));){let t=a.READ_WORD_TREE[e+(s-n.charCodes.lowercaseA)+1];if(t===-1)break;e=t,c++}let l=a.READ_WORD_TREE[e];if(l>-1&&!r.IS_IDENTIFIER_CHAR[s])t.state.pos=c,l&1?i.finishToken.call(void 0,l>>>1):i.finishToken.call(void 0,o.TokenType.name,l>>>1);else{for(;c<t.input.length;){let e=t.input.charCodeAt(c);if(r.IS_IDENTIFIER_CHAR[e])c++;else if(e===n.charCodes.backslash){if(c+=2,t.input.charCodeAt(c)===n.charCodes.leftCurlyBrace){for(;c<t.input.length&&t.input.charCodeAt(c)!==n.charCodes.rightCurlyBrace;)c++;c++}}else if(e===n.charCodes.atSign&&t.input.charCodeAt(c+1)===n.charCodes.atSign)c+=2;else break}t.state.pos=c,i.finishToken.call(void 0,o.TokenType.name)}}e.default=s})),Ob=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=Sb(),r=Cb(),i=xb(),a=Tb(),o=wb(),s=yb(),c=t(Db()),l=q(),u;(function(e){e[e.Access=0]=`Access`,e[e.ExportAccess=1]=`ExportAccess`,e[e.TopLevelDeclaration=2]=`TopLevelDeclaration`,e[e.FunctionScopedDeclaration=3]=`FunctionScopedDeclaration`,e[e.BlockScopedDeclaration=4]=`BlockScopedDeclaration`,e[e.ObjectShorthandTopLevelDeclaration=5]=`ObjectShorthandTopLevelDeclaration`,e[e.ObjectShorthandFunctionScopedDeclaration=6]=`ObjectShorthandFunctionScopedDeclaration`,e[e.ObjectShorthandBlockScopedDeclaration=7]=`ObjectShorthandBlockScopedDeclaration`,e[e.ObjectShorthand=8]=`ObjectShorthand`,e[e.ImportDeclaration=9]=`ImportDeclaration`,e[e.ObjectKey=10]=`ObjectKey`,e[e.ImportAccess=11]=`ImportAccess`})(u||(e.IdentifierRole=u={}));var d;(function(e){e[e.NoChildren=0]=`NoChildren`,e[e.OneChild=1]=`OneChild`,e[e.StaticChildren=2]=`StaticChildren`,e[e.KeyAfterPropSpread=3]=`KeyAfterPropSpread`})(d||(e.JSXRole=d={}));function f(e){let t=e.identifierRole;return t===u.TopLevelDeclaration||t===u.FunctionScopedDeclaration||t===u.BlockScopedDeclaration||t===u.ObjectShorthandTopLevelDeclaration||t===u.ObjectShorthandFunctionScopedDeclaration||t===u.ObjectShorthandBlockScopedDeclaration}e.isDeclaration=f;function p(e){let t=e.identifierRole;return t===u.FunctionScopedDeclaration||t===u.BlockScopedDeclaration||t===u.ObjectShorthandFunctionScopedDeclaration||t===u.ObjectShorthandBlockScopedDeclaration}e.isNonTopLevelDeclaration=p;function m(e){let t=e.identifierRole;return t===u.TopLevelDeclaration||t===u.ObjectShorthandTopLevelDeclaration||t===u.ImportDeclaration}e.isTopLevelDeclaration=m;function h(e){let t=e.identifierRole;return t===u.TopLevelDeclaration||t===u.BlockScopedDeclaration||t===u.ObjectShorthandTopLevelDeclaration||t===u.ObjectShorthandBlockScopedDeclaration}e.isBlockScopedDeclaration=h;function g(e){let t=e.identifierRole;return t===u.FunctionScopedDeclaration||t===u.ObjectShorthandFunctionScopedDeclaration}e.isFunctionScopedDeclaration=g;function _(e){return e.identifierRole===u.ObjectShorthandTopLevelDeclaration||e.identifierRole===u.ObjectShorthandBlockScopedDeclaration||e.identifierRole===u.ObjectShorthandFunctionScopedDeclaration}e.isObjectShorthandDeclaration=_;var v=class{constructor(){this.type=n.state.type,this.contextualKeyword=n.state.contextualKeyword,this.start=n.state.start,this.end=n.state.end,this.scopeDepth=n.state.scopeDepth,this.isType=n.state.isType,this.identifierRole=null,this.jsxRole=null,this.shadowsGlobal=!1,this.isAsyncOperation=!1,this.contextId=null,this.rhsEndIndex=null,this.isExpression=!1,this.numNullishCoalesceStarts=0,this.numNullishCoalesceEnds=0,this.isOptionalChainStart=!1,this.isOptionalChainEnd=!1,this.subscriptStartIndex=null,this.nullishStartIndex=null}};e.Token=v;function y(){n.state.tokens.push(new v),ae()}e.next=y;function b(){n.state.tokens.push(new v),n.state.start=n.state.pos,xe()}e.nextTemplateToken=b;function x(){n.state.type===l.TokenType.assign&&--n.state.pos,P()}e.retokenizeSlashAsRegex=x;function S(e){for(let t=n.state.tokens.length-e;t<n.state.tokens.length;t++)n.state.tokens[t].isType=!0;let t=n.state.isType;return n.state.isType=!0,t}e.pushTypeContext=S;function C(e){n.state.isType=e}e.popTypeContext=C;function w(e){return E(e)?(y(),!0):!1}e.eat=w;function T(e){let t=n.state.isType;n.state.isType=!0,w(e),n.state.isType=t}e.eatTypeToken=T;function E(e){return n.state.type===e}e.match=E;function ee(){let e=n.state.snapshot();y();let t=n.state.type;return n.state.restoreFromSnapshot(e),t}e.lookaheadType=ee;var te=class{constructor(e,t){this.type=e,this.contextualKeyword=t}};e.TypeAndKeyword=te;function ne(){let e=n.state.snapshot();y();let t=n.state.type,r=n.state.contextualKeyword;return n.state.restoreFromSnapshot(e),new te(t,r)}e.lookaheadTypeAndKeyword=ne;function re(){return D(n.state.pos)}e.nextTokenStart=re;function D(e){return o.skipWhiteSpace.lastIndex=e,e+o.skipWhiteSpace.exec(n.input)[0].length}e.nextTokenStartSince=D;function ie(){return n.input.charCodeAt(re())}e.lookaheadCharCode=ie;function ae(){if(oe(),n.state.start=n.state.pos,n.state.pos>=n.input.length){let e=n.state.tokens;e.length>=2&&e[e.length-1].start>=n.input.length&&e[e.length-2].start>=n.input.length&&r.unexpected.call(void 0,`Unexpectedly reached the end of input.`),j(l.TokenType.eof)}else O(n.input.charCodeAt(n.state.pos))}e.nextToken=ae;function O(e){a.IS_IDENTIFIER_START[e]||e===i.charCodes.backslash||e===i.charCodes.atSign&&n.input.charCodeAt(n.state.pos+1)===i.charCodes.atSign?c.default.call(void 0):_e(e)}function k(){for(;n.input.charCodeAt(n.state.pos)!==i.charCodes.asterisk||n.input.charCodeAt(n.state.pos+1)!==i.charCodes.slash;)if(n.state.pos++,n.state.pos>n.input.length){r.unexpected.call(void 0,`Unterminated comment`,n.state.pos-2);return}n.state.pos+=2}function A(e){let t=n.input.charCodeAt(n.state.pos+=e);if(n.state.pos<n.input.length)for(;t!==i.charCodes.lineFeed&&t!==i.charCodes.carriageReturn&&t!==i.charCodes.lineSeparator&&t!==i.charCodes.paragraphSeparator&&++n.state.pos<n.input.length;)t=n.input.charCodeAt(n.state.pos)}e.skipLineComment=A;function oe(){for(;n.state.pos<n.input.length;){let e=n.input.charCodeAt(n.state.pos);switch(e){case i.charCodes.carriageReturn:n.input.charCodeAt(n.state.pos+1)===i.charCodes.lineFeed&&++n.state.pos;case i.charCodes.lineFeed:case i.charCodes.lineSeparator:case i.charCodes.paragraphSeparator:++n.state.pos;break;case i.charCodes.slash:switch(n.input.charCodeAt(n.state.pos+1)){case i.charCodes.asterisk:n.state.pos+=2,k();break;case i.charCodes.slash:A(2);break;default:return}break;default:if(o.IS_WHITESPACE[e])++n.state.pos;else return}}}e.skipSpace=oe;function j(e,t=s.ContextualKeyword.NONE){n.state.end=n.state.pos,n.state.type=e,n.state.contextualKeyword=t}e.finishToken=j;function M(){let e=n.input.charCodeAt(n.state.pos+1);e>=i.charCodes.digit0&&e<=i.charCodes.digit9?ye(!0):e===i.charCodes.dot&&n.input.charCodeAt(n.state.pos+2)===i.charCodes.dot?(n.state.pos+=3,j(l.TokenType.ellipsis)):(++n.state.pos,j(l.TokenType.dot))}function se(){n.input.charCodeAt(n.state.pos+1)===i.charCodes.equalsTo?N(l.TokenType.assign,2):N(l.TokenType.slash,1)}function ce(e){let t=e===i.charCodes.asterisk?l.TokenType.star:l.TokenType.modulo,r=1,a=n.input.charCodeAt(n.state.pos+1);e===i.charCodes.asterisk&&a===i.charCodes.asterisk&&(r++,a=n.input.charCodeAt(n.state.pos+2),t=l.TokenType.exponent),a===i.charCodes.equalsTo&&n.input.charCodeAt(n.state.pos+2)!==i.charCodes.greaterThan&&(r++,t=l.TokenType.assign),N(t,r)}function le(e){let t=n.input.charCodeAt(n.state.pos+1);if(t===e)n.input.charCodeAt(n.state.pos+2)===i.charCodes.equalsTo?N(l.TokenType.assign,3):N(e===i.charCodes.verticalBar?l.TokenType.logicalOR:l.TokenType.logicalAND,2);else{if(e===i.charCodes.verticalBar){if(t===i.charCodes.greaterThan){N(l.TokenType.pipeline,2);return}if(t===i.charCodes.rightCurlyBrace&&n.isFlowEnabled){N(l.TokenType.braceBarR,2);return}}t===i.charCodes.equalsTo?N(l.TokenType.assign,2):N(e===i.charCodes.verticalBar?l.TokenType.bitwiseOR:l.TokenType.bitwiseAND,1)}}function ue(){n.input.charCodeAt(n.state.pos+1)===i.charCodes.equalsTo?N(l.TokenType.assign,2):N(l.TokenType.bitwiseXOR,1)}function de(e){let t=n.input.charCodeAt(n.state.pos+1);t===e?N(l.TokenType.preIncDec,2):t===i.charCodes.equalsTo?N(l.TokenType.assign,2):e===i.charCodes.plusSign?N(l.TokenType.plus,1):N(l.TokenType.minus,1)}function fe(){let e=n.input.charCodeAt(n.state.pos+1);if(e===i.charCodes.lessThan){if(n.input.charCodeAt(n.state.pos+2)===i.charCodes.equalsTo){N(l.TokenType.assign,3);return}n.state.isType?N(l.TokenType.lessThan,1):N(l.TokenType.bitShiftL,2)}else e===i.charCodes.equalsTo?N(l.TokenType.relationalOrEqual,2):N(l.TokenType.lessThan,1)}function pe(){if(n.state.isType){N(l.TokenType.greaterThan,1);return}let e=n.input.charCodeAt(n.state.pos+1);if(e===i.charCodes.greaterThan){let e=n.input.charCodeAt(n.state.pos+2)===i.charCodes.greaterThan?3:2;if(n.input.charCodeAt(n.state.pos+e)===i.charCodes.equalsTo){N(l.TokenType.assign,e+1);return}N(l.TokenType.bitShiftR,e)}else e===i.charCodes.equalsTo?N(l.TokenType.relationalOrEqual,2):N(l.TokenType.greaterThan,1)}function me(){n.state.type===l.TokenType.greaterThan&&(--n.state.pos,pe())}e.rescan_gt=me;function he(e){let t=n.input.charCodeAt(n.state.pos+1);t===i.charCodes.equalsTo?N(l.TokenType.equality,n.input.charCodeAt(n.state.pos+2)===i.charCodes.equalsTo?3:2):e===i.charCodes.equalsTo&&t===i.charCodes.greaterThan?(n.state.pos+=2,j(l.TokenType.arrow)):N(e===i.charCodes.equalsTo?l.TokenType.eq:l.TokenType.bang,1)}function ge(){let e=n.input.charCodeAt(n.state.pos+1),t=n.input.charCodeAt(n.state.pos+2);e===i.charCodes.questionMark&&!(n.isFlowEnabled&&n.state.isType)?t===i.charCodes.equalsTo?N(l.TokenType.assign,3):N(l.TokenType.nullishCoalescing,2):e===i.charCodes.dot&&!(t>=i.charCodes.digit0&&t<=i.charCodes.digit9)?(n.state.pos+=2,j(l.TokenType.questionDot)):(++n.state.pos,j(l.TokenType.question))}function _e(e){switch(e){case i.charCodes.numberSign:++n.state.pos,j(l.TokenType.hash);return;case i.charCodes.dot:M();return;case i.charCodes.leftParenthesis:++n.state.pos,j(l.TokenType.parenL);return;case i.charCodes.rightParenthesis:++n.state.pos,j(l.TokenType.parenR);return;case i.charCodes.semicolon:++n.state.pos,j(l.TokenType.semi);return;case i.charCodes.comma:++n.state.pos,j(l.TokenType.comma);return;case i.charCodes.leftSquareBracket:++n.state.pos,j(l.TokenType.bracketL);return;case i.charCodes.rightSquareBracket:++n.state.pos,j(l.TokenType.bracketR);return;case i.charCodes.leftCurlyBrace:n.isFlowEnabled&&n.input.charCodeAt(n.state.pos+1)===i.charCodes.verticalBar?N(l.TokenType.braceBarL,2):(++n.state.pos,j(l.TokenType.braceL));return;case i.charCodes.rightCurlyBrace:++n.state.pos,j(l.TokenType.braceR);return;case i.charCodes.colon:n.input.charCodeAt(n.state.pos+1)===i.charCodes.colon?N(l.TokenType.doubleColon,2):(++n.state.pos,j(l.TokenType.colon));return;case i.charCodes.questionMark:ge();return;case i.charCodes.atSign:++n.state.pos,j(l.TokenType.at);return;case i.charCodes.graveAccent:++n.state.pos,j(l.TokenType.backQuote);return;case i.charCodes.digit0:{let e=n.input.charCodeAt(n.state.pos+1);if(e===i.charCodes.lowercaseX||e===i.charCodes.uppercaseX||e===i.charCodes.lowercaseO||e===i.charCodes.uppercaseO||e===i.charCodes.lowercaseB||e===i.charCodes.uppercaseB){ve();return}}case i.charCodes.digit1:case i.charCodes.digit2:case i.charCodes.digit3:case i.charCodes.digit4:case i.charCodes.digit5:case i.charCodes.digit6:case i.charCodes.digit7:case i.charCodes.digit8:case i.charCodes.digit9:ye(!1);return;case i.charCodes.quotationMark:case i.charCodes.apostrophe:be(e);return;case i.charCodes.slash:se();return;case i.charCodes.percentSign:case i.charCodes.asterisk:ce(e);return;case i.charCodes.verticalBar:case i.charCodes.ampersand:le(e);return;case i.charCodes.caret:ue();return;case i.charCodes.plusSign:case i.charCodes.dash:de(e);return;case i.charCodes.lessThan:fe();return;case i.charCodes.greaterThan:pe();return;case i.charCodes.equalsTo:case i.charCodes.exclamationMark:he(e);return;case i.charCodes.tilde:N(l.TokenType.tilde,1);return}r.unexpected.call(void 0,`Unexpected character '${String.fromCharCode(e)}'`,n.state.pos)}e.getTokenFromCode=_e;function N(e,t){n.state.pos+=t,j(e)}function P(){let e=n.state.pos,t=!1,a=!1;for(;;){if(n.state.pos>=n.input.length){r.unexpected.call(void 0,`Unterminated regular expression`,e);return}let o=n.input.charCodeAt(n.state.pos);if(t)t=!1;else{if(o===i.charCodes.leftSquareBracket)a=!0;else if(o===i.charCodes.rightSquareBracket&&a)a=!1;else if(o===i.charCodes.slash&&!a)break;t=o===i.charCodes.backslash}++n.state.pos}++n.state.pos,Se(),j(l.TokenType.regexp)}function F(){for(;;){let e=n.input.charCodeAt(n.state.pos);if(e>=i.charCodes.digit0&&e<=i.charCodes.digit9||e===i.charCodes.underscore)n.state.pos++;else break}}function ve(){for(n.state.pos+=2;;){let e=n.input.charCodeAt(n.state.pos);if(e>=i.charCodes.digit0&&e<=i.charCodes.digit9||e>=i.charCodes.lowercaseA&&e<=i.charCodes.lowercaseF||e>=i.charCodes.uppercaseA&&e<=i.charCodes.uppercaseF||e===i.charCodes.underscore)n.state.pos++;else break}n.input.charCodeAt(n.state.pos)===i.charCodes.lowercaseN?(++n.state.pos,j(l.TokenType.bigint)):j(l.TokenType.num)}function ye(e){let t=!1,r=!1;e||F();let a=n.input.charCodeAt(n.state.pos);a===i.charCodes.dot&&(++n.state.pos,F(),a=n.input.charCodeAt(n.state.pos)),(a===i.charCodes.uppercaseE||a===i.charCodes.lowercaseE)&&(a=n.input.charCodeAt(++n.state.pos),(a===i.charCodes.plusSign||a===i.charCodes.dash)&&++n.state.pos,F(),a=n.input.charCodeAt(n.state.pos)),a===i.charCodes.lowercaseN?(++n.state.pos,t=!0):a===i.charCodes.lowercaseM&&(++n.state.pos,r=!0),j(t?l.TokenType.bigint:r?l.TokenType.decimal:l.TokenType.num)}function be(e){for(n.state.pos++;;){if(n.state.pos>=n.input.length){r.unexpected.call(void 0,`Unterminated string constant`);return}let t=n.input.charCodeAt(n.state.pos);if(t===i.charCodes.backslash)n.state.pos++;else if(t===e)break;n.state.pos++}n.state.pos++,j(l.TokenType.string)}function xe(){for(;;){if(n.state.pos>=n.input.length){r.unexpected.call(void 0,`Unterminated template`);return}let e=n.input.charCodeAt(n.state.pos);if(e===i.charCodes.graveAccent||e===i.charCodes.dollarSign&&n.input.charCodeAt(n.state.pos+1)===i.charCodes.leftCurlyBrace){if(n.state.pos===n.state.start&&E(l.TokenType.template)){if(e===i.charCodes.dollarSign){n.state.pos+=2,j(l.TokenType.dollarBraceL);return}++n.state.pos,j(l.TokenType.backQuote);return}j(l.TokenType.template);return}e===i.charCodes.backslash&&n.state.pos++,n.state.pos++}}function Se(){for(;n.state.pos<n.input.length;){let e=n.input.charCodeAt(n.state.pos);if(a.IS_IDENTIFIER_CHAR[e])n.state.pos++;else if(e===i.charCodes.backslash){if(n.state.pos+=2,n.input.charCodeAt(n.state.pos)===i.charCodes.leftCurlyBrace){for(;n.state.pos<n.input.length&&n.input.charCodeAt(n.state.pos)!==i.charCodes.rightCurlyBrace;)n.state.pos++;n.state.pos++}}else break}}e.skipWord=Se})),kb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=q();function n(e,t=e.currentIndex()){let n=t+1;if(r(e,n)){let r=e.identifierNameAtIndex(t);return{isType:!1,leftName:r,rightName:r,endIndex:n}}if(n++,r(e,n))return{isType:!0,leftName:null,rightName:null,endIndex:n};if(n++,r(e,n))return{isType:!1,leftName:e.identifierNameAtIndex(t),rightName:e.identifierNameAtIndex(t+2),endIndex:n};if(n++,r(e,n))return{isType:!0,leftName:null,rightName:null,endIndex:n};throw Error(`Unexpected import/export specifier at ${t}`)}e.default=n;function r(e,n){let r=e.tokens[n];return r.type===t.TokenType.braceR||r.type===t.TokenType.comma}})),Ab=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=/* @__PURE__ */ new Map([[`quot`,`"`],[`amp`,`&`],[`apos`,`'`],[`lt`,`<`],[`gt`,`>`],[`nbsp`,`\xA0`],[`iexcl`,`¡`],[`cent`,`¢`],[`pound`,`£`],[`curren`,`¤`],[`yen`,`¥`],[`brvbar`,`¦`],[`sect`,`§`],[`uml`,`¨`],[`copy`,`©`],[`ordf`,`ª`],[`laquo`,`«`],[`not`,`¬`],[`shy`,``],[`reg`,`®`],[`macr`,`¯`],[`deg`,`°`],[`plusmn`,`±`],[`sup2`,`²`],[`sup3`,`³`],[`acute`,`´`],[`micro`,`µ`],[`para`,`¶`],[`middot`,`·`],[`cedil`,`¸`],[`sup1`,`¹`],[`ordm`,`º`],[`raquo`,`»`],[`frac14`,`¼`],[`frac12`,`½`],[`frac34`,`¾`],[`iquest`,`¿`],[`Agrave`,`À`],[`Aacute`,`Á`],[`Acirc`,`Â`],[`Atilde`,`Ã`],[`Auml`,`Ä`],[`Aring`,`Å`],[`AElig`,`Æ`],[`Ccedil`,`Ç`],[`Egrave`,`È`],[`Eacute`,`É`],[`Ecirc`,`Ê`],[`Euml`,`Ë`],[`Igrave`,`Ì`],[`Iacute`,`Í`],[`Icirc`,`Î`],[`Iuml`,`Ï`],[`ETH`,`Ð`],[`Ntilde`,`Ñ`],[`Ograve`,`Ò`],[`Oacute`,`Ó`],[`Ocirc`,`Ô`],[`Otilde`,`Õ`],[`Ouml`,`Ö`],[`times`,`×`],[`Oslash`,`Ø`],[`Ugrave`,`Ù`],[`Uacute`,`Ú`],[`Ucirc`,`Û`],[`Uuml`,`Ü`],[`Yacute`,`Ý`],[`THORN`,`Þ`],[`szlig`,`ß`],[`agrave`,`à`],[`aacute`,`á`],[`acirc`,`â`],[`atilde`,`ã`],[`auml`,`ä`],[`aring`,`å`],[`aelig`,`æ`],[`ccedil`,`ç`],[`egrave`,`è`],[`eacute`,`é`],[`ecirc`,`ê`],[`euml`,`ë`],[`igrave`,`ì`],[`iacute`,`í`],[`icirc`,`î`],[`iuml`,`ï`],[`eth`,`ð`],[`ntilde`,`ñ`],[`ograve`,`ò`],[`oacute`,`ó`],[`ocirc`,`ô`],[`otilde`,`õ`],[`ouml`,`ö`],[`divide`,`÷`],[`oslash`,`ø`],[`ugrave`,`ù`],[`uacute`,`ú`],[`ucirc`,`û`],[`uuml`,`ü`],[`yacute`,`ý`],[`thorn`,`þ`],[`yuml`,`ÿ`],[`OElig`,`Œ`],[`oelig`,`œ`],[`Scaron`,`Š`],[`scaron`,`š`],[`Yuml`,`Ÿ`],[`fnof`,`ƒ`],[`circ`,`ˆ`],[`tilde`,`˜`],[`Alpha`,`Α`],[`Beta`,`Β`],[`Gamma`,`Γ`],[`Delta`,`Δ`],[`Epsilon`,`Ε`],[`Zeta`,`Ζ`],[`Eta`,`Η`],[`Theta`,`Θ`],[`Iota`,`Ι`],[`Kappa`,`Κ`],[`Lambda`,`Λ`],[`Mu`,`Μ`],[`Nu`,`Ν`],[`Xi`,`Ξ`],[`Omicron`,`Ο`],[`Pi`,`Π`],[`Rho`,`Ρ`],[`Sigma`,`Σ`],[`Tau`,`Τ`],[`Upsilon`,`Υ`],[`Phi`,`Φ`],[`Chi`,`Χ`],[`Psi`,`Ψ`],[`Omega`,`Ω`],[`alpha`,`α`],[`beta`,`β`],[`gamma`,`γ`],[`delta`,`δ`],[`epsilon`,`ε`],[`zeta`,`ζ`],[`eta`,`η`],[`theta`,`θ`],[`iota`,`ι`],[`kappa`,`κ`],[`lambda`,`λ`],[`mu`,`μ`],[`nu`,`ν`],[`xi`,`ξ`],[`omicron`,`ο`],[`pi`,`π`],[`rho`,`ρ`],[`sigmaf`,`ς`],[`sigma`,`σ`],[`tau`,`τ`],[`upsilon`,`υ`],[`phi`,`φ`],[`chi`,`χ`],[`psi`,`ψ`],[`omega`,`ω`],[`thetasym`,`ϑ`],[`upsih`,`ϒ`],[`piv`,`ϖ`],[`ensp`,` `],[`emsp`,` `],[`thinsp`,` `],[`zwnj`,``],[`zwj`,``],[`lrm`,``],[`rlm`,``],[`ndash`,`–`],[`mdash`,`—`],[`lsquo`,`‘`],[`rsquo`,`’`],[`sbquo`,`‚`],[`ldquo`,`“`],[`rdquo`,`”`],[`bdquo`,`„`],[`dagger`,`†`],[`Dagger`,`‡`],[`bull`,`•`],[`hellip`,`…`],[`permil`,`‰`],[`prime`,`′`],[`Prime`,`″`],[`lsaquo`,`‹`],[`rsaquo`,`›`],[`oline`,`‾`],[`frasl`,`⁄`],[`euro`,`€`],[`image`,`ℑ`],[`weierp`,`℘`],[`real`,`ℜ`],[`trade`,`™`],[`alefsym`,`ℵ`],[`larr`,`←`],[`uarr`,`↑`],[`rarr`,`→`],[`darr`,`↓`],[`harr`,`↔`],[`crarr`,`↵`],[`lArr`,`⇐`],[`uArr`,`⇑`],[`rArr`,`⇒`],[`dArr`,`⇓`],[`hArr`,`⇔`],[`forall`,`∀`],[`part`,`∂`],[`exist`,`∃`],[`empty`,`∅`],[`nabla`,`∇`],[`isin`,`∈`],[`notin`,`∉`],[`ni`,`∋`],[`prod`,`∏`],[`sum`,`∑`],[`minus`,`−`],[`lowast`,`∗`],[`radic`,`√`],[`prop`,`∝`],[`infin`,`∞`],[`ang`,`∠`],[`and`,`∧`],[`or`,`∨`],[`cap`,`∩`],[`cup`,`∪`],[`int`,`∫`],[`there4`,`∴`],[`sim`,`∼`],[`cong`,`≅`],[`asymp`,`≈`],[`ne`,`≠`],[`equiv`,`≡`],[`le`,`≤`],[`ge`,`≥`],[`sub`,`⊂`],[`sup`,`⊃`],[`nsub`,`⊄`],[`sube`,`⊆`],[`supe`,`⊇`],[`oplus`,`⊕`],[`otimes`,`⊗`],[`perp`,`⊥`],[`sdot`,`⋅`],[`lceil`,`⌈`],[`rceil`,`⌉`],[`lfloor`,`⌊`],[`rfloor`,`⌋`],[`lang`,`〈`],[`rang`,`〉`],[`loz`,`◊`],[`spades`,`♠`],[`clubs`,`♣`],[`hearts`,`♥`],[`diams`,`♦`]])})),jb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let[t,r]=n(e.jsxPragma||`React.createElement`),[i,a]=n(e.jsxFragmentPragma||`React.Fragment`);return{base:t,suffix:r,fragmentBase:i,fragmentSuffix:a}}e.default=t;function n(e){let t=e.indexOf(`.`);return t===-1&&(t=e.length),[e.slice(0,t),e.slice(t)]}})),Mb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{getPrefixCode(){return``}getHoistedCode(){return``}getSuffixCode(){return``}}})),Nb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(Ab()),r=Ob(),i=q(),a=xb(),o=t(jb()),s=t(Mb());e.default=class e extends s.default{__init(){this.lastLineNumber=1}__init2(){this.lastIndex=0}__init3(){this.filenameVarName=null}__init4(){this.esmAutomaticImportNameResolutions={}}__init5(){this.cjsAutomaticModuleNameResolutions={}}constructor(t,n,r,i,a){super(),this.rootTransformer=t,this.tokens=n,this.importProcessor=r,this.nameManager=i,this.options=a,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),e.prototype.__init5.call(this),this.jsxPragmaInfo=o.default.call(void 0,a),this.isAutomaticRuntime=a.jsxRuntime===`automatic`,this.jsxImportSource=a.jsxImportSource||`react`}process(){return this.tokens.matches1(i.TokenType.jsxTagStart)?(this.processJSXTag(),!0):!1}getPrefixCode(){let e=``;if(this.filenameVarName&&(e+=`const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath||``)};`),this.isAutomaticRuntime){if(this.importProcessor)for(let[t,n]of Object.entries(this.cjsAutomaticModuleNameResolutions))e+=`var ${n} = require("${t}");`;else{let{createElement:t,...n}=this.esmAutomaticImportNameResolutions;t&&(e+=`import {createElement as ${t}} from "${this.jsxImportSource}";`);let r=Object.entries(n).map(([e,t])=>`${e} as ${t}`).join(`, `);if(r){let t=this.jsxImportSource+(this.options.production?`/jsx-runtime`:`/jsx-dev-runtime`);e+=`import {${r}} from "${t}";`}}}return e}processJSXTag(){let{jsxRole:e,start:t}=this.tokens.currentToken(),n=this.options.production?null:this.getElementLocationCode(t);this.isAutomaticRuntime&&e!==r.JSXRole.KeyAfterPropSpread?this.transformTagToJSXFunc(n,e):this.transformTagToCreateElement(n)}getElementLocationCode(e){return`lineNumber: ${this.getLineNumberForIndex(e)}`}getLineNumberForIndex(e){let t=this.tokens.code;for(;this.lastIndex<e&&this.lastIndex<t.length;)t[this.lastIndex]===`
|
|
251
|
+
`&&this.lastLineNumber++,this.lastIndex++;return this.lastLineNumber}transformTagToJSXFunc(e,t){let n=t===r.JSXRole.StaticChildren;this.tokens.replaceToken(this.getJSXFuncInvocationCode(n));let a=null;if(this.tokens.matches1(i.TokenType.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, {`),this.processAutomaticChildrenAndEndProps(t);else{if(this.processTagIntro(),this.tokens.appendCode(`, {`),a=this.processProps(!0),this.tokens.matches2(i.TokenType.slash,i.TokenType.jsxTagEnd))this.tokens.appendCode(`}`);else if(this.tokens.matches1(i.TokenType.jsxTagEnd))this.tokens.removeToken(),this.processAutomaticChildrenAndEndProps(t);else throw Error(`Expected either /> or > at the end of the tag.`);a&&this.tokens.appendCode(`, ${a}`)}for(this.options.production||(a===null&&this.tokens.appendCode(`, void 0`),this.tokens.appendCode(`, ${n}, ${this.getDevSource(e)}, this`)),this.tokens.removeInitialToken();!this.tokens.matches1(i.TokenType.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(`)`)}transformTagToCreateElement(e){if(this.tokens.replaceToken(this.getCreateElementInvocationCode()),this.tokens.matches1(i.TokenType.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, null`),this.processChildren(!0);else if(this.processTagIntro(),this.processPropsObjectWithDevInfo(e),!this.tokens.matches2(i.TokenType.slash,i.TokenType.jsxTagEnd)){if(this.tokens.matches1(i.TokenType.jsxTagEnd))this.tokens.removeToken(),this.processChildren(!0);else throw Error(`Expected either /> or > at the end of the tag.`)}for(this.tokens.removeInitialToken();!this.tokens.matches1(i.TokenType.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(`)`)}getJSXFuncInvocationCode(e){return this.options.production?e?this.claimAutoImportedFuncInvocation(`jsxs`,`/jsx-runtime`):this.claimAutoImportedFuncInvocation(`jsx`,`/jsx-runtime`):this.claimAutoImportedFuncInvocation(`jsxDEV`,`/jsx-dev-runtime`)}getCreateElementInvocationCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedFuncInvocation(`createElement`,``);{let{jsxPragmaInfo:e}=this;return`${this.importProcessor&&this.importProcessor.getIdentifierReplacement(e.base)||e.base}${e.suffix}(`}}getFragmentCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedName(`Fragment`,this.options.production?`/jsx-runtime`:`/jsx-dev-runtime`);{let{jsxPragmaInfo:e}=this;return(this.importProcessor&&this.importProcessor.getIdentifierReplacement(e.fragmentBase)||e.fragmentBase)+e.fragmentSuffix}}claimAutoImportedFuncInvocation(e,t){let n=this.claimAutoImportedName(e,t);return this.importProcessor?`${n}.call(void 0, `:`${n}(`}claimAutoImportedName(e,t){if(this.importProcessor){let n=this.jsxImportSource+t;return this.cjsAutomaticModuleNameResolutions[n]||(this.cjsAutomaticModuleNameResolutions[n]=this.importProcessor.getFreeIdentifierForPath(n)),`${this.cjsAutomaticModuleNameResolutions[n]}.${e}`}return this.esmAutomaticImportNameResolutions[e]||(this.esmAutomaticImportNameResolutions[e]=this.nameManager.claimFreeName(`_${e}`)),this.esmAutomaticImportNameResolutions[e]}processTagIntro(){let e=this.tokens.currentIndex()+1;for(;this.tokens.tokens[e].isType||!this.tokens.matches2AtIndex(e-1,i.TokenType.jsxName,i.TokenType.jsxName)&&!this.tokens.matches2AtIndex(e-1,i.TokenType.greaterThan,i.TokenType.jsxName)&&!this.tokens.matches1AtIndex(e,i.TokenType.braceL)&&!this.tokens.matches1AtIndex(e,i.TokenType.jsxTagEnd)&&!this.tokens.matches2AtIndex(e,i.TokenType.slash,i.TokenType.jsxTagEnd);)e++;if(e===this.tokens.currentIndex()+1){let e=this.tokens.identifierName();c(e)&&this.tokens.replaceToken(`'${e}'`)}for(;this.tokens.currentIndex()<e;)this.rootTransformer.processToken()}processPropsObjectWithDevInfo(e){let t=this.options.production?``:`__self: this, __source: ${this.getDevSource(e)}`;!this.tokens.matches1(i.TokenType.jsxName)&&!this.tokens.matches1(i.TokenType.braceL)?t?this.tokens.appendCode(`, {${t}}`):this.tokens.appendCode(`, null`):(this.tokens.appendCode(`, {`),this.processProps(!1),t?this.tokens.appendCode(` ${t}}`):this.tokens.appendCode(`}`))}processProps(e){let t=null;for(;;){if(this.tokens.matches2(i.TokenType.jsxName,i.TokenType.eq)){let n=this.tokens.identifierName();if(e&&n===`key`){t!==null&&this.tokens.appendCode(t.replace(/[^\n]/g,``)),this.tokens.removeToken(),this.tokens.removeToken();let e=this.tokens.snapshot();this.processPropValue(),t=this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(e);continue}this.processPropName(n),this.tokens.replaceToken(`: `),this.processPropValue()}else if(this.tokens.matches1(i.TokenType.jsxName)){let e=this.tokens.identifierName();this.processPropName(e),this.tokens.appendCode(`: true`)}else if(this.tokens.matches1(i.TokenType.braceL))this.tokens.replaceToken(``),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken(``);else break;this.tokens.appendCode(`,`)}return t}processPropName(e){e.includes(`-`)?this.tokens.replaceToken(`'${e}'`):this.tokens.copyToken()}processPropValue(){this.tokens.matches1(i.TokenType.braceL)?(this.tokens.replaceToken(``),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken(``)):this.tokens.matches1(i.TokenType.jsxTagStart)?this.processJSXTag():this.processStringPropValue()}processStringPropValue(){let e=this.tokens.currentToken(),t=this.tokens.code.slice(e.start+1,e.end-1),n=u(t),r=d(t);this.tokens.replaceToken(r+n)}processAutomaticChildrenAndEndProps(e){e===r.JSXRole.StaticChildren?(this.tokens.appendCode(` children: [`),this.processChildren(!1),this.tokens.appendCode(`]}`)):(e===r.JSXRole.OneChild&&this.tokens.appendCode(` children: `),this.processChildren(!1),this.tokens.appendCode(`}`))}processChildren(e){let t=e;for(;;){if(this.tokens.matches2(i.TokenType.jsxTagStart,i.TokenType.slash))return;let e=!1;if(this.tokens.matches1(i.TokenType.braceL))this.tokens.matches2(i.TokenType.braceL,i.TokenType.braceR)?(this.tokens.replaceToken(``),this.tokens.replaceToken(``)):(this.tokens.replaceToken(t?`, `:``),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken(``),e=!0);else if(this.tokens.matches1(i.TokenType.jsxTagStart))this.tokens.appendCode(t?`, `:``),this.processJSXTag(),e=!0;else if(this.tokens.matches1(i.TokenType.jsxText)||this.tokens.matches1(i.TokenType.jsxEmptyText))e=this.processChildTextElement(t);else throw Error(`Unexpected token when processing JSX children.`);e&&(t=!0)}}processChildTextElement(e){let t=this.tokens.currentToken(),n=this.tokens.code.slice(t.start,t.end),r=u(n),i=l(n);return i===`""`?(this.tokens.replaceToken(r),!1):(this.tokens.replaceToken(`${e?`, `:``}${i}${r}`),!0)}getDevSource(e){return`{fileName: ${this.getFilenameVarName()}, ${e}}`}getFilenameVarName(){return this.filenameVarName||=this.nameManager.claimFreeName(`_jsxFileName`),this.filenameVarName}};function c(e){let t=e.charCodeAt(0);return t>=a.charCodes.lowercaseA&&t<=a.charCodes.lowercaseZ}e.startsWithLowerCase=c;function l(e){let t=``,n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];if(o===` `||o===` `||o===`\r`)r||(n+=o);else if(o===`
|
|
252
|
+
`)n=``,r=!0;else{if(i&&r&&(t+=` `),t+=n,n=``,o===`&`){let{entity:n,newI:r}=f(e,a+1);a=r-1,t+=n}else t+=o;i=!0,r=!1}}return r||(t+=n),JSON.stringify(t)}function u(e){let t=0,n=0;for(let r of e)r===`
|
|
253
|
+
`?(t++,n=0):r===` `&&n++;return`
|
|
254
|
+
`.repeat(t)+` `.repeat(n)}function d(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`
|
|
255
|
+
`){if(/\s/.test(e[n+1]))for(t+=` `;n<e.length&&/\s/.test(e[n+1]);)n++;else t+=`
|
|
256
|
+
`}else if(r===`&`){let{entity:r,newI:i}=f(e,n+1);t+=r,n=i-1}else t+=r}return JSON.stringify(t)}function f(e,t){let r=``,i=0,a,o=t;if(e[o]===`#`){let t=10;o++;let n;if(e[o]===`x`)for(t=16,o++,n=o;o<e.length&&m(e.charCodeAt(o));)o++;else for(n=o;o<e.length&&p(e.charCodeAt(o));)o++;if(e[o]===`;`){let r=e.slice(n,o);r&&(o++,a=String.fromCodePoint(parseInt(r,t)))}}else for(;o<e.length&&i++<10;){let t=e[o];if(o++,t===`;`){a=n.default.get(r);break}r+=t}return a?{entity:a,newI:o}:{entity:`&`,newI:t}}function p(e){return e>=a.charCodes.digit0&&e<=a.charCodes.digit9}function m(e){return e>=a.charCodes.digit0&&e<=a.charCodes.digit9||e>=a.charCodes.lowercaseA&&e<=a.charCodes.lowercaseF||e>=a.charCodes.uppercaseA&&e<=a.charCodes.uppercaseF}})),Pb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=Ob(),r=q(),i=Nb(),a=t(jb());function o(e,t){let o=a.default.call(void 0,t),s=/* @__PURE__ */ new Set;for(let t=0;t<e.tokens.length;t++){let a=e.tokens[t];if(a.type!==r.TokenType.name||a.isType||a.identifierRole!==n.IdentifierRole.Access&&a.identifierRole!==n.IdentifierRole.ObjectShorthand&&a.identifierRole!==n.IdentifierRole.ExportAccess||a.shadowsGlobal||s.add(e.identifierNameForToken(a)),a.type===r.TokenType.jsxTagStart&&s.add(o.base),a.type===r.TokenType.jsxTagStart&&t+1<e.tokens.length&&e.tokens[t+1].type===r.TokenType.jsxTagEnd&&(s.add(o.base),s.add(o.fragmentBase)),a.type===r.TokenType.jsxName&&a.identifierRole===n.IdentifierRole.Access){let n=e.identifierNameForToken(a);i.startsWithLowerCase.call(void 0,n)&&e.tokens[t+1].type!==r.TokenType.dot||s.add(e.identifierNameForToken(a))}}return s}e.getNonTypeIdentifiers=o})),Fb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=Ob(),r=yb(),i=q(),a=t(kb()),o=Pb();e.default=class e{__init(){this.nonTypeIdentifiers=/* @__PURE__ */ new Set}__init2(){this.importInfoByPath=/* @__PURE__ */ new Map}__init3(){this.importsToReplace=/* @__PURE__ */ new Map}__init4(){this.identifierReplacements=/* @__PURE__ */ new Map}__init5(){this.exportBindingsByLocalName=/* @__PURE__ */ new Map}constructor(t,n,r,i,a,o,s){this.nameManager=t,this.tokens=n,this.enableLegacyTypeScriptModuleInterop=r,this.options=i,this.isTypeScriptTransformEnabled=a,this.keepUnusedImports=o,this.helperManager=s,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),e.prototype.__init5.call(this)}preprocessTokens(){for(let e=0;e<this.tokens.tokens.length;e++)this.tokens.matches1AtIndex(e,i.TokenType._import)&&!this.tokens.matches3AtIndex(e,i.TokenType._import,i.TokenType.name,i.TokenType.eq)&&this.preprocessImportAtIndex(e),this.tokens.matches1AtIndex(e,i.TokenType._export)&&!this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType.eq)&&this.preprocessExportAtIndex(e);this.generateImportReplacements()}pruneTypeOnlyImports(){this.nonTypeIdentifiers=o.getNonTypeIdentifiers.call(void 0,this.tokens,this.options);for(let[e,t]of this.importInfoByPath.entries())t.hasBareImport||t.hasStarExport||t.exportStarNames.length>0||t.namedExports.length>0||[...t.defaultNames,...t.wildcardNames,...t.namedImports.map(({localName:e})=>e)].every(e=>this.shouldAutomaticallyElideImportedName(e))&&this.importsToReplace.set(e,``)}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}generateImportReplacements(){for(let[e,t]of this.importInfoByPath.entries()){let{defaultNames:n,wildcardNames:r,namedImports:i,namedExports:a,exportStarNames:o,hasStarExport:s}=t;if(n.length===0&&r.length===0&&i.length===0&&a.length===0&&o.length===0&&!s){this.importsToReplace.set(e,`require('${e}');`);continue}let c=this.getFreeIdentifierForPath(e),l;l=this.enableLegacyTypeScriptModuleInterop?c:r.length>0?r[0]:this.getFreeIdentifierForPath(e);let u=`var ${c} = require('${e}');`;if(r.length>0)for(let e of r){let t=this.enableLegacyTypeScriptModuleInterop?c:`${this.helperManager.getHelperName(`interopRequireWildcard`)}(${c})`;u+=` var ${e} = ${t};`}else o.length>0&&l!==c?u+=` var ${l} = ${this.helperManager.getHelperName(`interopRequireWildcard`)}(${c});`:n.length>0&&l!==c&&(u+=` var ${l} = ${this.helperManager.getHelperName(`interopRequireDefault`)}(${c});`);for(let{importedName:e,localName:t}of a)u+=` ${this.helperManager.getHelperName(`createNamedExportFrom`)}(${c}, '${t}', '${e}');`;for(let e of o)u+=` exports.${e} = ${l};`;s&&(u+=` ${this.helperManager.getHelperName(`createStarExport`)}(${c});`),this.importsToReplace.set(e,u);for(let e of n)this.identifierReplacements.set(e,`${l}.default`);for(let{importedName:e,localName:t}of i)this.identifierReplacements.set(t,`${c}.${e}`)}}getFreeIdentifierForPath(e){let t=e.split(`/`),n=t[t.length-1].replace(/\W/g,``);return this.nameManager.claimFreeName(`_${n}`)}preprocessImportAtIndex(e){let t=[],n=[],a=[];if(e++,(this.tokens.matchesContextualAtIndex(e,r.ContextualKeyword._type)||this.tokens.matches1AtIndex(e,i.TokenType._typeof))&&!this.tokens.matches1AtIndex(e+1,i.TokenType.comma)&&!this.tokens.matchesContextualAtIndex(e+1,r.ContextualKeyword._from)||this.tokens.matches1AtIndex(e,i.TokenType.parenL))return;if(this.tokens.matches1AtIndex(e,i.TokenType.name)&&(t.push(this.tokens.identifierNameAtIndex(e)),e++,this.tokens.matches1AtIndex(e,i.TokenType.comma)&&e++),this.tokens.matches1AtIndex(e,i.TokenType.star)&&(e+=2,n.push(this.tokens.identifierNameAtIndex(e)),e++),this.tokens.matches1AtIndex(e,i.TokenType.braceL)){let n=this.getNamedImports(e+1);e=n.newIndex;for(let e of n.namedImports)e.importedName==="default"?t.push(e.localName):a.push(e)}if(this.tokens.matchesContextualAtIndex(e,r.ContextualKeyword._from)&&e++,!this.tokens.matches1AtIndex(e,i.TokenType.string))throw Error(`Expected string token at the end of import statement.`);let o=this.tokens.stringValueAtIndex(e),s=this.getImportInfo(o);s.defaultNames.push(...t),s.wildcardNames.push(...n),s.namedImports.push(...a),t.length===0&&n.length===0&&a.length===0&&(s.hasBareImport=!0)}preprocessExportAtIndex(e){if(this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._var)||this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._let)||this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._const))this.preprocessVarExportAtIndex(e);else if(this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._function)||this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType._class)){let t=this.tokens.identifierNameAtIndex(e+2);this.addExportBinding(t,t)}else if(this.tokens.matches3AtIndex(e,i.TokenType._export,i.TokenType.name,i.TokenType._function)){let t=this.tokens.identifierNameAtIndex(e+3);this.addExportBinding(t,t)}else this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType.braceL)?this.preprocessNamedExportAtIndex(e):this.tokens.matches2AtIndex(e,i.TokenType._export,i.TokenType.star)&&this.preprocessExportStarAtIndex(e)}preprocessVarExportAtIndex(e){let t=0;for(let r=e+2;;r++)if(this.tokens.matches1AtIndex(r,i.TokenType.braceL)||this.tokens.matches1AtIndex(r,i.TokenType.dollarBraceL)||this.tokens.matches1AtIndex(r,i.TokenType.bracketL))t++;else if(this.tokens.matches1AtIndex(r,i.TokenType.braceR)||this.tokens.matches1AtIndex(r,i.TokenType.bracketR))t--;else if(t===0&&!this.tokens.matches1AtIndex(r,i.TokenType.name))break;else if(this.tokens.matches1AtIndex(1,i.TokenType.eq)){let e=this.tokens.currentToken().rhsEndIndex;if(e==null)throw Error(`Expected = token with an end index.`);r=e-1}else{let e=this.tokens.tokens[r];if(n.isDeclaration.call(void 0,e)){let e=this.tokens.identifierNameAtIndex(r);this.identifierReplacements.set(e,`exports.${e}`)}}}preprocessNamedExportAtIndex(e){e+=2;let{newIndex:t,namedImports:n}=this.getNamedImports(e);if(e=t,this.tokens.matchesContextualAtIndex(e,r.ContextualKeyword._from))e++;else{for(let{importedName:e,localName:t}of n)this.addExportBinding(e,t);return}if(!this.tokens.matches1AtIndex(e,i.TokenType.string))throw Error(`Expected string token at the end of import statement.`);let a=this.tokens.stringValueAtIndex(e);this.getImportInfo(a).namedExports.push(...n)}preprocessExportStarAtIndex(e){let t=null;if(this.tokens.matches3AtIndex(e,i.TokenType._export,i.TokenType.star,i.TokenType._as)?(e+=3,t=this.tokens.identifierNameAtIndex(e),e+=2):e+=3,!this.tokens.matches1AtIndex(e,i.TokenType.string))throw Error(`Expected string token at the end of star export statement.`);let n=this.tokens.stringValueAtIndex(e),r=this.getImportInfo(n);t===null?r.hasStarExport=!0:r.exportStarNames.push(t)}getNamedImports(e){let t=[];for(;;){if(this.tokens.matches1AtIndex(e,i.TokenType.braceR)){e++;break}let n=a.default.call(void 0,this.tokens,e);if(e=n.endIndex,n.isType||t.push({importedName:n.leftName,localName:n.rightName}),this.tokens.matches2AtIndex(e,i.TokenType.comma,i.TokenType.braceR)){e+=2;break}if(this.tokens.matches1AtIndex(e,i.TokenType.braceR)){e++;break}if(this.tokens.matches1AtIndex(e,i.TokenType.comma))e++;else throw Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[e])}`)}return{newIndex:e,namedImports:t}}getImportInfo(e){let t=this.importInfoByPath.get(e);if(t)return t;let n={defaultNames:[],wildcardNames:[],namedImports:[],namedExports:[],hasBareImport:!1,exportStarNames:[],hasStarExport:!1};return this.importInfoByPath.set(e,n),n}addExportBinding(e,t){this.exportBindingsByLocalName.has(e)||this.exportBindingsByLocalName.set(e,[]),this.exportBindingsByLocalName.get(e).push(t)}claimImportCode(e){let t=this.importsToReplace.get(e);return this.importsToReplace.set(e,``),t||``}getIdentifierReplacement(e){return this.identifierReplacements.get(e)||null}resolveExportBinding(e){let t=this.exportBindingsByLocalName.get(e);return!t||t.length===0?null:t.map(e=>`exports.${e}`).join(` = `)}getGlobalNames(){return/* @__PURE__ */ new Set([...this.identifierReplacements.keys(),...this.exportBindingsByLocalName.keys()])}}})),Ib=/* @__PURE__ */ o(((e,t,n)=>{(function(n,r){if(typeof e==`object`&&t!==void 0)r(t),t.exports=i(t);else if(typeof define==`function`&&define.amd)define([`module`],function(e){r.apply(this,arguments),e.exports=i(e)});else{let e={exports:{}};r(e),n=typeof globalThis<`u`?globalThis:n||self,n.sourcemapCodec=i(e)}function i(e){return`default`in e.exports?e.exports.default:e.exports}})(n,(function(e){"use strict";var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},o=(e,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(let c of r(a))!i.call(e,c)&&c!==o&&t(e,c,{get:()=>a[c],enumerable:!(s=n(a,c))||s.enumerable});return e},s=e=>o(t({},`__esModule`,{value:!0}),e),c={};a(c,{decode:()=>ae,decodeGeneratedRanges:()=>ee,decodeOriginalScopes:()=>w,decodeRangeMappings:()=>D,encode:()=>A,encodeGeneratedRanges:()=>te,encodeOriginalScopes:()=>T,encodeRangeMappings:()=>ie}),e.exports=s(c);var l=44,u=59,d=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,f=/* @__PURE__ */ new Uint8Array(64),p=/* @__PURE__ */ new Uint8Array(128);for(let e=0;e<d.length;e++){let t=d.charCodeAt(e);f[e]=t,p[t]=e}function m(e){let t=0,n=0,r=0;do r=p[e.next()],t|=(r&31)<<n,n+=5;while(r&32);return t}function h(e){return e&1?-2147483648|-(e>>>1):e>>>1}function g(e,t){do{let n=t&31;t>>>=5,t>0&&(n|=32),e.write(f[n])}while(t>0)}function _(e){return e<0?-e<<1|1:e<<1}function v(e,t){return e.pos>=t?!1:e.peek()!==l}var y=16384,b=typeof TextDecoder<`u`?/* @__PURE__ */ new TextDecoder:typeof Buffer<`u`?{decode(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString()}}:{decode(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}},x=class{constructor(){this.pos=0,this.out=``,this.buffer=new Uint8Array(y)}write(e){let{buffer:t}=this;t[this.pos++]=e,this.pos===y&&(this.out+=b.decode(t),this.pos=0)}flush(){let{buffer:e,out:t,pos:n}=this;return n>0?t+b.decode(e.subarray(0,n)):t}},S=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}},C=[];function w(e){let{length:t}=e,n=new S(e),r=[],i=[],a=0;for(;n.pos<t;n.pos++){a+=h(m(n));let e=h(m(n));if(!v(n,t)){let t=i.pop();t[2]=a,t[3]=e;continue}let o=h(m(n)),s=h(m(n))&1?[a,e,0,0,o,h(m(n))]:[a,e,0,0,o],c=C;if(v(n,t)){c=[];do{let e=h(m(n));c.push(e)}while(v(n,t))}s.vars=c,r.push(s),i.push(s)}return r}function T(e){let t=new x;for(let n=0;n<e.length;)n=E(e,n,t,[0]);return t.flush()}function E(e,t,n,r){let i=e[t],{0:a,1:o,2:s,3:c,4:u,vars:d}=i;t>0&&n.write(l),g(n,_(a-r[0])),r[0]=a,g(n,_(o)),g(n,_(u)),g(n,_(+(i.length===6))),i.length===6&&g(n,_(i[5]));for(let e of d)g(n,_(e));for(t++;t<e.length;){let{0:i,1:a}=e[t];if(i>s||i===s&&a>=c)break;t=E(e,t,n,r)}return n.write(l),g(n,_(s-r[0])),r[0]=s,g(n,_(c)),t}function ee(e){let{length:t}=e,n=new S(e),r=[],i=[],a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0;do{let e=n.indexOf(`;`),t=0;for(;n.pos<e;n.pos++){if(t+=h(m(n)),!v(n,e)){let e=i.pop();e[2]=a,e[3]=t;continue}let p=h(m(n)),g=p&1,_=p&2,y=p&4,b=null,x=C,S;if(g){let e=o+h(m(n));s=h(m(n))+(o===e?s:0),o=e,S=[a,t,0,0,e,s]}else S=[a,t,0,0];if(S.isScope=!!y,_){let e=c,t=l;c+=h(m(n));let r=e===c;l=(r?l:0)+h(m(n)),u=(r&&t===l?u:0)+h(m(n)),b=[c,l,u]}if(S.callsite=b,v(n,e)){x=[];do{d=a,f=t;let e=h(m(n)),r;if(e<-1){r=[[h(m(n))]];for(let t=-1;t>e;t--){let e=d;d+=h(m(n)),f=(d===e?f:0)+h(m(n));let t=h(m(n));r.push([t,d,f])}}else r=[[e]];x.push(r)}while(v(n,e))}S.bindings=x,r.push(S),i.push(S)}a++,n.pos=e+1}while(n.pos<t);return r}function te(e){if(e.length===0)return``;let t=new x;for(let n=0;n<e.length;)n=ne(e,n,t,[0,0,0,0,0,0,0]);return t.flush()}function ne(e,t,n,r){let i=e[t],{0:a,1:o,2:s,3:c,isScope:u,callsite:d,bindings:f}=i;if(r[0]<a?(re(n,r[0],a),r[0]=a,r[1]=0):t>0&&n.write(l),g(n,_(i[1]-r[1])),r[1]=i[1],g(n,_(i.length===6|(d?2:0)|(u?4:0))),i.length===6){let{4:e,5:t}=i;e!==r[2]&&(r[3]=0),g(n,_(e-r[2])),r[2]=e,g(n,_(t-r[3])),r[3]=t}if(d){let{0:e,1:t,2:a}=i.callsite;e===r[4]?t!==r[5]&&(r[6]=0):(r[5]=0,r[6]=0),g(n,_(e-r[4])),r[4]=e,g(n,_(t-r[5])),r[5]=t,g(n,_(a-r[6])),r[6]=a}if(f)for(let e of f){e.length>1&&g(n,_(-e.length));let t=e[0][0];g(n,_(t));let r=a,i=o;for(let t=1;t<e.length;t++){let a=e[t];g(n,_(a[1]-r)),r=a[1],g(n,_(a[2]-i)),i=a[2],g(n,_(a[0]))}}for(t++;t<e.length;){let{0:i,1:a}=e[t];if(i>s||i===s&&a>=c)break;t=ne(e,t,n,r)}return r[0]<s?(re(n,r[0],s),r[0]=s,r[1]=0):n.write(l),g(n,_(c-r[1])),r[1]=c,t}function re(e,t,n){do e.write(u);while(++t<n)}function D(e){let{length:t}=e,n=new S(e),r=[];do{let e=n.indexOf(`;`),t=[],i=0;for(;n.pos<e;)i+=m(n),t.push(i);r.push(t),n.pos=e+1}while(n.pos<=t);return r}function ie(e){if(e.length===0)return``;let t=new x;for(let n=0;n<e.length;n++){let r=e[n];n>0&&t.write(u);let i=0;for(let e=0;e<r.length;e++){let n=r[e];g(t,n-i),i=n}}return t.flush()}function ae(e){let{length:t}=e,n=new S(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i+=h(m(n)),i<u&&(l=!1),u=i,v(n,e)?(a+=h(m(n)),o+=h(m(n)),s+=h(m(n)),v(n,e)?(c+=h(m(n)),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||O(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function O(e){e.sort(k)}function k(e,t){return e[0]-t[0]}function A(e){let t=new x,n=0,r=0,i=0,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(o>0&&t.write(u),s.length===0)continue;let c=0;for(let e=0;e<s.length;e++){let o=s[e];e>0&&t.write(l),g(t,_(o[0]-c)),c=o[0],o.length!==1&&(g(t,_(o[1]-n)),g(t,_(o[2]-r)),g(t,_(o[3]-i)),n=o[1],r=o[2],i=o[3],o.length!==4&&(g(t,_(o[4]-a)),a=o[4]))}}return t.flush()}}))})),Lb=/* @__PURE__ */ o(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.resolveURI=r())})(n,(function(){"use strict";let e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function r(t){return e.test(t)}function i(e){return e.startsWith(`//`)}function a(e){return e.startsWith(`/`)}function o(e){return e.startsWith(`file:`)}function s(e){return/^[.?#]/.test(e)}function c(e){let n=t.exec(e);return u(n[1],n[2]||``,n[3],n[4]||``,n[5]||`/`,n[6]||``,n[7]||``)}function l(e){let t=n.exec(e),r=t[2];return u(`file:`,``,t[1]||``,``,a(r)?r:`/`+r,t[3]||``,t[4]||``)}function u(e,t,n,r,i,a,o){return{scheme:e,user:t,host:n,port:r,path:i,query:a,hash:o,type:7}}function d(e){if(i(e)){let t=c(`http:`+e);return t.scheme=``,t.type=6,t}if(a(e)){let t=c(`http://foo.com`+e);return t.scheme=``,t.host=``,t.type=5,t}if(o(e))return l(e);if(r(e))return c(e);let t=c(`http://foo.com/`+e);return t.scheme=``,t.host=``,t.type=e?e.startsWith(`?`)?3:e.startsWith(`#`)?2:4:1,t}function f(e){if(e.endsWith(`/..`))return e;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function p(e,t){m(t,t.type),e.path=e.path===`/`?t.path:f(t.path)+e.path}function m(e,t){let n=t<=4,r=e.path.split(`/`),i=1,a=0,o=!1;for(let e=1;e<r.length;e++){let t=r[e];t?(o=!1,t!==`.`&&(t===`..`?a?(o=!0,a--,i--):n&&(r[i++]=t):(r[i++]=t,a++))):o=!0}let s=``;for(let e=1;e<i;e++)s+=`/`+r[e];(!s||o&&!s.endsWith(`/..`))&&(s+=`/`),e.path=s}function h(e,t){if(!e&&!t)return``;let n=d(e),r=n.type;if(t&&r!==7){let e=d(t),i=e.type;switch(r){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:p(n,e);case 5:n.user=e.user,n.host=e.host,n.port=e.port;case 6:n.scheme=e.scheme}i>r&&(r=i)}m(n,r);let i=n.query+n.hash;switch(r){case 2:case 3:return i;case 4:{let r=n.path.slice(1);return r?s(t||e)&&!s(r)?`./`+r+i:r+i:i||`.`}case 5:return n.path+i;default:return n.scheme+`//`+n.user+n.host+n.port+n.path+i}}return h}))})),Rb=/* @__PURE__ */ o(((e,t,n)=>{(function(n,r){if(typeof e==`object`&&t!==void 0)r(t,Lb(),Ib()),t.exports=i(t);else if(typeof define==`function`&&define.amd)define([`module`,`@jridgewell/resolve-uri`,`@jridgewell/sourcemap-codec`],function(e){r.apply(this,arguments),e.exports=i(e)});else{let e={exports:{}};r(e,n.resolveURI,n.sourcemapCodec),n=typeof globalThis<`u`?globalThis:n||self,n.traceMapping=i(e)}function i(e){return`default`in e.exports?e.exports.default:e.exports}})(n,(function(e,t,n){"use strict";var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>function(){return t||(0,e[o(e)[0]])((t={exports:{}}).exports,t),t.exports},u=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:r(s(e)),d(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(i({},`__esModule`,{value:!0}),e),m=l({"umd:@jridgewell/sourcemap-codec"(e,t){t.exports=n}}),h=l({"umd:@jridgewell/resolve-uri"(e,n){n.exports=t}}),g={};u(g,{AnyMap:()=>ce,FlattenMap:()=>ce,GREATEST_LOWER_BOUND:()=>ge,LEAST_UPPER_BOUND:()=>he,TraceMap:()=>_e,allGeneratedPositionsFor:()=>xe,decodedMap:()=>Ee,decodedMappings:()=>F,eachMapping:()=>Se,encodedMap:()=>De,encodedMappings:()=>P,generatedPositionFor:()=>be,isIgnored:()=>we,originalPositionFor:()=>ye,presortedDecodedMap:()=>Te,sourceContentFor:()=>I,traceSegment:()=>ve}),e.exports=p(g);var _=f(m()),v=f(h());function y(e){if(!e)return``;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function b(e,t){let n=y(e),r=t?t+`/`:``;return e=>(0,v.default)(r+(e||``),n)}var x=0,S=1,C=2,w=3,T=4,E=1,ee=2;function te(e,t){let n=ne(e,0);if(n===e.length)return e;t||(e=e.slice());for(let r=n;r<e.length;r=ne(e,r+1))e[r]=D(e[r],t);return e}function ne(e,t){for(let n=t;n<e.length;n++)if(!re(e[n]))return n;return e.length}function re(e){for(let t=1;t<e.length;t++)if(e[t][x]<e[t-1][x])return!1;return!0}function D(e,t){return t||(e=e.slice()),e.sort(ie)}function ie(e,t){return e[x]-t[x]}function ae(e,t){let n=t.map(()=>[]);for(let t=0;t<e.length;t++){let r=e[t];for(let e=0;e<r.length;e++){let i=r[e];if(i.length===1)continue;let a=i[S],o=i[C],s=i[w],c=n[a];(c[o]||(c[o]=[])).push([s,t,i[x]])}}for(let e=0;e<n.length;e++){let t=n[e];for(let e=0;e<t.length;e++){let n=t[e];n&&n.sort(ie)}}return n}var O=!1;function k(e,t,n,r){for(;n<=r;){let i=n+(r-n>>1),a=e[i][x]-t;if(a===0)return O=!0,i;a<0?n=i+1:r=i-1}return O=!1,n-1}function A(e,t,n){for(let r=n+1;r<e.length&&e[r][x]===t;n=r++);return n}function oe(e,t,n){for(let r=n-1;r>=0&&e[r][x]===t;n=r--);return n}function j(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function M(e,t,n,r){let{lastKey:i,lastNeedle:a,lastIndex:o}=n,s=0,c=e.length-1;if(r===i){if(t===a)return O=o!==-1&&e[o][x]===t,o;t>=a?s=o===-1?0:o:c=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=k(e,t,s,c)}function se(e){return typeof e==`string`?JSON.parse(e):e}var ce=function(e,t){let n=se(e);if(!(`sections`in n))return new _e(n,t);let r=[],i=[],a=[],o=[],s=[];return le(n,t,r,i,a,o,s,0,0,1/0,1/0),Te({version:3,file:n.file,names:o,sources:i,sourcesContent:a,mappings:r,ignoreList:s})};function le(e,t,n,r,i,a,o,s,c,l,u){let{sections:d}=e;for(let e=0;e<d.length;e++){let{map:f,offset:p}=d[e],m=l,h=u;if(e+1<d.length){let t=d[e+1].offset;m=Math.min(l,s+t.line),m===l?h=Math.min(u,c+t.column):m<l&&(h=c+t.column)}ue(f,t,n,r,i,a,o,s+p.line,c+p.column,m,h)}}function ue(e,t,n,r,i,a,o,s,c,l,u){let d=se(e);if(`sections`in d)return le(...arguments);let f=new _e(d,t),p=r.length,m=a.length,h=F(f),{resolvedSources:g,sourcesContent:_,ignoreList:v}=f;if(de(r,g),de(a,f.names),_)de(i,_);else for(let e=0;e<g.length;e++)i.push(null);if(v)for(let e=0;e<v.length;e++)o.push(v[e]+p);for(let e=0;e<h.length;e++){let t=s+e;if(t>l)return;let r=fe(n,t),i=e===0?c:0,a=h[e];for(let e=0;e<a.length;e++){let n=a[e],o=i+n[x];if(t===l&&o>=u)return;if(n.length===1){r.push([o]);continue}let s=p+n[S],c=n[C],d=n[w];r.push(n.length===4?[o,s,c,d]:[o,s,c,d,m+n[T]])}}}function de(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function fe(e,t){for(let n=e.length;n<=t;n++)e[n]=[];return e[t]}var pe="`line` must be greater than 0 (lines start at line 1)",me="`column` must be greater than or equal to 0 (columns start at column 0)",he=-1,ge=1,_e=class{constructor(e,t){let n=typeof e==`string`;if(!n&&e._decodedMemo)return e;let r=se(e),{version:i,file:a,names:o,sourceRoot:s,sources:c,sourcesContent:l}=r;this.version=i,this.file=a,this.names=o||[],this.sourceRoot=s,this.sources=c,this.sourcesContent=l,this.ignoreList=r.ignoreList||r.x_google_ignoreList||void 0;let u=b(t,s);this.resolvedSources=c.map(u);let{mappings:d}=r;if(typeof d==`string`)this._encoded=d,this._decoded=void 0;else if(Array.isArray(d))this._encoded=void 0,this._decoded=te(d,n);else if(r.sections)throw Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);else throw Error(`invalid source map: ${JSON.stringify(r)}`);this._decodedMemo=j(),this._bySources=void 0,this._bySourceMemos=void 0}};function N(e){return e}function P(e){var t;return(t=N(e))._encoded??(t._encoded=(0,_.encode)(N(e)._decoded))}function F(e){var t;return(t=N(e))._decoded||(t._decoded=(0,_.decode)(N(e)._encoded))}function ve(e,t,n){let r=F(e);if(t>=r.length)return null;let i=r[t],a=je(i,N(e)._decodedMemo,t,n,ge);return a===-1?null:i[a]}function ye(e,t){let{line:n,column:r,bias:i}=t;if(n--,n<0)throw Error(pe);if(r<0)throw Error(me);let a=F(e);if(n>=a.length)return ke(null,null,null,null);let o=a[n],s=je(o,N(e)._decodedMemo,n,r,i||ge);if(s===-1)return ke(null,null,null,null);let c=o[s];if(c.length===1)return ke(null,null,null,null);let{names:l,resolvedSources:u}=e;return ke(u[c[S]],c[C]+1,c[w],c.length===5?l[c[T]]:null)}function be(e,t){let{source:n,line:r,column:i,bias:a}=t;return Ne(e,n,r,i,a||ge,!1)}function xe(e,t){let{source:n,line:r,column:i,bias:a}=t;return Ne(e,n,r,i,a||he,!0)}function Se(e,t){let n=F(e),{names:r,resolvedSources:i}=e;for(let e=0;e<n.length;e++){let a=n[e];for(let n=0;n<a.length;n++){let o=a[n],s=e+1,c=o[0],l=null,u=null,d=null,f=null;o.length!==1&&(l=i[o[1]],u=o[2]+1,d=o[3]),o.length===5&&(f=r[o[4]]),t({generatedLine:s,generatedColumn:c,source:l,originalLine:u,originalColumn:d,name:f})}}}function Ce(e,t){let{sources:n,resolvedSources:r}=e,i=n.indexOf(t);return i===-1&&(i=r.indexOf(t)),i}function I(e,t){let{sourcesContent:n}=e;if(n==null)return null;let r=Ce(e,t);return r===-1?null:n[r]}function we(e,t){let{ignoreList:n}=e;if(n==null)return!1;let r=Ce(e,t);return r!==-1&&n.includes(r)}function Te(e,t){let n=new _e(Oe(e,[]),t);return N(n)._decoded=e.mappings,n}function Ee(e){return Oe(e,F(e))}function De(e){return Oe(e,P(e))}function Oe(e,t){return{version:e.version,file:e.file,names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,mappings:t,ignoreList:e.ignoreList||e.x_google_ignoreList}}function ke(e,t,n,r){return{source:e,line:t,column:n,name:r}}function Ae(e,t){return{line:e,column:t}}function je(e,t,n,r,i){let a=M(e,r,t,n);return O?a=(i===he?A:oe)(e,r,a):i===he&&a++,a===-1||a===e.length?-1:a}function Me(e,t,n,r,i){let a=je(e,t,n,r,ge);if(!O&&i===he&&a++,a===-1||a===e.length)return[];let o=O?r:e[a][x];O||(a=oe(e,o,a));let s=A(e,o,a),c=[];for(;a<=s;a++){let t=e[a];c.push(Ae(t[E]+1,t[ee]))}return c}function Ne(e,t,n,r,i,a){var o,s;if(n--,n<0)throw Error(pe);if(r<0)throw Error(me);let{sources:c,resolvedSources:l}=e,u=c.indexOf(t);if(u===-1&&(u=l.indexOf(t)),u===-1)return a?[]:Ae(null,null);let d=(o=N(e))._bySourceMemos||(o._bySourceMemos=c.map(j)),f=((s=N(e))._bySources||(s._bySources=ae(F(e),d)))[u][n];if(f==null)return a?[]:Ae(null,null);let p=d[u];if(a)return Me(f,p,n,r,i);let m=je(f,p,n,r,i);if(m===-1)return Ae(null,null);let h=f[m];return Ae(h[E]+1,h[ee])}}))})),zb=/* @__PURE__ */ o(((e,t,n)=>{(function(n,r){if(typeof e==`object`&&t!==void 0)r(t,Ib(),Rb()),t.exports=i(t);else if(typeof define==`function`&&define.amd)define([`module`,`@jridgewell/sourcemap-codec`,`@jridgewell/trace-mapping`],function(e){r.apply(this,arguments),e.exports=i(e)});else{let e={exports:{}};r(e,n.sourcemapCodec,n.traceMapping),n=typeof globalThis<`u`?globalThis:n||self,n.genMapping=i(e)}function i(e){return`default`in e.exports?e.exports.default:e.exports}})(n,(function(e,t,n){"use strict";var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>function(){return t||(0,e[o(e)[0]])((t={exports:{}}).exports,t),t.exports},u=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:r(s(e)),d(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(i({},`__esModule`,{value:!0}),e),m=l({"umd:@jridgewell/sourcemap-codec"(e,n){n.exports=t}}),h=l({"umd:@jridgewell/trace-mapping"(e,t){t.exports=n}}),g={};u(g,{GenMapping:()=>re,addMapping:()=>ae,addSegment:()=>ie,allMappings:()=>ce,fromMap:()=>se,maybeAddMapping:()=>k,maybeAddSegment:()=>O,setIgnore:()=>oe,setSourceContent:()=>A,toDecodedMap:()=>j,toEncodedMap:()=>M}),e.exports=p(g);var _=class{constructor(){this._indexes={__proto__:null},this.array=[]}};function v(e){return e}function y(e,t){return v(e)._indexes[t]}function b(e,t){let n=y(e,t);if(n!==void 0)return n;let{array:r,_indexes:i}=v(e);return i[t]=r.push(t)-1}function x(e,t){let n=y(e,t);if(n===void 0)return;let{array:r,_indexes:i}=v(e);for(let e=n+1;e<r.length;e++){let t=r[e];r[e-1]=t,i[t]--}i[t]=void 0,r.pop()}var S=f(m()),C=f(h()),w=0,T=1,E=2,ee=3,te=4,ne=-1,re=class{constructor({file:e,sourceRoot:t}={}){this._names=new _,this._sources=new _,this._sourcesContent=[],this._mappings=[],this.file=e,this.sourceRoot=t,this._ignoreList=new _}};function D(e){return e}function ie(e,t,n,r,i,a,o,s){return le(!1,e,t,n,r,i,a,o,s)}function ae(e,t){return _e(!1,e,t)}var O=(e,t,n,r,i,a,o,s)=>le(!0,e,t,n,r,i,a,o,s),k=(e,t)=>_e(!0,e,t);function A(e,t,n){let{_sources:r,_sourcesContent:i}=D(e),a=b(r,t);i[a]=n}function oe(e,t,n=!0){let{_sources:r,_sourcesContent:i,_ignoreList:a}=D(e),o=b(r,t);o===i.length&&(i[o]=null),n?b(a,o):x(a,o)}function j(e){let{_mappings:t,_sources:n,_sourcesContent:r,_names:i,_ignoreList:a}=D(e);return pe(t),{version:3,file:e.file||void 0,names:i.array,sourceRoot:e.sourceRoot||void 0,sources:n.array,sourcesContent:r,mappings:t,ignoreList:a.array}}function M(e){let t=j(e);return Object.assign({},t,{mappings:(0,S.encode)(t.mappings)})}function se(e){let t=new C.TraceMap(e),n=new re({file:t.file,sourceRoot:t.sourceRoot});return me(D(n)._names,t.names),me(D(n)._sources,t.sources),D(n)._sourcesContent=t.sourcesContent||t.sources.map(()=>null),D(n)._mappings=(0,C.decodedMappings)(t),t.ignoreList&&me(D(n)._ignoreList,t.ignoreList),n}function ce(e){let t=[],{_mappings:n,_sources:r,_names:i}=D(e);for(let e=0;e<n.length;e++){let a=n[e];for(let n=0;n<a.length;n++){let o=a[n],s={line:e+1,column:o[w]},c,l,u;o.length!==1&&(c=r.array[o[T]],l={line:o[E]+1,column:o[ee]},o.length===5&&(u=i.array[o[te]])),t.push({generated:s,source:c,original:l,name:u})}}return t}function le(e,t,n,r,i,a,o,s,c){let{_mappings:l,_sources:u,_sourcesContent:d,_names:f}=D(t),p=ue(l,n),m=de(p,r);if(!i)return e&&he(p,m)?void 0:fe(p,m,[r]);let h=b(u,i),g=s?b(f,s):ne;if(h===d.length&&(d[h]=c??null),!(e&&ge(p,m,h,a,o,g)))return fe(p,m,s?[r,h,a,o,g]:[r,h,a,o])}function ue(e,t){for(let n=e.length;n<=t;n++)e[n]=[];return e[t]}function de(e,t){let n=e.length;for(let r=n-1;r>=0&&!(t>=e[r][w]);n=r--);return n}function fe(e,t,n){for(let n=e.length;n>t;n--)e[n]=e[n-1];e[t]=n}function pe(e){let{length:t}=e,n=t;for(let t=n-1;t>=0&&!(e[t].length>0);n=t,t--);n<t&&(e.length=n)}function me(e,t){for(let n=0;n<t.length;n++)b(e,t[n])}function he(e,t){return t===0||e[t-1].length===1}function ge(e,t,n,r,i,a){if(t===0)return!1;let o=e[t-1];return o.length!==1&&n===o[T]&&r===o[E]&&i===o[ee]&&a===(o.length===5?o[te]:ne)}function _e(e,t,n){let{generated:r,source:i,original:a,name:o,content:s}=n;return i?le(e,t,r.line-1,r.column,i,a.line-1,a.column,o,s):le(e,t,r.line-1,r.column,null,null,null,null,null)}}))})),Bb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=zb(),n=xb();function r({code:e,mappings:r},a,o,s,c){let l=i(s,c),u=new t.GenMapping({file:o.compiledFilename}),d=0,f=r[0];for(;f===void 0&&d<r.length-1;)d++,f=r[d];let p=0,m=0;f!==m&&t.maybeAddSegment.call(void 0,u,p,0,a,p,0);for(let i=0;i<e.length;i++){if(i===f){let e=f-m,n=l[d];for(t.maybeAddSegment.call(void 0,u,p,e,a,p,n);(f===i||f===void 0)&&d<r.length-1;)d++,f=r[d]}e.charCodeAt(i)===n.charCodes.lineFeed&&(p++,m=i+1,f!==m&&t.maybeAddSegment.call(void 0,u,p,0,a,p,0))}let{sourceRoot:h,sourcesContent:g,..._}=t.toEncodedMap.call(void 0,u);return _}e.default=r;function i(e,t){let r=Array(t.length),i=0,a=t[i].start,o=0;for(let s=0;s<e.length;s++)s===a&&(r[i]=a-o,i++,a=t[i].start),e.charCodeAt(s)===n.charCodes.lineFeed&&(o=s+1);return r}})),Vb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={require:`
|
|
257
|
+
import {createRequire as CREATE_REQUIRE_NAME} from "module";
|
|
258
|
+
const require = CREATE_REQUIRE_NAME(import.meta.url);
|
|
259
|
+
`,interopRequireWildcard:`
|
|
260
|
+
function interopRequireWildcard(obj) {
|
|
261
|
+
if (obj && obj.__esModule) {
|
|
262
|
+
return obj;
|
|
263
|
+
} else {
|
|
264
|
+
var newObj = {};
|
|
265
|
+
if (obj != null) {
|
|
266
|
+
for (var key in obj) {
|
|
267
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
268
|
+
newObj[key] = obj[key];
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
newObj.default = obj;
|
|
273
|
+
return newObj;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
`,interopRequireDefault:`
|
|
277
|
+
function interopRequireDefault(obj) {
|
|
278
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
279
|
+
}
|
|
280
|
+
`,createNamedExportFrom:`
|
|
281
|
+
function createNamedExportFrom(obj, localName, importedName) {
|
|
282
|
+
Object.defineProperty(exports, localName, {enumerable: true, configurable: true, get: () => obj[importedName]});
|
|
283
|
+
}
|
|
284
|
+
`,createStarExport:`
|
|
285
|
+
function createStarExport(obj) {
|
|
286
|
+
Object.keys(obj)
|
|
287
|
+
.filter((key) => key !== "default" && key !== "__esModule")
|
|
288
|
+
.forEach((key) => {
|
|
289
|
+
if (exports.hasOwnProperty(key)) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]});
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
`,nullishCoalesce:`
|
|
296
|
+
function nullishCoalesce(lhs, rhsFn) {
|
|
297
|
+
if (lhs != null) {
|
|
298
|
+
return lhs;
|
|
299
|
+
} else {
|
|
300
|
+
return rhsFn();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
`,asyncNullishCoalesce:`
|
|
304
|
+
async function asyncNullishCoalesce(lhs, rhsFn) {
|
|
305
|
+
if (lhs != null) {
|
|
306
|
+
return lhs;
|
|
307
|
+
} else {
|
|
308
|
+
return await rhsFn();
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
`,optionalChain:`
|
|
312
|
+
function optionalChain(ops) {
|
|
313
|
+
let lastAccessLHS = undefined;
|
|
314
|
+
let value = ops[0];
|
|
315
|
+
let i = 1;
|
|
316
|
+
while (i < ops.length) {
|
|
317
|
+
const op = ops[i];
|
|
318
|
+
const fn = ops[i + 1];
|
|
319
|
+
i += 2;
|
|
320
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
323
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
324
|
+
lastAccessLHS = value;
|
|
325
|
+
value = fn(value);
|
|
326
|
+
} else if (op === 'call' || op === 'optionalCall') {
|
|
327
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
328
|
+
lastAccessLHS = undefined;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return value;
|
|
332
|
+
}
|
|
333
|
+
`,asyncOptionalChain:`
|
|
334
|
+
async function asyncOptionalChain(ops) {
|
|
335
|
+
let lastAccessLHS = undefined;
|
|
336
|
+
let value = ops[0];
|
|
337
|
+
let i = 1;
|
|
338
|
+
while (i < ops.length) {
|
|
339
|
+
const op = ops[i];
|
|
340
|
+
const fn = ops[i + 1];
|
|
341
|
+
i += 2;
|
|
342
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
343
|
+
return undefined;
|
|
344
|
+
}
|
|
345
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
346
|
+
lastAccessLHS = value;
|
|
347
|
+
value = await fn(value);
|
|
348
|
+
} else if (op === 'call' || op === 'optionalCall') {
|
|
349
|
+
value = await fn((...args) => value.call(lastAccessLHS, ...args));
|
|
350
|
+
lastAccessLHS = undefined;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return value;
|
|
354
|
+
}
|
|
355
|
+
`,optionalChainDelete:`
|
|
356
|
+
function optionalChainDelete(ops) {
|
|
357
|
+
const result = OPTIONAL_CHAIN_NAME(ops);
|
|
358
|
+
return result == null ? true : result;
|
|
359
|
+
}
|
|
360
|
+
`,asyncOptionalChainDelete:`
|
|
361
|
+
async function asyncOptionalChainDelete(ops) {
|
|
362
|
+
const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops);
|
|
363
|
+
return result == null ? true : result;
|
|
364
|
+
}
|
|
365
|
+
`};e.HelperManager=class e{__init(){this.helperNames={}}__init2(){this.createRequireName=null}constructor(t){this.nameManager=t,e.prototype.__init.call(this),e.prototype.__init2.call(this)}getHelperName(e){let t=this.helperNames[e];return t||(t=this.nameManager.claimFreeName(`_${e}`),this.helperNames[e]=t,t)}emitHelpers(){let e=``;this.helperNames.optionalChainDelete&&this.getHelperName(`optionalChain`),this.helperNames.asyncOptionalChainDelete&&this.getHelperName(`asyncOptionalChain`);for(let[n,r]of Object.entries(t)){let t=this.helperNames[n],i=r;n===`optionalChainDelete`?i=i.replace(`OPTIONAL_CHAIN_NAME`,this.helperNames.optionalChain):n===`asyncOptionalChainDelete`?i=i.replace(`ASYNC_OPTIONAL_CHAIN_NAME`,this.helperNames.asyncOptionalChain):n===`require`&&(this.createRequireName===null&&(this.createRequireName=this.nameManager.claimFreeName(`_createRequire`)),i=i.replace(/CREATE_REQUIRE_NAME/g,this.createRequireName)),t&&(e+=` `,e+=i.replace(n,t).replace(/\s+/g,` `).trim())}return e}}})),Hb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ob(),n=q();function r(e,t,n){i(e,n)&&a(e,t,n)}e.default=r;function i(e,r){for(let i of e.tokens)if(i.type===n.TokenType.name&&!i.isType&&t.isNonTopLevelDeclaration.call(void 0,i)&&r.has(e.identifierNameForToken(i)))return!0;return!1}e.hasShadowedGlobals=i;function a(e,r,i){let a=[],s=r.length-1;for(let c=e.tokens.length-1;;c--){for(;a.length>0&&a[a.length-1].startTokenIndex===c+1;)a.pop();for(;s>=0&&r[s].endTokenIndex===c+1;)a.push(r[s]),s--;if(c<0)break;let l=e.tokens[c],u=e.identifierNameForToken(l);if(a.length>1&&!l.isType&&l.type===n.TokenType.name&&i.has(u)){if(t.isBlockScopedDeclaration.call(void 0,l))o(a[a.length-1],e,u);else if(t.isFunctionScopedDeclaration.call(void 0,l)){let t=a.length-1;for(;t>0&&!a[t].isFunctionScope;)t--;if(t<0)throw Error(`Did not find parent function scope.`);o(a[t],e,u)}}}if(a.length>0)throw Error(`Expected empty scope stack after processing file.`)}function o(e,t,r){for(let i=e.startTokenIndex;i<e.endTokenIndex;i++){let e=t.tokens[i];(e.type===n.TokenType.name||e.type===n.TokenType.jsxName)&&t.identifierNameForToken(e)===r&&(e.shadowsGlobal=!0)}}})),Ub=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=q();function n(e,n){let r=[];for(let i of n)i.type===t.TokenType.name&&r.push(e.slice(i.start,i.end));return r}e.default=n})),Wb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(Ub());e.default=class e{__init(){this.usedNames=/* @__PURE__ */ new Set}constructor(t,r){e.prototype.__init.call(this),this.usedNames=new Set(n.default.call(void 0,t,r))}claimFreeName(e){let t=this.findFreeName(e);return this.usedNames.add(t),t}findFreeName(e){if(!this.usedNames.has(e))return e;let t=2;for(;this.usedNames.has(e+String(t));)t++;return e+String(t)}}})),Gb=/* @__PURE__ */ o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.DetailContext=e.NoopContext=e.VError=void 0;var i=function(e){r(t,e);function t(n,r){var i=e.call(this,r)||this;return i.path=n,Object.setPrototypeOf(i,t.prototype),i}return t}(Error);e.VError=i,e.NoopContext=function(){function e(){}return e.prototype.fail=function(e,t,n){return!1},e.prototype.unionResolver=function(){return this},e.prototype.createContext=function(){return this},e.prototype.resolveUnion=function(e){},e}();var a=function(){function e(){this._propNames=[``],this._messages=[null],this._score=0}return e.prototype.fail=function(e,t,n){return this._propNames.push(e),this._messages.push(t),this._score+=n,!1},e.prototype.unionResolver=function(){return new o},e.prototype.resolveUnion=function(e){for(var t,n,r=e,i=null,a=0,o=r.contexts;a<o.length;a++){var s=o[a];(!i||s._score>=i._score)&&(i=s)}i&&i._score>0&&((t=this._propNames).push.apply(t,i._propNames),(n=this._messages).push.apply(n,i._messages))},e.prototype.getError=function(e){for(var t=[],n=this._propNames.length-1;n>=0;n--){var r=this._propNames[n];e+=typeof r==`number`?`[`+r+`]`:r?`.`+r:``;var a=this._messages[n];a&&t.push(e+` `+a)}return new i(e,t.join(`; `))},e.prototype.getErrorDetail=function(e){for(var t=[],n=this._propNames.length-1;n>=0;n--){var r=this._propNames[n];e+=typeof r==`number`?`[`+r+`]`:r?`.`+r:``;var i=this._messages[n];i&&t.push({path:e,message:i})}for(var a=null,n=t.length-1;n>=0;n--)a&&(t[n].nested=[a]),a=t[n];return a},e}();e.DetailContext=a;var o=function(){function e(){this.contexts=[]}return e.prototype.createContext=function(){var e=new a;return this.contexts.push(e),e},e}()})),Kb=/* @__PURE__ */ o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.basicTypes=e.BasicType=e.TParamList=e.TParam=e.param=e.TFunc=e.func=e.TProp=e.TOptional=e.opt=e.TIface=e.iface=e.TEnumLiteral=e.enumlit=e.TEnumType=e.enumtype=e.TIntersection=e.intersection=e.TUnion=e.union=e.TTuple=e.tuple=e.TArray=e.array=e.TLiteral=e.lit=e.TName=e.name=e.TType=void 0;var i=Gb(),a=function(){function e(){}return e}();e.TType=a;function o(e){return typeof e==`string`?c(e):e}function s(e,t){var n=e[t];if(!n)throw Error(`Unknown type `+t);return n}function c(e){return new l(e)}e.name=c;var l=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.name=t,n._failMsg=`is not a `+t,n}return t.prototype.getChecker=function(e,n,r){var i=this,a=s(e,this.name),o=a.getChecker(e,n,r);return a instanceof A||a instanceof t?o:function(e,t){return o(e,t)?!0:t.fail(null,i._failMsg,0)}},t}(a);e.TName=l;function u(e){return new d(e)}e.lit=u;var d=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.value=t,n.name=JSON.stringify(t),n._failMsg=`is not `+n.name,n}return t.prototype.getChecker=function(e,t){var n=this;return function(e,t){return e===n.value||t.fail(null,n._failMsg,-1)}},t}(a);e.TLiteral=d;function f(e){return new p(o(e))}e.array=f;var p=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttype=t,n}return t.prototype.getChecker=function(e,t){var n=this.ttype.getChecker(e,t);return function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var r=0;r<e.length;r++)if(!n(e[r],t))return t.fail(r,null,1);return!0}},t}(a);e.TArray=p;function m(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new h(e.map(function(e){return o(e)}))}e.tuple=m;var h=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttypes=t,n}return t.prototype.getChecker=function(e,t){var n=this.ttypes.map(function(n){return n.getChecker(e,t)}),r=function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var r=0;r<n.length;r++)if(!n[r](e[r],t))return t.fail(r,null,1);return!0};return t?function(e,t){return r(e,t)?e.length<=n.length||t.fail(n.length,`is extraneous`,2):!1}:r},t}(a);e.TTuple=h;function g(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new _(e.map(function(e){return o(e)}))}e.union=g;var _=function(e){r(t,e);function t(t){var n=e.call(this)||this;n.ttypes=t;var r=t.map(function(e){return e instanceof l||e instanceof d?e.name:null}).filter(function(e){return e}),i=t.length-r.length;return r.length?(i>0&&r.push(i+` more`),n._failMsg=`is none of `+r.join(`, `)):n._failMsg=`is none of `+i+` types`,n}return t.prototype.getChecker=function(e,t){var n=this,r=this.ttypes.map(function(n){return n.getChecker(e,t)});return function(e,t){for(var i=t.unionResolver(),a=0;a<r.length;a++)if(r[a](e,i.createContext()))return!0;return t.resolveUnion(i),t.fail(null,n._failMsg,0)}},t}(a);e.TUnion=_;function v(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return new y(e.map(function(e){return o(e)}))}e.intersection=v;var y=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttypes=t,n}return t.prototype.getChecker=function(e,t){var n=/* @__PURE__ */ new Set,r=this.ttypes.map(function(r){return r.getChecker(e,t,n)});return function(e,t){return r.every(function(n){return n(e,t)})?!0:t.fail(null,null,0)}},t}(a);e.TIntersection=y;function b(e){return new x(e)}e.enumtype=b;var x=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.members=t,n.validValues=/* @__PURE__ */ new Set,n._failMsg=`is not a valid enum value`,n.validValues=new Set(Object.keys(t).map(function(e){return t[e]})),n}return t.prototype.getChecker=function(e,t){var n=this;return function(e,t){return n.validValues.has(e)?!0:t.fail(null,n._failMsg,0)}},t}(a);e.TEnumType=x;function S(e,t){return new C(e,t)}e.enumlit=S;var C=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.enumName=t,r.prop=n,r._failMsg=`is not `+t+`.`+n,r}return t.prototype.getChecker=function(e,t){var n=this,r=s(e,this.enumName);if(!(r instanceof x))throw Error(`Type `+this.enumName+` used in enumlit is not an enum type`);var i=r.members[this.prop];if(!r.members.hasOwnProperty(this.prop))throw Error(`Unknown value `+this.enumName+`.`+this.prop+` used in enumlit`);return function(e,t){return e===i||t.fail(null,n._failMsg,-1)}},t}(a);e.TEnumLiteral=C;function w(e){return Object.keys(e).map(function(t){return T(t,e[t])})}function T(e,t){return t instanceof ne?new re(e,t.ttype,!0):new re(e,o(t),!1)}function E(e,t){return new ee(e,w(t))}e.iface=E;var ee=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.bases=t,r.props=n,r.propSet=new Set(n.map(function(e){return e.name})),r}return t.prototype.getChecker=function(e,t,n){var r=this,a=this.bases.map(function(n){return s(e,n).getChecker(e,t)}),o=this.props.map(function(n){return n.ttype.getChecker(e,t)}),c=new i.NoopContext,l=this.props.map(function(e,t){return!e.isOpt&&!o[t](void 0,c)}),u=function(e,t){if(typeof e!=`object`||!e)return t.fail(null,`is not an object`,0);for(var n=0;n<a.length;n++)if(!a[n](e,t))return!1;for(var n=0;n<o.length;n++){var i=r.props[n].name,s=e[i];if(s===void 0){if(l[n])return t.fail(i,`is missing`,1)}else if(!o[n](s,t))return t.fail(i,null,1)}return!0};if(!t)return u;var d=this.propSet;return n&&(this.propSet.forEach(function(e){return n.add(e)}),d=n),function(e,t){if(!u(e,t))return!1;for(var n in e)if(!d.has(n))return t.fail(n,`is extraneous`,2);return!0}},t}(a);e.TIface=ee;function te(e){return new ne(o(e))}e.opt=te;var ne=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.ttype=t,n}return t.prototype.getChecker=function(e,t){var n=this.ttype.getChecker(e,t);return function(e,t){return e===void 0||n(e,t)}},t}(a);e.TOptional=ne;var re=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TProp=re;function D(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new ie(new k(t),o(e))}e.func=D;var ie=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.paramList=t,r.result=n,r}return t.prototype.getChecker=function(e,t){return function(e,t){return typeof e==`function`||t.fail(null,`is not a function`,0)}},t}(a);e.TFunc=ie;function ae(e,t,n){return new O(e,o(t),!!n)}e.param=ae;var O=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TParam=O;var k=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.params=t,n}return t.prototype.getChecker=function(e,t){var n=this,r=this.params.map(function(n){return n.ttype.getChecker(e,t)}),a=new i.NoopContext,o=this.params.map(function(e,t){return!e.isOpt&&!r[t](void 0,a)}),s=function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var i=0;i<r.length;i++){var a=n.params[i];if(e[i]===void 0){if(o[i])return t.fail(a.name,`is missing`,1)}else if(!r[i](e[i],t))return t.fail(a.name,null,1)}return!0};return t?function(e,t){return s(e,t)?e.length<=r.length||t.fail(r.length,`is extraneous`,2):!1}:s},t}(a);e.TParamList=k;var A=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.validator=t,r.message=n,r}return t.prototype.getChecker=function(e,t){var n=this;return function(e,t){return n.validator(e)?!0:t.fail(null,n.message,0)}},t}(a);e.BasicType=A,e.basicTypes={any:new A(function(e){return!0},`is invalid`),number:new A(function(e){return typeof e==`number`},`is not a number`),object:new A(function(e){return typeof e==`object`&&e},`is not an object`),boolean:new A(function(e){return typeof e==`boolean`},`is not a boolean`),string:new A(function(e){return typeof e==`string`},`is not a string`),symbol:new A(function(e){return typeof e==`symbol`},`is not a symbol`),void:new A(function(e){return e==null},`is not void`),undefined:new A(function(e){return e===void 0},`is not undefined`),null:new A(function(e){return e===null},`is not null`),never:new A(function(e){return!1},`is unexpected`),Date:new A(j(`[object Date]`),`is not a Date`),RegExp:new A(j(`[object RegExp]`),`is not a RegExp`)};var oe=Object.prototype.toString;function j(e){return function(t){return typeof t==`object`&&t&&oe.call(t)===e}}typeof Buffer<`u`&&(e.basicTypes.Buffer=new A(function(e){return Buffer.isBuffer(e)},`is not a Buffer`));for(var M=function(t){e.basicTypes[t.name]=new A(function(e){return e instanceof t},`is not a `+t.name)},se=0,ce=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];se<ce.length;se++){var le=ce[se];M(le)}})),qb=/* @__PURE__ */ o(((e,t,n)=>{var r=n&&n.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r};Object.defineProperty(e,"__esModule",{value:!0}),e.Checker=e.createCheckers=void 0;var i=Kb(),a=Gb(),o=Kb();Object.defineProperty(e,"TArray",{enumerable:!0,get:function(){return o.TArray}}),Object.defineProperty(e,"TEnumType",{enumerable:!0,get:function(){return o.TEnumType}}),Object.defineProperty(e,"TEnumLiteral",{enumerable:!0,get:function(){return o.TEnumLiteral}}),Object.defineProperty(e,"TFunc",{enumerable:!0,get:function(){return o.TFunc}}),Object.defineProperty(e,"TIface",{enumerable:!0,get:function(){return o.TIface}}),Object.defineProperty(e,"TLiteral",{enumerable:!0,get:function(){return o.TLiteral}}),Object.defineProperty(e,"TName",{enumerable:!0,get:function(){return o.TName}}),Object.defineProperty(e,"TOptional",{enumerable:!0,get:function(){return o.TOptional}}),Object.defineProperty(e,"TParam",{enumerable:!0,get:function(){return o.TParam}}),Object.defineProperty(e,"TParamList",{enumerable:!0,get:function(){return o.TParamList}}),Object.defineProperty(e,"TProp",{enumerable:!0,get:function(){return o.TProp}}),Object.defineProperty(e,"TTuple",{enumerable:!0,get:function(){return o.TTuple}}),Object.defineProperty(e,"TType",{enumerable:!0,get:function(){return o.TType}}),Object.defineProperty(e,"TUnion",{enumerable:!0,get:function(){return o.TUnion}}),Object.defineProperty(e,"TIntersection",{enumerable:!0,get:function(){return o.TIntersection}}),Object.defineProperty(e,"array",{enumerable:!0,get:function(){return o.array}}),Object.defineProperty(e,"enumlit",{enumerable:!0,get:function(){return o.enumlit}}),Object.defineProperty(e,"enumtype",{enumerable:!0,get:function(){return o.enumtype}}),Object.defineProperty(e,"func",{enumerable:!0,get:function(){return o.func}}),Object.defineProperty(e,"iface",{enumerable:!0,get:function(){return o.iface}}),Object.defineProperty(e,"lit",{enumerable:!0,get:function(){return o.lit}}),Object.defineProperty(e,"name",{enumerable:!0,get:function(){return o.name}}),Object.defineProperty(e,"opt",{enumerable:!0,get:function(){return o.opt}}),Object.defineProperty(e,"param",{enumerable:!0,get:function(){return o.param}}),Object.defineProperty(e,"tuple",{enumerable:!0,get:function(){return o.tuple}}),Object.defineProperty(e,"union",{enumerable:!0,get:function(){return o.union}}),Object.defineProperty(e,"intersection",{enumerable:!0,get:function(){return o.intersection}}),Object.defineProperty(e,"BasicType",{enumerable:!0,get:function(){return o.BasicType}});var s=Gb();Object.defineProperty(e,"VError",{enumerable:!0,get:function(){return s.VError}});function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=Object.assign.apply(Object,r([{},i.basicTypes],e)),a={},o=0,s=e;o<s.length;o++)for(var c=s[o],u=0,d=Object.keys(c);u<d.length;u++){var f=d[u];a[f]=new l(n,c[f])}return a}e.createCheckers=c;var l=function(){function e(e,t,n){if(n===void 0&&(n=`value`),this.suite=e,this.ttype=t,this._path=n,this.props=/* @__PURE__ */ new Map,t instanceof i.TIface)for(var r=0,a=t.props;r<a.length;r++){var o=a[r];this.props.set(o.name,o.ttype)}this.checkerPlain=this.ttype.getChecker(e,!1),this.checkerStrict=this.ttype.getChecker(e,!0)}return e.prototype.setReportedPath=function(e){this._path=e},e.prototype.check=function(e){return this._doCheck(this.checkerPlain,e)},e.prototype.test=function(e){return this.checkerPlain(e,new a.NoopContext)},e.prototype.validate=function(e){return this._doValidate(this.checkerPlain,e)},e.prototype.strictCheck=function(e){return this._doCheck(this.checkerStrict,e)},e.prototype.strictTest=function(e){return this.checkerStrict(e,new a.NoopContext)},e.prototype.strictValidate=function(e){return this._doValidate(this.checkerStrict,e)},e.prototype.getProp=function(t){var n=this.props.get(t);if(!n)throw Error(`Type has no property `+t);return new e(this.suite,n,this._path+`.`+t)},e.prototype.methodArgs=function(t){var n=this._getMethod(t);return new e(this.suite,n.paramList)},e.prototype.methodResult=function(t){var n=this._getMethod(t);return new e(this.suite,n.result)},e.prototype.getArgs=function(){if(!(this.ttype instanceof i.TFunc))throw Error(`getArgs() applied to non-function`);return new e(this.suite,this.ttype.paramList)},e.prototype.getResult=function(){if(!(this.ttype instanceof i.TFunc))throw Error(`getResult() applied to non-function`);return new e(this.suite,this.ttype.result)},e.prototype.getType=function(){return this.ttype},e.prototype._doCheck=function(e,t){if(!e(t,new a.NoopContext)){var n=new a.DetailContext;throw e(t,n),n.getError(this._path)}},e.prototype._doValidate=function(e,t){if(e(t,new a.NoopContext))return null;var n=new a.DetailContext;return e(t,n),n.getErrorDetail(this._path)},e.prototype._getMethod=function(e){var t=this.props.get(e);if(!t)throw Error(`Type has no property `+e);if(!(t instanceof i.TFunc))throw Error(`Property `+e+` is not a method`);return t},e}();e.Checker=l})),Jb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var n=t(qb());e.Transform=n.union(n.lit(`jsx`),n.lit(`typescript`),n.lit(`flow`),n.lit(`imports`),n.lit(`react-hot-loader`),n.lit(`jest`)),e.SourceMapOptions=n.iface([],{compiledFilename:`string`}),e.Options=n.iface([],{transforms:n.array(`Transform`),disableESTransforms:n.opt(`boolean`),jsxRuntime:n.opt(n.union(n.lit(`classic`),n.lit(`automatic`),n.lit(`preserve`))),production:n.opt(`boolean`),jsxImportSource:n.opt(`string`),jsxPragma:n.opt(`string`),jsxFragmentPragma:n.opt(`string`),keepUnusedImports:n.opt(`boolean`),preserveDynamicImport:n.opt(`boolean`),injectCreateRequireForImportRequire:n.opt(`boolean`),enableLegacyTypeScriptModuleInterop:n.opt(`boolean`),enableLegacyBabel5ModuleInterop:n.opt(`boolean`),sourceMapOptions:n.opt(`SourceMapOptions`),filePath:n.opt(`string`)}),e.default={Transform:e.Transform,SourceMapOptions:e.SourceMapOptions,Options:e.Options}})),Yb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=qb(),r=t(Jb());let{Options:i}=n.createCheckers.call(void 0,r.default);function a(e){i.strictCheck(e)}e.validateOptions=a})),Xb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=tx(),n=Zb(),r=Ob(),i=yb(),a=q(),o=Sb(),s=ex(),c=Cb();function l(){r.next.call(void 0),s.parseMaybeAssign.call(void 0,!1)}e.parseSpread=l;function u(e){r.next.call(void 0),m(e)}e.parseRest=u;function d(e){s.parseIdentifier.call(void 0),p(e)}e.parseBindingIdentifier=d;function f(){s.parseIdentifier.call(void 0),o.state.tokens[o.state.tokens.length-1].identifierRole=r.IdentifierRole.ImportDeclaration}e.parseImportedIdentifier=f;function p(e){let t;t=o.state.scopeDepth===0?r.IdentifierRole.TopLevelDeclaration:e?r.IdentifierRole.BlockScopedDeclaration:r.IdentifierRole.FunctionScopedDeclaration,o.state.tokens[o.state.tokens.length-1].identifierRole=t}e.markPriorBindingIdentifier=p;function m(e){switch(o.state.type){case a.TokenType._this:{let e=r.pushTypeContext.call(void 0,0);r.next.call(void 0),r.popTypeContext.call(void 0,e);return}case a.TokenType._yield:case a.TokenType.name:o.state.type=a.TokenType.name,d(e);return;case a.TokenType.bracketL:r.next.call(void 0),h(a.TokenType.bracketR,e,!0);return;case a.TokenType.braceL:s.parseObj.call(void 0,!0,e);return;default:c.unexpected.call(void 0)}}e.parseBindingAtom=m;function h(e,t,n=!1,i=!1,s=0){let l=!0,d=!1,f=o.state.tokens.length;for(;!r.eat.call(void 0,e)&&!o.state.error;)if(l?l=!1:(c.expect.call(void 0,a.TokenType.comma),o.state.tokens[o.state.tokens.length-1].contextId=s,!d&&o.state.tokens[f].isType&&(o.state.tokens[o.state.tokens.length-1].isType=!0,d=!0)),!(n&&r.match.call(void 0,a.TokenType.comma))){if(r.eat.call(void 0,e))break;if(r.match.call(void 0,a.TokenType.ellipsis)){u(t),_(),r.eat.call(void 0,a.TokenType.comma),c.expect.call(void 0,e);break}g(i,t)}}e.parseBindingList=h;function g(e,t){e&&n.tsParseModifiers.call(void 0,[i.ContextualKeyword._public,i.ContextualKeyword._protected,i.ContextualKeyword._private,i.ContextualKeyword._readonly,i.ContextualKeyword._override]),v(t),_(),v(t,!0)}function _(){o.isFlowEnabled?t.flowParseAssignableListItemTypes.call(void 0):o.isTypeScriptEnabled&&n.tsParseAssignableListItemTypes.call(void 0)}function v(e,t=!1){if(t||m(e),!r.eat.call(void 0,a.TokenType.eq))return;let n=o.state.tokens.length-1;s.parseMaybeAssign.call(void 0),o.state.tokens[n].rhsEndIndex=o.state.tokens.length}e.parseMaybeDefault=v})),Zb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ob(),n=yb(),r=q(),i=Sb(),a=ex(),o=Xb(),s=nx(),c=Cb(),l=Qb();function u(){return t.match.call(void 0,r.TokenType.name)}function d(){return t.match.call(void 0,r.TokenType.name)||!!(i.state.type&r.TokenType.IS_KEYWORD)||t.match.call(void 0,r.TokenType.string)||t.match.call(void 0,r.TokenType.num)||t.match.call(void 0,r.TokenType.bigint)||t.match.call(void 0,r.TokenType.decimal)}function f(){let e=i.state.snapshot();return t.next.call(void 0),(t.match.call(void 0,r.TokenType.bracketL)||t.match.call(void 0,r.TokenType.braceL)||t.match.call(void 0,r.TokenType.star)||t.match.call(void 0,r.TokenType.ellipsis)||t.match.call(void 0,r.TokenType.hash)||d())&&!c.hasPrecedingLineBreak.call(void 0)?!0:(i.state.restoreFromSnapshot(e),!1)}function p(e){for(;m(e)!==null;);}e.tsParseModifiers=p;function m(e){if(!t.match.call(void 0,r.TokenType.name))return null;let a=i.state.contextualKeyword;if(e.indexOf(a)!==-1&&f()){switch(a){case n.ContextualKeyword._readonly:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._readonly;break;case n.ContextualKeyword._abstract:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._abstract;break;case n.ContextualKeyword._static:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._static;break;case n.ContextualKeyword._public:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._public;break;case n.ContextualKeyword._private:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._private;break;case n.ContextualKeyword._protected:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._protected;break;case n.ContextualKeyword._override:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._override;break;case n.ContextualKeyword._declare:i.state.tokens[i.state.tokens.length-1].type=r.TokenType._declare}return a}return null}e.tsParseModifier=m;function h(){for(a.parseIdentifier.call(void 0);t.eat.call(void 0,r.TokenType.dot);)a.parseIdentifier.call(void 0)}function g(){h(),!c.hasPrecedingLineBreak.call(void 0)&&t.match.call(void 0,r.TokenType.lessThan)&&Je()}function _(){t.next.call(void 0),Ce()}function v(){t.next.call(void 0)}function y(){c.expect.call(void 0,r.TokenType._typeof),t.match.call(void 0,r.TokenType._import)?b():h(),!c.hasPrecedingLineBreak.call(void 0)&&t.match.call(void 0,r.TokenType.lessThan)&&Je()}function b(){c.expect.call(void 0,r.TokenType._import),c.expect.call(void 0,r.TokenType.parenL),c.expect.call(void 0,r.TokenType.string),c.expect.call(void 0,r.TokenType.parenR),t.eat.call(void 0,r.TokenType.dot)&&h(),t.match.call(void 0,r.TokenType.lessThan)&&Je()}function x(){t.eat.call(void 0,r.TokenType._const);let e=t.eat.call(void 0,r.TokenType._in),o=c.eatContextual.call(void 0,n.ContextualKeyword._out);t.eat.call(void 0,r.TokenType._const),(e||o)&&!t.match.call(void 0,r.TokenType.name)?i.state.tokens[i.state.tokens.length-1].type=r.TokenType.name:a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType._extends)&&I(),t.eat.call(void 0,r.TokenType.eq)&&I()}function S(){t.match.call(void 0,r.TokenType.lessThan)&&C()}e.tsTryParseTypeParameters=S;function C(){let e=t.pushTypeContext.call(void 0,0);for(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.typeParameterStart)?t.next.call(void 0):c.unexpected.call(void 0);!t.eat.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)x(),t.eat.call(void 0,r.TokenType.comma);t.popTypeContext.call(void 0,e)}function w(e){let n=e===r.TokenType.arrow;S(),c.expect.call(void 0,r.TokenType.parenL),i.state.scopeDepth++,T(!1),i.state.scopeDepth--,(n||t.match.call(void 0,e))&&ve(e)}function T(e){o.parseBindingList.call(void 0,r.TokenType.parenR,e)}function E(){t.eat.call(void 0,r.TokenType.comma)||c.semicolon.call(void 0)}function ee(){w(r.TokenType.colon),E()}function te(){let e=i.state.snapshot();t.next.call(void 0);let n=t.eat.call(void 0,r.TokenType.name)&&t.match.call(void 0,r.TokenType.colon);return i.state.restoreFromSnapshot(e),n}function ne(){if(!(t.match.call(void 0,r.TokenType.bracketL)&&te()))return!1;let e=t.pushTypeContext.call(void 0,0);return c.expect.call(void 0,r.TokenType.bracketL),a.parseIdentifier.call(void 0),Ce(),c.expect.call(void 0,r.TokenType.bracketR),be(),E(),t.popTypeContext.call(void 0,e),!0}function re(e){t.eat.call(void 0,r.TokenType.question),!e&&(t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan))?(w(r.TokenType.colon),E()):(be(),E())}function D(){if(t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan)){ee();return}if(t.match.call(void 0,r.TokenType._new)){t.next.call(void 0),t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan)?ee():re(!1);return}let e=!!m([n.ContextualKeyword._readonly]);ne()||((c.isContextual.call(void 0,n.ContextualKeyword._get)||c.isContextual.call(void 0,n.ContextualKeyword._set))&&f(),a.parsePropertyName.call(void 0,-1),re(e))}function ie(){ae()}function ae(){for(c.expect.call(void 0,r.TokenType.braceL);!t.eat.call(void 0,r.TokenType.braceR)&&!i.state.error;)D()}function O(){let e=i.state.snapshot(),t=k();return i.state.restoreFromSnapshot(e),t}function k(){return t.next.call(void 0),t.eat.call(void 0,r.TokenType.plus)||t.eat.call(void 0,r.TokenType.minus)?c.isContextual.call(void 0,n.ContextualKeyword._readonly):(c.isContextual.call(void 0,n.ContextualKeyword._readonly)&&t.next.call(void 0),!t.match.call(void 0,r.TokenType.bracketL)||(t.next.call(void 0),!u())?!1:(t.next.call(void 0),t.match.call(void 0,r.TokenType._in)))}function A(){a.parseIdentifier.call(void 0),c.expect.call(void 0,r.TokenType._in),I()}function oe(){c.expect.call(void 0,r.TokenType.braceL),t.match.call(void 0,r.TokenType.plus)||t.match.call(void 0,r.TokenType.minus)?(t.next.call(void 0),c.expectContextual.call(void 0,n.ContextualKeyword._readonly)):c.eatContextual.call(void 0,n.ContextualKeyword._readonly),c.expect.call(void 0,r.TokenType.bracketL),A(),c.eatContextual.call(void 0,n.ContextualKeyword._as)&&I(),c.expect.call(void 0,r.TokenType.bracketR),t.match.call(void 0,r.TokenType.plus)||t.match.call(void 0,r.TokenType.minus)?(t.next.call(void 0),c.expect.call(void 0,r.TokenType.question)):t.eat.call(void 0,r.TokenType.question),xe(),c.semicolon.call(void 0),c.expect.call(void 0,r.TokenType.braceR)}function j(){for(c.expect.call(void 0,r.TokenType.bracketL);!t.eat.call(void 0,r.TokenType.bracketR)&&!i.state.error;)M(),t.eat.call(void 0,r.TokenType.comma)}function M(){t.eat.call(void 0,r.TokenType.ellipsis)?I():(I(),t.eat.call(void 0,r.TokenType.question)),t.eat.call(void 0,r.TokenType.colon)&&I()}function se(){c.expect.call(void 0,r.TokenType.parenL),I(),c.expect.call(void 0,r.TokenType.parenR)}function ce(){for(t.nextTemplateToken.call(void 0),t.nextTemplateToken.call(void 0);!t.match.call(void 0,r.TokenType.backQuote)&&!i.state.error;)c.expect.call(void 0,r.TokenType.dollarBraceL),I(),t.nextTemplateToken.call(void 0),t.nextTemplateToken.call(void 0);t.next.call(void 0)}var le;(function(e){e[e.TSFunctionType=0]=`TSFunctionType`,e[e.TSConstructorType=1]=`TSConstructorType`,e[e.TSAbstractConstructorType=2]=`TSAbstractConstructorType`})(le||={});function ue(e){e===le.TSAbstractConstructorType&&c.expectContextual.call(void 0,n.ContextualKeyword._abstract),(e===le.TSConstructorType||e===le.TSAbstractConstructorType)&&c.expect.call(void 0,r.TokenType._new);let t=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!1,w(r.TokenType.arrow),i.state.inDisallowConditionalTypesContext=t}function de(){switch(i.state.type){case r.TokenType.name:g();return;case r.TokenType._void:case r.TokenType._null:t.next.call(void 0);return;case r.TokenType.string:case r.TokenType.num:case r.TokenType.bigint:case r.TokenType.decimal:case r.TokenType._true:case r.TokenType._false:a.parseLiteral.call(void 0);return;case r.TokenType.minus:t.next.call(void 0),a.parseLiteral.call(void 0);return;case r.TokenType._this:v(),c.isContextual.call(void 0,n.ContextualKeyword._is)&&!c.hasPrecedingLineBreak.call(void 0)&&_();return;case r.TokenType._typeof:y();return;case r.TokenType._import:b();return;case r.TokenType.braceL:O()?oe():ie();return;case r.TokenType.bracketL:j();return;case r.TokenType.parenL:se();return;case r.TokenType.backQuote:ce();return;default:if(i.state.type&r.TokenType.IS_KEYWORD){t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].type=r.TokenType.name;return}}c.unexpected.call(void 0)}function fe(){for(de();!c.hasPrecedingLineBreak.call(void 0)&&t.eat.call(void 0,r.TokenType.bracketL);)t.eat.call(void 0,r.TokenType.bracketR)||(I(),c.expect.call(void 0,r.TokenType.bracketR))}function pe(){if(c.expectContextual.call(void 0,n.ContextualKeyword._infer),a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType._extends)){let e=i.state.snapshot();c.expect.call(void 0,r.TokenType._extends);let n=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!0,I(),i.state.inDisallowConditionalTypesContext=n,(i.state.error||!i.state.inDisallowConditionalTypesContext&&t.match.call(void 0,r.TokenType.question))&&i.state.restoreFromSnapshot(e)}}function me(){if(c.isContextual.call(void 0,n.ContextualKeyword._keyof)||c.isContextual.call(void 0,n.ContextualKeyword._unique)||c.isContextual.call(void 0,n.ContextualKeyword._readonly))t.next.call(void 0),me();else if(c.isContextual.call(void 0,n.ContextualKeyword._infer))pe();else{let e=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!1,fe(),i.state.inDisallowConditionalTypesContext=e}}function he(){if(t.eat.call(void 0,r.TokenType.bitwiseAND),me(),t.match.call(void 0,r.TokenType.bitwiseAND))for(;t.eat.call(void 0,r.TokenType.bitwiseAND);)me()}function ge(){if(t.eat.call(void 0,r.TokenType.bitwiseOR),he(),t.match.call(void 0,r.TokenType.bitwiseOR))for(;t.eat.call(void 0,r.TokenType.bitwiseOR);)he()}function _e(){return t.match.call(void 0,r.TokenType.lessThan)?!0:t.match.call(void 0,r.TokenType.parenL)&&P()}function N(){if(t.match.call(void 0,r.TokenType.name)||t.match.call(void 0,r.TokenType._this))return t.next.call(void 0),!0;if(t.match.call(void 0,r.TokenType.braceL)||t.match.call(void 0,r.TokenType.bracketL)){let e=1;for(t.next.call(void 0);e>0&&!i.state.error;)t.match.call(void 0,r.TokenType.braceL)||t.match.call(void 0,r.TokenType.bracketL)?e++:(t.match.call(void 0,r.TokenType.braceR)||t.match.call(void 0,r.TokenType.bracketR))&&e--,t.next.call(void 0);return!0}return!1}function P(){let e=i.state.snapshot(),t=F();return i.state.restoreFromSnapshot(e),t}function F(){return t.next.call(void 0),!!(t.match.call(void 0,r.TokenType.parenR)||t.match.call(void 0,r.TokenType.ellipsis)||N()&&(t.match.call(void 0,r.TokenType.colon)||t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.question)||t.match.call(void 0,r.TokenType.eq)||t.match.call(void 0,r.TokenType.parenR)&&(t.next.call(void 0),t.match.call(void 0,r.TokenType.arrow))))}function ve(e){let n=t.pushTypeContext.call(void 0,0);c.expect.call(void 0,e),Se()||I(),t.popTypeContext.call(void 0,n)}function ye(){t.match.call(void 0,r.TokenType.colon)&&ve(r.TokenType.colon)}function be(){t.match.call(void 0,r.TokenType.colon)&&Ce()}e.tsTryParseTypeAnnotation=be;function xe(){t.eat.call(void 0,r.TokenType.colon)&&I()}function Se(){let e=i.state.snapshot();return c.isContextual.call(void 0,n.ContextualKeyword._asserts)?(t.next.call(void 0),c.eatContextual.call(void 0,n.ContextualKeyword._is)?(I(),!0):u()||t.match.call(void 0,r.TokenType._this)?(t.next.call(void 0),c.eatContextual.call(void 0,n.ContextualKeyword._is)&&I(),!0):(i.state.restoreFromSnapshot(e),!1)):u()||t.match.call(void 0,r.TokenType._this)?(t.next.call(void 0),c.isContextual.call(void 0,n.ContextualKeyword._is)&&!c.hasPrecedingLineBreak.call(void 0)?(t.next.call(void 0),I(),!0):(i.state.restoreFromSnapshot(e),!1)):!1}function Ce(){let e=t.pushTypeContext.call(void 0,0);c.expect.call(void 0,r.TokenType.colon),I(),t.popTypeContext.call(void 0,e)}e.tsParseTypeAnnotation=Ce;function I(){if(Te(),i.state.inDisallowConditionalTypesContext||c.hasPrecedingLineBreak.call(void 0)||!t.eat.call(void 0,r.TokenType._extends))return;let e=i.state.inDisallowConditionalTypesContext;i.state.inDisallowConditionalTypesContext=!0,Te(),i.state.inDisallowConditionalTypesContext=e,c.expect.call(void 0,r.TokenType.question),I(),c.expect.call(void 0,r.TokenType.colon),I()}e.tsParseType=I;function we(){return c.isContextual.call(void 0,n.ContextualKeyword._abstract)&&t.lookaheadType.call(void 0)===r.TokenType._new}function Te(){_e()?ue(le.TSFunctionType):t.match.call(void 0,r.TokenType._new)?ue(le.TSConstructorType):we()?ue(le.TSAbstractConstructorType):ge()}e.tsParseNonConditionalType=Te;function Ee(){let e=t.pushTypeContext.call(void 0,1);I(),c.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e),a.parseMaybeUnary.call(void 0)}e.tsParseTypeAssertion=Ee;function De(){if(t.eat.call(void 0,r.TokenType.jsxTagStart)){i.state.tokens[i.state.tokens.length-1].type=r.TokenType.typeParameterStart;let e=t.pushTypeContext.call(void 0,1);for(;!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)I(),t.eat.call(void 0,r.TokenType.comma);l.nextJSXTagToken.call(void 0),t.popTypeContext.call(void 0,e)}}e.tsTryParseJSXTypeArgument=De;function Oe(){for(;!t.match.call(void 0,r.TokenType.braceL)&&!i.state.error;)ke(),t.eat.call(void 0,r.TokenType.comma)}function ke(){h(),t.match.call(void 0,r.TokenType.lessThan)&&Je()}function Ae(){o.parseBindingIdentifier.call(void 0,!1),S(),t.eat.call(void 0,r.TokenType._extends)&&Oe(),ae()}function je(){o.parseBindingIdentifier.call(void 0,!1),S(),c.expect.call(void 0,r.TokenType.eq),I(),c.semicolon.call(void 0)}function Me(){if(t.match.call(void 0,r.TokenType.string)?a.parseLiteral.call(void 0):a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType.eq)){let e=i.state.tokens.length-1;a.parseMaybeAssign.call(void 0),i.state.tokens[e].rhsEndIndex=i.state.tokens.length}}function Ne(){for(o.parseBindingIdentifier.call(void 0,!1),c.expect.call(void 0,r.TokenType.braceL);!t.eat.call(void 0,r.TokenType.braceR)&&!i.state.error;)Me(),t.eat.call(void 0,r.TokenType.comma)}function Pe(){c.expect.call(void 0,r.TokenType.braceL),s.parseBlockBody.call(void 0,r.TokenType.braceR)}function Fe(){o.parseBindingIdentifier.call(void 0,!1),t.eat.call(void 0,r.TokenType.dot)?Fe():Pe()}function Ie(){c.isContextual.call(void 0,n.ContextualKeyword._global)?a.parseIdentifier.call(void 0):t.match.call(void 0,r.TokenType.string)?a.parseExprAtom.call(void 0):c.unexpected.call(void 0),t.match.call(void 0,r.TokenType.braceL)?Pe():c.semicolon.call(void 0)}function Le(){o.parseImportedIdentifier.call(void 0),c.expect.call(void 0,r.TokenType.eq),ze(),c.semicolon.call(void 0)}e.tsParseImportEqualsDeclaration=Le;function Re(){return c.isContextual.call(void 0,n.ContextualKeyword._require)&&t.lookaheadType.call(void 0)===r.TokenType.parenL}function ze(){Re()?Be():h()}function Be(){c.expectContextual.call(void 0,n.ContextualKeyword._require),c.expect.call(void 0,r.TokenType.parenL),t.match.call(void 0,r.TokenType.string)||c.unexpected.call(void 0),a.parseLiteral.call(void 0),c.expect.call(void 0,r.TokenType.parenR)}function Ve(){if(c.isLineTerminator.call(void 0))return!1;switch(i.state.type){case r.TokenType._function:{let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0);let n=i.state.start;return s.parseFunction.call(void 0,n,!0),t.popTypeContext.call(void 0,e),!0}case r.TokenType._class:{let e=t.pushTypeContext.call(void 0,1);return s.parseClass.call(void 0,!0,!1),t.popTypeContext.call(void 0,e),!0}case r.TokenType._const:if(t.match.call(void 0,r.TokenType._const)&&c.isLookaheadContextual.call(void 0,n.ContextualKeyword._enum)){let e=t.pushTypeContext.call(void 0,1);return c.expect.call(void 0,r.TokenType._const),c.expectContextual.call(void 0,n.ContextualKeyword._enum),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,Ne(),t.popTypeContext.call(void 0,e),!0}case r.TokenType._var:case r.TokenType._let:{let e=t.pushTypeContext.call(void 0,1);return s.parseVarStatement.call(void 0,i.state.type!==r.TokenType._var),t.popTypeContext.call(void 0,e),!0}case r.TokenType.name:{let e=t.pushTypeContext.call(void 0,1),r=i.state.contextualKeyword,a=!1;return r===n.ContextualKeyword._global?(Ie(),a=!0):a=We(r,!0),t.popTypeContext.call(void 0,e),a}default:return!1}}function He(){return We(i.state.contextualKeyword,!0)}function Ue(e){switch(e){case n.ContextualKeyword._declare:{let e=i.state.tokens.length-1;if(Ve())return i.state.tokens[e].type=r.TokenType._declare,!0;break}case n.ContextualKeyword._global:if(t.match.call(void 0,r.TokenType.braceL))return Pe(),!0;break;default:return We(e,!1)}return!1}function We(e,a){switch(e){case n.ContextualKeyword._abstract:if(Ge(a)&&t.match.call(void 0,r.TokenType._class))return i.state.tokens[i.state.tokens.length-1].type=r.TokenType._abstract,s.parseClass.call(void 0,!0,!1),!0;break;case n.ContextualKeyword._enum:if(Ge(a)&&t.match.call(void 0,r.TokenType.name))return i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,Ne(),!0;break;case n.ContextualKeyword._interface:if(Ge(a)&&t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return Ae(),t.popTypeContext.call(void 0,e),!0}break;case n.ContextualKeyword._module:if(Ge(a)){if(t.match.call(void 0,r.TokenType.string)){let e=t.pushTypeContext.call(void 0,a?2:1);return Ie(),t.popTypeContext.call(void 0,e),!0}if(t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return Fe(),t.popTypeContext.call(void 0,e),!0}}break;case n.ContextualKeyword._namespace:if(Ge(a)&&t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return Fe(),t.popTypeContext.call(void 0,e),!0}break;case n.ContextualKeyword._type:if(Ge(a)&&t.match.call(void 0,r.TokenType.name)){let e=t.pushTypeContext.call(void 0,a?2:1);return je(),t.popTypeContext.call(void 0,e),!0}}return!1}function Ge(e){return e?(t.next.call(void 0),!0):!c.isLineTerminator.call(void 0)}function Ke(){let e=i.state.snapshot();return C(),s.parseFunctionParams.call(void 0),ye(),c.expect.call(void 0,r.TokenType.arrow),i.state.error?(i.state.restoreFromSnapshot(e),!1):(a.parseFunctionBody.call(void 0,!0),!0)}function qe(){i.state.type===r.TokenType.bitShiftL&&(--i.state.pos,t.finishToken.call(void 0,r.TokenType.lessThan)),Je()}function Je(){let e=t.pushTypeContext.call(void 0,0);for(c.expect.call(void 0,r.TokenType.lessThan);!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)I(),t.eat.call(void 0,r.TokenType.comma);e?(c.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e)):(t.popTypeContext.call(void 0,e),t.rescan_gt.call(void 0),c.expect.call(void 0,r.TokenType.greaterThan),i.state.tokens[i.state.tokens.length-1].isType=!0)}function Ye(){if(t.match.call(void 0,r.TokenType.name))switch(i.state.contextualKeyword){case n.ContextualKeyword._abstract:case n.ContextualKeyword._declare:case n.ContextualKeyword._enum:case n.ContextualKeyword._interface:case n.ContextualKeyword._module:case n.ContextualKeyword._namespace:case n.ContextualKeyword._type:return!0}return!1}e.tsIsDeclarationStart=Ye;function Xe(e,n){if(t.match.call(void 0,r.TokenType.colon)&&ve(r.TokenType.colon),!t.match.call(void 0,r.TokenType.braceL)&&c.isLineTerminator.call(void 0)){let t=i.state.tokens.length-1;for(;t>=0&&(i.state.tokens[t].start>=e||i.state.tokens[t].type===r.TokenType._default||i.state.tokens[t].type===r.TokenType._export);)i.state.tokens[t].isType=!0,t--}else a.parseFunctionBody.call(void 0,!1,n)}e.tsParseFunctionBodyAndFinish=Xe;function Ze(e,n,o){if(!c.hasPrecedingLineBreak.call(void 0)&&t.eat.call(void 0,r.TokenType.bang))i.state.tokens[i.state.tokens.length-1].type=r.TokenType.nonNullAssertion;else{if(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.bitShiftL)){let o=i.state.snapshot();if(!n&&a.atPossibleAsync.call(void 0)&&Ke())return;if(qe(),!n&&t.eat.call(void 0,r.TokenType.parenL)?(i.state.tokens[i.state.tokens.length-1].subscriptStartIndex=e,a.parseCallExpressionArguments.call(void 0)):t.match.call(void 0,r.TokenType.backQuote)?a.parseTemplate.call(void 0):(i.state.type===r.TokenType.greaterThan||i.state.type!==r.TokenType.parenL&&i.state.type&r.TokenType.IS_EXPRESSION_START&&!c.hasPrecedingLineBreak.call(void 0))&&c.unexpected.call(void 0),i.state.error)i.state.restoreFromSnapshot(o);else return}else!n&&t.match.call(void 0,r.TokenType.questionDot)&&t.lookaheadType.call(void 0)===r.TokenType.lessThan&&(t.next.call(void 0),i.state.tokens[e].isOptionalChainStart=!0,i.state.tokens[i.state.tokens.length-1].subscriptStartIndex=e,Je(),c.expect.call(void 0,r.TokenType.parenL),a.parseCallExpressionArguments.call(void 0));a.baseParseSubscript.call(void 0,e,n,o)}}e.tsParseSubscript=Ze;function Qe(){if(t.eat.call(void 0,r.TokenType._import))return c.isContextual.call(void 0,n.ContextualKeyword._type)&&t.lookaheadType.call(void 0)!==r.TokenType.eq&&c.expectContextual.call(void 0,n.ContextualKeyword._type),Le(),!0;if(t.eat.call(void 0,r.TokenType.eq))return a.parseExpression.call(void 0),c.semicolon.call(void 0),!0;if(c.eatContextual.call(void 0,n.ContextualKeyword._as))return c.expectContextual.call(void 0,n.ContextualKeyword._namespace),a.parseIdentifier.call(void 0),c.semicolon.call(void 0),!0;if(c.isContextual.call(void 0,n.ContextualKeyword._type)){let e=t.lookaheadType.call(void 0);(e===r.TokenType.braceL||e===r.TokenType.star)&&t.next.call(void 0)}return!1}e.tsTryParseExport=Qe;function $e(){a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration:(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?(i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0):(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?(i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ImportAccess,i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration):(a.parseIdentifier.call(void 0),i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ImportAccess,i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ImportDeclaration,i.state.tokens[i.state.tokens.length-4].isType=!0,i.state.tokens[i.state.tokens.length-3].isType=!0,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0)))}e.tsParseImportSpecifier=$e;function et(){a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ExportAccess:(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?(i.state.tokens[i.state.tokens.length-1].identifierRole=t.IdentifierRole.ExportAccess,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0):(a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)?i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ExportAccess:(a.parseIdentifier.call(void 0),i.state.tokens[i.state.tokens.length-3].identifierRole=t.IdentifierRole.ExportAccess,i.state.tokens[i.state.tokens.length-4].isType=!0,i.state.tokens[i.state.tokens.length-3].isType=!0,i.state.tokens[i.state.tokens.length-2].isType=!0,i.state.tokens[i.state.tokens.length-1].isType=!0)))}e.tsParseExportSpecifier=et;function tt(){if(c.isContextual.call(void 0,n.ContextualKeyword._abstract)&&t.lookaheadType.call(void 0)===r.TokenType._class)return i.state.type=r.TokenType._abstract,t.next.call(void 0),s.parseClass.call(void 0,!0,!0),!0;if(c.isContextual.call(void 0,n.ContextualKeyword._interface)){let e=t.pushTypeContext.call(void 0,2);return We(n.ContextualKeyword._interface,!0),t.popTypeContext.call(void 0,e),!0}return!1}e.tsTryParseExportDefaultExpression=tt;function nt(){if(i.state.type===r.TokenType._const){let e=t.lookaheadTypeAndKeyword.call(void 0);if(e.type===r.TokenType.name&&e.contextualKeyword===n.ContextualKeyword._enum)return c.expect.call(void 0,r.TokenType._const),c.expectContextual.call(void 0,n.ContextualKeyword._enum),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,Ne(),!0}return!1}e.tsTryParseStatementContent=nt;function rt(e){let t=i.state.tokens.length;p([n.ContextualKeyword._abstract,n.ContextualKeyword._readonly,n.ContextualKeyword._declare,n.ContextualKeyword._static,n.ContextualKeyword._override]);let r=i.state.tokens.length;if(ne()){let n=e?t-1:t;for(let e=n;e<r;e++)i.state.tokens[e].isType=!0;return!0}return!1}e.tsTryParseClassMemberWithIsStatic=rt;function it(e){Ue(e)||c.semicolon.call(void 0)}e.tsParseIdentifierStatement=it;function at(){let e=c.eatContextual.call(void 0,n.ContextualKeyword._declare);e&&(i.state.tokens[i.state.tokens.length-1].type=r.TokenType._declare);let a=!1;if(t.match.call(void 0,r.TokenType.name)){if(e){let e=t.pushTypeContext.call(void 0,2);a=He(),t.popTypeContext.call(void 0,e)}else a=He()}if(!a){if(e){let e=t.pushTypeContext.call(void 0,2);s.parseStatement.call(void 0,!0),t.popTypeContext.call(void 0,e)}else s.parseStatement.call(void 0,!0)}}e.tsParseExportDeclaration=at;function ot(e){if(e&&(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.bitShiftL))&&qe(),c.eatContextual.call(void 0,n.ContextualKeyword._implements)){i.state.tokens[i.state.tokens.length-1].type=r.TokenType._implements;let e=t.pushTypeContext.call(void 0,1);Oe(),t.popTypeContext.call(void 0,e)}}e.tsAfterParseClassSuper=ot;function st(){S()}e.tsStartParseObjPropValue=st;function ct(){S()}e.tsStartParseFunctionParams=ct;function lt(){let e=t.pushTypeContext.call(void 0,0);c.hasPrecedingLineBreak.call(void 0)||t.eat.call(void 0,r.TokenType.bang),be(),t.popTypeContext.call(void 0,e)}e.tsAfterParseVarHead=lt;function ut(){t.match.call(void 0,r.TokenType.colon)&&Ce()}e.tsStartParseAsyncArrowFromCallExpression=ut;function dt(e,t){return i.isJSXEnabled?ft(e,t):pt(e,t)}e.tsParseMaybeAssign=dt;function ft(e,n){if(!t.match.call(void 0,r.TokenType.lessThan))return a.baseParseMaybeAssign.call(void 0,e,n);let o=i.state.snapshot(),s=a.baseParseMaybeAssign.call(void 0,e,n);if(i.state.error)i.state.restoreFromSnapshot(o);else return s;return i.state.type=r.TokenType.typeParameterStart,C(),s=a.baseParseMaybeAssign.call(void 0,e,n),s||c.unexpected.call(void 0),s}e.tsParseMaybeAssignWithJSX=ft;function pt(e,n){if(!t.match.call(void 0,r.TokenType.lessThan))return a.baseParseMaybeAssign.call(void 0,e,n);let o=i.state.snapshot();C();let s=a.baseParseMaybeAssign.call(void 0,e,n);if(s||c.unexpected.call(void 0),i.state.error)i.state.restoreFromSnapshot(o);else return s;return a.baseParseMaybeAssign.call(void 0,e,n)}e.tsParseMaybeAssignWithoutJSX=pt;function mt(){if(t.match.call(void 0,r.TokenType.colon)){let e=i.state.snapshot();ve(r.TokenType.colon),c.canInsertSemicolon.call(void 0)&&c.unexpected.call(void 0),t.match.call(void 0,r.TokenType.arrow)||c.unexpected.call(void 0),i.state.error&&i.state.restoreFromSnapshot(e)}return t.eat.call(void 0,r.TokenType.arrow)}e.tsParseArrow=mt;function ht(){let e=t.pushTypeContext.call(void 0,0);t.eat.call(void 0,r.TokenType.question),be(),t.popTypeContext.call(void 0,e)}e.tsParseAssignableListItemTypes=ht;function gt(){(t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.bitShiftL))&&qe(),s.baseParseMaybeDecoratorArguments.call(void 0)}e.tsParseMaybeDecoratorArguments=gt})),Qb=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ob(),n=q(),r=Sb(),i=ex(),a=Cb(),o=xb(),s=Tb(),c=Zb();function l(){let e=!1,i=!1;for(;;){if(r.state.pos>=r.input.length){a.unexpected.call(void 0,`Unterminated JSX contents`);return}let s=r.input.charCodeAt(r.state.pos);if(s===o.charCodes.lessThan||s===o.charCodes.leftCurlyBrace){if(r.state.pos===r.state.start){if(s===o.charCodes.lessThan){r.state.pos++,t.finishToken.call(void 0,n.TokenType.jsxTagStart);return}t.getTokenFromCode.call(void 0,s);return}e&&!i?t.finishToken.call(void 0,n.TokenType.jsxEmptyText):t.finishToken.call(void 0,n.TokenType.jsxText);return}s===o.charCodes.lineFeed?e=!0:s!==o.charCodes.space&&s!==o.charCodes.carriageReturn&&s!==o.charCodes.tab&&(i=!0),r.state.pos++}}function u(e){for(r.state.pos++;;){if(r.state.pos>=r.input.length){a.unexpected.call(void 0,`Unterminated string constant`);return}if(r.input.charCodeAt(r.state.pos)===e){r.state.pos++;break}r.state.pos++}t.finishToken.call(void 0,n.TokenType.string)}function d(){let e;do{if(r.state.pos>r.input.length){a.unexpected.call(void 0,`Unexpectedly reached the end of input.`);return}e=r.input.charCodeAt(++r.state.pos)}while(s.IS_IDENTIFIER_CHAR[e]||e===o.charCodes.dash);t.finishToken.call(void 0,n.TokenType.jsxName)}function f(){x()}function p(e){f(),t.eat.call(void 0,n.TokenType.colon)?f():r.state.tokens[r.state.tokens.length-1].identifierRole=e}function m(){let e=r.state.tokens.length;p(t.IdentifierRole.Access);let i=!1;for(;t.match.call(void 0,n.TokenType.dot);)i=!0,x(),f();if(!i){let t=r.state.tokens[e],n=r.input.charCodeAt(t.start);n>=o.charCodes.lowercaseA&&n<=o.charCodes.lowercaseZ&&(t.identifierRole=null)}}function h(){switch(r.state.type){case n.TokenType.braceL:t.next.call(void 0),i.parseExpression.call(void 0),x();return;case n.TokenType.jsxTagStart:b(),x();return;case n.TokenType.string:x();return;default:a.unexpected.call(void 0,`JSX value should be either an expression or a quoted JSX text`)}}function g(){a.expect.call(void 0,n.TokenType.ellipsis),i.parseExpression.call(void 0)}function _(e){if(t.match.call(void 0,n.TokenType.jsxTagEnd))return!1;m(),r.isTypeScriptEnabled&&c.tsTryParseJSXTypeArgument.call(void 0);let s=!1;for(;!t.match.call(void 0,n.TokenType.slash)&&!t.match.call(void 0,n.TokenType.jsxTagEnd)&&!r.state.error;)t.eat.call(void 0,n.TokenType.braceL)?(s=!0,a.expect.call(void 0,n.TokenType.ellipsis),i.parseMaybeAssign.call(void 0),x()):(s&&r.state.end-r.state.start===3&&r.input.charCodeAt(r.state.start)===o.charCodes.lowercaseK&&r.input.charCodeAt(r.state.start+1)===o.charCodes.lowercaseE&&r.input.charCodeAt(r.state.start+2)===o.charCodes.lowercaseY&&(r.state.tokens[e].jsxRole=t.JSXRole.KeyAfterPropSpread),p(t.IdentifierRole.ObjectKey),t.match.call(void 0,n.TokenType.eq)&&(x(),h()));let l=t.match.call(void 0,n.TokenType.slash);return l&&x(),l}function v(){t.match.call(void 0,n.TokenType.jsxTagEnd)||m()}function y(){let e=r.state.tokens.length-1;r.state.tokens[e].jsxRole=t.JSXRole.NoChildren;let o=0;if(!_(e))for(S();;)switch(r.state.type){case n.TokenType.jsxTagStart:if(x(),t.match.call(void 0,n.TokenType.slash)){x(),v(),r.state.tokens[e].jsxRole!==t.JSXRole.KeyAfterPropSpread&&(o===1?r.state.tokens[e].jsxRole=t.JSXRole.OneChild:o>1&&(r.state.tokens[e].jsxRole=t.JSXRole.StaticChildren));return}o++,y(),S();break;case n.TokenType.jsxText:o++,S();break;case n.TokenType.jsxEmptyText:S();break;case n.TokenType.braceL:t.next.call(void 0),t.match.call(void 0,n.TokenType.ellipsis)?(g(),S(),o+=2):(t.match.call(void 0,n.TokenType.braceR)||(o++,i.parseExpression.call(void 0)),S());break;
|
|
366
|
+
// istanbul ignore next - should never happen
|
|
367
|
+
default:a.unexpected.call(void 0);return}}function b(){x(),y()}e.jsxParseElement=b;function x(){r.state.tokens.push(new t.Token),t.skipSpace.call(void 0),r.state.start=r.state.pos;let e=r.input.charCodeAt(r.state.pos);if(s.IS_IDENTIFIER_START[e])d();else if(e===o.charCodes.quotationMark||e===o.charCodes.apostrophe)u(e);else switch(++r.state.pos,e){case o.charCodes.greaterThan:t.finishToken.call(void 0,n.TokenType.jsxTagEnd);break;case o.charCodes.lessThan:t.finishToken.call(void 0,n.TokenType.jsxTagStart);break;case o.charCodes.slash:t.finishToken.call(void 0,n.TokenType.slash);break;case o.charCodes.equalsTo:t.finishToken.call(void 0,n.TokenType.eq);break;case o.charCodes.leftCurlyBrace:t.finishToken.call(void 0,n.TokenType.braceL);break;case o.charCodes.dot:t.finishToken.call(void 0,n.TokenType.dot);break;case o.charCodes.colon:t.finishToken.call(void 0,n.TokenType.colon);break;default:a.unexpected.call(void 0)}}e.nextJSXTagToken=x;function S(){r.state.tokens.push(new t.Token),r.state.start=r.state.pos,l()}})),$b=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ob(),n=q(),r=Sb(),i=ex(),a=tx(),o=Zb();function s(e){if(t.match.call(void 0,n.TokenType.question)){let e=t.lookaheadType.call(void 0);if(e===n.TokenType.colon||e===n.TokenType.comma||e===n.TokenType.parenR)return}i.baseParseConditional.call(void 0,e)}e.typedParseConditional=s;function c(){t.eatTypeToken.call(void 0,n.TokenType.question),t.match.call(void 0,n.TokenType.colon)&&(r.isTypeScriptEnabled?o.tsParseTypeAnnotation.call(void 0):r.isFlowEnabled&&a.flowParseTypeAnnotation.call(void 0))}e.typedParseParenItem=c})),ex=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=tx(),n=Qb(),r=$b(),i=Zb(),a=Ob(),o=yb(),s=bb(),c=q(),l=xb(),u=Tb(),d=Sb(),f=Xb(),p=nx(),m=Cb(),h=class{constructor(e){this.stop=e}};e.StopState=h;function g(e=!1){if(_(e),a.match.call(void 0,c.TokenType.comma))for(;a.eat.call(void 0,c.TokenType.comma);)_(e)}e.parseExpression=g;function _(e=!1,n=!1){return d.isTypeScriptEnabled?i.tsParseMaybeAssign.call(void 0,e,n):d.isFlowEnabled?t.flowParseMaybeAssign.call(void 0,e,n):v(e,n)}e.parseMaybeAssign=_;function v(e,t){if(a.match.call(void 0,c.TokenType._yield))return we(),!1;(a.match.call(void 0,c.TokenType.parenL)||a.match.call(void 0,c.TokenType.name)||a.match.call(void 0,c.TokenType._yield))&&(d.state.potentialArrowAt=d.state.start);let n=y(e);return t&&ue(),d.state.type&c.TokenType.IS_ASSIGN?(a.next.call(void 0),_(e),!1):n}e.baseParseMaybeAssign=v;function y(e){return S(e)?!0:(b(e),!1)}function b(e){d.isTypeScriptEnabled||d.isFlowEnabled?r.typedParseConditional.call(void 0,e):x(e)}function x(e){a.eat.call(void 0,c.TokenType.question)&&(_(),m.expect.call(void 0,c.TokenType.colon),_(e))}e.baseParseConditional=x;function S(e){let t=d.state.tokens.length;return w()?!0:(C(t,-1,e),!1)}function C(e,t,n){if(d.isTypeScriptEnabled&&(c.TokenType._in&c.TokenType.PRECEDENCE_MASK)>t&&!m.hasPrecedingLineBreak.call(void 0)&&(m.eatContextual.call(void 0,o.ContextualKeyword._as)||m.eatContextual.call(void 0,o.ContextualKeyword._satisfies))){let r=a.pushTypeContext.call(void 0,1);i.tsParseType.call(void 0),a.popTypeContext.call(void 0,r),a.rescan_gt.call(void 0),C(e,t,n);return}let r=d.state.type&c.TokenType.PRECEDENCE_MASK;if(r>0&&(!n||!a.match.call(void 0,c.TokenType._in))&&r>t){let i=d.state.type;a.next.call(void 0),i===c.TokenType.nullishCoalescing&&(d.state.tokens[d.state.tokens.length-1].nullishStartIndex=e);let o=d.state.tokens.length;w(),C(o,i&c.TokenType.IS_RIGHT_ASSOCIATIVE?r-1:r,n),i===c.TokenType.nullishCoalescing&&(d.state.tokens[e].numNullishCoalesceStarts++,d.state.tokens[d.state.tokens.length-1].numNullishCoalesceEnds++),C(e,t,n)}}function w(){if(d.isTypeScriptEnabled&&!d.isJSXEnabled&&a.eat.call(void 0,c.TokenType.lessThan))return i.tsParseTypeAssertion.call(void 0),!1;if(m.isContextual.call(void 0,o.ContextualKeyword._module)&&a.lookaheadCharCode.call(void 0)===l.charCodes.leftCurlyBrace&&!m.hasFollowingLineBreak.call(void 0))return Te(),!1;if(d.state.type&c.TokenType.IS_PREFIX)return a.next.call(void 0),w(),!1;if(T())return!0;for(;d.state.type&c.TokenType.IS_POSTFIX&&!m.canInsertSemicolon.call(void 0);)d.state.type===c.TokenType.preIncDec&&(d.state.type=c.TokenType.postIncDec),a.next.call(void 0);return!1}e.parseMaybeUnary=w;function T(){let e=d.state.tokens.length;return k()?!0:(E(e),d.state.tokens.length>e&&d.state.tokens[e].isOptionalChainStart&&(d.state.tokens[d.state.tokens.length-1].isOptionalChainEnd=!0),!1)}e.parseExprSubscripts=T;function E(e,n=!1){d.isFlowEnabled?t.flowParseSubscripts.call(void 0,e,n):ee(e,n)}function ee(e,t=!1){let n=new h(!1);do te(e,t,n);while(!n.stop&&!d.state.error)}e.baseParseSubscripts=ee;function te(e,n,r){d.isTypeScriptEnabled?i.tsParseSubscript.call(void 0,e,n,r):d.isFlowEnabled?t.flowParseSubscript.call(void 0,e,n,r):ne(e,n,r)}function ne(e,t,n){if(!t&&a.eat.call(void 0,c.TokenType.doubleColon))O(),n.stop=!0,E(e,t);else if(a.match.call(void 0,c.TokenType.questionDot)){if(d.state.tokens[e].isOptionalChainStart=!0,t&&a.lookaheadType.call(void 0)===c.TokenType.parenL){n.stop=!0;return}a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e,a.eat.call(void 0,c.TokenType.bracketL)?(g(),m.expect.call(void 0,c.TokenType.bracketR)):a.eat.call(void 0,c.TokenType.parenL)?D():A()}else if(a.eat.call(void 0,c.TokenType.dot))d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e,A();else if(a.eat.call(void 0,c.TokenType.bracketL))d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e,g(),m.expect.call(void 0,c.TokenType.bracketR);else if(!t&&a.match.call(void 0,c.TokenType.parenL)){if(re()){let t=d.state.snapshot(),r=d.state.tokens.length;a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e;let i=d.getNextContextId.call(void 0);d.state.tokens[d.state.tokens.length-1].contextId=i,D(),d.state.tokens[d.state.tokens.length-1].contextId=i,ie()&&(d.state.restoreFromSnapshot(t),n.stop=!0,d.state.scopeDepth++,p.parseFunctionParams.call(void 0),ae(r))}else{a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].subscriptStartIndex=e;let t=d.getNextContextId.call(void 0);d.state.tokens[d.state.tokens.length-1].contextId=t,D(),d.state.tokens[d.state.tokens.length-1].contextId=t}}else a.match.call(void 0,c.TokenType.backQuote)?pe():n.stop=!0}e.baseParseSubscript=ne;function re(){return d.state.tokens[d.state.tokens.length-1].contextualKeyword===o.ContextualKeyword._async&&!m.canInsertSemicolon.call(void 0)}e.atPossibleAsync=re;function D(){let e=!0;for(;!a.eat.call(void 0,c.TokenType.parenR)&&!d.state.error;){if(e)e=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.eat.call(void 0,c.TokenType.parenR))break;Se(!1)}}e.parseCallExpressionArguments=D;function ie(){return a.match.call(void 0,c.TokenType.colon)||a.match.call(void 0,c.TokenType.arrow)}function ae(e){d.isTypeScriptEnabled?i.tsStartParseAsyncArrowFromCallExpression.call(void 0):d.isFlowEnabled&&t.flowStartParseAsyncArrowFromCallExpression.call(void 0),m.expect.call(void 0,c.TokenType.arrow),ve(e)}function O(){let e=d.state.tokens.length;k(),E(e,!0)}function k(){if(a.eat.call(void 0,c.TokenType.modulo))return Ce(),!1;if(a.match.call(void 0,c.TokenType.jsxText)||a.match.call(void 0,c.TokenType.jsxEmptyText))return j(),!1;if(a.match.call(void 0,c.TokenType.lessThan)&&d.isJSXEnabled)return d.state.type=c.TokenType.jsxTagStart,n.jsxParseElement.call(void 0),a.next.call(void 0),!1;let e=d.state.potentialArrowAt===d.state.start;switch(d.state.type){case c.TokenType.slash:case c.TokenType.assign:a.retokenizeSlashAsRegex.call(void 0);case c.TokenType._super:case c.TokenType._this:case c.TokenType.regexp:case c.TokenType.num:case c.TokenType.bigint:case c.TokenType.decimal:case c.TokenType.string:case c.TokenType._null:case c.TokenType._true:case c.TokenType._false:return a.next.call(void 0),!1;case c.TokenType._import:return a.next.call(void 0),a.match.call(void 0,c.TokenType.dot)&&(d.state.tokens[d.state.tokens.length-1].type=c.TokenType.name,a.next.call(void 0),Ce()),!1;case c.TokenType.name:{let t=d.state.tokens.length,n=d.state.start,r=d.state.contextualKeyword;return Ce(),r===o.ContextualKeyword._await?(I(),!1):r===o.ContextualKeyword._async&&a.match.call(void 0,c.TokenType._function)&&!m.canInsertSemicolon.call(void 0)?(a.next.call(void 0),p.parseFunction.call(void 0,n,!1),!1):e&&r===o.ContextualKeyword._async&&!m.canInsertSemicolon.call(void 0)&&a.match.call(void 0,c.TokenType.name)?(d.state.scopeDepth++,f.parseBindingIdentifier.call(void 0,!1),m.expect.call(void 0,c.TokenType.arrow),ve(t),!0):a.match.call(void 0,c.TokenType._do)&&!m.canInsertSemicolon.call(void 0)?(a.next.call(void 0),p.parseBlock.call(void 0),!1):e&&!m.canInsertSemicolon.call(void 0)&&a.match.call(void 0,c.TokenType.arrow)?(d.state.scopeDepth++,f.markPriorBindingIdentifier.call(void 0,!1),m.expect.call(void 0,c.TokenType.arrow),ve(t),!0):(d.state.tokens[d.state.tokens.length-1].identifierRole=a.IdentifierRole.Access,!1)}case c.TokenType._do:return a.next.call(void 0),p.parseBlock.call(void 0),!1;case c.TokenType.parenL:return se(e);case c.TokenType.bracketL:return a.next.call(void 0),xe(c.TokenType.bracketR,!0),!1;case c.TokenType.braceL:return me(!1,!1),!1;case c.TokenType._function:return oe(),!1;case c.TokenType.at:p.parseDecorators.call(void 0);case c.TokenType._class:return p.parseClass.call(void 0,!1),!1;case c.TokenType._new:return de(),!1;case c.TokenType.backQuote:return pe(),!1;case c.TokenType.doubleColon:return a.next.call(void 0),O(),!1;case c.TokenType.hash:{let e=a.lookaheadCharCode.call(void 0);return u.IS_IDENTIFIER_START[e]||e===l.charCodes.backslash?A():a.next.call(void 0),!1}default:return m.unexpected.call(void 0),!1}}e.parseExprAtom=k;function A(){a.eat.call(void 0,c.TokenType.hash),Ce()}function oe(){let e=d.state.start;Ce(),a.eat.call(void 0,c.TokenType.dot)&&Ce(),p.parseFunction.call(void 0,e,!1)}function j(){a.next.call(void 0)}e.parseLiteral=j;function M(){m.expect.call(void 0,c.TokenType.parenL),g(),m.expect.call(void 0,c.TokenType.parenR)}e.parseParenExpression=M;function se(e){let t=d.state.snapshot(),n=d.state.tokens.length;m.expect.call(void 0,c.TokenType.parenL);let r=!0;for(;!a.match.call(void 0,c.TokenType.parenR)&&!d.state.error;){if(r)r=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.match.call(void 0,c.TokenType.parenR))break;if(a.match.call(void 0,c.TokenType.ellipsis)){f.parseRest.call(void 0,!1),ue();break}_(!1,!0)}return m.expect.call(void 0,c.TokenType.parenR),e&&ce()&&le()?(d.state.restoreFromSnapshot(t),d.state.scopeDepth++,p.parseFunctionParams.call(void 0),le(),ve(n),!d.state.error||(d.state.restoreFromSnapshot(t),se(!1),!1)):!1}function ce(){return a.match.call(void 0,c.TokenType.colon)||!m.canInsertSemicolon.call(void 0)}function le(){return d.isTypeScriptEnabled?i.tsParseArrow.call(void 0):d.isFlowEnabled?t.flowParseArrow.call(void 0):a.eat.call(void 0,c.TokenType.arrow)}e.parseArrow=le;function ue(){(d.isTypeScriptEnabled||d.isFlowEnabled)&&r.typedParseParenItem.call(void 0)}function de(){m.expect.call(void 0,c.TokenType._new),a.eat.call(void 0,c.TokenType.dot)?Ce():(fe(),d.isFlowEnabled&&t.flowStartParseNewArguments.call(void 0),a.eat.call(void 0,c.TokenType.parenL)&&xe(c.TokenType.parenR))}function fe(){O(),a.eat.call(void 0,c.TokenType.questionDot)}function pe(){for(a.nextTemplateToken.call(void 0),a.nextTemplateToken.call(void 0);!a.match.call(void 0,c.TokenType.backQuote)&&!d.state.error;)m.expect.call(void 0,c.TokenType.dollarBraceL),g(),a.nextTemplateToken.call(void 0),a.nextTemplateToken.call(void 0);a.next.call(void 0)}e.parseTemplate=pe;function me(e,t){let n=d.getNextContextId.call(void 0),r=!0;for(a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].contextId=n;!a.eat.call(void 0,c.TokenType.braceR)&&!d.state.error;){if(r)r=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.eat.call(void 0,c.TokenType.braceR))break;let i=!1;if(a.match.call(void 0,c.TokenType.ellipsis)){let n=d.state.tokens.length;if(f.parseSpread.call(void 0),e&&(d.state.tokens.length===n+2&&f.markPriorBindingIdentifier.call(void 0,t),a.eat.call(void 0,c.TokenType.braceR)))break}else e||(i=a.eat.call(void 0,c.TokenType.star)),!e&&m.isContextual.call(void 0,o.ContextualKeyword._async)?(i&&m.unexpected.call(void 0),Ce(),a.match.call(void 0,c.TokenType.colon)||a.match.call(void 0,c.TokenType.parenL)||a.match.call(void 0,c.TokenType.braceR)||a.match.call(void 0,c.TokenType.eq)||a.match.call(void 0,c.TokenType.comma)||(a.match.call(void 0,c.TokenType.star)&&(a.next.call(void 0),i=!0),P(n))):P(n),N(e,t,n)}d.state.tokens[d.state.tokens.length-1].contextId=n}e.parseObj=me;function he(e){return!e&&(a.match.call(void 0,c.TokenType.string)||a.match.call(void 0,c.TokenType.num)||a.match.call(void 0,c.TokenType.bracketL)||a.match.call(void 0,c.TokenType.name)||!!(d.state.type&c.TokenType.IS_KEYWORD))}function ge(e,t){let n=d.state.start;return a.match.call(void 0,c.TokenType.parenL)?(e&&m.unexpected.call(void 0),F(n,!1),!0):he(e)?(P(t),F(n,!1),!0):!1}function _e(e,t){if(a.eat.call(void 0,c.TokenType.colon)){e?f.parseMaybeDefault.call(void 0,t):_(!1);return}let n;n=e?d.state.scopeDepth===0?a.IdentifierRole.ObjectShorthandTopLevelDeclaration:t?a.IdentifierRole.ObjectShorthandBlockScopedDeclaration:a.IdentifierRole.ObjectShorthandFunctionScopedDeclaration:a.IdentifierRole.ObjectShorthand,d.state.tokens[d.state.tokens.length-1].identifierRole=n,f.parseMaybeDefault.call(void 0,t,!0)}function N(e,n,r){d.isTypeScriptEnabled?i.tsStartParseObjPropValue.call(void 0):d.isFlowEnabled&&t.flowStartParseObjPropValue.call(void 0),ge(e,r)||_e(e,n)}function P(e){d.isFlowEnabled&&t.flowParseVariance.call(void 0),a.eat.call(void 0,c.TokenType.bracketL)?(d.state.tokens[d.state.tokens.length-1].contextId=e,_(),m.expect.call(void 0,c.TokenType.bracketR),d.state.tokens[d.state.tokens.length-1].contextId=e):(a.match.call(void 0,c.TokenType.num)||a.match.call(void 0,c.TokenType.string)||a.match.call(void 0,c.TokenType.bigint)||a.match.call(void 0,c.TokenType.decimal)?k():A(),d.state.tokens[d.state.tokens.length-1].identifierRole=a.IdentifierRole.ObjectKey,d.state.tokens[d.state.tokens.length-1].contextId=e)}e.parsePropertyName=P;function F(e,t){let n=d.getNextContextId.call(void 0);d.state.scopeDepth++;let r=d.state.tokens.length,i=t;p.parseFunctionParams.call(void 0,i,n),ye(e,n);let a=d.state.tokens.length;d.state.scopes.push(new s.Scope(r,a,!0)),d.state.scopeDepth--}e.parseMethod=F;function ve(e){be(!0);let t=d.state.tokens.length;d.state.scopes.push(new s.Scope(e,t,!0)),d.state.scopeDepth--}e.parseArrowExpression=ve;function ye(e,n=0){d.isTypeScriptEnabled?i.tsParseFunctionBodyAndFinish.call(void 0,e,n):d.isFlowEnabled?t.flowParseFunctionBodyAndFinish.call(void 0,n):be(!1,n)}e.parseFunctionBodyAndFinish=ye;function be(e,t=0){e&&!a.match.call(void 0,c.TokenType.braceL)?_():p.parseBlock.call(void 0,!0,t)}e.parseFunctionBody=be;function xe(e,t=!1){let n=!0;for(;!a.eat.call(void 0,e)&&!d.state.error;){if(n)n=!1;else if(m.expect.call(void 0,c.TokenType.comma),a.eat.call(void 0,e))break;Se(t)}}function Se(e){e&&a.match.call(void 0,c.TokenType.comma)||(a.match.call(void 0,c.TokenType.ellipsis)?(f.parseSpread.call(void 0),ue()):a.match.call(void 0,c.TokenType.question)?a.next.call(void 0):_(!1,!0))}function Ce(){a.next.call(void 0),d.state.tokens[d.state.tokens.length-1].type=c.TokenType.name}e.parseIdentifier=Ce;function I(){w()}function we(){a.next.call(void 0),!a.match.call(void 0,c.TokenType.semi)&&!m.canInsertSemicolon.call(void 0)&&(a.eat.call(void 0,c.TokenType.star),_())}function Te(){m.expectContextual.call(void 0,o.ContextualKeyword._module),m.expect.call(void 0,c.TokenType.braceL),p.parseBlockBody.call(void 0,c.TokenType.braceR)}})),tx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ob(),n=yb(),r=q(),i=Sb(),a=ex(),o=nx(),s=Cb();function c(e){return(e.type===r.TokenType.name||!!(e.type&r.TokenType.IS_KEYWORD))&&e.contextualKeyword!==n.ContextualKeyword._from}function l(e){let n=t.pushTypeContext.call(void 0,0);s.expect.call(void 0,e||r.TokenType.colon),P(),t.popTypeContext.call(void 0,n)}function u(){s.expect.call(void 0,r.TokenType.modulo),s.expectContextual.call(void 0,n.ContextualKeyword._checks),t.eat.call(void 0,r.TokenType.parenL)&&(a.parseExpression.call(void 0),s.expect.call(void 0,r.TokenType.parenR))}function d(){let e=t.pushTypeContext.call(void 0,0);s.expect.call(void 0,r.TokenType.colon),t.match.call(void 0,r.TokenType.modulo)?u():(P(),t.match.call(void 0,r.TokenType.modulo)&&u()),t.popTypeContext.call(void 0,e)}function f(){t.next.call(void 0),S(!0)}function p(){t.next.call(void 0),a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.lessThan)&&ne(),s.expect.call(void 0,r.TokenType.parenL),fe(),s.expect.call(void 0,r.TokenType.parenR),d(),s.semicolon.call(void 0)}function m(){t.match.call(void 0,r.TokenType._class)?f():t.match.call(void 0,r.TokenType._function)?p():t.match.call(void 0,r.TokenType._var)?h():s.eatContextual.call(void 0,n.ContextualKeyword._module)?t.eat.call(void 0,r.TokenType.dot)?v():g():s.isContextual.call(void 0,n.ContextualKeyword._type)?y():s.isContextual.call(void 0,n.ContextualKeyword._opaque)?b():s.isContextual.call(void 0,n.ContextualKeyword._interface)?x():t.match.call(void 0,r.TokenType._export)?_():s.unexpected.call(void 0)}function h(){t.next.call(void 0),ve(),s.semicolon.call(void 0)}function g(){for(t.match.call(void 0,r.TokenType.string)?a.parseExprAtom.call(void 0):a.parseIdentifier.call(void 0),s.expect.call(void 0,r.TokenType.braceL);!t.match.call(void 0,r.TokenType.braceR)&&!i.state.error;)t.match.call(void 0,r.TokenType._import)?(t.next.call(void 0),o.parseImport.call(void 0)):s.unexpected.call(void 0);s.expect.call(void 0,r.TokenType.braceR)}function _(){s.expect.call(void 0,r.TokenType._export),t.eat.call(void 0,r.TokenType._default)?t.match.call(void 0,r.TokenType._function)||t.match.call(void 0,r.TokenType._class)?m():(P(),s.semicolon.call(void 0)):t.match.call(void 0,r.TokenType._var)||t.match.call(void 0,r.TokenType._function)||t.match.call(void 0,r.TokenType._class)||s.isContextual.call(void 0,n.ContextualKeyword._opaque)?m():t.match.call(void 0,r.TokenType.star)||t.match.call(void 0,r.TokenType.braceL)||s.isContextual.call(void 0,n.ContextualKeyword._interface)||s.isContextual.call(void 0,n.ContextualKeyword._type)||s.isContextual.call(void 0,n.ContextualKeyword._opaque)?o.parseExport.call(void 0):s.unexpected.call(void 0)}function v(){s.expectContextual.call(void 0,n.ContextualKeyword._exports),F(),s.semicolon.call(void 0)}function y(){t.next.call(void 0),E()}function b(){t.next.call(void 0),ee(!0)}function x(){t.next.call(void 0),S()}function S(e=!1){if(T(),t.match.call(void 0,r.TokenType.lessThan)&&ne(),t.eat.call(void 0,r.TokenType._extends))do C();while(!e&&t.eat.call(void 0,r.TokenType.comma));if(s.isContextual.call(void 0,n.ContextualKeyword._mixins)){t.next.call(void 0);do C();while(t.eat.call(void 0,r.TokenType.comma))}if(s.isContextual.call(void 0,n.ContextualKeyword._implements)){t.next.call(void 0);do C();while(t.eat.call(void 0,r.TokenType.comma))}oe(e,!1,e)}function C(){se(!1),t.match.call(void 0,r.TokenType.lessThan)&&re()}function w(){S()}function T(){a.parseIdentifier.call(void 0)}function E(){T(),t.match.call(void 0,r.TokenType.lessThan)&&ne(),l(r.TokenType.eq),s.semicolon.call(void 0)}function ee(e){s.expectContextual.call(void 0,n.ContextualKeyword._type),T(),t.match.call(void 0,r.TokenType.lessThan)&&ne(),t.match.call(void 0,r.TokenType.colon)&&l(r.TokenType.colon),e||l(r.TokenType.eq),s.semicolon.call(void 0)}function te(){ye(),ve(),t.eat.call(void 0,r.TokenType.eq)&&P()}function ne(){let e=t.pushTypeContext.call(void 0,0);
|
|
368
|
+
// istanbul ignore else: this condition is already checked at all call sites
|
|
369
|
+
t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.typeParameterStart)?t.next.call(void 0):s.unexpected.call(void 0);do te(),t.match.call(void 0,r.TokenType.greaterThan)||s.expect.call(void 0,r.TokenType.comma);while(!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error);s.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e)}e.flowParseTypeParameterDeclaration=ne;function re(){let e=t.pushTypeContext.call(void 0,0);for(s.expect.call(void 0,r.TokenType.lessThan);!t.match.call(void 0,r.TokenType.greaterThan)&&!i.state.error;)P(),t.match.call(void 0,r.TokenType.greaterThan)||s.expect.call(void 0,r.TokenType.comma);s.expect.call(void 0,r.TokenType.greaterThan),t.popTypeContext.call(void 0,e)}function D(){if(s.expectContextual.call(void 0,n.ContextualKeyword._interface),t.eat.call(void 0,r.TokenType._extends))do C();while(t.eat.call(void 0,r.TokenType.comma));oe(!1,!1,!1)}function ie(){t.match.call(void 0,r.TokenType.num)||t.match.call(void 0,r.TokenType.string)?a.parseExprAtom.call(void 0):a.parseIdentifier.call(void 0)}function ae(){t.lookaheadType.call(void 0)===r.TokenType.colon?(ie(),l()):P(),s.expect.call(void 0,r.TokenType.bracketR),l()}function O(){ie(),s.expect.call(void 0,r.TokenType.bracketR),s.expect.call(void 0,r.TokenType.bracketR),t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.parenL)?k():(t.eat.call(void 0,r.TokenType.question),l())}function k(){for(t.match.call(void 0,r.TokenType.lessThan)&&ne(),s.expect.call(void 0,r.TokenType.parenL);!t.match.call(void 0,r.TokenType.parenR)&&!t.match.call(void 0,r.TokenType.ellipsis)&&!i.state.error;)de(),t.match.call(void 0,r.TokenType.parenR)||s.expect.call(void 0,r.TokenType.comma);t.eat.call(void 0,r.TokenType.ellipsis)&&de(),s.expect.call(void 0,r.TokenType.parenR),l()}function A(){k()}function oe(e,a,o){let c;for(a&&t.match.call(void 0,r.TokenType.braceBarL)?(s.expect.call(void 0,r.TokenType.braceBarL),c=r.TokenType.braceBarR):(s.expect.call(void 0,r.TokenType.braceL),c=r.TokenType.braceR);!t.match.call(void 0,c)&&!i.state.error;){if(o&&s.isContextual.call(void 0,n.ContextualKeyword._proto)){let n=t.lookaheadType.call(void 0);n!==r.TokenType.colon&&n!==r.TokenType.question&&(t.next.call(void 0),e=!1)}if(e&&s.isContextual.call(void 0,n.ContextualKeyword._static)){let e=t.lookaheadType.call(void 0);e!==r.TokenType.colon&&e!==r.TokenType.question&&t.next.call(void 0)}if(ye(),t.eat.call(void 0,r.TokenType.bracketL))t.eat.call(void 0,r.TokenType.bracketL)?O():ae();else if(t.match.call(void 0,r.TokenType.parenL)||t.match.call(void 0,r.TokenType.lessThan))A();else{if(s.isContextual.call(void 0,n.ContextualKeyword._get)||s.isContextual.call(void 0,n.ContextualKeyword._set)){let e=t.lookaheadType.call(void 0);(e===r.TokenType.name||e===r.TokenType.string||e===r.TokenType.num)&&t.next.call(void 0)}j()}M()}s.expect.call(void 0,c)}function j(){if(t.match.call(void 0,r.TokenType.ellipsis)){if(s.expect.call(void 0,r.TokenType.ellipsis),t.eat.call(void 0,r.TokenType.comma)||t.eat.call(void 0,r.TokenType.semi),t.match.call(void 0,r.TokenType.braceR))return;P()}else ie(),t.match.call(void 0,r.TokenType.lessThan)||t.match.call(void 0,r.TokenType.parenL)?k():(t.eat.call(void 0,r.TokenType.question),l())}function M(){t.eat.call(void 0,r.TokenType.semi)||t.eat.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.braceR)||t.match.call(void 0,r.TokenType.braceBarR)||s.unexpected.call(void 0)}function se(e){for(e||a.parseIdentifier.call(void 0);t.eat.call(void 0,r.TokenType.dot);)a.parseIdentifier.call(void 0)}function ce(){se(!0),t.match.call(void 0,r.TokenType.lessThan)&&re()}function le(){s.expect.call(void 0,r.TokenType._typeof),pe()}function ue(){for(s.expect.call(void 0,r.TokenType.bracketL);i.state.pos<i.input.length&&!t.match.call(void 0,r.TokenType.bracketR)&&(P(),!t.match.call(void 0,r.TokenType.bracketR));)s.expect.call(void 0,r.TokenType.comma);s.expect.call(void 0,r.TokenType.bracketR)}function de(){let e=t.lookaheadType.call(void 0);e===r.TokenType.colon||e===r.TokenType.question?(a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType.question),l()):P()}function fe(){for(;!t.match.call(void 0,r.TokenType.parenR)&&!t.match.call(void 0,r.TokenType.ellipsis)&&!i.state.error;)de(),t.match.call(void 0,r.TokenType.parenR)||s.expect.call(void 0,r.TokenType.comma);t.eat.call(void 0,r.TokenType.ellipsis)&&de()}function pe(){let e=!1,o=i.state.noAnonFunctionType;switch(i.state.type){case r.TokenType.name:if(s.isContextual.call(void 0,n.ContextualKeyword._interface)){D();return}a.parseIdentifier.call(void 0),ce();return;case r.TokenType.braceL:oe(!1,!1,!1);return;case r.TokenType.braceBarL:oe(!1,!0,!1);return;case r.TokenType.bracketL:ue();return;case r.TokenType.lessThan:ne(),s.expect.call(void 0,r.TokenType.parenL),fe(),s.expect.call(void 0,r.TokenType.parenR),s.expect.call(void 0,r.TokenType.arrow),P();return;case r.TokenType.parenL:if(t.next.call(void 0),!t.match.call(void 0,r.TokenType.parenR)&&!t.match.call(void 0,r.TokenType.ellipsis)){if(t.match.call(void 0,r.TokenType.name)){let n=t.lookaheadType.call(void 0);e=n!==r.TokenType.question&&n!==r.TokenType.colon}else e=!0}if(e){if(i.state.noAnonFunctionType=!1,P(),i.state.noAnonFunctionType=o,i.state.noAnonFunctionType||!(t.match.call(void 0,r.TokenType.comma)||t.match.call(void 0,r.TokenType.parenR)&&t.lookaheadType.call(void 0)===r.TokenType.arrow)){s.expect.call(void 0,r.TokenType.parenR);return}t.eat.call(void 0,r.TokenType.comma)}fe(),s.expect.call(void 0,r.TokenType.parenR),s.expect.call(void 0,r.TokenType.arrow),P();return;case r.TokenType.minus:t.next.call(void 0),a.parseLiteral.call(void 0);return;case r.TokenType.string:case r.TokenType.num:case r.TokenType._true:case r.TokenType._false:case r.TokenType._null:case r.TokenType._this:case r.TokenType._void:case r.TokenType.star:t.next.call(void 0);return;default:if(i.state.type===r.TokenType._typeof){le();return}if(i.state.type&r.TokenType.IS_KEYWORD){t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].type=r.TokenType.name;return}}s.unexpected.call(void 0)}function me(){for(pe();!s.canInsertSemicolon.call(void 0)&&(t.match.call(void 0,r.TokenType.bracketL)||t.match.call(void 0,r.TokenType.questionDot));)t.eat.call(void 0,r.TokenType.questionDot),s.expect.call(void 0,r.TokenType.bracketL),t.eat.call(void 0,r.TokenType.bracketR)||(P(),s.expect.call(void 0,r.TokenType.bracketR))}function he(){t.eat.call(void 0,r.TokenType.question)?he():me()}function ge(){he(),!i.state.noAnonFunctionType&&t.eat.call(void 0,r.TokenType.arrow)&&P()}function _e(){for(t.eat.call(void 0,r.TokenType.bitwiseAND),ge();t.eat.call(void 0,r.TokenType.bitwiseAND);)ge()}function N(){for(t.eat.call(void 0,r.TokenType.bitwiseOR),_e();t.eat.call(void 0,r.TokenType.bitwiseOR);)_e()}function P(){N()}function F(){l()}e.flowParseTypeAnnotation=F;function ve(){a.parseIdentifier.call(void 0),t.match.call(void 0,r.TokenType.colon)&&F()}function ye(){(t.match.call(void 0,r.TokenType.plus)||t.match.call(void 0,r.TokenType.minus))&&(t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].isType=!0)}e.flowParseVariance=ye;function be(e){t.match.call(void 0,r.TokenType.colon)&&d(),a.parseFunctionBody.call(void 0,!1,e)}e.flowParseFunctionBodyAndFinish=be;function xe(e,n,o){if(t.match.call(void 0,r.TokenType.questionDot)&&t.lookaheadType.call(void 0)===r.TokenType.lessThan){if(n){o.stop=!0;return}t.next.call(void 0),re(),s.expect.call(void 0,r.TokenType.parenL),a.parseCallExpressionArguments.call(void 0)}else{if(!n&&t.match.call(void 0,r.TokenType.lessThan)){let e=i.state.snapshot();if(re(),s.expect.call(void 0,r.TokenType.parenL),a.parseCallExpressionArguments.call(void 0),i.state.error)i.state.restoreFromSnapshot(e);else return}a.baseParseSubscript.call(void 0,e,n,o)}}e.flowParseSubscript=xe;function Se(){if(t.match.call(void 0,r.TokenType.lessThan)){let e=i.state.snapshot();re(),i.state.error&&i.state.restoreFromSnapshot(e)}}e.flowStartParseNewArguments=Se;function Ce(){if(t.match.call(void 0,r.TokenType.name)&&i.state.contextualKeyword===n.ContextualKeyword._interface){let e=t.pushTypeContext.call(void 0,0);return t.next.call(void 0),w(),t.popTypeContext.call(void 0,e),!0}return s.isContextual.call(void 0,n.ContextualKeyword._enum)?(He(),!0):!1}e.flowTryParseStatement=Ce;function I(){return s.isContextual.call(void 0,n.ContextualKeyword._enum)?(He(),!0):!1}e.flowTryParseExportDefaultExpression=I;function we(e){if(e===n.ContextualKeyword._declare){if(t.match.call(void 0,r.TokenType._class)||t.match.call(void 0,r.TokenType.name)||t.match.call(void 0,r.TokenType._function)||t.match.call(void 0,r.TokenType._var)||t.match.call(void 0,r.TokenType._export)){let e=t.pushTypeContext.call(void 0,1);m(),t.popTypeContext.call(void 0,e)}}else if(t.match.call(void 0,r.TokenType.name)){if(e===n.ContextualKeyword._interface){let e=t.pushTypeContext.call(void 0,1);w(),t.popTypeContext.call(void 0,e)}else if(e===n.ContextualKeyword._type){let e=t.pushTypeContext.call(void 0,1);E(),t.popTypeContext.call(void 0,e)}else if(e===n.ContextualKeyword._opaque){let e=t.pushTypeContext.call(void 0,1);ee(!1),t.popTypeContext.call(void 0,e)}}s.semicolon.call(void 0)}e.flowParseIdentifierStatement=we;function Te(){return s.isContextual.call(void 0,n.ContextualKeyword._type)||s.isContextual.call(void 0,n.ContextualKeyword._interface)||s.isContextual.call(void 0,n.ContextualKeyword._opaque)||s.isContextual.call(void 0,n.ContextualKeyword._enum)}e.flowShouldParseExportDeclaration=Te;function Ee(){return t.match.call(void 0,r.TokenType.name)&&(i.state.contextualKeyword===n.ContextualKeyword._type||i.state.contextualKeyword===n.ContextualKeyword._interface||i.state.contextualKeyword===n.ContextualKeyword._opaque||i.state.contextualKeyword===n.ContextualKeyword._enum)}e.flowShouldDisallowExportDefaultSpecifier=Ee;function De(){if(s.isContextual.call(void 0,n.ContextualKeyword._type)){let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0),t.match.call(void 0,r.TokenType.braceL)?(o.parseExportSpecifiers.call(void 0),o.parseExportFrom.call(void 0)):E(),t.popTypeContext.call(void 0,e)}else if(s.isContextual.call(void 0,n.ContextualKeyword._opaque)){let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0),ee(!1),t.popTypeContext.call(void 0,e)}else if(s.isContextual.call(void 0,n.ContextualKeyword._interface)){let e=t.pushTypeContext.call(void 0,1);t.next.call(void 0),w(),t.popTypeContext.call(void 0,e)}else o.parseStatement.call(void 0,!0)}e.flowParseExportDeclaration=De;function Oe(){return t.match.call(void 0,r.TokenType.star)||s.isContextual.call(void 0,n.ContextualKeyword._type)&&t.lookaheadType.call(void 0)===r.TokenType.star}e.flowShouldParseExportStar=Oe;function ke(){if(s.eatContextual.call(void 0,n.ContextualKeyword._type)){let e=t.pushTypeContext.call(void 0,2);o.baseParseExportStar.call(void 0),t.popTypeContext.call(void 0,e)}else o.baseParseExportStar.call(void 0)}e.flowParseExportStar=ke;function Ae(e){if(e&&t.match.call(void 0,r.TokenType.lessThan)&&re(),s.isContextual.call(void 0,n.ContextualKeyword._implements)){let e=t.pushTypeContext.call(void 0,0);t.next.call(void 0),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._implements;do T(),t.match.call(void 0,r.TokenType.lessThan)&&re();while(t.eat.call(void 0,r.TokenType.comma));t.popTypeContext.call(void 0,e)}}e.flowAfterParseClassSuper=Ae;function je(){t.match.call(void 0,r.TokenType.lessThan)&&(ne(),t.match.call(void 0,r.TokenType.parenL)||s.unexpected.call(void 0))}e.flowStartParseObjPropValue=je;function Me(){let e=t.pushTypeContext.call(void 0,0);t.eat.call(void 0,r.TokenType.question),t.match.call(void 0,r.TokenType.colon)&&F(),t.popTypeContext.call(void 0,e)}e.flowParseAssignableListItemTypes=Me;function Ne(){if(t.match.call(void 0,r.TokenType._typeof)||s.isContextual.call(void 0,n.ContextualKeyword._type)){let e=t.lookaheadTypeAndKeyword.call(void 0);(c(e)||e.type===r.TokenType.braceL||e.type===r.TokenType.star)&&t.next.call(void 0)}}e.flowStartParseImportSpecifiers=Ne;function Pe(){let e=i.state.contextualKeyword===n.ContextualKeyword._type||i.state.type===r.TokenType._typeof;e?t.next.call(void 0):a.parseIdentifier.call(void 0),s.isContextual.call(void 0,n.ContextualKeyword._as)&&!s.isLookaheadContextual.call(void 0,n.ContextualKeyword._as)?(a.parseIdentifier.call(void 0),e&&!t.match.call(void 0,r.TokenType.name)&&!(i.state.type&r.TokenType.IS_KEYWORD)||a.parseIdentifier.call(void 0)):(e&&(t.match.call(void 0,r.TokenType.name)||i.state.type&r.TokenType.IS_KEYWORD)&&a.parseIdentifier.call(void 0),s.eatContextual.call(void 0,n.ContextualKeyword._as)&&a.parseIdentifier.call(void 0))}e.flowParseImportSpecifier=Pe;function Fe(){if(t.match.call(void 0,r.TokenType.lessThan)){let e=t.pushTypeContext.call(void 0,0);ne(),t.popTypeContext.call(void 0,e)}}e.flowStartParseFunctionParams=Fe;function Ie(){t.match.call(void 0,r.TokenType.colon)&&F()}e.flowAfterParseVarHead=Ie;function Le(){if(t.match.call(void 0,r.TokenType.colon)){let e=i.state.noAnonFunctionType;i.state.noAnonFunctionType=!0,F(),i.state.noAnonFunctionType=e}}e.flowStartParseAsyncArrowFromCallExpression=Le;function Re(e,n){if(t.match.call(void 0,r.TokenType.lessThan)){let o=i.state.snapshot(),c=a.baseParseMaybeAssign.call(void 0,e,n);if(i.state.error)i.state.restoreFromSnapshot(o),i.state.type=r.TokenType.typeParameterStart;else return c;let l=t.pushTypeContext.call(void 0,0);if(ne(),t.popTypeContext.call(void 0,l),c=a.baseParseMaybeAssign.call(void 0,e,n),c)return!0;s.unexpected.call(void 0)}return a.baseParseMaybeAssign.call(void 0,e,n)}e.flowParseMaybeAssign=Re;function ze(){if(t.match.call(void 0,r.TokenType.colon)){let e=t.pushTypeContext.call(void 0,0),n=i.state.snapshot(),a=i.state.noAnonFunctionType;i.state.noAnonFunctionType=!0,d(),i.state.noAnonFunctionType=a,s.canInsertSemicolon.call(void 0)&&s.unexpected.call(void 0),t.match.call(void 0,r.TokenType.arrow)||s.unexpected.call(void 0),i.state.error&&i.state.restoreFromSnapshot(n),t.popTypeContext.call(void 0,e)}return t.eat.call(void 0,r.TokenType.arrow)}e.flowParseArrow=ze;function Be(e,o=!1){if(i.state.tokens[i.state.tokens.length-1].contextualKeyword===n.ContextualKeyword._async&&t.match.call(void 0,r.TokenType.lessThan)){let e=i.state.snapshot();if(Ve()&&!i.state.error)return;i.state.restoreFromSnapshot(e)}a.baseParseSubscripts.call(void 0,e,o)}e.flowParseSubscripts=Be;function Ve(){i.state.scopeDepth++;let e=i.state.tokens.length;return o.parseFunctionParams.call(void 0),a.parseArrow.call(void 0)?(a.parseArrowExpression.call(void 0,e),!0):!1}function He(){s.expectContextual.call(void 0,n.ContextualKeyword._enum),i.state.tokens[i.state.tokens.length-1].type=r.TokenType._enum,a.parseIdentifier.call(void 0),Ue()}function Ue(){s.eatContextual.call(void 0,n.ContextualKeyword._of)&&t.next.call(void 0),s.expect.call(void 0,r.TokenType.braceL),We(),s.expect.call(void 0,r.TokenType.braceR)}function We(){for(;!t.match.call(void 0,r.TokenType.braceR)&&!i.state.error&&!t.eat.call(void 0,r.TokenType.ellipsis);)Ge(),t.match.call(void 0,r.TokenType.braceR)||s.expect.call(void 0,r.TokenType.comma)}function Ge(){a.parseIdentifier.call(void 0),t.eat.call(void 0,r.TokenType.eq)&&t.next.call(void 0)}})),nx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ix(),n=tx(),r=Zb(),i=Ob(),a=yb(),o=bb(),s=q(),c=xb(),l=Sb(),u=ex(),d=Xb(),f=Cb();function p(){if(se(s.TokenType.eof),l.state.scopes.push(new o.Scope(0,l.state.tokens.length,!0)),l.state.scopeDepth!==0)throw Error(`Invalid scope depth at end of file: ${l.state.scopeDepth}`);return new t.File(l.state.tokens,l.state.scopes)}e.parseTopLevel=p;function m(e){l.isFlowEnabled&&n.flowTryParseStatement.call(void 0)||(i.match.call(void 0,s.TokenType.at)&&_(),h(e))}e.parseStatement=m;function h(e){if(l.isTypeScriptEnabled&&r.tsTryParseStatementContent.call(void 0))return;let t=l.state.type;switch(t){case s.TokenType._break:case s.TokenType._continue:x();return;case s.TokenType._debugger:S();return;case s.TokenType._do:C();return;case s.TokenType._for:w();return;case s.TokenType._function:if(i.lookaheadType.call(void 0)===s.TokenType.dot)break;e||f.unexpected.call(void 0),ee();return;case s.TokenType._class:e||f.unexpected.call(void 0),me(!0);return;case s.TokenType._if:te();return;case s.TokenType._return:ne();return;case s.TokenType._switch:re();return;case s.TokenType._throw:D();return;case s.TokenType._try:ae();return;case s.TokenType._let:case s.TokenType._const:e||f.unexpected.call(void 0);case s.TokenType._var:O(t!==s.TokenType._var);return;case s.TokenType._while:k();return;case s.TokenType.braceL:M();return;case s.TokenType.semi:A();return;case s.TokenType._export:case s.TokenType._import:{let e=i.lookaheadType.call(void 0);if(e===s.TokenType.parenL||e===s.TokenType.dot)break;i.next.call(void 0),t===s.TokenType._import?Le():Ce();return}case s.TokenType.name:if(l.state.contextualKeyword===a.ContextualKeyword._async){let e=l.state.start,t=l.state.snapshot();if(i.next.call(void 0),i.match.call(void 0,s.TokenType._function)&&!f.canInsertSemicolon.call(void 0)){f.expect.call(void 0,s.TokenType._function),fe(e,!0);return}l.state.restoreFromSnapshot(t)}else if(l.state.contextualKeyword===a.ContextualKeyword._using&&!f.hasFollowingLineBreak.call(void 0)&&i.lookaheadType.call(void 0)===s.TokenType.name){O(!0);return}else if(g()){f.expectContextual.call(void 0,a.ContextualKeyword._await),O(!0);return}}let n=l.state.tokens.length;u.parseExpression.call(void 0);let o=null;if(l.state.tokens.length===n+1){let e=l.state.tokens[l.state.tokens.length-1];e.type===s.TokenType.name&&(o=e.contextualKeyword)}o==null?f.semicolon.call(void 0):i.eat.call(void 0,s.TokenType.colon)?oe():j(o)}function g(){if(!f.isContextual.call(void 0,a.ContextualKeyword._await))return!1;let e=l.state.snapshot();return i.next.call(void 0),!f.isContextual.call(void 0,a.ContextualKeyword._using)||f.hasPrecedingLineBreak.call(void 0)||(i.next.call(void 0),!i.match.call(void 0,s.TokenType.name)||f.hasPrecedingLineBreak.call(void 0))?(l.state.restoreFromSnapshot(e),!1):(l.state.restoreFromSnapshot(e),!0)}function _(){for(;i.match.call(void 0,s.TokenType.at);)v()}e.parseDecorators=_;function v(){if(i.next.call(void 0),i.eat.call(void 0,s.TokenType.parenL))u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.parenR);else{for(u.parseIdentifier.call(void 0);i.eat.call(void 0,s.TokenType.dot);)u.parseIdentifier.call(void 0);y()}}function y(){l.isTypeScriptEnabled?r.tsParseMaybeDecoratorArguments.call(void 0):b()}function b(){i.eat.call(void 0,s.TokenType.parenL)&&u.parseCallExpressionArguments.call(void 0)}e.baseParseMaybeDecoratorArguments=b;function x(){i.next.call(void 0),f.isLineTerminator.call(void 0)||(u.parseIdentifier.call(void 0),f.semicolon.call(void 0))}function S(){i.next.call(void 0),f.semicolon.call(void 0)}function C(){i.next.call(void 0),m(!1),f.expect.call(void 0,s.TokenType._while),u.parseParenExpression.call(void 0),i.eat.call(void 0,s.TokenType.semi)}function w(){l.state.scopeDepth++;let e=l.state.tokens.length;E();let t=l.state.tokens.length;l.state.scopes.push(new o.Scope(e,t,!1)),l.state.scopeDepth--}function T(){return!(!f.isContextual.call(void 0,a.ContextualKeyword._using)||f.isLookaheadContextual.call(void 0,a.ContextualKeyword._of))}function E(){i.next.call(void 0);let e=!1;if(f.isContextual.call(void 0,a.ContextualKeyword._await)&&(e=!0,i.next.call(void 0)),f.expect.call(void 0,s.TokenType.parenL),i.match.call(void 0,s.TokenType.semi)){e&&f.unexpected.call(void 0),ce();return}let t=g();if(t||i.match.call(void 0,s.TokenType._var)||i.match.call(void 0,s.TokenType._let)||i.match.call(void 0,s.TokenType._const)||T()){if(t&&f.expectContextual.call(void 0,a.ContextualKeyword._await),i.next.call(void 0),ue(!0,l.state.type!==s.TokenType._var),i.match.call(void 0,s.TokenType._in)||f.isContextual.call(void 0,a.ContextualKeyword._of)){le(e);return}ce()}else u.parseExpression.call(void 0,!0),i.match.call(void 0,s.TokenType._in)||f.isContextual.call(void 0,a.ContextualKeyword._of)?le(e):(e&&f.unexpected.call(void 0),ce())}function ee(){let e=l.state.start;i.next.call(void 0),fe(e,!0)}function te(){i.next.call(void 0),u.parseParenExpression.call(void 0),m(!1),i.eat.call(void 0,s.TokenType._else)&&m(!1)}function ne(){i.next.call(void 0),f.isLineTerminator.call(void 0)||(u.parseExpression.call(void 0),f.semicolon.call(void 0))}function re(){i.next.call(void 0),u.parseParenExpression.call(void 0),l.state.scopeDepth++;let e=l.state.tokens.length;for(f.expect.call(void 0,s.TokenType.braceL);!i.match.call(void 0,s.TokenType.braceR)&&!l.state.error;)if(i.match.call(void 0,s.TokenType._case)||i.match.call(void 0,s.TokenType._default)){let e=i.match.call(void 0,s.TokenType._case);i.next.call(void 0),e&&u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.colon)}else m(!0);i.next.call(void 0);let t=l.state.tokens.length;l.state.scopes.push(new o.Scope(e,t,!1)),l.state.scopeDepth--}function D(){i.next.call(void 0),u.parseExpression.call(void 0),f.semicolon.call(void 0)}function ie(){d.parseBindingAtom.call(void 0,!0),l.isTypeScriptEnabled&&r.tsTryParseTypeAnnotation.call(void 0)}function ae(){if(i.next.call(void 0),M(),i.match.call(void 0,s.TokenType._catch)){i.next.call(void 0);let e=null;if(i.match.call(void 0,s.TokenType.parenL)&&(l.state.scopeDepth++,e=l.state.tokens.length,f.expect.call(void 0,s.TokenType.parenL),ie(),f.expect.call(void 0,s.TokenType.parenR)),M(),e!=null){let t=l.state.tokens.length;l.state.scopes.push(new o.Scope(e,t,!1)),l.state.scopeDepth--}}i.eat.call(void 0,s.TokenType._finally)&&M()}function O(e){i.next.call(void 0),ue(!1,e),f.semicolon.call(void 0)}e.parseVarStatement=O;function k(){i.next.call(void 0),u.parseParenExpression.call(void 0),m(!1)}function A(){i.next.call(void 0)}function oe(){m(!0)}function j(e){l.isTypeScriptEnabled?r.tsParseIdentifierStatement.call(void 0,e):l.isFlowEnabled?n.flowParseIdentifierStatement.call(void 0,e):f.semicolon.call(void 0)}function M(e=!1,t=0){let n=l.state.tokens.length;l.state.scopeDepth++,f.expect.call(void 0,s.TokenType.braceL),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t),se(s.TokenType.braceR),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t);let r=l.state.tokens.length;l.state.scopes.push(new o.Scope(n,r,e)),l.state.scopeDepth--}e.parseBlock=M;function se(e){for(;!i.eat.call(void 0,e)&&!l.state.error;)m(!0)}e.parseBlockBody=se;function ce(){f.expect.call(void 0,s.TokenType.semi),i.match.call(void 0,s.TokenType.semi)||u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.semi),i.match.call(void 0,s.TokenType.parenR)||u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.parenR),m(!1)}function le(e){e?f.eatContextual.call(void 0,a.ContextualKeyword._of):i.next.call(void 0),u.parseExpression.call(void 0),f.expect.call(void 0,s.TokenType.parenR),m(!1)}function ue(e,t){for(;;){if(de(t),i.eat.call(void 0,s.TokenType.eq)){let t=l.state.tokens.length-1;u.parseMaybeAssign.call(void 0,e),l.state.tokens[t].rhsEndIndex=l.state.tokens.length}if(!i.eat.call(void 0,s.TokenType.comma))break}}function de(e){d.parseBindingAtom.call(void 0,e),l.isTypeScriptEnabled?r.tsAfterParseVarHead.call(void 0):l.isFlowEnabled&&n.flowAfterParseVarHead.call(void 0)}function fe(e,t,n=!1){i.match.call(void 0,s.TokenType.star)&&i.next.call(void 0),t&&!n&&!i.match.call(void 0,s.TokenType.name)&&!i.match.call(void 0,s.TokenType._yield)&&f.unexpected.call(void 0);let r=null;i.match.call(void 0,s.TokenType.name)&&(t||(r=l.state.tokens.length,l.state.scopeDepth++),d.parseBindingIdentifier.call(void 0,!1));let a=l.state.tokens.length;l.state.scopeDepth++,pe(),u.parseFunctionBodyAndFinish.call(void 0,e);let c=l.state.tokens.length;l.state.scopes.push(new o.Scope(a,c,!0)),l.state.scopeDepth--,r!==null&&(l.state.scopes.push(new o.Scope(r,c,!0)),l.state.scopeDepth--)}e.parseFunction=fe;function pe(e=!1,t=0){l.isTypeScriptEnabled?r.tsStartParseFunctionParams.call(void 0):l.isFlowEnabled&&n.flowStartParseFunctionParams.call(void 0),f.expect.call(void 0,s.TokenType.parenL),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t),d.parseBindingList.call(void 0,s.TokenType.parenR,!1,!1,e,t),t&&(l.state.tokens[l.state.tokens.length-1].contextId=t)}e.parseFunctionParams=pe;function me(e,t=!1){let n=l.getNextContextId.call(void 0);i.next.call(void 0),l.state.tokens[l.state.tokens.length-1].contextId=n,l.state.tokens[l.state.tokens.length-1].isExpression=!e;let r=null;e||(r=l.state.tokens.length,l.state.scopeDepth++),xe(e,t),Se();let a=l.state.tokens.length;if(_e(n),!l.state.error&&(l.state.tokens[a].contextId=n,l.state.tokens[l.state.tokens.length-1].contextId=n,r!==null)){let e=l.state.tokens.length;l.state.scopes.push(new o.Scope(r,e,!1)),l.state.scopeDepth--}}e.parseClass=me;function he(){return i.match.call(void 0,s.TokenType.eq)||i.match.call(void 0,s.TokenType.semi)||i.match.call(void 0,s.TokenType.braceR)||i.match.call(void 0,s.TokenType.bang)||i.match.call(void 0,s.TokenType.colon)}function ge(){return i.match.call(void 0,s.TokenType.parenL)||i.match.call(void 0,s.TokenType.lessThan)}function _e(e){for(f.expect.call(void 0,s.TokenType.braceL);!i.eat.call(void 0,s.TokenType.braceR)&&!l.state.error;){if(i.eat.call(void 0,s.TokenType.semi))continue;if(i.match.call(void 0,s.TokenType.at)){v();continue}let t=l.state.start;N(t,e)}}function N(e,t){l.isTypeScriptEnabled&&r.tsParseModifiers.call(void 0,[a.ContextualKeyword._declare,a.ContextualKeyword._public,a.ContextualKeyword._protected,a.ContextualKeyword._private,a.ContextualKeyword._override]);let n=!1;if(i.match.call(void 0,s.TokenType.name)&&l.state.contextualKeyword===a.ContextualKeyword._static){if(u.parseIdentifier.call(void 0),ge()){F(e,!1);return}if(he()){be();return}if(l.state.tokens[l.state.tokens.length-1].type=s.TokenType._static,n=!0,i.match.call(void 0,s.TokenType.braceL)){l.state.tokens[l.state.tokens.length-1].contextId=t,M();return}}P(e,n,t)}function P(e,t,n){if(l.isTypeScriptEnabled&&r.tsTryParseClassMemberWithIsStatic.call(void 0,t))return;if(i.eat.call(void 0,s.TokenType.star)){ve(n),F(e,!1);return}ve(n);let o=!1,c=l.state.tokens[l.state.tokens.length-1];c.contextualKeyword===a.ContextualKeyword._constructor&&(o=!0),ye(),ge()?F(e,o):he()?be():c.contextualKeyword===a.ContextualKeyword._async&&!f.isLineTerminator.call(void 0)?(l.state.tokens[l.state.tokens.length-1].type=s.TokenType._async,i.match.call(void 0,s.TokenType.star)&&i.next.call(void 0),ve(n),ye(),F(e,!1)):(c.contextualKeyword===a.ContextualKeyword._get||c.contextualKeyword===a.ContextualKeyword._set)&&!(f.isLineTerminator.call(void 0)&&i.match.call(void 0,s.TokenType.star))?(c.contextualKeyword===a.ContextualKeyword._get?l.state.tokens[l.state.tokens.length-1].type=s.TokenType._get:l.state.tokens[l.state.tokens.length-1].type=s.TokenType._set,ve(n),F(e,!1)):c.contextualKeyword===a.ContextualKeyword._accessor&&!f.isLineTerminator.call(void 0)?(ve(n),be()):f.isLineTerminator.call(void 0)?be():f.unexpected.call(void 0)}function F(e,t){l.isTypeScriptEnabled?r.tsTryParseTypeParameters.call(void 0):l.isFlowEnabled&&i.match.call(void 0,s.TokenType.lessThan)&&n.flowParseTypeParameterDeclaration.call(void 0),u.parseMethod.call(void 0,e,t)}function ve(e){u.parsePropertyName.call(void 0,e)}e.parseClassPropertyName=ve;function ye(){if(l.isTypeScriptEnabled){let e=i.pushTypeContext.call(void 0,0);i.eat.call(void 0,s.TokenType.question),i.popTypeContext.call(void 0,e)}}e.parsePostMemberNameModifiers=ye;function be(){if(l.isTypeScriptEnabled?(i.eatTypeToken.call(void 0,s.TokenType.bang),r.tsTryParseTypeAnnotation.call(void 0)):l.isFlowEnabled&&i.match.call(void 0,s.TokenType.colon)&&n.flowParseTypeAnnotation.call(void 0),i.match.call(void 0,s.TokenType.eq)){let e=l.state.tokens.length;i.next.call(void 0),u.parseMaybeAssign.call(void 0),l.state.tokens[e].rhsEndIndex=l.state.tokens.length}f.semicolon.call(void 0)}e.parseClassProperty=be;function xe(e,t=!1){(!l.isTypeScriptEnabled||e&&!t||!f.isContextual.call(void 0,a.ContextualKeyword._implements))&&(i.match.call(void 0,s.TokenType.name)&&d.parseBindingIdentifier.call(void 0,!0),l.isTypeScriptEnabled?r.tsTryParseTypeParameters.call(void 0):l.isFlowEnabled&&i.match.call(void 0,s.TokenType.lessThan)&&n.flowParseTypeParameterDeclaration.call(void 0))}function Se(){let e=!1;i.eat.call(void 0,s.TokenType._extends)?(u.parseExprSubscripts.call(void 0),e=!0):e=!1,l.isTypeScriptEnabled?r.tsAfterParseClassSuper.call(void 0,e):l.isFlowEnabled&&n.flowAfterParseClassSuper.call(void 0,e)}function Ce(){let e=l.state.tokens.length-1;l.isTypeScriptEnabled&&r.tsTryParseExport.call(void 0)||(Oe()?ke():Te()?(u.parseIdentifier.call(void 0),i.match.call(void 0,s.TokenType.comma)&&i.lookaheadType.call(void 0)===s.TokenType.star?(f.expect.call(void 0,s.TokenType.comma),f.expect.call(void 0,s.TokenType.star),f.expectContextual.call(void 0,a.ContextualKeyword._as),u.parseIdentifier.call(void 0)):Ee(),De()):i.eat.call(void 0,s.TokenType._default)?I():Me()?we():(Ne(),De()),l.state.tokens[e].rhsEndIndex=l.state.tokens.length)}e.parseExport=Ce;function I(){if(l.isTypeScriptEnabled&&r.tsTryParseExportDefaultExpression.call(void 0)||l.isFlowEnabled&&n.flowTryParseExportDefaultExpression.call(void 0))return;let e=l.state.start;i.eat.call(void 0,s.TokenType._function)?fe(e,!0,!0):f.isContextual.call(void 0,a.ContextualKeyword._async)&&i.lookaheadType.call(void 0)===s.TokenType._function?(f.eatContextual.call(void 0,a.ContextualKeyword._async),i.eat.call(void 0,s.TokenType._function),fe(e,!0,!0)):i.match.call(void 0,s.TokenType._class)?me(!0,!0):i.match.call(void 0,s.TokenType.at)?(_(),me(!0,!0)):(u.parseMaybeAssign.call(void 0),f.semicolon.call(void 0))}function we(){l.isTypeScriptEnabled?r.tsParseExportDeclaration.call(void 0):l.isFlowEnabled?n.flowParseExportDeclaration.call(void 0):m(!0)}function Te(){if(l.isTypeScriptEnabled&&r.tsIsDeclarationStart.call(void 0)||l.isFlowEnabled&&n.flowShouldDisallowExportDefaultSpecifier.call(void 0))return!1;if(i.match.call(void 0,s.TokenType.name))return l.state.contextualKeyword!==a.ContextualKeyword._async;if(!i.match.call(void 0,s.TokenType._default))return!1;let e=i.nextTokenStart.call(void 0),t=i.lookaheadTypeAndKeyword.call(void 0),o=t.type===s.TokenType.name&&t.contextualKeyword===a.ContextualKeyword._from;if(t.type===s.TokenType.comma)return!0;if(o){let t=l.input.charCodeAt(i.nextTokenStartSince.call(void 0,e+4));return t===c.charCodes.quotationMark||t===c.charCodes.apostrophe}return!1}function Ee(){i.eat.call(void 0,s.TokenType.comma)&&Ne()}function De(){f.eatContextual.call(void 0,a.ContextualKeyword._from)&&(u.parseExprAtom.call(void 0),He()),f.semicolon.call(void 0)}e.parseExportFrom=De;function Oe(){return l.isFlowEnabled?n.flowShouldParseExportStar.call(void 0):i.match.call(void 0,s.TokenType.star)}function ke(){l.isFlowEnabled?n.flowParseExportStar.call(void 0):Ae()}function Ae(){f.expect.call(void 0,s.TokenType.star),f.isContextual.call(void 0,a.ContextualKeyword._as)?je():De()}e.baseParseExportStar=Ae;function je(){i.next.call(void 0),l.state.tokens[l.state.tokens.length-1].type=s.TokenType._as,u.parseIdentifier.call(void 0),Ee(),De()}function Me(){return l.isTypeScriptEnabled&&r.tsIsDeclarationStart.call(void 0)||l.isFlowEnabled&&n.flowShouldParseExportDeclaration.call(void 0)||l.state.type===s.TokenType._var||l.state.type===s.TokenType._const||l.state.type===s.TokenType._let||l.state.type===s.TokenType._function||l.state.type===s.TokenType._class||f.isContextual.call(void 0,a.ContextualKeyword._async)||i.match.call(void 0,s.TokenType.at)}function Ne(){let e=!0;for(f.expect.call(void 0,s.TokenType.braceL);!i.eat.call(void 0,s.TokenType.braceR)&&!l.state.error;){if(e)e=!1;else if(f.expect.call(void 0,s.TokenType.comma),i.eat.call(void 0,s.TokenType.braceR))break;Pe()}}e.parseExportSpecifiers=Ne;function Pe(){l.isTypeScriptEnabled?r.tsParseExportSpecifier.call(void 0):(u.parseIdentifier.call(void 0),l.state.tokens[l.state.tokens.length-1].identifierRole=i.IdentifierRole.ExportAccess,f.eatContextual.call(void 0,a.ContextualKeyword._as)&&u.parseIdentifier.call(void 0))}function Fe(){let e=l.state.snapshot();return f.expectContextual.call(void 0,a.ContextualKeyword._module),f.eatContextual.call(void 0,a.ContextualKeyword._from)?f.isContextual.call(void 0,a.ContextualKeyword._from)?(l.state.restoreFromSnapshot(e),!0):(l.state.restoreFromSnapshot(e),!1):i.match.call(void 0,s.TokenType.comma)?(l.state.restoreFromSnapshot(e),!1):(l.state.restoreFromSnapshot(e),!0)}function Ie(){f.isContextual.call(void 0,a.ContextualKeyword._module)&&Fe()&&i.next.call(void 0)}function Le(){if(l.isTypeScriptEnabled&&i.match.call(void 0,s.TokenType.name)&&i.lookaheadType.call(void 0)===s.TokenType.eq)r.tsParseImportEqualsDeclaration.call(void 0);else{if(l.isTypeScriptEnabled&&f.isContextual.call(void 0,a.ContextualKeyword._type)){let e=i.lookaheadTypeAndKeyword.call(void 0);if(e.type===s.TokenType.name&&e.contextualKeyword!==a.ContextualKeyword._from){if(f.expectContextual.call(void 0,a.ContextualKeyword._type),i.lookaheadType.call(void 0)===s.TokenType.eq){r.tsParseImportEqualsDeclaration.call(void 0);return}}else(e.type===s.TokenType.star||e.type===s.TokenType.braceL)&&f.expectContextual.call(void 0,a.ContextualKeyword._type)}i.match.call(void 0,s.TokenType.string)||(Ie(),Be(),f.expectContextual.call(void 0,a.ContextualKeyword._from)),u.parseExprAtom.call(void 0),He(),f.semicolon.call(void 0)}}e.parseImport=Le;function Re(){return i.match.call(void 0,s.TokenType.name)}function ze(){d.parseImportedIdentifier.call(void 0)}function Be(){l.isFlowEnabled&&n.flowStartParseImportSpecifiers.call(void 0);let e=!0;if(!(Re()&&(ze(),!i.eat.call(void 0,s.TokenType.comma)))){if(i.match.call(void 0,s.TokenType.star))i.next.call(void 0),f.expectContextual.call(void 0,a.ContextualKeyword._as),ze();else for(f.expect.call(void 0,s.TokenType.braceL);!i.eat.call(void 0,s.TokenType.braceR)&&!l.state.error;){if(e)e=!1;else if(i.eat.call(void 0,s.TokenType.colon)&&f.unexpected.call(void 0,`ES2015 named imports do not destructure. Use another statement for destructuring after the import.`),f.expect.call(void 0,s.TokenType.comma),i.eat.call(void 0,s.TokenType.braceR))break;Ve()}}}function Ve(){l.isTypeScriptEnabled?r.tsParseImportSpecifier.call(void 0):l.isFlowEnabled?n.flowParseImportSpecifier.call(void 0):(d.parseImportedIdentifier.call(void 0),f.isContextual.call(void 0,a.ContextualKeyword._as)&&(l.state.tokens[l.state.tokens.length-1].identifierRole=i.IdentifierRole.ImportAccess,i.next.call(void 0),d.parseImportedIdentifier.call(void 0)))}function He(){(i.match.call(void 0,s.TokenType._with)||f.isContextual.call(void 0,a.ContextualKeyword._assert)&&!f.hasPrecedingLineBreak.call(void 0))&&(i.next.call(void 0),u.parseObj.call(void 0,!1,!1))}})),rx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ob(),n=xb(),r=Sb(),i=nx();function a(){return r.state.pos===0&&r.input.charCodeAt(0)===n.charCodes.numberSign&&r.input.charCodeAt(1)===n.charCodes.exclamationMark&&t.skipLineComment.call(void 0,2),t.nextToken.call(void 0),i.parseTopLevel.call(void 0)}e.parseFile=a})),ix=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Sb(),n=rx();e.File=class{constructor(e,t){this.tokens=e,this.scopes=t}};function r(e,r,i,a){if(a&&i)throw Error(`Cannot combine flow and typescript plugins.`);t.initParser.call(void 0,e,r,i,a);let o=n.parseFile.call(void 0);if(t.state.error)throw t.augmentError.call(void 0,t.state.error);return o}e.parse=r})),ax=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=yb();function n(e){let n=e.currentIndex(),r=0,i=e.currentToken();do{let a=e.tokens[n];if(a.isOptionalChainStart&&r++,a.isOptionalChainEnd&&r--,r+=a.numNullishCoalesceStarts,r-=a.numNullishCoalesceEnds,a.contextualKeyword===t.ContextualKeyword._await&&a.identifierRole==null&&a.scopeDepth===i.scopeDepth)return!0;n+=1}while(r>0&&n<e.tokens.length);return!1}e.default=n})),ox=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=q(),r=t(ax());e.default=class e{__init(){this.resultCode=``}__init2(){this.resultMappings=Array(this.tokens.length)}__init3(){this.tokenIndex=0}constructor(t,n,r,i,a){this.code=t,this.tokens=n,this.isFlowEnabled=r,this.disableESTransforms=i,this.helperManager=a,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this)}snapshot(){return{resultCode:this.resultCode,tokenIndex:this.tokenIndex}}restoreToSnapshot(e){this.resultCode=e.resultCode,this.tokenIndex=e.tokenIndex}dangerouslyGetAndRemoveCodeSinceSnapshot(e){let t=this.resultCode.slice(e.resultCode.length);return this.resultCode=e.resultCode,t}reset(){this.resultCode=``,this.resultMappings=Array(this.tokens.length),this.tokenIndex=0}matchesContextualAtIndex(e,t){return this.matches1AtIndex(e,n.TokenType.name)&&this.tokens[e].contextualKeyword===t}identifierNameAtIndex(e){return this.identifierNameForToken(this.tokens[e])}identifierNameAtRelativeIndex(e){return this.identifierNameForToken(this.tokenAtRelativeIndex(e))}identifierName(){return this.identifierNameForToken(this.currentToken())}identifierNameForToken(e){return this.code.slice(e.start,e.end)}rawCodeForToken(e){return this.code.slice(e.start,e.end)}stringValueAtIndex(e){return this.stringValueForToken(this.tokens[e])}stringValue(){return this.stringValueForToken(this.currentToken())}stringValueForToken(e){return this.code.slice(e.start+1,e.end-1)}matches1AtIndex(e,t){return this.tokens[e].type===t}matches2AtIndex(e,t,n){return this.tokens[e].type===t&&this.tokens[e+1].type===n}matches3AtIndex(e,t,n,r){return this.tokens[e].type===t&&this.tokens[e+1].type===n&&this.tokens[e+2].type===r}matches1(e){return this.tokens[this.tokenIndex].type===e}matches2(e,t){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t}matches3(e,t,n){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t&&this.tokens[this.tokenIndex+2].type===n}matches4(e,t,n,r){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t&&this.tokens[this.tokenIndex+2].type===n&&this.tokens[this.tokenIndex+3].type===r}matches5(e,t,n,r,i){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===t&&this.tokens[this.tokenIndex+2].type===n&&this.tokens[this.tokenIndex+3].type===r&&this.tokens[this.tokenIndex+4].type===i}matchesContextual(e){return this.matchesContextualAtIndex(this.tokenIndex,e)}matchesContextIdAndLabel(e,t){return this.matches1(e)&&this.currentToken().contextId===t}previousWhitespaceAndComments(){let e=this.code.slice(this.tokenIndex>0?this.tokens[this.tokenIndex-1].end:0,this.tokenIndex<this.tokens.length?this.tokens[this.tokenIndex].start:this.code.length);return this.isFlowEnabled&&(e=e.replace(/@flow/g,``)),e}replaceToken(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}replaceTokenTrimmingLeftWhitespace(e){this.resultCode+=this.previousWhitespaceAndComments().replace(/[^\r\n]/g,``),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}removeInitialToken(){this.replaceToken(``)}removeToken(){this.replaceTokenTrimmingLeftWhitespace(``)}removeBalancedCode(){let e=0;for(;!this.isAtEnd();){if(this.matches1(n.TokenType.braceL))e++;else if(this.matches1(n.TokenType.braceR)){if(e===0)return;e--}this.removeToken()}}copyExpectedToken(e){if(this.tokens[this.tokenIndex].type!==e)throw Error(`Expected token ${e}`);this.copyToken()}copyToken(){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}copyTokenWithPrefix(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultCode+=e,this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}appendTokenPrefix(){let e=this.currentToken();if((e.numNullishCoalesceStarts||e.isOptionalChainStart)&&(e.isAsyncOperation=r.default.call(void 0,this)),!this.disableESTransforms){if(e.numNullishCoalesceStarts)for(let t=0;t<e.numNullishCoalesceStarts;t++)e.isAsyncOperation?(this.resultCode+=`await `,this.resultCode+=this.helperManager.getHelperName(`asyncNullishCoalesce`)):this.resultCode+=this.helperManager.getHelperName(`nullishCoalesce`),this.resultCode+=`(`;e.isOptionalChainStart&&(e.isAsyncOperation&&(this.resultCode+=`await `),this.tokenIndex>0&&this.tokenAtRelativeIndex(-1).type===n.TokenType._delete?e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName(`asyncOptionalChainDelete`):this.resultCode+=this.helperManager.getHelperName(`optionalChainDelete`):e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName(`asyncOptionalChain`):this.resultCode+=this.helperManager.getHelperName(`optionalChain`),this.resultCode+=`([`)}}appendTokenSuffix(){let e=this.currentToken();if(e.isOptionalChainEnd&&!this.disableESTransforms&&(this.resultCode+=`])`),e.numNullishCoalesceEnds&&!this.disableESTransforms)for(let t=0;t<e.numNullishCoalesceEnds;t++)this.resultCode+=`))`}appendCode(e){this.resultCode+=e}currentToken(){return this.tokens[this.tokenIndex]}currentTokenCode(){let e=this.currentToken();return this.code.slice(e.start,e.end)}tokenAtRelativeIndex(e){return this.tokens[this.tokenIndex+e]}currentIndex(){return this.tokenIndex}nextToken(){if(this.tokenIndex===this.tokens.length)throw Error(`Unexpectedly reached end of input.`);this.tokenIndex++}previousToken(){this.tokenIndex--}finish(){if(this.tokenIndex!==this.tokens.length)throw Error(`Tried to finish processing tokens before reaching the end.`);return this.resultCode+=this.previousWhitespaceAndComments(),{code:this.resultCode,mappings:this.resultMappings}}isAtEnd(){return this.tokenIndex===this.tokens.length}}})),sx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=yb(),n=q();function r(e,r,l,u){let d=r.snapshot(),f=a(r),p=[],m=[],h=[],g=null,_=[],v=[],y=r.currentToken().contextId;if(y==null)throw Error(`Expected non-null class context ID on class open-brace.`);for(r.nextToken();!r.matchesContextIdAndLabel(n.TokenType.braceR,y);)if(r.matchesContextual(t.ContextualKeyword._constructor)&&!r.currentToken().isType)({constructorInitializerStatements:p,constructorInsertPos:g}=o(r));else if(r.matches1(n.TokenType.semi))u||v.push({start:r.currentIndex(),end:r.currentIndex()+1}),r.nextToken();else if(r.currentToken().isType)r.nextToken();else{let a=r.currentIndex(),d=!1,f=!1,b=!1;for(;s(r.currentToken());)r.matches1(n.TokenType._static)&&(d=!0),r.matches1(n.TokenType.hash)&&(f=!0),(r.matches1(n.TokenType._declare)||r.matches1(n.TokenType._abstract))&&(b=!0),r.nextToken();if(d&&r.matches1(n.TokenType.braceL)||f){i(r,y);continue}if(r.matchesContextual(t.ContextualKeyword._constructor)&&!r.currentToken().isType){({constructorInitializerStatements:p,constructorInsertPos:g}=o(r));continue}let x=r.currentIndex();if(c(r),r.matches1(n.TokenType.lessThan)||r.matches1(n.TokenType.parenL)){i(r,y);continue}for(;r.currentToken().isType;)r.nextToken();if(r.matches1(n.TokenType.eq)){let t=r.currentIndex(),n=r.currentToken().rhsEndIndex;if(n==null)throw Error(`Expected rhsEndIndex on class field assignment.`);for(r.nextToken();r.currentIndex()<n;)e.processToken();let i;d?(i=l.claimFreeName(`__initStatic`),h.push(i)):(i=l.claimFreeName(`__init`),m.push(i)),_.push({initializerName:i,equalsIndex:t,start:x,end:r.currentIndex()})}else(!u||b)&&v.push({start:a,end:r.currentIndex()})}return r.restoreToSnapshot(d),u?{headerInfo:f,constructorInitializerStatements:p,instanceInitializerNames:[],staticInitializerNames:[],constructorInsertPos:g,fields:[],rangesToRemove:v}:{headerInfo:f,constructorInitializerStatements:p,instanceInitializerNames:m,staticInitializerNames:h,constructorInsertPos:g,fields:_,rangesToRemove:v}}e.default=r;function i(e,t){for(e.nextToken();e.currentToken().contextId!==t;)e.nextToken();for(;s(e.tokenAtRelativeIndex(-1));)e.previousToken()}function a(e){let t=e.currentToken(),r=t.contextId;if(r==null)throw Error(`Expected context ID on class token.`);let i=t.isExpression;if(i==null)throw Error(`Expected isExpression on class token.`);let a=null,o=!1;for(e.nextToken(),e.matches1(n.TokenType.name)&&(a=e.identifierName());!e.matchesContextIdAndLabel(n.TokenType.braceL,r);)e.matches1(n.TokenType._extends)&&!e.currentToken().isType&&(o=!0),e.nextToken();return{isExpression:i,className:a,hasSuperclass:o}}function o(e){let t=[];e.nextToken();let r=e.currentToken().contextId;if(r==null)throw Error(`Expected context ID on open-paren starting constructor params.`);for(;!e.matchesContextIdAndLabel(n.TokenType.parenR,r);)if(e.currentToken().contextId===r){if(e.nextToken(),s(e.currentToken())){for(e.nextToken();s(e.currentToken());)e.nextToken();let r=e.currentToken();if(r.type!==n.TokenType.name)throw Error(`Expected identifier after access modifiers in constructor arg.`);let i=e.identifierNameForToken(r);t.push(`this.${i} = ${i}`)}}else e.nextToken();for(e.nextToken();e.currentToken().isType;)e.nextToken();let i=e.currentIndex(),a=!1;for(;!e.matchesContextIdAndLabel(n.TokenType.braceR,r);){if(!a&&e.matches2(n.TokenType._super,n.TokenType.parenL)){e.nextToken();let t=e.currentToken().contextId;if(t==null)throw Error(`Expected a context ID on the super call`);for(;!e.matchesContextIdAndLabel(n.TokenType.parenR,t);)e.nextToken();i=e.currentIndex(),a=!0}e.nextToken()}return e.nextToken(),{constructorInitializerStatements:t,constructorInsertPos:i}}function s(e){return[n.TokenType._async,n.TokenType._get,n.TokenType._set,n.TokenType.plus,n.TokenType.minus,n.TokenType._readonly,n.TokenType._static,n.TokenType._public,n.TokenType._private,n.TokenType._protected,n.TokenType._override,n.TokenType._abstract,n.TokenType.star,n.TokenType._declare,n.TokenType.hash].includes(e.type)}function c(e){if(e.matches1(n.TokenType.bracketL)){let t=e.currentToken().contextId;if(t==null)throw Error(`Expected class context ID on computed name open bracket.`);for(;!e.matchesContextIdAndLabel(n.TokenType.bracketR,t);)e.nextToken();e.nextToken()}else e.nextToken()}})),cx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=q();function n(e){if(e.removeInitialToken(),e.removeToken(),e.removeToken(),e.removeToken(),e.matches1(t.TokenType.parenL))e.removeToken(),e.removeToken(),e.removeToken();else for(;e.matches1(t.TokenType.dot);)e.removeToken(),e.removeToken()}e.default=n})),lx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ob(),n=q();e.EMPTY_DECLARATION_INFO={typeDeclarations:/* @__PURE__ */ new Set,valueDeclarations:/* @__PURE__ */ new Set};function r(e){let r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set;for(let a=0;a<e.tokens.length;a++){let o=e.tokens[a];o.type===n.TokenType.name&&t.isTopLevelDeclaration.call(void 0,o)&&(o.isType?r.add(e.identifierNameForToken(o)):i.add(e.identifierNameForToken(o)))}return{typeDeclarations:r,valueDeclarations:i}}e.default=r})),ux=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=yb(),n=q();function r(e){let r=e.currentIndex();for(;!e.matches1AtIndex(r,n.TokenType.braceR);)r++;return e.matchesContextualAtIndex(r+1,t.ContextualKeyword._from)&&e.matches1AtIndex(r+2,n.TokenType.string)}e.default=r})),dx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=yb(),n=q();function r(e){(e.matches2(n.TokenType._with,n.TokenType.braceL)||e.matches2(n.TokenType.name,n.TokenType.braceL)&&e.matchesContextual(t.ContextualKeyword._assert))&&(e.removeToken(),e.removeToken(),e.removeBalancedCode(),e.removeToken())}e.removeMaybeImportAttributes=r})),fx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=q();function n(e,n,r,i){if(!e||n)return!1;let a=r.currentToken();if(a.rhsEndIndex==null)throw Error(`Expected non-null rhsEndIndex on export token.`);let o=a.rhsEndIndex-r.currentIndex();if(o!==3&&!(o===4&&r.matches1AtIndex(a.rhsEndIndex-1,t.TokenType.semi)))return!1;let s=r.tokenAtRelativeIndex(2);if(s.type!==t.TokenType.name)return!1;let c=r.identifierNameForToken(s);return i.typeDeclarations.has(c)&&!i.valueDeclarations.has(c)}e.default=n})),px=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=Ob(),r=yb(),i=q(),a=t(cx()),o=lx(),s=t(o),c=t(kb()),l=t(ux()),u=dx(),d=t(fx()),f=t(Mb());e.default=class e extends f.default{__init(){this.hadExport=!1}__init2(){this.hadNamedExport=!1}__init3(){this.hadDefaultExport=!1}constructor(t,n,r,i,a,c,l,u,d,f,p,m){super(),this.rootTransformer=t,this.tokens=n,this.importProcessor=r,this.nameManager=i,this.helperManager=a,this.reactHotLoaderTransformer=c,this.enableLegacyBabel5ModuleInterop=l,this.enableLegacyTypeScriptModuleInterop=u,this.isTypeScriptTransformEnabled=d,this.isFlowTransformEnabled=f,this.preserveDynamicImport=p,this.keepUnusedImports=m,e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),this.declarationInfo=d?s.default.call(void 0,n):o.EMPTY_DECLARATION_INFO}getPrefixCode(){let e=``;return this.hadExport&&(e+=`Object.defineProperty(exports, "__esModule", {value: true});`),e}getSuffixCode(){return this.enableLegacyBabel5ModuleInterop&&this.hadDefaultExport&&!this.hadNamedExport?`
|
|
370
|
+
module.exports = exports.default;
|
|
371
|
+
`:``}process(){return this.tokens.matches3(i.TokenType._import,i.TokenType.name,i.TokenType.eq)?this.processImportEquals():this.tokens.matches1(i.TokenType._import)?(this.processImport(),!0):this.tokens.matches2(i.TokenType._export,i.TokenType.eq)?(this.tokens.replaceToken(`module.exports`),!0):this.tokens.matches1(i.TokenType._export)&&!this.tokens.currentToken().isType?(this.hadExport=!0,this.processExport()):this.tokens.matches2(i.TokenType.name,i.TokenType.postIncDec)&&this.processPostIncDec()?!0:this.tokens.matches1(i.TokenType.name)||this.tokens.matches1(i.TokenType.jsxName)?this.processIdentifier():this.tokens.matches1(i.TokenType.eq)?this.processAssignment():this.tokens.matches1(i.TokenType.assign)?this.processComplexAssignment():this.tokens.matches1(i.TokenType.preIncDec)?this.processPreIncDec():!1}processImportEquals(){let e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(e)?a.default.call(void 0,this.tokens):this.tokens.replaceToken(`const`),!0}processImport(){if(this.tokens.matches2(i.TokenType._import,i.TokenType.parenL)){if(this.preserveDynamicImport){this.tokens.copyToken();return}let e=this.enableLegacyTypeScriptModuleInterop?``:`${this.helperManager.getHelperName(`interopRequireWildcard`)}(`;this.tokens.replaceToken(`Promise.resolve().then(() => ${e}require`);let t=this.tokens.currentToken().contextId;if(t==null)throw Error(`Expected context ID on dynamic import invocation.`);for(this.tokens.copyToken();!this.tokens.matchesContextIdAndLabel(i.TokenType.parenR,t);)this.rootTransformer.processToken();this.tokens.replaceToken(e?`)))`:`))`)}else{if(this.removeImportAndDetectIfShouldElide())this.tokens.removeToken();else{let e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),this.tokens.appendCode(this.importProcessor.claimImportCode(e))}u.removeMaybeImportAttributes.call(void 0,this.tokens),this.tokens.matches1(i.TokenType.semi)&&this.tokens.removeToken()}}removeImportAndDetectIfShouldElide(){if(this.tokens.removeInitialToken(),this.tokens.matchesContextual(r.ContextualKeyword._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,i.TokenType.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,r.ContextualKeyword._from))return this.removeRemainingImport(),!0;if(this.tokens.matches1(i.TokenType.name)||this.tokens.matches1(i.TokenType.star))return this.removeRemainingImport(),!1;if(this.tokens.matches1(i.TokenType.string))return!1;let e=!1,t=!1;for(;!this.tokens.matches1(i.TokenType.string);)(!e&&this.tokens.matches1(i.TokenType.braceL)||this.tokens.matches1(i.TokenType.comma))&&(this.tokens.removeToken(),this.tokens.matches1(i.TokenType.braceR)||(t=!0),(this.tokens.matches2(i.TokenType.name,i.TokenType.comma)||this.tokens.matches2(i.TokenType.name,i.TokenType.braceR)||this.tokens.matches4(i.TokenType.name,i.TokenType.name,i.TokenType.name,i.TokenType.comma)||this.tokens.matches4(i.TokenType.name,i.TokenType.name,i.TokenType.name,i.TokenType.braceR))&&(e=!0)),this.tokens.removeToken();return this.keepUnusedImports?!1:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?t&&!e:!1}removeRemainingImport(){for(;!this.tokens.matches1(i.TokenType.string);)this.tokens.removeToken()}processIdentifier(){let e=this.tokens.currentToken();if(e.shadowsGlobal)return!1;if(e.identifierRole===n.IdentifierRole.ObjectShorthand)return this.processObjectShorthand();if(e.identifierRole!==n.IdentifierRole.Access)return!1;let t=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(e));if(!t)return!1;let r=this.tokens.currentIndex()+1;for(;r<this.tokens.tokens.length&&this.tokens.tokens[r].type===i.TokenType.parenR;)r++;return this.tokens.tokens[r].type===i.TokenType.parenL?this.tokens.tokenAtRelativeIndex(1).type===i.TokenType.parenL&&this.tokens.tokenAtRelativeIndex(-1).type!==i.TokenType._new?(this.tokens.replaceToken(`${t}.call(void 0, `),this.tokens.removeToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR)):this.tokens.replaceToken(`(0, ${t})`):this.tokens.replaceToken(t),!0}processObjectShorthand(){let e=this.tokens.identifierName(),t=this.importProcessor.getIdentifierReplacement(e);return t?(this.tokens.replaceToken(`${e}: ${t}`),!0):!1}processExport(){if(this.tokens.matches2(i.TokenType._export,i.TokenType._enum)||this.tokens.matches3(i.TokenType._export,i.TokenType._const,i.TokenType._enum))return this.hadNamedExport=!0,!1;if(this.tokens.matches2(i.TokenType._export,i.TokenType._default))return this.tokens.matches3(i.TokenType._export,i.TokenType._default,i.TokenType._enum)?(this.hadDefaultExport=!0,!1):(this.processExportDefault(),!0);if(this.tokens.matches2(i.TokenType._export,i.TokenType.braceL))return this.processExportBindings(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,r.ContextualKeyword._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(i.TokenType.braceL)){for(;!this.tokens.matches1(i.TokenType.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(i.TokenType._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(r.ContextualKeyword._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,i.TokenType.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens)),!0}if(this.hadNamedExport=!0,this.tokens.matches2(i.TokenType._export,i.TokenType._var)||this.tokens.matches2(i.TokenType._export,i.TokenType._let)||this.tokens.matches2(i.TokenType._export,i.TokenType._const))return this.processExportVar(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType._function)||this.tokens.matches3(i.TokenType._export,i.TokenType.name,i.TokenType._function))return this.processExportFunction(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType._class)||this.tokens.matches3(i.TokenType._export,i.TokenType._abstract,i.TokenType._class)||this.tokens.matches2(i.TokenType._export,i.TokenType.at))return this.processExportClass(),!0;if(this.tokens.matches2(i.TokenType._export,i.TokenType.star))return this.processExportStar(),!0;throw Error(`Unrecognized export syntax.`)}processAssignment(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e-1];if(t.isType||t.type!==i.TokenType.name||t.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,i.TokenType.dot)||e>=2&&[i.TokenType._var,i.TokenType._let,i.TokenType._const].includes(this.tokens.tokens[e-2].type))return!1;let n=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(t));return n?(this.tokens.copyToken(),this.tokens.appendCode(` ${n} =`),!0):!1}processComplexAssignment(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e-1];if(t.type!==i.TokenType.name||t.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,i.TokenType.dot))return!1;let n=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(t));return n?(this.tokens.appendCode(` = ${n}`),this.tokens.copyToken(),!0):!1}processPreIncDec(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e+1];if(t.type!==i.TokenType.name||t.shadowsGlobal||e+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(e+2,i.TokenType.dot)||this.tokens.matches1AtIndex(e+2,i.TokenType.bracketL)||this.tokens.matches1AtIndex(e+2,i.TokenType.parenL)))return!1;let n=this.tokens.identifierNameForToken(t),r=this.importProcessor.resolveExportBinding(n);return r?(this.tokens.appendCode(`${r} = `),this.tokens.copyToken(),!0):!1}processPostIncDec(){let e=this.tokens.currentIndex(),t=this.tokens.tokens[e],n=this.tokens.tokens[e+1];if(t.type!==i.TokenType.name||t.shadowsGlobal||e>=1&&this.tokens.matches1AtIndex(e-1,i.TokenType.dot))return!1;let r=this.tokens.identifierNameForToken(t),a=this.importProcessor.resolveExportBinding(r);if(!a)return!1;let o=this.tokens.rawCodeForToken(n),s=this.importProcessor.getIdentifierReplacement(r)||r;if(o===`++`)this.tokens.replaceToken(`(${s} = ${a} = ${s} + 1, ${s} - 1)`);else if(o===`--`)this.tokens.replaceToken(`(${s} = ${a} = ${s} - 1, ${s} + 1)`);else throw Error(`Unexpected operator: ${o}`);return this.tokens.removeToken(),!0}processExportDefault(){let e=!0;if(this.tokens.matches4(i.TokenType._export,i.TokenType._default,i.TokenType._function,i.TokenType.name)||this.tokens.matches5(i.TokenType._export,i.TokenType._default,i.TokenType.name,i.TokenType._function,i.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,r.ContextualKeyword._async)){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=this.processNamedFunction();this.tokens.appendCode(` exports.default = ${e};`)}else if(this.tokens.matches4(i.TokenType._export,i.TokenType._default,i.TokenType._class,i.TokenType.name)||this.tokens.matches5(i.TokenType._export,i.TokenType._default,i.TokenType._abstract,i.TokenType._class,i.TokenType.name)||this.tokens.matches3(i.TokenType._export,i.TokenType._default,i.TokenType.at)){this.tokens.removeInitialToken(),this.tokens.removeToken(),this.copyDecorators(),this.tokens.matches1(i.TokenType._abstract)&&this.tokens.removeToken();let e=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.default = ${e};`)}else if(d.default.call(void 0,this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))e=!1,this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken();else if(this.reactHotLoaderTransformer){let e=this.nameManager.claimFreeName(`_default`);this.tokens.replaceToken(`let ${e}; exports.`),this.tokens.copyToken(),this.tokens.appendCode(` = ${e} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(e)}else this.tokens.replaceToken(`exports.`),this.tokens.copyToken(),this.tokens.appendCode(` =`);e&&(this.hadDefaultExport=!0)}copyDecorators(){for(;this.tokens.matches1(i.TokenType.at);)if(this.tokens.copyToken(),this.tokens.matches1(i.TokenType.parenL))this.tokens.copyExpectedToken(i.TokenType.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR);else{for(this.tokens.copyExpectedToken(i.TokenType.name);this.tokens.matches1(i.TokenType.dot);)this.tokens.copyExpectedToken(i.TokenType.dot),this.tokens.copyExpectedToken(i.TokenType.name);this.tokens.matches1(i.TokenType.parenL)&&(this.tokens.copyExpectedToken(i.TokenType.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR))}}processExportVar(){this.isSimpleExportVar()?this.processSimpleExportVar():this.processComplexExportVar()}isSimpleExportVar(){let e=this.tokens.currentIndex();if(e++,e++,!this.tokens.matches1AtIndex(e,i.TokenType.name))return!1;for(e++;e<this.tokens.tokens.length&&this.tokens.tokens[e].isType;)e++;return!!this.tokens.matches1AtIndex(e,i.TokenType.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();let e=this.tokens.identifierName();for(;!this.tokens.matches1(i.TokenType.eq);)this.rootTransformer.processToken();let t=this.tokens.currentToken().rhsEndIndex;if(t==null)throw Error(`Expected = token with an end index.`);for(;this.tokens.currentIndex()<t;)this.rootTransformer.processToken();this.tokens.appendCode(`; exports.${e} = ${e}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=this.tokens.matches1(i.TokenType.braceL);e&&this.tokens.appendCode(`(`);let t=0;for(;;)if(this.tokens.matches1(i.TokenType.braceL)||this.tokens.matches1(i.TokenType.dollarBraceL)||this.tokens.matches1(i.TokenType.bracketL))t++,this.tokens.copyToken();else if(this.tokens.matches1(i.TokenType.braceR)||this.tokens.matches1(i.TokenType.bracketR))t--,this.tokens.copyToken();else if(t===0&&!this.tokens.matches1(i.TokenType.name)&&!this.tokens.currentToken().isType)break;else if(this.tokens.matches1(i.TokenType.eq)){let e=this.tokens.currentToken().rhsEndIndex;if(e==null)throw Error(`Expected = token with an end index.`);for(;this.tokens.currentIndex()<e;)this.rootTransformer.processToken()}else{let e=this.tokens.currentToken();if(n.isDeclaration.call(void 0,e)){let t=this.tokens.identifierName(),r=this.importProcessor.getIdentifierReplacement(t);if(r===null)throw Error(`Expected a replacement for ${t} in \`export var\` syntax.`);n.isObjectShorthandDeclaration.call(void 0,e)&&(r=`${t}: ${r}`),this.tokens.replaceToken(r)}else this.rootTransformer.processToken()}if(e){let e=this.tokens.currentToken().rhsEndIndex;if(e==null)throw Error(`Expected = token with an end index.`);for(;this.tokens.currentIndex()<e;)this.rootTransformer.processToken();this.tokens.appendCode(`)`)}}processExportFunction(){this.tokens.replaceToken(``);let e=this.processNamedFunction();this.tokens.appendCode(` exports.${e} = ${e};`)}processNamedFunction(){if(this.tokens.matches1(i.TokenType._function))this.tokens.copyToken();else if(this.tokens.matches2(i.TokenType.name,i.TokenType._function)){if(!this.tokens.matchesContextual(r.ContextualKeyword._async))throw Error(`Expected async keyword in function export.`);this.tokens.copyToken(),this.tokens.copyToken()}if(this.tokens.matches1(i.TokenType.star)&&this.tokens.copyToken(),!this.tokens.matches1(i.TokenType.name))throw Error(`Expected identifier for exported function name.`);let e=this.tokens.identifierName();if(this.tokens.copyToken(),this.tokens.currentToken().isType)for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return this.tokens.copyExpectedToken(i.TokenType.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.parenR),this.rootTransformer.processPossibleTypeRange(),this.tokens.copyExpectedToken(i.TokenType.braceL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(i.TokenType.braceR),e}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(i.TokenType._abstract)&&this.tokens.removeToken();let e=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${e} = ${e};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=l.default.call(void 0,this.tokens),t=[];for(;;){if(this.tokens.matches1(i.TokenType.braceR)){this.tokens.removeToken();break}let n=c.default.call(void 0,this.tokens);for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();if(!(n.isType||!e&&this.shouldElideExportedIdentifier(n.leftName))){let e=n.rightName;e==="default"?this.hadDefaultExport=!0:this.hadNamedExport=!0;let r=n.leftName,i=this.importProcessor.getIdentifierReplacement(r);t.push(`exports.${e} = ${i||r};`)}if(this.tokens.matches1(i.TokenType.braceR)){this.tokens.removeToken();break}if(this.tokens.matches2(i.TokenType.comma,i.TokenType.braceR)){this.tokens.removeToken(),this.tokens.removeToken();break}if(this.tokens.matches1(i.TokenType.comma))this.tokens.removeToken();else throw Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`)}if(this.tokens.matchesContextual(r.ContextualKeyword._from)){this.tokens.removeToken();let e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),u.removeMaybeImportAttributes.call(void 0,this.tokens)}else this.tokens.appendCode(t.join(` `));this.tokens.matches1(i.TokenType.semi)&&this.tokens.removeToken()}processExportStar(){for(this.tokens.removeInitialToken();!this.tokens.matches1(i.TokenType.string);)this.tokens.removeToken();let e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),u.removeMaybeImportAttributes.call(void 0,this.tokens),this.tokens.matches1(i.TokenType.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(e)}}})),mx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=yb(),r=q(),i=t(cx()),a=lx(),o=t(a),s=t(kb()),c=Pb(),l=t(ux()),u=dx(),d=t(fx()),f=t(Mb());e.default=class extends f.default{constructor(e,t,n,r,i,s,l,u){super(),this.tokens=e,this.nameManager=t,this.helperManager=n,this.reactHotLoaderTransformer=r,this.isTypeScriptTransformEnabled=i,this.isFlowTransformEnabled=s,this.keepUnusedImports=l,this.nonTypeIdentifiers=i&&!l?c.getNonTypeIdentifiers.call(void 0,e,u):/* @__PURE__ */ new Set,this.declarationInfo=i&&!l?o.default.call(void 0,e):a.EMPTY_DECLARATION_INFO,this.injectCreateRequireForImportRequire=!!u.injectCreateRequireForImportRequire}process(){if(this.tokens.matches3(r.TokenType._import,r.TokenType.name,r.TokenType.eq))return this.processImportEquals();if(this.tokens.matches4(r.TokenType._import,r.TokenType.name,r.TokenType.name,r.TokenType.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,n.ContextualKeyword._type)){this.tokens.removeInitialToken();for(let e=0;e<7;e++)this.tokens.removeToken();return!0}if(this.tokens.matches2(r.TokenType._export,r.TokenType.eq))return this.tokens.replaceToken(`module.exports`),!0;if(this.tokens.matches5(r.TokenType._export,r.TokenType._import,r.TokenType.name,r.TokenType.name,r.TokenType.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,n.ContextualKeyword._type)){this.tokens.removeInitialToken();for(let e=0;e<8;e++)this.tokens.removeToken();return!0}if(this.tokens.matches1(r.TokenType._import))return this.processImport();if(this.tokens.matches2(r.TokenType._export,r.TokenType._default))return this.processExportDefault();if(this.tokens.matches2(r.TokenType._export,r.TokenType.braceL))return this.processNamedExports();if(this.tokens.matches2(r.TokenType._export,r.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,n.ContextualKeyword._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(r.TokenType.braceL)){for(;!this.tokens.matches1(r.TokenType.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(r.TokenType._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(n.ContextualKeyword._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.TokenType.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens)),!0}return!1}processImportEquals(){let e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(e)?i.default.call(void 0,this.tokens):this.injectCreateRequireForImportRequire?(this.tokens.replaceToken(`const`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.replaceToken(this.helperManager.getHelperName(`require`))):this.tokens.replaceToken(`const`),!0}processImport(){if(this.tokens.matches2(r.TokenType._import,r.TokenType.parenL))return!1;let e=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(e);!this.tokens.matches1(r.TokenType.string);)this.tokens.removeToken();this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens),this.tokens.matches1(r.TokenType.semi)&&this.tokens.removeToken()}return!0}removeImportTypeBindings(){if(this.tokens.copyExpectedToken(r.TokenType._import),this.tokens.matchesContextual(n.ContextualKeyword._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.TokenType.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,n.ContextualKeyword._from))return!0;if(this.tokens.matches1(r.TokenType.string))return this.tokens.copyToken(),!1;this.tokens.matchesContextual(n.ContextualKeyword._module)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,n.ContextualKeyword._from)&&this.tokens.copyToken();let e=!1,t=!1,i=!1;if(this.tokens.matches1(r.TokenType.name)&&(this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())?(this.tokens.removeToken(),this.tokens.matches1(r.TokenType.comma)&&this.tokens.removeToken()):(e=!0,this.tokens.copyToken(),this.tokens.matches1(r.TokenType.comma)&&(i=!0,this.tokens.removeToken()))),this.tokens.matches1(r.TokenType.star))this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))?(this.tokens.removeToken(),this.tokens.removeToken(),this.tokens.removeToken()):(i&&this.tokens.appendCode(`,`),e=!0,this.tokens.copyExpectedToken(r.TokenType.star),this.tokens.copyExpectedToken(r.TokenType.name),this.tokens.copyExpectedToken(r.TokenType.name));else if(this.tokens.matches1(r.TokenType.braceL)){for(i&&this.tokens.appendCode(`,`),this.tokens.copyToken();!this.tokens.matches1(r.TokenType.braceR);){t=!0;let n=s.default.call(void 0,this.tokens);if(n.isType||this.shouldAutomaticallyElideImportedName(n.rightName)){for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.removeToken()}else{for(e=!0;this.tokens.currentIndex()<n.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.copyToken()}}this.tokens.copyExpectedToken(r.TokenType.braceR)}return this.keepUnusedImports?!1:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?t&&!e:!1}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}processExportDefault(){if(d.default.call(void 0,this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))return this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken(),!0;if(!(this.tokens.matches4(r.TokenType._export,r.TokenType._default,r.TokenType._function,r.TokenType.name)||this.tokens.matches5(r.TokenType._export,r.TokenType._default,r.TokenType.name,r.TokenType._function,r.TokenType.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,n.ContextualKeyword._async)||this.tokens.matches4(r.TokenType._export,r.TokenType._default,r.TokenType._class,r.TokenType.name)||this.tokens.matches5(r.TokenType._export,r.TokenType._default,r.TokenType._abstract,r.TokenType._class,r.TokenType.name))&&this.reactHotLoaderTransformer){let e=this.nameManager.claimFreeName(`_default`);return this.tokens.replaceToken(`let ${e}; export`),this.tokens.copyToken(),this.tokens.appendCode(` ${e} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(e),!0}return!1}processNamedExports(){if(!this.isTypeScriptTransformEnabled)return!1;this.tokens.copyExpectedToken(r.TokenType._export),this.tokens.copyExpectedToken(r.TokenType.braceL);let e=l.default.call(void 0,this.tokens),t=!1;for(;!this.tokens.matches1(r.TokenType.braceR);){let n=s.default.call(void 0,this.tokens);if(n.isType||!e&&this.shouldElideExportedName(n.leftName)){for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.removeToken()}else{for(t=!0;this.tokens.currentIndex()<n.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.TokenType.comma)&&this.tokens.copyToken()}}return this.tokens.copyExpectedToken(r.TokenType.braceR),!this.keepUnusedImports&&e&&!t&&(this.tokens.removeToken(),this.tokens.removeToken(),u.removeMaybeImportAttributes.call(void 0,this.tokens)),!0}shouldElideExportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(e)&&!this.declarationInfo.valueDeclarations.has(e)}}})),hx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=yb(),r=q(),i=t(Mb());e.default=class extends i.default{constructor(e,t,n){super(),this.rootTransformer=e,this.tokens=t,this.isImportsTransformEnabled=n}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?!0:this.tokens.matches1(r.TokenType._enum)?(this.processEnum(),!0):this.tokens.matches2(r.TokenType._export,r.TokenType._enum)?(this.processNamedExportEnum(),!0):this.tokens.matches3(r.TokenType._export,r.TokenType._default,r.TokenType._enum)?(this.processDefaultExportEnum(),!0):!1}processNamedExportEnum(){if(this.isImportsTransformEnabled){this.tokens.removeInitialToken();let e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${e} = ${e};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();let e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${e};`):this.tokens.appendCode(` export default ${e};`)}processEnum(){this.tokens.replaceToken(`const`),this.tokens.copyExpectedToken(r.TokenType.name);let e=!1;this.tokens.matchesContextual(n.ContextualKeyword._of)&&(this.tokens.removeToken(),e=this.tokens.matchesContextual(n.ContextualKeyword._symbol),this.tokens.removeToken());let t=this.tokens.matches3(r.TokenType.braceL,r.TokenType.name,r.TokenType.eq);this.tokens.appendCode(` = require("flow-enums-runtime")`);let i=!e&&!t;for(this.tokens.replaceTokenTrimmingLeftWhitespace(i?`.Mirrored([`:`({`);!this.tokens.matches1(r.TokenType.braceR);){if(this.tokens.matches1(r.TokenType.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(e,t),this.tokens.matches1(r.TokenType.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(i?`]);`:`});`)}processEnumElement(e,t){if(e){let e=this.tokens.identifierName();this.tokens.copyToken(),this.tokens.appendCode(`: Symbol("${e}")`)}else t?(this.tokens.copyToken(),this.tokens.replaceTokenTrimmingLeftWhitespace(`:`),this.tokens.copyToken()):this.tokens.replaceToken(`"${this.tokens.identifierName()}"`)}}})),gx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}function n(e){let t,n=e[0],r=1;for(;r<e.length;){let i=e[r],a=e[r+1];if(r+=2,(i===`optionalAccess`||i===`optionalCall`)&&n==null)return;i===`access`||i===`optionalAccess`?(t=n,n=a(n)):(i===`call`||i===`optionalCall`)&&(n=a((...e)=>n.call(t,...e)),t=void 0)}return n}var r=q(),i=t(Mb());let a=`jest`,o=[`mock`,`unmock`,`enableAutomock`,`disableAutomock`];e.default=class e extends i.default{__init(){this.hoistedFunctionNames=[]}constructor(t,n,r,i){super(),this.rootTransformer=t,this.tokens=n,this.nameManager=r,this.importProcessor=i,e.prototype.__init.call(this)}process(){return this.tokens.currentToken().scopeDepth===0&&this.tokens.matches4(r.TokenType.name,r.TokenType.dot,r.TokenType.name,r.TokenType.parenL)&&this.tokens.identifierName()===a?!n([this,`access`,e=>e.importProcessor,`optionalAccess`,e=>e.getGlobalNames,`call`,e=>e(),`optionalAccess`,e=>e.has,`call`,e=>e(a)])&&this.extractHoistedCalls():!1}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(e=>`${e}();`).join(``):``}extractHoistedCalls(){this.tokens.removeToken();let e=!1;for(;this.tokens.matches3(r.TokenType.dot,r.TokenType.name,r.TokenType.parenL);){let t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(o.includes(t)){let t=this.nameManager.claimFreeName(`__jestHoist`);this.hoistedFunctionNames.push(t),this.tokens.replaceToken(`function ${t}(){${a}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.TokenType.parenR),this.tokens.appendCode(`;}`),e=!1}else e?this.tokens.copyToken():this.tokens.replaceToken(`${a}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.TokenType.parenR),e=!0}return!0}}})),_x=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=q(),r=t(Mb());e.default=class extends r.default{constructor(e){super(),this.tokens=e}process(){if(this.tokens.matches1(n.TokenType.num)){let e=this.tokens.currentTokenCode();if(e.includes(`_`))return this.tokens.replaceToken(e.replace(/_/g,``)),!0}return!1}}})),vx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=q(),r=t(Mb());e.default=class extends r.default{constructor(e,t){super(),this.tokens=e,this.nameManager=t}process(){return this.tokens.matches2(n.TokenType._catch,n.TokenType.braceL)?(this.tokens.copyToken(),this.tokens.appendCode(` (${this.nameManager.claimFreeName(`e`)})`),!0):!1}}})),yx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=q(),r=t(Mb());e.default=class extends r.default{constructor(e,t){super(),this.tokens=e,this.nameManager=t}process(){if(this.tokens.matches1(n.TokenType.nullishCoalescing)){let e=this.tokens.currentToken();return this.tokens.tokens[e.nullishStartIndex].isAsyncOperation?this.tokens.replaceTokenTrimmingLeftWhitespace(`, async () => (`):this.tokens.replaceTokenTrimmingLeftWhitespace(`, () => (`),!0}if(this.tokens.matches1(n.TokenType._delete)&&this.tokens.tokenAtRelativeIndex(1).isOptionalChainStart)return this.tokens.removeInitialToken(),!0;let e=this.tokens.currentToken().subscriptStartIndex;if(e!=null&&this.tokens.tokens[e].isOptionalChainStart&&this.tokens.tokenAtRelativeIndex(-1).type!==n.TokenType._super){let t=this.nameManager.claimFreeName(`_`),r;if(r=e>0&&this.tokens.matches1AtIndex(e-1,n.TokenType._delete)&&this.isLastSubscriptInChain()?`${t} => delete ${t}`:`${t} => ${t}`,this.tokens.tokens[e].isAsyncOperation&&(r=`async ${r}`),this.tokens.matches2(n.TokenType.questionDot,n.TokenType.parenL)||this.tokens.matches2(n.TokenType.questionDot,n.TokenType.lessThan))this.justSkippedSuper()&&this.tokens.appendCode(`.bind(this)`),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${r}`);else if(this.tokens.matches2(n.TokenType.questionDot,n.TokenType.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}`);else if(this.tokens.matches1(n.TokenType.questionDot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}.`);else if(this.tokens.matches1(n.TokenType.dot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}.`);else if(this.tokens.matches1(n.TokenType.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}[`);else if(this.tokens.matches1(n.TokenType.parenL))this.justSkippedSuper()&&this.tokens.appendCode(`.bind(this)`),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${r}(`);else throw Error(`Unexpected subscript operator in optional chain.`);return!0}return!1}isLastSubscriptInChain(){let e=0;for(let t=this.tokens.currentIndex()+1;;t++){if(t>=this.tokens.tokens.length)throw Error(`Reached the end of the code while finding the end of the access chain.`);if(this.tokens.tokens[t].isOptionalChainStart?e++:this.tokens.tokens[t].isOptionalChainEnd&&e--,e<0)return!0;if(e===0&&this.tokens.tokens[t].subscriptStartIndex!=null)return!1}}justSkippedSuper(){let e=0,t=this.tokens.currentIndex()-1;for(;;){if(t<0)throw Error(`Reached the start of the code while finding the start of the access chain.`);if(this.tokens.tokens[t].isOptionalChainStart?e--:this.tokens.tokens[t].isOptionalChainEnd&&e++,e<0)return!1;if(e===0&&this.tokens.tokens[t].subscriptStartIndex!=null)return this.tokens.tokens[t-1].type===n.TokenType._super;t--}}}})),bx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=Ob(),r=q(),i=t(Mb());e.default=class extends i.default{constructor(e,t,n,r){super(),this.rootTransformer=e,this.tokens=t,this.importProcessor=n,this.options=r}process(){let e=this.tokens.currentIndex();if(this.tokens.identifierName()===`createReactClass`){let t=this.importProcessor&&this.importProcessor.getIdentifierReplacement(`createReactClass`);return t?this.tokens.replaceToken(`(0, ${t})`):this.tokens.copyToken(),this.tryProcessCreateClassCall(e),!0}if(this.tokens.matches3(r.TokenType.name,r.TokenType.dot,r.TokenType.name)&&this.tokens.identifierName()===`React`&&this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+2)===`createClass`){let t=this.importProcessor&&this.importProcessor.getIdentifierReplacement(`React`)||`React`;return t?(this.tokens.replaceToken(t),this.tokens.copyToken(),this.tokens.copyToken()):(this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.copyToken()),this.tryProcessCreateClassCall(e),!0}return!1}tryProcessCreateClassCall(e){let t=this.findDisplayName(e);t&&this.classNeedsDisplayName()&&(this.tokens.copyExpectedToken(r.TokenType.parenL),this.tokens.copyExpectedToken(r.TokenType.braceL),this.tokens.appendCode(`displayName: '${t}',`),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.TokenType.braceR),this.tokens.copyExpectedToken(r.TokenType.parenR))}findDisplayName(e){return e<2?null:this.tokens.matches2AtIndex(e-2,r.TokenType.name,r.TokenType.eq)||e>=2&&this.tokens.tokens[e-2].identifierRole===n.IdentifierRole.ObjectKey?this.tokens.identifierNameAtIndex(e-2):this.tokens.matches2AtIndex(e-2,r.TokenType._export,r.TokenType._default)?this.getDisplayNameFromFilename():null}getDisplayNameFromFilename(){let e=(this.options.filePath||`unknown`).split(`/`),t=e[e.length-1],n=t.lastIndexOf(`.`),r=n===-1?t:t.slice(0,n);return r===`index`&&e[e.length-2]?e[e.length-2]:r}classNeedsDisplayName(){let e=this.tokens.currentIndex();if(!this.tokens.matches2(r.TokenType.parenL,r.TokenType.braceL))return!1;let t=e+1,i=this.tokens.tokens[t].contextId;if(i==null)throw Error(`Expected non-null context ID on object open-brace.`);for(;e<this.tokens.tokens.length;e++){let t=this.tokens.tokens[e];if(t.type===r.TokenType.braceR&&t.contextId===i){e++;break}if(this.tokens.identifierNameAtIndex(e)===`displayName`&&this.tokens.tokens[e].identifierRole===n.IdentifierRole.ObjectKey&&t.contextId===i)return!1}if(e===this.tokens.tokens.length)throw Error(`Unexpected end of input when processing React class.`);return this.tokens.matches1AtIndex(e,r.TokenType.parenR)||this.tokens.matches2AtIndex(e,r.TokenType.comma,r.TokenType.parenR)}}})),xx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=Ob(),r=t(Mb());e.default=class e extends r.default{__init(){this.extractedDefaultExportName=null}constructor(t,n){super(),this.tokens=t,this.filePath=n,e.prototype.__init.call(this)}setExtractedDefaultExportName(e){this.extractedDefaultExportName=e}getPrefixCode(){return`
|
|
372
|
+
(function () {
|
|
373
|
+
var enterModule = require('react-hot-loader').enterModule;
|
|
374
|
+
enterModule && enterModule(module);
|
|
375
|
+
})();`.replace(/\s+/g,` `).trim()}getSuffixCode(){let e=/* @__PURE__ */ new Set;for(let t of this.tokens.tokens)!t.isType&&n.isTopLevelDeclaration.call(void 0,t)&&t.identifierRole!==n.IdentifierRole.ImportDeclaration&&e.add(this.tokens.identifierNameForToken(t));let t=Array.from(e).map(e=>({variableName:e,uniqueLocalName:e}));return this.extractedDefaultExportName&&t.push({variableName:this.extractedDefaultExportName,uniqueLocalName:`default`}),`
|
|
376
|
+
;(function () {
|
|
377
|
+
var reactHotLoader = require('react-hot-loader').default;
|
|
378
|
+
var leaveModule = require('react-hot-loader').leaveModule;
|
|
379
|
+
if (!reactHotLoader) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
${t.map(({variableName:e,uniqueLocalName:t})=>` reactHotLoader.register(${e}, "${t}", ${JSON.stringify(this.filePath||``)});`).join(`
|
|
383
|
+
`)}
|
|
384
|
+
leaveModule(module);
|
|
385
|
+
})();`}process(){return!1}}})),Sx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Tb();let n=/* @__PURE__ */ new Set(/* @__PURE__ */ `break.case.catch.class.const.continue.debugger.default.delete.do.else.export.extends.finally.for.function.if.import.in.instanceof.new.return.super.switch.this.throw.try.typeof.var.void.while.with.yield.enum.implements.interface.let.package.private.protected.public.static.await.false.null.true`.split(`.`));function r(e){if(e.length===0||!t.IS_IDENTIFIER_START[e.charCodeAt(0)])return!1;for(let n=1;n<e.length;n++)if(!t.IS_IDENTIFIER_CHAR[e.charCodeAt(n)])return!1;return!n.has(e)}e.default=r})),Cx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=q(),r=t(Sx()),i=t(Mb());e.default=class extends i.default{constructor(e,t,n){super(),this.rootTransformer=e,this.tokens=t,this.isImportsTransformEnabled=n}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?!0:this.tokens.matches1(n.TokenType._public)||this.tokens.matches1(n.TokenType._protected)||this.tokens.matches1(n.TokenType._private)||this.tokens.matches1(n.TokenType._abstract)||this.tokens.matches1(n.TokenType._readonly)||this.tokens.matches1(n.TokenType._override)||this.tokens.matches1(n.TokenType.nonNullAssertion)?(this.tokens.removeInitialToken(),!0):this.tokens.matches1(n.TokenType._enum)||this.tokens.matches2(n.TokenType._const,n.TokenType._enum)?(this.processEnum(),!0):this.tokens.matches2(n.TokenType._export,n.TokenType._enum)||this.tokens.matches3(n.TokenType._export,n.TokenType._const,n.TokenType._enum)?(this.processEnum(!0),!0):!1}processEnum(e=!1){for(this.tokens.removeInitialToken();this.tokens.matches1(n.TokenType._const)||this.tokens.matches1(n.TokenType._enum);)this.tokens.removeToken();let t=this.tokens.identifierName();this.tokens.removeToken(),e&&!this.isImportsTransformEnabled&&this.tokens.appendCode(`export `),this.tokens.appendCode(`var ${t}; (function (${t})`),this.tokens.copyExpectedToken(n.TokenType.braceL),this.processEnumBody(t),this.tokens.copyExpectedToken(n.TokenType.braceR),e&&this.isImportsTransformEnabled?this.tokens.appendCode(`)(${t} || (exports.${t} = ${t} = {}));`):this.tokens.appendCode(`)(${t} || (${t} = {}));`)}processEnumBody(e){let t=null;for(;!this.tokens.matches1(n.TokenType.braceR);){let{nameStringCode:r,variableName:i}=this.extractEnumKeyInfo(this.tokens.currentToken());this.tokens.removeInitialToken(),this.tokens.matches3(n.TokenType.eq,n.TokenType.string,n.TokenType.comma)||this.tokens.matches3(n.TokenType.eq,n.TokenType.string,n.TokenType.braceR)?this.processStringLiteralEnumMember(e,r,i):this.tokens.matches1(n.TokenType.eq)?this.processExplicitValueEnumMember(e,r,i):this.processImplicitValueEnumMember(e,r,i,t),this.tokens.matches1(n.TokenType.comma)&&this.tokens.removeToken(),t=i??`${e}[${r}]`}}extractEnumKeyInfo(e){if(e.type===n.TokenType.name){let t=this.tokens.identifierNameForToken(e);return{nameStringCode:`"${t}"`,variableName:r.default.call(void 0,t)?t:null}}if(e.type===n.TokenType.string){let t=this.tokens.stringValueForToken(e);return{nameStringCode:this.tokens.code.slice(e.start,e.end),variableName:r.default.call(void 0,t)?t:null}}throw Error(`Expected name or string at beginning of enum element.`)}processStringLiteralEnumMember(e,t,n){n==null?(this.tokens.appendCode(`${e}[${t}]`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(`;`)):(this.tokens.appendCode(`const ${n}`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(`; ${e}[${t}] = ${n};`))}processExplicitValueEnumMember(e,t,n){let r=this.tokens.currentToken().rhsEndIndex;if(r==null)throw Error(`Expected rhsEndIndex on enum assign.`);if(n!=null){for(this.tokens.appendCode(`const ${n}`),this.tokens.copyToken();this.tokens.currentIndex()<r;)this.rootTransformer.processToken();this.tokens.appendCode(`; ${e}[${e}[${t}] = ${n}] = ${t};`)}else{for(this.tokens.appendCode(`${e}[${e}[${t}]`),this.tokens.copyToken();this.tokens.currentIndex()<r;)this.rootTransformer.processToken();this.tokens.appendCode(`] = ${t};`)}}processImplicitValueEnumMember(e,t,n,r){let i=r==null?`0`:`${r} + 1`;n!=null&&(this.tokens.appendCode(`const ${n} = ${i}; `),i=n),this.tokens.appendCode(`${e}[${e}[${t}] = ${i}] = ${t};`)}}})),wx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=yb(),r=q(),i=t(sx()),a=t(px()),o=t(mx()),s=t(hx()),c=t(gx()),l=t(Nb()),u=t(_x()),d=t(vx()),f=t(yx()),p=t(bx()),m=t(xx()),h=t(Cx());e.default=class e{__init(){this.transformers=[]}__init2(){this.generatedVariables=[]}constructor(t,n,r,i){e.prototype.__init.call(this),e.prototype.__init2.call(this),this.nameManager=t.nameManager,this.helperManager=t.helperManager;let{tokenProcessor:g,importProcessor:_}=t;this.tokens=g,this.isImportsTransformEnabled=n.includes(`imports`),this.isReactHotLoaderTransformEnabled=n.includes(`react-hot-loader`),this.disableESTransforms=!!i.disableESTransforms,i.disableESTransforms||(this.transformers.push(new f.default(g,this.nameManager)),this.transformers.push(new u.default(g)),this.transformers.push(new d.default(g,this.nameManager))),n.includes(`jsx`)&&(i.jsxRuntime!==`preserve`&&this.transformers.push(new l.default(this,g,_,this.nameManager,i)),this.transformers.push(new p.default(this,g,_,i)));let v=null;if(n.includes(`react-hot-loader`)){if(!i.filePath)throw Error(`filePath is required when using the react-hot-loader transform.`);v=new m.default(g,i.filePath),this.transformers.push(v)}if(n.includes(`imports`)){if(_===null)throw Error(`Expected non-null importProcessor with imports transform enabled.`);this.transformers.push(new a.default(this,g,_,this.nameManager,this.helperManager,v,r,!!i.enableLegacyTypeScriptModuleInterop,n.includes(`typescript`),n.includes(`flow`),!!i.preserveDynamicImport,!!i.keepUnusedImports))}else this.transformers.push(new o.default(g,this.nameManager,this.helperManager,v,n.includes(`typescript`),n.includes(`flow`),!!i.keepUnusedImports,i));n.includes(`flow`)&&this.transformers.push(new s.default(this,g,n.includes(`imports`))),n.includes(`typescript`)&&this.transformers.push(new h.default(this,g,n.includes(`imports`))),n.includes(`jest`)&&this.transformers.push(new c.default(this,g,this.nameManager,_))}transform(){this.tokens.reset(),this.processBalancedCode();let e=this.isImportsTransformEnabled?`"use strict";`:``;for(let t of this.transformers)e+=t.getPrefixCode();e+=this.helperManager.emitHelpers(),e+=this.generatedVariables.map(e=>` var ${e};`).join(``);for(let t of this.transformers)e+=t.getHoistedCode();let t=``;for(let e of this.transformers)t+=e.getSuffixCode();let n=this.tokens.finish(),{code:r}=n;if(r.startsWith(`#!`)){let i=r.indexOf(`
|
|
386
|
+
`);return i===-1&&(i=r.length,r+=`
|
|
387
|
+
`),{code:r.slice(0,i+1)+e+r.slice(i+1)+t,mappings:this.shiftMappings(n.mappings,e.length)}}return{code:e+r+t,mappings:this.shiftMappings(n.mappings,e.length)}}processBalancedCode(){let e=0,t=0;for(;!this.tokens.isAtEnd();){if(this.tokens.matches1(r.TokenType.braceL)||this.tokens.matches1(r.TokenType.dollarBraceL))e++;else if(this.tokens.matches1(r.TokenType.braceR)){if(e===0)return;e--}if(this.tokens.matches1(r.TokenType.parenL))t++;else if(this.tokens.matches1(r.TokenType.parenR)){if(t===0)return;t--}this.processToken()}}processToken(){if(this.tokens.matches1(r.TokenType._class))this.processClass();else{for(let e of this.transformers)if(e.process())return;this.tokens.copyToken()}}processNamedClass(){if(!this.tokens.matches2(r.TokenType._class,r.TokenType.name))throw Error(`Expected identifier for exported class name.`);let e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.processClass(),e}processClass(){let e=i.default.call(void 0,this,this.tokens,this.nameManager,this.disableESTransforms),t=(e.headerInfo.isExpression||!e.headerInfo.className)&&e.staticInitializerNames.length+e.instanceInitializerNames.length>0,n=e.headerInfo.className;t&&(n=this.nameManager.claimFreeName(`_class`),this.generatedVariables.push(n),this.tokens.appendCode(` (${n} =`));let a=this.tokens.currentToken().contextId;if(a==null)throw Error(`Expected class to have a context ID.`);for(this.tokens.copyExpectedToken(r.TokenType._class);!this.tokens.matchesContextIdAndLabel(r.TokenType.braceL,a);)this.processToken();this.processClassBody(e,n);let o=e.staticInitializerNames.map(e=>`${n}.${e}()`);t?this.tokens.appendCode(`, ${o.map(e=>`${e}, `).join(``)}${n})`):e.staticInitializerNames.length>0&&this.tokens.appendCode(` ${o.map(e=>`${e};`).join(` `)}`)}processClassBody(e,t){let{headerInfo:n,constructorInsertPos:i,constructorInitializerStatements:a,fields:o,instanceInitializerNames:s,rangesToRemove:c}=e,l=0,u=0,d=this.tokens.currentToken().contextId;if(d==null)throw Error(`Expected non-null context ID on class.`);this.tokens.copyExpectedToken(r.TokenType.braceL),this.isReactHotLoaderTransformEnabled&&this.tokens.appendCode(`__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}`);let f=a.length+s.length>0;if(i===null&&f){let e=this.makeConstructorInitCode(a,s,t);if(n.hasSuperclass){let t=this.nameManager.claimFreeName(`args`);this.tokens.appendCode(`constructor(...${t}) { super(...${t}); ${e}; }`)}else this.tokens.appendCode(`constructor() { ${e}; }`)}for(;!this.tokens.matchesContextIdAndLabel(r.TokenType.braceR,d);)if(l<o.length&&this.tokens.currentIndex()===o[l].start){let e=!1;for(this.tokens.matches1(r.TokenType.bracketL)?this.tokens.copyTokenWithPrefix(`${o[l].initializerName}() {this`):this.tokens.matches1(r.TokenType.string)||this.tokens.matches1(r.TokenType.num)?(this.tokens.copyTokenWithPrefix(`${o[l].initializerName}() {this[`),e=!0):this.tokens.copyTokenWithPrefix(`${o[l].initializerName}() {this.`);this.tokens.currentIndex()<o[l].end;)e&&this.tokens.currentIndex()===o[l].equalsIndex&&this.tokens.appendCode(`]`),this.processToken();this.tokens.appendCode(`}`),l++}else if(u<c.length&&this.tokens.currentIndex()>=c[u].start){for(this.tokens.currentIndex()<c[u].end&&this.tokens.removeInitialToken();this.tokens.currentIndex()<c[u].end;)this.tokens.removeToken();u++}else this.tokens.currentIndex()===i&&(this.tokens.copyToken(),f&&this.tokens.appendCode(`;${this.makeConstructorInitCode(a,s,t)};`)),this.processToken();this.tokens.copyExpectedToken(r.TokenType.braceR)}makeConstructorInitCode(e,t,n){return[...e,...t.map(e=>`${n}.prototype.${e}.call(this)`)].join(`;`)}processPossibleArrowParamEnd(){if(this.tokens.matches2(r.TokenType.parenR,r.TokenType.colon)&&this.tokens.tokenAtRelativeIndex(1).isType){let e=this.tokens.currentIndex()+1;for(;this.tokens.tokens[e].isType;)e++;if(this.tokens.matches1AtIndex(e,r.TokenType.arrow)){for(this.tokens.removeInitialToken();this.tokens.currentIndex()<e;)this.tokens.removeToken();return this.tokens.replaceTokenTrimmingLeftWhitespace(`) =>`),!0}}return!1}processPossibleAsyncArrowWithTypeParams(){if(!this.tokens.matchesContextual(n.ContextualKeyword._async)&&!this.tokens.matches1(r.TokenType._async))return!1;let e=this.tokens.tokenAtRelativeIndex(1);if(e.type!==r.TokenType.lessThan||!e.isType)return!1;let t=this.tokens.currentIndex()+1;for(;this.tokens.tokens[t].isType;)t++;if(this.tokens.matches1AtIndex(t,r.TokenType.parenL)){for(this.tokens.replaceToken(`async (`),this.tokens.removeInitialToken();this.tokens.currentIndex()<t;)this.tokens.removeToken();return this.tokens.removeToken(),this.processBalancedCode(),this.processToken(),!0}return!1}processPossibleTypeRange(){if(this.tokens.currentToken().isType){for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return!0}return!1}shiftMappings(e,t){for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(e[n]=r+t)}return e}}})),Tx=/* @__PURE__ */ o((e=>{e.__esModule=!0,e.LinesAndColumns=void 0;var t=`
|
|
388
|
+
`,n=`\r`,r=function(){function e(e){this.string=e;for(var r=[0],i=0;i<e.length;)switch(e[i]){case t:i+=t.length,r.push(i);break;case n:i+=n.length,e[i]===t&&(i+=t.length),r.push(i);break;default:i++}this.offsets=r}return e.prototype.locationForIndex=function(e){if(e<0||e>this.string.length)return null;for(var t=0,n=this.offsets;n[t+1]<=e;)t++;var r=e-n[t];return{line:t,column:r}},e.prototype.indexForLocation=function(e){var t=e.line,n=e.column;return t<0||t>=this.offsets.length||n<0||n>this.lengthOfLine(t)?null:this.offsets[t]+n},e.prototype.lengthOfLine=function(e){var t=this.offsets[e];return(e===this.offsets.length-1?this.string.length:this.offsets[e+1])-t},e}();e.LinesAndColumns=r,e.default=r})),Ex=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(Tx()),r=q();function i(e,t){if(t.length===0)return``;let i=Object.keys(t[0]).filter(e=>e!==`type`&&e!==`value`&&e!==`start`&&e!==`end`&&e!==`loc`),o=Object.keys(t[0].type).filter(e=>e!==`label`&&e!==`keyword`),s=[`Location`,`Label`,`Raw`,...i,...o],c=new n.default(e),l=[s,...t.map(d)],u=s.map(()=>0);for(let e of l)for(let t=0;t<e.length;t++)u[t]=Math.max(u[t],e[t].length);return l.map(e=>e.map((e,t)=>e.padEnd(u[t])).join(` `)).join(`
|
|
389
|
+
`);function d(t){let n=e.slice(t.start,t.end);return[p(t.start,t.end),r.formatTokenType.call(void 0,t.type),a(String(n),14),...i.map(e=>f(t[e],e)),...o.map(e=>f(t.type[e],e))]}function f(e,t){return e===!0?t:e===!1||e===null?``:String(e)}function p(e,t){return`${m(e)}-${m(t)}`}function m(e){let t=c.locationForIndex(e);return t?`${t.line+1}:${t.column+1}`:`Unknown`}}e.default=i;function a(e,t){return e.length>t?`${e.slice(0,t-3)}...`:e}})),Dx=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=q(),r=t(kb());function i(e){let t=/* @__PURE__ */ new Set;for(let r=0;r<e.tokens.length;r++)e.matches1AtIndex(r,n.TokenType._import)&&!e.matches3AtIndex(r,n.TokenType._import,n.TokenType.name,n.TokenType.eq)&&a(e,r,t);return t}e.default=i;function a(e,t,r){t++,e.matches1AtIndex(t,n.TokenType.parenL)||(e.matches1AtIndex(t,n.TokenType.name)&&(r.add(e.identifierNameAtIndex(t)),t++,e.matches1AtIndex(t,n.TokenType.comma)&&t++),e.matches1AtIndex(t,n.TokenType.star)&&(t+=2,r.add(e.identifierNameAtIndex(t)),t++),e.matches1AtIndex(t,n.TokenType.braceL)&&(t++,o(e,t,r)))}function o(e,t,i){for(;;){if(e.matches1AtIndex(t,n.TokenType.braceR))return;let a=r.default.call(void 0,e,t);if(t=a.endIndex,a.isType||i.add(a.rightName),e.matches2AtIndex(t,n.TokenType.comma,n.TokenType.braceR)||e.matches1AtIndex(t,n.TokenType.braceR))return;if(e.matches1AtIndex(t,n.TokenType.comma))t++;else throw Error(`Unexpected token: ${JSON.stringify(e.tokens[t])}`)}}})),Ox=(/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return e&&e.__esModule?e:{default:e}}var n=t(Fb()),r=t(Bb()),i=Vb(),a=t(Hb()),o=t(Wb()),s=Yb(),c=ix(),l=t(ox()),u=t(wx());t(Ex());var d=t(Dx());function f(e,t){s.validateOptions.call(void 0,t);try{let n=p(e,t),i=new u.default(n,t.transforms,!!t.enableLegacyBabel5ModuleInterop,t).transform(),a={code:i.code};if(t.sourceMapOptions){if(!t.filePath)throw Error(`filePath must be specified when generating a source map.`);a={...a,sourceMap:r.default.call(void 0,i,t.filePath,t.sourceMapOptions,e,n.tokenProcessor.tokens)}}return a}catch(e){throw t.filePath&&(e.message=`Error transforming ${t.filePath}: ${e.message}`),e}}e.transform=f;function p(e,t){let r=t.transforms.includes(`jsx`),s=t.transforms.includes(`typescript`),u=t.transforms.includes(`flow`),f=t.disableESTransforms===!0,p=c.parse.call(void 0,e,r,s,u),m=p.tokens,h=p.scopes,g=new o.default(e,m),_=new i.HelperManager(g),v=new l.default(e,m,u,f,_),y=!!t.enableLegacyTypeScriptModuleInterop,b=null;return t.transforms.includes(`imports`)?(b=new n.default(g,v,y,t,t.transforms.includes(`typescript`),!!t.keepUnusedImports,_),b.preprocessTokens(),a.default.call(void 0,v,h,b.getGlobalNames()),t.transforms.includes(`typescript`)&&!t.keepUnusedImports&&b.pruneTypeOnlyImports()):t.transforms.includes(`typescript`)&&!t.keepUnusedImports&&a.default.call(void 0,v,h,d.default.call(void 0,v)),{tokenProcessor:v,scopes:h,nameManager:g,importProcessor:b,helperManager:_}}})))();const kx=`__ryugi_h`;function Ax(e){let t=e.message,n=/\((\d+):(\d+)\)/.exec(t);return n?`report.tsx:${n[1]}:${Number(n[2])+1} ${t.replace(/\s*\(\d+:\d+\)/,``)}`:`report.tsx: ${t}`}const jx=/* @__PURE__ */ new Set([`Stat`,`LineChart`,`BarChart`,`AreaChart`,`PieChart`,`ScatterChart`,`Table`]),Mx=/* @__PURE__ */ new Set([...jx,`Callout`,`Section`,`Image`]),Nx=[`fetch`,`XMLHttpRequest`,`WebSocket`,`EventSource`,`require`,`setInterval`,`setTimeout`,`document`,`window`,`localStorage`,`sessionStorage`,`globalThis`,`eval`,`Function`,`location`,`navigator`],Px=[`createElement`,`constructor`,`__proto__`];[...Nx.map(e=>({name:e,pattern:RegExp(`(?<![.\\w$])${e}(?![\\w$])`)})),...Px.map(e=>({name:e,pattern:RegExp(`(?<![\\w$])${e}(?![\\w$])`)}))];const Fx=RegExp(`${kx}\\(\\s*(?:'([^']*)'|"([^"]*)"|([A-Za-z_$][\\w$.]*))\\s*,\\s*`,`g`),Ix=/^(?:"([^"]*)"|'([^']*)')$/;function Lx(e){try{let{code:t}=(0,Ox.transform)(e,{transforms:[`typescript`,`jsx`],jsxPragma:kx,jsxFragmentPragma:`__ryugi_fragment`,production:!0});return{code:t}}catch(e){return{error:Ax(e)}}}function Rx(e,t){let n=/* @__PURE__ */ new Map;if(e[t]!==`{`)return n;let r=0,i=null,a=null,o=-1,s=t+1;for(let c=t;c<e.length;c++){let t=e[c];if(i)t===`\\`?c++:t===i&&(i=null);else if(t===`"`||t===`'`||t==="`")i=t;else if(t===`{`||t===`[`||t===`(`)r++;else if(t===`}`||t===`]`||t===`)`){if(r--,r===0)return a!==null&&n.set(a,e.slice(o,c).trim().replace(/,$/,``).trim()),n}else r===1&&(t===`:`&&a===null?(a=e.slice(s,c).trim(),o=c+1):t===`,`&&(a!==null&&n.set(a,e.slice(o,c).trim()),a=null,s=c+1))}return n}function zx(e){let t=[];for(let n of e.matchAll(Fx)){let r=n[1]??n[2],i=r??n[3];t.push({tag:r===void 0?i:`<${r}>`,props:r===void 0?Rx(e,n.index+n[0].length):/* @__PURE__ */ new Map})}return t}const Bx=e=>{let t=e===void 0?null:Ix.exec(e);return t?t[1]??t[2]:void 0};function Vx(e){if(e===void 0)return null;let t=Bx(e);if(t!==void 0)return[t];if(!e.startsWith(`[`)||!e.endsWith(`]`))return null;let n=e.slice(1,-1).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>Bx(e));return n.every(e=>e!==void 0)?[...new Set(n)]:null}function Hx(e){let t=[];for(let n of e){if(!Mx.has(n.tag))continue;let e=Bx(n.props.get(`id`));if(e===void 0)continue;let r=Bx(n.props.get(n.tag===`Image`?`caption`:`title`)),i=Bx(n.props.get(n.tag===`Table`?`rowKey`:`x`));t.push({id:e,tag:n.tag,...r===void 0?{}:{title:r},...i!==void 0&&jx.has(n.tag)?{key:i}:{},sources:Vx(n.props.get(`source`))??[]})}return t}function Ux(e){let t=Lx(e);return`code`in t?Hx(zx(t.code)):[]}function Wx(e,t){let n=je(e,`report`,t);if(!n)return null;try{return Ux(d.default.readFileSync(f.default.join(n,A.report),`utf8`)).map(e=>e.id)}catch{return null}}function Gx(e,t,n){if(!e.block)return null;let r=mg(e),i=t.blocksOf(r);return i&&!i.includes(e.block)?`<${n} report="${r}" block="${e.block}">: the report has no block ${e.block}; its blocks are: ${i.join(`, `)}`:null}function Kx(e,t,n){if(!e.slide)return null;let r=mg(e),i=t.slidesOf(r);return i&&!i.includes(e.slide)?`<${n} slides="${r}" slide="${e.slide}">: the deck has no slide ${e.slide}; its slides are: ${i.join(`, `)}`:null}const qx=e=>{try{return d.default.readFileSync(e,`utf8`)}catch{return null}},Jx=e=>({readFile:(t,n)=>{let r=t===`artifact`?hn(e,n):null;return(r&&qx(r))??{error:`${n} cannot be read here`}}});function Yx(e){let t=qx(f.default.join(e,PS)),n=t===null?qx(f.default.join(e,FS)):ab(t,Jx(e)).html;if(n===null)return null;let r=W_(n);return{title:r.title||null,slides:r.slides.flatMap(({id:e})=>e?[e]:[])}}const Xx=/^(\s*(?:<\?xml[^>]*\?>\s*)?(?:<!--[\s\S]*?-->\s*)*)<report(?=[\s/>])/;function Zx(e){let t=f.default.join(e,A.verify),n=f.default.join(e,`report.xml`);if(d.default.existsSync(t)||!d.default.existsSync(n))return;let r;try{r=d.default.readFileSync(n,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}let i=r.lastIndexOf(`</report>`),a=Xx.test(r)&&i!==-1?`${r.slice(0,i).replace(Xx,`$1<verify`)}</verify>${r.slice(i+9)}`:r,o=`${t}.${process.pid}.tmp`;d.default.writeFileSync(o,a),d.default.renameSync(o,t),d.default.rmSync(n,{force:!0})}`${`0`.repeat(26)}`;const Qx=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{};function $x(e,t=`scene.excalidraw`){let n;try{n=JSON.parse(e)}catch{return{error:`${t} is not valid JSON`}}let r=Qx(n),i=r.elements??[];if(!Array.isArray(i))return{error:`${t}: elements must be an array`};for(let[e,n]of i.entries()){let r=Qx(n);if(typeof r.id!=`string`||typeof r.type!=`string`)return{error:`${t}: element ${e} needs a string id and type`}}return{scene:{type:`excalidraw`,version:2,source:typeof r.source==`string`?r.source:`ryugi`,elements:i,appState:Qx(r.appState),files:Qx(r.files)}}}const eS=e=>{try{return d.default.readFileSync(e,`utf8`)}catch{return null}};function tS(e){try{return d.default.readdirSync(f.default.join(e,cn)).filter(e=>e.endsWith(`.excalidraw`)).map(e=>e.slice(0,-11)).sort()}catch{return[]}}function nS(e){let{pages:t}=mn(pn(eS(f.default.join(e,sn))).pages,tS(e)),n={},r={};for(let i of t){let t=eS(f.default.join(e,dn(i.id))),a=t===null?null:$x(t);if(!(!a||`error`in a)){r[i.id]=a.scene;for(let e of a.scene.elements)e.type===`frame`&&!e.isDeleted&&!(e.id in n)&&(n[e.id]=i.id)}}return{pages:t,frames:n,scenes:r}}function rS(e,t){let n=je(e,`whiteboard`,t);return n?nS(n):null}function iS(e,t,n){let r=e.whiteboard,i=t.framesOf(r);if(!i)return null;if(e.page){let t=i.pages.find(t=>t.id===e.page);if(!t)return`<${n} whiteboard="${r}" page="${e.page}">: the whiteboard has no page ${e.page}`;if(t.deleted)return`<${n} whiteboard="${r}" page="${e.page}">: page ${e.page} is deleted; restore it or point the reference elsewhere`}if(!e.frame)return null;let a=i.frames[e.frame];return a===void 0?`<${n} whiteboard="${r}" frame="${e.frame}">: the whiteboard has no frame ${e.frame}`:i.pages.find(e=>e.id===a)?.deleted?`<${n} whiteboard="${r}" frame="${e.frame}">: frame ${e.frame} is on deleted page ${a}`:null}const aS={document:vb,artboard:lb,whiteboard:iS,html:null,slides:Kx,report:Gx,storyboard:null};function oS(e){return{idOf:(t,n=`artboard`)=>je(e,n,t)?Le(e,n,t).slice(`/${n}/`.length):null,blocksOf:t=>Wx(e,t),documentBlocksOf:t=>_b(e,t),framesOf:t=>rS(e,t),canvasOf:t=>cb(e,t)}}RegExp(`<ref\\b[^>]*?\\b(${og.map(e=>e.refAttribute).join(`|`)})="([^"]+)"`,`g`),new Map(og.map(e=>[e.refAttribute,e.type]));function sS(e,t,n=`ref`){let r=pg(e),i=mg(e),a=t.idOf(i,r);return a?e.to&&e.to!==a?`<${n} ${r}="${i}"> points at ${e.to}, but ${i} is now ${a}; delete to= to point the reference at it`:aS[r]?.(e,t,n)??null:`<${n} ${r}="${i}"> names ${gg[r]} that is not in this project`}const cS=/<title[^>]*>([\s\S]*?)<\/title>/i;function lS(e,t){let n;try{n=d.default.readFileSync(f.default.join(e,A.html),`utf8`)}catch{return{title:t,warnings:[`index.html not found`],version:Ie(e)}}return{title:cS.exec(n)?.[1]?.trim()||t,warnings:[],version:Ie(e)}}const uS=`data`,dS=/<Report\b[^>]*?\btitle=(?:"([^"]*)"|'([^']*)'|\{\s*(?:"([^"]*)"|'([^']*)')\s*\})/;function fS(e){let t=dS.exec(e);return(t?.[1]??t?.[2]??t?.[3]??t?.[4])?.trim()||void 0}const pS=e=>e.elements.reduce((e,t)=>e+(t.version??0),0);function mS(e,t){let n=Ie(e),r;try{r=d.default.readFileSync(f.default.join(e,A.whiteboard),`utf8`)}catch{return{title:t,warnings:[`${A.whiteboard} not found`],version:n,sceneVersion:0}}let i=$x(r);if(`error`in i)return{title:t,warnings:[i.error],version:n,sceneVersion:0};let a=typeof i.scene.appState.name==`string`?i.scene.appState.name.trim():``,o=a?rn(`appState.name`,a,t):`"appState.name" is missing; give the whiteboard a title`;return{title:a||t,warnings:o?[o]:[],version:n,sceneVersion:pS(i.scene)}}function hS(e){return{...oS(e),slidesOf:t=>{let n=je(e,`slides`,t);return n?Yx(n)?.slides??null:null}}}function gS(e,t,n){if(e===`document`)return gb(t,n).title;if(e===`artboard`)return xn(t).canvas?.title;if(e===`whiteboard`)return mS(t,n).title;if(e===`html`)return lS(t,n).title;if(e===`slides`)return Yx(t)?.title;try{return fS(d.default.readFileSync(f.default.join(t,A.report),`utf8`))}catch{return null}}function _S(e){let t=hS(e);return n=>{let r=pg(n),i=mg(n),a=je(e,r,i),o=sS(n,t);if(o)return{missing:o};let s=t.idOf(i,r);return!a||!s?{missing:`<ref ${r}="${i}"> cannot be read`}:{title:gS(r,a,i)||i,to:s}}}const vS={w:1280,h:720},yS=e=>{try{return d.default.statSync(e).mtimeMs}catch{return 0}};function bS(e){let t=e.x??0,n=e.y??0,r=e.width??0,i=e.height??0,a=Array.isArray(e.points)?e.points:null,o=a?.length?a.map(([e,r])=>[t+e,n+r]):[[t,n],[t+r,n],[t,n+i],[t+r,n+i]],s=typeof e.angle==`number`?e.angle:0;if(!s)return o;let c=t+r/2,l=n+i/2,u=Math.cos(s),d=Math.sin(s);return o.map(([e,t])=>[c+(e-c)*u-(t-l)*d,l+(e-c)*d+(t-l)*u])}function xS(e,t,n,r,i,a,o){let s=n.frame?r.frames[n.frame]:n.page,c=f.default.join(e,dn(s));o(c);let l=(r.scenes[s]?.elements??[]).filter(e=>!e.isDeleted),u=n.frame?l.find(e=>e.id===n.frame):void 0,d=u?{w:u.width??0,h:u.height??0}:SS(l);return!d||!(d.w>0&&d.h>0)?{missing:`${i}: ${n.frame?`frame ${n.frame}`:`page ${s}`} has nothing drawn on it yet`}:{kind:`frame`,src:`../../whiteboard/${t}/embed.html?${new URLSearchParams({...n.frame?{frame:n.frame}:{},page:s,v:String(Math.round(yS(c)))})}`,w:Math.round(d.w),h:Math.round(d.h),title:u?.name||mS(e,t).title,to:a}}function SS(e){let t=e.flatMap(bS);if(!t.length)return null;let n=t.map(([e])=>e),r=t.map(([,e])=>e);return{w:Math.max(...n)-Math.min(...n),h:Math.max(...r)-Math.min(...r)}}function CS(e,t,n,r,i,a){a(f.default.join(e,`canvas.json`));let o=xn(e),s=o.canvas?.boards[n];if(!s)return{missing:`${r}: the artboard has no board ${n}`};if(j(s))return{missing:`${r}: board ${n} is ${s.type===`image`?`an image`:`a video`}, not a page`};let c=vn(e,s.file);a(c??f.default.join(e,s.file));let l=o.versions[s.file];return!c||!l?{missing:`${r}: board ${n} is still being written`}:{kind:`frame`,src:`../../artboard/${t}/${encodeURI(s.file)}?v=${Math.round(l)}`,w:s.w,h:s.h,title:s.title||n,to:i}}function wS(e,t,n,r,i){let a=f.default.join(e,A.html);return i(a),d.default.existsSync(a)?{kind:`frame`,src:`../../html/${t}/${A.html}?v=${Math.round(Ie(e))}`,...vS,title:lS(e,t).title,to:r}:{missing:`${n}: the page has no ${A.html} yet`}}function TS(e,t,n,r,i){let a=f.default.join(e,A.report);i(a);for(let t of d.default.existsSync(f.default.join(e,`data`))?d.default.readdirSync(f.default.join(e,uS)):[])i(f.default.join(e,uS,t));let o=``;try{o=d.default.readFileSync(a,`utf8`)}catch{o=``}return{kind:`flow`,src:`../../report/${t}/index.html?block=${encodeURIComponent(n)}&embed&v=${Math.round(Ie(e))}`,title:fS(o)||t,to:r}}function ES(e,t,n,r,i){return i(f.default.join(e,PS)),{kind:`frame`,src:`../../slides/${t}/index.html?embed=${encodeURIComponent(n)}&v=${Math.round(Ie(e))}`,...vS,title:Yx(e)?.title||t,to:r}}function DS(e,t,n,r){if(!Oe(n))return;let i=f.default.join(e,t,n);if(t===`html`&&r(f.default.join(i,A.html)),t===`artboard`&&r(f.default.join(i,A.artboard)),t===`report`&&r(f.default.join(i,A.report)),t===`slides`&&r(f.default.join(i,PS)),t===`whiteboard`){r(f.default.join(i,sn)),r(f.default.join(i,cn));for(let e of[on,...tS(i)])r(f.default.join(i,dn(e)))}}function OS(e,t){let n=hS(e);return r=>{let i=pg(r),a=mg(r),o=sS(r,n,`embed`);if(o)return DS(e,i,a,t),{missing:o};let s=je(e,i,a),c=n.idOf(a,i),l=r.board??r.frame,u=`<embed ${i}="${a}"${l?` ${r.board?`board`:`frame`}="${l}"`:``}>`;if(!s||!c)return{missing:`${u} cannot be read`};if(i===`report`&&r.block)return TS(s,a,r.block,c,t);if(i===`slides`&&r.slide)return ES(s,a,r.slide,c,t);if(i===`html`)return wS(s,a,u,c,t);if(i===`artboard`&&r.board)return CS(s,a,r.board,u,c,t);let d=i===`whiteboard`?n.framesOf(a):null;return d&&(r.frame||r.page)?xS(s,a,r,d,u,c,t):{missing:`${u} cannot be read`}}}const kS=/^(?:id_(?:rsa|dsa|ecdsa|ed25519)\b.*|(?:secrets?|credentials?)(?:\..*)?|.*\.(?:pem|key|p12|pfx|jks|keystore|tfstate|tfvars)(?:\..*)?)$/i,AS=(e,t)=>e.toLowerCase().startsWith(`${t.toLowerCase()}${f.default.sep}`);function jS(e,t){let n={error:`${t} is outside what a deck may read`};if(f.default.isAbsolute(t))return n;let r=hn(e,t);if(!r)return n;let i;try{if(i=d.default.realpathSync(r),!AS(i,d.default.realpathSync(e)))return n;let a=d.default.statSync(i);if(!a.isFile())return{error:`${t} is not a file`};if(a.size>524288)return{error:`${t} is too large to put on a slide`}}catch{return{error:`${t} was not found`}}return i}function MS(e,t){try{return(0,p.execFileSync)(`git`,[`check-ignore`,`-q`,`--`,t],{cwd:e,stdio:`ignore`,timeout:2e3}),!0}catch{return!1}}function NS(e,t){let n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Map;return{deps:()=>[...n],embed:OS(f.default.resolve(e,`../..`),e=>n.add(e)),ref:_S(f.default.resolve(e,`../..`)),checkChart:t=>sb.chart(t,e)??null,readFile(i,a){let o=jS(i===`project`?t:e,a);if(typeof o!=`string`)return o;if(kS.test(f.default.basename(o))||kS.test(f.default.basename(a)))return{error:`${a} is named like a secret, and a deck does not show those`};if(i===`project`&&(r.has(o)||r.set(o,MS(t,o)),r.get(o)))return{error:`git ignores ${a}, and a deck does not show ignored files`};if(i===`artifact`&&f.default.basename(o).toLowerCase()===`comments.json`)return{error:`${a} is not part of the deck`};try{let e=d.default.readFileSync(o,`utf8`);return n.add(o),e}catch{return{error:`${a} could not be read`}}}}}const PS=`deck.xml`,FS=`index.html`,IS=e=>f.default.resolve(e,`../../../..`);function LS(e){try{return d.default.readFileSync(e,`utf8`)}catch{return null}}function RS(e,t=IS(e),n={}){let r=LS(f.default.join(e,PS));if(r===null){let t=LS(f.default.join(e,FS));return t===null?null:{html:t,source:`html`,issues:[],warnings:[],deps:[],embeds:[],refs:[],both:!1,complete:null,origins:/* @__PURE__ */ new Map,title:null,groups:[],cover:null}}let i=NS(e,t),a;try{a=ab(r,i,n)}catch(e){a={html:``,title:null,deps:[],embeds:[],refs:[],warnings:[],origins:/* @__PURE__ */ new Map,groups:[],cover:null,issues:[{code:`xml`,slide:-1,detail:`the deck could not be read: ${e instanceof Error?e.message:String(e)}`}]}}return{html:a.html,source:`xml`,issues:a.issues,warnings:a.warnings,deps:i.deps(),embeds:a.embeds,refs:a.refs,both:d.default.existsSync(f.default.join(e,FS)),complete:/<\/deck\s*>\s*$/.test(r),origins:a.origins,title:a.title,groups:a.groups,cover:a.cover}}function zS(e,t){let n=f.default.resolve(e,t);return n.startsWith(`${e}${f.default.sep}`)&&d.default.existsSync(n)}function BS(e){try{return d.default.statSync(e).mtimeMs}catch{return 0}}function VS(e,t,n=IS(e)){let r=RS(e,n),i=Math.max(Ie(e,`comments.json`),...(r?.deps??[]).map(BS));if(!r)return{title:t,version:i,complete:!1,outline:[],issues:[],warnings:[`${PS} not found`]};let a=W_(r.html),o=r.source===`xml`,s=new Set(r.embeds.flatMap(({frame:e})=>e?[e]:[]));return{title:r.title||a.title||t,version:i,complete:r.complete??a.complete,outline:a.slides,issues:[...r.both?[{code:`two_entries`,slide:-1}]:[],...a.issues,...a.assets.filter(t=>!s.has(t)&&!zS(e,t)).map(e=>({code:`missing_asset`,slide:-1,detail:e}))],...o?{sourceIssues:r.issues,sourceWarnings:r.warnings}:{},...o?{groups:r.groups,origins:Object.fromEntries(r.origins),...r.cover?{cover:r.cover}:{}}:{},warnings:o||a.hasDeck?[]:[`index.html has no <div class="reveal"><div class="slides">`]}}function HS(e){try{return JSON.parse(d.default.readFileSync(e,`utf8`))}catch{return null}}function US(e,t){let n=/* @__PURE__ */ new Map,r=HS(e);if(!yr(r)||r.version!==t||!Array.isArray(r.slides))return n;for(let e of r.slides)yr(e)&&typeof e.id==`string`&&typeof e.overflow==`boolean`&&n.set(e.id,e.overflow);return n}function WS(e){let t=/* @__PURE__ */ new Map,n=HS(e);if(!yr(n)||!Array.isArray(n.threads))return t;for(let e of n.threads){if(!yr(e)||e.status!==`open`||!yr(e.anchor))continue;let{slide:n}=e.anchor;typeof n==`string`&&t.set(n,(t.get(n)??0)+1)}return t}function GS(e,t){let n=f.default.join(e,`slides`,t),r=VS(n,t),i=US(f.default.join(e,`.state`,`slides`,t,`outline.json`),r.version),a=WS(f.default.join(n,`comments.json`));return r.outline.map((e,t)=>{let n=e.id===null?void 0:i.get(e.id);return{number:t+1,id:e.id??``,layout:e.layout,title:e.title,steps:e.steps,overflow:n===void 0?`unknown`:n?`yes`:`no`,comments:e.id!==null&&a.get(e.id)||0}})}const KS={authoring:w_,source:`deck.xml`,changes:!0,review:{sections:[]},localGet:{key:`slides`,read:(e,t)=>{let n=GS(e,t);return n?{rows:n}:{}},columns:[{key:`number`,required:!0,positional:!0},{key:`id`,required:!0,positional:!0},{key:`layout`,positional:!0},{key:`title`,positional:!0},{key:`steps`},{key:`overflow`},{key:`comments`}]},outlineView:{rows:e=>e.map(e=>({...e,overflow:e.overflow===!0?`yes`:e.overflow===!1?`no`:`unknown`})),columns:[{key:`id`,positional:!0,required:!0},{key:`layout`,positional:!0},{key:`title`,positional:!0},{key:`steps`},{key:`overflow`}]},commentActions:{add:e=>{if(!e.slide)throw new M(`comment add on a deck needs --slide <slideId>`);return{op:`add`,slide:e.slide,text:$n(e)}}}},qS=String.raw`import { spawn, spawnSync } from 'node:child_process';
|
|
390
|
+
import fs from 'node:fs';
|
|
391
|
+
import os from 'node:os';
|
|
392
|
+
import path from 'node:path';
|
|
393
|
+
|
|
394
|
+
const RATE = 48000;
|
|
395
|
+
const CHANNELS = 2;
|
|
396
|
+
const SEEK_TIMEOUT_MS = 30000;
|
|
397
|
+
|
|
398
|
+
let raw = '';
|
|
399
|
+
for await (const chunk of process.stdin) raw += chunk;
|
|
400
|
+
const job = JSON.parse(raw);
|
|
401
|
+
const say = (progress, stage) => console.log(JSON.stringify({ progress, stage }));
|
|
402
|
+
const fail = (message) => {
|
|
403
|
+
console.error(message);
|
|
404
|
+
process.exit(1);
|
|
405
|
+
};
|
|
406
|
+
const cleanups = new Set();
|
|
407
|
+
const children = new Set();
|
|
408
|
+
const cleanUp = () => {
|
|
409
|
+
for (const child of children) child.kill('SIGKILL');
|
|
410
|
+
children.clear();
|
|
411
|
+
for (const clean of cleanups) {
|
|
412
|
+
try {
|
|
413
|
+
clean();
|
|
414
|
+
} catch {
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
cleanups.clear();
|
|
419
|
+
};
|
|
420
|
+
process.on('SIGTERM', () => {
|
|
421
|
+
cleanUp();
|
|
422
|
+
process.exit(143);
|
|
423
|
+
});
|
|
424
|
+
process.on('exit', cleanUp);
|
|
425
|
+
|
|
426
|
+
const onPath = (name) =>
|
|
427
|
+
(process.env.PATH || '')
|
|
428
|
+
.split(path.delimiter)
|
|
429
|
+
.map((dir) => path.join(dir, name))
|
|
430
|
+
.find((file) => fs.existsSync(file));
|
|
431
|
+
|
|
432
|
+
function findChrome() {
|
|
433
|
+
if (process.env.CHROME_PATH) return fs.existsSync(process.env.CHROME_PATH) ? process.env.CHROME_PATH : null;
|
|
434
|
+
const known =
|
|
435
|
+
process.platform === 'darwin'
|
|
436
|
+
? [
|
|
437
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
438
|
+
'/Applications/Chromium.app/Contents/MacOS/Chromium',
|
|
439
|
+
'/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
|
|
440
|
+
]
|
|
441
|
+
: process.platform === 'win32'
|
|
442
|
+
? [
|
|
443
|
+
path.join(process.env.PROGRAMFILES || 'C:\\Program Files', 'Google/Chrome/Application/chrome.exe'),
|
|
444
|
+
path.join(process.env['PROGRAMFILES(X86)'] || 'C:\\Program Files (x86)', 'Google/Chrome/Application/chrome.exe'),
|
|
445
|
+
]
|
|
446
|
+
: [];
|
|
447
|
+
return (
|
|
448
|
+
known.find((file) => fs.existsSync(file)) ||
|
|
449
|
+
['google-chrome', 'google-chrome-stable', 'chromium', 'chromium-browser'].map(onPath).find(Boolean) ||
|
|
450
|
+
null
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const chrome = findChrome();
|
|
455
|
+
if (!chrome) fail('Chrome not found: install Google Chrome, or set CHROME_PATH to a Chrome or Chromium binary');
|
|
456
|
+
if (spawnSync('ffmpeg', ['-version']).status !== 0)
|
|
457
|
+
fail('ffmpeg not found: install it (macOS: brew install ffmpeg) and export again');
|
|
458
|
+
if (typeof WebSocket === 'undefined') fail('this script needs Node 22 or later');
|
|
459
|
+
|
|
460
|
+
const exec = (args, input) =>
|
|
461
|
+
new Promise((resolve, reject) => {
|
|
462
|
+
const child = spawn('ffmpeg', ['-v', 'error', '-y', ...args], { stdio: ['pipe', 'pipe', 'pipe'] });
|
|
463
|
+
children.add(child);
|
|
464
|
+
const out = [];
|
|
465
|
+
let err = '';
|
|
466
|
+
child.stdout.on('data', (chunk) => out.push(chunk));
|
|
467
|
+
child.stderr.on('data', (chunk) => (err = (err + chunk).slice(-4000)));
|
|
468
|
+
child.on('error', reject);
|
|
469
|
+
child.on('close', (code) => {
|
|
470
|
+
children.delete(child);
|
|
471
|
+
if (code === 0) resolve(Buffer.concat(out));
|
|
472
|
+
else reject(new Error('ffmpeg: ' + err.trim()));
|
|
473
|
+
});
|
|
474
|
+
if (input) input(child.stdin);
|
|
475
|
+
else child.stdin.end();
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
function cdp(url) {
|
|
479
|
+
return new Promise((resolve, reject) => {
|
|
480
|
+
const ws = new WebSocket(url);
|
|
481
|
+
const waiting = new Map();
|
|
482
|
+
let id = 0;
|
|
483
|
+
ws.onmessage = (event) => {
|
|
484
|
+
const message = JSON.parse(event.data);
|
|
485
|
+
const pending = message.id && waiting.get(message.id);
|
|
486
|
+
if (!pending) return;
|
|
487
|
+
waiting.delete(message.id);
|
|
488
|
+
if (message.error) pending.reject(new Error(message.error.message));
|
|
489
|
+
else pending.resolve(message.result);
|
|
490
|
+
};
|
|
491
|
+
ws.onerror = () => reject(new Error('could not reach Chrome'));
|
|
492
|
+
ws.onopen = () =>
|
|
493
|
+
resolve({
|
|
494
|
+
send: (method, params = {}) =>
|
|
495
|
+
new Promise((ok, no) => {
|
|
496
|
+
id += 1;
|
|
497
|
+
waiting.set(id, { resolve: ok, reject: no });
|
|
498
|
+
ws.send(JSON.stringify({ id, method, params }));
|
|
499
|
+
}),
|
|
500
|
+
close: () => ws.close(),
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
async function launch() {
|
|
506
|
+
const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'ryugi-render-'));
|
|
507
|
+
const child = spawn(
|
|
508
|
+
chrome,
|
|
509
|
+
[
|
|
510
|
+
'--headless=new',
|
|
511
|
+
'--remote-debugging-port=0',
|
|
512
|
+
'--user-data-dir=' + profile,
|
|
513
|
+
'--no-first-run',
|
|
514
|
+
'--no-default-browser-check',
|
|
515
|
+
'--hide-scrollbars',
|
|
516
|
+
'--mute-audio',
|
|
517
|
+
'--autoplay-policy=no-user-gesture-required',
|
|
518
|
+
'about:blank',
|
|
519
|
+
],
|
|
520
|
+
{ stdio: 'ignore', detached: process.platform !== 'win32' },
|
|
521
|
+
);
|
|
522
|
+
const stop = () => {
|
|
523
|
+
try {
|
|
524
|
+
if (process.platform !== 'win32') process.kill(-child.pid, 'SIGKILL');
|
|
525
|
+
else child.kill('SIGKILL');
|
|
526
|
+
} catch {}
|
|
527
|
+
fs.rmSync(profile, { recursive: true, force: true });
|
|
528
|
+
};
|
|
529
|
+
cleanups.add(stop);
|
|
530
|
+
const portFile = path.join(profile, 'DevToolsActivePort');
|
|
531
|
+
for (let tries = 0; tries < 200 && !fs.existsSync(portFile); tries += 1)
|
|
532
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
533
|
+
if (!fs.existsSync(portFile)) fail('Chrome did not open its DevTools port');
|
|
534
|
+
const port = fs.readFileSync(portFile, 'utf8').split('\n')[0];
|
|
535
|
+
const target = await (await fetch('http://127.0.0.1:' + port + '/json/new?about:blank', { method: 'PUT' })).json();
|
|
536
|
+
const page = await cdp(target.webSocketDebuggerUrl);
|
|
537
|
+
await page.send('Page.enable');
|
|
538
|
+
await page.send('Emulation.setDeviceMetricsOverride', {
|
|
539
|
+
width: job.width,
|
|
540
|
+
height: job.height,
|
|
541
|
+
deviceScaleFactor: 1,
|
|
542
|
+
mobile: false,
|
|
543
|
+
});
|
|
544
|
+
return { page, stop };
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
async function evaluate(page, expression) {
|
|
548
|
+
const result = await page.send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true });
|
|
549
|
+
if (result.exceptionDetails) throw new Error(result.exceptionDetails.exception?.description || expression);
|
|
550
|
+
return result.result.value;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
async function open(page, from, to) {
|
|
554
|
+
const url = new URL(job.renderUrl);
|
|
555
|
+
url.searchParams.set('from', String(from));
|
|
556
|
+
url.searchParams.set('to', String(to));
|
|
557
|
+
if (!job.captions) url.searchParams.set('captions', '0');
|
|
558
|
+
await page.send('Page.navigate', { url: url.toString() });
|
|
559
|
+
const until = Date.now() + SEEK_TIMEOUT_MS;
|
|
560
|
+
while (!(await evaluate(page, 'Boolean(window.ryugiStoryboard && window.ryugiStoryboard.duration > 0)'))) {
|
|
561
|
+
if (Date.now() > until) throw new Error('the render page did not load: ' + url.pathname);
|
|
562
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
const frameOf = (seconds) => Math.round(seconds * job.fps);
|
|
567
|
+
const totalFrames = Math.max(1, frameOf(job.duration));
|
|
568
|
+
let framesDone = 0;
|
|
569
|
+
|
|
570
|
+
async function renderSegment(page, shot) {
|
|
571
|
+
const first = frameOf(shot.start);
|
|
572
|
+
const last = frameOf(shot.start + shot.dur);
|
|
573
|
+
const count = last - first;
|
|
574
|
+
const file = path.join(job.cache, shot.segment + '-' + job.fps + '.mp4');
|
|
575
|
+
if (count <= 0) return null;
|
|
576
|
+
if (fs.existsSync(file)) {
|
|
577
|
+
framesDone += count;
|
|
578
|
+
say((framesDone / totalFrames) * 0.85, 'shot ' + shot.id + ' (cached)');
|
|
579
|
+
return file;
|
|
580
|
+
}
|
|
581
|
+
const from = first / job.fps;
|
|
582
|
+
const to = last / job.fps;
|
|
583
|
+
await open(page, from, to);
|
|
584
|
+
const temp = file + '.' + process.pid + '.tmp.mp4';
|
|
585
|
+
const dropTemp = () => fs.rmSync(temp, { force: true });
|
|
586
|
+
cleanups.add(dropTemp);
|
|
587
|
+
await exec(
|
|
588
|
+
['-f', 'image2pipe', '-framerate', String(job.fps), '-c:v', 'mjpeg', '-i', '-', '-c:v', 'libx264', '-preset', 'veryfast', '-crf', '16', '-pix_fmt', 'yuv420p', '-r', String(job.fps), temp],
|
|
589
|
+
async (stdin) => {
|
|
590
|
+
for (let frame = 0; frame < count; frame += 1) {
|
|
591
|
+
await evaluate(page, 'window.ryugiStoryboard.seek(' + frame / job.fps + ')');
|
|
592
|
+
const shotData = await page.send('Page.captureScreenshot', { format: 'jpeg', quality: 92, fromSurface: true });
|
|
593
|
+
if (!stdin.write(Buffer.from(shotData.data, 'base64'))) await new Promise((resolve) => stdin.once('drain', resolve));
|
|
594
|
+
framesDone += 1;
|
|
595
|
+
if (frame % job.fps === 0) say((framesDone / totalFrames) * 0.85, 'shot ' + shot.id);
|
|
596
|
+
}
|
|
597
|
+
stdin.end();
|
|
598
|
+
},
|
|
599
|
+
);
|
|
600
|
+
fs.renameSync(temp, file);
|
|
601
|
+
cleanups.delete(dropTemp);
|
|
602
|
+
return file;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
function levelAt(envelope, time) {
|
|
606
|
+
if (!envelope.length) return 0;
|
|
607
|
+
if (time <= envelope[0][0]) return envelope[0][1];
|
|
608
|
+
for (let index = 1; index < envelope.length; index += 1) {
|
|
609
|
+
const [t1, v1] = envelope[index];
|
|
610
|
+
if (time > t1) continue;
|
|
611
|
+
const [t0, v0] = envelope[index - 1];
|
|
612
|
+
return t1 > t0 ? v0 + ((v1 - v0) * (time - t0)) / (t1 - t0) : v1;
|
|
613
|
+
}
|
|
614
|
+
return envelope[envelope.length - 1][1];
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
function tempo(speed) {
|
|
618
|
+
const parts = [];
|
|
619
|
+
let rest = speed;
|
|
620
|
+
while (rest < 0.5) {
|
|
621
|
+
parts.push(0.5);
|
|
622
|
+
rest /= 0.5;
|
|
623
|
+
}
|
|
624
|
+
parts.push(rest);
|
|
625
|
+
return parts.map((each) => 'atempo=' + each).join(',');
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
async function mixAudio() {
|
|
629
|
+
const samples = Math.ceil(job.duration * RATE);
|
|
630
|
+
const mix = new Float32Array(samples * CHANNELS);
|
|
631
|
+
const sources = [...job.audio.voice, ...job.audio.music, ...job.audio.sfx, ...(job.audio.takes || [])];
|
|
632
|
+
for (const source of sources) {
|
|
633
|
+
const end = Math.min(source.end, job.duration);
|
|
634
|
+
if (end <= source.start || source.envelope.every(([, level]) => level === 0)) continue;
|
|
635
|
+
let pcm;
|
|
636
|
+
try {
|
|
637
|
+
const speed = source.speed || 1;
|
|
638
|
+
const filter = speed === 1 ? [] : ['-af', tempo(speed)];
|
|
639
|
+
pcm = await exec(['-ss', String(source.from), '-t', String((end - source.start) * speed), '-i', path.resolve(job.dir, source.file), '-vn', ...filter, '-f', 'f32le', '-ac', String(CHANNELS), '-ar', String(RATE), '-']);
|
|
640
|
+
} catch (error) {
|
|
641
|
+
console.error('skipped ' + source.file + ': ' + error.message);
|
|
642
|
+
continue;
|
|
643
|
+
}
|
|
644
|
+
const offset = Math.round(source.start * RATE);
|
|
645
|
+
const frames = Math.min(pcm.length / 4 / CHANNELS, samples - offset);
|
|
646
|
+
for (let frame = 0; frame < frames; frame += 1) {
|
|
647
|
+
const level = levelAt(source.envelope, source.start + frame / RATE);
|
|
648
|
+
if (level === 0) continue;
|
|
649
|
+
for (let channel = 0; channel < CHANNELS; channel += 1) {
|
|
650
|
+
const at = (offset + frame) * CHANNELS + channel;
|
|
651
|
+
mix[at] += pcm.readFloatLE((frame * CHANNELS + channel) * 4) * level;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
for (let index = 0; index < mix.length; index += 1) mix[index] = Math.max(-1, Math.min(1, mix[index]));
|
|
656
|
+
return Buffer.from(mix.buffer);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
fs.mkdirSync(job.cache, { recursive: true });
|
|
660
|
+
fs.mkdirSync(path.dirname(job.out), { recursive: true });
|
|
661
|
+
const browser = await launch();
|
|
662
|
+
const segments = [];
|
|
663
|
+
try {
|
|
664
|
+
for (const shot of job.shots) {
|
|
665
|
+
const file = await renderSegment(browser.page, shot);
|
|
666
|
+
if (file) segments.push(file);
|
|
667
|
+
}
|
|
668
|
+
} finally {
|
|
669
|
+
browser.page.close();
|
|
670
|
+
browser.stop();
|
|
671
|
+
}
|
|
672
|
+
say(0.88, 'sound');
|
|
673
|
+
const work = fs.mkdtempSync(path.join(os.tmpdir(), 'ryugi-mix-'));
|
|
674
|
+
cleanups.add(() => fs.rmSync(work, { recursive: true, force: true }));
|
|
675
|
+
const mixFile = path.join(work, 'mix.f32');
|
|
676
|
+
fs.writeFileSync(mixFile, await mixAudio());
|
|
677
|
+
const list = path.join(work, 'segments.txt');
|
|
678
|
+
fs.writeFileSync(list, segments.map((file) => "file '" + file.replaceAll("'", "'\\''") + "'").join('\n') + '\n');
|
|
679
|
+
say(0.92, 'encode');
|
|
680
|
+
await exec([
|
|
681
|
+
'-f', 'concat', '-safe', '0', '-i', list,
|
|
682
|
+
'-f', 'f32le', '-ar', String(RATE), '-ac', String(CHANNELS), '-i', mixFile,
|
|
683
|
+
'-map', '0:v', '-map', '1:a',
|
|
684
|
+
'-c:v', 'libx264', '-preset', 'medium', '-b:v', '1500k', '-maxrate', '2000k', '-bufsize', '3000k', '-pix_fmt', 'yuv420p',
|
|
685
|
+
'-c:a', 'aac', '-b:a', '160k', '-t', String(job.duration), '-movflags', '+faststart',
|
|
686
|
+
job.out,
|
|
687
|
+
]);
|
|
688
|
+
fs.rmSync(work, { recursive: true, force: true });
|
|
689
|
+
say(1, 'done');
|
|
690
|
+
`,JS=`render/render.mjs`;function YS(e,t=!1){let n=f.default.join(e,JS);return!t&&d.default.existsSync(n)?!1:(d.default.mkdirSync(f.default.dirname(n),{recursive:!0}),d.default.writeFileSync(n,qS,{flag:t?`w`:`wx`}),!0)}const XS=`import { spawnSync } from 'node:child_process';
|
|
691
|
+
import { unlinkSync, writeFileSync } from 'node:fs';
|
|
692
|
+
|
|
693
|
+
const MODEL = 'google/gemini-3.8-flash-tts';
|
|
694
|
+
const RATE = 24000;
|
|
695
|
+
|
|
696
|
+
let raw = '';
|
|
697
|
+
for await (const chunk of process.stdin) raw += chunk;
|
|
698
|
+
const input = JSON.parse(raw);
|
|
699
|
+
const key = process.env.OPENROUTER_API_KEY;
|
|
700
|
+
if (!key) {
|
|
701
|
+
console.error('OPENROUTER_API_KEY is not set: add it to the project .env');
|
|
702
|
+
process.exit(1);
|
|
703
|
+
}
|
|
704
|
+
const response = await fetch('https://openrouter.ai/api/v1/audio/speech', {
|
|
705
|
+
method: 'POST',
|
|
706
|
+
headers: { Authorization: 'Bearer ' + key, 'Content-Type': 'application/json' },
|
|
707
|
+
body: JSON.stringify({
|
|
708
|
+
model: MODEL,
|
|
709
|
+
input: input.text,
|
|
710
|
+
voice: input.voice || 'Kore',
|
|
711
|
+
response_format: 'pcm',
|
|
712
|
+
...(input.direction ? { instructions: input.direction } : {}),
|
|
713
|
+
}),
|
|
714
|
+
});
|
|
715
|
+
if (!response.ok) {
|
|
716
|
+
console.error('OpenRouter ' + response.status + ': ' + (await response.text()));
|
|
717
|
+
process.exit(1);
|
|
718
|
+
}
|
|
719
|
+
const pcm = Buffer.from(await response.arrayBuffer());
|
|
720
|
+
const pcmFile = input.out + '.pcm';
|
|
721
|
+
writeFileSync(pcmFile, pcm);
|
|
722
|
+
const ffmpeg = spawnSync(
|
|
723
|
+
'ffmpeg',
|
|
724
|
+
['-v', 'error', '-y', '-f', 's16le', '-ar', String(RATE), '-ac', '1', '-i', pcmFile, '-c:a', 'libopus', '-b:a', '64k', input.out],
|
|
725
|
+
{ encoding: 'utf8' },
|
|
726
|
+
);
|
|
727
|
+
unlinkSync(pcmFile);
|
|
728
|
+
if (ffmpeg.status !== 0) {
|
|
729
|
+
console.error('ffmpeg could not encode the audio as Opus: ' + (ffmpeg.stderr || ffmpeg.error?.message || 'is ffmpeg installed?'));
|
|
730
|
+
process.exit(1);
|
|
731
|
+
}
|
|
732
|
+
console.log(JSON.stringify({ duration: pcm.length / 2 / RATE }));
|
|
733
|
+
`,ZS=[`import { spawnSync } from 'node:child_process';
|
|
734
|
+
import { unlinkSync, writeFileSync } from 'node:fs';
|
|
735
|
+
|
|
736
|
+
const MODEL = 'google/gemini-3.8-flash-tts';
|
|
737
|
+
const RATE = 24000;
|
|
738
|
+
|
|
739
|
+
let raw = '';
|
|
740
|
+
for await (const chunk of process.stdin) raw += chunk;
|
|
741
|
+
const input = JSON.parse(raw);
|
|
742
|
+
const key = process.env.OPENROUTER_API_KEY;
|
|
743
|
+
if (!key) {
|
|
744
|
+
console.error('OPENROUTER_API_KEY is not set: add it to the project .env');
|
|
745
|
+
process.exit(1);
|
|
746
|
+
}
|
|
747
|
+
const response = await fetch('https://openrouter.ai/api/v1/audio/speech', {
|
|
748
|
+
method: 'POST',
|
|
749
|
+
headers: { Authorization: 'Bearer ' + key, 'Content-Type': 'application/json' },
|
|
750
|
+
body: JSON.stringify({ model: MODEL, input: input.text, voice: input.voice || 'Kore', response_format: 'pcm' }),
|
|
751
|
+
});
|
|
752
|
+
if (!response.ok) {
|
|
753
|
+
console.error('OpenRouter ' + response.status + ': ' + (await response.text()));
|
|
754
|
+
process.exit(1);
|
|
755
|
+
}
|
|
756
|
+
const pcm = Buffer.from(await response.arrayBuffer());
|
|
757
|
+
const pcmFile = input.out + '.pcm';
|
|
758
|
+
writeFileSync(pcmFile, pcm);
|
|
759
|
+
const ffmpeg = spawnSync(
|
|
760
|
+
'ffmpeg',
|
|
761
|
+
['-v', 'error', '-y', '-f', 's16le', '-ar', String(RATE), '-ac', '1', '-i', pcmFile, '-c:a', 'libopus', '-b:a', '64k', input.out],
|
|
762
|
+
{ encoding: 'utf8' },
|
|
763
|
+
);
|
|
764
|
+
unlinkSync(pcmFile);
|
|
765
|
+
if (ffmpeg.status !== 0) {
|
|
766
|
+
console.error('ffmpeg could not encode the audio as Opus: ' + (ffmpeg.stderr || ffmpeg.error?.message || 'is ffmpeg installed?'));
|
|
767
|
+
process.exit(1);
|
|
768
|
+
}
|
|
769
|
+
console.log(JSON.stringify({ duration: pcm.length / 2 / RATE }));
|
|
770
|
+
`];function QS(e){let t=f.default.join(e,`voice/voice.mjs`);return d.default.existsSync(t)?(ZS.includes(d.default.readFileSync(t,`utf8`))&&d.default.writeFileSync(t,XS),!1):(d.default.mkdirSync(f.default.dirname(t),{recursive:!0}),d.default.writeFileSync(t,XS,{flag:`wx`}),!0)}var $S='# Storyboard writing\n\nA storyboard plans a product demo video and plays it back before anything is recorded: shots in order, each with a duration, what happens on screen, and voiceover lines that are synthesized and spoken with captions. Write `storyboard.xml` under the returned artifact directory first, with no shot pictures at all: every shot without `src` plays as a title card, so your human partner can hear the pacing within minutes. Add moving pictures, recorded takes, music and sound effects afterwards. On this machine the hub opens a storyboard in an editor: a monitor, a bin and a multitrack timeline (captions, overlay, picture, voice, music, effects) where your human partner trims, splits, reorders, adds transitions, speed, keys and sounds, and exports the next cut.\n\nRe-read `storyboard.xml` and the shot pages immediately before each edit: your human partner edits the timeline, and the server writes those edits into the same file, and moving an overlay rewrites the times of `sb-cursor`, `sb-type` or `sb-clip` in the shot page. Patch only the shots and lines you mean to change and keep every id. Never edit `comments.json`, `audio/`, `cuts/` or `.state/`. Finish with `check`; lines still being voiced are pending, not done.\n\n```xml\n<storyboard title="Shared albums" aspect="16:9" lang="en" voice="Kore" target="10-15">\n <lexicon>\n <say word="Ryugi" as="Lyu-ghee" hint="lyu as in the Chinese name Liu, never an English r; hard g"/>\n </lexicon>\n <music id="bed" src="sound/bed.mp3" at="0" gain="-18" duck="-10" fade-in="1" fade-out="2"/>\n <shot id="hook" title="A wall of text" dur="4">\n <action>The terminal fills with a 300-line plan</action>\n <action>Cut away before anyone could read it</action>\n <line id="hook-1" at="0.4">Your agent wrote 300 lines. Now read them.</line>\n </shot>\n <shot id="sketch" title="Sketch it together" dur="8" src="shots/sketch.html" transition="dissolve" transition-dur="0.4">\n <action>You draw a box; the agent completes the flow</action>\n <key prop="scale" at="2" value="1"/>\n <key prop="scale" at="5" value="1.18" ease="in-out"/>\n <sfx id="click" src="sound/click.wav" at="2.6" gain="-6"/>\n <line id="sketch-1" caption="Sketch it together.">Sketch the structure together, right in the page.</line>\n </shot>\n</storyboard>\n```\n\n## Elements\n\n- `<storyboard>`: `title`; `aspect` is `16:9` (default), `9:16` or `1:1`; `lang`; `voice` is the voice name passed to the voice script; `target` is the intended length as a range of seconds (`"65-80"`), and a total outside it is a warning.\n- `<lexicon>` with `<say word="…" as="…" hint="…"/>`: pronunciations. Before synthesis every whole-word `word` is replaced by `as`; captions keep the original words. A respelling alone is often read wrong, so a line holding the word also tells the speech model that `as` is how `word` is said, followed by `hint` (optional: how it sounds, in plain words). Give every made-up or borrowed name a `hint`.\n- `<shot>`: `id`, `title`, `dur` (seconds, required, one decimal is fine). Optional `src` (a shot page under `shots/`), `take` (a recorded clip under `takes/`) and `take-in` (the second of the take to start from). A shot starts where the shots before it end; never write start times.\n- `<action>`: one thing that happens on screen, one sentence each. Title cards and the script column show them.\n- `<line>`: one voiceover line. `at` is seconds from the shot\'s start; without it the line follows the previous line by 0.3s (the first line starts 0.3s in). `caption` replaces the words shown on screen; without it the caption is the line itself. `gain` is its volume in dB (default 0).\n\nShot and line ids are lowercase letters, digits and hyphens, unique across the whole file; comments are anchored to them.\n\n## Tracks\n\nShots are the spine: everything below is optional, and a storyboard without it is a picture, voice and caption timeline. Times on a shot are seconds from its start on the timeline; music uses whole-video seconds.\n\n- On `<shot>`: `speed` (0.25 to 4, default 1) runs the page clock and the take faster or slower while `dur` stays its length on the timeline; voice, keys and effects are not sped up. `src-in` is the second of the shot page to start from. `transition` is `cut` (default), `dissolve` or `black`, centred on the seam before this shot and `transition-dur` seconds long (default 0.4, at most half the shorter shot); it never changes the total length. `gain` in dB plays a take\'s own sound, which is otherwise muted.\n- `<key prop="…" at="…" value="…" ease="…"/>` inside a shot animates the picture layer: `x` and `y` in design pixels, `scale` as a factor, `opacity` 0 to 1, and `gain` in dB for a take\'s sound. `ease` is `linear` (default), `in`, `out` or `in-out`, easing into that key. One key holds its value for the whole shot; captions do not move.\n- `<sfx id src at gain fade-in fade-out/>` inside a shot plays a sound effect `at` seconds into the shot.\n- `<music id src at from to gain duck fade-in fade-out>` at the top level plays a file from `at` seconds into the video, starting `from` seconds into the file and ending at `to` (default: the end of the video). `duck` lowers it by that many dB while a voice line plays (down in 0.2s, back in 0.4s). Gain `<key prop="gain">` elements inside it change its volume over time, in seconds from `at`.\n- On `<storyboard>`: `mute="music sfx"` silences any of `voice`, `music` and `sfx`, and `captions="off"` hides captions; both carry into the export.\n\nSound files live in `sound/` (mp3, wav, m4a or ogg). Put them there yourself, or your human partner drops them into the editor. `check` reports a track that names a file that is not there.\n\n## Voice\n\nEvery line is synthesized on its own by `voice/voice.mjs` in the artifact directory, which `start` copies from a template the first time and keeps up to date while it is unedited (OpenRouter text-to-speech; it reads `OPENROUTER_API_KEY` from the project\'s `.env` and needs ffmpeg). It reads `{text, voice, lang, out, direction?}` on stdin; `direction` carries the lexicon\'s pronunciations for that line. The hub runs it a second after `storyboard.xml` changes, only for lines whose words, voice or lexicon changed. Run `ryugi storyboard voice --artifact storyboard/<id>` to synthesize and print each line\'s length, then fit shot durations to the voice: `check` reports a voiced line that runs past its shot or overlaps the line before it. `--line <id>` voices one line; `--force` re-voices everything after you change the script.\n\n## Shot pages\n\nA shot page is plain HTML with CSS animations, drawn the way the product looks, laid out at 1920×1080 (1080×1920 for `aspect="9:16"`, 1080×1080 for `1:1`) and scaled to fit the player. Time 0 is the shot\'s start; the viewer pauses every animation and seeks it, so scrubbing and frame-by-frame capture show exactly the same frame. Animate only with CSS animations or the Web Animations API, never with `setTimeout`, `setInterval` or `requestAnimationFrame`, and give every animation a finite iteration count. Three elements cover what CSS cannot seek:\n\n- `<sb-clip src="../takes/raw.mp4" from="3.2" to="11.2" at="0.5">` plays part of a recorded video, muted, starting `at` seconds into the shot.\n- `<sb-cursor path="420,300@0 610,340@1.2 click@1.3 700,420@2.4">` moves a pointer through `x,y@seconds` points and ripples on each `click@seconds`.\n- `<sb-type at="2.3" cps="28">text</sb-type>` types its text from `at`, `cps` characters a second.\n\n`sb-cursor` covers the page, so its points are page pixels. Pages cannot reach the network; keep images under `assets/` and refer to them relatively. `check` warns about timers and endless animations, and counts a shot as not yet run until the viewer has shown it.\n\nThe page `…/storyboard/<id>/render` draws only the picture and captions, with transitions, speed and keys, exactly as the editor\'s monitor does (`?captions=0` drops captions, `?from=&to=` draws only that stretch). Its `window.ryugiStoryboard.seek(t)` resolves once that frame is painted, `duration` is the length in seconds, `audio()` lists every voiced line\'s file URL and start, and `mix()` lists every sound with its file, start, end, gain, fades, keys and duck, so any capture tool can step frame by frame and mix the sound in.\n\n## Takes, export and the cut\n\nPut recorded clips in `takes/` and name them with `take` on their shot; the shot then plays the clip under the voiceover, muted unless the shot has a `gain`, and its shot page and overlays are not drawn (put a clip in the page with `sb-clip` to draw over it).\n\nExport renders the timeline into the next cut on this machine. `start` copies an export script to `render/render.mjs` the first time; it drives Chrome over the DevTools protocol and ffmpeg, with no packages to install, renders each shot from the render page frame by frame, reuses shots that did not change, mixes voice, music and effects and writes 1080p H.264. The hub hands it the timeline as JSON on stdin and registers what it writes as the next cut, with a hash of every shot so the editor marks the shots that changed. Run `ryugi storyboard export --artifact storyboard/<id> [--wait]` to export from the command line; lines not yet voiced are voiced first. `ryugi storyboard template --artifact storyboard/<id> --force` replaces `render/render.mjs` with the latest template; without `--force` a script you changed is kept. A project can replace the script with its own kit that reads the same JSON.\n\nWhen a finished video comes from somewhere else, register it with `ryugi storyboard cut --artifact storyboard/<id> --file <1080p.mp4> [--map <map.json>] [--master <4k.mp4>]`. Without `--map` each shot\'s range comes from the storyboard\'s current durations; pass a map (`{"shots":[{"id":"hook","start":0,"end":4.2}]}`) when the cut\'s timing differs. Encode the cut as H.264 1080p at about 1.5 Mbps so it fits the Cloud allowance.\n\n## Comments and references\n\nRead feedback with `comment list`. Comments are anchored to a shot, a line, a moment of a shot (`--at <seconds>`) or a moment of a cut (`--cut <n> --at <seconds>`), which maps to its shot; `comment list` names each thread\'s shot, moment or line, and for an area marked on a recorded take or the cut, the path of its crop. A thread whose shot was deleted stays, marked `shot deleted`. Your human partner can reorder, trim, split and join shots, rewrite titles, actions and voice lines, add, duplicate or delete shots, and set transitions, speed, keys, sounds and mutes in the editor; each edit rewrites only its part of `storyboard.xml`. A split gives the second half the id `<id>-b` and leaves its comments on the first half. When `check` reports `Structure: N changes by your human partner`, run `changes --artifact storyboard/<id>` and read them before editing the file, so you build on their version instead of writing it back. A document or deck links a shot with `<ref storyboard="<id>" shot="<shot-id>"/>`.\n';function eC(e){if(!e.shot&&!e.cut)throw new M(`comment add on a storyboard needs --shot <shotId>, or --cut <n> --at <seconds>`);if(e.line&&e.at!==void 0)throw new M(`comment add takes --line or --at, not both`);let t=er(e.at,`--at`);if(t!==void 0&&t<0)throw new M(`--at must be seconds from 0`);let n;if(e.cut!==void 0){if(n=Number(e.cut),!Number.isInteger(n)||n<1)throw new M(`--cut must be a cut number from 1`);if(t===void 0)throw new M(`a comment on a cut needs --at <seconds>`);if(e.line)throw new M(`comment add takes --line or --cut, not both`)}return{op:`add`,...e.shot?{shot:e.shot}:{},...e.line?{line:e.line}:{},...n===void 0?{}:{cut:n},...t===void 0?{}:{at:t},text:$n(e)}}const tC={authoring:$S,changes:!0,review:{sections:[]},commentActions:{add:eC},onStart:e=>{QS(e),YS(e)}};var nC='# Verify report writing\n\nWrite `verify.xml` and captured files in `evidence/`. Reports cover command output, counts, API behavior, deploy evidence and evals. Claims judged by looking at a screen go in artboard verify groups; reference those groups from the report. Never invent captured output or human verdicts. Report prose uses the human\'s language; IDs/commands/raw logs retain their form.\n\n```xml\n<verify title="Delivery survives reconnect">\n <p>Verified against local build.</p>\n <claim id="delivery" judge="agent" from="local build @ COMMIT" capturedAt="2026-11-13T10:00:00Z">\n <title>Three attempts preserve the delivery</title>\n <result><code>3</code> attempts, <code>1</code> delivery kept</result>\n <table>\n <tr><th>Measured</th><th>Got</th><th>Expected</th></tr>\n <tr><td>Attempts</td><td><code>3</code></td><td>3</td></tr>\n <tr><td>Deliveries kept</td><td><code>1</code></td><td>1</td></tr>\n </table>\n <output src="evidence/delivery.txt"/>\n </claim>\n <gap id="production"><title>Production run</title><why>No production credentials</why><needs>A test key</needs></gap>\n</verify>\n```\n\nRequired report title; optional one introductory p first; only claim/gap/ref after it, no top-level headings. The page reads as one column: a status line, then what waits on the human (gaps, rejected and pending claims), then the agent\'s checks one line each, grouped by environment. Claim needs unique stable id, judge, title and evidence. `from` identifies actual environment/build; capturedAt is the real ISO capture time, not a future/example timestamp. Update both with replaced evidence. Capture command output directly to evidence/*.txt and never edit it. `output src="evidence/…"` keeps it one click away; no HTML output files. Over 200,000 characters is explicitly truncated.\n\nEvery agent claim has one `<result>`: inline, one line, what it proved (`<result><code>897 passed (897)</code></result>`); it is the claim\'s whole line on the page, and Check notes an agent claim without one. Its `code` values follow the copied-value rule below. Claims from the same environment and build use the identical `from` string: the page groups checks by exact `from` and writes it once per group. Above the output, write the result for the person reading: nobody should have to read a log to see what it proved. A claim may hold p, ul/ol, table (tr/th/td), steps (`step title="…"` with block children), codeblock, img, alert, details and inline marks. A table or steps directly inside the claim folds its raw output behind one line. Inside a table or steps, inline `code` means "copied from this claim\'s output": write the value exactly as the output prints it, with no rounding and no unit change. Check and the page name any such value the output does not contain, and that claim then waits on the human. Expected values, ordinals and your own wording stay outside `code`; commands go in a codeblock.\n\njudge="agent" means a command decided the stated predicate, ran in the claimed environment, passed and has raw output plus from. Missing evidence/from needs human judgment. A failed check is a fix or gap, never a passed agent claim. judge="human" requires an ask explaining what would make the judgment wrong; use for unresolved nonscreen tradeoffs, not to re-ask approved decisions. A human claim holding a long table (rulings, decisions) marks each row `<tr cost="change|small|none">`: change (wrong means behavior must change), small (a small cost), none (no effect). Only change rows show; small and none fold behind a count. Check notes a human-claim table over 12 rows without cost. A rejected agent claim remains human-owned until the human passes it, even after new evidence.\n\nGap needs id/title/why/needs (one specific unblock). `<ref artboard="slug" group="v2"/>` counts a screen claim toward done; the page sums the groups per artboard in one status-line sentence with a link, not as rows, so the verdict is given on the artboard. Read via comment list; record pass/reject/waive only if requested by the human, reply on rejection threads and replace evidence after a repair. Stable IDs preserve verdicts/comments. Never edit comments.json or `.state/`. Run the returned Check command before sharing.\n';function rC(e,t){if(t===`pass`||t===`reject`){let n=t===`pass`&&!!e.all;if(!n&&!e.claim)throw new M(t===`pass`?`comment pass on a report needs --claim <claimId>, or --all`:`comment reject on a report needs --claim <claimId>`);let r=t===`reject`?$n(e):e.text?.trim();return{op:`verdict`,verdict:t,...n?{all:!0}:{claim:e.claim},...r?{text:r}:{}}}if(t===`waive`){if(!e.gap)throw new M(`comment waive needs --gap <gapId>`);return{op:`waive`,gap:e.gap}}if(t===`reply`){if(!e.thread)throw new M(`comment reply needs --thread <threadId>`);return{op:`reply`,threadId:e.thread,text:$n(e)}}throw new M(`comment ${t} does not work on verify reports: use list, pass, reject, waive or reply`)}const iC={artboard:rr,document:__,html:v_,whiteboard:{authoring:`# Whiteboard writing
|
|
771
|
+
|
|
772
|
+
Write \`scene.excalidraw\` (main page); optional \`pages.json\` and \`pages/<id>.excalidraw\`. The browser and agent collaborate live. Re-read immediately before edits, preserve IDs and all customData (\`ryugiAuthor\`, \`ryugiRev\`, \`ryugiLastBy\`). Never manufacture revision fields or force over a conflict; read again and apply on top of the human version. Missing elements are not deletion; retain the element and set \`isDeleted:true\`. Bound labels are separate text elements: edit text and originalText.
|
|
773
|
+
|
|
774
|
+
\`\`\`json
|
|
775
|
+
{
|
|
776
|
+
"type": "excalidraw",
|
|
777
|
+
"version": 2,
|
|
778
|
+
"source": "ryugi",
|
|
779
|
+
"appState": { "name": "Delivery flow", "viewBackgroundColor": "#ffffff" },
|
|
780
|
+
"files": {},
|
|
781
|
+
"elements": [
|
|
782
|
+
{
|
|
783
|
+
"id": "f-flow",
|
|
784
|
+
"type": "frame",
|
|
785
|
+
"name": "Delivery",
|
|
786
|
+
"children": ["n-queue", "n-worker", "a-deliver", "c-retry"]
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
"id": "n-queue",
|
|
790
|
+
"type": "rectangle",
|
|
791
|
+
"x": 0,
|
|
792
|
+
"y": 0,
|
|
793
|
+
"width": 180,
|
|
794
|
+
"height": 80,
|
|
795
|
+
"label": { "text": "Queue" }
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"id": "n-worker",
|
|
799
|
+
"type": "rectangle",
|
|
800
|
+
"x": 320,
|
|
801
|
+
"y": 0,
|
|
802
|
+
"width": 180,
|
|
803
|
+
"height": 80,
|
|
804
|
+
"label": { "text": "Worker" }
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
"id": "a-deliver",
|
|
808
|
+
"type": "arrow",
|
|
809
|
+
"x": 180,
|
|
810
|
+
"y": 40,
|
|
811
|
+
"width": 140,
|
|
812
|
+
"height": 0,
|
|
813
|
+
"start": { "id": "n-queue" },
|
|
814
|
+
"end": { "id": "n-worker" }
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
"id": "c-retry",
|
|
818
|
+
"type": "richtext",
|
|
819
|
+
"x": 0,
|
|
820
|
+
"y": 140,
|
|
821
|
+
"width": 260,
|
|
822
|
+
"xml": "<h3>Retry</h3><p>Three attempts, then the <b>dead-letter</b> queue.</p>",
|
|
823
|
+
"shadow": true
|
|
824
|
+
}
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
\`\`\`
|
|
828
|
+
|
|
829
|
+
Elements: rectangle, ellipse, diamond, line, arrow, text, freedraw, image, frame, plus \`"richtext"\`, \`"svg"\` and \`"shadow"\`, which Ryugi draws and excalidraw.com does not open. New elements may use skeleton shorthand: id/type/x/y/width/height plus label for shape/arrow text, text for free text, start/end \`{id}\` for bindings, children for frames. Browser completes/measures skeletons and writes full elements. A frame without bounds fits its children; on later edits resize existing frame bounds explicitly to fit. \`frameId\` adds an element to an existing frame; null removes it. Inter-frame arrows belong to neither frame. Arrow width/height may be negative/zero; startArrowhead:"arrow" gives two-way arrows. A note or any formatted text is a \`"richtext"\` card: give x/y/width and \`"xml"\` holding document markup (h1–h6, p, ul/ol/li, blockquote, a href, b/i/u/s/code); the browser stores it as \`content\`, removes \`xml\` and measures the height; other markup is kept as plain text. To change a card, write \`"xml"\` again on the same id. backgroundColor tints a card. \`"svg"\` holds one whole \`<svg …>…</svg>\` document in its \`"svg"\` field, sized by width/height or else by the markup. \`"shadow": true\` gives a rectangle, ellipse, diamond, image, svg or card a drop shadow. Images use Excalidraw files dataURLs; keep total scene under 5MB. Give appState.name a readable title distinct from slug. IDs are unique across every live page and remain stable for comments/refs. A drawing a document shows goes in its own frame, with a stable id the document embeds by: \`<ref whiteboard="slug" frame="<frame id>" embed="true"/>\`. A deck shows a frame with \`<embed whiteboard="slug" frame="<frame id>"/>\`, or a whole page with \`page="<page id>"\`.
|
|
830
|
+
|
|
831
|
+
For pages write \`{"pages":[{"id":"main","name":"Overview"},{"id":"p-detail","name":"Detail"}]}\`. main is first and undeletable; extra IDs lowercase letters/digits/hyphens, filenames pages/<id>.excalidraw. Missing page file means empty. Names/order live in pages.json; appState.name remains board title. Preserve human pages on reread. Delete with deleted:true, retain file; deleted pages are excluded from check/render/publish and their comments become orphans. Arrows cannot cross pages. Move by copying the full element including customData to the new page and tombstoning it on the old one; comments/refs follow.
|
|
832
|
+
|
|
833
|
+
Run Check after edits; skeleton_not_completed/browser_not_run needs the board open in a browser. Check covers every page; --page narrows it. Fix duplicate IDs, conflicts, missing arrow targets, overflow/overlap and clipping. \`scene --artifact whiteboard/<id>\` returns page/frame structure and render paths; inspect a current render as well as validation. Never edit comments.json or \`.state/\`; the state directory contains render.png, geometry, selection, backlinks and warnings maintained by the server.
|
|
834
|
+
`,review:{sections:[]},commentActions:{add:e=>{let t=er(e.x,`--x`),n=er(e.y,`--y`);if(e.element)return{op:`add`,element:e.element,text:$n(e)};if(t===void 0||n===void 0)throw new M(`comment add on a whiteboard needs --element <id>, or --x and --y`);return{op:`add`,x:t,y:n,...e.page?{page:e.page}:{},text:$n(e)}}}},verify:{authoring:nC,locate:Zx,commentRequest:rC},slides:KS,report:C_,storyboard:tC},aC={authoring:y_,pointer:b_},oC=e=>k.filter(t=>e(iC[t])),sC=oC(e=>e.review),cC=oC(e=>e.changes),lC=oC(e=>e.review||e.commentRequest),uC=e=>RegExp(`^(?:${e.join(`|`)})/[a-z0-9][a-z0-9-]*$`);function dC(e){let t=e.map(e=>`${e}/<id>`);return t.length>1?`${t.slice(0,-1).join(`, `)} or ${t.at(-1)}`:t[0]}const fC=e=>e.length>1?`<${e.join(`|`)}>/<id>`:`${e[0]}/<id>`;function pC(e,t={}){if(!ue.test(e))throw new M(de);let n=iC[e.split(`/`)[0]],r=n.authoring.trim();return t.mockup?`${r}\n\n${aC.authoring.trim()}`:n.phoneScreens?`${r}\n\n${aC.pointer.replace(`<artifact>`,e).trim()}`:r}function mC(){return aC.authoring.trim()}function hC(e,t){if(!ue.test(t))throw new M(de);let n=t.split(`/`)[0],r=iC[n],i=f.default.join(e,`.ryugi`,`artifacts`,t);r.locate?.(i);let a=f.default.join(i,r.source??A[n]);if(d.default.existsSync(a))return{write:a,content:`existing`};let o=f.default.join(i,A[n]);return r.source&&d.default.existsSync(o)?{write:o,content:`existing`}:{write:a,content:`missing`}}function gC(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.phase!=`string`||![`waiting`,`preparing`,`uploading`,`publishing`,`not-ready`,`failed`,`published`].includes(t.phase)||t.publishedAt!==null&&(typeof t.publishedAt!=`string`||!Number.isFinite(Date.parse(t.publishedAt)))||typeof t.autoPublish!=`boolean`||t.message!==void 0&&typeof t.message!=`string`||t.reasons!==void 0&&(!Array.isArray(t.reasons)||!t.reasons.every(e=>typeof e==`string`))?null:t}const _C=[`1d`,`7d`,`30d`,`never`],vC=e=>_C.includes(e),yC=e=>e===`private`||e===`public`,bC=()=>({version:1,artifacts:{}});function xC(e){try{let t=JSON.parse(d.default.readFileSync(e,`utf8`));if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Expected a config object`);return t}catch(e){if(e.code===`ENOENT`)return bC();throw e}}const SC=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`);function CC(e){if(typeof e!=`object`||!e)return!1;let{id:t,url:n,publishedAt:r,visibility:i}=e;return typeof t==`string`&&typeof n==`string`&&(typeof r==`string`||r===null)&&yC(i)}function wC({id:e,url:t,publishedAt:n,visibility:r,fingerprint:i,onProfile:a,keyed:o,modulesSynced:s,sourceHash:c,identitySynced:l}){return{id:e,url:t,publishedAt:n,visibility:r,...typeof i==`string`?{fingerprint:i}:{},...typeof a==`boolean`?{onProfile:a}:{},...o===!0?{keyed:o}:{},...SC(s)?{modulesSynced:s}:{},...typeof c==`string`?{sourceHash:c}:{},...l===!0?{identitySynced:l}:{}}}function TC(e){let t=bC();if(typeof e!=`object`||!e)return t;let n=e.output;n&&typeof n==`object`&&`format`in n&&[`brief`,`json`,`jsonl`].includes(String(n.format))&&(t.output={format:n.format});let{autoPublish:r,modulesSynced:i,space:a}=e;typeof r==`boolean`&&(t.autoPublish=r),typeof a==`string`&&a&&(t.space=a),typeof i==`string`&&(t.modulesSynced=i);let o=e.artifacts;if(typeof o!=`object`||!o)return t;for(let[e,n]of Object.entries(o)){if(typeof n!=`object`||!n)continue;let{visibility:r,cloud:i,autoPublish:a,modules:o,project:s}=n;if(r!==void 0&&!yC(r))continue;let c={};r&&(c.visibility=r),CC(i)&&(c.cloud=wC(i)),a===!1&&(c.autoPublish=!1),SC(o)&&(c.modules=o),typeof s==`string`&&s&&(c.project=s),t.artifacts[e]=c}return t}function EC(e){let t;try{t=d.default.readFileSync(e,`utf8`)}catch{return{config:bC()}}try{return{config:TC(JSON.parse(t))}}catch(e){return{config:bC(),warning:`config.json is not valid JSON: ${e.message}`}}}const DC=[`config.json`,`artifacts/*`,`!artifacts/document/`,`artifacts/document/*/.artifact-id`];function OC(e){let t=f.default.join(e,`.gitignore`),n=``;try{n=d.default.readFileSync(t,`utf8`)}catch{}let r=new Set(n.split(/\r?\n/).map(e=>e.trim())),i=DC.filter(e=>!r.has(e));i.length!==0&&d.default.writeFileSync(t,`${n}${n===``||n.endsWith(`
|
|
835
|
+
`)?``:`
|
|
836
|
+
`}${i.join(`
|
|
837
|
+
`)}\n`)}function kC(e){d.default.mkdirSync(f.default.dirname(e),{recursive:!0}),OC(f.default.dirname(e)),d.default.existsSync(e)||Sn(e,bC())}function AC(e,t,n){let{config:r,warning:i}=EC(e);if(i)throw Error(i);let a={...r.artifacts[t]};if(n.visibility&&(a.visibility=n.visibility),n.cloud===null)delete a.cloud;else if(n.cloud){let e=a.cloud?.id===n.cloud.id?a.cloud:void 0;a.cloud={...e?.modulesSynced?{modulesSynced:e.modulesSynced}:{},...e?.identitySynced?{identitySynced:e.identitySynced}:{},...n.cloud}}n.autoPublish===null?delete a.autoPublish:n.autoPublish===!1&&(a.autoPublish=!1),n.modules===null?delete a.modules:n.modules&&(a.modules=n.modules),n.project===null?delete a.project:n.project&&(a.project=n.project);let o=xC(e);o.artifacts??={};let s={...o.artifacts[t]};if(n.visibility&&(s.visibility=a.visibility),n.cloud){let e={...s.cloud?.id===n.cloud.id?s.cloud:{}};for(let t of Object.keys(wC(e)))delete e[t];s.cloud={...e,...a.cloud}}return n.autoPublish===!1&&(s.autoPublish=!1),n.modules&&(s.modules=n.modules),n.project&&(s.project=n.project),n.project===null&&delete s.project,n.cloud===null&&delete s.cloud,n.autoPublish===null&&delete s.autoPublish,n.modules===null&&delete s.modules,o.artifacts[t]=s,Sn(e,o),a}function jC(e,t){let n=xC(e);t===null?delete n.autoPublish:n.autoPublish=t,d.default.mkdirSync(f.default.dirname(e),{recursive:!0}),Sn(e,n)}function MC(e,t){let n=xC(e);n.space=t,d.default.mkdirSync(f.default.dirname(e),{recursive:!0}),Sn(e,n)}const NC=e=>f.default.join(f.default.dirname(e),`config.json`);function PC(e,t=!1){try{let n=JSON.parse(d.default.readFileSync(e,`utf8`));if(typeof n==`object`&&n&&!Array.isArray(n))return n;if(t)throw Error(`Expected a configuration object: ${e}`);return{}}catch(e){if(t&&e.code!==`ENOENT`)throw e;return{}}}function FC(e){let t=PC(e).autoPublish;return typeof t==`boolean`?t:void 0}function IC(e,t,n=()=>{}){let r=PC(e,!0);n(),d.default.mkdirSync(f.default.dirname(e),{recursive:!0,mode:448}),Sn(e,{...r,autoPublish:t})}var J=class extends Error{error;kind;raw;constructor(e,t=`failed`,n){super(e.message),this.error=e,this.kind=t,this.raw=n}};function LC(e){if(e instanceof J)return e.error;let t=e,n=t?.fields;return{code:typeof n?.code==`string`?`E_${n.code.toUpperCase().replace(/^E_/,``)}`:`E_COMMAND_FAILED`,message:typeof t?.message==`string`&&t.message?t.message:typeof n?.message==`string`?n.message:String(e),...typeof n?.status==`number`?{httpStatus:n.status}:{},...n&&Object.keys(n).length?{details:n}:{}}}function RC(e,t=!1){switch(e.kind){case`succeeded`:return{outcome:t?`attention`:`success`,code:0};case`validation_failed`:return{outcome:`attention`,code:3};case`pending`:return{outcome:`pending`,code:4};case`action_required`:return{outcome:`attention`,code:2};case`partial`:return{outcome:`partial`,code:5};case`failed`:return{outcome:`error`,code:1};case`interrupted`:return{outcome:`error`,code:e.signal===`SIGINT`?130:143}}}function zC(e,t,n,r){return!e||typeof e!=`object`||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).filter(([e])=>t.includes(e)?!0:(r.push({path:`${n}.${e}`,reason:`fields`}),!1)))}function BC(e,t,n,r){let i=[...t.coverage.omitted??[]],a=t.data;if(n.fields){let e=[.../* @__PURE__ */ new Set([...n.fields,...r.requiredFields??[]])];if(r.collection&&a&&typeof a==`object`){let t=a,n=t[r.collection];a={...t,[r.collection]:Array.isArray(n)?n.map((t,n)=>zC(t,e,`data.${r.collection}.${n}`,i)):n}}else a=zC(a,e,`data`,i)}return{schema:`ryugi.cli/v1`,command:e,outcome:RC(t.completion,t.warnings.length>0).outcome,data:a,...t.coverage.page?{page:t.coverage.page}:{},...i.length?{omitted:i}:{},...t.effects.length?{effects:t.effects}:{},...t.warnings.length?{warnings:t.warnings}:{},...t.actions.length?{next:t.actions}:{},...t.completion.kind===`failed`?{error:t.completion.error}:t.completion.kind===`interrupted`?{error:{code:`E_INTERRUPTED`,message:`Command interrupted by ${t.completion.signal}.`,details:{signal:t.completion.signal}}}:{}}}const VC={format:{type:`string`,value:`<brief|table|json|jsonl|raw>`,help:`Output format (default: brief)`},json:{type:`boolean`,help:`Shorthand for --format json`},detail:{type:`boolean`,help:`Read complete evidence for the selected object or page`},fields:{type:`string`,value:`<fields>`,help:`Select public output fields, separated by commas`},quiet:{type:`boolean`,help:`Print the command's declared scalar only`},verbose:{type:`boolean`,help:`Include diagnostic details on stderr`}};function HC(e,t){let n={};for(let r=0;r<e.length;r++){let i=e[r];if(i===`--`)break;if(!i.startsWith(`--`))continue;let a=i.indexOf(`=`),o=i.slice(2,a<0?void 0:a),s=o===`source`?`boolean`:t[o]?.type;s===`string`?n[o]=a<0?e[++r]??``:i.slice(a+1):s===`boolean`&&(n[o]=!0)}return n}function UC(e,t,n=process.env){let r=HC(e,t),i=[`format`,`json`,`quiet`,`source`].filter(e=>r[e]!==void 0),a=n.RYUGI_ARTIFACTS_FORMAT??`brief`,o=r.format??(r.json?`json`:r.quiet?`quiet`:r.source?`source`:a),s=[`brief`,`table`,`json`,`jsonl`,`raw`,`source`,`quiet`].includes(o),c={format:s?o:`brief`,detail:!!r.detail||!!r.source,verbose:!!r.verbose},l;return i.length>1?l=new J({code:`E_OPTION_CONFLICT`,message:`Choose one of --format, --json, --quiet or --source.`}):s&&(i.length||[`brief`,`json`,`jsonl`].includes(a))||(l=new J({code:`E_FORMAT_UNSUPPORTED`,message:`Unknown output format: ${String(o)}`})),typeof r.fields==`string`&&(c.fields=r.fields.split(`,`).map(e=>e.trim()),c.fields.some(e=>!e)&&(l=new J({code:`E_ARGUMENT_INVALID`,message:`--fields requires comma-separated field names.`}))),{options:c,...l?{error:l}:{}}}const WC=[`brief`,`json`,`jsonl`];function GC(e){return{global:NC(Jn(process.env,process.platform,h.default.homedir())),project:f.default.join(f.default.dirname(ce(e).root),`config.json`)}}function KC(e){try{let t=JSON.parse(d.default.readFileSync(e,`utf8`));if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Expected an object`);return t}catch(t){if(t.code===`ENOENT`)return{};throw new J({code:`E_CONFIG_INVALID`,message:`Cannot read ${e}: ${t.message}`})}}function qC(e){let t=GC(e),n=e=>{let t=KC(e).output;if(t?.format!==void 0&&!WC.includes(t.format))throw new J({code:`E_FORMAT_UNSUPPORTED`,message:`Unsupported output format in ${e}: ${String(t.format)}`});return t&&WC.includes(t.format)?t.format:null},r=n(t.global),i=n(t.project);return{global:r,project:i,effective:i??r??`brief`,source:i?`project`:r?`global`:`default`}}function JC(e,t,n,r=()=>{}){if(n===`inherit`&&!t||n!==`inherit`&&!WC.includes(n))throw new J({code:`E_ARGUMENT_INVALID`,message:`--output-format takes brief, json, jsonl, or inherit with --project.`});let i=GC(e),a=t?i.project:i.global,o=KC(a);if(o.output!==void 0&&(!o.output||typeof o.output!=`object`||Array.isArray(o.output)))throw new J({code:`E_CONFIG_INVALID`,message:`Expected an output configuration object in ${a}.`});let s={...o.output};n===`inherit`?delete s.format:s.format=n,Object.keys(s).length?o.output=s:delete o.output,r(),t?kC(a):d.default.mkdirSync(f.default.dirname(a),{recursive:!0,mode:448}),Sn(a,o)}function YC(e,t,n=process.env){if(n.RYUGI_ARTIFACTS_FORMAT!==void 0)return n;let r=HC(e,t);if([`format`,`json`,`quiet`,`source`].some(e=>r[e]!==void 0))return n;let i=typeof r[`project-dir`]==`string`?r[`project-dir`]:process.cwd();if(!r[`project-dir`]&&e[0]&&!e[0].startsWith(`-`))try{d.default.statSync(e[0]).isDirectory()&&(i=e[0])}catch{}let a=qC(i);return{...n,RYUGI_ARTIFACTS_FORMAT:a.effective}}const XC=`adeck`,ZC={...VC,"project-dir":{type:`string`,value:`<path>`,help:`Project directory (default: current directory)`}},QC={help:{type:`boolean`,short:`h`,help:`Show this help`}};function $C(e,t,n=0){let r={...ZC,...t},i=Object.fromEntries(Object.entries({...ZC,...t}).map(([e,{type:t,short:n}])=>[e,n?{type:t,short:n}:{type:t}]));try{let t=[];for(let n=0;n<e.length;n++){let i=e[n];if(i===`--`){t.push(...e.slice(n));break}let a=e[n+1],o=a===`-h`||Object.values(r).some(e=>e.short&&a===`-${e.short}`);i.startsWith(`--`)&&r[i.slice(2)]?.type===`string`&&a?.startsWith(`-`)&&!a.startsWith(`--`)&&!o?(t.push(`${i}=${a}`),n++):t.push(i)}let a=(0,g.parseArgs)({args:t,options:i,allowPositionals:n>0,strict:!0});if(a.positionals.length>n)throw new M(`Unknown argument: ${a.positionals[n]}`);return{values:a.values,positionals:a.positionals,projectDir:a.values[`project-dir`]??process.cwd()}}catch(e){if(e instanceof M)throw e;if(e.code===`ERR_PARSE_ARGS_UNKNOWN_OPTION`){let t=/'([^']+)'/.exec(e.message)?.[1];if(t)throw new M(`Unknown argument: ${t}`)}throw new M(e.message)}}function ew(e){let t=e.indexOf(`--`);return(t===-1?e:e.slice(0,t)).some(e=>e===`--help`||e===`-h`)}function tw(e){let t=Math.max(...e.map(([e])=>e.length))+2;return e.map(([e,n])=>` ${e.padEnd(t)}${n.replaceAll(`
|
|
838
|
+
`,`\n ${` `.repeat(t)}`)}`.trimEnd()).join(`
|
|
839
|
+
`)}function nw(e){return Object.entries(e).filter(([,e])=>e.help!==void 0).map(([e,t])=>[`${t.short?`-${t.short}, `:``}--${e}${t.value?` ${t.value}`:``}`,t.help])}function rw(e,t){if(!t)return e.options;let n=e.usage?.filter(e=>e.split(/\s/)[0]===t)??[];if(!n.length)throw new M(`Unknown ${e.name} action: ${t}`);let r=/* @__PURE__ */ new Set([...n.flatMap(e=>[...e.matchAll(/--([\w-]+)/g)].map(e=>e[1])),...e.actionOptions?.[t]??[]]);return Object.fromEntries(Object.entries(e.options).filter(([e])=>r.has(e)))}function iw(e,t){let n=rw(e,t);return[(e.usage??[`[options]`]).filter(e=>!t||e.split(/\s/)[0]===t).map((t,n)=>`${n?` `:`Usage: `}${XC} ${e.name} ${t}`).join(`
|
|
840
|
+
`),``,e.summary,...e.details?[``,e.details]:[],``,`Options:`,tw(nw({...n,...ZC,...QC}))].join(`
|
|
841
|
+
`)}function aw(e,t={}){return[`Usage: ${XC} [project-directory] [--no-open]`,` ${XC} <command> [options]`,``,`Without a command, opens the project's artifacts in your browser and keeps the server`,`running until Ctrl+C.`,``,`Commands:`,tw(e.map(e=>[e.name,e.summary])),``,`Tasks:`,` Write or edit: start --background --no-open --artifact <type>/<id>, edit the returned file, then check.`,` Find or read: get --project-dir <path> (local); get <link-or-id> (cloud); scene for a whiteboard.`,` Apply feedback: comment list --artifact <type>/<id> --sections all --detail; changes for document edits.`,` Organize and share: modules, config, publish. Prepare the environment: install, update, start, stop.`,` Automation: start is finite by default; use --foreground for a live process. JSON uses ryugi.cli/v1.`,``,`Run \`${XC} <command> --help\` for a command's options.`,``,`Options:`,tw(nw({...ZC,...t,version:{type:`boolean`,short:`v`,help:`Print the version`},...QC}))].join(`
|
|
842
|
+
`)}const ow=e=>[...e.matchAll(/"([^"]*)"|'([^']*)'|(\S+)/g)].map(e=>e[1]??e[2]??e[3]);function sw(){let e=process.env.RYUGI_ARTIFACTS_COMMAND?.trim();return e?ow(e):[process.execPath,process.argv[1]]}function cw(e){if(process.env.RYUGI_ARTIFACTS_FORMAT)return process.env.RYUGI_ARTIFACTS_FORMAT;let t=e.indexOf(`--project-dir`);try{return qC(t>=0&&e[t+1]?e[t+1]:process.cwd()).effective}catch{return`brief`}}function lw(e,t=`Details`){let n=e.indexOf(`--`),r=n<0?e:e.slice(0,n),i=n<0?[]:e.slice(n),a={...ZC,...oP.find(t=>t.name===e[0])?.options},o=[],s=!1;for(let e=0;e<r.length;e++){let t=r[e];if([`--format`,`--source`,`--quiet`].includes(t.split(`=`)[0])&&(s=!0),t.startsWith(`--`)&&!t.includes(`=`)&&a[t.slice(2)]?.type===`string`&&r[e+1]!==void 0){let n=r[++e];o.push(n.startsWith(`-`)?`${t}=${n}`:t,...n.startsWith(`-`)?[]:[n])}else o.push(t)}let c=s||cw(r)===`brief`?[]:[`--format`,`brief`];return{kind:`command`,argv:[...sw(),...o,...c,...i],label:t}}function Y(e,t={kind:`succeeded`},n={}){return{data:e,completion:t,coverage:{},effects:[],warnings:[],actions:[],...n}}var uw=class{entries=[];begin(e,t){return this.entries.push({operation:e,target:t,state:`unknown`}),this.entries.length-1}confirm(e,t){this.set(e,`confirmed`,t)}set(e,t,n){let r=this.entries[e];if(!r)throw Error(`Unknown effect`);this.entries[e]={...r,state:t,...n===void 0?{}:{details:n}}}snapshot(){return this.entries.map(e=>({...e}))}};const dw=/^\d{4}-\d\d-\d\dT\d\d:\d\d(?::\d\d(?:\.\d+)?)?(?:Z|[+-]\d\d:?\d\d)$/,fw=e=>String(e).padStart(2,`0`),pw=e=>typeof e==`string`&&dw.test(e)&&!Number.isNaN(Date.parse(e));function mw(e,t=/* @__PURE__ */ new Date){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let r=`${fw(n.getHours())}:${fw(n.getMinutes())}`;return n.getFullYear()===t.getFullYear()?n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${fw(n.getMonth()+1)}-${fw(n.getDate())} ${r}`:`${n.getFullYear()}-${fw(n.getMonth()+1)}-${fw(n.getDate())}`}function hw(e,t){let n=e.details;return!n||typeof n!=`object`||Array.isArray(n)?[]:Object.entries(n).flatMap(([e,n])=>typeof n==`string`&&/^https?:\/\/\S+$/i.test(n)?[{kind:`url`,label:t?`${t} ${e}`:e,url:n}]:[])}const X=(e,t)=>({key:t,value:e[t]}),Z=(e,t,n=!1)=>({label:e,binding:t,required:n}),gw=e=>e.replaceAll(/\p{Cc}/gu,` `);function _w(e,t=!1){if(e==null)return``;if(Array.isArray(e))return e.map(e=>_w(e,!0)).join(`, `);if(typeof e==`object`){let n=Object.entries(e).filter(([,e])=>!yw(e)).map(([e,t])=>`${e} ${_w(t,!0)}`).join(t?`, `:` · `);return t?`(${n})`:n}return pw(e)?mw(e):String(e)}const vw=(e,t,n)=>{if(typeof e==`object`&&e){if(!n)throw Error(`Brief cannot print the object at ${t}; flatten it in the view.`);return _w(e)}return _w(e)},yw=(e,t)=>e==null||e===``||e===!1||t!==void 0&&e===t,bw={1:`FAILED`,2:`NEEDS YOU`,3:`ISSUES`,4:`INCOMPLETE`,5:`PARTIAL`,130:`INTERRUPTED`,143:`INTERRUPTED`},xw={E_ARTIFACT_NOT_FOUND:`check --artifact and --project-dir; artifacts live in <project>/.ryugi/artifacts/<type>/<id>/`,E_ARGUMENT_INVALID:`run the command with --help for its options`,E_CURSOR_EXPIRED:`run the read again without --cursor or --snapshot`,E_CURSOR_MISMATCH:`run the read again without --cursor or --snapshot`},Sw=(e,t)=>t?bw[t]??`FAILED`:gw(e).replaceAll(`_`,` `).toUpperCase(),Cw=e=>{let t=e.replaceAll(/[._]/g,` `).trim();return t?t[0].toUpperCase()+t.slice(1):`Command`};function ww(e){let t=e.offset??0;if(!e.hasMore&&t===0)return null;let n=e.total===null?``:` of ${e.total}`;return e.offset===void 0?`${e.returned}${n} shown${e.total===null&&e.hasMore?` · more available`:``}`:`${e.returned?`${t+1}–${t+e.returned}`:`none`}${n}`}const Tw=e=>/^[\w./:@=+-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`;function Ew(e){return e.kind===`command`?e.argv.map(Tw).join(` `):e.url}const Dw=e=>e.map(e=>`Effect: ${gw(e.operation)} ${gw(e.target)} · ${e.state}`),Ow=e=>e.split(`.`).filter(Boolean).at(-1)??e;function kw(e,t,n,r,i=[],a=0){let o=[Sw(e.status,a),e.subject&&gw(e.subject),e.summary&&gw(e.summary)].filter(Boolean),s=[o.length?`${gw(e.heading)}: ${o.join(` · `)}`:gw(e.heading)],c=[...t.omitted??[]],l=(e,t=!1)=>t||i.includes(e)||!n.fields||n.fields.includes(e),u=(e,t,n=!1)=>gw(vw(e,t,n)),d=(e,t,n,r,i,a,o=!1)=>{if(yw(n,a))return null;let s=gw(e??t);if(n===!0)return s;let c=u(n,r,o);return i?c:`${s} ${c}`},f=(e,t=!1)=>{for(let n of e){if(!r&&!l(n.binding.key,n.required)||yw(n.binding.value))continue;let e=n.binding.value===!0?`yes`:u(n.binding.value,`data.${n.binding.key}`,t);s.push(`${gw(n.label)}: ${e}`)}},p=(e,t)=>e.map(e=>d(e.label,e.binding.key,e.binding.value,`${t}.${e.binding.key}`,e.positional)).filter(e=>e!==null).join(` · `),m=(e,t)=>{e&&s.push(t?`${gw(e)} · ${gw(t)}`:gw(e))},h=e=>{let t=e&&ww(e);t&&s.push(t)};f(e.facts);let g=t.error?hw(t.error):[];if(t.error){s.push(`${gw(t.error.code)}: ${gw(t.error.message)}`),t.error.httpStatus!==void 0&&t.error.httpStatus>=500&&s.push(`HTTP: ${t.error.httpStatus}`);let e=xw[t.error.code];e&&s.push(`Next: ${e}`);let n=t.error.details;if(n&&typeof n==`object`&&!Array.isArray(n))for(let[e,t]of Object.entries(n))g.some(t=>t.label===e)||f([{label:e,binding:{key:e,value:t},required:!0}],!0);else n!==void 0&&f([{label:`Details`,binding:{key:`details`,value:n},required:!0}],!0)}if(!r&&n.fields&&t.data&&typeof t.data==`object`){let r=/* @__PURE__ */ new Set([...e.facts.map(e=>e.binding.key),...e.sections.flatMap(e=>e.kind===`fields`?e.facts.map(e=>e.binding.key):[e.key])]),a=t.data;f([.../* @__PURE__ */ new Set([...n.fields,...i])].filter(e=>!r.has(e)&&Object.hasOwn(a,e)).map(e=>({label:e,binding:{key:e,value:a[e]}})),!0)}for(let t of e.sections){if(t.kind===`fields`){f(t.facts);continue}if(!r&&!l(t.key))continue;let e=`title`in t&&t.title?t.title:void 0;if(t.kind===`records`){m(e??(t.page?t.key:void 0),t.summary);let a=new Set(t.columns.map(e=>e.key)),o=t.key===r?[.../* @__PURE__ */ new Set([...n.fields??[],...n.fields?i:[]])].filter(e=>!a.has(e)).map(e=>({key:e,label:e})):[],c=new Set(o.map(e=>e.key)),f=[...t.columns,...o].filter(e=>t.key!==r||l(e.key,e.required));if(n.format===`table`){let e=f.map(e=>e.label??e.key),n=t.rows.map((e,n)=>f.map(r=>yw(e[r.key],r.default)?``:u(e[r.key],`data.${t.key}.${n}.${r.key}`,c.has(r.key)))),r=e.map((e,t)=>Math.max(e.length,...n.map(e=>e[t]?.length??0)));s.push(...[e,...n].map(e=>e.map((e,t)=>e.padEnd(r[t]??e.length)).join(` `).trimEnd()))}else for(let[e,n]of t.rows.entries())s.push(` ${f.map(r=>d(r.label,r.key,n[r.key],`data.${t.key}.${e}.${r.key}`,r.positional,r.default,c.has(r.key))).filter(e=>e!==null).join(` · `)}`);t.rows.length||e||t.page||s.push(`No records.`),h(t.page)}else if(t.kind===`messages`){m(e,t.summary);for(let[e,n]of t.groups.entries()){s.push(` ${p(n.facts,`data.${t.key}.${e}`)}`);for(let[r,i]of n.messages.entries())s.push(` ${p(i.facts,`data.${t.key}.${e}.messages.${r}`)}`),s.push(...i.text.split(`
|
|
843
|
+
`).map(e=>` ${e.replaceAll(/\p{Cc}/gu,e=>e===` `?e:``)}`))}t.groups.length||e||t.page||s.push(`No messages.`),h(t.page)}else if(t.kind===`diagnostics`){let e=n.detail?t.items.length:t.preview??3;for(let n of t.items.slice(0,e))s.push(` ${n.location?`${gw(n.location)} `:``}${gw(n.code)}: ${u(n.message,`data.${t.key}`)}`);e<t.items.length&&c.push({path:`data.${t.key}`,reason:`preview`,count:t.items.length-e})}else m(e&&`${e}:`,t.summary),s.push(...t.text.trimEnd().split(`
|
|
844
|
+
`).map(e=>` ${e.replaceAll(/\p{Cc}/gu,e=>e===` `||e===`
|
|
845
|
+
`?e:``)}`))}t.page&&h(t.page),(a||(t.effects??[]).some(e=>e.state!==`confirmed`))&&s.push(...Dw(t.effects??[]));for(let e of t.warnings??[])s.push(`Warning: ${gw(e.message)}`);let _=e.actions??t.next??[],v=[..._,...g.filter(e=>!_.some(t=>Ew(t)===Ew(e)))],y=/* @__PURE__ */ new Set,b=v.find(e=>e.label===`Details`);for(let e of c){if(e.count===void 0)continue;let t=`${e.count} more ${Ow(e.path)}`;b&&!y.has(b)?(y.add(b),s.push(`${t} · Details: ${Ew(b)}`)):s.push(t)}for(let e of v)y.has(e)||s.push(`${gw(e.label??`Next`)}: ${e.reason?`${gw(e.reason)} · `:``}${Ew(e)}`);return`${s.join(`
|
|
846
|
+
`)}\n`}function Aw(e,t,n=1){return kw({heading:Cw(e.command),status:``,facts:[],sections:[]},e,{...t,fields:void 0},void 0,[],n)}function Q(e,t){return{run:(n,r,i,a)=>jw(e,t,n,r,i,a)}}async function jw(e,t,n,r,i,a){let o=0,s=Promise.resolve(),c,l=!1,u=[],d=new AbortController,f=()=>d.abort(i?.reason);i?.addEventListener(`abort`,f,{once:!0}),i?.aborted&&f();let p={signal:d.signal,effects:new uw,payloads:{},progress(e){l||h(n.format===`jsonl`?`stdout`:`stderr`,n.format===`jsonl`?m(`progress`,e):`${e.phase}${e.current===void 0?``:` ${e.current}${e.total===void 0?``:`/${e.total}`}`}\n`)},diagnostic(e){h(`stderr`,`${e.trimEnd()}\n`)}};function m(e,t){return`${JSON.stringify({schema:`ryugi.cli/v1`,...t,seq:o++,kind:e})}\n`}function h(e,t){s=s.then(()=>r.write(e,t)).catch(e=>{c=e,d.abort(e)})}async function g(){if(await s,c)throw c}let _=8388608;async function v(e,t){if((typeof t==`string`?new TextEncoder().encode(t).byteLength:t.byteLength)>_)throw new J({code:`E_RESULT_TOO_LARGE`,message:`Result exceeds 8 MiB; read one object or save it to a file.`});await g(),await r.write(e,t)}async function y(t,r=`result`){let i={...t,effects:t.effects.length?t.effects:p.effects.snapshot()};i.effects.some(e=>e.state===`unknown`)&&(i.actions=[...i.actions,...a?.(e.id,void 0,i.effects)??[]]),u=i.effects;let o=BC(e.id,i,n,e.output);if(n.format===`json`)await v(`stdout`,`${JSON.stringify(o)}\n`);else if(n.format===`jsonl`){let t=o,n=e.output.collection;if(n&&r===`result`){let e=o.data,r=e[n];if(Array.isArray(r)){for(let e of r)await v(`stdout`,m(`item`,{collection:n,data:e}));let i={...e};delete i[n],t={...o,data:i}}}await v(`stdout`,m(r,t))}else if(n.format===`raw`||n.format===`source`){let e=p.payloads[n.format];if(e===void 0)throw new J({code:`E_PAYLOAD_UNAVAILABLE`,message:`No ${n.format} payload was returned.`});await v(`stdout`,e)}else if(n.format===`quiet`){if(!e.output.scalar)throw new J({code:`E_FORMAT_UNSUPPORTED`,message:`This command has no scalar output.`});await v(`stdout`,`${e.output.scalar(i.data)}\n`)}else await v(i.completion.kind===`failed`?`stderr`:`stdout`,kw(e.present(i),o,n,e.output.collection,e.output.requiredFields,RC(i.completion).code));return RC(i.completion).code}try{if(!e.output.formats.includes(n.format)||e.mode===`live`&&[`json`,`quiet`,`raw`,`source`,`table`].includes(n.format))throw new J({code:`E_FORMAT_UNSUPPORTED`,message:`${n.format} is not supported for ${e.id}. Supported: ${e.output.formats.join(`, `)}`});if(n.detail&&!e.output.detail)throw new J({code:`E_OPTION_UNSUPPORTED`,message:`--detail is not supported for this operation.`});let r=n.fields?.find(t=>!e.output.fields?.includes(t));if(r)throw new J({code:`E_FIELD_UNKNOWN`,message:`Unknown output field: ${r}`});if(n.format===`jsonl`&&await v(`stdout`,m(`meta`,{command:e.id})),e.mode===`finite`){let n=await e.run(t,p);return l=!0,await y(n)}let i=!1,a;for await(let n of e.run(t,p)){if(a||n.kind===`ready`&&i)throw new J({code:`E_LIFECYCLE_INVALID`,message:`Invalid command lifecycle.`});if(n.kind===`ready`){i=!0;try{await y(n.result,`ready`)}catch(e){throw d.abort(e),e}}else a=n.result,l=!0}if(!a)throw new J({code:`E_LIFECYCLE_INCOMPLETE`,message:`Command ended without a terminal result.`});return await y(a)}catch(t){if(l=!0,t instanceof J&&t.raw!==void 0&&(p.payloads.raw=t.raw),t?.code===`EPIPE`)return 141;let i=d.signal.aborted&&(d.signal.reason===`SIGINT`||d.signal.reason===`SIGTERM`)?d.signal.reason:void 0,o=i?{code:`E_INTERRUPTED`,message:`Command interrupted by ${i}.`,details:{signal:i}}:LC(t),s=t instanceof J?t.kind===`action_required`:t?.code===2,c=p.effects.snapshot(),f=Y(null,i?{kind:`interrupted`,signal:i}:s?{kind:`action_required`,reason:o.message}:{kind:`failed`,error:o},{effects:c.length?c:u,actions:[...a?.(e.id,o,c.length?c:u)??[],...t?.actions??[]]}),h={...BC(e.id,f,{...n,fields:void 0},{}),error:o};try{await g(),n.format===`json`||n.format===`jsonl`?await r.write(`stdout`,n.format===`json`?`${JSON.stringify(h)}\n`:m(`result`,h)):n.format===`raw`&&p.payloads.raw!==void 0&&o.code!==`E_RESULT_TOO_LARGE`&&Buffer.byteLength(p.payloads.raw)<=_?await r.write(`stdout`,p.payloads.raw):await r.write(`stderr`,Aw(h,n,RC(f.completion).code)),n.verbose&&t instanceof Error&&t.stack&&await r.write(`stderr`,`${t.stack}\n`)}catch(e){if(e?.code===`EPIPE`)return 141}return RC(f.completion).code}finally{i?.removeEventListener(`abort`,f)}}function Mw(e){let t=e.values;if(t.foreground&&t.background)throw new J({code:`E_OPTION_CONFLICT`,message:`Choose --foreground or --background.`});if(t.open&&t[`no-open`])throw new J({code:`E_OPTION_CONFLICT`,message:`Choose --open or --no-open.`});return{projectDir:e.projectDir,artifact:t.artifact,background:!!t.background,foreground:!!t.foreground,host:t.host??`127.0.0.1`,urlHost:t[`url-host`],port:t.port,open:t[`no-open`]?!1:t.open?!0:process.env.ARTIFACTS_OPEN!==`0`,openExisting:!!t.open,mockup:!!t.mockup}}function Nw(e,t){let n=t?f.default.dirname(f.default.dirname(t.root)):e.projectDir,r=e.artifact?hC(n,e.artifact):void 0;return{cliVersion:`1.113.1`,serverVersion:P(He().version),status:t?`running`:`stopped`,scope:`machine`,project:n,...r,...r?.content===`missing`?{writing:pC(e.artifact,{mockup:e.mockup})}:{},reused:!!t?.reused,...t?{url:t.cloudLink??t.link??t.url,localUrl:t.link??t.url}:{},...e.artifact?{artifact:e.artifact}:{},cloud:t?.cloudLink?`live_link_reserved`:`local_only`}}function Pw({data:e}){return{heading:`Server`,status:e.status,subject:e.reused?`reused`:void 0,facts:[Z(`Scope`,X(e,`scope`)),Z(`CLI version`,X(e,`cliVersion`)),Z(`Server version`,X(e,`serverVersion`)),Z(`Project`,X(e,`project`),!0),...e.artifact?[Z(`Artifact`,X(e,`artifact`),!0)]:[],...e.write?[Z(e.artifact?.startsWith(`document/`)?`Source`:`Write`,X(e,`write`),!0),Z(`Content`,X(e,`content`),!0)]:[],...e.url?[Z(`Open`,X(e,`url`),!0)]:[],...e.localUrl&&e.localUrl!==e.url?[Z(`Local`,X(e,`localUrl`),!0)]:[],Z(`Cloud`,X(e,`cloud`))],sections:e.writing?[{kind:`content`,key:`writing`,title:`Writing`,text:e.writing}]:[]}}function Fw(e,t){let n=e.artifact?.includes(`/`)?e.artifact.split(`/`)[0]:void 0,r=n&&Ae(n)?iC[n].onStart:void 0;r&&r(f.default.join(f.default.dirname(f.default.dirname(t.root)),`.ryugi`,`artifacts`,e.artifact));let i=t.cloudLimit?.upgradeUrl?[{kind:`url`,url:t.cloudLimit.upgradeUrl,label:`Upgrade`}]:[],a=Nw(e,t);return a.artifact?.startsWith(`document/`)&&i.push(lw([`write-document`,`--project-dir`,a.project,`--artifact`,a.artifact,`--input`,`<edited.xml>`,...a.content===`existing`?[`--base`,`<original.xml>`]:[]],`Save`)),e.artifact&&i.push(lw([`check`,`--project-dir`,f.default.dirname(f.default.dirname(t.root)),`--artifact`,e.artifact],`Check`)),t.loginHint&&i.push(lw([`publish`,`--login`,`--from`,`hint`,`--project-dir`,e.projectDir],`Sign in`)),Y(a,void 0,{actions:i,warnings:[...t.loginHint?[{code:`W_LOGIN_OPTIONAL`,message:t.loginHint.message}]:[],...t.cloudLimit?[{code:`W_CLOUD_LIMIT`,message:String(t.cloudLimit.message??`Cloud link unavailable; local server is ready.`)}]:[]]})}async function*Iw(e,t){let n=[],r,i=!1,a,o,s,c=t.effects.begin(`start`,e.projectDir),l=e=>{n.push(e),r?.()},u=iT(e,{signal:t.signal,ready(n){o=n,t.effects.confirm(c,{reused:!!n.reused}),l({kind:`ready`,result:Fw(e,n)})},failure(e){s=String(e.error??`Server failed`)},log:e=>t.diagnostic(e)}).then(n=>{if(t.signal.aborted){let n=t.signal.reason===`SIGINT`?`SIGINT`:`SIGTERM`;l({kind:`result`,result:Y({...Nw(e,o),status:`stopped`},{kind:`interrupted`,signal:n},{effects:t.effects.snapshot()})})}else if(n!==0||s)throw new J({code:`E_SERVER_FAILED`,message:s??`Server exited with ${n}.`});else l({kind:`result`,result:Y({...Nw(e,o),status:o?.reused?`running`:`stopped`},void 0,{effects:t.effects.snapshot()})})}).catch(e=>{a=e}).finally(()=>{i=!0,r?.()});try{for(;!i||n.length;)n.length?yield n.shift():await new Promise(e=>{r=e});if(a)throw a}finally{await u}}function Lw(e,t=`start`){let n=Mw(e);return n.library=t===`browse`,n.foreground?Q({id:t,mode:`live`,output:{formats:[`brief`,`jsonl`]},run:(e,t)=>Iw(n,t),present:Pw},e):Q({id:t,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.url},async run(e,t){let r,i,a=t.effects.begin(`start`,n.projectDir);if(await iT(n,{signal:t.signal,ready(e){r=e,t.effects.confirm(a,{reused:!!e.reused})},failure(e){i=String(e.error??`Server failed`)},log:e=>t.diagnostic(e)})!==0||!r)throw new J({code:`E_SERVER_FAILED`,message:i??`Server did not become ready.`});return Fw(n,r)},present:Pw},e)}const Rw=e=>e.startsWith(`local-`),zw=e=>/^\d+\.\d+\.\d+$/.test(e)?e.split(`.`).map(Number):null;function Bw(e,t){let n=zw(e),r=zw(t);if(!n||!r)return!1;for(let e=0;e<3;e++)if(n[e]!==r[e])return n[e]<r[e];return!1}function Vw(e,t){return e&&t&&e===t?`keep`:Rw(e)&&t&&!Rw(t)||Bw(t,e)?`protected`:`replace`}const Hw=(e,t)=>{let n=process.env[e]?Number(process.env[e]):NaN;return Number.isFinite(n)&&n>=0?n:t},Uw=Hw(`RYUGI_START_SETTLE_MS`,6e3),Ww=Hw(`RYUGI_STOP_GRACE_MS`,7e3),Gw=e=>ie(e),Kw=e=>{let t=new URL(e);return t.hostname===`localhost`&&(t.hostname=`127.0.0.1`),t},qw=(e,t)=>{let n=Kw(e.url),r=new URL(t,n.origin),i=n.searchParams.get(`key`);return i&&r.searchParams.set(`key`,i),r.toString()};function Jw(e,t,n){let r={type:`server-started`,url:e.url,port:e.port,root:t.root};if(n){let i=new URL(e.url),a=Fe(n),o=i.searchParams.get(`key`);r.link=`${i.origin}${Le(t.root,a.type,a.id)}${o?`?key=${o}`:``}`}return r}async function Yw(e,t,n,r){if(!r)return e;try{let{url:i,limit:a}=await(await fetch(qw(t,`/api/cloud/reserve/${r}`),{method:`POST`,headers:{"X-Ryugi-Project":encodeURIComponent(n.project)},signal:AbortSignal.timeout(5e3)})).json();return typeof i==`string`?{...e,cloudLink:i}:typeof a?.upgradeUrl==`string`?{...e,cloudLimit:{message:a.message,upgradeUrl:a.upgradeUrl}}:e}catch{return e}}async function Xw(e){for(let t=0;t<150;t++){try{return d.default.mkdirSync(e),!0}catch{}try{if(Date.now()-d.default.statSync(e).mtimeMs>6e4){d.default.rmdirSync(e);continue}}catch{}await fe(100)}return!1}function Zw(e){let t=Number(P(e.pid)),n=P(e.serverId);return!Number.isInteger(t)||t<=0||!n?null:_e(t,n)?t:null}function Qw(e){try{let t=JSON.parse(P(e.info)??``);return typeof t.url==`string`&&Number.isInteger(t.port)?t:null}catch{return null}}async function $w(e){try{return(await fetch(qw(e,`/api/status`),{signal:AbortSignal.timeout(5e3)})).ok}catch{return!1}}async function eT(e,t){try{process.kill(e,`SIGTERM`)}catch{}if(!await N(e,Ww)){try{process.kill(e,`SIGKILL`)}catch{}if(!await N(e,2e3))throw new M(`The ${t} (pid ${e}) did not stop; stop it with \`${le()} stop\` and retry`)}}async function tT(){let e=qe();for(let t of Ze(e)){if(_e(t.pid,t.serverId)){try{process.kill(t.pid,`SIGTERM`)}catch{}await N(t.pid,5e3)}try{Qe(e,t)}catch{}}}function nT(e,t){if(!t||t.startsWith(`document/`))return;let n=Object.fromEntries(ye.flatMap(e=>process.env[e]?[[e,process.env[e]]]:[]));if(!Object.keys(n).length)return;let r=f.default.join(e.state,t);d.default.mkdirSync(r,{recursive:!0}),d.default.writeFileSync(f.default.join(r,`agent`),`${JSON.stringify(n)}\n`)}async function rT(e,t,n){let r=await fetch(qw(e,`/api/hub/projects`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dir:t.project,...n?{open:n}:{},...n&&process.env.ARTIFACTS_OPEN_CMD?{openCmd:process.env.ARTIFACTS_OPEN_CMD}:{}}),signal:AbortSignal.timeout(15e3)});if(!r.ok)throw new M(`The artifacts server refused this project: ${await r.text()}`)}async function iT(e,t){if(t.signal?.throwIfAborted(),e.artifact!==void 0&&!ue.test(e.artifact))throw new M(de);if(e.port!==void 0&&(!/^\d+$/.test(e.port)||Number(e.port)<1||Number(e.port)>65535))throw new M(`--port must be a port number`);e.urlHost||=e.host===`127.0.0.1`||e.host===`localhost`?`localhost`:e.host,process.umask(63);let n=ce(e.projectDir),r=He();Ue(r.home),d.default.mkdirSync(n.state,{recursive:!0}),d.default.existsSync(f.default.join(n.state,`.gitignore`))||d.default.writeFileSync(f.default.join(n.state,`.gitignore`),`*
|
|
847
|
+
`);let i=process.env.RYUGI_ARTIFACTS_VERSION||`1.113.1`,a=Ge(r.projects).some(e=>e.dir===n.project),o=async(r,i)=>{nT(n,e.artifact);let o=e.open&&!e.library&&(!i||!a);await rT(r,n,o?e.artifact??!0:void 0);let s=Jw(r,n,e.artifact);i&&(s.reused=!0);let c=await Yw(s,r,n,e.artifact),l=Xn(n.project);if(t.signal?.throwIfAborted(),e.library&&e.open&&(process.env.ARTIFACTS_OPEN_CMD?await new Promise(e=>(0,p.execFile)(process.env.ARTIFACTS_OPEN_CMD,[r.url],()=>e())):await Ve(r.url,[r.url]).catch(e=>t.log(e.message,`stderr`))),await t.ready(l?{...c,loginHint:l}:c),i&&a&&process.platform===`darwin`&&e.open&&e.openExisting&&e.artifact&&!process.env.ARTIFACTS_OPEN_CMD){let e=c.link;await Ve(typeof c.cloudLink==`string`?c.cloudLink:e,[e]).catch(e=>t.log(e.message,`stderr`))}};if(!await Xw(r.lock))throw new M(`Another start is still starting the artifacts server; retry in a moment`);let s=!0,c=()=>{if(s){s=!1;try{d.default.rmdirSync(r.lock)}catch{}}};try{t.signal?.throwIfAborted();let a=Zw(r),s=Qw(r),l=null;if(a&&!s){for(let e=0;e<Uw&&pe(a)&&!s;e+=100)await fe(100),s=Qw(r);!s&&pe(a)&&(l={label:`stopping artifacts server`,pid:a,reasons:[`no-info`],running:P(r.version)??``})}if(a&&s){let t=P(r.version)??``,n=Vw(t,i),u=[...n===`keep`?[]:[`version`],...(s.host??`127.0.0.1`)===e.host?[]:[`host`],...(s.urlHost??`localhost`)===e.urlHost?[]:[`urlHost`],...(s.cloudOrigin??`https://artideck.dev`)===Gw(process.env)?[]:[`cloudOrigin`],...e.port!==void 0&&String(s.port)!==e.port?[`port`]:[],...Pn(r,An(e.host,e.urlHost))?[`launch`]:[]],d={pid:a,running:t,cli:i},f=n===`protected`||u.length===0;if(f&&await $w(s))return u.length&&O(r,{...d,action:`kept`,reasons:u}),c(),await o(s,!0),0;l={label:`running artifacts server`,pid:a,reasons:f?[...u,`unanswered`]:u,running:t}}let f=await Bn(r,i);l&&(O(r,{action:`replaced`,cli:i,pid:l.pid,reasons:l.reasons,running:l.running}),await eT(l.pid,l.label)),await tT(),d.default.rmSync(r.info,{force:!0});let h=u.default.randomBytes(24).toString(`hex`);d.default.writeFileSync(r.serverId,`${h}\n`),d.default.writeFileSync(r.version,`${i}\n`);let g={args:kn(h,e.port),env:An(e.host,e.urlHost)};if(e.foreground){jn(r,g);let e=(0,p.spawn)(f,g.args,{env:g.env,stdio:[`ignore`,`pipe`,`pipe`]});d.default.writeFileSync(r.pid,`${e.pid}\n`);let n=()=>{e.kill(`SIGTERM`)};if(t.signal)t.signal.addEventListener(`abort`,n,{once:!0});else for(let e of[`SIGINT`,`SIGTERM`])process.on(e,n);m.default.createInterface({input:e.stderr}).on(`line`,e=>t.log(e,`stderr`));let i=new Promise(t=>e.on(`close`,e=>t(e??1))),a=!1,s;m.default.createInterface({input:e.stdout}).on(`line`,e=>{let r;try{r=JSON.parse(e)}catch{t.log(e,`stdout`);return}r.type!==`server-started`||a?t.event?t.event(r):r.type===`server-error`||r.type===`error`?t.failure(r):t.log(JSON.stringify(r),`stderr`):(a=!0,c(),s=o(r,!1),s.catch(()=>n()))});try{let e=await i;return await s,e}finally{if(t.signal)t.signal.removeEventListener(`abort`,n);else for(let e of[`SIGINT`,`SIGTERM`])process.removeListener(e,n)}}let _=await Gn(r,f,g,`${le()} start --project-dir ${n.project}${e.artifact?` --artifact ${e.artifact}`:``} --host ${e.host} --url-host ${e.urlHost} --foreground`);return`failed`in _?(t.failure(_.failed),1):(c(),await o(_.info,!1),0)}finally{c()}}const aT={semantic:Lw,name:`start`,summary:`Start this machine's artifacts server if needed and register the project with it`,options:{artifact:{type:`string`,value:`<type>/<id>`,help:`Also print a link that opens this artifact`},host:{type:`string`,value:`<host>`,help:`Interface to listen on (default: 127.0.0.1)`},"url-host":{type:`string`,value:`<host>`,help:`Host in printed URLs (default: localhost for a loopback --host)`},port:{type:`string`,value:`<n>`,help:`Port to listen on (default: the first free of 27319-27321)`},open:{type:`boolean`,help:`Open or focus the artifact, including when reusing a server`},"no-open":{type:`boolean`,help:`Do not open a browser`},foreground:{type:`boolean`,help:`Run the server in this process until Ctrl+C`},background:{type:`boolean`,help:`Run until ready and detach (the default; incompatible with --foreground)`},mockup:{type:`boolean`,help:`Include the phone mockup guide in the writing description; with --help, print only the guide`}}},oT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function sT(e,t){let n;try{n=d.default.openSync(e,`r`);let r=d.default.fstatSync(n).size,i=Math.min(r,t),a=Buffer.alloc(i);return d.default.readSync(n,a,0,i,r-i),a.toString(`utf8`).split(`
|
|
848
|
+
`).reverse()}catch{return[]}finally{n!==void 0&&d.default.closeSync(n)}}function cT(e,t){if(e)return lT(sT(e,2097152),t)??lT(sT(e,67108864),t)}function lT(e,t){for(let n of e)if(n.startsWith(`{`))try{let e=t(JSON.parse(n));if(typeof e==`string`&&e&&!e.startsWith(`<`))return e}catch{}}function uT(e,t,n){let r=f.default.join(t.CLAUDE_CONFIG_DIR||f.default.join(n,`.claude`),`projects`);try{for(let t of d.default.readdirSync(r)){let n=f.default.join(r,t,e+`.jsonl`);if(d.default.existsSync(n))return n}}catch{return}}function dT(e,t,n){let r=f.default.join(t.CODEX_HOME||f.default.join(n,`.codex`),`sessions`),i=e=>{try{return d.default.readdirSync(e).sort().reverse()}catch{return[]}};for(let t of i(r))for(let n of i(f.default.join(r,t)))for(let a of i(f.default.join(r,t,n))){let o=f.default.join(r,t,n,a),s=i(o).find(t=>t.endsWith(`-`+e+`.jsonl`));if(s)return f.default.join(o,s)}}function fT(e,t,n=h.default.homedir()){if(e===`Claude Code`||e===`Claude Cowork`){let e=t.CLAUDE_CODE_SESSION_ID;return!e||!oT.test(e)?void 0:cT(uT(e,t,n),e=>e.type===`assistant`?e.message?.model:void 0)}if(e===`Codex`){let e=t.CODEX_THREAD_ID;return!e||!oT.test(e)?void 0:cT(dT(e,t,n),e=>e.type===`turn_context`?e.payload?.model:void 0)}}async function pT(e,t,n,r,i){d.default.mkdirSync(f.default.dirname(e),{recursive:!0});let a=f.default.join(f.default.dirname(e),`.`+f.default.basename(e)),o=a+`.`+(0,u.randomUUID)()+`.tmp`,s=a+`.write-lock`;if(!await Xw(s))throw new M(`Another document save is in progress. Retry after it finishes.`);try{let a=null;try{a=d.default.readFileSync(e,`utf8`)}catch(e){if(e.code!==`ENOENT`)throw e}if(a!==t)throw new M(`Document changed. Re-read it and reapply the edit.`);if(n===a)return;let s=a===null?r:te(a).createdBy;d.default.writeFileSync(o,ne(n,{createdBy:s,modifiedBy:r,...i&&{model:i}}),{mode:a===null?384:d.default.statSync(e).mode&511}),d.default.renameSync(o,e)}finally{d.default.rmSync(o,{force:!0}),d.default.rmdirSync(s)}}const mT={name:`write-document`,summary:`Save a document revision with the calling agent’s attribution`,usage:[`--artifact document/<id> --input <edited.xml> [--base <original.xml>]`],options:{artifact:{type:`string`,help:`Document to create or edit`},base:{type:`string`,help:`Unedited copy from before the edit (omit for creation)`},input:{type:`string`,help:`Edited copy of the LiteXML file`}},semantic:e=>Q({id:`write-document`,mode:`finite`,output:{formats:[`brief`,`json`],fields:[`artifact`,`author`]},run:async()=>{let{artifact:t,base:n,input:r}=e.values;if(typeof t!=`string`||!t.startsWith(`document/`)||!ue.test(t)||typeof r!=`string`)throw new M(`Supply --artifact document/<id> and --input <file>.`);let i=I(process.env);if(!i)throw new M(`No agent identity in the writing process environment.`);return await pT(f.default.join(ce(e.projectDir).root,t,`doc.xml`),typeof n==`string`?d.default.readFileSync(n,`utf8`):null,d.default.readFileSync(r,`utf8`),i,fT(i,process.env)),Y({artifact:t,author:i})},present:({data:e})=>({heading:`Document`,status:`SAVED`,subject:e.artifact,summary:e.author,facts:[],sections:[]})},e)},hT=[`desktop`,`laptop`,`tablet`,`mobile`],gT=/* @__PURE__ */ new Set([`localhost`,`127.0.0.1`,`[::1]`,`::1`]),_T=4096;function vT(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t||t.length>256)return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol!==`http:`||n.username||n.password||n.search||n.hash||n.pathname!==`/`&&n.pathname!==``)return null;let r=n.hostname.toLowerCase();if(!gT.has(r))return null;let i=n.port?Number(n.port):80;return!Number.isInteger(i)||i<1||i>65535?null:{origin:n.origin,host:n.host,hostname:r===`[::1]`?`::1`:r,port:i}}function yT(e){let t=e.trim();if(!t||t.length>1024)return null;let n=/^https?:\/\//i.test(t)?t:`http://${t}`,r;try{r=new URL(n)}catch{return null}let i=vT(r.origin);if(!i)return null;let a=`${r.pathname||`/`}${r.search}${r.hash}`;return{url:i.origin,path:a}}function bT(e){if(typeof e==`string`)return hT.includes(e)?e:null;if(typeof e==`object`&&e&&!Array.isArray(e)){let{w:t,h:n}=e;if(typeof t==`number`&&typeof n==`number`&&Number.isInteger(t)&&Number.isInteger(n)&&t>=240&&t<=_T&&n>=240&&n<=_T)return{w:t,h:n}}return null}function xT(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||t.length>2e3||!t.startsWith(`/`)||t.startsWith(`//`)?null:t}function ST(e){let t;try{t=JSON.parse(e)}catch(e){return{config:null,issues:[`preview.json is not valid JSON: ${e.message}`]}}if(typeof t!=`object`||!t||Array.isArray(t))return{config:null,issues:[`preview.json must be a JSON object`]};let n=t,r=[];n.version!==1&&r.push(`preview.json requires version: 1`);let i=vT(n.url);i||r.push(`preview.json url must be a local loopback http origin (e.g. http://localhost:5173 or http://127.0.0.1:3000)`);let a;n.title!==void 0&&(typeof n.title!=`string`||!n.title.trim()||n.title.length>200?r.push(`preview.json title must be a non-empty string (<= 200 chars)`):a=n.title.trim());let o;if(n.path!==void 0){let e=xT(n.path);e?o=e:r.push(`preview.json path must start with "/" (and not "//")`)}let s;if(n.viewport!==void 0){let e=bT(n.viewport);e?s=e:r.push(`preview.json viewport must be one of ${hT.join(`, `)} or { w, h } (240..${_T})`)}return r.length>0||!i?{config:null,issues:r}:{config:{version:1,url:i.origin,...a?{title:a}:{},...o?{path:o}:{},...s?{viewport:s}:{}},issues:[]}}const CT=e=>`No artifacts server is running for this project. Start it with \`${le()} start --project-dir ${e}\`, then run this again.`,wT=e=>{try{let{url:t}=JSON.parse(P(e)??``);return typeof t==`string`?t:null}catch{return null}};function TT(e,t){let n=He(),r=wT(n.info);return r?Ge(n.projects).some(t=>t.dir===e)?r:null:wT(t)}function ET(e){let t=ce(e),n=TT(t.project,t.info);if(!n)throw new J({code:`E_SERVER_NOT_RUNNING`,message:CT(t.project)});let r=new URL(n),i=r.searchParams.get(`key`)??``;return r.hostname===`localhost`&&(r.hostname=`127.0.0.1`),{project:t.project,async call(e,n,a,o){let s;try{let c=new URL(`${r.origin}${n}`);c.searchParams.set(`key`,i);let l=Kn(process.env);s=await fetch(c,{method:e,signal:o,headers:{"X-Ryugi-Client":`cli`,"X-Ryugi-Project":encodeURIComponent(t.project),...l?{"x-ryugi-cloud-token":l}:{},...a?{"Content-Type":`application/json`}:{}},body:a?JSON.stringify(a):void 0})}catch{throw new J({code:`E_SERVER_UNREACHABLE`,message:CT(t.project)})}let c=new Uint8Array(await s.arrayBuffer()),l;try{l=JSON.parse(new TextDecoder().decode(c))}catch{}if(!l||typeof l!=`object`||Array.isArray(l))throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid JSON response; the operation result is unknown.`,httpStatus:s.status},`failed`,c);return{status:s.status,json:l,raw:c}}}}async function DT(){let e=He(),t=wT(e.info),n={scope:`machine`,version:P(e.version)};if(!t)return{...n,status:`not_running`};try{let e=new URL(`/api/status`,t);e.search=new URL(t).search;let r=await fetch(e,{signal:AbortSignal.timeout(1e3)}),i=await r.json();return{...n,status:r.ok&&typeof i.pid==`number`?`running`:`unreachable`,pid:typeof i.pid==`number`?i.pid:void 0}}catch{return{...n,status:`unreachable`}}}const OT=`preview.json`,kT=/^[a-z0-9][a-z0-9-]{0,63}$/;function AT(e){return f.default.join(f.default.dirname(e),`preview`)}function jT(e,t){return kT.test(t)?f.default.join(AT(e),t):null}function MT(e){let t=AT(e),n;try{n=d.default.readdirSync(t)}catch{return[]}let r=[];for(let e of n){if(!kT.test(e))continue;let n=f.default.join(t,e);d.default.existsSync(f.default.join(n,OT))&&r.push({id:e,payload:NT(n,e)})}return r}function NT(e,t,n){let r=f.default.join(e,OT),i,a=1;try{let e=d.default.statSync(r);a=Math.trunc(e.mtimeMs)||1,i=d.default.readFileSync(r,`utf8`)}catch{return{title:t,version:a,config:null,issues:[`preview.json is missing`],warnings:[`preview.json is missing`],proxyUrl:n??null}}let{config:o,issues:s}=ST(i);return{title:o?.title||t,version:a,config:o,issues:s,warnings:s,proxyUrl:n??null}}function PT(e,t){d.default.mkdirSync(e,{recursive:!0}),Sn(f.default.join(e,OT),t)}function FT(e,t,n){return new Promise(r=>{let i=_.default.connect({host:e,port:t}),a=!1,o=e=>{a||(a=!0,i.destroy(),r(e))};i.setTimeout(n,()=>o(!1)),i.once(`connect`,()=>o(!0)),i.once(`error`,()=>o(!1))})}async function IT(e,t=800){let n=vT(e);if(!n)return!1;if(n.hostname!==`localhost`)return FT(n.hostname,n.port,t);let r=await Promise.all([FT(`127.0.0.1`,n.port,t),FT(`::1`,n.port,t)]);return r[0]||r[1]}function LT(e){let t=typeof e==`string`&&e.trim()?e.trim():`dev`;if(!kT.test(t))throw new M(`Preview --id must use lowercase letters, digits, and hyphens.`);return t}function RT(e){let t=e.anchor??{},n=typeof t.route==`string`?t.route:`/`,r=t.kind===`box`?`box`:`element`,i=t.pageRect??t.rect,a=t.source,o=a?.file?`${a.file}${a.line?`:${a.line}`:``}`:a?.component?`<${a.component}>`:``,s=r===`box`&&i?`box (${i.x},${i.y} ${i.w}x${i.h})`:[typeof t.selector==`string`?t.selector:``,typeof t.text==`string`?`"${t.text.slice(0,48)}"`:``].filter(Boolean).join(` `),c=t.viewport,l=typeof t.cropPath==`string`?t.cropPath:``,u=[[`${String(e.id??``)} [${String(e.status??`open`)}]`,n,s,o,c?`${c.w}x${c.h}`:``,l?`crop ${l}`:``].filter(Boolean).join(` · `)],d=Array.isArray(e.messages)?e.messages:[];for(let e of d){if(e.deleted)continue;let t=e.author===`agent`?String(e.name||`agent`):`human`;u.push(` ${String(e.id??``)} ${t}: ${String(e.text??``)}`)}return Array.isArray(t.errors)&&t.errors.length>0&&u.push(` errors: ${t.errors.join(` | `)}`),u}function zT({data:e}){return{heading:`Preview ${e.action}`,status:e.action===`open`?`ready`:`ok`,subject:e.id?`preview/${e.id}`:void 0,facts:[...e.url?[Z(`Target`,{key:`url`,value:e.url})]:[],...e.upstreamAlive===void 0?[]:[Z(`Upstream`,{key:`upstreamAlive`,value:e.upstreamAlive?`online`:`offline`})],...e.open?[Z(`Open`,{key:`open`,value:e.open},!0)]:[],...e.receipt?[Z(`Receipt`,{key:`receipt`,value:e.receipt})]:[]],sections:e.lines.length?[{kind:`content`,key:`lines`,text:e.lines.join(`
|
|
849
|
+
`)}]:[]}}const BT={name:`preview`,summary:`Manage local dev server previews (open, list, comments, reply, resolve, ack)`,usage:[`open --url <http://localhost:port> [--id dev]`,`list`,`comments [--id dev] [--all] [--agent <name>]`,`reply --thread <id> --text <message> [--id dev] [--agent <name>]`,`resolve --thread <id> [--id dev] [--agent <name>]`,`ack --receipt <id> [--id dev] [--agent <name>]`],positionals:1,options:{id:{type:`string`,value:`<id>`,help:`Preview id (default: dev)`},url:{type:`string`,value:`<http://localhost:port>`,help:`Local loopback dev server URL`},all:{type:`boolean`,help:`Include all threads, not just unread ones`},thread:{type:`string`,value:`<id>`,help:`Comment thread ID for reply/resolve`},text:{type:`string`,value:`<message>`,help:`Reply message text`},receipt:{type:`string`,value:`<id>`,help:`Review receipt ID to acknowledge`},agent:{type:`string`,value:`<name>`,help:`Agent name for comments/replies`}},semantic:e=>Q({id:`preview`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.open??e.lines[0]??`ok`},async run(t,n){let r=e.positionals[0]||`list`,i=ce(e.projectDir);if(r===`list`){let e=MT(i.root);return Y({action:`list`,lines:e.length?e.map(({id:e,payload:t})=>`${e} · ${t.config?.url??`(invalid)`}${t.config?.path??`/`}`):[`No local previews configured yet.`]})}if(r===`open`){let t=LT(e.values.id),r=e.values.url;if(!r)throw new M(`Pass --url http://localhost:<port>`);let a=yT(r);if(!a)throw new M(`--url must be a local loopback http URL (e.g. http://localhost:5182)`);let o=jT(i.root,t),s=null;try{s=ST(d.default.readFileSync(f.default.join(o,`preview.json`),`utf8`)).config}catch{}PT(o,{version:1,url:a.url,...s?.title?{title:s.title}:{},...a.path&&a.path!==`/`?{path:a.path}:s?.path?{path:s.path}:{},...s?.viewport?{viewport:s.viewport}:{}});let c=``;if(await iT({projectDir:e.projectDir,background:!1,foreground:!1,host:`127.0.0.1`,open:!1},{signal:n.signal,ready(e){c=e.url},failure(e){throw new M(String(e.error??`Failed to start Hub`))},log(e){n.diagnostic(e)}})!==0||!c)throw new M(`Hub did not start.`);let l=`${new URL(c).origin}/preview/${encodeURIComponent(t)}?project=${encodeURIComponent(i.project)}`,u=await IT(a.url);return Y({action:`open`,id:t,url:a.url,upstreamAlive:u,open:l,lines:u?[]:[`Upstream ${a.url} is not listening yet; start your dev server and reload.`]})}let a=LT(e.values.id),o=ET(e.projectDir),s=e.values.agent||`Agent`;if(r===`comments`){let t=await o.call(`POST`,`/api/agent/v1/preview/${encodeURIComponent(a)}/review`,{op:`list`,section:`threads`,detail:!0,all:!!e.values.all,agent:s},n.signal);if(t.status<200||t.status>=300)throw new M(t.json?.error||`HTTP ${t.status}`);let r=Array.isArray(t.json?.items)?t.json.items:[];return Y({action:`comments`,id:a,lines:r.length?r.flatMap(RT):[`No unread preview comments.`],receipt:typeof t.json?.receipt==`string`?t.json.receipt:void 0})}if(r===`reply`||r===`resolve`){let t=e.values.thread;if(!t)throw new M(`Pass --thread <id> for preview ${r}`);let i=e.values.text;if(r===`reply`&&!i?.trim())throw new M(`Pass --text <message> for preview reply`);let c=await o.call(`POST`,`/api/agent/preview/${encodeURIComponent(a)}/comments`,r===`reply`?{op:`reply`,threadId:t,text:i,agent:s}:{op:`resolve`,threadId:t,agent:s},n.signal);if(c.status<200||c.status>=300)throw new M(c.json?.error||`HTTP ${c.status}`);return Y({action:r,id:a,lines:[r===`reply`?`Replied to preview/${a} thread ${t}`:`Resolved preview/${a} thread ${t}`]})}if(r===`ack`){let t=e.values.receipt;if(!t)throw new M(`Pass --receipt <id> for preview ack`);let r=await o.call(`POST`,`/api/agent/v1/preview/${encodeURIComponent(a)}/review`,{op:`ack`,receipt:t,agent:s},n.signal);if(r.status<200||r.status>=300)throw new M(r.json?.error||`HTTP ${r.status}`);return Y({action:`ack`,id:a,receipt:t,lines:[`Acknowledged receipt ${t}`]})}throw new M(`Unknown preview action "${r}". Use open, list, comments, reply, resolve, or ack.`)},present:zT},e)},VT=/^report\/[a-z0-9][a-z0-9-]*$/,HT=e=>typeof e==`object`&&!!e&&Array.isArray(e.sources),UT=({sources:e})=>e.map(e=>e.ok?`${e.id}: ok in ${(e.durationMs/1e3).toFixed(1)} s${e.shape?` · ${e.shape}`:``}`:`${e.id}: failed · ${e.error??`unknown error`}`),WT={name:`report`,summary:`Run the data sources of a report on this machine (needs a running server)`,usage:[`refresh --artifact report/<id> [--only <source-id>]`],details:`refresh runs each data source script under sources/<id>/ and writes its JSON to data/<id>.json; a failed run keeps the last good data. Prints one line per source with the shape of its data.`,positionals:1,options:{artifact:{type:`string`,value:`report/<id>`,help:`The report`},only:{type:`string`,value:`<source-id>`,help:`Run only this data source`}},semantic:e=>Q({id:`report`,mode:`finite`,output:{detail:!1,formats:[`brief`,`json`,`jsonl`,`raw`],fields:[`artifact`,`sources`,`issues`,`lines`],scalar:e=>e.sources.every(e=>e.ok)?`ok`:`failed`},async run(t,n){if(e.positionals[0]!==`refresh`)throw new M(`usage: ryugi report refresh --artifact report/<id>`);let r=e.values.artifact;if(!r||!VT.test(r))throw new M(`--artifact must be report/<id>`);let i=e.values.only,a=await ET(e.projectDir).call(`POST`,`/api/${r}/refresh`,i?{source:i}:{},n.signal);if(n.payloads.raw=a.raw,a.status<200||a.status>=300)throw new M(a.json?.error||`HTTP ${a.status}`);if(!HT(a.json))throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid refresh report.`});let o={...a.json,artifact:r,lines:UT(a.json)},s=o.sources.filter(e=>!e.ok);return Y(o,s.length?s.length===o.sources.length?{kind:`failed`,error:{code:`E_REPORT_SOURCE_FAILED`,message:UT({sources:s}).join(`; `)}}:{kind:`partial`}:{kind:`succeeded`})},present:GT},e)};function GT({data:e}){return{heading:`Refresh`,status:e.sources.every(e=>e.ok)?``:`failed`,subject:e.artifact??``,facts:[Z(`Sources`,{key:`sources`,value:String(e.sources.length)})],sections:[{kind:`content`,key:`lines`,text:(e.lines??UT(e)).join(`
|
|
850
|
+
`)},...e.issues?.length?[{kind:`content`,key:`issues`,text:e.issues.join(`
|
|
851
|
+
`)}]:[]]}}const KT=/^storyboard\/[a-z0-9][a-z0-9-]*$/,qT=e=>typeof e==`object`&&!!e&&Array.isArray(e.lines),JT=e=>typeof e==`object`&&!!e&&typeof e.n==`number`&&Array.isArray(e.shots),YT=({lines:e})=>e.map(e=>e.ok?`${e.id}: ${Math.round((e.duration??0)*100)/100}s${e.cached?` (unchanged)`:``}`:`${e.id}: failed · ${e.error??`unknown error`}`),XT=e=>{let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},ZT=e=>[`cut ${e.n}: ${e.file} · ${e.shots.length} shot${e.shots.length===1?``:`s`}, ${XT(e.shots.at(-1)?.end??0)} · timing from the ${e.mapped===`map`?`map`:`storyboard's durations`}`],QT=(e,t)=>f.default.resolve(e,t),$T=e=>e.state===`done`?[`cut ${e.n}: cuts/${e.n}.mp4`]:e.state===`running`?[`cut ${e.n}: ${Math.round(e.progress*100)}% · ${e.stage}`]:[`cut ${e.n} ${e.state}${e.error?`: ${e.error}`:``}`];function eE(e,t,n){let r=f.default.join(e,`.ryugi`,`artifacts`,...t.split(`/`));if(!d.default.existsSync(r))throw new M(`${t} not found in ${e}`);return YS(r,n)?[`wrote ${JS}`]:[`${JS} is already there; pass --force to replace it with the latest template`]}const tE=e=>typeof e==`object`&&!!e&&typeof e.state==`string`,nE=(e,t)=>new Promise(n=>{let r=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(r),n()})});function rE(e,t){if(t!==void 0)try{return JSON.parse(d.default.readFileSync(QT(e,t),`utf8`))}catch(e){throw new M(`--map ${t} is not readable JSON: ${e.message}`)}}const iE={name:`storyboard`,summary:`Voice the lines of a storyboard, export or register a cut, or refresh its render script, on this machine`,usage:[`voice --artifact storyboard/<id> [--line <line-id>] [--force]`,`cut --artifact storyboard/<id> --file <1080p.mp4> [--map <map.json>] [--master <4k.mp4>]`,`export --artifact storyboard/<id> [--wait]`,`template --artifact storyboard/<id> [--force]`],details:`voice runs voice/voice.mjs for every line whose words, voice or lexicon changed and prints each line's length, so shot durations can be fitted to the voice; a failed line keeps the audio it had. cut copies the 1080p H.264 file in as the next version under cuts/, with each shot's range from --map ({"shots":[{"id","start","end"}]}) or from the storyboard's durations; --master records where the full-size master lives without copying it. export asks the server to run render/render.mjs on the current timeline and registers what it writes as the next cut; --wait prints its progress until it ends. template copies the latest render script to render/render.mjs; --force replaces one that is already there.`,positionals:1,options:{artifact:{type:`string`,value:`storyboard/<id>`,help:`The storyboard`},line:{type:`string`,value:`<line-id>`,help:`voice: voice only this line`},force:{type:`boolean`,help:`voice: voice again even when the words did not change; template: replace render/render.mjs`},wait:{type:`boolean`,help:`export: wait for the export to end, printing its progress`},file:{type:`string`,value:`<1080p.mp4>`,help:`cut: the finished video to register`},map:{type:`string`,value:`<map.json>`,help:`cut: each shot's start and end in the video`},master:{type:`string`,value:`<4k.mp4>`,help:`cut: where the full-size master is kept`}},semantic:e=>Q({id:`storyboard`,mode:`finite`,output:{detail:!1,formats:[`brief`,`json`,`jsonl`,`raw`],fields:[`artifact`,`action`,`lines`,`cut`,`export`,`error`,`summary`],scalar:e=>e.error||e.lines.some(e=>!e.ok)?`failed`:`ok`},async run(t,n){let r=e.positionals[0];if(r!==`voice`&&r!==`cut`&&r!==`export`&&r!==`template`)throw new M(`usage: ryugi storyboard voice|cut|export|template --artifact storyboard/<id>`);let i=e.values.artifact;if(!i||!KT.test(i))throw new M(`--artifact must be storyboard/<id>`);if(r===`template`)return Y({action:r,artifact:i,lines:[],summary:eE(e.projectDir,i,!!e.values.force)},{kind:`succeeded`});let a=ET(e.projectDir);if(r===`export`){let t=await a.call(`POST`,`/api/${i}/export`,{},n.signal);if(n.payloads.raw=t.raw,t.status<200||t.status>=300||!tE(t.json))throw new M(t.json?.error||`HTTP ${t.status}`);let o=t.json,s=[];for(;e.values.wait&&o.state===`running`&&!n.signal?.aborted;){let e=$T(o)[0];s.at(-1)!==e&&s.push(e),await nE(1e3,n.signal);let t=await a.call(`GET`,`/api/${i}/export`,void 0,n.signal);tE(t.json)&&(o=t.json)}return Y({action:r,artifact:i,export:o,lines:[],summary:[...s,...$T(o)],...o.error?{error:o.error}:{}},o.state===`failed`||o.state===`cancelled`?{kind:`failed`,error:{code:`E_STORYBOARD_EXPORT`,message:o.error??o.state}}:{kind:`succeeded`})}if(r===`cut`){let t=e.values.file;if(!t)throw new M(`storyboard cut needs --file <1080p.mp4>`);let o=rE(e.projectDir,e.values.map),s=e.values.master,c=await a.call(`POST`,`/api/${i}/cut`,{file:QT(e.projectDir,t),...o===void 0?{}:{map:o},...s?{master:QT(e.projectDir,s)}:{}},n.signal);if(n.payloads.raw=c.raw,c.status<200||c.status>=300)throw new M(c.json?.error||`HTTP ${c.status}`);if(!JT(c.json))throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid cut.`});let l=c.json;return Y({action:r,artifact:i,cut:l,lines:[],summary:ZT(l)},{kind:`succeeded`})}let o=e.values.line,s=await a.call(`POST`,`/api/${i}/voice`,{...o?{line:o}:{},force:!!e.values.force},n.signal);if(n.payloads.raw=s.raw,!qT(s.json))throw s.status<200||s.status>=300?new M(s.json?.error||`HTTP ${s.status}`):new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid voice report.`});let c={action:r,artifact:i,lines:s.json.lines,...s.json.error?{error:s.json.error}:{},summary:YT(s.json)};if(c.error)return Y(c,{kind:`failed`,error:{code:`E_STORYBOARD_VOICE`,message:c.error}});let l=c.lines.filter(e=>!e.ok);return Y(c,l.length?l.length===c.lines.length?{kind:`failed`,error:{code:`E_STORYBOARD_VOICE`,message:YT({lines:l}).join(`; `)}}:{kind:`partial`}:{kind:`succeeded`})},present:aE},e)};function aE({data:e}){let t=e.action===`cut`;return{heading:{cut:`Cut`,export:`Export`,template:`Template`,voice:`Voice`}[e.action],status:e.error||e.lines.some(e=>!e.ok)?`failed`:``,subject:e.artifact??``,facts:t?[Z(`Version`,{key:`cut`,value:String(e.cut?.n??``)})]:e.action===`export`?[Z(`Version`,{key:`export`,value:String(e.export?.n??``)})]:e.action===`voice`?[Z(`Lines`,{key:`lines`,value:String(e.lines.length)})]:[],sections:[...e.error?[{kind:`content`,key:`error`,text:e.error}]:[],{kind:`content`,key:`summary`,text:(e.summary??[]).join(`
|
|
852
|
+
`)}]}}const oE=/^whiteboard\/[a-z0-9][a-z0-9-]*$/,sE=e=>{let t=e;return typeof e==`object`&&!!e&&typeof t.artifact==`string`&&typeof t.sceneVersion==`number`&&Array.isArray(t.lines)&&[`none`,`current`,`stale`].includes(t.render)},cE={name:`scene`,summary:`Read a whiteboard: its render and a structure summary (needs a running server)`,usage:[`--artifact whiteboard/<id> [--page <pageId>] [--frame <frameId>]`],details:`Prints the scene version, where the latest browser render is and whether it shows the current scene, then one line per frame, element and arrow, with who drew each. On a whiteboard with several pages it lists the pages; --page or --frame reads one.`,options:{artifact:{type:`string`,value:`whiteboard/<id>`,help:`The whiteboard`},page:{type:`string`,value:`<pageId>`,help:`Read this page of a whiteboard with several pages`},frame:{type:`string`,value:`<frameId>`,help:`Only this frame and the arrows touching it, on whichever page holds it`}},semantic:e=>Q({id:`scene`,mode:`finite`,output:{detail:!1,formats:[`brief`,`json`,`jsonl`,`raw`],fields:[`artifact`,`page`,`pages`,`sceneVersion`,`render`,`renderPath`,`lines`,`conflicts`],scalar:e=>e.render},async run(t,n){let r=e.values.artifact;if(!r||!oE.test(r))throw new M(`--artifact must be whiteboard/<id>`);let i=e.values.frame,a=e.values.page,o=await ET(e.projectDir).call(`POST`,`/api/agent/${r}/scene`,{...i?{frame:i}:{},...a?{page:a}:{}},n.signal);if(n.payloads.raw=o.raw,o.status<200||o.status>=300)throw new M(o.json?.error||`HTTP ${o.status}`);if(!sE(o.json))throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an invalid scene report.`});let s=o.json;return Y(s,{kind:`succeeded`},{actions:(s.pages??[]).map(t=>lw([`scene`,`--artifact`,r,`--page`,t.id,`--project-dir`,e.projectDir],`Read ${t.id}`))})},present:lE},e)};function lE({data:e}){return{heading:`Scene`,status:e.problem?`invalid`:``,subject:e.artifact,facts:[...e.page?[Z(`Page`,X(e,`page`))]:[],Z(`Version`,X(e,`sceneVersion`)),Z(`Render`,X(e,`render`)),...e.renderPath?[Z(`Image`,X(e,`renderPath`))]:[],...e.problem?[Z(`Problem`,X(e,`problem`))]:[],Z(`Conflicts`,{key:`conflicts`,value:e.conflicts.join(`, `)})],sections:[{kind:`content`,key:`lines`,text:e.lines.join(`
|
|
853
|
+
`)}]}}const uE={threads:[`id`,`status`,`waitingOn`,`anchor`,`stale`,`changes`,`messages`,`preview`,`messageCount`,`omittedMessages`],asks:[`id`,`state`,`choice`,`text`,`byRecommendation`,`staleChoice`,`note`],groups:[`id`,`kind`,`verdict`,`choice`,`by`,`byRecommendation`,`round`,`threads`,`evidenceUpdated`,`rejectThreads`,`title`,`from`,`capturedAt`],rounds:[`id`,`state`,`title`,`groups`,`submitted`]},dE={threads:[`id`,`status`,`waitingOn`],asks:[`id`,`state`],groups:[`id`,`kind`,`verdict`,`choice`],rounds:[`id`,`state`]},fE=e=>e.startsWith(`document/`)?[`threads`,`asks`]:[`threads`,`groups`,`rounds`];function pE(e,t){return e.section?`Choose section or sections, not both.`:!e.sections.length||new Set(e.sections).size!==e.sections.length||e.sections.some(e=>!fE(t).includes(e))?`Choose distinct review sections supported by this artifact.`:e.fields||e.cursor||e.snapshot||e.thread||e.filters&&Object.values(e.filters).some(e=>e!==void 0)?`Fields, filters, thread, cursor and snapshot require a single --section. Follow each collection continuation separately.`:null}function mE(e){let{section:t,filters:n}=e;if(!t&&(e.detail||e.cursor||e.fields||n&&Object.values(n).some(Boolean)))return`Choose a section before requesting detail, fields, filters or a cursor.`;if(t&&!(t in uE))return`Unknown review section.`;if(n&&Object.keys(n).some(e=>![`status`,`waitingOn`,`kind`,`choiceState`].includes(e)))return`Unknown review filter.`;if(n?.waitingOn&&(t!==`threads`||![`agent`,`human`,`any`].includes(n.waitingOn)))return`waitingOn applies to threads and must be agent, human or any.`;let r=t===`threads`?[`open`,`resolved`]:t===`asks`?[`draft`,`submitted`,`settled`,`orphan`]:t===`groups`?[`pending`,`pass`,`reject`]:[`open`,`submitted`,`closed`];return n?.status&&!r.includes(n.status)?`Invalid status for this section.`:n?.kind&&(t!==`groups`||![`choose`,`verify`].includes(n.kind))?`kind applies to groups.`:t===`groups`&&n?.status&&n.kind!==`verify`?`Verify status requires kind=verify.`:n?.choiceState&&(t!==`groups`||n.kind!==`choose`||![`chosen`,`empty`].includes(n.choiceState))?`choiceState requires a choice group.`:t&&e.fields?.some(e=>!uE[t].includes(e))?`Unknown field for this section.`:null}function hE(e,t,n){let r=f.default.resolve(e),i=n?.begin(`save`,r),a;try{a=d.default.openSync(r,`wx`,384)}catch(e){throw i!==void 0&&n.set(i,`failed`),new J({code:e.code===`EEXIST`?`E_FILE_EXISTS`:`E_FILE_WRITE_FAILED`,message:`Could not create ${r}: ${e.message}`})}try{d.default.writeFileSync(a,t)}catch(e){throw d.default.closeSync(a),d.default.unlinkSync(r),i!==void 0&&n.set(i,`failed`),new J({code:`E_FILE_WRITE_FAILED`,message:`Could not save ${r}: ${e.message}`})}return d.default.closeSync(a),i!==void 0&&n.confirm(i,{bytes:typeof t==`string`?Buffer.byteLength(t):t.byteLength}),{file:r,bytes:typeof t==`string`?Buffer.byteLength(t):t.byteLength}}function gE(e,t,n,r,i){let a=e.projectDir,o=[`--artifact`,t,`--project-dir`,a];if(n.evidence===`preview`&&n.items.length&&n.snapshot){let t=i.findIndex(e=>e.label===`Read`),a=[`status`,`waiting-on`,`kind`,`choice-state`].flatMap(t=>typeof e.values[t]==`string`?[`--${t}`,String(e.values[t])]:[]),s={...lw([`comment`,`list`,...o,`--section`,`threads`,`--detail`,`--snapshot`,n.snapshot,`--limit`,String(r?.returned??n.items.length),...typeof e.values.cursor==`string`?[`--cursor`,e.values.cursor]:[],...a,...e.values.all?[`--all`]:[]],`Read`),reason:`Read the complete captured page before acting. Previews mark nothing read.`};t<0?i.push(s):i.splice(t,1,s)}if(n.evidence!==`complete`)return;let s=n.items.filter(e=>e.status===`open`);if(s.length){let{write:e}=hC(a,t);i.push({...lw([`check`,...o],`Check`),reason:`After editing ${e} in place. Re-read before editing; preserve human changes and existing IDs. comments.json is server-owned.`});for(let e of s)i.push({...lw([`comment`,`reply`,...o,`--thread`,String(e.id),`--text`,`<what changed or your answer>`],`Reply (${e.id})`),reason:`Replace the message argument after applying this request.`}),e.anchor?.verdict!==`reject`&&i.push({...lw([`comment`,`resolve`,...o,`--thread`,String(e.id)],`Resolve (${e.id})`),reason:`Only once this thread is settled.`})}let c=i.findIndex(e=>e.label===`Acknowledge`);if(c>=0){let[e]=i.splice(c,1);i.push({...e,reason:`After using every delivered message. This resolves nothing and leaves later replies unread.`})}}const $=e=>typeof e==`string`?e:``,_E=e=>e.replaceAll(/\s*\n\s*/g,` / `).trim(),vE=(e,t)=>`${e} ${t}${e===1?``:`s`}`,yE=e=>e[0].toUpperCase()+e.slice(1),bE=(e,t=[])=>Object.entries(e??{}).filter(([e,n])=>e!==`waitingOnAgent`&&!t.includes(e)&&typeof n==`number`&&n>0).map(([e,t])=>`${t} ${e}`).join(`, `),xE=e=>e?` (${e})`:``,SE={asks:{word:`to apply`,none:`nothing to apply`,listed:[`submitted`]},groups:{word:`to act on`,none:`nothing to act on`,listed:[]},rounds:{word:`open or submitted`,none:`nothing open`,listed:[`open`,`submitted`]}};function CE(e,t,n,r=!1){let i=n?.total??t.items.length,a=t.summary;if(r){let e=`${i} matched`;return{head:e,full:`${e}${xE(bE(a))}`,count:i}}if(e===`threads`){let e=Number(a?.waitingOnAgent??0),t=i?`${i} unread${e?`, ${e} waiting on you`:``}`:`nothing unread`,n=Number(a?.resolved??0);return{head:t,full:`${t}${n?` (${n} resolved)`:``}`,count:i}}let o=SE[e],s=i?`${i} ${o.word}`:o.none,c=e===`groups`?Object.entries(a??{}).reduce((e,[t,n])=>t===`waitingOnAgent`||typeof n!=`number`?e:e+n,0)-i:0,l=e===`groups`?c>0?vE(c,`other`):``:bE(a,o.listed);return{head:s,full:`${s}${xE(l)}`,count:i}}function wE(e){if(!e||typeof e!=`object`)return``;let t=e;if(t.kind===`node`)return` node ${$(t.id)}`;if(t.kind!==`edge`)return``;let n=typeof t.index==`number`&&t.index>0?` #${t.index+1}`:``;return` edge ${$(t.from)} → ${$(t.to)}${n}`}function TE(e){let t=e.snapshot&&typeof e.snapshot==`object`?e.snapshot:{},n=$(t.tag),r=$(t.title),i=e.point&&typeof e.point==`object`?e.point:null,a=t.value===void 0?``:` = ${_E(JSON.stringify(t.value))}`,o=i?` · point ${$(i.series)} @ ${String(i.x)}${a}`:typeof e.row==`string`?` · row ${e.row}${typeof t.value==`object`?``:a}`:``;return`${n?`${n} `:``}${String(e.block)}${r?` "${_E(r)}"`:``}${o}${e.dataChanged?` · data changed`:``}`}const EE=e=>{let t=Math.round(e*10),n=Math.floor(t/10);return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}.${t%10}`};function DE(e){let t=$(e.title);return`${e.deleted?`shot ${String(e.shot)} (shot deleted)`:`shot ${typeof e.number==`number`?`${e.number} `:``}${String(e.shot)}${t?` "${_E(t)}"`:``}`}${typeof e.t==`number`?` · ${typeof e.cut==`number`?`cut ${e.cut} `:``}at ${EE(e.t)}`:``}${typeof e.line==`string`?` · line ${e.line}${$(e.lineText)?` "${_E($(e.lineText))}"`:``}`:``}${e.mark?` · marked`:``}${$(e.cropPath)?` · crop ${$(e.cropPath)}`:``}`}function OE(e){if(!e||typeof e!=`object`)return``;let t=e;if(typeof t.blockId==`string`){let e=Array.isArray(t.blockIds)&&t.blockIds.length>1?t.blockIds:[t.blockId];return`${e.length>1?`blocks`:`block`} ${e.join(`, `)}${wE(t.diagram)}${$(t.quote)?` "${_E($(t.quote))}"`:``}`}if(Array.isArray(t.elements)&&t.elements.length)return`element ${t.elements.join(`, `)}`;if(typeof t.block==`string`)return TE(t);if(typeof t.shot==`string`)return DE(t);if(typeof t.slide==`string`){let e=$(t.title),n=$(t.text),r=Array.isArray(t.nodes)?t.nodes:[],i=r.length?` · ${r.length} node${r.length===1?``:`s`}: ${r.map(e=>`${$(e.tag)} ${$(e.block)} "${_E($(e.text))}"`).join(`, `)}`:``;return`slide ${t.slide}${e?` "${_E(e)}"`:``}${i||(n?` · on "${_E(n)}"`:``)}`}let n=$(t.page);if(typeof t.board==`string`)return`${n?`page ${n} `:``}board ${t.board}`;let r=typeof t.x==`number`&&typeof t.y==`number`?` ${Math.round(t.x)},${Math.round(t.y)}`:``;return`page ${n||`main`}${r}`}const kE={key:`id`,positional:!0,required:!0},AE={key:`line`,positional:!0,required:!0},jE={key:`tail`,positional:!0,required:!0},ME=e=>e.choice?` → ${e.choice}${e.byRecommendation?` (recommended)`:``}`:``;function NE(e,t){return e===`asks`?{columns:[kE,AE,{key:`note`,label:`note`},{key:`staleChoice`,label:`stale choice`}],rows:t.map(e=>({...e,line:`${$(e.state)}${e.choice?ME(e):$(e.text)?` · "${_E($(e.text))}"`:`choice`in e||`text`in e?` · no answer`:``}`,note:$(e.note)&&`"${_E($(e.note))}"`}))}:e===`threads`?{columns:[kE,{key:`status`,positional:!0,required:!0},{key:`waiting`,positional:!0},{key:`where`,positional:!0},{key:`marked`,label:`marked`},{key:`stale`,label:`stale`},{key:`orphan`,label:`orphan`},{key:`messageCount`,positional:!0},{key:`preview`,positional:!0}],rows:t.map(e=>({...PE(e),messageCount:typeof e.messageCount==`number`&&e.messageCount?vE(e.messageCount,`message`):``,preview:$(e.preview)&&`"${_E($(e.preview))}"`}))}:e===`groups`?{columns:[kE,{key:`kind`,positional:!0,required:!0},AE,{key:`origin`,positional:!0},{key:`evidenceUpdated`,label:`evidence updated`},{key:`rejects`,positional:!0},{key:`threadCount`,positional:!0},jE],rows:t.map(e=>({...e,line:e.kind===`verify`?$(e.verdict):`${e.round?`round ${e.round}`:``}${e.choice?ME(e):` · no pick`}`.replace(/^ · /,``),origin:typeof e.from==`string`&&e.from?`from ${e.from}`:``,rejects:typeof e.rejectThreads==`number`&&e.rejectThreads?vE(e.rejectThreads,`reject thread`):``,threadCount:typeof e.threads==`number`&&e.threads?vE(e.threads,`thread`):``,tail:$(e.title)}))}:{columns:[kE,{key:`state`,positional:!0,required:!0},{key:`groupList`,positional:!0},jE],rows:t.map(e=>({...e,groupList:Array.isArray(e.groups)&&e.groups.length?`groups ${e.groups.join(`, `)}`:``,tail:$(e.title)}))}}function PE(e){return{id:e.id,status:e.status,waiting:e.waitingOn?`waiting on ${e.waitingOn}`:``,where:OE(e.anchor&&typeof e.anchor==`object`&&typeof e.page==`string`?{page:e.page,...e.anchor}:e.anchor),marked:Array.isArray(e.marked)?e.marked.map($).filter(Boolean).join(`; `):``,stale:e.stale===!0,orphan:e.orphan===!0}}const FE=(e,t)=>({label:e,binding:{key:e,value:t},positional:!0});function IE(e,t=`items`){return{kind:`messages`,key:t,groups:e.map(e=>{let t=PE(e);return{facts:[FE(`id`,t.id),FE(`status`,t.status),FE(`waiting`,t.waiting),FE(`where`,t.where),{label:`marked`,binding:{key:`marked`,value:t.marked}},{label:`stale`,binding:{key:`stale`,value:t.stale}},{label:`orphan`,binding:{key:`orphan`,value:t.orphan}}],messages:(Array.isArray(e.messages)?e.messages:[]).map(e=>({facts:[FE(`message`,[e.id,`${$(e.name)||$(e.author)}${e.author===`agent`?` (agent)`:``}`,$(e.at)&&mw($(e.at)),e.deleted?`(deleted)`:``,$(e.editedAt)&&`edited ${mw($(e.editedAt))}`].filter(Boolean).join(` `))],text:typeof e.text==`string`?e.text:``}))}})}}function LE(e,t,n,r,i){let a=CE(e,t,n,i),o={key:r?e:`items`,title:yE(e),summary:a.full};return e===`threads`&&t.evidence===`complete`?{...IE(t.items),...o,...r?{page:n}:{}}:{kind:`records`,...NE(e,t.items),...o,...r?{page:n}:{}}}const RE=[`threads`,`asks`,`groups`,`rounds`];function zE(e,t){let n=e.summary??{},r=e=>t.find(t=>t.label===yE(e)),i=RE.filter(e=>r(e));return{heading:`Comment list`,status:``,subject:e.artifact,facts:[],sections:i.map(e=>{let t=n[e],i=e===`threads`?CE(`threads`,{items:[],summary:{waitingOnAgent:n.waitingOnAgent}},{total:Number(t??0)}).head:bE(t)||`none`;return{kind:`records`,key:e,title:yE(e),summary:`${i} · ${Ew(r(e))}`,columns:[],rows:[]}}),actions:t.filter(e=>!i.some(t=>yE(t)===e.label))}}function BE({data:e,actions:t,coverage:n},r=`Comment list`,i=!1){if(e.section===`summary`)return zE(e,t);let a=n.page;return{heading:r,status:``,subject:e.artifact,summary:CE(e.section,e,a,i).head,facts:[],sections:[LE(e.section,e,a,!1,i)]}}function VE({data:e},t=!1){let n=Object.entries(e.sections),r=n.map(([e,n])=>CE(e,n,n.page,t)).filter(e=>e.count>0).map(e=>e.head);return{heading:`Comment list`,status:``,subject:e.artifact,summary:r.join(` · `)||`nothing new`,facts:[],sections:n.map(([e,n])=>LE(e,n,n.page,!0,t))}}const HE=(e,t)=>typeof e.values[t]==`string`?e.values[t]:void 0,UE=[`brief`,`table`,`json`,`jsonl`,`raw`];function WE(e,t=!1){let n=HE(e,`artifact`),r=t?cC:sC;if(!n||!uC(r).test(n))throw new J({code:`E_ARGUMENT_INVALID`,message:`--artifact must be ${dC(r)}.`});return n}function GE(e){let t=HE(e,`limit`);if(t!==void 0&&(!/^\d+$/.test(t)||Number(t)<1||Number(t)>100))throw new J({code:`E_ARGUMENT_INVALID`,message:`--limit must be between 1 and 100.`});return{...t===void 0?{}:{limit:Number(t)},...HE(e,`cursor`)?{cursor:HE(e,`cursor`)}:{},...HE(e,`snapshot`)?{snapshot:HE(e,`snapshot`)}:{},all:!!e.values.all,detail:!!e.values.detail||!!e.values.save,...HE(e,`fields`)?{fields:HE(e,`fields`).split(`,`).map(e=>e.trim())}:{}}}function KE(e,t){let n=Se(t);return{...e,agent:I(t)??`Agent`,...n?{session:n}:{}}}async function qE(e,t,n,r,i){let a=await ET(e.projectDir).call(`POST`,`/api/agent/v1/${n}/${r}`,KE(i,process.env),t.signal);if(t.payloads.raw=a.raw,a.json.schema!==`ryugi.review/v1`)throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported review response.`});if(a.status<200||a.status>=300)throw new J({code:typeof a.json.code==`string`?a.json.code:`E_REVIEW_FAILED`,message:a.json.error||`HTTP ${a.status}`,httpStatus:a.status});return a.json}function JE(e,t){return[`--artifact`,t,`--project-dir`,e.projectDir]}function YE(e,t,n){let r=/* @__PURE__ */ new Set([...Object.keys(ZC),`artifact`,`receipt`]),i=Object.keys(e.values).find(e=>!r.has(e));if(i)throw new J({code:`E_ARGUMENT_INVALID`,message:`--${i} is not supported for ack.`});let a=HE(e,`receipt`);if(!a)throw new J({code:`E_ARGUMENT_INVALID`,message:`ack requires --receipt.`});return Q({id:n===`review`?`comment.ack`:`changes.ack`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.receipt},async run(r,i){ET(e.projectDir);let o=i.effects.begin(n===`review`?`comment.ack`:`changes.ack`,a),s=await qE(e,i,t,n,{op:`ack`,receipt:a});if(![`acknowledged`,`unchanged`].includes(s.status))throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported acknowledgement result; inspect unread state before retrying.`});return i.effects.set(o,s.status===`unchanged`?`none`:`confirmed`,{artifact:t}),Y({artifact:t,receipt:a,status:s.status})},present:ZE(n===`review`?`comment`:`changes`)},e)}function XE(e,t,n){if(n!==`list`)throw new J({code:`E_ARGUMENT_INVALID`,message:`--sections applies to comment list.`});let r=GE(e),i=HE(e,`sections`)?.trim(),a=i===`all`?fE(t):(i??``).split(`,`).map(e=>e.trim()),o=Object.fromEntries([`status`,`waiting-on`,`kind`,`choice-state`].map(t=>[t,HE(e,t)])),s=pE({...r,sections:a,section:HE(e,`section`),thread:HE(e,`thread`),filters:o},t);if(s)throw new J({code:`E_ARGUMENT_INVALID`,message:s});return Q({id:`comment.list`,mode:`finite`,output:{formats:UE,detail:!0},async run(n,i){let o=await qE(e,i,t,`review`,{op:`list`,sections:a,...r});for(let e of a){let t=o.sections?.[e];if(!t||!Array.isArray(t.items)||typeof t.snapshot!=`string`||!t.page||typeof t.page.scope!=`string`||typeof t.page.hasMore!=`boolean`||!Number.isInteger(t.page.returned)||!(t.page.total===null||Number.isInteger(t.page.total)))throw new J({code:`E_SERVER_UPGRADE_REQUIRED`,message:`The server does not provide combined review pages. Run start --background for this project to rebuild/restart it.`});if(t.page.returned!==t.items.length||t.page.returned<0||t.page.total!==null&&t.page.total<t.page.returned||t.page.snapshot!==t.snapshot||t.page.nextCursor!==null&&typeof t.page.nextCursor!=`string`||t.page.hasMore!==(typeof t.page.nextCursor==`string`&&t.page.nextCursor.length>0))throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned inconsistent combined review coverage.`})}return $E(e,t,a,o,r)},present:e=>VE(e,r.all)},e)}const ZE=e=>({data:t})=>({heading:e===`comment`?`Comment ack`:`Changes ack`,status:t.status,subject:t.artifact,facts:[],sections:[]});function QE({data:e}){let t=e.blocks.length;return{heading:`Changes`,status:e.saved?`saved`:``,subject:e.artifact,summary:e.empty?`no human edits`:e.diff===void 0?`${t} block${t===1?``:`s`} changed`:`complete diff`,facts:e.saved?[Z(`File`,X(e,`saved`),!0)]:[],sections:e.empty||e.saved?[]:e.diff===void 0?[{kind:`records`,key:`blocks`,rows:e.blocks.map(e=>({id:e.id,size:[e.additions&&`+${e.additions}`,e.deletions&&`-${e.deletions}`].filter(Boolean).join(` `),preview:e.preview&&`"${e.preview.replaceAll(/\s*\n\s*/g,` / `)}"`})),columns:[{key:`id`,positional:!0,required:!0},{key:`size`,positional:!0},{key:`preview`,positional:!0}]}]:[{kind:`diff`,key:`diff`,text:e.diff}]}}function $E(e,t,n,r,i){let a={},o=[],s=[];for(let c of n){let n=r.sections[c],l=eD(e,t,c,n,i),{artifact:u,section:d,...f}=l.data;a[c]={...f,page:n.page},o.push(...l.actions.map(e=>e.label===`More`?{...e,label:`More (${c})`}:e)),f.evidence===`preview`&&c===`threads`&&s.push({path:`data.sections.threads.items.messages`,reason:`summary`})}return Y({artifact:t,sections:a},void 0,{actions:o,coverage:{omitted:s}})}function eD(e,t,n,r,i,a){let o=r.page,s={artifact:t,section:n??`summary`,items:r.items??[],evidence:i.fields?`projected`:n&&n!==`threads`?`state`:i.detail||a?`complete`:`preview`,...r.snapshot?{snapshot:r.snapshot}:{},...r.receipt?{receipt:r.receipt}:{},...r.summary?{summary:r.summary}:{}},c=[],l=JE(e,t);if(r.receipt&&c.push(lw([`comment`,`ack`,...l,`--receipt`,r.receipt],`Acknowledge`)),o?.nextCursor&&c.push(lw([`comment`,`list`,...l,`--section`,n,...i.detail?[`--detail`]:[],...Object.entries({status:HE(e,`status`),"waiting-on":HE(e,`waiting-on`),kind:HE(e,`kind`),"choice-state":HE(e,`choice-state`),fields:HE(e,`fields`),limit:HE(e,`limit`)}).flatMap(([e,t])=>t?[`--${e}`,t]:[]),...i.all?[`--all`]:[],`--cursor`,o.nextCursor],`More`)),n)n===`threads`&&s.evidence===`preview`&&s.items[0]&&c.push(lw([`comment`,`read`,...l,`--thread`,String(s.items[0].id),`--snapshot`,r.snapshot,`--detail`],`Read`));else{c.push(lw([`comment`,`list`,...l,`--sections`,`all`,`--detail`,...i.all?[`--all`]:[],...HE(e,`limit`)?[`--limit`,HE(e,`limit`)]:[]],`Review all`));let n=[`threads`,...iC[t.split(`/`)[0]].review?.sections??[]];c.unshift(...n.map(e=>lw([`comment`,`list`,...l,`--section`,e,...e===`asks`?[`--detail`]:[]],e[0].toUpperCase()+e.slice(1))))}if(n===`asks`)for(let e of s.items.filter(e=>e.state===`submitted`))c.push({...lw([`comment`,`note`,...l,`--ask`,String(e.id),`--text`,`<what changed>`],`Settle (${e.id})`),reason:`Apply this submitted human answer, then replace the note argument with what changed. Never invent an answer.`});return n===`threads`&&gE(e,t,s,o,c),Y(s,void 0,{actions:c,coverage:{...o?{page:o}:{},...s.evidence===`preview`&&n===`threads`?{omitted:[{path:`data.items.messages`,reason:`summary`}]}:{}}})}function tD(e){let t=WE(e),n=e.positionals[0];if(n===`ack`)return YE(e,t,`review`);if(e.values.sections!==void 0)return XE(e,t,n);if(n!==`list`&&n!==`read`)throw new J({code:`E_ARGUMENT_INVALID`,message:`Expected list, read or ack.`});let r=GE(e),i=n===`read`?`threads`:HE(e,`section`),a=HE(e,`thread`);if(n===`read`&&!a)throw new J({code:`E_ARGUMENT_INVALID`,message:`read requires --thread.`});if(i&&![`threads`,`asks`,`groups`,`rounds`].includes(i))throw new J({code:`E_ARGUMENT_INVALID`,message:`Unknown review section.`});if(!i&&(r.detail||r.cursor||r.fields||[`status`,`waiting-on`,`kind`,`choice-state`].some(t=>e.values[t])))throw new J({code:`E_ARGUMENT_INVALID`,message:`Select --section before detail, fields, cursor or filters.`});let o=Object.fromEntries([[`status`,HE(e,`status`)],[`waitingOn`,HE(e,`waiting-on`)],[`kind`,HE(e,`kind`)],[`choiceState`,HE(e,`choice-state`)]].filter(([,e])=>e!==void 0)),s=mE({...r,section:i,filters:o});if(s)throw new J({code:`E_ARGUMENT_INVALID`,message:s});return Q({id:`comment.${n}`,mode:`finite`,output:{detail:!0,formats:UE,collection:`items`,requiredFields:i?dE[i]:[],fields:i?[...uE[i]]:[]},async run(s,c){let l=await qE(e,c,t,`review`,{op:n,...r,...i?{section:i}:{},...a?{thread:a,detail:!0}:{},...Object.keys(o).length?{filters:o}:{}});return eD(e,t,i,l,r,a)},present:t=>BE(t,n===`read`?`Comment read`:`Comment list`,r.all||!!HE(e,`status`)&&(i!==`asks`||HE(e,`status`)!==`submitted`)||!!HE(e,`choice-state`))},e)}function nD(e){let t=WE(e,!0),n=e.positionals[0];if(n===`ack`)return YE(e,t,`changes`);if(n)throw new J({code:`E_ARGUMENT_INVALID`,message:`Expected changes or changes ack.`});let r=GE(e),i=HE(e,`save`);if(i!==void 0&&!i.trim())throw new J({code:`E_ARGUMENT_INVALID`,message:`--save requires a nonempty file path.`});if(r.detail&&(r.fields||r.cursor||r.limit!==void 0))throw new J({code:`E_OPTION_CONFLICT`,message:`A complete diff cannot use --limit, --cursor or --fields.`});return Q({id:`changes`,mode:`finite`,output:{detail:!0,formats:i?[`brief`,`json`,`jsonl`]:UE,fields:[`artifact`,`snapshot`,`blocks`,`diff`,`empty`]},async run(n,a){let{page:o,schema:s,...c}=await qE(e,a,t,`changes`,{op:`read`,...r}),l=c;if(i&&l.empty!==!0&&typeof l.diff!=`string`)throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server did not return complete diff evidence; no export was written.`});if(i){let e=hE(i,l.diff??``,a.effects);l.saved=e.file,l.bytes=e.bytes,delete l.diff}let u=JE(e,t),d=l.receipt?[lw([`changes`,`ack`,...u,`--receipt`,l.receipt],`Acknowledge`)]:l.empty?[]:[lw([`changes`,...u,`--snapshot`,l.snapshot,...r.all?[`--all`]:[],`--detail`],`Read`)];return o?.nextCursor&&d.push(lw([`changes`,...u,...r.all?[`--all`]:[],...Object.entries({fields:HE(e,`fields`),limit:HE(e,`limit`)}).flatMap(([e,t])=>t?[`--${e}`,t]:[]),`--cursor`,o.nextCursor],`More`)),Y(l,void 0,{actions:d,coverage:{...o?{page:o}:{},...!r.detail&&!l.empty?{omitted:[{path:`data.diff`,reason:`summary`}]}:{}}})},present:QE},e)}const rD={semantic:nD,positionals:1,name:`changes`,summary:`Show what your human partner changed in a document or a deck (needs a running server)`,usage:[`--artifact document/<id>|slides/<id> [--all] [--detail | --save <file>]`,`ack --artifact document/<id>|slides/<id> --receipt <receipt>`],details:`Previews unread document edits without marking them read. Use --detail for complete evidence, then changes ack --receipt after using it.`,options:{limit:{type:`string`,value:`<n>`,help:`Summary records per page (1–100, default 10)`},cursor:{type:`string`,value:`<cursor>`,help:`Continue a change summary snapshot`},snapshot:{type:`string`,value:`<snapshot>`,help:`Read a captured change snapshot`},receipt:{type:`string`,value:`<receipt>`,help:`ack: acknowledge the complete captured diff`},save:{type:`string`,value:`<file>`,help:`Save the complete diff without overwriting an existing file`},artifact:{type:`string`,value:`document/<id>|slides/<id>`,help:`The document or deck`},all:{type:`boolean`,help:`Show historical changes without a receipt`}}};function iD(e){let t=e=>!!e&&typeof e==`object`&&!Array.isArray(e),n=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`);if(!t(e)||!n(e.warnings)||!t(e.evidence)||typeof e.evidence.required!=`boolean`||typeof e.evidence.fresh!=`boolean`||e.evidence.observed!==void 0&&typeof e.evidence.observed!=`boolean`||e.pending!==void 0&&!n(e.pending)||e.provenance!==void 0&&!n(e.provenance)||e.modules!==void 0&&!n(e.modules)||e.checkedAt!==void 0&&typeof e.checkedAt!=`string`||e.structure!==void 0&&typeof e.structure!=`number`||e.unvisited!==void 0&&!(Array.isArray(e.unvisited)&&e.unvisited.every(e=>t(e)&&typeof e.page==`string`&&n(e.boards)))||e.sheet!==void 0&&e.sheet!==null&&(!t(e.sheet)||typeof e.sheet.version!=`number`||!n(e.sheet.files)||e.sheet.unavailable!==void 0&&typeof e.sheet.unavailable!=`string`)||e.diagnostics!==void 0&&!(Array.isArray(e.diagnostics)&&e.diagnostics.every(e=>t(e)&&typeof e.code==`string`&&typeof e.message==`string`&&(e.location===void 0||typeof e.location==`string`)&&(e.severity===`error`||e.severity===`warning`))))return!1;for(let t of[`ran`,`merging`])if(e[t]!==void 0&&typeof e[t]!=`boolean`)return!1;return!(e.dynamic!==void 0&&(!t(e.dynamic)||Object.values(e.dynamic).some(e=>!t(e)||e.ran!==void 0&&typeof e.ran!=`boolean`))||e.recordings!==void 0&&(!t(e.recordings)||Object.values(e.recordings).some(e=>!t(e)||[`status`,`warning`].some(t=>e[t]!==void 0&&typeof e[t]!=`string`))))}const aD=/* @__PURE__ */ new Set([`W_PROVENANCE`,`W_MODULES`,`W_HUMAN_EDIT_OVERWRITTEN`,`W_BOARD_CLIPPED`]);function oD(e,t){let n=(t.warnings??[]).map(e=>({code:`W_ARTIFACT`,severity:`warning`,message:e}));n.push(...t.diagnostics??[]);for(let e of t.provenance??[])n.push({code:`W_PROVENANCE`,severity:`warning`,message:e});for(let e of t.modules??[])n.push({code:`W_MODULES`,severity:`warning`,message:e});let r=[...t.pending??[]];t.merging&&r.push(`merging`);for(let[e,i]of Object.entries(t.recordings??{}))i.warning&&n.push({code:`W_RECORDING`,severity:`warning`,message:i.warning,location:e}),i.status===`processing`&&r.push(`recording:${e}`);let i=Object.entries(t.dynamic??{}),a=t.evidence?.required??(e.startsWith(`html/`)||e.startsWith(`artboard/`)||i.length>0),o=t.evidence?.observed===!1||t.ran===!1||i.some(([,e])=>e.ran===!1);a&&o&&r.push(`browser_not_run`);let s=t.evidence?.observed??(t.ran===!0||i.length>0&&i.every(([,e])=>e.ran===!0)),c=a?o?`not_run`:s&&t.evidence?.fresh===!0?`clean`:`unknown`:`not_required`,l=n.filter(e=>!aD.has(e.code)),u=l.length?`issues`:r.length?`pending`:c===`unknown`||t.evidence?.fresh===!1?`unknown`:`clean`;return Y({artifact:e,status:u,static:l.length?`issues`:`clean`,runtime:c,issues:n,pending:r,...t.sheet?.unavailable?{sheetUnavailable:t.sheet.unavailable}:t.sheet?{sheet:t.sheet.files}:{},...t.structure?{structure:t.structure}:{},...t.unvisited?.length?{unvisited:t.unvisited}:{},evidence:t},u===`issues`?{kind:`validation_failed`}:u===`pending`||u===`unknown`?{kind:`pending`,reasons:r.length?r:[`evidence_unknown`]}:{kind:`succeeded`})}async function sD(e,t,n){if(!e.artifact||!ue.test(e.artifact))throw new M(de);let r=await ET(e.projectDir).call(`POST`,`/api/agent/${e.artifact}/check${e.page?`?page=${encodeURIComponent(e.page)}`:``}`,void 0,t);n?.(r.raw);let{status:i,json:a}=r;if(i<200||i>=300)throw new M(a?.error||`HTTP ${i}`);if(!iD(a))throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned invalid check evidence; validation could not be established.`});return{...r,json:a}}const cD={name:`check`,summary:`Wait until the server has checked the latest write, then print its warnings (needs a running server)`,usage:[`--artifact <type>/<id> [options]`],options:{artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact to check`},page:{type:`string`,value:`<page-id>`,help:`Whiteboards: check only this page and the board-wide warnings`}},semantic:e=>Q({id:`check`,mode:`finite`,output:{detail:!0,formats:[`brief`,`table`,`json`,`jsonl`,`raw`,`quiet`],fields:[`artifact`,`file`,`status`,`static`,`runtime`,`issues`,`pending`,`sheet`,`sheetUnavailable`,`structure`,`unvisited`,`evidence`],scalar:e=>e.status},async run(t,n){let r=await sD({projectDir:e.projectDir,artifact:e.values.artifact,page:e.values.page},n.signal,e=>{n.payloads.raw=e});n.payloads.raw=r.raw;let i=oD(e.values.artifact,r.json);return i.data.file=hC(e.projectDir,i.data.artifact).write,i.actions=[lw([`check`,`--artifact`,i.data.artifact,...e.values.page?[`--page`,e.values.page]:[],`--project-dir`,e.projectDir,`--detail`])],i},present:lD},e)};function lD({data:e}){let t=e.issues.length;return{heading:`Check`,status:e.status,subject:e.artifact,summary:t?`${t} issue${t===1?``:`s`}`:``,facts:[...t&&e.file?[Z(`File`,{key:`file`,value:e.file})]:[],...e.runtime===`not_run`||e.runtime===`unknown`?[Z(`Browser`,{key:`runtime`,value:e.runtime.replaceAll(`_`,` `)})]:[],...e.pending.length?[Z(`Pending`,{key:`pending`,value:e.pending.join(`, `)})]:[],...e.unvisited?.length?[Z(`Show`,{key:`unvisited`,value:`${e.unvisited.map(({page:e,boards:t})=>`page ${e}: ${t.join(`, `)}`).join(` · `)}. Open the artboard in a browser, bring these boards into view, then check again; with agent-browser installed (see adeck doctor) Check loads them itself`})]:[],...e.sheet?.length?[Z(`Sheet`,{key:`sheet`,value:e.sheet.join(`, `)})]:e.sheetUnavailable?[Z(`Sheet`,{key:`sheetUnavailable`,value:`unavailable (${e.sheetUnavailable})`})]:[],...e.structure?[Z(`Structure`,{key:`structure`,value:`${e.structure} change${e.structure===1?``:`s`} by your human partner since you last read — run changes --artifact ${e.artifact}`})]:[]],sections:[{kind:`diagnostics`,key:`issues`,items:e.issues,preview:3}]}}const uD={reject:0,pending:1,pass:2,checked:3},dD={reject:`rejected`,pending:`pending`,pass:`passed`,checked:`checked by agent`},fD=(e,t)=>e?`${e} ${t}`:``,pD=e=>e.filter(Boolean).join(` · `),mD=(e,t=!1)=>({key:e,positional:!0,required:t});function hD({data:e}){let{tally:t}=e,n=t=>e.claims.filter(e=>e.state===t).length,r=e.threads.filter(e=>e.status===`open`),i=pD([fD(t.needYou,`on your human partner`),fD(t.notVerified,`not verified`),fD(t.orphaned,`open reject on a claim that is gone`)]);return{heading:`Comment list`,status:``,subject:e.artifact,summary:t.done?`done`:t.rejected?`${t.rejected} to act on`:`nothing to act on`,facts:i?[Z(`Waiting`,{key:`waiting`,value:i})]:[],sections:[{kind:`records`,key:`claims`,title:`Claims`,summary:pD([fD(n(`reject`),`rejected`),fD(n(`pending`),`pending`),fD(n(`pass`),`passed`),fD(n(`checked`),`checked by agent`)]),columns:[mD(`id`,!0),mD(`line`,!0),mD(`rejects`),{key:`evidenceUpdated`,label:`evidence updated`},mD(`origin`),mD(`tail`)],rows:[...e.claims].sort((e,t)=>uD[e.state]-uD[t.state]).map(e=>({...e,line:dD[e.state],rejects:e.state===`reject`&&e.rejectThreads?`${e.rejectThreads} reject thread${e.rejectThreads===1?``:`s`}`:``,evidenceUpdated:e.evidenceUpdated||void 0,origin:e.from?`from ${e.from}`:``,tail:e.title}))},...e.rows.length?[{kind:`records`,key:`rows`,title:`Artboard rows`,summary:String(e.rows.length),columns:[mD(`id`,!0),mD(`state`,!0)],rows:e.rows.map(e=>({...e,id:`${e.artboard}/${e.group}`}))}]:[],...e.gaps.length?[{kind:`records`,key:`gaps`,title:`Not verified`,summary:pD([fD(e.gaps.filter(e=>!e.waived).length,`open`),fD(e.gaps.filter(e=>e.waived).length,`waived`)]),columns:[mD(`id`,!0),mD(`line`,!0),mD(`tail`)],rows:e.gaps.map(e=>({...e,line:e.waived?`waived`:`not verified`,tail:e.title}))}]:[],...e.threads.length?[{kind:`messages`,key:`threads`,title:`Threads`,summary:pD([fD(r.length,`open`),fD(e.threads.length-r.length,`resolved`)]),groups:e.threads.map(e=>({facts:[{...Z(`Thread`,{key:`id`,value:e.id},!0),positional:!0},Z(`On`,{key:`anchor`,value:e.anchor.claim?`claim ${e.anchor.claim}`:`gap ${e.anchor.gap}`},!0),Z(`Verdict`,{key:`verdict`,value:e.anchor.verdict??(e.anchor.waive?`waived`:``)}),Z(`Status`,{key:`status`,value:e.status},!0),...e.stale?[Z(`Stale`,{key:`stale`,value:!0})]:[]],messages:e.messages.map(e=>({facts:[{...Z(`Author`,{key:`author`,value:e.author},!0),positional:!0},Z(`At`,{key:`at`,value:e.at})],text:e.text}))}))}]:[]]}}function gD(e){let t=e.values.artifact,n=hC(e.projectDir,t);return Q({id:`comment.list`,mode:`finite`,output:{detail:!0,formats:[`brief`,`json`,`jsonl`],fields:[`id`,`state`,`title`,`from`],scalar:e=>e.tally.done?`done`:`open`},async run(r,i){let a=I(process.env),o=await ET(e.projectDir).call(`POST`,`/api/agent/${t}/comments`,{op:`list`,...a?{agent:a}:{}},i.signal);if(o.status<200||o.status>=300)throw new J({code:o.status===404?`E_ARTIFACT_NOT_FOUND`:`E_COMMENT_FAILED`,message:o.json?.error||`HTTP ${o.status}`,httpStatus:o.status});let s=o.json,c=[`--artifact`,t,`--project-dir`,e.projectDir],l=s.threads.filter(e=>e.status===`open`);return Y({...s,artifact:t,projectDir:e.projectDir},void 0,{actions:l.length?[{...lw([`check`,...c],`Check`),reason:`After repairing the rejected claim and updating ${n.write} with real evidence. Preserve existing IDs and human edits; a human pass closes the rejection.`},...l.map(e=>({...lw([`comment`,`reply`,...c,`--thread`,e.id,`--text`,`<what changed and the replacement evidence>`],`Reply (${e.id})`),reason:`Reply after the repair; leave rejected claims open for the human verdict.`}))]:[]})},present:hD},e)}function _D({data:e}){let t=e.threadId?`thread ${e.threadId}`:e.ask?`ask ${e.ask}`:e.group?`group ${e.group}${e.board?` → ${e.board}`:``}`:e.round?`round ${e.round}`:``;return{heading:`Comment ${e.operation}`,status:e.status,subject:e.artifact,summary:`${t}${e.operation===`answer`&&e.choice?` → ${e.choice}`:``}`,facts:[...e.messageId?[Z(`Message`,X(e,`messageId`))]:[],...e.groups?.length?[Z(`Groups`,{key:`groups`,value:e.groups.join(`, `)})]:[]],sections:[]}}function vD(e){let t={action:e.positionals[0],artifact:e.values.artifact,projectDir:e.projectDir};for(let n of[`ask`,`at`,`block`,`board`,`choice`,`claim`,`cut`,`edge`,`element`,`gap`,`group`,`line`,`node`,`page`,`quote`,`round`,`shot`,`slide`,`text`,`thread`,`x`,`y`])t[n]=e.values[n];for(let n of[`all`,`clear`,`withdraw`])t[n]=!!e.values[n];return t}function yD(e){let t=vD(e),n=t.action;if(t.artifact?.startsWith(`verify/`)&&[`list`,`read`,`ack`].includes(n??``)){if(n!==`list`)throw new J({code:`E_OPTION_UNSUPPORTED`,message:`A verify report has no thread receipts: comment list shows every thread.`});return gD(e)}if([`list`,`read`,`ack`].includes(n??``))return tD(e);if([`section`,`sections`,`limit`,`cursor`,`snapshot`,`receipt`,`status`,`waiting-on`,`kind`,`choice-state`].some(t=>e.values[t]!==void 0))throw new J({code:`E_OPTION_UNSUPPORTED`,message:`Review query options apply only to list, read and ack.`});return Q({id:`comment.${n??`unknown`}`,mode:`finite`,output:{formats:n===`pass`&&t.all?[`brief`,`json`,`jsonl`]:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.ask??e.group??e.round??e.threadId??e.artifact},async run(e,n){let r=CD(t);ET(t.projectDir);let i=n.effects.begin(`comment.${r.action}`,t.thread??t.ask??t.group??t.artifact),a=await wD(t,r,n.signal);if(a.status>=400&&a.status<500&&n.effects.set(i,`failed`),a.status<200||a.status>=300)throw new J({code:a.status===404&&!a.json.error?`E_SERVER_UPGRADE_REQUIRED`:`E_COMMENT_FAILED`,message:a.json.error||`HTTP ${a.status}`,httpStatus:a.status});let o=a.json;n.effects.confirm(i);let{action:s,request:c}=r,l={add:`added`,reply:`replied`,resolve:`resolved`,answer:t.clear?`cleared`:`answered`,note:`settled`,choose:t.clear?`cleared`:`recorded`,pass:`recorded`,reject:`recorded`,waive:`recorded`,submit:t.withdraw?`withdrawn`:`submitted`},u=s===`pass`&&[o.groups,o.claims].some(e=>Array.isArray(e)&&e.length===0);return u&&n.effects.set(i,`none`),Y({artifact:t.artifact,operation:s,status:u?`unchanged`:l[s],by:`agent`,...typeof o.threadId==`string`?{threadId:o.threadId}:{},...typeof o.messageId==`string`?{messageId:o.messageId}:{},...t.ask?{ask:t.ask}:{},...t.group?{group:t.group}:{},...Array.isArray(o.groups)?{groups:o.groups}:{},...Array.isArray(o.claims)?{groups:o.claims}:{},...t.claim?{group:t.claim}:{},...t.gap?{group:t.gap}:{},...t.round?{round:t.round}:{},...s===`choose`?{board:c.board}:{},...s===`submit`?{submitted:!t.withdraw}:{},...s===`answer`?{choice:c.choice}:{}},void 0,{effects:n.effects.snapshot()})},present:_D},e)}const bD=uC(lC),xD=/* @__PURE__ */ new Set([`pass`,`reject`]);function SD(e,t,n){let r=iC[n];if(r.commentRequest)return r.commentRequest(e,t);if(t===`waive`)throw new M(`comment waive works on verify reports only`);let i=r.commentActions?.[t];if(i)return i(e);if(t===`answer`||t===`note`)throw new M(`comment ${t} works on documents only`);if(t===`choose`||t===`submit`||xD.has(t))throw new M(`comment ${t} works on artboards only`);if(t===`add`)throw new M(`comment add does not work on ${n}`);if(!e.thread)throw new M(`comment ${t} needs --thread <threadId>`);return t===`reply`?{op:`reply`,threadId:e.thread,text:$n(e)}:{op:`resolve`,threadId:e.thread}}function CD(e){let t=Zn.find(t=>t===e.action);if(!t)throw new M(`comment needs an action: list, add, reply, resolve, choose, submit, answer, note, pass, reject or waive`);if(!e.artifact||!bD.test(e.artifact))throw new M(`--artifact must be ${dC(lC)}`);let[n,r]=e.artifact.split(`/`);return{action:t,type:n,id:r,request:SD(e,t,n),artifact:e.artifact}}async function wD(e,t,n){let{type:r,id:i,request:a}=t,o=ET(e.projectDir),s=I(process.env);return o.call(`POST`,`/api/agent/${r}/${i}/comments`,{...a,agent:s??`Agent`},n)}const TD={actionOptions:{list:[`limit`,`cursor`,`snapshot`,`status`,`waiting-on`,`kind`,`choice-state`,`thread`],read:[`limit`,`cursor`,`all`,`save`]},semantic:yD,name:`comment`,summary:`Read and answer feedback on a document, artboard, whiteboard, deck, data report or verify report (needs a running server)`,usage:[`list --artifact ${fC(sC)} --sections all|<names> [--detail] [--all]`,`list --artifact ${fC(sC)} [--section threads|asks|groups|rounds] [--all]`,`read --artifact ${fC(sC)} --thread <threadId> [--snapshot <token>]`,`ack --artifact ${fC(sC)} --receipt <receipt>`,`add --artifact document/<id> --block <blockId> [--quote <text>] [--text <text>]`,`add --artifact document/<id> --block <blockId> (--node <id> | --edge "<from>-><to>[#n]") [--text <text>]`,`add --artifact artboard/<id> --board <boardId> [--x <px> --y <px>] [--text <text>]`,`add --artifact whiteboard/<id> (--element <elementId> | --x <px> --y <px> [--page <pageId>]) [--text <text>]`,`add --artifact slides/<id> --slide <slideId> [--text <text>]`,`add --artifact storyboard/<id> (--shot <shotId> [--line <lineId> | --at <seconds>] | --cut <n> --at <seconds>) [--text <text>]`,`add --artifact report/<id> --block <blockId> [--point <series>:<x> | --row <rowKey>] [--text <text>]`,`reply --artifact ${fC(lC)} --thread <threadId> [--text <text>]`,`resolve --artifact ${fC(sC)} --thread <threadId>`,`choose --artifact artboard/<id> --group <groupId> (--board <boardId> | --clear)`,`submit --artifact artboard/<id> --round <roundId> [--withdraw]`,`submit --artifact document/<id> [--withdraw]`,`answer --artifact document/<id> --ask <questionId> (--choice <value> | --text <answer> | --clear)`,`note --artifact document/<id> --ask <questionId> [--text <note>]`,`pass --artifact artboard/<id> (--group <groupId> | --all) [--text <text>]`,`reject --artifact artboard/<id> --group <groupId> [--text <text>]`,`list --artifact verify/<id>`,`pass --artifact verify/<id> (--claim <claimId> | --all)`,`reject --artifact verify/<id> --claim <claimId> [--text <text>]`,`waive --artifact verify/<id> --gap <gapId>`],details:`list returns a summary; select threads, asks, groups or rounds to read one collection. Previews do not consume evidence. read returns a complete thread and receipt; use ack after applying that evidence. asks, groups and rounds are independent state reads without receipts. Without --text, add, reply, note and reject read the message from stdin. answer records what your human partner said in the terminal; note settles a question once its answer is applied. pass and reject record a verdict on a verify group only when your human partner asks for it; the board shows the agent recorded it.`,options:{sections:{type:`string`,value:`<all|threads,asks|threads,groups,rounds>`,help:`Read multiple bounded review collections in one request`},section:{type:`string`,value:`<threads|asks|groups|rounds>`,help:`Semantic list: select one review collection`},limit:{type:`string`,value:`<n>`,help:`Semantic reads: records per page (1–100, default 10)`},cursor:{type:`string`,value:`<cursor>`,help:`Continue a semantic snapshot page`},snapshot:{type:`string`,value:`<snapshot>`,help:`Read an existing semantic snapshot`},receipt:{type:`string`,value:`<receipt>`,help:`ack: confirm exactly the complete evidence delivered`},status:{type:`string`,value:`<status>`,help:`Filter the selected semantic review collection`},"waiting-on":{type:`string`,value:`<agent|human|any>`,help:`Filter unread threads by who should reply`},kind:{type:`string`,value:`<verify|choose>`,help:`Filter review groups by kind`},claim:{type:`string`,value:`<claimId>`,help:`Verify reports: the claim to pass or reject`},gap:{type:`string`,value:`<gapId>`,help:`Verify reports: the not-verified item to waive`},"choice-state":{type:`string`,value:`<chosen|empty>`,help:`Filter choice groups`},artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact whose feedback to read or answer`},all:{type:`boolean`,help:`list: every thread, not only what changed; pass: every verify group not yet passed`},block:{type:`string`,value:`<blockId>`,help:`add: the document block to comment on`},quote:{type:`string`,value:`<text>`,help:`add: the text in the block the comment is about`},node:{type:`string`,value:`<nodeId>`,help:`add: the node of the diagram in --block, by its id in the mermaid source`},edge:{type:`string`,value:`<from>-><to>[#n]`,help:`add: the edge of the diagram in --block between two node ids; #2 is the second edge between them`},board:{type:`string`,value:`<boardId>`,help:`add: the artboard board to comment on`},element:{type:`string`,value:`<elementId>`,help:`add: the whiteboard element to comment on`},page:{type:`string`,value:`<pageId>`,help:`add: the whiteboard page --x and --y are on (default main)`},slide:{type:`string`,value:`<slideId>`,help:`add: the slide of a deck to comment on`},shot:{type:`string`,value:`<shotId>`,help:`add: the shot of a storyboard to comment on`},line:{type:`string`,value:`<lineId>`,help:`add: the voice line of --shot the comment is about`},at:{type:`string`,value:`<seconds>`,help:`add: the moment of --shot, or of --cut, the comment is about`},cut:{type:`string`,value:`<n>`,help:`add: the registered cut --at is a moment of`},point:{type:`string`,value:`<series>:<x>`,help:`add: the point of a report chart in --block, by its series and x value`},row:{type:`string`,value:`<rowKey>`,help:`add: the row of a report table in --block`},x:{type:`string`,value:`<px>`,help:`add: horizontal position on the board`},y:{type:`string`,value:`<px>`,help:`add: vertical position on the board`},thread:{type:`string`,value:`<threadId>`,help:`reply, resolve: the thread`},text:{type:`string`,value:`<text>`,help:`add, reply, note: the message; answer: a written answer; reject: the reason; pass: an optional note`},group:{type:`string`,value:`<groupId>`,help:`choose: the choice group; pass, reject: the verify group`},clear:{type:`boolean`,help:`choose, answer: clear the choice or answer`},ask:{type:`string`,value:`<questionId>`,help:`answer, note: the question id`},choice:{type:`string`,value:`<value>`,help:`answer: the option value`},round:{type:`string`,value:`<roundId>`,help:`submit: the round`},withdraw:{type:`boolean`,help:`submit: withdraw the submission`}},positionals:1},ED={on:!0,off:!1,inherit:null};function DD(e,t=()=>{}){let n=NC(Jn(process.env,process.platform,h.default.homedir())),r=f.default.join(f.default.dirname(ce(e.projectDir).root),`config.json`);if(e.autoPublish!==void 0){let i=ED[e.autoPublish];if(i===void 0)throw new M(`--auto-publish takes on, off, or (with --project) inherit`);if(e.project){let e=EC(r);if(e.warning)throw new M(e.warning);t(),kC(r),jC(r,i)}else if(i===null)throw new M(`inherit only applies with --project`);else IC(n,i,t)}return{global:FC(n)??null,project:EC(r).config.autoPublish??null}}const OD={name:`config`,summary:`Auto-publish changed artifacts as private cloud copies when the agent's turn ends`,usage:[`[--auto-publish on|off] [options]`,`--auto-publish on|off|inherit --project [options]`],details:`Without --auto-publish, prints the current values.`,options:{"output-format":{type:`string`,value:`<brief|json|jsonl|inherit>`,help:`Set the output protocol (inherit for project only)`},"auto-publish":{type:`string`,value:`on|off|inherit`,help:`Turn auto-publish on or off; inherit (with --project) drops the override`},project:{type:`boolean`,help:`Set it for this project only instead of every project`}},semantic:e=>Q({id:`config`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:e.values[`auto-publish`]!==void 0||e.values[`output-format`]!==void 0?[]:[`global`,`project`,`effective`,`source`,`applies`,`output`]},run(t,n){if(e.values[`auto-publish`]!==void 0&&e.values[`output-format`]!==void 0)throw new M(`Choose auto-publish or output-format.`);let r=e.values.project?`project`:`global`,i=GC(e.projectDir)[r],a,o=()=>{a=n.effects.begin(`config`,i)};typeof e.values[`output-format`]==`string`&&JC(e.projectDir,!!e.values.project,e.values[`output-format`],o);let s=DD({projectDir:e.projectDir,autoPublish:e.values[`auto-publish`],project:!!e.values.project},o);return a!==void 0&&n.effects.confirm(a),Y({scope:r,projectDir:e.projectDir,file:i,...s,output:qC(e.projectDir),effective:s.project??s.global,source:s.project===null?s.global===null?`undecided`:`global`:`project`,applies:`supported_turn_end_hook`})},present:kD},e)};function kD({data:e}){let t=e.effective===null?`undecided`:e.effective?`on`:`off`;return{heading:`Config`,status:``,facts:[Z(`Scope`,{key:`scope`,value:e.scope}),Z(`File`,{key:`file`,value:e.file}),Z(`Auto-publish`,{key:`autoPublish`,value:e.source===`undecided`?t:`${t} (${e.source})`}),Z(`Output format`,{key:`output`,value:`${e.output.effective} (${e.output.source})`})],sections:[]}}function AD(e=process.env,t=h.default.homedir()){if(e.RYUGI_DAEMON_SOCKET)return e.RYUGI_DAEMON_SOCKET;let n=f.default.dirname(qe(e)),{home:r}=He(e,t);if(ht(r,t))return f.default.join(n,`daemon.sock`);let i=f.default.join(r,`daemon.sock`);if(Buffer.byteLength(i)<=103)return i;let a=u.default.createHash(`sha256`).update(r).digest(`hex`).slice(0,16);return f.default.join(n,`daemon-${a}.sock`)}function jD(e,{timeoutMs:t=5e3}={}){let n=(n,r)=>new Promise((i,a)=>{let o=_.default.connect(e),s=``,c=e=>{o.destroy(),a(e)},l=setTimeout(()=>c(/* @__PURE__ */ Error(`daemon ${n} timed out`)),t);o.on(`error`,e=>{clearTimeout(l),c(e)}),o.on(`connect`,()=>o.write(`${JSON.stringify({op:n,...r})}\n`)),o.on(`data`,e=>{if(s+=e.toString(`utf8`),s.length>4194304)return c(/* @__PURE__ */ Error(`daemon reply too large`));let t=s.indexOf(`
|
|
854
|
+
`);if(!(t<0)){clearTimeout(l),o.end();try{let e=JSON.parse(s.slice(0,t));e.ok?i(e.data??null):a(Error(e.error||`daemon ${n} failed`))}catch{a(/* @__PURE__ */ Error(`daemon reply is not JSON`))}}})});return{call:n,available:()=>n(`status`,{}).then(()=>!0,()=>!1)}}const MD=()=>u.default.randomBytes(24).toString(`base64url`);function ND(e){try{return d.default.readFileSync(e,`utf8`).trim()}catch{return``}}function PD(e){let t=f.default.join(f.default.dirname(e),`host-id`),n=ND(t);if(/^[\w-]{16,64}$/.test(n))return n;let r=MD();return d.default.mkdirSync(f.default.dirname(t),{recursive:!0,mode:448}),d.default.writeFileSync(t,`${r}\n`,{mode:384}),r}async function FD(e,t){let n=He();if(Ue(n.home),!await Xw(n.lock))throw new M(`Another start is still starting the artifacts server; retry in a moment`);try{let r=Zw(n);if(!r&&!t.startStopped)return`not-running`;let i=await Bn(n,e);r&&(O(n,{action:`replaced`,pid:r,running:P(n.version)??``,cli:e,reasons:[t.reason]}),await eT(r,`running artifacts server`)),d.default.rmSync(n.info,{force:!0});let a=u.default.randomBytes(24).toString(`hex`);d.default.writeFileSync(n.serverId,`${a}\n`),d.default.writeFileSync(n.version,`${e}\n`);let o=Mn(n),s=o?.env.ARTIFACTS_HOST||`127.0.0.1`,c=o?.env.ARTIFACTS_URL_HOST||`localhost`,l=await Gn(n,i,{args:o?Fn(o,a).args:kn(a),env:An(s,c)},`${le()} start --host ${s} --url-host ${c} --foreground`);if(`failed`in l)throw new M(String(l.failed.error??`Server failed`));return r?`restarted`:`started`}finally{try{d.default.rmdirSync(n.lock)}catch{}}}const ID=e=>({binary:f.default.join(e,`.ryugi`,`bin`,`ryugi-daemon`)});async function LD(e,t){if(!ht(e.serverHome,e.home))return{status:`other-hub`};let n=vt(e);if(!d.default.existsSync(n))return{status:`not-installed`};let r=yt(n);if(bt(r,e))return{status:`current`};let i=await xt(e);return t?.(),st(n,i),{status:`updated`,from:r?.version??`unknown`,to:e.version}}const RD=`session control runs on macOS and Linux`,zD=(e,t)=>e.enabled?`linger on: the hub keeps running after you log out`:`linger off (${e.error}): the hub stops when you log out; to keep it running, an admin can run: sudo loginctl enable-linger ${t}`;function BD(e){if(e.platform!==`darwin`&&e.platform!==`linux`)throw new M(RD);if(!ht(e.serverHome,e.home))return null;let t=Lt(e);if(!t)throw new M(RD);let n=t.check();if(n)throw new M(`${n}; session control needs systemd on Linux`);return t}const VD=(e,t,n)=>({autostart:n,binary:t,launch:e.launch,log:e.log,path:e.path});async function HD(e,t){let n=BD(e),r;t.binary?(r=vt(e),st(r,d.default.readFileSync(t.binary))):r=await e.ensureBinary().catch(e=>{throw new M(e.message)}),En(e.serverHome,!0);let i=n?.write(VD(e,r,!0))??null;await e.restartHub(!0);let a=n?.linger();return{binary:r,kind:n?.kind??`process`,service:i,...a?{linger:a}:{}}}async function UD(e){let t=BD(e);En(e.serverHome,!1);let n=vt(e),r=null;return t&&d.default.existsSync(t.file(!0))&&(r=t.write(VD(e,n,!1)),t.disable()),await e.restartHub(!1),{service:r}}async function WD(e){let{cloud:t}=e;try{await e.daemon.call(`status`,{})}catch{throw new M(`the daemon is not running; start it with: adeck daemon install`)}let n=await e.fetch(`${t.origin}/api/devices/confirm`,{method:`POST`,headers:{Authorization:`Bearer ${t.token}`,"Content-Type":`application/json`},body:JSON.stringify({code:e.code.trim().toUpperCase(),hostId:t.hostId,...e.label?{label:e.label}:{}})}),r=await n.json().catch(()=>null);if(!n.ok||!r?.deviceId)throw new M(r?.error?.message??`Cloud refused the code: HTTP ${n.status}`);let i=r.label??``;return await e.daemon.call(`trust.add`,{deviceId:r.deviceId,label:i}),{deviceId:r.deviceId,label:i}}function GD(e,t,n,r=ID(e).binary){let i=t.filter(e=>e.state===`running`&&e.attach),a=n?i.find(e=>e.taskId===n||e.artifact===n):i.length===1?i[0]:void 0;if(!a)throw i.length===0?new M(`no daemon session is running`):n?new M(`no running daemon session ${n}`):new M(`several daemon sessions are running; name one:\n${i.map(e=>` ${e.taskId} ${e.artifact}`).join(`
|
|
855
|
+
`)}`);return[r,`attach`,a.attach]}const KD=[`install`,`uninstall`,`status`,`trust`,`devices`,`remote`,`sessions`,`attach`],qD=()=>ie(process.env),JD=()=>process.env.RYUGI_ARTIFACTS_VERSION||`1.113.1`;function YD(){let e=He();return{configHome:process.env.XDG_CONFIG_HOME||void 0,ensureBinary:()=>Bn(e,JD()),home:h.default.homedir(),launch:On(e),log:e.log,path:process.env.PATH??`/usr/bin:/bin`,platform:process.platform,restartHub:e=>FD(JD(),{reason:`session-control`,startStopped:e}),run:In,serverHome:e.home,uid:process.getuid?.()??0}}function XD(){let e=Jn(process.env,process.platform,h.default.homedir()),t=qD(),n=qn(e,t);if(!n)throw new M(`sign in to Artideck Cloud (${t}) on this computer first`);return{origin:t,token:n.token,hostId:PD(e)}}const ZD=()=>jD(AD());async function QD(e){try{return await e()}catch(e){let t=e.code;throw t===`ENOENT`||t===`ECONNREFUSED`?new M(`the daemon is not running; install it with: adeck daemon install`):new M(e.message)}}async function $D(){return(await QD(()=>ZD().call(`sessions.local`,{}))).sessions}async function eO(e){let[t,n,r]=e.positionals;if(!t||!KD.includes(t))throw new M(`usage: adeck daemon ${KD.join(`|`)}`);let i=(e,n)=>({action:t,status:e,lines:n});switch(t){case`install`:{let t=await HD(YD(),{binary:e.values.binary});return i(`installed`,[`session control on`,`binary ${t.binary}`,...t.service?[`${t.kind.padEnd(8)}${t.service}`]:[],...t.linger?[zD(t.linger,h.default.userInfo().username)]:[]])}case`uninstall`:{let e=await UD(YD());return i(`removed`,[`session control off`,...e.service?[`service ${e.service}`]:[]])}case`status`:{let e=await QD(()=>ZD().call(`status`,{}));return i(`running`,[`version ${e.version}`,`remote ${e.remote?`on`:`off`}`,`sessions ${e.sessions} running, ${e.queued} queued`])}case`trust`:{if(!n)throw new M(`usage: adeck daemon trust <code>`);let t=await WD({code:n,cloud:XD(),daemon:ZD(),fetch,label:e.values.label});return i(`trusted`,[`${t.deviceId} ${t.label}`])}case`devices`:{if(n===`revoke`){if(!r)throw new M(`usage: adeck daemon devices revoke <device-id>`);let e=XD(),t=await fetch(`${e.origin}/api/devices/${encodeURIComponent(r)}`,{method:`DELETE`,headers:{Authorization:`Bearer ${e.token}`}});if(!t.ok&&t.status!==404)throw new M(`Cloud refused the revoke: HTTP ${t.status}`);return await QD(()=>ZD().call(`trust.remove`,{deviceId:r})),i(`revoked`,[r])}let e=await QD(()=>ZD().call(`trust.list`,{}));return i(`listed`,e.devices.length?e.devices.map(e=>`${e.id} ${e.label}`):[`no trusted devices; pair one from Artideck Cloud on the phone`])}case`remote`:if(n!==`on`&&n!==`off`)throw new M(`usage: adeck daemon remote on|off`);return await QD(()=>ZD().call(`remote.set`,{on:n===`on`})),i(n,[`remote mode ${n}`]);case`sessions`:{let e=await $D();return i(`listed`,e.length?e.map(e=>`${e.taskId} ${e.state.padEnd(7)} ${e.harness.padEnd(6)} ${e.artifact} ${e.projectDir}`):[`no daemon sessions`])}default:{let[e,...t]=GD(h.default.homedir(),await $D(),n,process.env.RYUGI_DAEMON_BIN||void 0);return process.stderr.write(`This is a daemon session: it runs with permission checks bypassed.
|
|
856
|
+
`),i((0,p.spawnSync)(e,t,{stdio:`inherit`}).status===0?`detached`:`failed`,[])}}}function tO({data:e}){return{heading:`Daemon`,status:e.status,summary:``,facts:[],sections:e.lines.length?[{kind:`content`,key:`lines`,text:e.lines.join(`
|
|
857
|
+
`)}]:[]}}const nO={name:`daemon`,summary:`Install and run the daemon that starts agent sessions from your phone`,usage:[`install [--binary <path>]`,`uninstall`,`status`,`trust <code> [--label <name>]`,`devices [revoke <device-id>]`,`remote on|off`,`sessions`,`attach [<task-id>|<type>/<id>]`],details:`install turns on session control: the hub (ryugi-daemon, downloaded for this version and checked against its sha256, or --binary for a local build) then runs agent sessions itself, starts at login as a launchd agent on macOS or an enabled systemd user service on Linux, and turns on linger there so it keeps running after you log out. uninstall turns session control off; the hub keeps running without it. trust confirms the code shown on the phone with Artideck Cloud and adds the device to the daemon. remote off makes the daemon refuse new tasks, resumes and screens. attach opens a daemon session in this terminal.`,positionals:3,options:{binary:{type:`string`,value:`<path>`,help:`Install this ryugi-daemon build instead of downloading one`},label:{type:`string`,value:`<name>`,help:`Name for the trusted device`}},semantic:e=>Q({id:`daemon`,mode:`finite`,output:{formats:[`brief`,`json`,`quiet`],scalar:e=>e.status},async run(){let t=await eO(e);return Y(t,t.status===`failed`?{kind:`failed`,error:{code:`E_DAEMON`,message:`daemon ${t.action} failed`}}:{kind:`succeeded`})},present:tO},e)};function rO(e,t){try{return d.default.realpathSync(e)===d.default.realpathSync(t)}catch{return f.default.resolve(e)===f.default.resolve(t)}}function iO(e,t){let n=JSON.parse(t(`claude`,[`plugin`,`list`,`--json`]));if(!Array.isArray(n))throw Error(`Claude returned an unknown plugin list`);let r=n.find(t=>t.id===e&&t.scope===`user`);return!r||typeof r.installPath!=`string`?null:{path:r.installPath,source:typeof r.readFromFolder==`string`?r.readFromFolder:r.installPath,version:String(r.version||`unknown`)}}function aO(e,t){let n=iO(e,t);if(!n)throw Error(`Native Claude plugin not found: ${e}`);return n}function oO(e,t){if(!e.nativeSource||!e.registration)return`foreign`;let n=iO(e.registration,t);if(!n)return`missing`;if(rO(n.source,e.nativeSource))return`owned`;let[r,i]=e.registration.split(`@`),a=f.default.dirname(n.path);return n.source===n.path&&f.default.basename(a)===r&&f.default.basename(f.default.dirname(a))===i&&rO(a,f.default.dirname(e.nativeSource))?`owned`:`foreign`}function sO(e,t){let n=e.path;if(e.harness===`claude-code`){let n=oO(e,t);if(n===`missing`)throw Error(`Native Claude plugin not found: ${e.registration}`);return n===`owned`}if(e.harness===`codex`){let e=JSON.parse(t(`codex`,[`plugin`,`list`,`--json`]));return Array.isArray(e.installed)&&e.installed.some(e=>e.pluginId===`ryugi@ryugi-managed`&&typeof e.source?.path==`string`&&rO(e.source.path,n))}if(e.harness===`pi`)return t(`pi`,[`list`]).split(/\r?\n/).some(e=>f.default.isAbsolute(e.trim())&&rO(e.trim(),n));if(e.harness===`gemini`){let e=JSON.parse(t(`gemini`,[`extensions`,`list`,`--output-format`,`json`]));return Array.isArray(e)&&e.some(e=>e.name===`ryugi`&&e.installMetadata?.type===`link`&&typeof e.installMetadata.source==`string`&&rO(e.installMetadata.source,n)&&typeof e.path==`string`&&rO(e.path,n))}if(e.harness===`copilot`){let e=JSON.parse(t(`copilot`,[`plugin`,`list`,`--json`]));return Array.isArray(e)&&e.some(e=>e.name===`ryugi`&&e.marketplace===`ryugi-managed`&&typeof e.installedFrom==`string`&&rO(e.installedFrom,f.default.dirname(n)))}if(e.harness===`agy`){let e=JSON.parse(t(`agy`,[`plugin`,`list`,`--json`])),r=JSON.parse(d.default.readFileSync(f.default.join(n,`.antigravity-plugin/plugin.json`),`utf8`)).version;return Array.isArray(e)&&e.some(e=>e.name===`ryugi`&&e.enabled!==!1&&e.version===r)}return!0}function cO(e,t,n){let r=JSON.parse(n(e,[`plugin`,`marketplace`,`list`,`--json`])),i=e===`codex`?r.marketplaces:r;if(!Array.isArray(i))throw Error(`${e} returned an unknown marketplace list`);return i.some(n=>n.name===`ryugi-managed`&&(e===`codex`?typeof n.root==`string`&&rO(n.root,t):typeof n.source==`string`&&rO(n.source.replace(/^Local:\s*/i,``),t)))}function lO(e,t){let n=JSON.parse(t(e,[`plugin`,`marketplace`,`list`,`--json`])),r=e===`codex`?n.marketplaces:n;if(!Array.isArray(r))throw Error(`${e} returned an unknown marketplace list`);return r.some(e=>e.name===`ryugi-managed`)}function uO(e){let t=(0,u.createHash)(`sha256`);function n(r){for(let i of d.default.readdirSync(r).sort()){let a=f.default.join(r,i),o=d.default.lstatSync(a);if(o.isSymbolicLink())throw Error(`Plugin contains an unexpected symlink: ${a}`);t.update(f.default.relative(e,a)),t.update(o.isDirectory()?`\0dir\0`:`\0file\0`),o.isDirectory()?n(a):t.update(d.default.readFileSync(a))}}return n(e),t.digest(`hex`)}function dO(e,t,n){if(d.default.existsSync(t))throw Error(`Candidate already exists: ${t}`);d.default.mkdirSync(t,{recursive:!0});try{for(let n of[`skills`,`hooks`,`lib`,`assets`,`index.js`,`package.json`,`LICENSE`,`GEMINI.md`,`gemini-extension.json`,`.pi`,`.opencode`,`.antigravity-plugin`,`.claude-plugin`,`.codex-plugin`,`.cursor-plugin`]){let r=f.default.join(e,n);d.default.existsSync(r)&&d.default.cpSync(r,f.default.join(t,n),{recursive:!0,filter(t){let n=f.default.relative(e,t).replaceAll(`\\`,`/`);if(/^skills\/artifacts\/app\/(cli\.cjs|server\.cjs|document-engine\.cjs|document-host\.cjs|loro_wasm_bg\.wasm|ryugi-daemon(\.exe)?|viewer|runtime)(\/|$)/.test(n))return!1;if(d.default.lstatSync(t).isSymbolicLink())throw Error(`Plugin source symlink is not supported: ${t}`);return!0}})}for(let e of[`artifacts`,`interface-craft`,...n===`full`?[`using-ryugi`]:[]])if(!d.default.existsSync(f.default.join(t,`skills`,e,`SKILL.md`)))throw Error(`Incomplete Ryugi plugin: missing ${e}`);if(n===`artifacts`){for(let e of d.default.readdirSync(f.default.join(t,`skills`)))[`artifacts`,`interface-craft`].includes(e)||d.default.rmSync(f.default.join(t,`skills`,e),{recursive:!0,force:!0});d.default.writeFileSync(f.default.join(t,`GEMINI.md`),`# Ryugi Artifacts
|
|
858
|
+
Use the artifacts and interface-craft skills when requested.
|
|
859
|
+
`);let e=f.default.join(t,`hooks/session-start`);d.default.existsSync(e)&&(d.default.renameSync(e,`${e}-implementation`),d.default.writeFileSync(e,`#!/usr/bin/env bash
|
|
860
|
+
exec bash "\${0%/*}/session-start-implementation" "$@" > /dev/null
|
|
861
|
+
`,{mode:493}))}let r=f.default.join(t,`package.json`),i=JSON.parse(d.default.readFileSync(r,`utf8`));if(i.name!==`ryugi`||typeof i.version!=`string`)throw Error(`Not a Ryugi plugin package`);delete i.scripts,delete i.devDependencies,delete i[`simple-git-hooks`],delete i[`lint-staged`],d.default.writeFileSync(r,JSON.stringify(i,null,2));let a=uO(t).slice(0,12);for(let e of[`.codex-plugin/plugin.json`,`.cursor-plugin/plugin.json`,`.antigravity-plugin/plugin.json`,`.claude-plugin/plugin.json`,`gemini-extension.json`]){let r=f.default.join(t,e);if(!d.default.existsSync(r))continue;let o=JSON.parse(d.default.readFileSync(r,`utf8`));o.version=`${i.version}-${n}.${a}`,d.default.writeFileSync(r,JSON.stringify(o,null,2))}return{root:t,mode:n,version:i.version,digest:uO(t)}}catch(e){throw d.default.rmSync(t,{recursive:!0,force:!0}),e}}function fO(e,t,n=process.env.RYUGI_PLUGIN_REPO||`https://github.com/Innei/ryugi.git`){let r=f.default.join(e,`downloads`,(0,u.randomUUID)());d.default.mkdirSync(f.default.dirname(r),{recursive:!0});let i=`v${t}`,a=(0,p.spawnSync)(`git`,[`clone`,`--depth`,`1`,`--branch`,i,`--config`,`advice.detachedHead=false`,n,r],{encoding:`utf8`,timeout:12e4});if(a.error||a.status!==0)throw d.default.rmSync(r,{recursive:!0,force:!0}),Error(`Could not download the Ryugi plugin release ${i} that matches this CLI (Git required): ${a.stderr||a.error?.message}`);return r}function pO(e,t,n){let r=/* @__PURE__ */ new Set,i=(n,a=!0)=>{let o=f.default.resolve(e,n),s=f.default.relative(e,o);if(!s||s.startsWith(`..`)||f.default.isAbsolute(s)||!d.default.existsSync(o))throw Error(`Incomplete ${t} plugin: missing or invalid ${n}`);if(r.has(o))return o;if(r.add(o),a&&d.default.statSync(o).isFile()&&/\.(?:[cm]?js|ts)$/.test(o)){let r=d.default.readFileSync(o,`utf8`);for(let a of r.matchAll(/(?:require\(\s*|from\s*)['"](\.{1,2}\/[^'"]+)['"]/g)){let r=f.default.resolve(f.default.dirname(o),a[1]),s=[r,`${r}.cjs`,`${r}.js`,`${r}.json`].find(e=>d.default.existsSync(e)&&d.default.statSync(e).isFile());if(!s)throw Error(`Incomplete ${t} plugin: missing dependency ${a[1]} from ${n}`);i(f.default.relative(e,s))}}return o},a=e=>JSON.parse(d.default.readFileSync(i(e,!1),`utf8`));for(let e of[`artifacts`,`interface-craft`,...n===`full`?[`using-ryugi`,`brainstorming`,`executing-specs`,`systematic-debugging`,`test-driven-development`,`using-git-worktrees`,`verifying`]:[]])i(`skills/${e}/SKILL.md`,!1);if(i(`skills/artifacts/app/ryugi.cjs`),i(`skills/artifacts/app/output-bootstrap.cjs`),t===`pi`){let e=a(`package.json`);if(!Array.isArray(e.pi?.extensions)||!e.pi.extensions.length)throw Error(`Incomplete pi plugin: missing native extension declaration`);for(let t of e.pi.extensions)i(t);i(`.pi/extensions/ryugi.ts`)}if((t===`codex`||t===`agy`)&&i(`skills/artifacts/app/hook-bin.sh`,!1),t===`codex`||t===`cursor`){let e=a(`.${t}-plugin/plugin.json`);if(typeof e.hooks!=`string`)throw Error(`Incomplete ${t} plugin: missing native hooks declaration`);let n=a(e.hooks),r=e=>{if(Array.isArray(e))e.forEach(r);else if(e&&typeof e==`object`)Object.values(e).forEach(r);else if(typeof e==`string`){for(let t of e.matchAll(/\$\{(?:PLUGIN_ROOT|CLAUDE_PLUGIN_ROOT|CURSOR_PLUGIN_ROOT)\}\/([^\s"']+)/g))i(t[1]);e.startsWith(`./hooks/`)&&i(e.split(/\s/)[0])}};r(n),t===`cursor`&&(i(`hooks/run-hook.cmd`,!1),i(`hooks/session-start`,!1))}if(t===`gemini`&&i(a(`gemini-extension.json`).contextFileName||`GEMINI.md`,!1),t===`opencode`&&i(`.opencode/plugins/ryugi.js`),t===`copilot`&&a(`.claude-plugin/plugin.json`),t===`agy`){a(`.antigravity-plugin/plugin.json`),a(`hooks/hooks-antigravity.json`);for(let e of[`run-hook.cmd`,`session-start`,`user-prompt-submit`,`stop`,`agent-event`,`project-root.sh`])i(`hooks/${e}`,!1)}}const mO=[{id:`claude-code`,command:`claude`,label:`Claude Code`,comments:`native monitor`},{id:`codex`,command:`codex`,label:`Codex`,comments:`native hooks; trust them in Codex Settings → Hooks`},{id:`cursor`,command:`cursor`,label:`Cursor`,comments:`read comments on request`},{id:`gemini`,command:`gemini`,label:`Gemini CLI`,comments:`read comments on request`},{id:`opencode`,command:`opencode`,label:`OpenCode`,comments:`read comments on request`},{id:`pi`,command:`pi`,label:`Pi`,comments:`native extension`},{id:`copilot`,command:`copilot`,label:`GitHub Copilot CLI`,comments:`read comments on request`},{id:`agy`,command:`agy`,label:`Antigravity`,comments:`native hooks + LS watch`}],hO=(e,t,n=9e4)=>{if(process.platform===`win32`&&[e,...t].some(e=>/["%\r\n&|<>^]/.test(e)))throw Error(`Unsupported character in Windows native command argument`);let r=process.platform===`win32`?(0,p.spawnSync)([e,...t].map(e=>`"${e}"`).join(` `),{shell:!0,encoding:`utf8`,timeout:n,stdio:[`ignore`,`pipe`,`pipe`]}):(0,p.spawnSync)(e,t,{encoding:`utf8`,timeout:n,stdio:[`ignore`,`pipe`,`pipe`]});if(r.error||r.status!==0)throw Error(`${e} ${t.join(` `)} failed: ${(r.stderr||r.stdout||r.error?.message||``).trim()}`);return r.stdout};function gO(e=h.default.homedir(),t=hO){return mO.map(n=>{let r=!1;try{t(n.command,[`--version`],2e3),r=!0}catch{}return n.id===`cursor`&&d.default.existsSync(f.default.join(e,`.cursor`))&&(r=!0),{...n,detected:r,reason:r?null:`${n.command} not found on PATH`}})}const _O=e=>{try{return d.default.lstatSync(e),!0}catch{return!1}};function vO(e,t){return e===`cursor`?f.default.join(t.home||h.default.homedir(),`.cursor/plugins/local/ryugi`):f.default.join(t.root,`plugins`,e,`plugin`)}function yO(e,t){if(f.default.resolve(e.path)!==f.default.resolve(t))throw Error(`Installation path no longer matches owned ${e.harness} path`);if(!d.default.existsSync(e.path)||uO(e.path)!==e.digest)throw Error(`Installed ${e.harness} files changed; preserving user edits at ${e.path}`)}function bO(e,t,n){pO(t.root,e,t.mode);let r=vO(e,n),i=n.previous,a=n.run||hO,o=n.env||process.env,s=n.home||h.default.homedir();if(_O(r)){if(!i)throw Error(`Plugin already exists and is not owned by this installer: ${r}`);yO(i,r)}else if(i)throw Error(`Owned plugin is missing at ${r}; run doctor before reinstalling`);if(!i&&[`codex`,`gemini`,`pi`,`copilot`,`agy`].includes(e)){let t=e===`codex`?[`plugin`,`list`,`--json`]:e===`gemini`?[`extensions`,`list`]:e===`pi`?[`list`]:e===`agy`?[`plugin`,`list`,`--json`]:[`plugin`,`list`];if(/\bryugi\b/i.test(a(mO.find(t=>t.id===e).command,t)))throw Error(`An existing Ryugi ${e} install is managed elsewhere. Remove it with that harness before installing here.`)}if(i&&!sO(i,a))throw Error(`Native ${e} source changed or is no longer registered; preserving it`);if(!i&&(e===`codex`||e===`copilot`)&&lO(e,a))throw Error(`Native ${e} marketplace ryugi-managed is owned elsewhere`);let c=f.default.dirname(r);d.default.mkdirSync(c,{recursive:!0});let l=f.default.join(c,`.candidate-${(0,u.randomUUID)()}`),p=f.default.join(c,`.previous-${(0,u.randomUUID)()}`);d.default.cpSync(t.root,l,{recursive:!0});let m=i?.registration,g=!1,_=!1,y=(e,t,r,i)=>{let o=n.effects?.begin(e,i),s=a(t,r);return o!==void 0&&n.effects.confirm(o),s};try{if(_O(r)&&(d.default.renameSync(r,p),g=!0),d.default.renameSync(l,r),e===`copilot`){d.default.mkdirSync(f.default.join(r,`hooks`),{recursive:!0});let e=f.default.join(r,`hooks/managed-bootstrap.cjs`);d.default.writeFileSync(e,`const fs = require('node:fs');
|
|
862
|
+
const path = require('node:path');
|
|
863
|
+
const skill = path.join(__dirname, '../skills/using-ryugi/SKILL.md');
|
|
864
|
+
console.log(JSON.stringify(fs.existsSync(skill) ? { additionalContext: fs.readFileSync(skill, 'utf8') } : {}));
|
|
865
|
+
`),d.default.writeFileSync(f.default.join(r,`hooks/hooks.json`),JSON.stringify({version:1,hooks:{sessionStart:[{type:`command`,exec:`node`,args:[e]}]}}))}if(e===`codex`||e===`copilot`){let t=f.default.dirname(r),n=e===`codex`?`.agents/plugins/marketplace.json`:`.claude-plugin/marketplace.json`,a=f.default.join(t,n);d.default.mkdirSync(f.default.dirname(a),{recursive:!0}),d.default.writeFileSync(a,JSON.stringify({name:`ryugi-managed`,owner:{name:`Innei`},plugins:[{name:`ryugi`,source:e===`codex`?{source:`local`,path:`./plugin`}:`./plugin`,policy:{installation:`AVAILABLE`,authentication:`ON_INSTALL`}}]})),i||(y(`install.native-marketplace`,e,[`plugin`,`marketplace`,`add`,t],t),_=!0),y(`install.native-plugin`,e,[`plugin`,e===`codex`?`add`:`install`,`ryugi@ryugi-managed`],`ryugi@ryugi-managed`),m=`ryugi@ryugi-managed`}else if(e===`pi`)i||y(`install.native-package`,`pi`,[`install`,r],r),m=r;else if(e===`gemini`)i||y(`install.native-extension`,`gemini`,[`extensions`,`link`,r,`--consent`],r),m=`ryugi`;else if(e===`agy`){d.default.copyFileSync(f.default.join(r,`hooks/hooks-antigravity.json`),f.default.join(r,`hooks.json`)),t.mode===`artifacts`&&_O(f.default.join(r,`hooks/session-start-implementation`))&&d.default.writeFileSync(f.default.join(r,`hooks/session-start`),`#!/usr/bin/env bash
|
|
866
|
+
bash "\${0%/*}/session-start-implementation" "$@" > /dev/null
|
|
867
|
+
printf "{}\\n"
|
|
868
|
+
`,{mode:493});for(let e of[`hooks/hooks.json`,`hooks/hooks-cursor.json`,`hooks/hooks-antigravity.json`,`GEMINI.md`,`gemini-extension.json`,`AGENTS.md`])d.default.rmSync(f.default.join(r,e),{recursive:!0,force:!0});y(`install.native-plugin`,`agy`,[`plugin`,`install`,r],r),m=`ryugi`}else if(e===`opencode`){let e=f.default.join(o.XDG_CONFIG_HOME||f.default.join(s,`.config`),`opencode/plugins/ryugi.js`),t=`export { default, RyugiPlugin } from ${JSON.stringify((0,v.pathToFileURL)(f.default.join(r,`.opencode/plugins/ryugi.js`)).href)};\n`;if(_O(e)&&(!i||d.default.readFileSync(e,`utf8`)!==t))throw Error(`OpenCode plugin entry is not owned: ${e}`);d.default.mkdirSync(f.default.dirname(e),{recursive:!0}),d.default.writeFileSync(e,t),m=e}let n={harness:e,mode:t.mode,path:r,digest:uO(r),version:t.version,registration:m};if(!sO(n,a))throw Error(`Native ${e} did not recognize the installed source`);return n}catch(t){if(_&&(e===`codex`||e===`copilot`))try{if(!cO(e,c,a))throw Error(`Marketplace source no longer matches`,{cause:t});y(`install.native-marketplace-remove`,e,[`plugin`,`marketplace`,`remove`,`ryugi-managed`],c)}catch(e){throw Error(`${t.message}; marketplace registration remains and its candidate is retained at ${r}: ${e.message}`,{cause:e})}throw d.default.rmSync(r,{recursive:!0,force:!0}),g&&d.default.renameSync(p,r),t}finally{d.default.rmSync(l,{recursive:!0,force:!0}),_O(r)&&d.default.rmSync(p,{recursive:!0,force:!0})}}const xO=`artideck`,SO=`ryugi-artifacts`,CO=[xO,SO],wO=[`npm`,`pnpm`,`yarn`,`bun`],TO=[[`npx`,[`/_npx/`]],[`pnpm dlx`,[`/pnpm/dlx/`,`/.pnpm-store/dlx/`]],[`bunx`,[`/bunx-`,`/.bun/install/cache/`]]],EO=[[`pnpm`,[`/pnpm/global/`]],[`yarn`,[`/yarn/global/`]],[`bun`,[`/.bun/install/global/`]],[`npm`,CO.flatMap(e=>[`/lib/node_modules/${e}/`,`/npm/node_modules/${e}/`])]];function DO(e){let t=e.replaceAll(`\\`,`/`).toLowerCase();return t.includes(`/node_modules/ryugi-artifacts/`)||t.includes(`/ryugi-artifacts@`)?SO:xO}function OO(e,t){if(t.RYUGI_MANAGED_RUNTIME===`1`&&t.RYUGI_INSTALL_ROOT){let n=f.default.relative(f.default.join(t.RYUGI_INSTALL_ROOT,`versions`),e);if(n&&!n.startsWith(`..`)&&!f.default.isAbsolute(n))return{kind:`managed`}}if(t.RYUGI_ARTIFACTS_COMMAND)return{kind:`launcher`};let n=e;try{n=d.default.realpathSync(e)}catch{}let r=n.replaceAll(`\\`,`/`).toLowerCase(),i=e=>e.some(e=>r.includes(e));for(let[e,t]of TO)if(i(t))return{kind:`transient`,runner:e};for(let[e,t]of EO)if(i(t))return{kind:`global`,pm:e};return r.includes(`/node_modules/`)?{kind:`unknown`}:{kind:`local`}}const kO=(e=process.env)=>e.RYUGI_INSTALL_ROOT||f.default.join(e.XDG_DATA_HOME||f.default.join(h.default.homedir(),`.local/share`),`ryugi`,`install`),AO=(e=process.env)=>e.RYUGI_BIN_DIR||f.default.join(h.default.homedir(),`.local/bin`);function jO(e,t){d.default.mkdirSync(f.default.dirname(e),{recursive:!0});let n=`${e}.${(0,u.randomUUID)()}.tmp`;try{d.default.writeFileSync(n,`${JSON.stringify(t,null,2)}\n`,{flag:`wx`}),d.default.renameSync(n,e)}finally{d.default.rmSync(n,{force:!0})}}const MO=[`bin/ryugi.cjs`,`dist/cli.cjs`,`dist/document-engine.cjs`,`dist/loro_wasm_bg.wasm`,`dist/output-bootstrap.cjs`,`dist/viewer/index.html`,`dist/runtime/ryugi-ui.js`,`dist/runtime/ryugi-icons.js`,`dist/runtime/ryugi-mockup.js`],NO=e=>(0,u.createHash)(`sha256`).update(e).digest(`hex`);function PO(e){let t=(0,u.createHash)(`sha256`);function n(r){let i=f.default.join(e,r);if(t.update(r).update(`\0`),d.default.statSync(i).isDirectory())for(let e of d.default.readdirSync(i).sort())n(f.default.join(r,e));else t.update(d.default.readFileSync(i))}for(let e of[`bin`,`dist`,`package.json`])n(e);return t.digest(`hex`)}var FO=class{root;binDir;constructor(e=kO(),t=AO()){this.root=f.default.resolve(e),this.binDir=f.default.resolve(t)}get launcher(){return f.default.join(this.root,`launcher.cjs`)}get bin(){return f.default.join(this.binDir,process.platform===`win32`?`ryugi.cmd`:`ryugi`)}get aliasBin(){return f.default.join(this.binDir,process.platform===`win32`?`adeck.cmd`:`adeck`)}launcherSource(){return`#!/usr/bin/env node
|
|
869
|
+
// Ryugi managed runtime launcher v1
|
|
870
|
+
const fs = require('node:fs');
|
|
871
|
+
const path = require('node:path');
|
|
872
|
+
const [major, minor] = process.versions.node.split('.').map(Number);
|
|
873
|
+
if (major < 20 || (major === 20 && minor < 12)) throw Error('Ryugi requires Node.js 20.12 or newer. Upgrade Node and retry.');
|
|
874
|
+
const root = __dirname;
|
|
875
|
+
const current = JSON.parse(fs.readFileSync(path.join(root, 'current.json'), 'utf8'));
|
|
876
|
+
const relative = path.relative(fs.realpathSync(path.join(root, 'versions')), fs.realpathSync(current.packageRoot));
|
|
877
|
+
if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) throw Error('Invalid Ryugi runtime record');
|
|
878
|
+
process.env.RYUGI_INSTALL_ROOT = root;
|
|
879
|
+
process.env.RYUGI_MANAGED_RUNTIME = '1';
|
|
880
|
+
require(path.join(current.packageRoot, 'dist/cli.cjs'));
|
|
881
|
+
`}shimSource(){return`@echo off\r\nnode "${this.launcher}" %*\r\n`}owns(e){try{return process.platform===`win32`?d.default.readFileSync(e,`utf8`)===this.shimSource():d.default.lstatSync(e).isSymbolicLink()&&d.default.realpathSync(e)===d.default.realpathSync(this.launcher)}catch{return!1}}ownsBin(){return this.owns(this.bin)}ownsAlias(){return this.owns(this.aliasBin)}linkAlias(){if(!this.ownsAlias())try{process.platform===`win32`?d.default.writeFileSync(this.aliasBin,this.shimSource(),{flag:`wx`}):d.default.symlinkSync(this.launcher,this.aliasBin)}catch{}}preflight(){let e=!1;try{d.default.lstatSync(this.bin),e=!0}catch(e){if(e.code!==`ENOENT`)throw e}if(e&&!this.ownsBin())throw Error(`Command already exists at ${this.bin}; choose --bin-dir or keep its original package manager.`);if(d.default.existsSync(this.launcher)){let e=d.default.readFileSync(this.launcher,`utf8`);if(e!==this.launcherSource()&&NO(e)!==this.current()?.launcherDigest)throw Error(`Foreign launcher already exists at ${this.launcher}`)}}current(){let e=f.default.join(this.root,`current.json`);if(!d.default.existsSync(e))return null;let t=JSON.parse(d.default.readFileSync(e,`utf8`)),n=f.default.relative(d.default.realpathSync(f.default.join(this.root,`versions`)),d.default.realpathSync(t.packageRoot));if(!n||n.startsWith(`..`)||f.default.isAbsolute(n))throw Error(`Invalid runtime state at ${e}`);return t}install(e){this.preflight();let t=JSON.parse(d.default.readFileSync(f.default.join(e,`package.json`),`utf8`));if(!CO.includes(t.name)||!/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(t.version))throw Error(`Invalid Ryugi runtime package`);for(let t of MO)if(!d.default.existsSync(f.default.join(e,t)))throw Error(`Incomplete Ryugi runtime: missing ${t}. Build or reinstall the complete package.`);let n=PO(e),r=this.current();if(r&&r.version===t.version&&r.digest===n&&this.ownsBin())try{if(PO(r.packageRoot)===n)return this.linkAlias(),r}catch{}let i=f.default.join(this.root,`versions`,`${t.version}-${(0,u.randomUUID)()}`);d.default.mkdirSync(i,{recursive:!0});try{for(let t of[`package.json`,`bin`,`dist`])d.default.cpSync(f.default.join(e,t),f.default.join(i,t),{recursive:!0,dereference:!0});let r=(0,p.spawnSync)(process.execPath,[f.default.join(i,`dist/cli.cjs`),`--version`,`--format`,`brief`],{encoding:`utf8`,timeout:15e3,env:{...process.env,RYUGI_NO_UPDATE_CHECK:`1`}});if(r.error||r.status!==0||![t.version,`ryugi ${t.version}`].includes(r.stdout.trim()))throw Error(`Runtime validation failed: ${r.stderr||r.error?.message||`version mismatch`}`);d.default.writeFileSync(this.launcher,this.launcherSource(),{mode:493}),d.default.mkdirSync(this.binDir,{recursive:!0}),this.ownsBin()||(process.platform===`win32`?d.default.writeFileSync(this.bin,this.shimSource(),{flag:`wx`}):d.default.symlinkSync(this.launcher,this.bin)),this.linkAlias();let a={version:t.version,digest:n,launcherDigest:NO(this.launcherSource()),packageRoot:i,launcher:this.launcher,bin:this.bin};return jO(f.default.join(this.root,`current.json`),a),a}catch(e){throw d.default.rmSync(i,{recursive:!0,force:!0}),e}}};function IO(e,t=process.env){return(t.PATH||``).split(f.default.delimiter).some(t=>f.default.resolve(t)===f.default.resolve(e))?null:(t.SHELL||``).endsWith(`/fish`)?`Run: fish_add_path ${JSON.stringify(e)}`:process.platform===`win32`?`Add ${e} to your user PATH, then open a new terminal.`:`Add to your shell profile: export PATH=${JSON.stringify(e)}:"$PATH"`}const LO=e=>e===`antigravity`?`agy`:e;function RO(e){let t=f.default.join(e,`installation.json`);if(!d.default.existsSync(t))return{schema:1,harnesses:{}};let n=JSON.parse(d.default.readFileSync(t,`utf8`));if(n.schema!==1||!n.harnesses||typeof n.harnesses!=`object`)throw Error(`Unsupported installation state: ${t}`);return n}function zO(e,t){jO(f.default.join(e,`installation.json`),t)}function BO(e,t,n={}){let r=RO(e),i=[];for(let a of Object.values(r.harnesses)){if(!a||a.harness===`claude-code`)continue;let o=f.default.join(e,`candidates`,(0,u.randomUUID)());try{let s=dO(t,o,a.mode);if(s.digest===(a.sealed??a.digest)){i.push({harness:a.harness,status:`current`});continue}let c=bO(a.harness,s,{...n,root:e,previous:a});r.harnesses[a.harness]={...c,sealed:s.digest},zO(e,r),i.push({harness:a.harness,status:`refreshed`})}catch(e){i.push({harness:a.harness,status:`failed`,error:e.message})}finally{d.default.rmSync(o,{recursive:!0,force:!0})}}return i}const VO=e=>[`cli.cjs`,`document-engine.cjs`,`loro_wasm_bg.wasm`,e===`win32`?`ryugi-daemon.exe`:`ryugi-daemon`,`output-bootstrap.cjs`],HO=[`viewer`,`runtime`],UO=e=>f.default.join(e,`.ryugi`,`dev.json`),WO=e=>f.default.join(e,`.ryugi`,`dev`,`builds`),GO=e=>f.default.join(e,`.ryugi`,`dev`,`bin`,`ryugi-daemon`);function KO(e,t=UO(e)){try{let e=JSON.parse(d.default.readFileSync(t,`utf8`)),n=[`build`,`plugin`,`version`,`linkedAt`];return n.every(t=>typeof e?.[t]==`string`)?Object.fromEntries(n.map(t=>[t,e[t]])):null}catch{return null}}function qO(e,t){let n=[...VO(t),...HO].filter(t=>!d.default.existsSync(f.default.join(e,t)));if(n.length)throw Error(`${e} is not a complete build: it has no ${n.join(`, `)}`);let r=[...VO(t)];for(let t of HO)for(let n of d.default.readdirSync(f.default.join(e,t),{recursive:!0}).map(String))d.default.statSync(f.default.join(e,t,n)).isFile()&&r.push(f.default.join(t,n));return r.sort()}function JO(e,t){let n=(0,u.createHash)(`sha256`);for(let r of t)n.update(`${r.split(f.default.sep).join(`/`)}\0`),n.update(d.default.readFileSync(f.default.join(e,r)));return n.digest(`hex`).slice(0,12)}function YO(e,t,n){if(d.default.existsSync(n)){let e=/* @__PURE__ */ new Date;d.default.utimesSync(n,e,e);return}let r=f.default.join(f.default.dirname(n),`.staging-${(0,u.randomUUID)()}`);try{for(let n of t)d.default.mkdirSync(f.default.dirname(f.default.join(r,n)),{recursive:!0}),d.default.copyFileSync(f.default.join(e,n),f.default.join(r,n)),d.default.chmodSync(f.default.join(r,n),d.default.statSync(f.default.join(e,n)).mode);d.default.renameSync(r,n)}catch(e){if(d.default.rmSync(r,{recursive:!0,force:!0}),!d.default.existsSync(n))throw e}}function XO(e,t,n){let r=GO(t),i=d.default.readFileSync(e),a=(0,u.createHash)(`sha256`).update(i).digest(`hex`),o=`${r}.source`;if(d.default.existsSync(r)&&d.default.existsSync(o)&&d.default.readFileSync(o,`utf8`).trim()===a)return r;d.default.mkdirSync(f.default.dirname(r),{recursive:!0});let s=`${r}.${(0,u.randomUUID)()}`;try{d.default.writeFileSync(s,i),d.default.chmodSync(s,493),n?.(s),d.default.renameSync(s,r)}catch(e){throw d.default.rmSync(s,{force:!0}),e}return d.default.writeFileSync(o,`${a}\n`),r}function ZO(e){try{return d.default.readlinkSync(e)}catch{return null}}function QO(e,t){let n=f.default.join(e,`ryugi-daemon`);if(ZO(n)===t)return;let r=`${n}.${(0,u.randomUUID)()}`;d.default.symlinkSync(t,r),d.default.renameSync(r,n)}function $O(e){try{let t=JSON.parse(d.default.readFileSync(f.default.join(e,`launch.json`),`utf8`))?.env?.RYUGI_DOCUMENT_ENGINE;return typeof t==`string`?f.default.basename(f.default.dirname(t)):null}catch{return null}}function ek(e,t){let n=WO(e),r=d.default.readdirSync(n).filter(e=>!e.startsWith(`.`)).map(e=>({name:e,at:d.default.statSync(f.default.join(n,e)).mtimeMs})).sort((e,t)=>t.at-e.at),i=/* @__PURE__ */ new Set([...t,...r.slice(0,3).map(e=>e.name)]);for(let{name:e}of r)i.has(e)||d.default.rmSync(f.default.join(n,e),{recursive:!0,force:!0})}function tk(e,t){let n=UO(e);d.default.mkdirSync(f.default.dirname(n),{recursive:!0,mode:448});let r=`${n}.${process.pid}.${(0,u.randomUUID)()}`;d.default.writeFileSync(r,`${JSON.stringify(t,null,2)}\n`),d.default.renameSync(r,n)}function nk(e){let t=f.default.resolve(e.source),n=qO(t,e.platform),r=JO(t,n);d.default.mkdirSync(WO(e.home),{recursive:!0});let i=f.default.join(WO(e.home),r);YO(t,n,i),e.platform===`darwin`&&QO(i,XO(f.default.join(t,`ryugi-daemon`),e.home,e.sign));let a={build:i,plugin:f.default.resolve(e.plugin),version:`local-${r}`,linkedAt:(/* @__PURE__ */ new Date()).toISOString()};return tk(e.home,a),ek(e.home,[r,$O(e.serverHome),$O(f.default.join(e.home,`.ryugi`,`server`))]),a}function rk(e){try{return d.default.unlinkSync(UO(e)),!0}catch{return!1}}function ik(){let e=(0,p.spawnSync)(`security`,[`find-identity`,`-v`,`-p`,`codesigning`],{encoding:`utf8`});return/"(Developer ID Application: [^"]+)"/.exec(e.stdout??``)?.[1]}function ak(e,t){if(t!==`darwin`)return;let n=e.RYUGI_DEV_SIGN_IDENTITY??ik();if(n)return e=>{let t=(0,p.spawnSync)(`codesign`,[`--force`,`--sign`,n,`--identifier`,`dev.ryugi.daemon`,`--timestamp=none`,e],{encoding:`utf8`});if(t.status!==0)throw Error(`codesign could not sign the daemon with "${n}": ${(t.stderr||t.error?.message||``).trim()}. Set RYUGI_DEV_SIGN_IDENTITY to another identity, or to an empty value to link it unsigned.`)}}function ok(e){let t=h.default.homedir(),n=e.values.plugin??KO(t)?.plugin??void 0;if(!n)throw new M(`name the Ryugi plugin checkout: adeck dev link --plugin <dir>`);if(!d.default.existsSync(f.default.join(n,`skills/artifacts/app/ryugi.cjs`)))throw new M(`${n} is not a Ryugi plugin checkout: it has no skills/artifacts/app/ryugi.cjs`);try{return nk({source:e.positionals[1]??__dirname,plugin:n,home:t,platform:process.platform,serverHome:He().home,sign:ak(process.env,process.platform)})}catch(e){throw new M(e.message)}}function sk(e){let t=e.positionals[0]??`status`;if(t===`link`){let n=ok(e);return{action:t,status:`linked`,link:n,refreshed:BO(kO(),n.plugin,{run:hO})}}if(t===`unlink`)return{action:t,status:rk(h.default.homedir())?`unlinked`:`none`,link:null,refreshed:[]};if(t===`status`){let e=KO(h.default.homedir());return{action:t,status:e?`linked`:`none`,link:e,refreshed:[]}}throw new M(`usage: adeck dev link|unlink|status`)}function ck({data:e}){return{heading:`Dev link`,status:e.status,summary:e.link?e.link.version:`every agent runs its own CLI or an npm release`,facts:[],sections:e.link?[{kind:`content`,key:`link`,text:[`build ${e.link.build}`,`plugin ${e.link.plugin}`,...e.refreshed.map(e=>`copy ${e.harness} ${e.status}${e.error?`: ${e.error}`:``}`)].join(`
|
|
882
|
+
`)}]:[]}}const lk={name:`dev`,summary:`Point every agent on this machine at a local development build`,usage:[`link [<build dir>] [--plugin <checkout>]`,`unlink`,`status`],details:`link freezes a complete build (the directory of this CLI by default) under ~/.ryugi/dev/builds/<fingerprint> and records it in ~/.ryugi/dev.json with the plugin checkout; every Ryugi launcher then runs that CLI and hub, and the plugin checkout's ryugi-hook build. unlink removes the record; launchers go back to their own CLI or npm releases.`,positionals:2,options:{plugin:{type:`string`,value:`<checkout>`,help:`Ryugi plugin checkout to link`}},semantic:e=>Q({id:`dev`,mode:`finite`,output:{formats:[`brief`,`json`,`quiet`],scalar:e=>e.status},run:()=>Y(sk(e)),present:ck},e)},uk=[`/opt/homebrew/bin`,`/usr/local/bin`],dk=process.platform===`win32`?[`agent-browser.cmd`,`agent-browser.exe`]:[`agent-browser`],fk=e=>{try{return d.default.accessSync(e,d.default.constants.X_OK),d.default.statSync(e).isFile()}catch{return!1}},pk=e=>{let t=f.default.join(e,`.nvm`,`versions`,`node`);try{return d.default.readdirSync(t).sort().reverse().map(e=>f.default.join(t,e,`bin`))}catch{return[]}};function mk(e,t,n,r){return[...(e.PATH??``).split(f.default.delimiter),r,e.PNPM_HOME??``,f.default.join(t,`Library`,`pnpm`,`bin`),f.default.join(t,`.local`,`share`,`pnpm`),f.default.join(t,`.local`,`bin`),f.default.join(t,`.bun`,`bin`),f.default.join(t,`.npm-global`,`bin`),f.default.join(t,`.volta`,`bin`),f.default.join(t,`.asdf`,`shims`),f.default.join(t,`.local`,`share`,`mise`,`shims`),...pk(t),...n].filter(Boolean)}function hk({env:e=process.env,home:t=h.default.homedir(),extraDirs:n=uk,nodeDir:r=f.default.dirname(process.execPath)}={}){let i=e.RYUGI_AGENT_BROWSER;if(i)return fk(i)?i:null;for(let i of mk(e,t,n,r))for(let e of dk){let t=f.default.join(i,e);if(fk(t))return t}return null}const gk=(e=process.env)=>({...e,PATH:[f.default.dirname(process.execPath),e.PATH??``].filter(Boolean).join(f.default.delimiter)});function _k(e){let t=(0,p.spawnSync)(e,[`--version`],{encoding:`utf8`,timeout:5e3,env:gk()});return/(\d+\.\d+\.\d+\S*)/.exec(t.stdout??``)?.[1]??null}const vk=e=>{let t=Buffer.alloc(8);return t.writeBigUInt64LE(BigInt(e)),t};function yk(e){let t=(0,u.createHash)(`sha256`).update(`codex-plugin-bundle-v1`),n=[e];for(;n.length;){let r=n.pop(),i=f.default.relative(e,r),a=i?f.default.basename(i):``;if(a&&(a===`__pycache__`||a===`.venv`||a.endsWith(`.pyc`)||a.endsWith(`.egg-info`)))continue;let o=Buffer.from(i);t.update(vk(o.length)).update(o);let s=d.default.lstatSync(r);if(s.isDirectory()){t.update(`directory`);let e=d.default.readdirSync(r).sort((e,t)=>Buffer.compare(Buffer.from(e),Buffer.from(t)));for(let t=e.length-1;t>=0;t--)n.push(f.default.join(r,e[t]))}else if(s.isFile())t.update(`file`).update(vk(s.size)).update(d.default.readFileSync(r));else throw Error(`Unsupported Codex plugin entry: ${r}`)}return`sha256:${t.digest(`hex`)}`}const bk=e=>e.replaceAll(/(?<=[a-z\d])([A-Z])/g,`_$1`).toLowerCase();function xk(e,t){let n=JSON.parse(d.default.readFileSync(f.default.join(e,`.codex-plugin/plugin.json`),`utf8`));if(typeof n.hooks!=`string`)return[];let r=f.default.posix.normalize(n.hooks.replaceAll(`\\`,`/`)),i=JSON.parse(d.default.readFileSync(f.default.join(e,r),`utf8`)).hooks??{},a=[];for(let[e,n]of Object.entries(i))n.forEach((n,i)=>(n.hooks??[]).forEach((n,o)=>a.push(`${t}:${r}:${bk(e)}:${i}:${o}`)));return a}function Sk(e){let t=/* @__PURE__ */ new Map,n;for(let r of e.split(/\r?\n/)){let e=r.match(/^\s*\[\s*hooks\.state\."((?:[^"\\]|\\.)*)"\s*\]\s*$/);if(e){n={},t.set(JSON.parse(`"${e[1]}"`),n);continue}if(/^\s*\[/.test(r)){n=void 0;continue}let i=r.match(/^\s*([\w-]+)\s*=\s*(.+?)\s*$/);n&&i&&(n[i[1]]=i[2].replace(/^"(.*)"$/,`$1`))}return t}function Ck(e,t,n,r=h.default.homedir()){let i=xk(e,t),a=f.default.join(n.CODEX_HOME||f.default.join(r,`.codex`),`config.toml`),o=Sk(d.default.existsSync(a)?d.default.readFileSync(a,`utf8`):``),s=yk(e),c=i.filter(e=>{let t=o.get(e);return t?.trusted_content_hash!==s||t.enabled===`false`});return{declared:i.length,blocked:c.length}}const wk=12096e5,Tk=e=>f.default.join(ct(e),`plugins.json`);function Ek(e,t){d.default.mkdirSync(ct(e),{recursive:!0,mode:448});let n=`${Tk(e)}.${process.pid}.tmp`;d.default.writeFileSync(n,JSON.stringify(t)),d.default.renameSync(n,Tk(e))}function Dk(e){try{let t=JSON.parse(d.default.readFileSync(Tk(e),`utf8`));return Array.isArray(t?.plugins)?{complete:t.complete===!0,plugins:t.plugins.filter(e=>typeof e?.version==`string`&&at(e.version))}:null}catch{return null}}const Ok=e=>{try{return d.default.statSync(e).mtimeMs}catch{return null}};function kk(e){let t=ct(e.home),n=[],r=[];try{r=d.default.readdirSync(t)}catch{}for(let i of r){if(!at(i)||e.keep.has(i))continue;let r=f.default.join(t,i),a=Ok(f.default.join(r,`last-used`)),o=Ok(r),s=Ok(f.default.join(r,`.lock`)),c=(t,n)=>t!==null&&e.now-t<n;c(a,wk)||a===null&&c(o,wk)||c(s,3e5)||(d.default.rmSync(r,{recursive:!0,force:!0}),n.push(i))}let i=f.default.join(t,`.legacy-removed`);if(!e.legacyInUse&&!d.default.existsSync(i)){let n=e.env.XDG_CACHE_HOME||f.default.join(e.home,`.cache`);d.default.rmSync(f.default.join(n,`ryugi`,`hook`),{recursive:!0,force:!0}),d.default.mkdirSync(t,{recursive:!0,mode:448}),d.default.writeFileSync(i,``)}return n}async function Ak(e){if(f.default.resolve(e.serverHome)!==f.default.join(e.home,`.ryugi`,`server`))return{status:`other-hub`};let t=e.now??Date.now(),n=e.installed??Dk(e.home),r=n?.plugins??[],i=/* @__PURE__ */ new Set([e.version,...r.filter(e=>!e.legacy).map(e=>e.version)]),a=[],o=[],{progress:s}=e,c=await Promise.all([...i].map(n=>mt({...e,version:n,now:t,onProgress:s&&((e,t)=>s(n,e,t))})));return[...i].forEach((e,t)=>{let n=c[t];n.status===`installed`&&a.push(e),(n.status===`failed`||n.status===`skipped`&&n.error)&&o.push({version:e,error:n.error??`failed`})}),{status:`done`,prefetched:a,failed:o,removed:e.cleanup?kk({env:e.env,home:e.home,keep:i,legacyInUse:!n?.complete||r.some(e=>e.legacy),now:t}):[]}}const jk=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Mk=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Nk=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,Pk=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Fk=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Ik=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Lk=/\t{1,1000}/y,Rk=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,zk=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Bk=/\p{M}+/gu,Vk={limit:1/0,ellipsis:``},Hk=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Hk(i,Vk,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[zk,l],[Pk,0],[Fk,o],[Lk,s],[Rk,c],[Ik,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Bk,``)){let t=e.codePointAt(0)||0;if(S=Mk(t)?2:Nk(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Ik?jk(e.slice(p,n.lastIndex)):n===Rk?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Uk={limit:1/0,ellipsis:``,ellipsisWidth:0},Wk=(e,t={})=>Hk(e,Uk,t).width,Gk=`]8;;`,Kk=RegExp(`(?:\\[(?<code>\\d+)m|\\${Gk}(?<uri>.*))`,`y`),qk=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Jk=e=>`[${e}m`,Yk=e=>`${Gk}${e}`,Xk=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:Wk(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=Wk(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Gk,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Zk=e=>{let t=e.split(` `),n=t.length;for(;n&&!Wk(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Qk=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=Wk(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=Wk(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Xk(s,r,t),c=Wk(s.at(-1)??``)}else{if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Xk(s,r,t),c=Wk(s.at(-1)??``);continue}s.push(``),c=0}c+i>t&&n.wordWrap===!1?(Xk(s,r,t),c=Wk(s.at(-1)??``)):(s[s.length-1]+=r,c+=i)}}n.trim!==!1&&(s=s.map(e=>Zk(e)));let l=s.join(`
|
|
883
|
+
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){Kk.lastIndex=e+1;let t=Kk.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
884
|
+
`){a&&(r+=Yk(``));let e=i?qk(i):void 0;i&&e&&(r+=Jk(e))}else t===`
|
|
885
|
+
`&&(i&&qk(i)&&(r+=Jk(i)),a&&(r+=Yk(a)))}return r},$k=/\r?\n/;function eA(e,t,n){return String(e).normalize().split($k).map(e=>Qk(e,t,n)).join(`
|
|
886
|
+
`)}const tA={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`},nA={screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let n=0;n<e;n++)t+=this.line+(n<e-1?tA.up():``);return e&&(t+=tA.left),t}};function rA(e,t,n){if(!n.some(e=>!e.disabled))return e;let r=e+t,i=Math.max(n.length-1,0),a=r<0?i:r>i?0:r;return n[a]?.disabled?rA(a,t<0?-1:1,n):a}const iA={actions:/* @__PURE__ */ new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:/* @__PURE__ */ new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]]),messages:{cancel:`Canceled`,error:`Something went wrong`},withGuide:!0,accessible:void 0,date:{monthNames:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],messages:{required:`Please enter a valid date`,invalidMonth:`There are only 12 months in a year`,invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function aA(e){if(e!==void 0)return e;if(iA.accessible!==void 0)return iA.accessible;let t=process.env.ACCESSIBLE;return t!==void 0&&t!==``&&t!==`0`&&t!==`false`}function oA(e,t){if(typeof e==`string`)return iA.aliases.get(e)===t;for(let n of e)if(n!==void 0&&oA(n,t))return!0;return!1}function sA(e,t){if(e===t)return;let n=e.split(`
|
|
887
|
+
`),r=t.split(`
|
|
888
|
+
`),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}const cA=globalThis.process.platform.startsWith(`win`),lA=Symbol(`clack:cancel`);function uA(e){return e===lA}function dA(e,t){let n=e;n.isTTY&&n.setRawMode(t)}function fA({input:e=y.stdin,output:t=y.stdout,overwrite:n=!0,hideCursor:r=!0}={}){let i=m.createInterface({input:e,output:t,prompt:``,tabSize:1});m.emitKeypressEvents(e,i),e instanceof b.ReadStream&&e.isTTY&&e.setRawMode(!0);let a=(i,{name:o,sequence:s})=>{if(oA([String(i),o,s],`cancel`)){r&&t.write(tA.show),process.exit(0);return}if(!n)return;let c=o===`return`?0:-1,l=o===`return`?-1:0;m.moveCursor(t,c,l,()=>{m.clearLine(t,1,()=>{e.once(`keypress`,a)})})};return r&&t.write(tA.hide),e.once(`keypress`,a),()=>{e.off(`keypress`,a),r&&t.write(tA.show),e instanceof b.ReadStream&&e.isTTY&&!cA&&e.setRawMode(!1),i.terminal=!1,i.close()}}const pA=e=>`columns`in e&&typeof e.columns==`number`?e.columns:80,mA=e=>`rows`in e&&typeof e.rows==`number`?e.rows:20;function hA(e,t,n,r=n,i=n,a){return eA(t,pA(e??y.stdout)-Wk(n),{hard:!0,trim:!1}).split(`
|
|
889
|
+
`).map((e,t,o)=>{let s=a?a(e,t):e;return t===0?`${r}${s}`:t===o.length-1?`${i}${s}`:`${n}${s}`}).join(`
|
|
890
|
+
`)}function gA(e,t){if(`~standard`in e){let n=e[`~standard`].validate(t);return n instanceof Promise?n.then(e=>e.issues?.at(0)?.message):n.issues?.at(0)?.message}return e(t)}let _A=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame=``;_subscribers=/* @__PURE__ */ new Map;_cursor=0;state=`initial`;error=``;value;userInput=``;get accessible(){return aA(this.opts.accessible)}constructor(e,t=!0){let{input:n=y.stdin,output:r=y.stdout,render:i,signal:a,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=a,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(lA);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}this.rl=m.default.createInterface({input:this.input,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on(`keypress`,this.onKeypress),dA(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(tA.show),this.output.off(`resize`,this.render),dA(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(tA.show),this.output.off(`resize`,this.render),dA(this.input,!1),e(lA)})})}_isActionKey(e,t){return e===` `}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit(`value`,this.value)}_setUserInput(e,t){this.userInput=e??``,this.emit(`userInput`,this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:`u`}),this._setUserInput(``)}async onKeypress(e,t){if(this.state!==`validating`){if(this._track&&t.name!==`return`&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:`h`}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&iA.aliases.has(t.name)&&this.emit(`cursor`,iA.aliases.get(t.name)),iA.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),this.emit(`key`,e,t),t?.name===`return`&&this._shouldSubmit(e,t)){if(this.opts.validate){let e=gA(this.opts.validate,this.value),t;e instanceof Promise?(this.state=`validating`,this.render(),t=await e):t=e,t&&(this.error=t instanceof Error?t.message:t,this.state=`error`,this.rl?.write(this.userInput))}this.state!==`error`&&(this.state=`submit`)}oA([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
|
|
891
|
+
`),dA(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=eA(this._prevFrame,pA(this.output),{hard:!0,trim:!1}).split(`
|
|
892
|
+
`).length-1;this.output.write(tA.move(-999,e*-1))}render(){let e=eA(this._render(this)??``,pA(this.output),{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(tA.hide);else{let t=sA(this._prevFrame,e),n=mA(this.output);if(this.restoreCursor(),t){let r=Math.max(0,t.numLinesAfter-n),i=Math.max(0,t.numLinesBefore-n),a=t.lines.find(e=>e>=r);if(a===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(tA.move(0,a-i)),this.output.write(nA.lines(1));let t=e.split(`
|
|
893
|
+
`);this.output.write(t[a]),this._prevFrame=e,this.output.write(tA.move(0,t.length-a-1));return}if(t.lines.length>1){if(r<i)a=r;else{let e=a-i;e>0&&this.output.write(tA.move(0,e))}this.output.write(nA.down());let t=e.split(`
|
|
894
|
+
`).slice(a);this.output.write(t.join(`
|
|
895
|
+
`)),this._prevFrame=e;return}}this.output.write(nA.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}};var vA=class extends _A{options;cursor=0;get _value(){return this.options[this.cursor]?.value}get _enabledOptions(){return this.options.filter(e=>e.disabled!==!0)}toggleAll(){let e=this._enabledOptions,t=this.value!==void 0&&this.value.length===e.length;this.value=t?[]:e.map(e=>e.value)}toggleInvert(){let e=this.value;if(!e)return;let t=this._enabledOptions.filter(t=>!e.includes(t.value));this.value=t.map(e=>e.value)}toggleValue(){this.value===void 0&&(this.value=[]);let e=this.value.includes(this._value);this.value=e?this.value.filter(e=>e!==this._value):[...this.value,this._value]}constructor(e){super(e,!1),this.options=e.options,this.value=[...e.initialValues??[]];let t=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0);this.cursor=this.options[t]?.disabled?rA(t,1,this.options):t,this.on(`key`,(e,t)=>{t.name===`a`&&this.toggleAll(),t.name===`i`&&this.toggleInvert(),t.name===void 0&&e===` `&&this.toggleValue()}),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=rA(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=rA(this.cursor,1,this.options);break;case`space`:this.toggleValue()}})}};let yA=class extends _A{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){let e=this._selectedValue;this.value=e===void 0?void 0:e.value}constructor(e){super(e,!1),this.options=e.options;let t=this.options.findIndex(({value:t})=>t===e.initialValue),n=t===-1?0:t;this.cursor=this.options[n]?.disabled?rA(n,1,this.options):n,this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=rA(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=rA(this.cursor,1,this.options)}this.changeValue()})}};function bA(){return y.default.platform===`win32`?!!y.default.env.CI||!!y.default.env.WT_SESSION||!!y.default.env.TERMINUS_SUBLIME||y.default.env.ConEmuTask===`{cmd::Cmder}`||y.default.env.TERM_PROGRAM===`Terminus-Sublime`||y.default.env.TERM_PROGRAM===`vscode`||y.default.env.TERM===`xterm-256color`||y.default.env.TERM===`alacritty`||y.default.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:y.default.env.TERM!==`linux`}const xA=bA(),SA=()=>process.env.CI===`true`,CA=(e,t)=>xA?e:t,wA=CA(`◆`,`*`),TA=CA(`■`,`x`),EA=CA(`▲`,`x`),DA=CA(`◇`,`o`),OA=CA(`┌`,`T`),kA=CA(`│`,`|`),AA=CA(`└`,`—`),jA=CA(`●`,`>`),MA=CA(`○`,` `),NA=CA(`◻`,`[•]`),PA=CA(`◼`,`[+]`),FA=CA(`◻`,`[ ]`),IA=CA(`─`,`-`),LA=CA(`╮`,`+`),RA=CA(`├`,`+`),zA=CA(`╯`,`+`),BA=CA(`╰`,`+`),VA=e=>{switch(e){case`initial`:case`active`:return(0,g.styleText)(`cyan`,wA);case`cancel`:return(0,g.styleText)(`red`,TA);case`error`:return(0,g.styleText)(`yellow`,EA);case`submit`:return(0,g.styleText)(`green`,DA);case`validating`:return(0,g.styleText)(`dim`,wA)}},HA=e=>{switch(e){case`initial`:case`active`:return(0,g.styleText)(`cyan`,kA);case`cancel`:return(0,g.styleText)(`red`,kA);case`error`:return(0,g.styleText)(`yellow`,kA);case`submit`:return(0,g.styleText)(`green`,kA)}};function UA(e,t,n){let r=n?`${(0,g.styleText)(`cyan`,kA)} `:``,i=hA(e,t.join(` • `),r).split(`
|
|
896
|
+
`);return n&&i.push((0,g.styleText)(`cyan`,AA)),i}const WA=(e,t,n,r,i,a=!1)=>{let o=t,s=0;if(a)for(let t=r-1;t>=n;t--){let n=e[t];if(n&&(o-=n.length),s++,o<=i)break}else for(let t=n;t<r;t++){let n=e[t];if(n&&(o-=n.length),s++,o<=i)break}return{lineCount:o,removals:s}},GA=({cursor:e,options:t,style:n,output:r=process.stdout,maxItems:i=1/0,columnPadding:a=0,rowPadding:o=4})=>{let s=pA(r)-a,c=mA(r),l=(0,g.styleText)(`dim`,`...`),u=Math.max(c-o,0),d=Math.max(Math.min(i,u),5),f=0;e>=d-3&&(f=Math.max(Math.min(e-d+3,t.length-d),0));let p=d<t.length&&f>0,m=d<t.length&&f+d<t.length,h=Math.min(f+d,t.length),_=[],v=0;p&&v++,m&&v++;let y=f+ +!!p,b=h-+!!m;for(let r=y;r<b;r++){let i=t[r],a=eA(i===void 0?``:n(i,r===e),s,{hard:!0,trim:!1}).split(`
|
|
897
|
+
`);_.push(a),v+=a.length}if(v>u){let t=0,n=0,r=v,i=e-y,a=u,o=()=>WA(_,r,0,i,a),s=()=>WA(_,r,i+1,_.length,a,!0);p?({lineCount:r,removals:t}=o(),r>a&&(m||--a,{lineCount:r,removals:n}=s())):(m||--a,{lineCount:r,removals:n}=s(),r>a&&(--a,{lineCount:r,removals:t}=o())),t>0&&(p=!0,_.splice(0,t)),n>0&&(m=!0,_.splice(_.length-n,n))}let x=[];p&&x.push(l);for(let e of _)for(let t of e)x.push(t);return m&&x.push(l),x},KA=[`${(0,g.styleText)(`dim`,`↑/↓`)} to navigate`,`${(0,g.styleText)(`dim`,`Space:`)} select`,`${(0,g.styleText)(`dim`,`Enter:`)} confirm`],qA=(e,t)=>e.split(`
|
|
898
|
+
`).map(e=>t(e)).join(`
|
|
899
|
+
`),JA=e=>{let t=(e,t)=>{let n=e.label??String(e.value);return t===`disabled`?`${(0,g.styleText)(`gray`,FA)} ${qA(n,e=>(0,g.styleText)([`strikethrough`,`gray`],e))}${e.hint?` ${(0,g.styleText)(`dim`,`(${e.hint??`disabled`})`)}`:``}`:t===`active`?`${(0,g.styleText)(`cyan`,NA)} ${n}${e.hint?` ${(0,g.styleText)(`dim`,`(${e.hint})`)}`:``}`:t===`selected`?`${(0,g.styleText)(`green`,PA)} ${qA(n,e=>(0,g.styleText)(`dim`,e))}${e.hint?` ${(0,g.styleText)(`dim`,`(${e.hint})`)}`:``}`:t===`cancelled`?`${qA(n,e=>(0,g.styleText)([`strikethrough`,`dim`],e))}`:t===`active-selected`?`${(0,g.styleText)(`green`,PA)} ${n}${e.hint?` ${(0,g.styleText)(`dim`,`(${e.hint})`)}`:``}`:t===`submitted`?`${qA(n,e=>(0,g.styleText)(`dim`,e))}`:`${(0,g.styleText)(`dim`,FA)} ${qA(n,e=>(0,g.styleText)(`dim`,e))}`},n=e.required??!0,r=e.showInstructions??!0;return new vA({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:n,cursorAt:e.cursorAt,validate(e){if(n&&(e===void 0||e.length===0))return`Please select at least one option.
|
|
900
|
+
${(0,g.styleText)(`reset`,(0,g.styleText)(`dim`,`Press ${(0,g.styleText)([`gray`,`bgWhite`,`inverse`],` space `)} to select, ${(0,g.styleText)(`gray`,(0,g.styleText)(`bgWhite`,(0,g.styleText)(`inverse`,` enter `)))} to submit`))}`},render(){let n=e.withGuide??iA.withGuide,i=hA(e.output,e.message,n?`${HA(this.state)} `:``,`${VA(this.state)} `),a=`${n?`${(0,g.styleText)(`gray`,kA)}
|
|
901
|
+
`:``}${i}
|
|
902
|
+
`,o=this.value??[],s=(e,n)=>{if(e.disabled)return t(e,`disabled`);let r=o.includes(e.value);return n&&r?t(e,`active-selected`):r?t(e,`selected`):t(e,n?`active`:`inactive`)};switch(this.state){case`submit`:{let r=this.options.filter(({value:e})=>o.includes(e)).map(e=>t(e,`submitted`)).join((0,g.styleText)(`dim`,`, `))||(0,g.styleText)(`dim`,`none`);return`${a}${hA(e.output,r,n?`${(0,g.styleText)(`gray`,kA)} `:``)}`}case`cancel`:{let r=this.options.filter(({value:e})=>o.includes(e)).map(e=>t(e,`cancelled`)).join((0,g.styleText)(`dim`,`, `));return r.trim()===``?`${a}${(0,g.styleText)(`gray`,kA)}`:`${a}${hA(e.output,r,n?`${(0,g.styleText)(`gray`,kA)} `:``)}${n?`
|
|
903
|
+
${(0,g.styleText)(`gray`,kA)}`:``}`}case`error`:{let t=n?`${(0,g.styleText)(`yellow`,kA)} `:``,r=this.error.split(`
|
|
904
|
+
`).map((e,t)=>t===0?`${n?`${(0,g.styleText)(`yellow`,AA)} `:``}${(0,g.styleText)(`yellow`,e)}`:` ${e}`).join(`
|
|
905
|
+
`),i=a.split(`
|
|
906
|
+
`).length,o=r.split(`
|
|
907
|
+
`).length+1;return`${a}${t}${GA({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:t.length,rowPadding:i+o,style:s}).join(`
|
|
908
|
+
${t}`)}
|
|
909
|
+
${r}
|
|
910
|
+
`}default:{let t=n?`${(0,g.styleText)(`cyan`,kA)} `:``,i=a.split(`
|
|
911
|
+
`).length,o=r?UA(e.output,KA,n):n?[(0,g.styleText)(`cyan`,AA)]:[],c=o.join(`
|
|
912
|
+
`),l=o.length+1;return`${a}${t}${GA({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:t.length,rowPadding:i+l,style:s}).join(`
|
|
913
|
+
${t}`)}
|
|
914
|
+
${c}
|
|
915
|
+
`}}}}).prompt()},YA=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??iA.withGuide?`${(0,g.styleText)(`gray`,AA)} `:``;n.write(`${r}${(0,g.styleText)(`red`,e)}
|
|
916
|
+
|
|
917
|
+
`)},XA=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??iA.withGuide?`${(0,g.styleText)(`gray`,OA)} `:``;n.write(`${r}${e}
|
|
918
|
+
`)},ZA=e=>e,QA=(e,t,n)=>{let r={hard:!0,trim:!1},i=eA(e,t,r).split(`
|
|
919
|
+
`),a=i.reduce((e,t)=>Math.max(Wk(t),e),0);return eA(e,t-(i.map(n).reduce((e,t)=>Math.max(Wk(t),e),0)-a),r)},$A=(e=``,t=``,n)=>{let r=n?.output??y.default.stdout,i=n?.withGuide??iA.withGuide,a=n?.format??ZA,o=[``,...QA(e,pA(r)-6,a).split(`
|
|
920
|
+
`).map(a),``],s=Wk(t),c=Math.max(o.reduce((e,t)=>{let n=Wk(t);return n>e?n:e},0),s)+2,l=o.map(e=>`${(0,g.styleText)(`gray`,kA)} ${e}${` `.repeat(c-Wk(e))}${(0,g.styleText)(`gray`,kA)}`).join(`
|
|
921
|
+
`),u=i?`${(0,g.styleText)(`gray`,kA)}
|
|
922
|
+
`:``,d=i?RA:BA;r.write(`${u}${(0,g.styleText)(`green`,DA)} ${(0,g.styleText)(`reset`,t)} ${(0,g.styleText)(`gray`,IA.repeat(Math.max(c-s-1,1))+LA)}
|
|
923
|
+
${l}
|
|
924
|
+
${(0,g.styleText)(`gray`,d+IA.repeat(c+2)+zA)}
|
|
925
|
+
`)},ej=e=>(0,g.styleText)(`magenta`,e),tj=({indicator:e=`dots`,onCancel:t,output:n=process.stdout,cancelMessage:r,errorMessage:i,frames:a=xA?[`◒`,`◐`,`◓`,`◑`]:[`•`,`o`,`O`,`0`],delay:o=xA?80:120,signal:s,...c}={})=>{let l=SA(),u=aA(c.accessible),d,f,p=!1,m=!1,h=``,_,v=performance.now(),y=pA(n),b=c?.styleFrame??ej,x=e=>{let n=e>1?i??iA.messages.error:r??iA.messages.cancel;m=e===1,p&&(D(n,e),m&&typeof t==`function`&&t())},S=()=>x(2),C=()=>x(1),w=()=>{process.on(`uncaughtExceptionMonitor`,S),process.on(`unhandledRejection`,S),process.on(`SIGINT`,C),process.on(`SIGTERM`,C),process.on(`exit`,x),s&&s.addEventListener(`abort`,C)},T=()=>{process.removeListener(`uncaughtExceptionMonitor`,S),process.removeListener(`unhandledRejection`,S),process.removeListener(`SIGINT`,C),process.removeListener(`SIGTERM`,C),process.removeListener(`exit`,x),s&&s.removeEventListener(`abort`,C)},E=()=>{if(_===void 0)return;l&&n.write(`
|
|
926
|
+
`);let e=eA(_,y,{hard:!0,trim:!1}).split(`
|
|
927
|
+
`);e.length>1&&n.write(tA.up(e.length-1)),n.write(tA.to(0)),n.write(nA.down())},ee=e=>e.replace(/\.+$/,``),te=e=>{let t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},ne=c.withGuide??iA.withGuide,re=(t=``)=>{if(p=!0,m=!1,h=ee(t),v=performance.now(),w(),u){h!==``&&n.write(`${h}
|
|
928
|
+
`),f=setInterval(()=>{n.write(h===``?`still working
|
|
929
|
+
`:`still working: ${h}
|
|
930
|
+
`)},3e4);return}d=fA({output:n}),ne&&n.write(`${(0,g.styleText)(`gray`,kA)}
|
|
931
|
+
`);let r=0,i=0;f=setInterval(()=>{if(l&&h===_)return;E(),_=h;let t=b(a[r]),o;if(l)o=`${t} ${h}...`;else if(e===`timer`)o=`${t} ${h} ${te(v)}`;else{let e=`.`.repeat(Math.floor(i)).slice(0,3);o=`${t} ${h}${e}`}let s=eA(o,y,{hard:!0,trim:!1});n.write(s),r=r+1<a.length?r+1:0,i=i<4?i+.125:0},o)},D=(t=``,a=0,o=!1)=>{if(p){if(p=!1,m=a===1,clearInterval(f),u||E(),h=t??h,!o){if(u){let t=a===1?r??iA.messages.cancel:a===2?i??iA.messages.error:`Done`,o=h||t;e===`timer`?n.write(`${o} ${te(v)}
|
|
932
|
+
`):n.write(`${o}
|
|
933
|
+
`)}else{let t=a===0?(0,g.styleText)(`green`,DA):a===1?(0,g.styleText)(`red`,TA):(0,g.styleText)(`red`,EA);e===`timer`?n.write(`${t} ${h} ${te(v)}
|
|
934
|
+
`):n.write(`${t} ${h}
|
|
935
|
+
`)}}T(),d?.()}};return{start:re,stop:(e=``)=>D(e,0),message:(e=``)=>{h=ee(e??h)},cancel:(e=``)=>D(e,1),error:(e=``)=>D(e,2),clear:()=>D(``,0,!0),get isCancelled(){return m}}},nj=[`${(0,g.styleText)(`dim`,`↑/↓`)} to navigate`,`${(0,g.styleText)(`dim`,`Enter:`)} confirm`],rj=(e,t)=>e.includes(`
|
|
936
|
+
`)?e.split(`
|
|
937
|
+
`).map(e=>t(e)).join(`
|
|
938
|
+
`):t(e),ij=e=>{let t=(e,t)=>{if(e===void 0)return``;let n=e.label??String(e.value);switch(t){case`disabled`:return`${(0,g.styleText)(`gray`,MA)} ${rj(n,e=>(0,g.styleText)(`gray`,e))}${e.hint?` ${(0,g.styleText)(`dim`,`(${e.hint??`disabled`})`)}`:``}`;case`selected`:return`${rj(n,e=>(0,g.styleText)(`dim`,e))}`;case`active`:return`${(0,g.styleText)(`green`,jA)} ${n}${e.hint?` ${(0,g.styleText)(`dim`,`(${e.hint})`)}`:``}`;case`cancelled`:return`${rj(n,e=>(0,g.styleText)([`strikethrough`,`dim`],e))}`;default:return`${(0,g.styleText)(`dim`,MA)} ${rj(n,e=>(0,g.styleText)(`dim`,e))}`}},n=e.showInstructions??!0;return new yA({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let r=e.withGuide??iA.withGuide,i=`${VA(this.state)} `,a=`${HA(this.state)} `,o=hA(e.output,e.message,a,i),s=`${r?`${(0,g.styleText)(`gray`,kA)}
|
|
939
|
+
`:``}${o}
|
|
940
|
+
`;switch(this.state){case`submit`:{let n=r?`${(0,g.styleText)(`gray`,kA)} `:``;return`${s}${hA(e.output,t(this.options[this.cursor],`selected`),n)}`}case`cancel`:{let n=r?`${(0,g.styleText)(`gray`,kA)} `:``;return`${s}${hA(e.output,t(this.options[this.cursor],`cancelled`),n)}${r?`
|
|
941
|
+
${(0,g.styleText)(`gray`,kA)}`:``}`}default:{let i=r?`${(0,g.styleText)(`cyan`,kA)} `:``,a=s.split(`
|
|
942
|
+
`).length,o=n?UA(e.output,nj,r):r?[(0,g.styleText)(`cyan`,AA)]:[],c=o.join(`
|
|
943
|
+
`),l=o.length+1;return`${s}${i}${GA({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:i.length,rowPadding:a+l,style:(e,n)=>t(e,e.disabled?`disabled`:n?`active`:`inactive`)}).join(`
|
|
944
|
+
${i}`)}
|
|
945
|
+
${c}
|
|
946
|
+
`}}}}).prompt()};`${(0,g.styleText)(`gray`,kA)}`;function aj(e,t){let n=e.harness===void 0?t.selection?.targets||Object.keys(t.previous):e.harness===`none`?[]:e.harness.split(`,`).map(LO);if(e.harness===void 0&&!t.selection&&!n.length)throw Error(`--harness <claude-code,codex,cursor,gemini,opencode,pi,copilot,agy|none> is required. Use --harness none for CLI only.`);for(let e of n){if(!mO.some(t=>t.id===e))throw Error(`Unknown harness: ${e}`);if(!t.detected.includes(e))throw Error(`${e} not detected; install its CLI first or use --harness none.`)}let r=new Set(n.map(e=>t.previous[e]?.mode).filter(Boolean)),i=e.mode||(e.harness===void 0?t.selection?.mode:void 0)||(r.size===1?[...r][0]:void 0);if(i!==`artifacts`&&i!==`full`)throw Error(`--mode artifacts|full is required without an interactive terminal.`);return{root:t.root,binDir:t.binDir,mode:i,targets:[...new Set(n)]}}async function oj(e,t,n){let r=n?.mode||e.selection?.mode||Object.values(e.previous)[0]?.mode||`artifacts`,i=n?.targets||e.selection?.targets||Object.keys(e.previous),a=!!n,o=n?`review`:`mode`;for(;;){if(o===`mode`){let e=await t.mode(r);if(e===null)return null;r=e,o=a?`review`:`targets`}if(o===`targets`){let e=await t.targets(i);if(e===null)return null;i=e,a=!0,o=`review`}let n=aj({mode:r,harness:i.join(`,`)||`none`},e),s=await t.review(n);if(s===`cancel`)return null;if(s===`apply`)return n;o=s}}async function sj(e,t){let n=process.stderr;XA(`Ryugi · Install`,{output:n});let r=await oj(e,{async mode(e){$A(`Artifacts: the artifacts and interface-craft skills. Documents, artboards,
|
|
947
|
+
whiteboards and HTML pages with comments. Your agent sessions start as before.
|
|
948
|
+
|
|
949
|
+
Full workflow: Artifacts plus brainstorming, specs, TDD, debugging, git
|
|
950
|
+
worktrees and verification skills. Injects the Ryugi workflow into every
|
|
951
|
+
new session. Rerun install to switch.`,`Content`,{output:n});let t=await ij({output:n,message:`What would you like to install?`,initialValue:e,options:[{value:`artifacts`,label:`Artifacts`,hint:`visual pages only; sessions unchanged`},{value:`full`,label:`Full workflow`,hint:`Artifacts + workflow skills; changes every session`}]});return uA(t)?null:t},async targets(t){let r=mO.filter(t=>!e.detected.includes(t.id));if(r.length&&$A(r.map(e=>`${e.label}: ${e.command} not found`).join(`
|
|
952
|
+
`),`Unavailable`,{output:n}),!e.detected.length)return[];let i=await JA({output:n,message:`Install into which harnesses? (empty = CLI only)`,required:!1,initialValues:t,options:mO.filter(t=>e.detected.includes(t.id)).map(t=>({value:t.id,label:t.label,hint:`${e.previous[t.id]?.mode||`new`} · ${t.comments}`}))});return uA(i)?null:i},async review(t){$A([`CLI: ${t.root}`,`Command: ${t.binDir}`,`Content: ${t.mode}`,...t.targets.map(n=>`${n}: ${e.previous[n]?.mode||`new`} → ${t.mode}; ${mO.find(e=>e.id===n).comments}`),...t.targets.length?[`Start a new harness session after installation.`]:[`CLI only; no harness plugins.`]].join(`
|
|
953
|
+
`),`Installation plan`,{output:n});let r=await ij({output:n,message:`Continue?`,options:[{value:`apply`,label:`Install`},{value:`mode`,label:`Change content`},{value:`targets`,label:`Change targets`},{value:`cancel`,label:`Cancel`}]});return uA(r)?`cancel`:r}},t);return r||YA(`Cancelled. No installation changes made.`,{output:n}),r}function cj(){return tj({output:process.stderr,onCancel:()=>{}})}function lj(e){for(let t of[`package.json`,`.codex-plugin/plugin.json`])try{let n=JSON.parse(d.default.readFileSync(f.default.join(e,t),`utf8`)),r=String(n.version??``).replace(/-(?:full|artifacts)\.[\da-f]+$/,``);if(/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(r))return r}catch{}return null}function uj(e){let t=/* @__PURE__ */ new Map;return(n,r)=>{let i=JSON.stringify([n,r]);return t.has(i)||t.set(i,e(n,r)),t.get(i)}}function dj(e,t){let n=uj(t),r=[],i;try{i=Object.values(RO(e).harnesses)}catch{return{plugins:r,complete:!1}}let a=!0;for(let e of i)try{if(e.harness===`claude-code`&&oO(e,n)!==`owned`)continue;let t=e.harness===`claude-code`?e.registration&&aO(e.registration,n).path:e.path;if(!t)continue;let i=f.default.join(t,`skills/artifacts/app/hook-bin.sh`);if(!d.default.existsSync(i))continue;let a=lj(t);if(!a)continue;r.push({harness:e.harness,version:a,legacy:!d.default.readFileSync(i,`utf8`).includes(`.ryugi/hook`)})}catch{a=!1}return{plugins:r,complete:a}}function fj(e,t){return dj(e,t.run).plugins}function pj(e,t,n){let r=dj(e,t);return Ek(n,r),r}function mj(e){let t=[],n=[];if(e.status!==`done`)return{warnings:t,actions:n};for(let r of e.failed)t.push({code:`W_HOOK_BINARY`,severity:`warning`,message:`ryugi-hook ${r.version} was not downloaded (${r.error}); plugin hooks skip until it is.`}),r.version!==`unknown`&&n.push({kind:`command`,argv:[`adeck`,`hook`,`install`,r.version],label:`Download the hook binary`});return{warnings:t,actions:n}}function hj(e,t){let n=/* @__PURE__ */ new Map,r=t?1:25,i=null;return{report(a,o,s){let c=s?` ${Math.floor(Math.floor(o/s*100)/r)*r}%`:t?` ${(o/1048576).toFixed(1)} MB`:``;if(n.get(a)===c)return;n.set(a,c);let l=`Downloading ryugi-hook ${[...n].map(([e,t])=>e+t).join(` · `)}`;if(!t)return e.progress({phase:l});i?i.message(l):(i=cj()).start(l)},finish(){i?.stop(`Downloaded ryugi-hook ${[...n.keys()].join(`, `)}`)}}}async function gj(e,t,n){let r=hj(t,n);try{return await _j({...e,progress:r.report})}finally{r.finish()}}function _j(e){return vj(e).catch(e=>({status:`done`,failed:[{version:`unknown`,error:e.message}],prefetched:[],removed:[]}))}async function vj(e){let t=h.default.homedir(),n=He().home;if(f.default.resolve(n)!==f.default.join(t,`.ryugi`,`server`))return{status:`other-hub`};let r=pj(e.root??kO(),e.run??hO,t);return Ak({arch:process.arch,cleanup:e.cleanup,env:process.env,fetch,home:t,installed:r,platform:process.platform,progress:e.progress,retry:!0,serverHome:n,version:`1.113.1`})}const yj=e=>`export { default, RyugiPlugin } from ${JSON.stringify((0,v.pathToFileURL)(f.default.join(e,`.opencode/plugins/ryugi.js`)).href)};\n`;function bj(e,t={}){let n=[],r=new FO(e).current();if(r){let i=new FO(e,t.binDir||f.default.dirname(r.bin));n.push({component:`CLI command`,status:i.ownsBin()?`ok`:`attention`,message:i.bin});let a=IO(i.binDir,t.env||process.env);n.push({component:`PATH`,status:a?`attention`:`ok`,message:a||`${i.binDir} is on PATH`});for(let e of[`dist/cli.cjs`,`dist/document-engine.cjs`,`dist/loro_wasm_bg.wasm`,`dist/viewer/index.html`,`dist/runtime/ryugi-ui.js`])n.push({component:`CLI ${e}`,status:d.default.existsSync(f.default.join(r.packageRoot,e))?`ok`:`attention`,message:f.default.join(r.packageRoot,e)})}else n.push({component:`CLI runtime`,status:`attention`,message:`No self-managed runtime; retain the current package-manager or development CLI.`});for(let r of Object.values(RO(e).harnesses))try{if(r.harness===`claude-code`){let e=f.default.join((t.env||process.env).CLAUDE_CONFIG_DIR||f.default.join(t.home||h.default.homedir(),`.claude`),`settings.json`);if(!JSON.parse(d.default.readFileSync(e,`utf8`)).enabledPlugins?.[r.registration])throw Error(`Recorded Claude plugin is not enabled at user scope`);if(!sO(r,t.run||hO))throw Error(`Native Claude source no longer matches the record`)}else if(yO(r,vO(r.harness,{root:e,home:t.home})),!sO(r,t.run||hO))throw Error(`Native registration does not match the owned source`);let i=`${r.mode} · ${r.version}`;if(r.harness===`codex`){let e=Ck(r.path,r.registration||`ryugi@ryugi-managed`,t.env||process.env,t.home);n.push(e.blocked?{component:r.harness,status:`attention`,message:`${i}; ${e.blocked} of ${e.declared} Codex hooks are not approved for this version, so comments will not arrive. Open Codex Settings → Hooks, choose Ryugi, press Trust all, then start a new chat.`}:{component:r.harness,status:`ok`,message:`${i}; hooks trusted; new session required`});continue}n.push({component:r.harness,status:`ok`,message:`${i}; restart/new session required; delivery unverified`})}catch(e){n.push({component:r.harness,status:`attention`,message:e.message})}let i=t.home||h.default.homedir(),a=ut(process.platform,process.arch);for(let r of fj(e,{run:t.run||hO})){let e=`${r.harness} hook`;if(r.legacy){n.push({component:e,status:`attention`,message:`plugin ${r.version} predates ~/.ryugi/hook; run adeck update to refresh it`});continue}if(!a)continue;let t=f.default.join(lt(i,r.version),`ryugi-hook`);n.push(d.default.existsSync(t)?{component:e,status:`ok`,message:t}:{component:e,status:`attention`,message:`no ryugi-hook ${r.version}, so this plugin's hooks skip; run adeck hook install ${r.version}`})}return n.push(xj(t)),n}function xj(e){let t=`agent-browser`,n=hk({env:e.env||process.env,...e.home?{home:e.home}:{},...e.agentBrowserDirs?{extraDirs:e.agentBrowserDirs}:{}});if(!n)return{component:t,status:`optional`,message:`not found: install it (npm i -g agent-browser, then agent-browser install) so artboard Check loads its boards without a browser window`};let r=_k(n);return{component:t,status:`ok`,message:r?`${n} (${r})`:n}}function Sj(e,t={}){let n=RO(e),r={removed:[],failures:[],preserved:[`Project artifacts, comments, harness plugin data and runtime caches are retained.`]},i=t.run||hO;for(let a of t.targets||Object.keys(n.harnesses)){let o=n.harnesses[a];if(o)try{if(a===`claude-code`){if(![`ryugi@ryugi-dev`,`ryugi-artifacts@ryugi-dev`].includes(o.registration||``))throw Error(`Unknown native Claude plugin identity`);let e=oO(o,i);if(e===`foreign`)throw Error(`Native Claude source changed; preserving it`);e===`owned`&&i(`claude`,[`plugin`,`uninstall`,o.registration,`--scope`,`user`])}else{if(yO(o,vO(a,{root:e,home:t.home})),!sO(o,i))throw Error(`Native plugin source changed; preserving it`);if(a===`codex`&&i(`codex`,[`plugin`,`remove`,`ryugi@ryugi-managed`]),a===`copilot`&&i(`copilot`,[`plugin`,`uninstall`,`ryugi@ryugi-managed`]),a===`pi`&&i(`pi`,[`remove`,o.path]),a===`gemini`&&i(`gemini`,[`extensions`,`uninstall`,`ryugi`]),a===`agy`&&i(`agy`,[`plugin`,`uninstall`,`ryugi`]),a===`opencode`){let e=t.env||process.env,n=f.default.join(e.XDG_CONFIG_HOME||f.default.join(t.home||h.default.homedir(),`.config`),`opencode/plugins/ryugi.js`);if(!d.default.existsSync(n)||d.default.readFileSync(n,`utf8`)!==yj(o.path))throw Error(`Plugin entry was changed; preserving ${n}`);d.default.unlinkSync(n)}d.default.rmSync(o.path,{recursive:!0})}delete n.harnesses[a],zO(e,n),r.removed.push(a)}catch(e){r.failures.push({component:a,message:e.message})}}if(!t.targets){let n=new FO(e).current();if(n){let i=new FO(e,t.binDir||f.default.dirname(n.bin));i.ownsBin()?(d.default.unlinkSync(i.bin),r.removed.push(`CLI command`)):r.failures.push({component:`CLI command`,message:`Command changed; preserving ${i.bin}`}),i.ownsAlias()&&d.default.unlinkSync(i.aliasBin)}}return r}const Cj={name:`doctor`,summary:`Check installed CLI ownership, plugin files and native registrations`,options:{"install-dir":{type:`string`,value:`<path>`,help:`Managed installation directory`}},semantic:e=>Q({id:`doctor`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},run(){let t=bj(f.default.resolve(e.values[`install-dir`]||kO()));return Y({checks:t},t.some(e=>e.status===`attention`)?{kind:`action_required`,reason:`Some installation components need attention`}:{kind:`succeeded`})},present:({data:e})=>({heading:`Doctor`,status:e.checks.some(e=>e.status===`attention`)?`attention`:`ok`,facts:[],sections:[{kind:`records`,key:`checks`,rows:e.checks.map(e=>({...e})),columns:[{key:`component`,required:!0},{key:`status`,required:!0},{key:`message`,required:!0}]}]})},e)},wj=/<head(\s[^>]*)?>/i,Tj=/^\s*(<!doctype[^>]*>)?\s*(<html(\s[^>]*)?>)?/i,Ej=/^<script>([\s\S]*?)<\/script>/,Dj=/^(?:<script (?:defer|type="module") src="[^"]*\/_ryugi\/runtime\/ryugi-(?:icons|ui|deck|storyboard)\.js"><\/script>|<style data-ryugi-deck>[^<]*<\/style>)+/;function Oj(e){let t=wj.exec(e);return t?t.index+t[0].length:Tj.exec(e)?.[0].length??0}function kj(e){let t=Oj(e),n=e.slice(t);n.startsWith(`<style>:root{color-scheme:light dark;background:transparent}body{margin:0;font-family:var(--lobe-font-family,system-ui,-apple-system,sans-serif)}</style>`)&&(n=n.slice(153));let r=Ej.exec(n);return!r||!r[1].includes(`ryugi:`)?e:e.slice(0,t)+n.slice(r[0].length).replace(Dj,``)}function Aj(e,t=4){let n=0,r;try{r=d.default.readdirSync(e,{withFileTypes:!0})}catch{return n}for(let i of r){if(i.name.startsWith(`.`)||i.isSymbolicLink())continue;let r=f.default.join(e,i.name);i.isDirectory()?t>0&&(n=Math.max(n,Aj(r,t-1))):i.isFile()&&(n=Math.max(n,d.default.statSync(r).mtimeMs))}return n}const jj=e=>{let t=Aj(e);return t?{updatedAt:new Date(t).toISOString()}:{}};function Mj(e){let t=/* @__PURE__ */ new Set([...Object.keys(ZC),`artifact`,`source`]),n=Object.keys(e.values).find(e=>!t.has(e));if(n)throw new J({code:`E_ARGUMENT_INVALID`,message:`--${n} applies to Cloud reads only. Local reads accept --artifact, --detail or --source.`});let r=e.values.artifact;r&&hC(e.projectDir,r);let i=!!e.values.source||e.values.format===`source`;if(i&&!r)throw new J({code:`E_ARGUMENT_INVALID`,message:`Local --source requires --artifact <type>/<id>.`});let{project:a,root:o}=ce(e.projectDir);return Q({id:`get`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`,...r?[`source`]:[]],detail:!0},async run(t,n){let s=r?{artifacts:[{type:r.split(`/`)[0],id:r.split(`/`)[1],dir:``}],warnings:[]}:Pe(o),c=s.artifacts.map(({type:e,id:t,dir:n})=>{let r=`${e}/${t}`,i=hC(a,r);if(i.content===`existing`){let e=d.default.realpathSync(i.write);if(!e.startsWith(`${o}${f.default.sep}`))throw new J({code:`E_FILE_PATH_UNSAFE`,message:`Artifact source escapes its project: ${i.write}`});let t=d.default.statSync(e);if(!t.isFile())throw new J({code:`E_FILE_PATH_UNSAFE`,message:`Artifact source is not a regular file: ${i.write}`});return{artifact:r,...i,bytes:t.size,modifiedAt:t.mtime.toISOString(),...n?jj(n):{}}}return{artifact:r,...i,...n?jj(n):{}}});c.sort((e,t)=>(t.updatedAt??``).localeCompare(e.updatedAt??``));let l,p;if(r&&(i||e.values.detail)){if(c[0]?.content!==`existing`)throw new J({code:`E_ARTIFACT_NOT_FOUND`,message:`Content not written yet: ${c[0]?.write}`});let e=d.default.readFileSync(c[0].write);l=e.toString(`utf8`),p=u.default.createHash(`sha256`).update(e).digest(`hex`),n.payloads.source=l}let[m,h]=r?.split(`/`)??[],g=s.warnings.map(e=>({code:`W_ARTIFACT_DISCOVERY`,message:e})),_=m&&Ae(m)&&h&&c[0]?.content===`existing`?iC[m].localGet:void 0,v=_?.read(o,h,c[0].write);g.push(...v?.warnings??[]);let y=l!==void 0&&!i?v?.markdown:void 0,b=y??l;return Y({origin:`local`,project:a,complete:!0,...r?{}:{server:await DT()},items:c,..._&&v?.rows?{[_.key]:v.rows}:{},...b===void 0?{}:{content:b,contentFormat:y===void 0?void 0:`markdown`,sha256:p}},void 0,{warnings:g,actions:r?[lw([`check`,`--project-dir`,a,`--artifact`,r],`Check`)]:[],coverage:r&&l===void 0?{omitted:[{path:`data.content`,reason:`summary`}]}:{}})},present({data:e}){return{heading:`Local artifacts`,status:`complete`,subject:e.project,facts:e.server?[{label:`Server`,binding:{key:`server`,value:`${e.server.status}${e.server.version?` · ${e.server.version}`:``}`}}]:[],sections:[{kind:`records`,key:`items`,rows:e.items,columns:[{key:`artifact`,required:!0,positional:!0},{key:`content`,positional:!0},{key:`updatedAt`,label:`Updated`,positional:!0},{key:`write`,label:`Edit`,required:!0},{key:`bytes`}]},...k.flatMap(t=>{let n=iC[t].localGet,r=n&&e[n.key];return n&&Array.isArray(r)?[{kind:`records`,key:n.key,rows:r,columns:n.columns}]:[]}),...e.content===void 0?[]:[{kind:`content`,key:`content`,text:e.content,title:e.contentFormat===`markdown`?`Markdown`:`Complete source`}]]}}},e)}function Nj({data:e}){let t=Ae(e.type)?iC[e.type].outlineView:void 0;return{heading:`Cloud artifact`,status:e.status===`downloaded`||e.status===`partial`?e.status:``,subject:e.id,summary:[e.type,`v${e.version}`,e.visibility].join(` · `),facts:[Z(`Title`,X(e,`title`)),...e.saved?[Z(`Saved`,X(e,`saved`),!0),Z(`Bytes`,X(e,`bytes`))]:[],...e.dir?[Z(`Downloaded`,X(e,`dir`),!0)]:e.files?[Z(`Files available`,{key:`files`,value:e.files.join(`, `)})]:[]],sections:[...e.outline?[{kind:`records`,key:`outline`,...t?{rows:t.rows(e.outline),columns:t.columns}:{rows:e.outline,columns:[{key:`id`,positional:!0,required:!0},{key:`type`,positional:!0},{key:`preview`,positional:!0}]}}]:[],...e.prompt===void 0?[]:[{kind:`content`,key:`prompt`,title:Kg.replace(/[::]$/,``),text:e.prompt}],...e.content===void 0?[]:[{kind:`content`,key:`content`,title:`LiteXML`,text:e.content}],...e.comments?[{...IE(e.comments.threads,`comments`),title:`Published snapshot comments`}]:[]]}}const Pj=(e,t)=>typeof e.values[t]==`string`?e.values[t]:void 0,Fj=e=>!!e&&!e.includes(`\\`)&&!e.includes(`\0`)&&!f.default.posix.isAbsolute(e)&&e.split(`/`).every(e=>!!e&&e!==`.`&&e!==`..`);async function Ij(e,t,n){if(!e.contentBase||!Array.isArray(e.files))throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server did not return a complete download manifest.`});if(e.files.some(e=>!Fj(e)))throw new J({code:`E_FILE_PATH_UNSAFE`,message:`The manifest contains an unsafe file path.`});if(d.default.existsSync(t))throw new J({code:`E_FILE_EXISTS`,message:`Download directory already exists: ${t}`});d.default.mkdirSync(f.default.dirname(t),{recursive:!0}),d.default.mkdirSync(t,{mode:448});for(let r of e.files){let i=f.default.join(t,...r.split(`/`)),a=n.effects.begin(`download`,i);try{let t=await fetch(`${e.contentBase}${r.split(`/`).map(encodeURIComponent).join(`/`)}`,{headers:nt,signal:n.signal});if(!t.ok)throw Error(`HTTP ${t.status}`);d.default.mkdirSync(f.default.dirname(i),{recursive:!0});let o=Buffer.from(await t.arrayBuffer()),s=hE(i,r.endsWith(`.html`)?kj(o.toString(`utf8`)):o);n.effects.confirm(a,{bytes:s.bytes})}catch(e){throw n.effects.set(a,`failed`,{message:e.message}),new J({code:`E_DOWNLOAD_FAILED`,message:`Could not download ${r}: ${e.message}`})}}}function Lj(e){let t=e.positionals[0];if(!t)return Mj(e);if(e.values.artifact)throw new J({code:`E_OPTION_CONFLICT`,message:`Choose a local --artifact or a Cloud link/id, not both.`});let{origin:n,id:r,grant:i}=Vj(t,ie(process.env)),a=Pj(e,`save`);if(a!==void 0&&!a.trim())throw new J({code:`E_ARGUMENT_INVALID`,message:`--save requires a nonempty file path.`});let o=!!e.values.source||e.values.format===`source`||a!==void 0,s=Pj(e,`block`),c=Pj(e,`out`),l=!!e.values.download||!!c,u=!!e.values.detail||o;if(o&&(s||l||Pj(e,`fields`)||Pj(e,`cursor`)||Pj(e,`limit`)))throw new J({code:`E_OPTION_CONFLICT`,message:`Source must be a complete document; use --snapshot to pin its version.`});if(s&&(l||u||Pj(e,`cursor`)))throw new J({code:`E_OPTION_CONFLICT`,message:`--block reads one complete block and cannot combine with detail, cursor or download.`});let d=Pj(e,`limit`);if(d&&(!/^\d+$/.test(d)||+d<1||+d>100))throw new J({code:`E_ARGUMENT_INVALID`,message:`--limit must be between 1 and 100.`});let p=new URLSearchParams({semantic:`1`});for(let t of[`snapshot`,`cursor`,`fields`,`limit`,`section`,`page`]){let n=Pj(e,t);n&&p.set(t,n)}return u&&p.set(`detail`,`1`),s&&p.set(`block`,s),l&&p.set(`download`,`1`),(e.values[`no-comments`]||o)&&p.set(`no-comments`,`1`),Q({id:`get`,mode:`finite`,output:{detail:!0,formats:[`brief`,`table`,`json`,`jsonl`,`source`,`quiet`],requiredFields:[`id`,`type`,`visibility`,`version`,`status`,...l?[`dir`]:[],...a?[`saved`,`bytes`]:[]],fields:[`id`,`type`,`title`,`visibility`,`version`,`updatedAt`,`outline`,`files`,`content`,`comments`,`saved`,`bytes`],scalar:e=>e.saved??e.id},async run(d,m){let g=qn(Jn(process.env,process.platform,h.default.homedir()),n),_=await fetch(`${n}/api/a/${r}?${new URLSearchParams([...p,...Object.entries(i??{})])}`,{headers:g?{...nt,Authorization:`Bearer ${g.token}`}:nt,signal:m.signal}),v=await _.text();m.payloads.raw=v;let y;try{y=JSON.parse(v)}catch{throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The Cloud server returned an unsupported read response.`})}if(!_.ok)throw new J({code:_.status===404?`E_NOT_FOUND`:`E_CLOUD_FAILED`,httpStatus:_.status,message:y.error||`HTTP ${_.status}`});if(y.schema!==`ryugi.cloud-read/v1`)throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The Cloud server returned an unsupported read response.`});let b;if(o){if(y.type!==`document`||typeof y.content!=`string`)throw new J({code:`E_FORMAT_UNSUPPORTED`,message:`Source is available for documents only.`});m.payloads.source=y.content,a&&(b=hE(a,y.content,m.effects),m.payloads.source=``,(e.values.source||e.values.format===`source`)&&m.diagnostic(`Saved ${b.file} (${b.bytes} bytes)`))}let{schema:x,page:S,contentBase:C,...w}=y,T={...w,...b?{saved:b.file,bytes:b.bytes}:{},status:l?`downloaded`:u||s?`read`:`available`};if(b&&delete T.content,l){T.dir=f.default.resolve(c??f.default.join(process.env.XDG_CACHE_HOME||f.default.join(h.default.homedir(),`.cache`),`ryugi`,`get`,r,`v${y.version}`));try{await Ij(y,T.dir,m)}catch(e){if(!m.effects.snapshot().some(e=>e.state===`confirmed`))throw e;return T.status=`partial`,T.downloads=m.effects.snapshot(),Y(T,{kind:`partial`},{warnings:[{code:`W_DOWNLOAD_PARTIAL`,message:e.message}]})}T.downloads=m.effects.snapshot()}let E=[...p.entries()].filter(([e])=>![`semantic`,`cursor`,`snapshot`,`detail`,`download`].includes(e)).flatMap(([e,t])=>e===`no-comments`?[`--${e}`]:[`--${e}`,t]),ee=[`get`,...E,`--snapshot`,y.snapshot],te=[`get`,...E,...u?[`--detail`]:[],`--cursor`,y.page?.nextCursor??``,`--`,t];return Y(T,void 0,{coverage:{page:S,...!u&&!s?{omitted:[{path:`data.content`,reason:`summary`}]}:{}},actions:[...!u&&!s?[lw([...ee,`--detail`,`--`,t],`Details`)]:[],...!s&&!o&&!l&&y.page?.nextCursor?[lw(te,`More`)]:[]]})},present:Nj},e)}const Rj=/^[\w-]{1,64}$/,zj=/^\/a\/([\w-]{1,64})(?:\/(?:view|preview))?\/?$/,Bj=`Expected an Artideck Cloud link (https://<host>/a/<id>) or an artifact id.`;function Vj(e,t){if(Rj.test(e))return{origin:t,id:e};let n;try{n=new URL(e)}catch{throw new M(Bj)}let r=zj.exec(n.pathname)?.[1];if(!r||n.protocol!==`https:`&&n.protocol!==`http:`)throw new M(Bj);let i=n.searchParams.get(`key`),a=n.searchParams.get(`via`);return{origin:D(n.origin),id:r,...i?{grant:{key:i,...a?{via:a}:{}}}:{}}}const Hj={name:`get`,summary:`Discover local artifacts, read native source, or read a published Cloud link/id`,usage:[`[--artifact <type>/<id> [--detail|--source]]`,`<link-or-id> [--out <dir>] [--no-comments] [options]`],details:`Without a link, lists local artifacts without a server or sign-in. --artifact selects local content; --detail or --source reads its complete native file, except that a document shows its heading outline and --detail reads it as markdown (--source keeps LiteXML). Cloud reads show a published outline/manifest; use --detail, --source or --download for more. Local reads never consume feedback.`,semantic:Lj,options:{artifact:{type:`string`,value:`<type>/<id>`,help:`Read this local artifact; omit to discover local artifacts`},section:{type:`string`,value:`<outline|files>`,help:`Choose the independently paginated collection`},source:{type:`boolean`,help:`Print complete native source locally, or complete LiteXML from Cloud`},download:{type:`boolean`,help:`Download the complete published manifest`},save:{type:`string`,value:`<file>`,help:`Save complete Cloud document source to a new file; supports structured output`},block:{type:`string`,value:`<id>`,help:`Read one published document block`},page:{type:`string`,value:`<pageId>`,help:`Read one page of a published whiteboard`},snapshot:{type:`string`,value:`<token>`,help:`Pin a published version`},cursor:{type:`string`,value:`<token>`,help:`Continue a manifest or outline page`},limit:{type:`string`,value:`<1-100>`,help:`Maximum outline or manifest rows`},out:{type:`string`,value:`<dir>`,help:`Download files here instead of ~/.cache/ryugi/get/<id>/`},"no-comments":{type:`boolean`,help:`Leave a document's comments out`}},positionals:1};function Uj({data:e}){return{heading:`Hook`,status:e.status,summary:e.error??``,facts:[Z(`Version`,X(e,`version`))],sections:[]}}const Wj={name:`hook`,summary:`Download the ryugi-hook binary a plugin version runs its hooks with`,usage:[`install <version> [--background]`],details:`install downloads ryugi-hook for this platform from the plugin release of <version>, checks its sha256 and keeps it in ~/.ryugi/hook/<version>. The plugin launcher runs it with --background when a hook finds no binary; that waits out the retry delay after a failed download, which a person running it skips.`,positionals:2,options:{background:{type:`boolean`,help:`Wait out the retry delay after a failed download`}},semantic:e=>Q({id:`hook`,mode:`finite`,output:{formats:[`brief`,`json`,`quiet`],scalar:e=>e.status},async run(){let[t,n]=e.positionals;if(t!==`install`)throw new M(`Usage: adeck hook install <version>`);if(!n||!at(n))throw new M(`hook install needs a release version, not ${n??`nothing`}`);let r=await mt({arch:process.arch,fetch,home:h.default.homedir(),platform:process.platform,retry:!e.values.background,version:n}),i=r.status===`present`||r.status===`installed`,a={action:t,version:n,status:r.status};return r.error&&(a.error=r.error),Y(a,i?{kind:`succeeded`}:{kind:`failed`,error:{code:`E_HOOK_INSTALL`,message:r.error??`ryugi-hook ${n} is not available here (${r.status})`}})},present:Uj},e)},Gj=`icons/index.json`,Kj=/* @__PURE__ */ new Map;function qj(e){let t=Kj.get(e);if(t===void 0){try{t=JSON.parse(d.default.readFileSync(f.default.join(e,Gj),`utf8`))}catch{t=null}Kj.set(e,t??null)}return t??null}const Jj=e=>e.toLowerCase().match(/[a-z0-9]+/g)??[];function Yj(e,t,n,r){if(t===e)return 8;if(t.split(`-`).includes(e))return 5;let i=r.indexOf(e);return i===-1?n.some(t=>t===e||t.split(`-`).includes(e))?3:t.includes(e)?2:+!!r.some(t=>Jj(t).some(t=>t.startsWith(e))):i<3?4:i<8?3:2}function Xj(e,t,n=10){let r=Jj(t),i=t.trim().toLowerCase(),a=/* @__PURE__ */ new Map;for(let[t,n]of Object.entries(e.aliases))a.set(n,[...a.get(n)??[],t]);let o=[];for(let[t,n]of Object.entries(e.icons)){let e=a.get(t)??[],s=0,c=0;for(let i of r){let r=Yj(i,t,e,n);r>0&&s++,c+=r}(t===i||e.includes(i))&&(s+=r.length),s&&o.push({icon:{name:t,aliases:e,tags:n},matched:s,score:c})}return o.sort((e,t)=>t.matched-e.matched||t.score-e.score||e.icon.name.length-t.icon.name.length||e.icon.name.localeCompare(t.icon.name)).slice(0,n).map(({icon:e})=>e)}function Zj({data:e}){return{heading:`Icons`,status:e.icons.length?``:`none`,subject:e.query,summary:e.icons.length?`${e.icons.length} Lucide icons · use the first column as <ryugi-icon name>`:`no Lucide icon fits; try other English words`,facts:[],sections:[{kind:`records`,key:`icons`,rows:e.icons.map(e=>({name:e.name,aliases:e.aliases.join(` `),tags:e.tags.slice(0,8).join(`, `)})),columns:[{key:`name`,positional:!0,required:!0},{key:`tags`,positional:!0},{key:`aliases`,label:`also`}]}]}}const Qj={name:`icons`,summary:`Find Lucide icon names for <ryugi-icon> by what the icon should show`,usage:[`<words> [--limit <1-50>] [options]`],details:"Searches the Lucide icons ryugi-icon draws by their names, earlier names and Lucide tags, in English: `adeck icons delete trash`. Icons fitting every word come first. Runs offline, without a server.",options:{limit:{type:`string`,value:`<1-50>`,help:`Maximum icons to list (default 10)`}},positionals:16,semantic:e=>{let t=e.positionals.join(` `).trim();if(!t)throw new M(`Name what the icon should show, in English: adeck icons <words> (e.g. adeck icons delete trash)`);let n=e.values.limit,r=n===void 0?10:Number(n);if(!Number.isInteger(r)||r<1||r>50)throw new M(`--limit must be a whole number from 1 to 50`);return Q({id:`icons`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`],fields:[`name`,`tags`,`aliases`],collection:`icons`,requiredFields:[`name`]},run:()=>{let e=f.default.join(__dirname,`runtime`),n=qj(e);if(!n)throw new M(`This install has no icon index: ${f.default.join(e,Gj)}`);return Y({query:t,icons:Xj(n,t,r)})},present:Zj},e)}},$j=`Innei/ryugi`,eM={artifacts:`ryugi-artifacts@ryugi-dev`,full:`ryugi@ryugi-dev`};function tM(e,t=process.platform){return t===`win32`?{command:[`claude`,...e].join(` `),args:[],shell:!0}:{command:`claude`,args:e,shell:!1}}function nM(e){let{command:t,args:n,shell:r}=tM(e);return(0,p.spawnSync)(t,n,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`],shell:r})}function rM(e){let t=nM(e);if(t.error||t.status!==0)throw Error(`claude ${e.join(` `)} failed: ${(t.stderr||t.stdout||t.error?.message||``).trim()}`);return t.stdout}function iM(){let e=nM([`--version`]);return!e.error&&e.status===0}function aM(e){if(!d.default.existsSync(e))return{};let t=JSON.parse(d.default.readFileSync(e,`utf8`)).enabledPlugins;return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}function oM(){let e=JSON.parse(rM([`plugin`,`marketplace`,`list`,`--json`]));if(!Array.isArray(e))throw Error(`claude plugin marketplace list returned no list`);return e.some(e=>e?.name===`ryugi-dev`)}function sM(e){let t=JSON.parse(rM([`plugin`,`list`,`--json`]));if(!Array.isArray(t))throw Error(`claude plugin list returned no list`);return t.some(t=>t?.id===e&&t?.scope===`user`)}const cM=e=>e===`artifacts`||e===`full`;async function lM(e,t,n){let r=e=>Y({mode:null,harness:`claude-code`,installed:null,disabled:[]},{kind:`validation_failed`},{warnings:[{code:`W_INSTALL_MODE`,message:e,severity:`error`}]});if(e!==void 0&&!cM(e))return r(`--mode takes artifacts or full`);if(!iM())return Y({mode:cM(e)?e:null,harness:`none`,installed:null,disabled:[]},{kind:`succeeded`},{warnings:[{code:`W_NO_CLAUDE_CODE`,message:`Claude Code was not found; artifacts only is Claude Code only. Install the full plugin by hand on other harnesses.`,severity:`warning`}],actions:[{kind:`url`,label:`Install guide`,url:`https://github.com/Innei/ryugi/blob/main/docs/install.md#artifacts-only`}]});let i=process.env.CLAUDE_CONFIG_DIR||f.default.join(h.default.homedir(),`.claude`),a=aM(f.default.join(i,`settings.json`));if(!cM(e))return r(`--mode artifacts|full is required`);let o=e,s=eM[o],c=eM[o===`artifacts`?`full`:`artifacts`],l=(e,t,r)=>{let i=n?.begin(e,t);rM(r),i!==void 0&&n.confirm(i)};oM()||l(`install.marketplace`,$j,[`plugin`,`marketplace`,`add`,$j,`--scope`,`user`]),l(`install.refresh`,`ryugi-dev`,[`plugin`,`marketplace`,`update`,`ryugi-dev`]),sM(s)?l(`install.update`,s,[`plugin`,`update`,s,`--scope`,`user`]):l(`install.plugin`,s,[`plugin`,`install`,s,`--scope`,`user`]);let u=[];a[c]===!0&&(l(`install.disable`,c,[`plugin`,`disable`,c,`--scope`,`user`]),u.push(c));let d=[],p=[];for(let[e,n]of[[`project`,`settings.json`],[`local`,`settings.local.json`]])aM(f.default.join(t,`.claude`,n))[c]===!0&&(d.push({code:`W_OTHER_VARIANT_ENABLED`,message:`${c} is still enabled at ${e} scope; enable only one Ryugi entry`,severity:`warning`}),p.push({kind:`command`,argv:[`claude`,`plugin`,`disable`,c,`--scope`,e],label:`Disable at ${e} scope`}));return Y({mode:o,harness:`claude-code`,installed:s,disabled:u},{kind:`succeeded`},{warnings:d,actions:p})}async function uM(e,t,n=!1,r=!1){let i={bin:null,mode:null,owner:null,targets:[]},a=e=>Y(i,{kind:`validation_failed`},{warnings:[{code:`E_INSTALL_PLAN`,message:e,severity:`error`}]}),o=f.default.resolve(e.values[`install-dir`]||kO()),s=new FO(o).current(),c=f.default.resolve(e.values[`bin-dir`]||(s?f.default.dirname(s.bin):AO())),l=RO(o);if(e.values.mode!==void 0&&![`artifacts`,`full`].includes(String(e.values.mode)))return a(`--mode takes artifacts or full`);let p=(e.values.harness===`none`?[]:gO()).filter(e=>e.detected).map(e=>e.id),m={...l.harnesses},g=f.default.join(process.env.CLAUDE_CONFIG_DIR||f.default.join(h.default.homedir(),`.claude`),`settings.json`);if(!m[`claude-code`]&&p.includes(`claude-code`)&&d.default.existsSync(g)){let e=JSON.parse(d.default.readFileSync(g,`utf8`)).enabledPlugins||{},t=e[`ryugi@ryugi-dev`]===!0?`full`:e[`ryugi-artifacts@ryugi-dev`]===!0?`artifacts`:null;t&&(m[`claude-code`]={harness:`claude-code`,mode:t,digest:``,path:``,version:`native-marketplace`})}let _={root:o,binDir:c,detected:p,previous:m,selection:l.selection},v;try{if(n&&!e.values.yes){let t;e.values.mode&&e.values.harness&&(t=aj({mode:String(e.values.mode),harness:String(e.values.harness)},_)),v=await sj(_,t)}else v=aj({mode:e.values.mode,harness:e.values.harness},_)}catch(e){return a(e.message)}if(!v)return Y(i,{kind:`interrupted`,signal:`SIGINT`});i.mode=v.mode;let y=[],b=[],x=n?cj():null,S,C=!1,w=e=>{x?x.start(e):t.progress({phase:e})};try{if(!e.values[`no-cli`]){t.signal.throwIfAborted();let e=OO(__filename,process.env);if(e.kind===`global`||e.kind===`unknown`){if(e.kind===`unknown`)return a(`Cannot identify CLI ownership; use --no-cli to install plugins while retaining this CLI.`);i.owner=e.pm,i.bin=process.argv[1]||__filename}else{w(`Installing persistent CLI`);let e=new FO(o,c);e.preflight();let n=t.effects.begin(`install.runtime`,o),r=e.install(f.default.resolve(__dirname,`..`));t.effects.confirm(n,r),i.bin=r.bin,i.owner=`ryugi`,x?.stop(`Persistent CLI installed`);let a=IO(c);a&&y.push({code:`W_PATH`,severity:`warning`,message:a})}}for(let n of v.targets){if(await new Promise(e=>setImmediate(e)),t.signal.aborted){i.targets.push({harness:n,mode:v.mode,status:`not_attempted`});continue}w(`Installing ${v.mode} into ${n}`);let r=t.effects.begin(`install.harness`,n);try{if(n===`claude-code`){let r=l.harnesses[n];if(r&&oO(r,hO)===`foreign`)throw Error(`Native Claude source changed; preserving it`);let a=await lM(v.mode,e.projectDir,t.effects);if(!a.data.installed)throw Error(`Claude Code plugin was not installed`);let o=aO(a.data.installed,hO);l.harnesses[n]={harness:n,mode:v.mode,version:o.version,path:o.path,nativeSource:o.source,digest:``,registration:a.data.installed},y.push(...a.warnings),b.push(...a.actions),i.targets.push({harness:n,mode:v.mode,status:`installed`,installed:a.data.installed,disabled:a.data.disabled})}else{S||(S=e.values[`plugin-source`],S||(S=fO(o,e.values[`plugin-version`]||`1.113.1`),C=!0));let r=f.default.join(o,`candidates`,(0,u.randomUUID)());try{let e=dO(S,r,v.mode);l.harnesses[n]=bO(n,e,{root:o,previous:l.harnesses[n],effects:t.effects})}finally{d.default.rmSync(r,{recursive:!0,force:!0})}i.targets.push({harness:n,mode:v.mode,status:`installed`,installed:l.harnesses[n].path})}zO(o,l),t.effects.confirm(r),x?.stop(`${n} installed; start a new session`),y.push({code:`W_NEW_SESSION`,severity:`warning`,message:`${n}: start a new session. ${mO.find(e=>e.id===n).comments}. Comment delivery has not been verified by this installer.`})}catch(e){i.targets.push({harness:n,mode:v.mode,status:`failed`,error:e.message}),x?.stop(`${n} failed`)}}}finally{x?.stop(),C&&S&&d.default.rmSync(S,{recursive:!0,force:!0})}r||(l.selection={mode:v.mode,targets:v.targets});let T=t.effects.begin(`install.selection`,o);zO(o,l),t.effects.confirm(T);let E=mj(await gj({cleanup:!1,root:o},t,n));y.push(...E.warnings);let ee=i.targets.filter(e=>e.status===`failed`),te=ee.length?[{kind:`command`,argv:[`adeck`,`install`,`--mode`,v.mode,`--harness`,ee.map(e=>e.harness).join(`,`),`--install-dir`,o,...e.values[`no-cli`]?[`--no-cli`]:[],...e.values[`bin-dir`]?[`--bin-dir`,c]:[],...e.values[`plugin-source`]?[`--plugin-source`,String(e.values[`plugin-source`])]:[]],label:`Retry failed targets`}]:[];return te.push(...b,...E.actions),t.signal.aborted?Y(i,{kind:`interrupted`,signal:`SIGINT`},{warnings:y,actions:te}):Y(i,ee.length?i.bin||i.targets.some(e=>e.status===`installed`)?{kind:`partial`}:{kind:`failed`,error:{code:`E_HARNESS_INSTALL`,message:ee.map(e=>`${e.harness}: ${e.error}`).join(`
|
|
954
|
+
`)}}:{kind:`succeeded`},{warnings:y,actions:te})}function dM({data:e}){return{heading:`Install`,status:e.targets.some(e=>e.status===`failed`)?`partial`:`installed`,summary:e.mode||``,facts:[Z(`Command`,X(e,`bin`)),Z(`Owner`,X(e,`owner`))],sections:[{kind:`records`,key:`targets`,title:`Harnesses`,rows:e.targets.map(e=>({...e})),columns:[{key:`harness`,required:!0},{key:`status`,required:!0},{key:`installed`},{key:`error`}]}]}}const fM={name:`install`,summary:`Install persistent CLI and Artifacts or full Ryugi into selected harnesses`,usage:[`[--mode artifacts|full] [--harness <targets|none>] [options]`],details:`Interactive terminal wizard; automation requires explicit mode and targets (or reuses recorded selections). --harness none installs only the CLI.`,options:{mode:{type:`string`,value:`artifacts|full`,help:`Content mode`},harness:{type:`string`,value:`<targets|none>`,help:`Comma-separated claude-code,codex,cursor,gemini,opencode,pi,copilot,agy; none for CLI only`},yes:{type:`boolean`,help:`Apply an explicit or recorded plan without terminal confirmation`},"no-cli":{type:`boolean`,help:`Keep the current CLI; install only harness plugins`},"install-dir":{type:`string`,value:`<path>`,help:`Managed runtime and installation state directory`},"bin-dir":{type:`string`,value:`<path>`,help:`Command directory (default ~/.local/bin)`},"plugin-source":{type:`string`,value:`<path>`,help:`Use an existing Ryugi plugin checkout (offline or development)`}},semantic(e){return{run(t,n,r,i){return Q({id:`install`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.bin},run:(n,r)=>uM(e,r,t.format===`brief`&&!!process.stdin.isTTY&&!!process.stderr.isTTY&&!process.env.CI),present:dM},e).run(t,n,r,i)}}}},pM=/^(?:[^@/]+@)?[^:/]+:(?!\/)(.+)$/;function mM(e){if(/^[a-z][a-z0-9+.-]*:\/\//i.test(e))try{let t=new URL(e);return t.protocol===`file:`?null:t.pathname}catch{return null}return pM.exec(e)?.[1]??null}function hM(e){let t=mM(e.trim());if(!t)return null;let n=t.replace(/\.git\/?$/,``).split(`/`).filter(Boolean);return n.length<2?null:n.join(`/`).toLowerCase()}function gM(e){try{return hM((0,p.execFileSync)(`git`,[`-C`,e,`remote`,`get-url`,`origin`],{encoding:`utf8`,timeout:2e3,stdio:[`ignore`,`pipe`,`ignore`],env:{...process.env,GIT_TERMINAL_PROMPT:`0`}}))??f.default.basename(e)}catch{return f.default.basename(e)}}var _M=`# Module vocabulary
|
|
955
|
+
|
|
956
|
+
Edit \`<project>/.ryugi/modules.json\`. A module is a lasting business area, such as billing or sharing, not a file, flag, task or ticket. Read the file immediately before edits and preserve unrelated modules and stable IDs.
|
|
957
|
+
|
|
958
|
+
\`\`\`json
|
|
959
|
+
{
|
|
960
|
+
"version": 1,
|
|
961
|
+
"modules": [
|
|
962
|
+
{
|
|
963
|
+
"id": "billing",
|
|
964
|
+
"name": "Billing",
|
|
965
|
+
"description": "Plans, quotas and invoices.",
|
|
966
|
+
"paths": ["src/billing/**"],
|
|
967
|
+
"aliases": []
|
|
968
|
+
}
|
|
969
|
+
]
|
|
970
|
+
}
|
|
971
|
+
\`\`\`
|
|
972
|
+
|
|
973
|
+
Use readable lowercase IDs. Give modules descriptions and repository path globs so an agent can choose by the artifact's subject. Start from the repository's structure, docs and existing artifact titles; do not invent a business decision the human needs to make. A vocabulary normally has 5–15 lasting areas, rather than one module per current task.
|
|
974
|
+
|
|
975
|
+
\`modules\` lists current modules, counts and maintenance hints. \`modules --artifact <type>/<id> --set billing,sharing\` replaces that artifact's tags, at most 3; \`--set ""\` clears. Choose IDs from this file. A new subject may need different tags; a missing/retired ID needs retagging. The artifact directory must already exist.
|
|
976
|
+
|
|
977
|
+
Before adding a module, read counts and hints. Add only when no description fits and the area will outlive the task. Rename by changing name while keeping id. Merge B into A by removing B and adding B's ID to A.aliases. Split A into A1/A2 by adding A's old ID to both new aliases. Removing without an alias leaves a retired label on old artifacts. Never reuse or change an ID. Fix clear maintenance hints, leave business judgments to the human, and report edits to this vocabulary explicitly.
|
|
978
|
+
|
|
979
|
+
The CLI writes artifact tags to project configuration and preserves other settings. Do not edit server state or Cloud metadata to assign tags.
|
|
980
|
+
`;const vM=`modules.json`,yM=/^[a-z0-9-]{1,40}$/,bM=`1 to 40 lowercase letters, digits and dashes`,xM=e=>e===void 0?[]:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:null;function SM(e,t){if(typeof e!=`object`||!e)return`module ${t+1} must be an object`;let{id:n,name:r,description:i=``,paths:a,aliases:o}=e;if(typeof n!=`string`||!yM.test(n))return`module id ${JSON.stringify(n)} must be ${bM}`;if(typeof r!=`string`||r.trim()===``)return`${n} needs a name`;if(r.length>60)return`${n}: a name is at most 60 characters`;if(typeof i!=`string`)return`${n}: description must be text`;if(i.length>200)return`${n}: a description is at most 200 characters`;let s=xM(a);if(!s)return`${n}: paths must be a list of globs`;let c=xM(o);if(!c)return`${n}: aliases must be a list of retired ids`;if(c.length>20)return`${n} has more than 20 aliases`;let l=c.find(e=>!yM.test(e));return l===void 0?{id:n,name:r,description:i,paths:s,aliases:c}:`alias ${JSON.stringify(l)} of ${n} must be ${bM}`}function CM(e){let t;try{t=JSON.parse(e)}catch(e){return{state:`invalid`,reason:`modules.json is not valid JSON: ${e.message}`}}let n=t?.modules;if(!Array.isArray(n))return{state:`invalid`,reason:`"modules" must be a list`};if(n.length>100)return{state:`invalid`,reason:`a vocabulary has at most 100 modules`};let r=[],i=/* @__PURE__ */ new Set;for(let[e,t]of n.entries()){let n=SM(t,e);if(typeof n==`string`)return{state:`invalid`,reason:n};if(i.has(n.id))return{state:`invalid`,reason:`duplicate module id: ${n.id}`};i.add(n.id),r.push(n)}for(let{id:e,aliases:t}of r){let n=t.find(e=>i.has(e));if(n!==void 0)return{state:`invalid`,reason:`alias ${JSON.stringify(n)} of ${e} is a live module id`}}return{state:`ok`,modules:r}}function wM(e){let t;try{t=d.default.readFileSync(f.default.join(e,vM),`utf8`)}catch{return{state:`missing`}}return CM(t)}function TM(e,t){let n=/* @__PURE__ */ new Set,r=[];for(let i of t){let t=e.some(e=>e.id===i)?[i]:e.filter(e=>e.aliases.includes(i)).map(e=>e.id);t.length===0&&r.push(i);for(let e of t)n.add(e)}return r.length?{unknown:r}:{ids:[...n].sort()}}const EM=`.ryugi/${vM}`,DM=e=>f.default.dirname(ce(e).root),OM=e=>f.default.join(DM(e),`config.json`);function kM(e,t){if(!ue.test(t))throw new M(de);if(!d.default.existsSync(f.default.join(ce(e).root,t)))throw new M(`No such artifact: ${t}`)}function AM(e){let t=wM(DM(e));if(t.state===`missing`)throw new M(`This project has no vocabulary. Create ${EM} first.`);if(t.state===`invalid`)throw new M(`${EM} is invalid: ${t.reason}`);return t.modules}function jM(e,t,n,r=()=>{}){kM(e,t);let i=AM(e),a=TM(i,n.split(`,`).map(e=>e.trim()).filter(Boolean));if(`unknown`in a)throw new M(`Unknown module: ${a.unknown.join(`, `)}. Choose from: ${i.map(({id:e})=>e).join(`, `)}.`);if(a.ids.length>3)throw new M(`An artifact has at most 3 modules; pick the ones it is mainly about.`);let o=OM(e);return r(),kC(o),AC(o,t,{modules:a.ids}),{artifact:t,modules:a.ids}}function MM(e){let t=/* @__PURE__ */ new Map,n=0;for(let{modules:r}of Object.values(EC(OM(e)).config.artifacts))if(r?.length){n+=1;for(let e of r)t.set(e,(t.get(e)??0)+1)}return{counts:t,tagged:n}}const NM=e=>e.replace(/\/?\*+$/,``).replace(/\/$/,``),PM=(e,t)=>e===t||e.startsWith(`${t}/`);function FM(e){let t=[];for(let[n,r]of e.entries())for(let i of e.slice(n+1)){let e=r.paths.flatMap(e=>i.paths.map(t=>[e,t])).find(([e,t])=>PM(NM(e),NM(t))||PM(NM(t),NM(e)));e&&t.push(`paths overlap: ${r.id} and ${i.id} (${e[0]} and ${e[1]})`)}return t}function IM(e,t,n){let r=e.filter(({id:e})=>!t.get(e)).map(({id:e})=>e);return[...e.length>20?[`${e.length} modules, more than 20: merge the ones that are always chosen together`]:[],...n>=20&&r.length?[`no artifacts: ${r.join(`, `)} — merge them into a neighbour or remove them`]:[],...FM(e)]}function LM(e,{cloud:t,artifact:n}={}){n&&kM(e,n);let r=n?{current:EC(OM(e)).config.artifacts[n]?.modules??null}:{},i=wM(DM(e)),a=t?`cloud`:`local`;if(i.state!==`ok`)return{file:EM,state:i.state,...i.state===`invalid`?{reason:i.reason}:{},modules:[],counts:a,hints:[],...n?{artifact:n}:{},...r};let o=MM(e),s=t?new Map(t.modules.map(({id:e,count:t})=>[e,t])):o.counts,c=t?t.tagged:o.tagged;return{file:EM,state:`ok`,modules:i.modules.map(e=>({...e,count:s.get(e.id)??0})),counts:a,hints:IM(i.modules,s,c),...n?{artifact:n}:{},...r}}async function RM(e,t){try{let{status:n,json:r}=await ET(e).call(`GET`,`/api/cloud/artifacts`,void 0,t);if(n!==200)return;let i=gM(ce(e).project);return r.vocabularies?.[i]}catch{return}}function zM({data:e}){let t=e.state===`missing`?`no vocabulary: create ${e.file}`:e.state===`invalid`?`invalid: ${e.reason}`:``;return{heading:`Modules`,status:e.state===`ok`?``:e.state,subject:e.artifact,summary:t||`${e.modules.length} · ${e.file} · counts from ${e.counts===`cloud`?`Cloud`:`this checkout only`}`,facts:e.current===void 0?[]:[Z(`Current`,{key:`current`,value:e.current===null?`never tagged`:e.current.length?e.current.join(`, `):`cleared`})],sections:[...e.writing?[{kind:`content`,key:`writing`,title:`Writing`,text:e.writing}]:[],{kind:`records`,key:`modules`,rows:e.modules.map(e=>({...e,paths:e.paths.join(` `)})),columns:[{key:`id`,positional:!0,required:!0},{key:`count`,positional:!0,required:!0},{key:`name`,positional:!0},{key:`description`,positional:!0},{key:`paths`,positional:!0}]},{kind:`diagnostics`,key:`hints`,items:e.hints.map(e=>({code:`W_MODULES_MAINTENANCE`,message:e,severity:`warning`}))}]}}function BM({data:e}){return{heading:`Modules`,status:`SET`,subject:e.artifact,summary:e.modules.length?e.modules.join(`, `):`cleared`,facts:[],sections:[]}}const VM={name:`modules`,summary:`List the project's business modules, or set the modules an artifact serves`,usage:[`[--artifact <type>/<id>] [options]`,`--artifact <type>/<id> --set <id>[,<id>...]`],details:_M.trim(),options:{artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact to show or tag`},set:{type:`string`,value:`<id>[,<id>...]`,help:`Replace the artifact’s modules with these ids`}},semantic:e=>{let t=e.values.artifact,n=e.values.set;if(n!==void 0){if(!t)throw new M(`--set needs --artifact <type>/<id>`);return Q({id:`modules.set`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.modules.join(`,`)},run:(r,i)=>{let a,o=jM(e.projectDir,t,n,()=>{a=i.effects.begin(`modules.set`,t)});return a!==void 0&&i.effects.confirm(a),Y(o)},present:BM},e)}return Q({id:`modules`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`],fields:[`id`,`count`,`name`,`description`,`paths`,`aliases`],collection:`modules`,requiredFields:[`id`,`count`]},async run(n,r){let i=await RM(e.projectDir,r.signal),a=LM(e.projectDir,{cloud:i,artifact:t});return Y({...a,project:e.projectDir,write:f.default.join(e.projectDir,a.file),...a.state===`ok`?{}:{writing:_M.trim()}})},present:zM},e)}};var HM=/* @__PURE__ */ (e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(HM||{});const UM=[0,1],WM=[1,0],GM=[2,3],KM=[3,2],qM={L:UM,M:WM,Q:GM,H:KM},JM=/^\d*$/,YM=/^[A-Z0-9 $%*+./:-]*$/,XM=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,ZM=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],QM=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];var $M=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<1||e>40)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,HM.Timing),this.setFunctionModule(e,6,e%2==0,HM.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,tN(r,e));this.setFunctionModule(8,7,tN(r,6)),this.setFunctionModule(8,8,tN(r,7)),this.setFunctionModule(7,8,tN(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,tN(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,tN(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,tN(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=tN(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,HM.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,HM.Alignment)}setFunctionModule(e,t,n,r=HM.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==gN(t,n))throw RangeError(`Invalid argument`);let r=QM[n[0]][t],i=ZM[n[0]][t],a=Math.floor(hN(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=_N(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=vN(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(hN(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=tN(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=3:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*40),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*40}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=3:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*40),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*40}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=3)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*10,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function eN(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function tN(e,t){return!!(e>>>t&1)}var nN=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}};const rN=[1,10,12,14],iN=[2,9,11,13],aN=[4,8,16,16];function oN(e,t){return e[Math.floor((t+7)/17)+1]}function sN(e){let t=[];for(let n of e)eN(n,8,t);return new nN(aN,e.length,t)}function cN(e){if(!dN(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);eN(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new nN(rN,e.length,t)}function lN(e){if(!fN(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=XM.indexOf(e.charAt(n))*45;r+=XM.indexOf(e.charAt(n+1)),eN(r,11,t)}return n<e.length&&eN(XM.indexOf(e.charAt(n)),6,t),new nN(iN,e.length,t)}function uN(e){return e===``?[]:dN(e)?[cN(e)]:fN(e)?[lN(e)]:[sN(mN(e))]}function dN(e){return JM.test(e)}function fN(e){return YM.test(e)}function pN(e,t){let n=0;for(let r of e){let e=oN(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function mN(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function hN(e){if(e<1||e>40)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function gN(e,t){return Math.floor(hN(e)/8)-ZM[t[0]][e]*QM[t[0]][e]}function _N(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=yN(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=yN(n,2)}return t}function vN(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=yN(t,e))}return n}function yN(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function bN(e,t,n=1,r=40,i=-1,a=!0){if(!(1<=n&&n<=r&&r<=40)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=gN(o,t)*8,i=pN(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[WM,GM,KM])a&&s<=gN(o,e)*8&&(t=e);let c=[];for(let t of e){eN(t.mode[0],4,c),eN(t.numChars,oN(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=gN(o,t)*8;eN(0,Math.min(4,l-c.length),c),eN(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)eN(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new $M(o,t,u,i)}function xN(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?uN(e):Array.isArray(e)?[sN(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=bN(c,qM[n],i,a,o,r),u=SN({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function SN(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=HM.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function CN(e,t,n,r=!1){return t<0||n<0||t>=e.length||n>=e.length?r:e[n][t]}function wN(e,t={}){let n={WHITE_ALL:`█`,WHITE_BLACK:`▀`,BLACK_WHITE:`▄`,BLACK_ALL:` `},r=xN(e,t),i=(e,t)=>CN(r.data,e,t,!0),a=[],o=``;for(let e=0;e<r.size;e+=2){for(let t=0;t<r.size;t++)i(t,e)===!1&&i(t,e+1)===!1?o+=n.WHITE_ALL:i(t,e)===!1&&i(t,e+1)===!0?o+=n.WHITE_BLACK:i(t,e)===!0&&i(t,e+1)===!1?o+=n.BLACK_WHITE:o+=n.BLACK_ALL;a.push(o),o=``}return a.join(`
|
|
981
|
+
`)}const TN=e=>typeof e==`object`&&!!e&&typeof e.code==`string`&&typeof e.url==`string`;function EN(e){if(e.status>=200&&e.status<300)return e.json;let t=e.json;throw new J({code:e.status===401?`E_LOGIN_REQUIRED`:typeof t.code==`string`?`E_${t.code.toUpperCase()}`:`E_HTTP_${e.status}`,message:typeof t.error==`string`?t.error:`Cloud request failed: HTTP ${e.status}`,httpStatus:e.status,details:{...t.loginUrl?{loginUrl:t.loginUrl}:{},...TN(t.login)?{loginUrl:t.login.url,signInCode:t.login.code}:{},...t.upgradeUrl?{upgradeUrl:t.upgradeUrl}:{},...t.limit?{limit:t.limit}:{},...t.plan?{plan:t.plan}:{},...t.reasons?{reasons:t.reasons}:{}}},e.status===401||e.status===402&&(t.code===`plan_limit`||t.code===`plan_required`)?`action_required`:`failed`)}const DN=[`brief`,`json`,`jsonl`,`quiet`],ON=/^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$/i;function kN(e){let{values:t}=e,n=[`unpublish`,`revoke-key`,`list`,`delete`,`login`,`logout`,`move-to`].filter(e=>t[e]),r=!!(t.key||t[`new-key`]);if(n.length>1||t.public&&t.private||t.public&&r||t.profile&&t[`no-profile`]||r&&t[`revoke-key`])throw new J({code:`E_OPTION_CONFLICT`,message:`Choose one publish action and one visibility.`});let i=n[0]??`publish`;if(i!==`publish`&&r||t.key&&t[`new-key`]||t.artifact!==void 0&&![`publish`,`unpublish`,`revoke-key`,`list`].includes(i)||t.from!==void 0&&i!==`login`||t[`with-token`]&&i!==`login`)throw new J({code:`E_OPTION_UNSUPPORTED`,message:`Key creation applies only to publishing; artifact targets apply to publishing, key revocation or targeted --list; --from and --with-token apply only to --login. Choose either --key or --new-key.`});if(i!==`list`&&[`visibility`,`type`,`project`,`module`,`limit`,`cursor`].some(e=>t[e]!==void 0))throw new J({code:`E_OPTION_UNSUPPORTED`,message:`List filters and paging apply only to --list.`});let a=t.artifact;if(([`publish`,`unpublish`,`revoke-key`].includes(i)||i===`list`&&a!==void 0)&&(!a||!ue.test(a)))throw new J({code:`E_ARGUMENT_INVALID`,message:`--artifact must be <type>/<id>.`});if(i===`list`&&a&&[`visibility`,`type`,`project`,`module`,`limit`,`cursor`,`fields`].some(e=>t[e]!==void 0))throw new J({code:`E_OPTION_UNSUPPORTED`,message:`Targeted --list --artifact reads publication and key state; collection filters and paging apply only without --artifact.`});if(i===`delete`&&!/^[\w-]{1,64}$/.test(String(t.delete??``)))throw new J({code:`E_ARGUMENT_INVALID`,message:`--delete requires a Cloud artifact ID.`});if(i!==`publish`&&(t.public||t.private||t[`no-refs`]||t.profile||t[`no-profile`]))throw new J({code:`E_OPTION_UNSUPPORTED`,message:`Visibility, profile listing and --no-refs apply only to publishing.`});if(t.expires!==void 0&&!r)throw new J({code:`E_OPTION_UNSUPPORTED`,message:`--expires applies only with --key or --new-key.`});if(i===`move-to`&&(!ON.test(String(t[`move-to`]))||String(t[`move-to`]).toLowerCase()===`personal`))throw new J({code:`E_ARGUMENT_INVALID`,message:`--move-to requires the slug of a team you belong to.`});let o=t.space;if(o!==void 0&&i!==`publish`)throw new J({code:`E_OPTION_UNSUPPORTED`,message:`--space applies only to publishing.`});if(o!==void 0&&!ON.test(o))throw new J({code:`E_ARGUMENT_INVALID`,message:`--space must be a team slug or "personal".`});if(t.expires!==void 0&&!vC(t.expires))throw new J({code:`E_ARGUMENT_INVALID`,message:`--expires must be 1d, 7d, 30d or never.`});let s=r?{...t.expires?{expires:t.expires}:{},...t[`new-key`]?{regenerate:!0}:{}}:void 0;return{action:i,artifact:a,key:s,space:o?.toLowerCase(),onProfile:t.profile?!0:!t[`no-profile`]&&void 0,visibility:t.public?`public`:t.private||s?`private`:void 0}}function AN(e,t,n){return Q({id:`publish.${t}`,mode:`finite`,output:{formats:t===`login`?[`brief`,`json`,`jsonl`]:DN,scalar:e=>e.id},async run(r,i){let a=t===`delete`?String(e.values.delete):n,o=[`login`,`logout`,`move-to`].includes(t)?`POST`:`DELETE`,s=t===`delete`?`/api/cloud/artifacts/${a}`:t===`unpublish`?`/api/cloud/publish/${a}`:t===`revoke-key`?`/api/cloud/share-key/${a}`:t===`move-to`?`/api/cloud/transfer`:`/api/cloud/${t}`,c=t===`login`?void 0:i.effects.begin(t,a??`cloud-account`),l=typeof e.values.from==`string`?e.values.from:`cli`,u;if(t===`login`){if(e.values[`with-token`]){let e=[];for await(let t of process.stdin)e.push(Buffer.from(t));let t=Buffer.concat(e).toString(`utf8`).trim();if(!t)throw new J({code:`E_ARGUMENT_INVALID`,message:`Pass an access token on stdin when using --login --with-token.`});u={token:t}}else u={source:l}}let d=await ET(e.projectDir).call(o,s,t===`move-to`?{space:String(e.values[`move-to`]).toLowerCase()}:u,i.signal);c!==void 0&&d.status>=400&&d.status<500&&i.effects.set(c,`failed`);let f=EN(d);c!==void 0&&i.effects.confirm(c);let p=t===`login`&&TN(f.pending)?f.pending:null,m=t===`login`&&!f.signedIn?{kind:`pending`,reasons:[`sign_in_code_unconfirmed`]}:t===`logout`&&f.remoteRevoked!==!0?{kind:`partial`}:{kind:`succeeded`};return Y({id:t===`logout`?`signed-out`:f.id??a??`cloud-account`,artifact:a,status:t===`login`?f.signedIn?`signed_in`:`pending`:t===`logout`?`signed_out`:t===`move-to`?`moved`:t===`delete`?`deleted`:t===`revoke-key`?`key_removed`:`unpublished`,...f.url?{url:f.url}:{},...p?{code:p.code,url:p.url,expiresAt:p.expiresAt,autoPublish:f.autoPublish===!0?`on`:`off until you turn it on: ${process.env.RYUGI_ARTIFACTS_COMMAND||`npx artideck`} config --auto-publish on`}:{},...t===`logout`?{localCredentials:`cleared`,remoteSession:f.remoteRevoked===!0?`revoked`:`unknown`}:{}},m,{effects:i.effects.snapshot(),actions:p?[{kind:`url`,url:p.url,label:`Confirm the code`}]:f.url?[{kind:`url`,url:f.url,label:`Open`}]:[]})},present({data:e}){return{heading:t===`login`?`Login`:t===`logout`?`Logout`:`Cloud artifact`,status:e.status,subject:e.id,facts:[...e.artifact?[Z(`Artifact`,X(e,`artifact`))]:[],...e.code?[Z(`Code`,X(e,`code`))]:[],...e.url?[Z(`URL`,X(e,`url`))]:[],...e.expiresAt?[Z(`Expires`,X(e,`expiresAt`))]:[],...e.autoPublish?[Z(`Auto-publish`,X(e,`autoPublish`))]:[],...e.remoteSession?[Z(`Remote session`,X(e,`remoteSession`))]:[]],sections:e.url&&e.code?[{kind:`content`,key:`qr`,text:wN(e.url)}]:[]}}},e)}async function jN(e,t,n,r,i,a){let o=ET(e.projectDir),s=await(async(e,n)=>{let r=t.effects.begin(`publish`,e),a={...n?{visibility:n}:{},...i===void 0?{}:{onProfile:i}},s=await o.call(`POST`,`/api/cloud/publish/${e}`,Object.keys(a).length?a:void 0,t.signal);s.status>=400&&s.status<500&&t.effects.set(r,`failed`,s.json);let c=EN(s);return t.effects.confirm(r,{url:c.url,visibility:c.visibility,version:c.version}),c})(n,r),c;if(a||s.keyed){let e=a?t.effects.begin(`share-key`,n):void 0,r=await o.call(a?`PUT`:`GET`,`/api/cloud/share-key/${n}`,a,t.signal);e!==void 0&&r.status>=400&&r.status<500&&t.effects.set(e,`failed`);let i=EN(r);if(i.shareKey===void 0||a&&!i.shareKey)throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server did not confirm the share-key state.`});c=i.shareKey??void 0,e!==void 0&&t.effects.confirm(e,{expiresAt:c?.expiresAt})}let l=EN(await o.call(`GET`,`/api/cloud/refs/${n}?visibility=${s.visibility}&referrers=0`,void 0,t.signal)),u=e.values[`no-refs`]?[]:l.items.filter(e=>e.checked&&e.state!==`private`),d=/* @__PURE__ */ new Map;if(u.length){let e=new Map(u.map(e=>[e.artifact,t.effects.begin(`publish`,e.artifact)])),r=EN(await o.call(`POST`,`/api/cloud/publish-refs/${n}`,{visibility:s.visibility,refs:u.map(e=>e.artifact),makePublic:[]},t.signal));for(let n of r.results){d.set(n.artifact,n);let r=e.get(n.artifact);r!==void 0&&(n.status===`published`?t.effects.confirm(r,{}):n.status===`failed`?t.effects.set(r,`failed`,n.error):n.status===`not_attempted`&&t.effects.set(r,`not_attempted`))}}let f=e=>{try{EN({status:e.error?.httpStatus??500,json:e.error??{}})}catch(e){return LC(e)}},p={publish:`published`,update:`updated`,"make-public":`made_public`},m=l.items.map(e=>{let t={artifact:e.artifact,state:e.state,via:e.via},n=d.get(e.artifact);if(n){let e=n.status===`published`?void 0:f(n);return{...t,status:n.status===`published`?p[n.action]:n.status,...e?{error:e}:{}}}return e.reason===`upstream`?{...t,status:`unreachable`}:e.state===`unpublished`||e.state===`stale`?{...t,status:`skipped`}:{...t,status:e.state}}),h=m.some(e=>[`failed`,`unknown`,`not_attempted`].includes(e.status)),g={status:h?`partial`:`published`,artifact:n,id:s.id??new URL(s.url).pathname.split(`/`).filter(Boolean).at(-1),url:c?.url??s.url,visibility:s.visibility,...s.version===void 0?{}:{version:s.version},visibilitySource:r?`requested`:`preserved`,onProfile:s.onProfile===!0,onProfileSource:i===void 0?`preserved`:`requested`,...c?{shareKey:{key:c.key,expiresAt:c.expiresAt}}:{},references:m},_=m.filter(e=>e.status===`private`),v=m.filter(e=>e.status===`skipped`);return Y(g,h?{kind:`partial`}:{kind:`succeeded`},{effects:t.effects.snapshot(),warnings:[...(Array.isArray(s.notes)?s.notes:[]).filter(e=>typeof e==`string`).map(e=>({code:`W_CUT_NOT_PUBLISHED`,message:e})),...i&&s.visibility!==`public`?[{code:`W_PROFILE_NEEDS_PUBLIC`,message:`It will show on your profile once it is public.`}]:[],..._.length?[{code:`W_REFERENCES_PRIVATE`,message:`${_.length} referenced artifacts are private; visitors see a locked label.`}]:[],...v.length?[{code:`W_REFERENCES_UNPUBLISHED`,message:`${v.length} referenced artifacts were left as they are (--no-refs).`}]:[]],actions:[...m.flatMap(e=>e.error?hw(e.error,e.artifact):[]),..._.map(t=>lw([`publish`,`--artifact`,t.artifact,`--project-dir`,e.projectDir,`--public`],`Next`)),...v.length&&!h?[lw([`publish`,`--artifact`,n,`--project-dir`,e.projectDir],`Next`)]:[]]})}function MN({data:e}){return{heading:`Publish`,status:e.status,subject:e.artifact,facts:[Z(`ID`,X(e,`id`),!0),Z(`URL`,X(e,`url`),!0),Z(`Visibility`,{key:`visibility`,value:`${e.visibility} (${e.visibilitySource})`},!0),...e.visibility===`public`?[Z(`Profile`,{key:`onProfile`,value:e.onProfile?`listed`:`not listed`},!0)]:[],...e.shareKey?[Z(`Key`,{key:`shareKey.key`,value:e.shareKey.key},!0),Z(`Expires`,{key:`shareKey.expiresAt`,value:e.shareKey.expiresAt??`never`},!0)]:[],...e.version===void 0?[]:[Z(`Version`,X(e,`version`))]],sections:e.references.length?[{kind:`records`,key:`references`,title:`Referenced artifacts`,rows:e.references.map(e=>({artifact:e.artifact,status:e.status,via:e.via?`via ${e.via}`:``,error:e.error?`${e.error.code}: ${e.error.message}`:``,recovery:e.status===`unknown`?`inspect the remote artifact before retrying`:``})),columns:[{key:`artifact`,positional:!0,required:!0},{key:`status`,positional:!0,required:!0},{key:`via`,positional:!0},{key:`error`,positional:!0},{key:`recovery`,positional:!0}]}]:[]}}function NN({data:e,coverage:t}){return{heading:`Cloud artifacts`,status:``,summary:`${t.page?.total??e.artifacts.length} on account`,facts:[],sections:[{kind:`records`,key:`artifacts`,rows:e.artifacts.map(e=>({...e,version:e.version===void 0?``:`v${e.version}`})),columns:[{key:`id`,positional:!0,required:!0},{key:`type`,positional:!0},{key:`visibility`,positional:!0,required:!0},{key:`version`,positional:!0},{key:`updatedAt`,positional:!0},{key:`title`,positional:!0}]}]}}function PN(e){let{action:t,artifact:n,visibility:r,onProfile:i,key:a,space:o}=kN(e);if(t===`list`&&n)return Q({id:`publish.list`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},async run(t,r){let i=ET(e.projectDir),a=gC(EN(await i.call(`GET`,`/api/cloud/publication/${n}`,void 0,r.signal)));if(!a)throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported publication state.`});let{shareKey:o}=EN(await i.call(`GET`,`/api/cloud/share-key/${n}`,void 0,r.signal));if(o===void 0)throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server did not return the current share-key state.`});return Y({artifact:n,publication:a,shareKey:o})},present({data:e}){return{heading:`Cloud artifact`,status:e.publication.phase,subject:n,facts:[Z(`Published at`,{key:`publication.publishedAt`,value:e.publication.publishedAt}),Z(`Key`,{key:`shareKey.key`,value:e.shareKey?.key??`none`},!0),...e.shareKey?[Z(`URL`,{key:`shareKey.url`,value:e.shareKey.url},!0),Z(`Expires`,{key:`shareKey.expiresAt`,value:e.shareKey.expiresAt??`never`},!0)]:[]],sections:[]}}},e);if(t===`publish`)return Q({id:`publish.publish`,mode:`finite`,output:{formats:DN,scalar:e=>e.id},run:(t,s)=>(o&&MC(f.default.join(f.default.dirname(ce(e.projectDir).root),`config.json`),o),jN(e,s,n,r,i,a)),present:MN},e);if(t===`list`){let t=new URLSearchParams({semantic:`1`});for(let n of[`visibility`,`type`,`project`,`limit`,`cursor`,`fields`]){let r=e.values[n];typeof r==`string`&&t.set(n,r)}if(typeof e.values.module==`string`){t.has(`project`)||t.set(`project`,gM(ce(e.projectDir).project));let n=e.values.module.split(`,`).map(e=>e.trim());for(let e of new Set(n))t.append(`module`,e)}if(t.has(`limit`)&&(!/^\d+$/.test(t.get(`limit`))||+t.get(`limit`)<1||+t.get(`limit`)>100))throw new J({code:`E_ARGUMENT_INVALID`,message:`--limit must be between 1 and 100.`});if(t.has(`visibility`)&&![`public`,`private`].includes(t.get(`visibility`))||t.has(`type`)&&!Ae(t.get(`type`)))throw new J({code:`E_ARGUMENT_INVALID`,message:`Invalid Cloud list filter.`});return Q({id:`publish.list`,mode:`finite`,output:{detail:!0,formats:[`brief`,`table`,`json`,`jsonl`,`raw`],fields:[`id`,`type`,`title`,`project`,`modules`,`visibility`,`url`,`updatedAt`,`version`],collection:`artifacts`,requiredFields:[`id`,`type`,`visibility`,`version`]},async run(n,r){let i=await ET(e.projectDir).call(`GET`,`/api/cloud/artifacts?${t}`,void 0,r.signal);r.payloads.raw=i.raw;let a=EN(i);if(a.schema!==`ryugi.cloud-list/v1`)throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported Cloud list response.`});return Y({artifacts:a.artifacts},void 0,{coverage:{page:a.page},actions:a.page?.nextCursor?[lw([`publish`,`--list`,`--project-dir`,e.projectDir,...[...new Set(t.keys())].filter(e=>![`semantic`,`cursor`].includes(e)).flatMap(e=>[`--${e}`,t.getAll(e).join(`,`)]),`--cursor`,a.page.nextCursor],`More`)]:[]})},present:NN},e)}return AN(e,t,n)}const FN={semantic:PN,name:`publish`,summary:`Publish an artifact to the Artideck Cloud (needs a running server)`,usage:[`--artifact <type>/<id> [--public | --private | --key] [--profile | --no-profile] [options]`,`--artifact <type>/<id> --unpublish | --revoke-key [options]`,`--list | --delete <cloud-id> | --login | --logout [options]`,`--move-to <team-slug> (move this project into a team)`,`--list --artifact <type>/<id> (read publication and current key state without changing either)`],options:{visibility:{type:`string`,value:`<public|private>`,help:`Filter published list visibility`},type:{type:`string`,value:`<${k.join(`|`)}>`,help:`Filter published list type`},project:{type:`string`,value:`<project>`,help:`Filter published list project`},module:{type:`string`,value:`<id>[,<id>...]`,help:`Filter published list by module ("" for untagged); the project defaults to this one`},limit:{type:`string`,value:`<1-100>`,help:`Maximum list rows`},cursor:{type:`string`,value:`<token>`,help:`Continue a stable list snapshot`},artifact:{type:`string`,value:`<type>/<id>`,help:`The artifact to publish, unpublish, revoke a key, or inspect with --list`},public:{type:`boolean`,help:`Anyone with the link can open it`},private:{type:`boolean`,help:`Only you can open it`},key:{type:`boolean`,help:`Only people with the key can open it; prints a link that carries the key`},expires:{type:`string`,value:`<1d|7d|30d|never>`,help:`With --key or --new-key: when the key stops working (7d for a new key)`},"new-key":{type:`boolean`,help:`Replace the key; links with the old key stop opening`},"revoke-key":{type:`boolean`,help:`Remove the key; only you can open it`},profile:{type:`boolean`,help:`Show it on your public profile once it is public`},"no-profile":{type:`boolean`,help:`Take it off your public profile`},unpublish:{type:`boolean`,help:`Remove the artifact's cloud copy`},list:{type:`boolean`,help:`List your cloud artifacts; with --artifact, read its publication and current key state`},delete:{type:`string`,value:`<cloud-id>`,help:`Delete a cloud artifact by its id from --list`},space:{type:`string`,value:`<team-slug|personal>`,help:`Where this project's new artifacts publish; already published ones stay where they are`},"move-to":{type:`string`,value:`<team-slug>`,help:`Move every artifact of this project from your personal space into a team; links stay the same`},"no-refs":{type:`boolean`,help:`Publish only this artifact; leave the artifacts it references as they are`},login:{type:`boolean`,help:`Sign in to the Artideck Cloud`},"with-token":{type:`boolean`,help:`With --login: read an access token from stdin instead of opening a browser`},from:{type:`string`,value:`<tag>`,help:`With --login: where this sign-in started, recorded by Artideck Cloud`},logout:{type:`boolean`,help:`Sign out of the Artideck Cloud`}}},IN=/* @__PURE__ */ new Set([`created`,`updated`,`bound`]),LN=/* @__PURE__ */ new Set([`conflict`,`name_clash`]);function RN({data:e}){let t=/* @__PURE__ */ new Map;for(let n of e.results)t.set(n.outcome,(t.get(n.outcome)??0)+1);return{heading:`Pull`,status:``,subject:e.project,summary:e.results.length?[...t].map(([e,t])=>`${t} ${e}`).join(` · `):`no Cloud artifacts in this project`,facts:[Z(`Project`,X(e,`project`))],sections:[{kind:`records`,key:`results`,rows:e.results.map(e=>({...e,note:e.message??e.notes?.join(`; `)??``})),columns:[{key:`key`,positional:!0,required:!0},{key:`outcome`,positional:!0,required:!0},{key:`url`,positional:!0},{key:`note`,positional:!0}]}]}}function zN(e){let t=e.values.artifact,n=e.positionals[0];if(t&&n)throw new J({code:`E_OPTION_CONFLICT`,message:`Give --artifact or a Cloud link, not both.`});let r=t??n,i=e.values.as;if(i&&!r)throw new J({code:`E_ARGUMENT_INVALID`,message:`--as needs one target: --artifact <type>/<id> or a Cloud link.`});let a=e.values[`dry-run`]===!0,o=e.values.force===!0,s=e.values.project;return Q({id:`pull`,mode:`finite`,output:{formats:[`brief`,`table`,`json`,`jsonl`],collection:`results`,fields:[`key`,`outcome`,`cloudId`,`url`,`dir`,`message`,`notes`],requiredFields:[`key`,`outcome`]},async run(t,n){let c=EN(await ET(e.projectDir).call(`POST`,`/api/cloud/pull`,{target:r,project:s,as:i,dryRun:a,force:o},n.signal));if(!Array.isArray(c.results))throw new J({code:`E_PROTOCOL_MISMATCH`,message:`The server returned an unsupported pull response.`});if(!a)for(let e of c.results){if(!IN.has(e.outcome)&&e.outcome!==`failed`)continue;let t=n.effects.begin(`pull.${e.outcome}`,e.key);e.outcome===`failed`?n.effects.set(t,`failed`,{message:e.message}):n.effects.confirm(t)}let l=c.results.some(e=>e.outcome===`failed`)?{kind:`partial`}:c.results.some(e=>LN.has(e.outcome))?{kind:`validation_failed`}:{kind:`succeeded`},u=[`--project-dir`,e.projectDir];return Y(c,l,{effects:n.effects.snapshot(),actions:c.results.flatMap(e=>e.outcome===`conflict`?[lw([`get`,e.url],`Compare`),lw([`pull`,e.cloudId,`--force`,...u],`Take Cloud`)]:e.outcome===`name_clash`?[lw([`pull`,e.cloudId,`--as`,`${e.key.split(`/`)[1]}-cloud`,...u],`Pull as`)]:[])})},present:RN},e)}const BN={semantic:zN,name:`pull`,summary:`Pull this project's Cloud artifacts into the local artifacts folder (needs a running server)`,usage:[`[--project <owner/repo>] [--dry-run] [--force] [options]`,`--artifact <type>/<id> | <link-or-cloud-id> [--as <id>] [--dry-run] [--force] [options]`],positionals:1,details:`Each Cloud artifact of the project lands in .ryugi/artifacts/<type>/<slug> and stays bound to its Cloud link, so publish updates it instead of creating a new one.
|
|
982
|
+
|
|
983
|
+
Results:
|
|
984
|
+
created no local copy; downloaded and bound
|
|
985
|
+
updated the local copy was untouched since the last pull or publish; replaced with the newer Cloud version
|
|
986
|
+
bound a local copy with the same content was already there; only the binding was written
|
|
987
|
+
up_to_date nothing newer on Cloud
|
|
988
|
+
local_ahead edited here, Cloud unchanged; publish to send it
|
|
989
|
+
conflict edited here and changed on Cloud; nothing written. Compare with get, then pull --force to take the Cloud version
|
|
990
|
+
name_clash the directory holds something else; nothing written. Pull it under another name with --as
|
|
991
|
+
failed a download or write failed; the local copy is as it was
|
|
992
|
+
|
|
993
|
+
Local comments.json, marks/ and dotfiles are kept. A document gets the published comments only when it has no comments.json.`,options:{artifact:{type:`string`,value:`<type>/<id>`,help:`Pull only the Cloud copy this local artifact is bound to`},project:{type:`string`,value:`<owner/repo>`,help:`Pull another project’s artifacts; they keep publishing under it`},as:{type:`string`,value:`<id>`,help:`With one target: the local id to pull it under`},"dry-run":{type:`boolean`,help:`Report what each artifact would do; write nothing`},force:{type:`boolean`,help:`Take the Cloud version over local edits (conflict) or an unbound directory`}}};function VN(e){for(let t of Ge(e))d.default.rmSync(f.default.join(Ke(t.dir),`.state`,`server-info`),{force:!0})}function HN({data:e}){return{heading:`Server`,status:e.status,summary:e.status===e.reason?``:e.reason.replaceAll(`_`,` `),facts:[Z(`Scope`,X(e,`scope`)),Z(`Artifacts`,X(e,`artifacts`))],sections:[]}}async function UN(){let e=He(),t=t=>{d.default.rmSync(e.info,{force:!0}),VN(e.projects),d.default.mkdirSync(e.home,{recursive:!0,mode:448}),d.default.writeFileSync(e.stopped,`${JSON.stringify({reason:t,timestamp:Math.floor(Date.now()/1e3)})}\n`)};if(P(e.pid)===null)return{status:`not_running`};let n=Number(P(e.pid)),r=P(e.serverId)??``;if(!Number.isInteger(n)||n<=0||!/^[\w-]{32,64}$/.test(r)||!_e(n,r))return d.default.rmSync(e.pid,{force:!0}),d.default.rmSync(e.serverId,{force:!0}),t(`stale_pid`),{status:`stale_pid`};t(`stop`),O(e,{action:`stopped`,pid:n,running:P(e.version)??``,cli:process.env.RYUGI_ARTIFACTS_VERSION||`1.113.1`});try{process.kill(n,`SIGTERM`)}catch{}if(!await N(n,7e3)){Rn(e)?.unload();try{process.kill(n,`SIGKILL`)}catch{}await N(n,1e3)}if(pe(n))return d.default.rmSync(e.stopped,{force:!0}),{status:`failed`,error:`process still running`};for(let t of[e.pid,e.serverId])d.default.rmSync(t,{force:!0});return t(`stop`),{status:`stopped`}}const WN={name:`stop`,summary:`Stop this machine's artifacts server; the artifacts are kept`,usage:[`[options]`],options:{},semantic:e=>Q({id:`stop`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`,`quiet`],scalar:e=>e.status},async run(e,t){let n=t.effects.begin(`stop`,`machine`),r=await UN();return r.status!==`failed`&&t.effects.set(n,r.status===`not_running`?`none`:`confirmed`),Y({status:r.status===`stopped`?`stopped`:r.status===`failed`?`failed`:`unchanged`,reason:r.status,scope:`machine`,artifacts:`kept`},r.status===`failed`?{kind:`failed`,error:{code:`E_SERVER_STOP_FAILED`,message:r.error}}:{kind:`succeeded`})},present:HN},e)};function GN({data:e}){return{heading:`Uninstall`,status:e.failures.length?`partial`:`removed`,facts:[Z(`Removed`,{key:`removed`,value:e.removed.join(`, `)}),Z(`Preserved`,{key:`preserved`,value:e.preserved.join(` `)})],sections:[{kind:`records`,key:`failures`,rows:e.failures,columns:[{key:`component`,required:!0},{key:`message`,required:!0}]}]}}const KN={name:`uninstall`,summary:`Remove recorded integrations and owned command; keep artifacts and data`,options:{"install-dir":{type:`string`,value:`<path>`,help:`Managed installation directory`},harness:{type:`string`,value:`<targets>`,help:`Only remove these comma-separated harnesses; keep CLI`}},semantic:e=>Q({id:`uninstall`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`]},run(t,n){let r=typeof e.values.harness==`string`?e.values.harness.split(`,`).map(LO):void 0;if(r?.some(e=>!mO.some(t=>t.id===e)))return Y({removed:[],preserved:[],failures:[]},{kind:`validation_failed`},{warnings:[{code:`E_HARNESS`,severity:`error`,message:`Unknown harness selection`}]});let i=f.default.resolve(e.values[`install-dir`]||kO()),a=n.effects.begin(`uninstall`,i),o=Sj(i,{targets:r});return o.failures.length||n.effects.confirm(a,o.removed),Y(o,o.failures.length?{kind:`partial`}:{kind:`succeeded`})},present:GN},e)};function qN(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++)if(n[e]!==r[e])return n[e]>r[e];return!1}const JN=e=>f.default.join(e.XDG_CACHE_HOME||f.default.join(h.default.homedir(),`.cache`),`ryugi`,`artifacts`,`latest.json`);function YN(e,t,n){try{d.default.mkdirSync(f.default.dirname(e),{recursive:!0});let r=`${e}.${process.pid}`;d.default.writeFileSync(r,JSON.stringify({version:t,checkedAt:n})),d.default.renameSync(r,e)}catch{}}function XN({data:e}){return{heading:`Update`,status:e.status,facts:[Z(`Current`,X(e,`current`),!0),Z(`Latest`,X(e,`latest`)),Z(`Install`,X(e,`install`)),...e.message?[Z(`Advice`,X(e,`message`))]:[],...e.daemon?[Z(`Daemon`,{key:`daemon`,value:e.daemon.status===`updated`?`updated ${e.daemon.from} → ${e.daemon.to}`:e.daemon.status===`failed`?`failed: ${e.daemon.error}`:e.daemon.status===`not-running`?`not running; start it to update it`:`current`})]:[],...e.hub&&e.hub.status!==`unchanged`?[Z(`Hub`,{key:`hub`,value:e.hub.status===`failed`?`restart failed: ${e.hub.error}`:e.hub.status===`kept-local`?`runs a local build; left as it is`:e.hub.status===`not-running`?`not running`:`restarted on the new version`})]:[]],sections:e.plugins?.length?[{kind:`records`,key:`plugins`,title:`Harnesses`,rows:e.plugins.map(e=>({...e})),columns:[{key:`harness`,required:!0},{key:`mode`,required:!0},{key:`status`,required:!0},{key:`error`}]}]:[]}}async function ZN(e,t){if(e.cli===`current`&&e.daemon===`current`)return{status:`unchanged`};let n=t.running();if(!n)return{status:`not-running`};if(Vw(n.version,e.to)===`protected`)return{status:`kept-local`};try{if(e.cli===`updated`&&e.newCli){let n=t.runCli(e.newCli,[`start`,`--background`,`--no-open`,`--project-dir`,e.projectDir]);return n.ok?{status:`restarted`}:{status:`failed`,error:n.output||`start failed`}}return await t.restartHub(e.to),{status:`restarted`}}catch(e){return{status:`failed`,error:e.message}}}const QN={running(){let e=He(),t=Zw(e);return t?{pid:t,version:P(e.version)?.trim()??``}:null},runCli(e,t){let n=(0,p.spawnSync)(e,t,{encoding:`utf8`,shell:process.platform===`win32`,timeout:12e4});return{ok:n.status===0,output:`${n.stderr??``}${n.stdout??``}`.trim()}},async restartHub(e){await FD(e,{reason:`update`,startStopped:!1})}};function $N(e,t,n=xO){let r=`${n}@${t}`;return{cmd:e,args:e===`npm`?[`install`,`-g`,r]:e===`yarn`?[`global`,`add`,r]:[`add`,`-g`,r]}}const eP=({cmd:e,args:t})=>[e,...t].join(` `);async function tP(e,t){let n=e.endsWith(`/`)?e:`${e}/`;try{let e=await fetch(new URL(`${t}/latest`,n),{signal:AbortSignal.timeout(1e4)}),{version:r}=await e.json();if(e.ok&&typeof r==`string`&&/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(r))return r;throw Error(`registry returned ${e.status}`)}catch(e){throw new M(`Could not get the latest ${t} version from ${n}: ${e.message}`)}}function nP(e,t){return e.kind===`transient`?`You ran ${xO} through ${e.runner}, which keeps no install to update. Run \`${e.runner} ${xO}@latest\` to get ${t}.`:e.kind===`local`?"This is a local build from a Ryugi checkout. Update it with `git pull`, then `pnpm build` in artifacts/.":e.kind===`launcher`?`Release cache refreshed to ${t}. Run the returned start command through the launcher to install it and replace the running server.`:null}var rP=class extends M{};async function iP(e,t){if(!Rt[process.platform]?.includes(process.arch))return;let n=h.default.homedir(),r,i=await LD({arch:process.arch,cliDir:__dirname,env:process.env,fetch,home:n,platform:process.platform,serverHome:He().home,version:e},()=>{r=t.effects.begin(`update.daemon`,ID(n).binary)}).catch(e=>({status:`failed`,error:e.message}));if(i.status!==`not-installed`&&i.status!==`other-hub`)return i.status===`updated`&&r!==void 0&&t.effects.confirm(r,{from:i.from,to:i.to}),i}async function aP(e,t={}){if(e.pm!==void 0&&!wO.includes(e.pm))throw new M(`--pm must be one of ${wO.join(`, `)}`);let n=e.pm?{kind:`global`,pm:e.pm}:OO(e.file,e.env),r=n.kind===`global`||n.kind===`unknown`?DO(e.file):xO,i=await tP(e.registry,r);t.beforeCache?.(),YN(JN(e.env),i,Date.now()),t.cacheRefreshed?.();let a={type:`update-check`,current:e.current,latest:i,install:n.kind};if(!qN(i,e.current))return{...a,upToDate:!0,command:null};if(n.kind===`unknown`){let t=wO.map(e=>` ${eP($N(e,i,r))}`).join(`
|
|
994
|
+
`);throw new rP(`Could not tell how ${xO} was installed (${e.file}). Install ${i} with one of:\n${t}\nor run \`${xO} update --pm <${wO.join(`|`)}>\`.`)}if(n.kind===`managed`){if(e.check)return{...a,upToDate:!1,command:`adeck update`};let n=kO(e.env),r=new FO(n).current();if(!r)throw new M(`Managed runtime state is missing; run adeck doctor.`);let o=new FO(n,f.default.dirname(r.bin)),s=f.default.join(n,`downloads`,`runtime-${(0,u.randomUUID)()}`);try{t.beforeInstall?.();let n;return t.downloadRuntime?n=await t.downloadRuntime(i):(d.default.mkdirSync(s,{recursive:!0}),t.log?.(`Downloading ${xO}@${i}`),hO(`npm`,[`install`,`--prefix`,s,`--ignore-scripts`,`--no-audit`,`--no-fund`,`--omit=dev`,`--legacy-peer-deps`,`--registry`,e.registry,`${xO}@${i}`]),n=f.default.join(s,`node_modules`,xO)),o.install(n),{type:`updated`,from:e.current,to:i,pm:`ryugi`,command:`adeck update`}}finally{d.default.rmSync(s,{recursive:!0,force:!0})}}if(n.kind!==`global`)return{...a,upToDate:!1,command:null,message:nP(n,i)};let o=$N(n.pm,i,r);if(e.check)return{...a,upToDate:!1,command:eP(o)};let s=process.platform===`win32`;t.beforeInstall?.();let c=t.log?[`inherit`,`pipe`,`pipe`]:[`inherit`,2,2],l=s?(0,p.spawnSync)(eP(o),{stdio:[...c],env:e.env,shell:!0}):(0,p.spawnSync)(o.cmd,o.args,{stdio:[...c],env:e.env});if(l.stdout?.length&&t.log?.(l.stdout.toString()),l.stderr?.length&&t.log?.(l.stderr.toString()),l.error)throw new M(`Could not run ${eP(o)}: ${l.error.message}`);if(l.status!==0)throw new M(`${eP(o)} exited with ${l.status??l.signal}`);return{type:`updated`,from:e.current,to:i,pm:n.pm,command:eP(o)}}const oP=[aT,mT,WN,cD,FN,BN,WT,iE,BT,VM,TD,rD,cE,Hj,Qj,OD,{name:`update`,summary:`Update the CLI through its original owner, then refresh recorded harness integrations and the daemon`,options:{check:{type:`boolean`,help:`Compare CLI versions only; do not install`},"cli-only":{type:`boolean`,help:`Update CLI without refreshing harness plugins`},"plugins-only":{type:`boolean`,help:`Refresh recorded plugins without updating CLI or daemon`},"install-dir":{type:`string`,value:`<path>`,help:`Managed installation directory`},"plugin-source":{type:`string`,value:`<path>`,help:`Plugin checkout for offline/development refresh`},pm:{type:`string`,value:`<npm|pnpm|yarn|bun>`,help:`Use this package manager instead of detecting it`}},semantic:e=>Q({id:`update`,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:[`current`,`latest`,`install`,`status`,`installed`,`message`,`command`,`plugins`,`daemon`,`hub`]},async run(t,n){if(e.values[`cli-only`]&&e.values[`plugins-only`])throw new M(`Choose --cli-only or --plugins-only`);let r=e.values.check?null:KO(h.default.homedir(),process.env.RYUGI_DEV_LINK||void 0);if(r)throw new J({code:`E_DEV_LINKED`,message:`This machine runs the local build ${r.version} through a dev link, and an update would put released copies over it. Refresh the local build with \`pnpm dev:link\` in the ryugi-cloud checkout, or run \`adeck dev unlink\` first to go back to releases.`},`action_required`);let i,a,o;try{o=e.values[`plugins-only`]?{type:`update-check`,current:`1.113.1`,latest:`1.113.1`,install:OO(__filename,process.env).kind,upToDate:!0,command:null,message:`CLI unchanged; refreshing recorded plugins.`}:await aP({current:`1.113.1`,file:__filename,env:process.env,registry:process.env.npm_config_registry||`https://registry.npmjs.org/`,check:!!e.values.check,pm:e.values.pm},{beforeCache(){a=n.effects.begin(`release-cache`,JN(process.env))},cacheRefreshed(){a!==void 0&&n.effects.confirm(a)},beforeInstall(){i=n.effects.begin(`install`,xO)},log:n.diagnostic})}catch(e){throw e instanceof rP?new J({code:`E_INSTALL_UNKNOWN`,message:e.message},`action_required`):e}o.type===`updated`&&i!==void 0&&n.effects.confirm(i,{from:o.from,to:o.to});let s=o.type===`updated`?{current:o.to,latest:o.to,install:o.pm===`ryugi`?`managed`:`global`,status:`updated`,installed:!0,command:o.command}:{current:o.current,latest:o.latest,install:o.install,status:o.upToDate?`up_to_date`:`available`,installed:!1,command:o.command,...o.message?{message:o.message}:{}},c=f.default.resolve(e.values[`install-dir`]||kO());if(!e.values.check&&!e.values[`cli-only`]){s.plugins=[];for(let t of Object.values(RO(c).harnesses)){let r=await uM({projectDir:e.projectDir,positionals:[],values:{mode:t.mode,harness:t.harness,"no-cli":!0,"install-dir":c,"plugin-source":e.values[`plugin-source`],"plugin-version":s.current}},n,!1,!0),i=r.data.targets.find(e=>e.harness===t.harness);s.plugins.push({harness:t.harness,mode:t.mode,status:i?.status||`failed`,error:i?.error||(r.completion.kind===`succeeded`?void 0:r.warnings.map(e=>e.message).join(`; `))})}}if(!e.values.check&&!e.values[`plugins-only`]&&s.status!==`available`){let t=await iP(s.current,n);t&&(s.daemon=t),s.hub=await ZN({cli:s.status===`updated`?`updated`:`current`,daemon:t?.status===`updated`?`updated`:`current`,from:`1.113.1`,to:s.current,newCli:s.install===`managed`?new FO(kO(process.env)).bin:s.install===`global`?`ryugi`:null,projectDir:e.projectDir},QN)}let l=e.values.check?{warnings:[],actions:[]}:mj(await gj({cleanup:!0,root:c},n,!!process.stdin.isTTY&&!!process.stderr.isTTY));return Y(s,s.plugins?.some(e=>e.status!==`installed`)||s.daemon?.status===`failed`||s.hub?.status===`failed`?{kind:`partial`}:void 0,{effects:n.effects.snapshot(),warnings:l.warnings,actions:[...s.install===`launcher`&&s.status===`available`?[lw([`start`,`--background`,`--no-open`,`--project-dir`,e.projectDir],`Restart server`)]:[],...l.actions]})},present:XN},e)},fM,Cj,nO,lk,Wj,KN];function sP(e){return(t,n,r)=>{let i=[`--project-dir`,e.projectDir],a=typeof e.values.artifact==`string`?e.values.artifact:void 0,o=[...i,...a?[`--artifact`,a]:[]];if(r.some(e=>e.state===`unknown`)){let e;if(t.startsWith(`comment`)&&a)e=[`comment`,`list`,...o,...a.startsWith(`verify/`)?[]:[`--sections`,`all`,...t.endsWith(`.ack`)?[]:[`--all`],`--detail`]];else if(t.startsWith(`changes`))e=[`changes`,...o,`--detail`];else if(t.startsWith(`publish`))e=[`publish`,`--list`,...i,...a&&r.some(e=>[`share-key`,`revoke-key`].includes(e.operation)&&e.state===`unknown`)?[`--artifact`,a]:[]];else if(t===`config`)e=[`config`,...i];else if(t.startsWith(`modules`))e=[`modules`,...o];else if(t===`update`)e=[`--version`];else if(t===`install`)return[{kind:`command`,argv:[`claude`,`plugin`,`list`,`--json`],label:`Verify state`,reason:`Inspect installed plugins before any retry; an operation may already have completed.`}];else e=[`get`,...i];return[{...lw(e,`Verify state`),reason:`Inspect current state before any retry; an operation may already have completed.`}]}return n?.code===`E_SERVER_NOT_RUNNING`||n?.code===`E_SERVER_UNREACHABLE`?[lw([`start`,`--background`,`--no-open`,...o],`Start server`)]:n?.code===`E_ARGUMENT_INVALID`||n?.code===`E_OPTION_CONFLICT`?[lw([t.split(`.`)[0],...e.positionals[0]&&t.startsWith(`comment`)?[e.positionals[0]]:[],`--help`],`Help`)]:n?hw(n):[]}}async function cP(e,t,n,r){return jw({id:e,mode:`finite`,output:{formats:[n.format]},run(){throw t},present(){return{heading:`Error`,status:`failed`,facts:[],sections:[]}}},void 0,{...n,fields:void 0,detail:!1},r)}function lP(e,t){return{id:e,mode:`finite`,output:{formats:[`brief`,`json`,`jsonl`],fields:[`text`,`version`,`capabilities`,`commands`]},run(){return Y(t)},present({data:e}){return e.version?{heading:`ryugi ${e.version}`,status:``,facts:[],sections:[]}:{heading:`Help`,status:``,facts:[],sections:[{kind:`content`,key:`text`,text:e.text}]}}}}async function uP(e,t,n,r,i,a,o){let[s,...c]=e,l=t.find(e=>e.name===s),u;try{if(l?.positionals&&l.usage?.some(e=>/^[a-z]+\s/.test(e))&&(u=$C(c.filter(e=>e!==`--help`&&e!==`-h`),l.options,l.positionals).positionals[0]),s===`--version`||s===`-v`)return $C(c,{},0),await Q(lP(`version`,{text:r,version:r,capabilities:[`reviewBundlesV1`]}),void 0).run(i,a);if(s===`--help`||s===`-h`||l&&ew(c)){l||$C(c,{},0);let e=l?iw(l,u):aw(t,n);if(l&&[`start`,`check`].includes(l.name)){let t=$C(c.filter(e=>e!==`--help`&&e!==`-h`),l.options,l.positionals);t.values.mockup?e=mC():typeof t.values.artifact==`string`&&(e+=`\n\n${pC(t.values.artifact)}`)}return await Q(lP(`help`,{text:e,commands:t.map(({name:e,summary:t})=>({name:e,summary:t}))}),void 0).run(i,a)}if(!l&&(!s||s.startsWith(`-`)||(()=>{try{return d.default.statSync(s).isDirectory()}catch{return!1}})())){let t=$C(e,n,1);if(t.positionals.length&&t.values[`project-dir`])throw new J({code:`E_ARGUMENT_INVALID`,message:`Specify one project directory.`});return t.projectDir=t.values[`project-dir`]??t.positionals[0]??t.projectDir,t.values.foreground=!0,t.values.open=!t.values[`no-open`],await Lw(t,`browse`).run(i,a,o)}if(!l)throw new J({code:s?.includes(`/`)?`E_PROJECT_NOT_FOUND`:`E_UNKNOWN_COMMAND`,message:s?`Unknown command: ${s}`:`Use start --foreground to browse with semantic output.`});let f;try{f=$C(c,rw(l,u),l.positionals)}catch(e){throw new J({code:`E_ARGUMENT_INVALID`,message:e.message})}return f.projectDir=ce(f.projectDir).project,await l.semantic(f).run(i,a,o,sP(f))}catch(e){let t=e instanceof M?new J({code:`E_ARGUMENT_INVALID`,message:e.message}):e;return t instanceof Error&&Object.assign(t,{actions:[lw([...l?[l.name,...u&&l.usage?.some(e=>e.startsWith(`${u} `))?[u]:[]]:[],`--help`],`Help`)]}),cP(l?.name??s??`browse`,t,i,a)}}function dP(e=process.stdout,t=process.stderr){let n=/* @__PURE__ */ new WeakMap;for(let r of[e,t])r.on(`error`,e=>n.set(r,e));return{write(r,i){let a=r===`stdout`?e:t,o=n.get(a);return o?Promise.reject(o):new Promise((e,t)=>a.write(i,n=>n?t(n):e()))}}}function fP(e){process.exitCode=e}const pP={"no-open":{type:`boolean`,help:`Print the URL without opening a browser`}};async function mP(e){T(`cli`);let t=Object.assign({},ZC,...oP.map(e=>e.options)),n=dP(),r;try{r=UC(e,t,YC(e,t))}catch(r){return cP(e[0]??`browse`,r,UC(e,t).options,n)}if(r.error)return cP(e[0]??`browse`,r.error,r.options,n);let i=new AbortController,a=()=>i.abort(`SIGINT`),o=()=>i.abort(`SIGTERM`);process.on(`SIGINT`,a),process.on(`SIGTERM`,o);try{return await uP(e,oP,pP,`1.113.1`,r.options,n,i.signal)}finally{process.removeListener(`SIGINT`,a),process.removeListener(`SIGTERM`,o)}}mP(process.argv.slice(2)).then(fP,e=>cP(process.argv[2]??`browse`,e,{format:`brief`},dP()).then(fP));
|