@cortex-agent/server 2026.10.28 → 2026.12.5
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/LICENSE +255 -21
- package/README.md +36 -7
- package/THIRD_PARTY_NOTICES.txt +1990 -593
- package/defaults/hooks/cortex-hook-api.mjs +2 -1
- package/defaults/hooks/quota-stop.mjs +37 -0
- package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +23 -15
- package/defaults/prompts/clean-workspace.md +5 -0
- package/dist/agent-adapter/claude/remote-mcp-proxy.js +1 -1
- package/dist/chunks/agent-runner-LVZVKBZX.js +4 -0
- package/dist/chunks/anthropic-messages-TT6454AA.js +8 -0
- package/dist/chunks/azure-openai-responses-52LR2XZD.js +4 -0
- package/dist/chunks/bedrock-converse-stream-EOZGYUNY.js +60 -0
- package/dist/chunks/bowser-MLGGLXTZ.js +20 -0
- package/dist/chunks/child-runner-SMG2VOU5.js +4 -0
- package/dist/chunks/chunk-24DH4IR5.js +4 -0
- package/dist/chunks/chunk-25XKBRDT.js +70 -0
- package/dist/chunks/chunk-2ABET62E.js +23 -0
- package/dist/chunks/chunk-2BVUA256.js +4 -0
- package/dist/chunks/{chunk-LEUENXI2.js → chunk-2WFL62UO.js} +1 -1
- package/dist/chunks/{chunk-OZGBWAT2.js → chunk-2YTYYG4K.js} +1 -1
- package/dist/chunks/chunk-335SSANX.js +4 -0
- package/dist/chunks/chunk-377OPTXX.js +17 -0
- package/dist/chunks/chunk-3EZNVLBF.js +129 -0
- package/dist/chunks/chunk-3O6ZG5HA.js +7 -0
- package/dist/chunks/{chunk-6AKUD3CF.js → chunk-3XLHL5YT.js} +1 -1
- package/dist/chunks/chunk-4HRI75GU.js +4 -0
- package/dist/chunks/chunk-4JBYLRPM.js +57 -0
- package/dist/chunks/chunk-4KKV7VKE.js +4 -0
- package/dist/chunks/chunk-4KQHDDC5.js +4 -0
- package/dist/chunks/chunk-4SWD4JMP.js +33 -0
- package/dist/chunks/chunk-52VCLZS5.js +4 -0
- package/dist/chunks/chunk-54P7TSY3.js +10 -0
- package/dist/chunks/chunk-5DVSAXOI.js +7 -0
- package/dist/chunks/chunk-5F3A62YS.js +4 -0
- package/dist/chunks/{chunk-XNSSUVT6.js → chunk-5FHETFZM.js} +1 -1
- package/dist/chunks/{chunk-A34TDMIC.js → chunk-5LBLRAHS.js} +1 -1
- package/dist/chunks/chunk-5UYVNA3W.js +4 -0
- package/dist/chunks/chunk-6G3OYMCV.js +21 -0
- package/dist/chunks/chunk-7GGPYU5E.js +30 -0
- package/dist/chunks/chunk-7TYSMLUV.js +4 -0
- package/dist/chunks/chunk-7W7VYUTK.js +5 -0
- package/dist/chunks/chunk-AXYAZTTN.js +6 -0
- package/dist/chunks/{chunk-BGVHA2D4.js → chunk-B3NB243Z.js} +1 -1
- package/dist/chunks/chunk-BKYP6AGM.js +8 -0
- package/dist/chunks/chunk-BVEDNESB.js +4 -0
- package/dist/chunks/chunk-BWDJS6A4.js +12 -0
- package/dist/chunks/chunk-C6YVF7EI.js +4 -0
- package/dist/chunks/chunk-CEJIYYVE.js +15 -0
- package/dist/chunks/chunk-CI2RHH74.js +50 -0
- package/dist/chunks/chunk-CMSOOLJB.js +4 -0
- package/dist/chunks/chunk-CSVTYYLP.js +4 -0
- package/dist/chunks/chunk-DE5EGVKG.js +6 -0
- package/dist/chunks/{chunk-E6BYRULL.js → chunk-DK3RPZOQ.js} +1 -1
- package/dist/chunks/{chunk-YPK2CAIZ.js → chunk-DK4UCK7L.js} +1 -1
- package/dist/chunks/chunk-DYLBVUAU.js +4 -0
- package/dist/chunks/chunk-FDC2GRBK.js +27 -0
- package/dist/chunks/chunk-FE7HH5JS.js +18 -0
- package/dist/chunks/chunk-FYD57YRO.js +436 -0
- package/dist/chunks/chunk-G264APQN.js +5 -0
- package/dist/chunks/chunk-G4JYZFEO.js +11 -0
- package/dist/chunks/chunk-GFFM56U2.js +4 -0
- package/dist/chunks/chunk-GOS3P7KS.js +132 -0
- package/dist/chunks/chunk-HVN37UXD.js +4 -0
- package/dist/chunks/chunk-IA6IODY3.js +4 -0
- package/dist/chunks/{chunk-HU6UIDEJ.js → chunk-IGZWZP7Z.js} +1 -1
- package/dist/chunks/{chunk-NR6U3WIZ.js → chunk-IJ7XFQMI.js} +1 -1
- package/dist/chunks/chunk-IMMGYDAB.js +6 -0
- package/dist/chunks/chunk-IOWBF7UK.js +10 -0
- package/dist/chunks/{chunk-HALUQ7ZF.js → chunk-ITGCWQFK.js} +1 -1
- package/dist/chunks/chunk-IVZ7QUEG.js +4 -0
- package/dist/chunks/{chunk-YAEVYJAR.js → chunk-IWY2HIFK.js} +1 -1
- package/dist/chunks/{chunk-KGJZAYQD.js → chunk-J7OBATRN.js} +1 -1
- package/dist/chunks/{chunk-QWAQHHRS.js → chunk-JGUEIW2W.js} +1 -1
- package/dist/chunks/chunk-JKL3AK5D.js +106 -0
- package/dist/chunks/chunk-JZ7U7RUK.js +351 -0
- package/dist/chunks/chunk-KJUQCCB5.js +4 -0
- package/dist/chunks/chunk-KST6OY76.js +10 -0
- package/dist/chunks/chunk-KZSAFVSY.js +129 -0
- package/dist/chunks/chunk-LD2ZSH3M.js +903 -0
- package/dist/chunks/chunk-LE6QPXN6.js +7 -0
- package/dist/chunks/chunk-LEAV3FFG.js +4 -0
- package/dist/chunks/chunk-LIIZI3HY.js +5 -0
- package/dist/chunks/chunk-LP72AF56.js +45 -0
- package/dist/chunks/{chunk-FXDIR3SQ.js → chunk-MJQ2D2OP.js} +1 -1
- package/dist/chunks/{chunk-6LZK4DDH.js → chunk-NHHR4DCF.js} +1 -1
- package/dist/chunks/chunk-NW4GW47L.js +4 -0
- package/dist/chunks/chunk-OALEJ6FG.js +60 -0
- package/dist/chunks/chunk-OIV4DIMB.js +4 -0
- package/dist/chunks/chunk-OJ37ZWBG.js +4 -0
- package/dist/chunks/chunk-OZXMPBUX.js +4 -0
- package/dist/chunks/{chunk-3THJYAEF.js → chunk-PG7452XE.js} +1 -1
- package/dist/chunks/chunk-PJCUB7YJ.js +4 -0
- package/dist/chunks/chunk-PTS3J4DQ.js +6 -0
- package/dist/chunks/{chunk-PXS5SHOV.js → chunk-PVVEEBUU.js} +1 -1
- package/dist/chunks/chunk-Q7BZLPBU.js +8 -0
- package/dist/chunks/{chunk-FOJQXLL2.js → chunk-QC66ZXPP.js} +1 -1
- package/dist/chunks/chunk-QXFWIL4C.js +4 -0
- package/dist/chunks/{chunk-PFMEUFJ7.js → chunk-R2CCD4OF.js} +1 -1
- package/dist/chunks/chunk-R6CGBSTC.js +22 -0
- package/dist/chunks/chunk-RG5GP4RB.js +5 -0
- package/dist/chunks/{chunk-D3NXKK2L.js → chunk-RW2F2QNP.js} +1 -1
- package/dist/chunks/{models-L5VF4I5O-XXNJYQMQ.js → chunk-RWPO3NZ3.js} +1 -1
- package/dist/chunks/chunk-SAJD4EKE.js +10 -0
- package/dist/chunks/chunk-SDUS2H3E.js +4 -0
- package/dist/chunks/chunk-SIHGKM4E.js +4 -0
- package/dist/chunks/chunk-SKHFU5DI.js +4 -0
- package/dist/chunks/{chunk-STUHNKQS.js → chunk-SM45TH22.js} +1 -1
- package/dist/chunks/chunk-T54CZKNJ.js +6 -0
- package/dist/chunks/chunk-TKFFQNAP.js +19 -0
- package/dist/chunks/chunk-TMV2ZDOI.js +18 -0
- package/dist/chunks/chunk-TRXLIL7V.js +4 -0
- package/dist/chunks/{chunk-SUFW24P4.js → chunk-UEEW2R4E.js} +1 -1
- package/dist/chunks/chunk-UHXPRU6G.js +10 -0
- package/dist/chunks/chunk-UPQVWHZ3.js +4 -0
- package/dist/chunks/{chunk-JERCOLY3.js → chunk-V35MFAUQ.js} +4 -6
- package/dist/chunks/chunk-V7K3KNDM.js +4 -0
- package/dist/chunks/chunk-VHX2GHBF.js +4 -0
- package/dist/chunks/chunk-VOAKRJ4R.js +4 -0
- package/dist/chunks/{chunk-X2GYYRVM.js → chunk-VW7TLY3P.js} +1 -1
- package/dist/chunks/chunk-W34AK4SK.js +65 -0
- package/dist/chunks/{chunk-REBNWCKI.js → chunk-WU7RNAZD.js} +1 -1
- package/dist/chunks/chunk-WZC4TDDM.js +6 -0
- package/dist/chunks/chunk-WZYS2HAK.js +4 -0
- package/dist/chunks/chunk-X2TKJ7KR.js +11 -0
- package/dist/chunks/{chunk-H2FP6DG4.js → chunk-X5ND4H4P.js} +1 -1
- package/dist/chunks/{chunk-4U7XXM4W.js → chunk-Y3AOGNDT.js} +1 -1
- package/dist/chunks/chunk-Y6DGVTKM.js +6 -0
- package/dist/chunks/{chunk-KENCMLRE.js → chunk-YAEHSSR4.js} +1 -1
- package/dist/chunks/chunk-YWPBE5LP.js +4 -0
- package/dist/chunks/chunk-ZAVX7G2M.js +15 -0
- package/dist/chunks/chunk-ZD2M73XA.js +19 -0
- package/dist/chunks/chunk-ZD4O6NPV.js +4 -0
- package/dist/chunks/chunk-ZNAMETPQ.js +4 -0
- package/dist/chunks/chunk-ZY6N5LVQ.js +4 -0
- package/dist/chunks/chunk-ZYQ4TDTT.js +81 -0
- package/dist/chunks/cli-VB2N7HEK.js +55 -0
- package/dist/chunks/cloudflare-workers-ai-system-one-YKU742EC.js +4 -0
- package/dist/chunks/context-CI2FKEQE.js +4 -0
- package/dist/chunks/cost-CZRRSIUF.js +5 -0
- package/dist/chunks/dist-QCNQN6DY.js +4 -0
- package/dist/chunks/easter-egg-3d-XR5S2O3T.js +4 -0
- package/dist/chunks/{event-streams-3JSFPOTZ.js → event-streams-AVE4MSS6.js} +1 -1
- package/dist/chunks/{execution-repo-ZLJTBWFC.js → execution-repo-5TLV2NM4.js} +1 -1
- package/dist/chunks/{executions-6ARGR3IO.js → executions-I3UUIGSL.js} +1 -1
- package/dist/chunks/file-Y5G56IUT.js +4 -0
- package/dist/chunks/github-copilot-BRU2SRRZ.js +4 -0
- package/dist/chunks/google-generative-ai-ZF5QEUZV.js +4 -0
- package/dist/chunks/google-vertex-4PJZZI3Y.js +4 -0
- package/dist/chunks/init-A6GY656J.js +4 -0
- package/dist/chunks/{install-cli-4IZCSDFZ.js → install-cli-FALWKQYO.js} +1 -1
- package/dist/chunks/{interaction-ask-G5T3H3CG.js → interaction-ask-O5HGF6CH.js} +1 -1
- package/dist/chunks/{interaction-plan-E5V42MUP.js → interaction-plan-JTVDN3BC.js} +1 -1
- package/dist/chunks/kimi-coding-ZCIBMDZ6.js +4 -0
- package/dist/chunks/{llama-cpp-classify-OTXZWCMW.js → llama-cpp-classify-NRUXAIGQ.js} +3 -3
- package/dist/chunks/local-client-stop-RS4AHNF4.js +4 -0
- package/dist/chunks/{memory-cli-PYOILNN5.js → memory-cli-DIT4DQF3.js} +1 -1
- package/dist/chunks/meta-JQH66YU7.js +4 -0
- package/dist/chunks/mistral-conversations-CXHOECUV.js +7 -0
- package/dist/chunks/model-resolver-GIBPYRKP.js +4 -0
- package/dist/chunks/monitor-Z2HKNY5E.js +4 -0
- package/dist/chunks/{node-PTK2HCDV.js → node-DAO3SX7O.js} +1 -1
- package/dist/chunks/{openai-codex-2REL6UQU.js → openai-codex-JULCKICT.js} +1 -1
- package/dist/chunks/openai-codex-responses-U6DGMGDK.js +12 -0
- package/dist/chunks/openai-completions-PP4XLLOM.js +9 -0
- package/dist/chunks/{openai-decisions-2N6ZRPZC.js → openai-decisions-JU6QQKEM.js} +1 -1
- package/dist/chunks/openai-responses-2SG757TL.js +6 -0
- package/dist/chunks/openrouter-images-32M7YZWC.js +4 -0
- package/dist/chunks/pi-messages-VSINMXN4.js +10 -0
- package/dist/chunks/radius-THYKWV4E.js +4 -0
- package/dist/chunks/remote-ops-2WBEFQ3E.js +14 -0
- package/dist/chunks/runner-5MKMRTIN.js +4 -0
- package/dist/chunks/runtime-DST3H5JP.js +4 -0
- package/dist/chunks/schedule-cli-V7Y2BBVY.js +4 -0
- package/dist/chunks/slack-R7SEJYMY.js +4 -0
- package/dist/chunks/start-ui-http-7K5JOLPU.js +43 -0
- package/dist/chunks/subagent-Z5IQ4L54.js +4 -0
- package/dist/chunks/{time-KEHDQT6K.js → time-P6PE52WL.js} +1 -1
- package/dist/chunks/tool-shims-YCXZWTST.js +4 -0
- package/dist/chunks/typesafe-system-one-M2DABJSZ.js +4 -0
- package/dist/chunks/ui-board-HQIE4RZG.js +5 -0
- package/dist/chunks/ui-decision-YBZDS4YW.js +4 -0
- package/dist/chunks/{ui-file-GVH53O3X.js → ui-file-SRD4ILBS.js} +1 -1
- package/dist/chunks/ui-view-Z25MTZT7.js +4 -0
- package/dist/chunks/virtual-modules-H4DXPJZB.js +4 -0
- package/dist/chunks/waitpoint-M6JZBSLT.js +5 -0
- package/dist/chunks/workers-SQ2R32TK.js +4 -0
- package/dist/client-bundle/client.mjs +273 -93
- package/dist/client-bundle/manifest.json +2 -2
- package/dist/core/pi-sdk.js +1 -1
- package/dist/domain/auth/cc-auth-cli.js +1 -1
- package/dist/domain/mcp/bundled-server.js +1 -1
- package/dist/domain/mcp/feishu/client.js +4 -0
- package/dist/entry/app.js +151 -559
- package/dist/entry/browser-cli.js +10 -10
- package/dist/entry/cli.js +1 -1
- package/dist/entry/cortex-cli.js +1 -1
- package/dist/entry/daemon.js +4 -4
- package/dist/entry/hook-cli.js +2 -2
- package/dist/entry/production-app-bootstrap.js +1 -1
- package/dist/entry/production-evidence-export-cli.js +1 -1
- package/dist/entry/signal-cli.js +2 -2
- package/dist/tui/index.js +41 -41
- package/package.json +3 -3
- package/vendor/pi/CHANGELOG.md +330 -0
- package/vendor/pi/dist/codemode-worker.js +2 -0
- package/vendor/pi/dist/core/export-html/ansi-to-html.js +57 -20
- package/vendor/pi/dist/core/export-html/template.css +9 -0
- package/vendor/pi/dist/core/export-html/template.js +166 -46
- package/vendor/pi/dist/core/export-html/tool-renderer.js +5 -3
- package/vendor/pi/dist/core/extensions/loader.js +1 -1
- package/vendor/pi/dist/extensions/codemode/execute.js +15 -13
- package/vendor/pi/dist/modes/interactive/theme/theme.js +36 -23
- package/vendor/pi/dist/utils/image-resize-worker.js +1 -1
- package/vendor/pi/dist/utils/image-resize.js +1 -1
- package/vendor/pi/docs/cli.md +35 -12
- package/vendor/pi/docs/custom-provider.md +2 -0
- package/vendor/pi/docs/environment-variables.md +2 -0
- package/vendor/pi/docs/extensions.md +3192 -225
- package/vendor/pi/docs/keybindings.md +2 -2
- package/vendor/pi/docs/llama-cpp.md +27 -19
- package/vendor/pi/docs/mcp.md +6 -4
- package/vendor/pi/docs/message-types.md +1 -1
- package/vendor/pi/docs/models-configuration.md +9 -3
- package/vendor/pi/docs/models.md +2 -1
- package/vendor/pi/docs/nvidia-rtx-llama-cpp.md +5 -5
- package/vendor/pi/docs/packages.md +24 -0
- package/vendor/pi/docs/prompt-templates.md +1 -1
- package/vendor/pi/docs/providers.md +4 -2
- package/vendor/pi/docs/quickstart.md +7 -3
- package/vendor/pi/docs/rpc-commands.md +1 -1
- package/vendor/pi/docs/rpc.md +4 -2
- package/vendor/pi/docs/sessions.md +17 -3
- package/vendor/pi/docs/settings.md +6 -5
- package/vendor/pi/docs/slash-commands.md +3 -2
- package/vendor/pi/docs/terminal-setup.md +3 -1
- package/vendor/pi/docs/tmux.md +6 -0
- package/vendor/pi/docs/tui.md +4 -0
- package/vendor/pi/docs/windows.md +27 -0
- package/vendor/pi/examples/extensions/README.md +2 -1
- package/vendor/pi/examples/extensions/custom-provider-anthropic/index.ts +27 -31
- package/vendor/pi/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/vendor/pi/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/vendor/pi/examples/extensions/debug-provider.ts +2 -2
- package/vendor/pi/examples/extensions/gondolin/index.ts +4 -7
- package/vendor/pi/examples/extensions/gondolin/package-lock.json +19 -29
- package/vendor/pi/examples/extensions/gondolin/package.json +2 -2
- package/vendor/pi/examples/extensions/plan-mode/index.ts +23 -13
- package/vendor/pi/examples/extensions/plan-mode/utils.ts +42 -16
- package/vendor/pi/examples/extensions/preset.ts +2 -0
- package/vendor/pi/examples/extensions/reload-runtime.ts +17 -5
- package/vendor/pi/examples/extensions/subagent/README.md +14 -11
- package/vendor/pi/examples/extensions/subagent/index.ts +392 -171
- package/vendor/pi/examples/extensions/todo.ts +7 -0
- package/vendor/pi/examples/extensions/tools.ts +2 -0
- package/vendor/pi/examples/extensions/with-deps/package-lock.json +2 -2
- package/vendor/pi/examples/extensions/with-deps/package.json +1 -1
- package/vendor/pi/examples/tsconfig.json +208 -0
- package/vendor/pi/package.json +15 -16
- package/vendor/pi/schemas/models.schema.json +66 -37
- package/vendor/pi/schemas/settings.schema.json +18 -1
- package/vendor/pi-ai/bedrock.js +1 -1
- package/vendor/pi-ai/oauth-load.js +1 -1
- package/web/dist/assets/{board-math-css-BPXakv_3.js → board-math-css-DKX6FcUS.js} +1 -1
- package/web/dist/assets/index-D11wi0uG.js +540 -0
- package/web/dist/assets/index-JedYumhY.css +1 -0
- package/web/dist/assets/{index-WCm6wwmM.js → index-jl30Gy8P.js} +1 -1
- package/web/dist/assets/pdf-worker-DdZgk2mV.js +57 -0
- package/web/dist/assets/pdf.worker.min-Bz_KHX45.js +55 -0
- package/web/dist/index.html +2 -2
- package/web/dist/theme.css +22 -0
- package/dist/chunks/anthropic-messages-M3SMXACA.js +0 -8
- package/dist/chunks/api-GM53PHIL-GFHEXXE6.js +0 -4
- package/dist/chunks/azure-openai-responses-76YWXHSB.js +0 -4
- package/dist/chunks/bedrock-converse-stream-5UPX4NTQ.js +0 -58
- package/dist/chunks/child-runner-3GHOWGZP.js +0 -4
- package/dist/chunks/chunk-2ZNLUY2U.js +0 -128
- package/dist/chunks/chunk-3F6WW7HR.js +0 -13
- package/dist/chunks/chunk-3OKHUVEM.js +0 -7
- package/dist/chunks/chunk-3YHOCPQU.js +0 -10
- package/dist/chunks/chunk-4EX2JJWB.js +0 -4
- package/dist/chunks/chunk-4LLH5OWM.js +0 -10
- package/dist/chunks/chunk-52T37Y47.js +0 -8
- package/dist/chunks/chunk-7MU2AKNM.js +0 -4
- package/dist/chunks/chunk-AAA3UBIS.js +0 -4
- package/dist/chunks/chunk-ASYQHJVQ.js +0 -9
- package/dist/chunks/chunk-BKHDWCRT.js +0 -79
- package/dist/chunks/chunk-CQLH4UVX.js +0 -4
- package/dist/chunks/chunk-CVC66CFV.js +0 -33
- package/dist/chunks/chunk-D6UA4BZC.js +0 -19
- package/dist/chunks/chunk-DGMNI4AO.js +0 -4
- package/dist/chunks/chunk-DHSA5ACV.js +0 -125
- package/dist/chunks/chunk-DPQPXBTP.js +0 -68
- package/dist/chunks/chunk-DXBSQXJL.js +0 -18
- package/dist/chunks/chunk-E7ZMYIY6.js +0 -30
- package/dist/chunks/chunk-EQITBTJC.js +0 -10
- package/dist/chunks/chunk-EXJA5RIX.js +0 -357
- package/dist/chunks/chunk-FF7UELTU.js +0 -4
- package/dist/chunks/chunk-FH74NME3.js +0 -115
- package/dist/chunks/chunk-FOQ7VLIL.js +0 -17
- package/dist/chunks/chunk-FX6MOGLR.js +0 -11
- package/dist/chunks/chunk-G2V65UBA.js +0 -4
- package/dist/chunks/chunk-HGPBHTVD.js +0 -6
- package/dist/chunks/chunk-J5DVLUKY.js +0 -6
- package/dist/chunks/chunk-JW2HFMTF.js +0 -4
- package/dist/chunks/chunk-KDYEGGMW.js +0 -4
- package/dist/chunks/chunk-KIGMAATV.js +0 -23
- package/dist/chunks/chunk-KIU5FAPY.js +0 -5
- package/dist/chunks/chunk-KIWMQPH7.js +0 -739
- package/dist/chunks/chunk-L6VCIGWS.js +0 -11
- package/dist/chunks/chunk-LACGULCN.js +0 -10
- package/dist/chunks/chunk-LMSQZ6TQ.js +0 -4
- package/dist/chunks/chunk-MEPASGPP.js +0 -6
- package/dist/chunks/chunk-MFAEUHMV.js +0 -28
- package/dist/chunks/chunk-NAA7GF6Q.js +0 -5
- package/dist/chunks/chunk-NKDMKRSB.js +0 -68
- package/dist/chunks/chunk-NKXV32S6.js +0 -4
- package/dist/chunks/chunk-NVX5IPRN.js +0 -4
- package/dist/chunks/chunk-O3JW2F7D.js +0 -8
- package/dist/chunks/chunk-OE4KH3NJ.js +0 -4
- package/dist/chunks/chunk-OISO5JXB.js +0 -4
- package/dist/chunks/chunk-OPYXNSMY.js +0 -4
- package/dist/chunks/chunk-OSEIQ7SS.js +0 -4
- package/dist/chunks/chunk-P52RMIYX.js +0 -6
- package/dist/chunks/chunk-PBJ5MPPX.js +0 -60
- package/dist/chunks/chunk-PZMGBKUR.js +0 -13
- package/dist/chunks/chunk-PZMXHA6X.js +0 -9
- package/dist/chunks/chunk-Q7CE3UIE.js +0 -133
- package/dist/chunks/chunk-QBKCAIJG.js +0 -4
- package/dist/chunks/chunk-QEOFEETJ.js +0 -4
- package/dist/chunks/chunk-QUUEQRIT.js +0 -4
- package/dist/chunks/chunk-RA6HKFBV.js +0 -4
- package/dist/chunks/chunk-REPYBMQS.js +0 -4
- package/dist/chunks/chunk-SKHLZ6XY.js +0 -9
- package/dist/chunks/chunk-TAWLERZA.js +0 -4
- package/dist/chunks/chunk-TWAEABGG.js +0 -52
- package/dist/chunks/chunk-TZFLHVOQ.js +0 -7
- package/dist/chunks/chunk-UD3NMUHR.js +0 -12
- package/dist/chunks/chunk-UNVEZI57.js +0 -4
- package/dist/chunks/chunk-VQUPKMDR.js +0 -4
- package/dist/chunks/chunk-W25TB3PU.js +0 -4
- package/dist/chunks/chunk-W5LGYSPZ.js +0 -4
- package/dist/chunks/chunk-WEZWKMYU.js +0 -4
- package/dist/chunks/chunk-XAJLZR7C.js +0 -28
- package/dist/chunks/chunk-XH6FMP3N.js +0 -71
- package/dist/chunks/chunk-XSRZHN63.js +0 -4
- package/dist/chunks/chunk-Y3GFB5XM.js +0 -8
- package/dist/chunks/chunk-YG7OEPR2.js +0 -6
- package/dist/chunks/chunk-YHIWOGVL.js +0 -4
- package/dist/chunks/chunk-YKKEI5GI.js +0 -4
- package/dist/chunks/chunk-YZSHTWNM.js +0 -92
- package/dist/chunks/chunk-Z4H3VDHI.js +0 -4
- package/dist/chunks/cli-5DBTRMHU.js +0 -53
- package/dist/chunks/client-XOGYH5UR.js +0 -4
- package/dist/chunks/cloudflare-workers-ai-system-one-32JCFHI3.js +0 -4
- package/dist/chunks/config-DJSQI77S-335IXHSM.js +0 -4
- package/dist/chunks/context-VCQH5OB6.js +0 -4
- package/dist/chunks/cost-PGGFI7QJ.js +0 -5
- package/dist/chunks/dist-PUKMZ7GW.js +0 -4
- package/dist/chunks/easter-egg-3d-MO4MOEVF.js +0 -4
- package/dist/chunks/es5-VNTQPCKX.js +0 -4
- package/dist/chunks/file-7BN7RCAY.js +0 -4
- package/dist/chunks/gateway-UCRPMR75.js +0 -36
- package/dist/chunks/github-copilot-HAI2DA62.js +0 -4
- package/dist/chunks/google-generative-ai-2VXWLHWI.js +0 -4
- package/dist/chunks/google-vertex-UA36QP2U.js +0 -4
- package/dist/chunks/init-HA7FAQ73.js +0 -4
- package/dist/chunks/kimi-coding-HMJRKCPA.js +0 -4
- package/dist/chunks/local-client-stop-SQRU7ZZM.js +0 -4
- package/dist/chunks/meta-KY3LNFV2.js +0 -4
- package/dist/chunks/mistral-conversations-34F66L3O.js +0 -7
- package/dist/chunks/model-resolver-N3DTAQ2S.js +0 -4
- package/dist/chunks/openai-codex-responses-ZBVHREB3.js +0 -12
- package/dist/chunks/openai-completions-VVIB26SH.js +0 -9
- package/dist/chunks/openai-responses-735XA2ZX.js +0 -6
- package/dist/chunks/openrouter-images-3IKETHAC.js +0 -4
- package/dist/chunks/pi-messages-I3E4ZFHA.js +0 -10
- package/dist/chunks/radius-HXRZVBDB.js +0 -4
- package/dist/chunks/remote-ops-BALZYKH6.js +0 -14
- package/dist/chunks/runner-PLVZDGHB.js +0 -4
- package/dist/chunks/runtime-6YLTA2ZD.js +0 -4
- package/dist/chunks/schedule-cli-OLASBBYJ.js +0 -4
- package/dist/chunks/slack-WAGSPZUX.js +0 -4
- package/dist/chunks/start-ui-http-QALT7C3P.js +0 -43
- package/dist/chunks/subagent-E3UC7ZHC.js +0 -4
- package/dist/chunks/tool-shims-Q6P6UXVC.js +0 -4
- package/dist/chunks/typesafe-system-one-6ULACYD4.js +0 -4
- package/dist/chunks/ui-board-4GYW6KKW.js +0 -5
- package/dist/chunks/ui-decision-U2FXSEC2.js +0 -4
- package/dist/chunks/ui-view-O7PLANT7.js +0 -4
- package/dist/chunks/virtual-modules-IDC5YKZJ.js +0 -4
- package/dist/chunks/waitpoint-2FGQBIAC.js +0 -5
- package/dist/chunks/workers-XN4PSTH6.js +0 -4
- package/vendor/aistatus/gateway-cli.js +0 -21
- package/vendor/pi/examples/extensions/sandbox/index.ts +0 -321
- package/vendor/pi/examples/extensions/sandbox/package-lock.json +0 -92
- package/vendor/pi/examples/extensions/sandbox/package.json +0 -19
- package/web/dist/assets/index-BHZpFXhc.js +0 -525
- package/web/dist/assets/index-DqWMdMkh.css +0 -1
- package/web/dist/assets/pdf-worker-Hp15W1QJ.js +0 -57
- package/web/dist/assets/pdf.worker.min-DnhTvCwe.js +0 -55
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
var s="CORTEX_MCP_TOOL_ALLOWLIST",i={"cortex-core":["remote_bash","remote_read","remote_write","remote_edit","remote_glob","remote_grep","current_time","agent","agent_stop"],"cortex-ext":["cost_query","query_executions","cortex_context","wait_create","wait_check","wait_cancel","monitor_start","monitor_stop"],"cortex-interaction-bridge":["cortex_plan_enter","cortex_plan_exit","cortex_ask_user"],"cortex-slack":["slack_send_file"],"cortex-feishu":["feishu_send_file"],"cortex-web":["send_file","send_view","send_decision","board_open"],"cortex-workers":["worker_spawn","worker_send","worker_list","worker_stop"],"cortex-worker-report":["report_to_lead"]},l=new Set(Object.values(i).flat()),u=new Set(["cortex_schedule_add","cortex_schedule_list","cortex_schedule_get","cortex_schedule_remove","cortex_schedule_pause","cortex_schedule_resume","task_status","task_result","task_list","answer_subtask","thread_abort","thread_split","thread_wait","ask_manager","thread_run","cortex_commission_start","cortex_commission_submit","board_close","mark_routine","worker_answer"]),d=["agent","agent_stop"];function w(e,t){let o=e??t.flatMap(n=>i[n]??[]),r=new Set(d);return _(o.filter(n=>!r.has(n)))}function _(e){return[...new Set(e)].filter(t=>!u.has(t)).sort()}function p(e,t=l){let o=_(e).filter(r=>!t.has(r));if(o.length>0)throw new Error(`Unknown MCP tool name(s): ${o.join(", ")}`)}function x(e=process.env[s]){if(e===void 0)return null;let t;try{t=JSON.parse(e)}catch{throw new Error(`${s} must be a JSON string array`)}if(!Array.isArray(t)||t.some(r=>typeof r!="string"))throw new Error(`${s} must be a JSON string array`);let o=_(t);return p(o),new Set(o)}function a(e,t){return(...o)=>t.has(o[0])?e(...o):void 0}function h(e,t,o=x()){if(o===null){t(e);return}let r=e,n=r.tool.bind(e),c=r.registerTool.bind(e);r.tool=a(n,o),r.registerTool=a(c,o);try{t(e)}finally{r.tool=n,r.registerTool=c}}export{s as a,i as b,u as c,d,w as e,_ as f,p as g,x as h,h as i};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{d as je}from"./chunk-WHC7AYZD.js";var ET={};je(ET,{AddImmutable:()=>ht,AddImmutableDeferred:()=>mo,AddOptional:()=>nt,AddOptionalDeferred:()=>Ae,AddReadonly:()=>st,AddReadonlyDeferred:()=>De,Any:()=>bt,Array:()=>Te,ArrayOptions:()=>yr,BigInt:()=>_t,BigIntPattern:()=>za,Boolean:()=>Er,Broaden:()=>Mn,Call:()=>Ho,CallConstruct:()=>Yt,CanComposite:()=>Pn,Capitalize:()=>Jo,CapitalizeAction:()=>Vn,CapitalizeDeferred:()=>Dr,CapitalizeInstantiate:()=>ei,Codec:()=>hr,CollapseToObject:()=>Kt,Compare:()=>Rt,CompareResultDisjoint:()=>sr,CompareResultEqual:()=>Vt,CompareResultLeftInside:()=>Ht,CompareResultRightInside:()=>Zt,Composite:()=>no,Conditional:()=>ai,ConditionalAction:()=>Qn,ConditionalDeferred:()=>Gr,ConditionalInstantiate:()=>oi,Constructor:()=>qe,ConstructorOptions:()=>Ea,ConstructorParameters:()=>ii,ConstructorParametersAction:()=>Xn,ConstructorParametersDeferred:()=>zr,ConstructorParametersInstantiate:()=>si,ConvertToIntegerKey:()=>Ut,Cyclic:()=>Fe,CyclicCandidates:()=>Ko,CyclicCheck:()=>Do,CyclicDependencies:()=>Uo,CyclicExtends:()=>No,CyclicOptions:()=>ox,CyclicTarget:()=>Ne,Decode:()=>Da,DecodeBuilder:()=>Bt,Deferred:()=>I,Dependent:()=>at,DependentOptions:()=>Ca,Distribute:()=>Jt,Encode:()=>Ka,EncodeBuilder:()=>zt,Enum:()=>qa,Evaluate:()=>Ni,EvaluateAction:()=>_n,EvaluateDeferred:()=>po,EvaluateDependent:()=>Se,EvaluateEnum:()=>fe,EvaluateInstantiate:()=>Bo,EvaluateIntersect:()=>D,EvaluateTemplateLiteral:()=>me,EvaluateType:()=>ke,EvaluateUnion:()=>Ie,EvaluateUnionFast:()=>Qe,Exclude:()=>mi,ExcludeAction:()=>mr,ExcludeDeferred:()=>Br,ExcludeInstantiate:()=>pi,Extends:()=>ae,ExtendsResult:()=>g,Extract:()=>ui,ExtractAction:()=>Yn,ExtractDeferred:()=>_r,ExtractInstantiate:()=>ci,Flatten:()=>vt,Function:()=>Le,FunctionOptions:()=>ka,Generic:()=>Ze,Identifier:()=>Wt,Immutable:()=>Ua,Index:()=>fi,IndexAction:()=>ea,IndexDeferred:()=>er,IndexInstantiate:()=>di,Infer:()=>Nt,InstanceType:()=>xi,InstanceTypeAction:()=>ta,InstanceTypeDeferred:()=>Wr,InstanceTypeInstantiate:()=>Ii,Instantiate:()=>Ia,InstantiateCyclic:()=>Go,Integer:()=>pt,IntegerKey:()=>Xe,IntegerPattern:()=>kr,Interface:()=>Fo,InterfaceAction:()=>zn,InterfaceDeferred:()=>Xt,InterfaceInstantiate:()=>Ao,Intersect:()=>de,IntersectOptions:()=>La,InvalidLiteralValue:()=>kn,IsAny:()=>U,IsArray:()=>F,IsBigInt:()=>Ke,IsBoolean:()=>he,IsCall:()=>Ft,IsCodec:()=>br,IsConstructor:()=>Q,IsCyclic:()=>te,IsDeferred:()=>He,IsDependent:()=>N,IsEnum:()=>re,IsEnumValue:()=>wa,IsFunction:()=>X,IsGeneric:()=>Tt,IsIdentifier:()=>Ba,IsImmutable:()=>it,IsInfer:()=>_,IsInteger:()=>ue,IsInterfaceDeferred:()=>qt,IsIntersect:()=>k,IsKind:()=>x,IsLiteral:()=>M,IsLiteralBigInt:()=>vx,IsLiteralBoolean:()=>Cx,IsLiteralNumber:()=>_a,IsLiteralString:()=>Wa,IsLiteralValue:()=>Or,IsNever:()=>ve,IsNull:()=>kt,IsNumber:()=>V,IsObject:()=>S,IsOptional:()=>se,IsParameter:()=>Va,IsReadonly:()=>mt,IsRecord:()=>oe,IsRef:()=>Y,IsRefine:()=>En,IsRefinement:()=>Os,IsRest:()=>Ye,IsSchema:()=>Z,IsString:()=>ce,IsSymbol:()=>Je,IsTemplateLiteral:()=>G,IsTemplateLiteralDeferred:()=>Ro,IsTemplateLiteralFinite:()=>Mr,IsTemplateLiteralPattern:()=>bT,IsThis:()=>Lr,IsTuple:()=>L,IsTypeScriptEnumLike:()=>Sa,IsUndefined:()=>jt,IsUnion:()=>y,IsUnknown:()=>B,IsUnsafe:()=>Tr,IsVoid:()=>Ue,KeyOf:()=>yi,KeyOfAction:()=>ra,KeyOfDeferred:()=>tr,KeyOfInstantiate:()=>$i,KeysToIndexer:()=>Dt,Literal:()=>O,LiteralTypeName:()=>Ps,Lowercase:()=>Qo,LowercaseAction:()=>Hn,LowercaseDeferred:()=>Kr,LowercaseInstantiate:()=>ti,Mapped:()=>gi,MappedAction:()=>na,MappedDeferred:()=>Qt,MappedInstantiate:()=>Ti,Module:()=>Gi,ModuleDeferred:()=>uo,ModuleInstantiate:()=>xn,Narrow:()=>ao,Never:()=>w,NeverPattern:()=>Oa,NonNullable:()=>bi,NonNullableAction:()=>oa,NonNullableDeferred:()=>Vr,NonNullableInstantiate:()=>hi,Null:()=>Et,Number:()=>ye,NumberKey:()=>Mt,NumberPattern:()=>Pr,Object:()=>$,ObjectOptions:()=>Ma,Omit:()=>Ei,OmitAction:()=>ia,OmitDeferred:()=>Hr,OmitInstantiate:()=>ki,Optional:()=>Pa,Parameter:()=>ut,Parameters:()=>Oi,ParametersAction:()=>ma,ParametersDeferred:()=>Zr,ParametersInstantiate:()=>Pi,ParsePatternIntoTypes:()=>Pt,ParseTemplateIntoTypes:()=>Oo,Partial:()=>Ri,PartialAction:()=>pa,PartialDeferred:()=>Jr,PartialInstantiate:()=>Mi,Pick:()=>vi,PickAction:()=>ua,PickDeferred:()=>Qr,PickInstantiate:()=>Ci,Priority:()=>TT,PropertyKeys:()=>$r,PropertyValues:()=>gr,Readonly:()=>Na,ReadonlyObject:()=>ca,ReadonlyObjectAction:()=>fa,ReadonlyObjectDeferred:()=>Xr,ReadonlyObjectInstantiate:()=>ji,ReadonlyType:()=>Si,Record:()=>jr,RecordAction:()=>vn,RecordDeferred:()=>Sr,RecordFromPattern:()=>io,RecordInstantiate:()=>oo,RecordKey:()=>Ct,RecordOptions:()=>eI,RecordPattern:()=>Oe,RecordPatternToType:()=>wr,RecordValue:()=>le,Ref:()=>ze,RefInstantiate:()=>wi,Refine:()=>Ga,RefineAdd:()=>ks,RemoveImmutable:()=>$T,RemoveImmutableDeferred:()=>yT,RemoveOptional:()=>Cr,RemoveOptionalDeferred:()=>to,RemoveReadonly:()=>Ya,RemoveReadonlyDeferred:()=>Xa,Required:()=>qi,RequiredAction:()=>la,RequiredArray:()=>Ra,RequiredDeferred:()=>Yr,RequiredInstantiate:()=>Li,Rest:()=>ft,ReturnType:()=>Ai,ReturnTypeAction:()=>da,ReturnTypeDeferred:()=>en,ReturnTypeInstantiate:()=>Fi,Script:()=>zi,String:()=>Ee,StringKey:()=>Ce,StringPattern:()=>Rr,Symbol:()=>Ot,TemplateLiteral:()=>vo,TemplateLiteralCreate:()=>vr,TemplateLiteralDecode:()=>Za,TemplateLiteralDecodeUnsafe:()=>On,TemplateLiteralDeferred:()=>Fr,TemplateLiteralEncode:()=>Po,TemplateLiteralFromString:()=>Zu,TemplateLiteralFromTypes:()=>Mo,This:()=>qr,Tuple:()=>H,TupleOptions:()=>Ja,Type:()=>yn,TypeScriptEnumToEnumValues:()=>ja,Uncapitalize:()=>Xo,UncapitalizeAction:()=>Zn,UncapitalizeDeferred:()=>Ur,UncapitalizeInstantiate:()=>ri,Undefined:()=>St,Union:()=>h,UnionOptions:()=>Ha,Unknown:()=>ee,Unsafe:()=>va,Uppercase:()=>Yo,UppercaseAction:()=>Jn,UppercaseDeferred:()=>Nr,UppercaseInstantiate:()=>ni,Void:()=>Ar,With:()=>Di,WithAction:()=>xa,WithDeferred:()=>tn,WithInstantiate:()=>Ki,_Array_:()=>Te,_Function_:()=>Le,_Object_:()=>$,default:()=>hT});var p={};je(p,{Assign:()=>zd,Clone:()=>dr,Create:()=>ex,Discard:()=>tx,Metrics:()=>we,Update:()=>rx});var we={assign:0,create:0,clone:0,discard:0,update:0};var Me={};je(Me,{Get:()=>Gd,Reset:()=>Ud,Set:()=>Nd});var ps={};je(ps,{And:()=>ha,ArrayLiteral:()=>sd,ArrowFunction:()=>md,Call:()=>pd,ConstDeclaration:()=>dd,Constant:()=>ms,Counted:()=>rd,Entries:()=>nd,Every:()=>Yl,HasPropertyKey:()=>od,If:()=>xd,IsArray:()=>is,IsBigInt:()=>Ll,IsBoolean:()=>Al,IsConstructor:()=>_l,IsDeepEqual:()=>id,IsEqual:()=>Wl,IsFunction:()=>Bl,IsGreaterEqualThan:()=>Jl,IsGreaterThan:()=>Vl,IsInteger:()=>Fl,IsLessEqualThan:()=>Zl,IsLessThan:()=>Hl,IsMaxLength:()=>Xl,IsMinLength:()=>Ql,IsNull:()=>Dl,IsNumber:()=>Kl,IsObject:()=>ss,IsObjectNotArray:()=>Ul,IsString:()=>Nl,IsSymbol:()=>Gl,IsUndefined:()=>zl,Keys:()=>ad,Member:()=>cd,MultipleOf:()=>gd,New:()=>ud,Not:()=>os,Or:()=>as,ReduceAnd:()=>yd,ReduceOr:()=>$d,Return:()=>Id,Some:()=>ed,SomeAll:()=>td,Statements:()=>ld,Ternary:()=>fd});var i={};je(i,{Counted:()=>Ol,Entries:()=>Ml,EntriesRegExp:()=>Rl,Every:()=>bl,EveryAll:()=>hl,GraphemeCount:()=>$l,HasPropertyKey:()=>Pl,IsArray:()=>cr,IsBigInt:()=>ur,IsBoolean:()=>Yi,IsClassInstance:()=>yl,IsConstructor:()=>cl,IsDeepEqual:()=>ba,IsEqual:()=>E,IsFunction:()=>es,IsGreaterEqualThan:()=>rs,IsGreaterThan:()=>dl,IsInteger:()=>$a,IsLessEqualThan:()=>ts,IsLessThan:()=>xl,IsMaxLength:()=>gl,IsMinLength:()=>Tl,IsMultipleOf:()=>Il,IsNull:()=>Tn,IsNumber:()=>bn,IsObject:()=>fr,IsObjectNotArray:()=>fl,IsString:()=>lr,IsSymbol:()=>ll,IsUndefined:()=>ga,IsUnsafePropertyKey:()=>ns,IsValueLike:()=>Ta,Keys:()=>gn,ShiftLeft:()=>hn,Some:()=>El,SomeAll:()=>kl,Symbols:()=>vl,Values:()=>Cl});function $t(e,t,r){return e>=t&&e<=r}function Wi(e){return e===8205}function sl(e){return $t(e,55296,56319)}function Bi(e){return $t(e,127462,127487)}function Vi(e){return $t(e,65024,65039)}function Hi(e){return $t(e,768,879)||$t(e,6832,6911)||$t(e,7616,7679)||$t(e,65056,65071)}function $n(e){return e>65535?2:1}function _i(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(Hi(r)||Vi(r))t+=$n(r);else break}return t}function ya(e,t){let r=e.codePointAt(t),n=t+$n(r);for(n=_i(e,n);n<e.length-1&&Wi(e.codePointAt(n));){let o=e.codePointAt(n+1);n+=1+$n(o),n=_i(e,n)}return Bi(r)&&n<e.length&&Bi(e.codePointAt(n))&&(n+=$n(e.codePointAt(n))),n}function Zi(e){return e>=768&&(sl(e)||Hi(e)||Vi(e)||Wi(e))}function Ji(e){let t=0,r=0;for(;r<e.length;)r=ya(e,r),t++;return t}function ml(e,t){let r=0,n=0;for(;n<e.length;)if(n=ya(e,n),++r>=t)return!0;return!1}function pl(e,t){let r=0,n=0;for(;n<e.length;)if(n=ya(e,n),++r>t)return!1;return!0}function Qi(e,t){if(t===0)return!0;if(e.length<t)return!1;let r=0;for(;;){if(Zi(e.charCodeAt(r)))return ml(e,t);if(++r>=t)return!0}}function Xi(e,t){if(e.length<=t)return!0;let r=0;for(;;){if(Zi(e.charCodeAt(r)))return pl(e,t);if(++r>t)return!1}}function cr(e){return Array.isArray(e)}function ur(e){return E(typeof e,"bigint")}function Yi(e){return E(typeof e,"boolean")}function cl(e){if(ga(e)||!es(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function es(e){return E(typeof e,"function")}function $a(e){return Number.isInteger(e)}function Tn(e){return E(e,null)}function bn(e){return Number.isFinite(e)}function fl(e){return fr(e)&&!cr(e)}function fr(e){return E(typeof e,"object")&&!Tn(e)}function lr(e){return E(typeof e,"string")}function ll(e){return E(typeof e,"symbol")}function ga(e){return E(e,void 0)}function E(e,t){return e===t}function dl(e,t){return e>t}function xl(e,t){return e<t}function ts(e,t){return e<=t}function rs(e,t){return e>=t}function Il(e,t){if(ur(e)||ur(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!bn(e)||$a(e)&&1/t%1===0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<r}function yl(e){if(!fr(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Tn(t)?!1:E(typeof t.constructor,"function")&&!(E(t.constructor,globalThis.Object)||E(t.constructor.name,"Object"))}function Ta(e){return ur(e)||Yi(e)||Tn(e)||bn(e)||lr(e)||ga(e)}function $l(e){return Ji(e)}function gl(e,t){return Xi(e,t)}function Tl(e,t){return Qi(e,t)}function bl(e,t,r){return e.every((n,o)=>o<t||r(n,o))}function hl(e,t,r){let n=!0;return e.forEach((o,s)=>{s>=t&&!r(o,s)&&(n=!1)}),n}function El(e,t){return e.some((r,n)=>t(r,n))}function kl(e,t){let r=!1;return e.forEach((n,o)=>{t(n,o)&&(r=!0)}),r}function Ol(e,t){return e.reduce((r,n,o)=>t(n,o)?++r:r,0)}function hn(e,t,r){return E(e.length,0)?r():t(e[0],e.slice(1))}function ns(e){return E(e,"__proto__")||E(e,"constructor")||E(e,"prototype")}function Pl(e,t){return ns(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Rl(e){return gn(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function Ml(e){return Object.entries(e)}function gn(e){return Object.getOwnPropertyNames(e)}function vl(e){return Object.getOwnPropertySymbols(e)}function Cl(e){return Object.values(e)}function Sl(e,t){if(!fr(t))return!1;let r=gn(e);return E(r.length,gn(t).length)&&r.every(n=>ba(e[n],t[n]))}function jl(e,t){return cr(t)&&E(e.length,t.length)&&e.every((r,n)=>ba(e[n],t[n]))}function ba(e,t){return cr(e)?jl(e,t):fr(e)?Sl(e,t):E(e,t)}var wl=/^[\p{ID_Start}_$][\p{ID_Continue}_$\u200C\u200D]*$/u;function ql(e){return wl.test(e)}function ha(e,t){return`(${e} && ${t})`}function as(e,t){return`(${e} || ${t})`}function os(e){return`!(${e})`}function is(e){return`Array.isArray(${e})`}function Ll(e){return`typeof ${e} === "bigint"`}function Al(e){return`typeof ${e} === "boolean"`}function Fl(e){return`Number.isInteger(${e})`}function Dl(e){return`${e} === null`}function Kl(e){return`Number.isFinite(${e})`}function Ul(e){return ha(ss(e),os(is(e)))}function ss(e){return`typeof ${e} === "object" && ${e} !== null`}function Nl(e){return`typeof ${e} === "string"`}function Gl(e){return`typeof ${e} === "symbol"`}function zl(e){return`${e} === undefined`}function Bl(e){return`typeof ${e} === "function"`}function _l(e){return`Guard.IsConstructor(${e})`}function Wl(e,t){return`${e} === ${t}`}function Vl(e,t){return`${e} > ${t}`}function Hl(e,t){return`${e} < ${t}`}function Zl(e,t){return`${e} <= ${t}`}function Jl(e,t){return`${e} >= ${t}`}function Ql(e,t){return`Guard.IsMinLength(${e}, ${t})`}function Xl(e,t){return`Guard.IsMaxLength(${e}, ${t})`}function Yl(e,t,r,n){return E(t,"0")?`${e}.every((${r[0]}, ${r[1]}) => (${n}))`:`${e}.every((${r[0]}, ${r[1]}) => (${r[1]} < ${t}) || (${n}))`}function ed(e,t,r){return`${e}.some((${t[0]}, ${t[1]}) => ${r})`}function td(e,t,r){return`((value) => { let result = false; value.forEach((${t[0]}, ${t[1]}) => { if (${r}) result = true }); return result })(${e})`}function rd(e,t,r){return`${e}.reduce((result, ${t[0]}, ${t[1]}) => (${r}) ? ++result : result, 0)`}function nd(e){return`Object.entries(${e})`}function ad(e){return`Object.getOwnPropertyNames(${e})`}function od(e,t){return E(t,'"__proto__"')||E(t,'"constructor"')?`Object.prototype.hasOwnProperty.call(${e}, ${t})`:`${t} in ${e}`}function id(e,t){return`Guard.IsDeepEqual(${e}, ${t})`}function sd(e){return`[${e.join(", ")}]`}function md(e,t){return`((${e.join(", ")}) => ${t})`}function pd(e,t){return`${e}(${t.join(", ")})`}function ud(e,t){return`new ${e}(${t.join(", ")})`}function cd(e,t){return`${e}${ql(t)?`.${t}`:`[${ms(t)}]`}`}function ms(e){if(!Ta(e))throw Error("Unsupported Constant");return lr(e)?JSON.stringify(e):`${e}`}function fd(e,t,r){return`(${e} ? ${t} : ${r})`}function ld(e){return`{ ${e.join("; ")}; }`}function dd(e,t){return`const ${e} = ${t}`}function xd(e,t){return`if(${e}) { ${t} }`}function Id(e){return`return ${e}`}function yd(e){return E(e.length,0)?"true":e.reduce((t,r)=>ha(t,r))}function $d(e){return E(e.length,0)?"false":e.reduce((t,r)=>as(t,r))}function gd(e,t){return`Guard.IsMultipleOf(${e}, ${t})`}var ge={};je(ge,{IsBigInt64Array:()=>wd,IsBigUint64Array:()=>qd,IsBoolean:()=>Td,IsDate:()=>Ad,IsFloat32Array:()=>Sd,IsFloat64Array:()=>jd,IsInt16Array:()=>Rd,IsInt32Array:()=>vd,IsInt8Array:()=>kd,IsMap:()=>Dd,IsNumber:()=>bd,IsRegExp:()=>Ld,IsSet:()=>Fd,IsString:()=>hd,IsTypeArray:()=>Ed,IsUint16Array:()=>Md,IsUint32Array:()=>Cd,IsUint8Array:()=>Od,IsUint8ClampedArray:()=>Pd});function Td(e){return e instanceof Boolean}function bd(e){return e instanceof Number}function hd(e){return e instanceof String}function Ed(e){return globalThis.ArrayBuffer.isView(e)}function kd(e){return e instanceof globalThis.Int8Array}function Od(e){return e instanceof globalThis.Uint8Array}function Pd(e){return e instanceof globalThis.Uint8ClampedArray}function Rd(e){return e instanceof globalThis.Int16Array}function Md(e){return e instanceof globalThis.Uint16Array}function vd(e){return e instanceof globalThis.Int32Array}function Cd(e){return e instanceof globalThis.Uint32Array}function Sd(e){return e instanceof globalThis.Float32Array}function jd(e){return e instanceof globalThis.Float64Array}function wd(e){return e instanceof globalThis.BigInt64Array}function qd(e){return e instanceof globalThis.BigUint64Array}function Ld(e){return e instanceof globalThis.RegExp}function Ad(e){return e instanceof globalThis.Date}function Fd(e){return e instanceof globalThis.Set}function Dd(e){return e instanceof globalThis.Map}var OT=i;var Ge={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Ud(){Ge.immutableTypes=!1,Ge.maxErrors=8,Ge.maxInstantiationCount=128,Ge.useAcceleration=!0,Ge.exactOptionalPropertyTypes=!1,Ge.enumerableKind=!1,Ge.correctiveParse=!1,Ge.unionPrioritySort=!0}function Nd(e){for(let t of i.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(Ge,t,{value:r})}}function Gd(){return Ge}function rt(e){return Me.Get().immutableTypes?Object.freeze(e):e}function zd(e,t){return we.assign+=1,rt({...e,...t})}function Bd(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function _d(e){let t={};for(let r of i.Keys(e)){if(i.IsUnsafePropertyKey(r))continue;let n=Object.getOwnPropertyDescriptor(e,r);n.value=gt(n.value),i.IsEqual(n.enumerable,!0)?t[r]=n.value:Object.defineProperty(t,r,n)}return t}function Wd(e){let t={};for(let r of i.Keys(e))i.IsUnsafePropertyKey(r)||(t[r]=gt(e[r]));for(let r of i.Symbols(e))t[r]=gt(e[r]);return t}function Vd(e){return i.IsClassInstance(e)?e:Bd(e)?_d(e):Wd(e)}function Hd(e){return e.map(t=>gt(t))}function Zd(e){return e.slice()}function Jd(e){return new RegExp(e.source,e.flags)}function Qd(e){return new Map(gt([...e.entries()]))}function Xd(e){return new Set(gt([...e.values()]))}function gt(e){return ge.IsTypeArray(e)?Zd(e):ge.IsRegExp(e)?Jd(e):ge.IsMap(e)?Qd(e):ge.IsSet(e)?Xd(e):i.IsArray(e)?Hd(e):i.IsObject(e)?Vd(e):e}function dr(e){return we.clone+=1,gt(e)}function Yd(e,t){for(let r of Object.keys(t))Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:!1,value:t[r]});return e}function us(e,t){return{...e,...t}}function ex(e,t,r={}){we.create+=1;let n=us(t,r),o=Me.Get().enumerableKind?us(n,e):Yd(n,e);return rt(o)}function tx(e,t){we.discard+=1;let r={};for(let n of i.Keys(e)){if(t.includes(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=dr(o.value),Object.defineProperty(r,n,o)}return rt(r)}function rx(e,t,r){we.update+=1;let n=Me.Get(),o=dr(e);for(let s of Object.keys(t))Object.defineProperty(o,s,{configurable:!0,writable:!0,enumerable:n.enumerableKind,value:t[s]});for(let s of Object.keys(r))Object.defineProperty(o,s,{configurable:!0,enumerable:!0,writable:!0,value:r[s]});return rt(o)}function x(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function Z(e){return i.IsObject(e)}function I(e,t,r){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function He(e){return x(e,"Deferred")}function nx(e){return p.Update(e,{"~readonly":!0},{})}function xr(e,t){return p.Update(nx(e),{},t)}function cs(e,t,r,n){let o=c(e,t,r);return xr(o,n)}function ax(e){return p.Update(e,{"~optional":!0},{})}function Ir(e,t){return p.Update(ax(e),{},t)}function fs(e,t,r,n){let o=c(e,t,r);return Ir(o,n)}function Te(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function F(e){return x(e,"Array")}function yr(e){return p.Discard(e,["~kind","type","items"])}function qe(e,t,r={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function Q(e){return x(e,"Constructor")}function Ea(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Le(e,t,r={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function X(e){return x(e,"Function")}function ka(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function ze(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function Y(e){return x(e,"Ref")}function Ze(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Tt(e){return x(e,"Generic")}function bt(e){return p.Create({"~kind":"Any"},{},e)}function U(e){return x(e,"Any")}var Oa="(?!)";function w(e){return p.Create({"~kind":"Never"},{not:{}},e)}function ve(e){return x(e,"Never")}function Ae(e,t={}){return I("AddOptional",[e],t)}function nt(e,t={}){return Ir(e,t)}function Pa(e){return nt(e)}function se(e){return Z(e)&&i.HasPropertyKey(e,"~optional")}function Ra(e){return i.Keys(e).filter(t=>!se(e[t]))}function $r(e){return i.Keys(e)}function gr(e){return i.Values(e)}function $(e,t={}){let r=Ra(e),n=r.length>0?{required:r}:{};return p.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function S(e){return x(e,"Object")}function Ma(e){return p.Discard(e,["~kind","type","properties","required"])}function ee(e){return p.Create({"~kind":"Unknown"},{},e)}function B(e){return x(e,"Unknown")}function Fe(e,t,r){let n=i.Keys(e).reduce((o,s)=>({...o,[s]:p.Update(e[s],{},{$id:s})}),{});return p.Create({"~kind":"Cyclic"},{$defs:n,$ref:t},r)}function te(e){return x(e,"Cyclic")}function ox(e){return p.Discard(e,["~kind","$defs","$ref"])}function va(e){return p.Update(e,{"~unsafe":null},{})}function Tr(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var Be={};je(Be,{Match:()=>ix});function ix(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Nt(...e){let[t,r]=Be.Match(e,{2:(n,o)=>[n,o,o],1:n=>[n,ee(),ee()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function _(e){return x(e,"Infer")}function at(e,t,r,n={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function N(e){return x(e,"Dependent")}function Ca(e){return p.Discard(e,["~kind","if","then","else"])}function Sa(e){return i.IsObjectNotArray(e)}function ja(e){return i.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function wa(e){return i.IsString(e)||i.IsNumber(e)}function qa(e,t){let r=Sa(e)?ja(e):e;return p.Create({"~kind":"Enum"},{enum:r},t)}function re(e){return x(e,"Enum")}function de(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function k(e){return x(e,"Intersect")}function La(e){return p.Discard(e,["~kind","allOf"])}var ds={};je(ds,{CanEvaluate:()=>mx,Evaluate:()=>ls});var Aa;function sx(){try{return ls("null")(),!0}catch{return!1}}function mx(){return i.IsUndefined(Aa)&&(Aa=sx()),Aa&&Me.Get().useAcceleration}function ls(...e){return new globalThis.Function(...e)}var bs={};je(bs,{Hash:()=>Px,HashCode:()=>Ts});function J(){throw new Error("Unreachable")}function px(e){let t=new Set,r=e;for(;r&&r!==Object.prototype;){for(let n of Reflect.ownKeys(r))n!=="constructor"&&typeof n!="symbol"&&t.add(n);r=Object.getPrototypeOf(r)}return[...t]}function ux(e){return typeof e=="number"}var xe;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(xe||(xe={}));var Gt=BigInt("14695981039346656037"),[cx,fx]=[BigInt("1099511628211"),BigInt("18446744073709551616")],lx=Array.from({length:256}).map((e,t)=>BigInt(t)),ys=new Float64Array(1),$s=new DataView(ys.buffer),gs=new Uint8Array(ys.buffer);function ne(e){Gt=Gt^lx[e],Gt=Gt*cx%fx}function dx(e){ne(xe.Array);for(let t of e)ot(t)}function xx(e){ne(xe.BigInt),$s.setBigInt64(0,e);for(let t of gs)ne(t)}function xs(e){ne(xe.Boolean),ne(e?1:0)}function Ix(e){ne(xe.Constructor),ot(e.toString())}function yx(e){ne(xe.Date),ot(e.getTime())}function $x(e){ne(xe.Function),ot(e.toString())}function gx(e){ne(xe.Null)}function Is(e){ne(xe.Number),$s.setFloat64(0,e,!0);for(let t of gs)ne(t)}function Tx(e){ne(xe.Object);for(let t of px(e).sort())ot(t),ot(e[t])}function bx(e){ne(xe.RegExp),Fa(e.toString())}var hx=new TextEncoder;function Fa(e){ne(xe.String);for(let t of hx.encode(e))ne(t)}function Ex(e){ne(xe.Symbol),ot(e.toString())}function kx(e){ne(xe.TypeArray);let t=new Uint8Array(e.buffer);for(let r=0;r<t.length;r++)ne(t[r])}function Ox(e){return ne(xe.Undefined)}function ot(e){return ge.IsTypeArray(e)?kx(e):ge.IsDate(e)?yx(e):ge.IsRegExp(e)?bx(e):ge.IsBoolean(e)?xs(e.valueOf()):ge.IsString(e)?Fa(e.valueOf()):ge.IsNumber(e)?Is(e.valueOf()):ux(e)?Is(e):i.IsArray(e)?dx(e):i.IsBoolean(e)?xs(e):i.IsBigInt(e)?xx(e):i.IsConstructor(e)?Ix(e):i.IsNull(e)?gx(e):i.IsObject(e)?Tx(e):i.IsString(e)?Fa(e):i.IsSymbol(e)?Ex(e):i.IsUndefined(e)?Ox(e):i.IsFunction(e)?$x(e):J()}function Ts(e){return Gt=BigInt("14695981039346656037"),ot(e),Gt}function Px(e){return Ts(e).toString(16).padStart(16,"0")}function hs(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var Rx=hs;function Kh(){return Rx}var zt=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=br(r)?m=>this.decode(r["~codec"].decode(m)):this.decode,o=br(r)?m=>r["~codec"].encode(t(m)):t,s={decode:n,encode:o};return p.Update(this.type,{"~codec":s},{})}},Bt=class{constructor(t){this.type=t}Decode(t){return new zt(this.type,t)}};function hr(e){return new Bt(e)}function Da(e,t){return hr(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Ka(e,t){return hr(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function br(e){return Z(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function Ua(e){return ht(e)}function it(e){return Z(e)&&i.HasPropertyKey(e,"~immutable")}function De(e,t={}){return I("AddReadonly",[e],t)}function st(e,t={}){return xr(e,t)}function Na(e){return st(e)}function mt(e){return Z(e)&&i.HasPropertyKey(e,"~readonly")}function ks(e,t){let r=En(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":r},{})}function Ga(...e){let[t,r,n]=Be.Match(e,{3:(o,s,m)=>[o,s,m],2:(o,s)=>[o,s,()=>"Refine Error"]});return ks(t,{check:r,error:n})}function Os(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function En(e){return Z(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>Os(t))}var za="-?(?:0|[1-9][0-9]*)n";function _t(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Ke(e){return x(e,"BigInt")}function Er(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function he(e){return x(e,"Boolean")}function Wt(e){return p.Create({"~kind":"Identifier"},{name:e})}function Ba(e){return x(e,"Identifier")}var kr="-?(?:0|[1-9][0-9]*)";function pt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function ue(e){return x(e,"Integer")}var kn=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function Ps(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new kn(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:Ps(e),const:e},t)}function Or(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function vx(e){return M(e)&&i.IsBigInt(e.const)}function Cx(e){return M(e)&&i.IsBoolean(e.const)}function _a(e){return M(e)&&i.IsNumber(e.const)}function Wa(e){return M(e)&&i.IsString(e.const)}function M(e){return x(e,"Literal")}function Et(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function kt(e){return x(e,"Null")}var Pr="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function ye(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function V(e){return x(e,"Number")}function Ot(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function Je(e){return x(e,"Symbol")}function ut(...e){let[t,r,n]=Be.Match(e,{3:(o,s,m)=>[o,s,m],2:(o,s)=>[o,s,s],1:o=>[o,ee(),ee()]});return p.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function Va(e){return x(e,"Parameter")}var Rr=".*";function Ee(e){return p.Create({"~kind":"String"},{type:"string"},e)}function ce(e){return x(e,"String")}function h(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function y(e){return x(e,"Union")}function Ha(e){return p.Discard(e,["~kind","anyOf"])}function Pt(e){let t=Rs(e);return i.IsEqual(t.length,2)?t[0]:[]}function Sx(e){return!0}function Ms(e){return i.ShiftLeft(e,(t,r)=>jx(t)?Ms(r):!1,()=>!0)}function vs(e){return i.IsEqual(e.length,0)?!1:Ms(e)}function jx(e){return y(e)?vs(e.anyOf):M(e)?Sx(e.const):!1}function Mr(e){return vs(e)}function vr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Cs(e,t,r=[]){return i.ShiftLeft(e,(n,o)=>Cs(o,t,[...r,`${n}${t}`]),()=>r)}function wx(e,t){return i.IsEqual(e.length,0)?[`${t}`]:Cs(e,t)}function Ss(e,t,r=[]){return i.ShiftLeft(t,(n,o)=>Ss(e,o,[...r,...js(e,n)]),()=>r)}function js(e,t){return y(t)?Ss(e,t.anyOf):M(t)?wx(e,t.const):J()}function ws(e,t){return i.ShiftLeft(t,(r,n)=>ws(js(e,r),n),()=>e)}function qx(e){return e.map(t=>O(t))}function Lx(e){let t=ws([],e),r=qx(t);return h(r)}function Ax(e){return i.IsEqual(e.length,0)?J():i.IsEqual(e.length,1)&&M(e[0])?e[0]:Lx(e)}function On(e){let t=Pt(e);return i.IsEqual(t.length,0)?Ee():Mr(t)?Ax(t):vr(e)}function Za(e){let t=On(e);return G(t)?Ee():t}function $e(e,t){let r="object",n={[e]:t};return p.Create({"~kind":"Record"},{type:r,patternProperties:n})}function qs(e){return $e(Ce,e)}function Ls(e){return $({true:e,false:e})}function H(e,t={}){let[r,n,o]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:o,items:r,minItems:n},t)}function L(e){return x(e,"Tuple")}function Ja(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Fx(e){return p.Discard(e,["~readonly"])}function Qa(e,t){return p.Update(Fx(e),{},t)}function As(e,t,r,n){let o=c(e,t,r);return Qa(o,n)}function Xa(e,t={}){return I("RemoveReadonly",[e],t)}function Ya(e,t={}){return Qa(e,t)}function Dx(e){return p.Discard(e,["~optional"])}function eo(e,t){return p.Update(Dx(e),{},t)}function Fs(e,t,r,n){let o=c(e,t,r);return eo(o,n)}function to(e,t={}){return I("RemoveOptional",[e],t)}function Cr(e,t={}){return eo(e,t)}function ro(e){return e.reduceRight((r,n,o)=>({[o]:n,...r}),{})}function Ds(e){let t=ro(e.items);return $(t)}function Pn(e){return S(e)||L(e)}function Kx(e,t){return mt(e)?!!mt(t):!1}function Ux(e,t){return se(e)?!!se(t):!1}function Nx(e,t){let r=Kx(e,t),n=Ux(e,t),o=D([e,t]),s=Ya(Cr(o));return r&&n?st(nt(s)):r&&!n?st(s):!r&&n?nt(s):s}function Gx(e,t,r){return r in e?r in t?Nx(e[r],t[r]):e[r]:r in t?t[r]:w()}function zx(e,t){return[...new Set([...i.Keys(e),...i.Keys(t)])].reduce((o,s)=>({...o,[s]:Gx(e,t,s)}),{})}function Ks(e){return S(e)?e.properties:L(e)?ro(e.items):{}}function no(e,t){let r=Ks(e),n=Ks(t),o=zx(r,n);return $(o)}function Bx(e,t){let r=Rt(e,t);return i.IsEqual(r,Ht)?e:i.IsEqual(r,Zt)||i.IsEqual(r,Vt)?t:w()}function _x(e,t){let r=Pn(e),n=Pn(t);return r&&n?no(e,t):r&&!n?e:!r&&n?t:Bx(e,t)}function ao(e,t){return ve(e)||U(e)?e:B(e)||ve(t)||U(t)?t:B(t)?e:_x(e,t)}function Wx(e,t){return y(e)||y(t)}function Vx(e,t){let r=ke(e),n=ke(t);return Wx(r,n)?D([r,n]):ao(r,n)}function Us(e,t,r=[]){return i.ShiftLeft(t,(n,o)=>Us(e,o,[...r,Vx(n,e)]),()=>i.IsEqual(r.length,0)?[e]:r)}function Ns(e,t,r=[]){return i.ShiftLeft(e,(n,o)=>Ns(o,t,[...r,...Jt([n],t)]),()=>r)}function Jt(e,t=[]){return i.ShiftLeft(e,(r,n)=>y(r)?Jt(n,Ns(r.anyOf,t)):Jt(n,Us(r,t)),()=>t)}function Hx(e,t){let r=ae({},e,t);return g.IsExtendsTrueLike(r)?[]:[e]}function Gs(e,t,r=[]){return i.ShiftLeft(e,(n,o)=>Gs(o,t,[...r,...Hx(n,t)]),()=>r)}function Rn(e,t){let r=ke(e),n=y(r)?r.anyOf:[r],o=Gs(n,t);return Ie(o)}function Se(e,t,r){let n=D([e,t]),o=Rn(r,e);return Ie([n,o])}function fe(e,t=[]){return i.ShiftLeft(e,(r,n)=>fe(n,[...t,O(r)]),()=>Ie(t))}function D(e){let t=Jt(e),r=Mn(t);return Ie(r)}function me(e){let t=Za(e);return ke(t)}function Ie(e){let t=Mn(e);return Qe(t)}function ke(e){return N(e)?Se(e.if,e.then,e.else):re(e)?fe(e.enum):k(e)?D(e.allOf):G(e)?me(e.pattern):y(e)?Ie(e.anyOf):e}function Qe(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?w():h(e)}function zs(e,t){let r=fe(e);return ct(r,t)}function Bs(e,t){return $e(Xe,t)}function _s(e,t){let r=D(e);return ct(r,t)}function Ws(e,t){return i.IsString(e)||i.IsNumber(e)?$({[e]:t}):i.IsEqual(e,!1)?$({false:t}):i.IsEqual(e,!0)?$({true:t}):$({})}function Vs(e,t){return $e(Mt,t)}function Hs(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?$e(e.pattern.toString(),t):$e(Ce,t)}function Zs(e,t){let r=Pt(e);return Mr(r)?ct(me(e),t):$e(e,t)}function Zx(e){return y(e)?vt(e.anyOf):[e]}function vt(e,t=[]){return i.ShiftLeft(e,(r,n)=>vt(n,[...t,...Zx(r)]),()=>t)}function Jx(e){return e.some(t=>ce(t)||V(t)||ue(t))}function Qx(e,t){return i.IsEqual(Jx(e),!0)?$e(Ce,t):void 0}function Xx(e,t){return e.reduce((r,n)=>M(n)&&(i.IsString(n.const)||i.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function Yx(e,t){let r=Xx(e,t);return $(r)}function Js(e,t){let r=vt(e),n=Qx(r,t);return Z(n)?n:Yx(r,t)}function ct(e,t){return U(e)?qs(t):he(e)?Ls(t):re(e)?zs(e.enum,t):ue(e)?Bs(e,t):k(e)?_s(e.allOf,t):M(e)?Ws(e.const,t):V(e)?Vs(e,t):y(e)?Js(e.anyOf,t):ce(e)?Hs(e,t):G(e)?Zs(e.pattern,t):$({})}function vn(e,t,r){return b([e])?p.Update(ct(e,t),{},r):Sr(e,t,r)}function oo(e,t,r,n,o){let s=c(e,t,r),m=c(e,t,n);return vn(s,m,o)}var Xe=`^${kr}$`,Mt=`^${Pr}$`,Ce=`^${Rr}$`;function Sr(e,t,r={}){return I("Record",[e,t],r)}function jr(e,t,r={}){return vn(e,t,r)}function io(e,t){return $e(e,t)}function wr(e){return i.IsEqual(e,Ce)?Ee():i.IsEqual(e,Xe)?pt():i.IsEqual(e,Mt)?ye():On(e)}function Oe(e){return i.Keys(e.patternProperties)[0]}function Ct(e){let t=Oe(e);return wr(t)}function le(e){return e.patternProperties[Oe(e)]}function oe(e){return x(e,"Record")}function eI(e){return p.Discard(e,["~kind","type","patternProperties"])}function ft(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function Ye(e){return x(e,"Rest")}function qr(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function Lr(e){return x(e,"This")}function St(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function jt(e){return x(e,"Undefined")}function Ar(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Ue(e){return x(e,"Void")}function rI(e,t){return i.IsEqual(e,"Array")?Te(t[0]):i.IsEqual(e,"Capitalize")?Dr(t[0]):i.IsEqual(e,"ConstructorParameters")?zr(t[0]):i.IsEqual(e,"Evaluate")?po(t[0]):i.IsEqual(e,"Exclude")?Br(t[0],t[1]):i.IsEqual(e,"Extract")?_r(t[0],t[1]):i.IsEqual(e,"Index")?er(t[0],t[1]):i.IsEqual(e,"InstanceType")?Wr(t[0]):i.IsEqual(e,"Lowercase")?Kr(t[0]):i.IsEqual(e,"NonNullable")?Vr(t[0]):i.IsEqual(e,"Omit")?Hr(t[0],t[1]):i.IsEqual(e,"Parameters")?Zr(t[0]):i.IsEqual(e,"Partial")?Jr(t[0]):i.IsEqual(e,"Pick")?Qr(t[0],t[1]):i.IsEqual(e,"Readonly")?Xr(t[0]):i.IsEqual(e,"KeyOf")?tr(t[0]):i.IsEqual(e,"Record")?Sr(t[0],t[1]):i.IsEqual(e,"Required")?Yr(t[0]):i.IsEqual(e,"ReturnType")?en(t[0]):i.IsEqual(e,"Uncapitalize")?Ur(t[0]):i.IsEqual(e,"Uppercase")?Nr(t[0]):Yt(ze(e),t)}function wt(){throw Error("Unreachable")}function tm(e,t=[]){return i.ShiftLeft(e,(r,n)=>tm(n,[...t,r[1]]),()=>t)}function et(e){return i.IsEqual(e.length,3)?[e[0],...tm(e[1])]:[]}function rm(e){return ut(e[0],e[2],e[4])}function nm(e){return ut(e[0],e[2],e[2])}function am(e){return ut(e[0],ee(),e[2])}function om(e){return ut(e,ee(),ee())}function im(e){return et(e)}function sm(e){return e[1]}function mm(e){return et(e)}function pm(e){return e[1]}function um(e){return rI(e[0],e[1])}function cm(e){return null}function fm(e){return Ee()}function lm(e){return ye()}function dm(e){return Er()}function xm(e){return St()}function Im(e){return Et()}function ym(e){return pt()}function $m(e){return _t()}function gm(e){return ee()}function Tm(e){return bt()}function bm(e){return $({})}function hm(e){return w()}function Em(e){return Ot()}function km(e){return Ar()}function Om(e){return qr()}function Pm(e){return O(BigInt(e))}function Rm(e){return O(i.IsEqual(e,"true"))}function Mm(e){return O(parseFloat(e))}function vm(e){return O(e)}function Cm(e){return e[1]}function Sm(e){return O(e)}function jm(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function wm(e){return e[1]}function qm(e){return Fr(e)}function Lm(e){return i.IsEqual(e.length,6)?at(e[1],e[3],e[5]):at(e[1],e[3],ee())}function Am(e){return e.length>0}function Fm(e){return e.reduce((t,r)=>i.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function Dm(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Km(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function Um(e){return i.IsEqual(e.length,2)?e[1]:[]}function Qs(e,t){return t.reduce((r,n)=>{let o=n;return i.IsEqual(o.length,1)?er(r,o[0]):i.IsEqual(o.length,0)?Te(r):wt()},e)}function Xs(e,t){return i.IsEqual(t.length,3)?Gr(e,t[0],t[1],t[2]):e}function nI(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:tn(e,t)}function Nm(e){let[t,r,n,o,s]=e;return nI(Xs(t?tr(Qs(r,n)):Qs(r,n),o),s)}function so(e,t){return i.IsEqual(t.length,3)?(()=>{let[r,n,o]=t,s=so(n,o);if(i.IsEqual(r,"&"))return k(s)?de([e,...s.allOf]):de([e,s]);if(i.IsEqual(r,"|"))return y(s)?h([e,...s.anyOf]):h([e,s]);wt()})():e}function Gm(e){let[t,r]=e;return so(t,r)}function zm(e){let[t,r]=e;return so(t,r)}function Bm(e){return mo(e[1])}function _m(e){return e[1]}function Wm(e){return Ze(e[0],e[2])}function Vm(e){return i.IsEqual(e.length,4)?Nt(e[1],e[3]):i.IsEqual(e.length,2)?Nt(e[1],ee()):wt()}function Hm(e){return`${e}`}function Zm(e){return ue(e[3])?Xe:V(e[3])?Mt:Je(e[3])?Ce:ce(e[3])?Ce:wt()}function Jm(e){return e.length>0}function Qm(e){return e.length>0}function Xm(e){let[t,r,n,o,s]=e;return{[r]:t&&n?De(Ae(s)):t&&!n?De(s):!t&&n?Ae(s):s}}function Ym(e){return et(e)}function ep(e){return e.reduce((t,r)=>i.HasPropertyKey(r,Xe)||i.HasPropertyKey(r,Mt)||i.HasPropertyKey(r,Ce)?[t[0],p.Assign(t[1],r)]:[p.Assign(t[0],r),t[1]],[{},{}])}function tp(e){return ep(e[1])}function rp(e){let[t,r]=e,n=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return $(t,n)}function np(e){return i.IsEqual(e.length,5)?De(Ae(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?De(e[3]):Ae(e[3]):wt()}function ap(e){if(!i.IsArray(e)||!i.IsEqual(e.length,3))return e;let[t,r,n]=e;return t&&n?De(Ae(r)):t&&!n?De(r):!t&&n?Ae(r):r}function op(e){return i.IsEqual(e.length,2)?ft(e[1]):i.IsEqual(e.length,1)?e[0]:wt()}function ip(e){return et(e)}function sp(e){return H(e[1])}function mp(e){return De(Ae(e[4]))}function pp(e){return De(e[3])}function up(e){return Ae(e[3])}function cp(e){return e[2]}function fp(e){return i.IsEqual(e.length,2)?ft(e[1]):i.IsEqual(e.length,1)?e[0]:wt()}function lp(e){return et(e)}function dp(e){return Le(e[1],e[4])}function xp(e){return qe(e[2],e[5])}function Ys(e,t){return i.IsEqual(e,"remove")?Xa(t):i.IsEqual(e,"add")?De(t):t}function Ip(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function em(e,t){return i.IsEqual(e,"remove")?to(t):i.IsEqual(e,"add")?Ae(t):t}function yp(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function $p(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function gp(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?Qt(Wt(e[3]),e[5],e[6][0],Ys(e[1],em(e[8],e[10]))):Qt(Wt(e[3]),e[5],ze(e[3]),Ys(e[1],em(e[8],e[10])))}function Tp(e){return ze(e)}function bp(e){return BigInt(e)}function hp(e){return parseFloat(e)}function Ep(e){return i.IsEqual(e,"true")}function kp(e){return null}function Op(e){return{[e[0]]:e[2]}}function Pp(e){return et(e)}function aI(e){return e.reduce((t,r)=>p.Assign(t,r),{})}function Rp(e){return aI(e[1])}function Mp(e){return et(e)}function vp(e){return e[1]}function Cp(e){return _t()}function Sp(e){return Ee()}function jp(e){return ye()}function wp(e){return pt()}function qp(e){return w()}function Lp(e){return O(e)}function Ap(e){return h(e[1])}function Fp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Dp(e){return[e[0],...e[1]]}function Kp(e){return e[1]}function Up(e){return et(e)}function Np(e){return i.IsEqual(e.length,2)?e[1]:[]}function Gp(e){let t=e[2],r=e[3],[n,o]=e[4],s=i.IsEqual(i.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Ze(t,Xt(r,n,s))}}function zp(e){let t=e[2],[r,n]=e[3],o=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:Xt(t,r,o)}}function Bp(e){return{[e[1]]:Ze(e[2],e[4])}}function _p(e){return{[e[1]]:e[3]}}function Wp(e){return null}function Vp(e){return et(e)}function Hp(e){return e[1]}function Zp(e){let[t,r]=[e[0],e[1]];return uo(p.Assign(t,ep(r)[0]))}function rn(e){return E(e.length,2)}function P(e,t,r){return rn(e)?t(e[0],e[1]):r()}function sI(e,t){return E(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function z(e,t){for(let r=0;r<e.length;r++){let n=sI(e[r],t);if(rn(n))return n}return[]}function co(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var Jp=[...co(97,122),...co(65,90)],fo="0",lo=co(49,57),rr=[fo,...lo],Qp=" ",nr=`
|
|
5
|
+
`;var lt="_",Cn=".",Xp="$",Sn="-";var Yp="//",eu="/*",pI="*/";function tu(e){let t=e.indexOf(pI);return E(t,-1)?"":e.slice(t+2)}function ru(e){let t=e.indexOf(nr);return E(t,-1)?"":e.slice(t)}function uI(e){return e.replace(/^[ \t\r\f\v]+/,"")}function jn(e){let t=uI(e);return t.startsWith(eu)?jn(tu(t.slice(2))):t.startsWith(Yp)?jn(ru(t.slice(2))):t}function ie(e){let t=e.trimStart();return t.startsWith(eu)?ie(tu(t.slice(2))):t.startsWith(Yp)?ie(ru(t.slice(2))):t}function wn(e,t){return P(z([e],t),(r,n)=>[r,n],()=>["",t])}function cI(e,t){return e.includes(t)}function ar(e,t,r,n=""){return P(z(e,r),(o,s)=>cI(t,o)?ar(e,t,s,n):ar(e,t,s,`${n}${o}`),()=>[n,r])}function fI(e){return z(lo,e)}var lI=[...rr,lt];function dI(e){return ar(lI,[lt],e)}function xI(e){return P(z([fo],e),(t,r)=>[t,r],()=>P(fI(e),(t,r)=>P(dI(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[]))}function qn(e){return xI(ie(e))}function II(e){return wn(Sn,e)}function yI(e){return P(II(e),(t,r)=>P(qn(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function nu(e){return yI(ie(e))}function $I(e){return P(nu(e),(t,r)=>P(z(["n"],r),(n,o)=>[`${t}`,o],()=>[]),()=>[])}function xo(e){return $I(e)}function Io(e,t){return z([e],t)}function u(e,t){return E(e,"")?["",t]:e.startsWith(nr)?Io(e,jn(t)):e.startsWith(Qp)?Io(e,t):Io(e,ie(t))}var au=[...Jp,lt,Xp];function gI(e){return z(au,e)}var TI=[...au,...rr];function ou(e,t=""){return P(z(TI,e),(r,n)=>ou(n,`${t}${r}`),()=>[t,e])}function bI(e){return P(gI(e),(t,r)=>P(ou(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function W(e){return bI(ie(e))}var hI=[...rr,lt];function EI(e){return rn(z([Cn],e))}function iu(e){return P(ar(hI,[lt],e),(t,r)=>E(t,"")?[]:[t,r],()=>[])}function kI(e){return P(z([Cn],e),(t,r)=>P(iu(r),(n,o)=>[`0${t}${n}`,o],()=>[]),()=>[])}function OI(e){return P(qn(e),(t,r)=>P(z([Cn],r),(n,o)=>P(iu(o),(s,m)=>[`${t}${n}${s}`,m],()=>[`${t}`,o]),()=>[`${t}`,r]),()=>[])}function PI(e){return EI(e)?kI(e):OI(e)}function su(e){return PI(ie(e))}function RI(e){return wn(Sn,e)}function MI(e){return P(RI(e),(t,r)=>P(su(r),(n,o)=>[`${t}${n}`,o],()=>[]),()=>[])}function Ln(e){return MI(ie(e))}function vI(e){return E(e,"")?[]:[e.slice(0,1),e.slice(1)]}function mu(e,t){return hn(e,(r,n)=>t.startsWith(r)?!0:mu(n,t),()=>!1)}function dt(e,t,r=""){return P(vI(t),(n,o)=>mu(e,t)?[r,t]:dt(e,o,`${r}${n}`),()=>[])}function CI(e,t,r){return P(z([e],r),(n,o)=>P(dt([t],o),(s,m)=>P(z([t],m),(f,d)=>[`${s}`,d],()=>[]),()=>[]),()=>[])}function SI(e,t,r){return P(z([e],r),(n,o)=>P(dt([nr,t],o),(s,m)=>P(z([t],m),(f,d)=>[`${s}`,d],()=>[]),()=>[]),()=>[])}function pu(e,t,r,n){return r?CI(e,t,ie(n)):SI(e,t,ie(n))}function jI(e,t){return z(e,t)}function wI(e,t){return pu(e,e,!1,t)}function qI(e,t){return P(jI(e,t),(r,n)=>wI(r,`${r}${n}`),()=>[])}function An(e,t){return qI(e,ie(t))}function uu(e,t){return P(dt(e,t),(r,n)=>E(r,"")?[]:[r,n],()=>[])}var a=(e,t,r=()=>[])=>e.length===2?t(e):r(),AI=e=>a(a(W(e),([t,r])=>a(u("extends",r),([n,o])=>a(v(o),([s,m])=>a(u("=",m),([f,d])=>a(v(d),([q,C])=>[[t,n,s,f,q],C]))))),([t,r])=>[rm(t),r]),FI=e=>a(a(W(e),([t,r])=>a(u("extends",r),([n,o])=>a(v(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[nm(t),r]),DI=e=>a(a(W(e),([t,r])=>a(u("=",r),([n,o])=>a(v(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[am(t),r]),KI=e=>a(W(e),([t,r])=>[om(t),r]),lu=e=>a(a(AI(e),([t,r])=>[t,r],()=>a(FI(e),([t,r])=>[t,r],()=>a(DI(e),([t,r])=>[t,r],()=>a(KI(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),du=(e,t=[])=>a(a(u(",",e),([r,n])=>a(lu(n),([o,s])=>[[r,o],s])),([r,n])=>du(n,[...t,r]),()=>[t,e]),UI=e=>a(a(a(lu(e),([t,r])=>a(du(r),([n,o])=>a(a(u(",",o),([s,m])=>[[s],m],()=>[[],o]),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[im(t),r]),go=e=>a(a(u("<",e),([t,r])=>a(UI(r),([n,o])=>a(u(">",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[sm(t),r]),xu=(e,t=[])=>a(a(u(",",e),([r,n])=>a(v(n),([o,s])=>[[r,o],s])),([r,n])=>xu(n,[...t,r]),()=>[t,e]),NI=e=>a(a(a(v(e),([t,r])=>a(xu(r),([n,o])=>a(a(u(",",o),([s,m])=>[[s],m],()=>[[],o]),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[mm(t),r]),GI=e=>a(a(u("<",e),([t,r])=>a(NI(r),([n,o])=>a(u(">",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[pm(t),r]),zI=e=>a(a(W(e),([t,r])=>a(GI(r),([n,o])=>[[t,n],o])),([t,r])=>[um(t),r]),Iu=e=>a(a(a(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[cm(t),r]),yu=e=>a(u("string",e),([t,r])=>[fm(t),r]),$u=e=>a(u("number",e),([t,r])=>[lm(t),r]),BI=e=>a(u("boolean",e),([t,r])=>[dm(t),r]),_I=e=>a(u("undefined",e),([t,r])=>[xm(t),r]),WI=e=>a(u("null",e),([t,r])=>[Im(t),r]),gu=e=>a(u("integer",e),([t,r])=>[ym(t),r]),VI=e=>a(u("bigint",e),([t,r])=>[$m(t),r]),HI=e=>a(u("unknown",e),([t,r])=>[gm(t),r]),ZI=e=>a(u("any",e),([t,r])=>[Tm(t),r]),JI=e=>a(u("object",e),([t,r])=>[bm(t),r]),QI=e=>a(u("never",e),([t,r])=>[hm(t),r]),Tu=e=>a(u("symbol",e),([t,r])=>[Em(t),r]),XI=e=>a(u("void",e),([t,r])=>[km(t),r]),YI=e=>a(u("this",e),([t,r])=>[Om(t),r]),ey=e=>a(a(u("${",e),([t,r])=>a(v(r),([n,o])=>a(u("}",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[Cm(t),r]),yo=e=>a(dt(["${","`"],e),([t,r])=>[Sm(t),r]),bu=e=>a(a(a(yo(e),([t,r])=>a(ey(r),([n,o])=>a(bu(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a(a(yo(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a(a(yo(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[jm(t),r]),To=e=>a(a(u("`",e),([t,r])=>a(bu(r),([n,o])=>a(u("`",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[wm(t),r]),ty=e=>a(To(e),([t,r])=>[qm(t),r]),ry=e=>a(a(a(u("if",e),([t,r])=>a(v(r),([n,o])=>a(u("then",o),([s,m])=>a(v(m),([f,d])=>a(u("else",d),([q,C])=>a(v(C),([pe,yt])=>[[t,n,s,f,q,pe],yt])))))),([t,r])=>[t,r],()=>a(a(u("if",e),([t,r])=>a(v(r),([n,o])=>a(u("then",o),([s,m])=>a(v(m),([f,d])=>[[t,n,s,f],d])))),([t,r])=>[t,r],()=>[])),([t,r])=>[Lm(t),r]),ny=e=>a(xo(e),([t,r])=>[Pm(t),r]),ay=e=>a(a(u("true",e),([t,r])=>[t,r],()=>a(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[Rm(t),r]),oy=e=>a(Ln(e),([t,r])=>[Mm(t),r]),iy=e=>a(An(["'",'"'],e),([t,r])=>[vm(t),r]),sy=e=>a(a(a(u("keyof",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Am(t),r]),hu=(e,t=[])=>a(a(a(u("[",e),([r,n])=>a(v(n),([o,s])=>a(u("]",s),([m,f])=>[[r,o,m],f]))),([r,n])=>[r,n],()=>a(a(u("[",e),([r,n])=>a(u("]",n),([o,s])=>[[r,o],s])),([r,n])=>[r,n],()=>[])),([r,n])=>hu(n,[...t,r]),()=>[t,e]),my=e=>a(hu(e),([t,r])=>[Fm(t),r]),py=e=>a(a(a(u("extends",e),([t,r])=>a(v(r),([n,o])=>a(u("?",o),([s,m])=>a(v(m),([f,d])=>a(u(":",d),([q,C])=>a(v(C),([pe,yt])=>[[t,n,s,f,q,pe],yt])))))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Dm(t),r]),uy=e=>a(a(a(u("(",e),([t,r])=>a(v(r),([n,o])=>a(u(")",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a(yu(e),([t,r])=>[t,r],()=>a($u(e),([t,r])=>[t,r],()=>a(BI(e),([t,r])=>[t,r],()=>a(_I(e),([t,r])=>[t,r],()=>a(WI(e),([t,r])=>[t,r],()=>a(gu(e),([t,r])=>[t,r],()=>a(VI(e),([t,r])=>[t,r],()=>a(HI(e),([t,r])=>[t,r],()=>a(ZI(e),([t,r])=>[t,r],()=>a(JI(e),([t,r])=>[t,r],()=>a(QI(e),([t,r])=>[t,r],()=>a(Tu(e),([t,r])=>[t,r],()=>a(XI(e),([t,r])=>[t,r],()=>a(YI(e),([t,r])=>[t,r],()=>a(ny(e),([t,r])=>[t,r],()=>a(ay(e),([t,r])=>[t,r],()=>a(oy(e),([t,r])=>[t,r],()=>a(iy(e),([t,r])=>[t,r],()=>a(ty(e),([t,r])=>[t,r],()=>a(ry(e),([t,r])=>[t,r],()=>a(by(e),([t,r])=>[t,r],()=>a(ky(e),([t,r])=>[t,r],()=>a(Cy(e),([t,r])=>[t,r],()=>a(vy(e),([t,r])=>[t,r],()=>a(qy(e),([t,r])=>[t,r],()=>a(zI(e),([t,r])=>[t,r],()=>a(Ly(e),([t,r])=>[t,r],()=>[])))))))))))))))))))))))))))),([t,r])=>[Km(t),r]),cy=e=>a(a(a(u("with",e),([t,r])=>a(Ku(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Um(t),r]),Eu=e=>a(a(sy(e),([t,r])=>a(uy(r),([n,o])=>a(my(o),([s,m])=>a(py(m),([f,d])=>a(cy(d),([q,C])=>[[t,n,s,f,q],C]))))),([t,r])=>[Nm(t),r]),ku=e=>a(a(a(u("&",e),([t,r])=>a(Eu(r),([n,o])=>a(ku(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Ou=e=>a(a(Eu(e),([t,r])=>a(ku(r),([n,o])=>[[t,n],o])),([t,r])=>[Gm(t),r]),Pu=e=>a(a(a(u("|",e),([t,r])=>a(Ou(r),([n,o])=>a(Pu(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Fn=e=>a(a(Ou(e),([t,r])=>a(Pu(r),([n,o])=>[[t,n],o])),([t,r])=>[zm(t),r]),fy=e=>a(a(u("readonly",e),([t,r])=>a(Fn(r),([n,o])=>[[t,n],o])),([t,r])=>[Bm(t),r]),ly=e=>a(a(u("|",e),([t,r])=>a(Fn(r),([n,o])=>[[t,n],o])),([t,r])=>[_m(t),r]),dy=e=>a(a(go(e),([t,r])=>a(u("=",r),([n,o])=>a(v(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[Wm(t),r]),xy=e=>a(a(a(u("infer",e),([t,r])=>a(W(r),([n,o])=>a(u("extends",o),([s,m])=>a(Fn(m),([f,d])=>[[t,n,s,f],d])))),([t,r])=>[t,r],()=>a(a(u("infer",e),([t,r])=>a(W(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>[])),([t,r])=>[Vm(t),r]),v=e=>a(a(xy(e),([t,r])=>[t,r],()=>a(ly(e),([t,r])=>[t,r],()=>a(fy(e),([t,r])=>[t,r],()=>a(Fn(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Iy=e=>a(Ln(e),([t,r])=>[Hm(t),r]),yy=e=>a(W(e),([t,r])=>[t,r]),$y=e=>a(An(["'",'"'],e),([t,r])=>[t,r]),gy=e=>a(a(u("[",e),([t,r])=>a(W(r),([n,o])=>a(u(":",o),([s,m])=>a(a(gu(m),([f,d])=>[f,d],()=>a($u(m),([f,d])=>[f,d],()=>a(yu(m),([f,d])=>[f,d],()=>a(Tu(m),([f,d])=>[f,d],()=>[])))),([f,d])=>a(u("]",d),([q,C])=>[[t,n,s,f,q],C]))))),([t,r])=>[Zm(t),r]),Ru=e=>a(a(Iy(e),([t,r])=>[t,r],()=>a(yy(e),([t,r])=>[t,r],()=>a($y(e),([t,r])=>[t,r],()=>a(gy(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Mu=e=>a(a(a(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Jm(t),r]),vu=e=>a(a(a(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Qm(t),r]),Cu=e=>a(a(Mu(e),([t,r])=>a(Ru(r),([n,o])=>a(vu(o),([s,m])=>a(u(":",m),([f,d])=>a(v(d),([q,C])=>[[t,n,s,f,q],C]))))),([t,r])=>[Xm(t),r]),Dn=e=>a(a(a(u(",",e),([t,r])=>a(u(`
|
|
6
|
+
`,r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a(a(u(";",e),([t,r])=>a(u(`
|
|
7
|
+
`,r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a(a(u(",",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a(a(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a(a(u(`
|
|
8
|
+
`,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),Su=(e,t=[])=>a(a(Dn(e),([r,n])=>a(Cu(n),([o,s])=>[[r,o],s])),([r,n])=>Su(n,[...t,r]),()=>[t,e]),Ty=e=>a(a(a(Cu(e),([t,r])=>a(Su(r),([n,o])=>a(a(Dn(o),([s,m])=>[[s],m],()=>[[],o]),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Ym(t),r]),bo=e=>a(a(u("{",e),([t,r])=>a(Ty(r),([n,o])=>a(u("}",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[tp(t),r]),by=e=>a(bo(e),([t,r])=>[rp(t),r]),hy=e=>a(a(a(W(e),([t,r])=>a(u("?",r),([n,o])=>a(u(":",o),([s,m])=>a(u("readonly",m),([f,d])=>a(v(d),([q,C])=>[[t,n,s,f,q],C]))))),([t,r])=>[t,r],()=>a(a(W(e),([t,r])=>a(u(":",r),([n,o])=>a(u("readonly",o),([s,m])=>a(v(m),([f,d])=>[[t,n,s,f],d])))),([t,r])=>[t,r],()=>a(a(W(e),([t,r])=>a(u("?",r),([n,o])=>a(u(":",o),([s,m])=>a(v(m),([f,d])=>[[t,n,s,f],d])))),([t,r])=>[t,r],()=>a(a(W(e),([t,r])=>a(u(":",r),([n,o])=>a(v(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>[])))),([t,r])=>[np(t),r]),cu=e=>a(a(hy(e),([t,r])=>[t,r],()=>a(a(Mu(e),([t,r])=>a(v(r),([n,o])=>a(vu(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>[])),([t,r])=>[ap(t),r]),ju=e=>a(a(a(u("...",e),([t,r])=>a(cu(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a(a(cu(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[op(t),r]),wu=(e,t=[])=>a(a(u(",",e),([r,n])=>a(ju(n),([o,s])=>[[r,o],s])),([r,n])=>wu(n,[...t,r]),()=>[t,e]),Ey=e=>a(a(a(ju(e),([t,r])=>a(wu(r),([n,o])=>a(a(u(",",o),([s,m])=>[[s],m],()=>[[],o]),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[ip(t),r]),ky=e=>a(a(u("[",e),([t,r])=>a(Ey(r),([n,o])=>a(u("]",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[sp(t),r]),Oy=e=>a(a(W(e),([t,r])=>a(u("?",r),([n,o])=>a(u(":",o),([s,m])=>a(u("readonly",m),([f,d])=>a(v(d),([q,C])=>[[t,n,s,f,q],C]))))),([t,r])=>[mp(t),r]),Py=e=>a(a(W(e),([t,r])=>a(u(":",r),([n,o])=>a(u("readonly",o),([s,m])=>a(v(m),([f,d])=>[[t,n,s,f],d])))),([t,r])=>[pp(t),r]),Ry=e=>a(a(W(e),([t,r])=>a(u("?",r),([n,o])=>a(u(":",o),([s,m])=>a(v(m),([f,d])=>[[t,n,s,f],d])))),([t,r])=>[up(t),r]),My=e=>a(a(W(e),([t,r])=>a(u(":",r),([n,o])=>a(v(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[cp(t),r]),fu=e=>a(a(Oy(e),([t,r])=>[t,r],()=>a(Py(e),([t,r])=>[t,r],()=>a(Ry(e),([t,r])=>[t,r],()=>a(My(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),qu=e=>a(a(a(u("...",e),([t,r])=>a(fu(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a(a(fu(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[fp(t),r]),Lu=(e,t=[])=>a(a(u(",",e),([r,n])=>a(qu(n),([o,s])=>[[r,o],s])),([r,n])=>Lu(n,[...t,r]),()=>[t,e]),Au=e=>a(a(a(qu(e),([t,r])=>a(Lu(r),([n,o])=>a(a(u(",",o),([s,m])=>[[s],m],()=>[[],o]),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[lp(t),r]),vy=e=>a(a(u("(",e),([t,r])=>a(Au(r),([n,o])=>a(u(")",o),([s,m])=>a(u("=>",m),([f,d])=>a(v(d),([q,C])=>[[t,n,s,f,q],C]))))),([t,r])=>[dp(t),r]),Cy=e=>a(a(u("new",e),([t,r])=>a(u("(",r),([n,o])=>a(Au(o),([s,m])=>a(u(")",m),([f,d])=>a(u("=>",d),([q,C])=>a(v(C),([pe,yt])=>[[t,n,s,f,q,pe],yt])))))),([t,r])=>[xp(t),r]),Sy=e=>a(a(a(u("+",e),([t,r])=>a(u("readonly",r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a(a(u("-",e),([t,r])=>a(u("readonly",r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a(a(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[Ip(t),r]),jy=e=>a(a(a(u("+",e),([t,r])=>a(u("?",r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a(a(u("-",e),([t,r])=>a(u("?",r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a(a(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[yp(t),r]),wy=e=>a(a(a(u("as",e),([t,r])=>a(v(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[$p(t),r]),qy=e=>a(a(u("{",e),([t,r])=>a(Sy(r),([n,o])=>a(u("[",o),([s,m])=>a(W(m),([f,d])=>a(u("in",d),([q,C])=>a(v(C),([pe,yt])=>a(wy(yt),([Vf,Hf])=>a(u("]",Hf),([Zf,Jf])=>a(jy(Jf),([Qf,Xf])=>a(u(":",Xf),([Yf,el])=>a(v(el),([tl,rl])=>a(Iu(rl),([nl,al])=>a(u("}",al),([ol,il])=>[[t,n,s,f,q,pe,Vf,Zf,Qf,Yf,tl,nl,ol],il]))))))))))))),([t,r])=>[gp(t),r]),Ly=e=>a(W(e),([t,r])=>[Tp(t),r]),Ay=e=>a(xo(e),([t,r])=>[bp(t),r]),Fy=e=>a(Ln(e),([t,r])=>[hp(t),r]),Dy=e=>a(a(u("true",e),([t,r])=>[t,r],()=>a(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[Ep(t),r]),Ky=e=>a(An(['"',"'"],e),([t,r])=>[t,r]),Uy=e=>a(u("null",e),([t,r])=>[kp(t),r]),Ny=e=>a(u("undefined",e),([t,r])=>[void 0,r]),Fu=e=>a(a(Ru(e),([t,r])=>a(u(":",r),([n,o])=>a(ho(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[Op(t),r]),Du=(e,t=[])=>a(a(Dn(e),([r,n])=>a(Fu(n),([o,s])=>[[r,o],s])),([r,n])=>Du(n,[...t,r]),()=>[t,e]),Gy=e=>a(a(a(Fu(e),([t,r])=>a(Du(r),([n,o])=>a(a(Dn(o),([s,m])=>[[s],m],()=>[[],o]),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Pp(t),r]),Ku=e=>a(a(u("{",e),([t,r])=>a(Gy(r),([n,o])=>a(u("}",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[Rp(t),r]),Uu=(e,t=[])=>a(a(u(",",e),([r,n])=>a(ho(n),([o,s])=>[[r,o],s])),([r,n])=>Uu(n,[...t,r]),()=>[t,e]),zy=e=>a(a(a(ho(e),([t,r])=>a(Uu(r),([n,o])=>a(a(u(",",o),([s,m])=>[[s],m],()=>[[],o]),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Mp(t),r]),By=e=>a(a(u("[",e),([t,r])=>a(zy(r),([n,o])=>a(u("]",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[vp(t),r]),ho=e=>a(a(Ay(e),([t,r])=>[t,r],()=>a(Fy(e),([t,r])=>[t,r],()=>a(Dy(e),([t,r])=>[t,r],()=>a(Ky(e),([t,r])=>[t,r],()=>a(Uy(e),([t,r])=>[t,r],()=>a(Ny(e),([t,r])=>[t,r],()=>a(Ku(e),([t,r])=>[t,r],()=>a(By(e),([t,r])=>[t,r],()=>[])))))))),([t,r])=>[t,r]),_y=e=>a(u("-?(?:0|[1-9][0-9]*)n",e),([t,r])=>[Cp(t),r]),Wy=e=>a(u(".*",e),([t,r])=>[Sp(t),r]),Vy=e=>a(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,r])=>[jp(t),r]),Hy=e=>a(u("-?(?:0|[1-9][0-9]*)",e),([t,r])=>[wp(t),r]),Zy=e=>a(u("(?!)",e),([t,r])=>[qp(t),r]),Jy=e=>a(uu(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,r])=>[Lp(t),r]),Qy=e=>a(a(_y(e),([t,r])=>[t,r],()=>a(Wy(e),([t,r])=>[t,r],()=>a(Vy(e),([t,r])=>[t,r],()=>a(Hy(e),([t,r])=>[t,r],()=>a(Zy(e),([t,r])=>[t,r],()=>a(Xy(e),([t,r])=>[t,r],()=>a(Jy(e),([t,r])=>[t,r],()=>[]))))))),([t,r])=>[t,r]),Xy=e=>a(a(u("(",e),([t,r])=>a(Eo(r),([n,o])=>a(u(")",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[Ap(t),r]),Nu=e=>a(a(a($o(e),([t,r])=>a(u("|",r),([n,o])=>a(Nu(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a(a($o(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[]))),([t,r])=>[Fp(t),r]),$o=e=>a(a(Qy(e),([t,r])=>a(Eo(r),([n,o])=>[[t,n],o])),([t,r])=>[Dp(t),r]),Eo=e=>a(a(Nu(e),([t,r])=>[t,r],()=>a($o(e),([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Rs=e=>a(a(u("^",e),([t,r])=>a(Eo(r),([n,o])=>a(u("$",o),([s,m])=>[[t,n,s],m]))),([t,r])=>[Kp(t),r]),Gu=(e,t=[])=>a(a(u(",",e),([r,n])=>a(v(n),([o,s])=>[[r,o],s])),([r,n])=>Gu(n,[...t,r]),()=>[t,e]),Yy=e=>a(a(a(v(e),([t,r])=>a(Gu(r),([n,o])=>a(a(u(",",o),([s,m])=>[[s],m],()=>[[],o]),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Up(t),r]),zu=e=>a(a(a(u("extends",e),([t,r])=>a(Yy(r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Np(t),r]),e$=e=>a(a(u("interface",e),([t,r])=>a(W(r),([n,o])=>a(go(o),([s,m])=>a(zu(m),([f,d])=>a(bo(d),([q,C])=>[[t,n,s,f,q],C]))))),([t,r])=>[Gp(t),r]),t$=e=>a(a(u("interface",e),([t,r])=>a(W(r),([n,o])=>a(zu(o),([s,m])=>a(bo(m),([f,d])=>[[t,n,s,f],d])))),([t,r])=>[zp(t),r]),r$=e=>a(a(u("type",e),([t,r])=>a(W(r),([n,o])=>a(go(o),([s,m])=>a(u("=",m),([f,d])=>a(v(d),([q,C])=>[[t,n,s,f,q],C]))))),([t,r])=>[Bp(t),r]),n$=e=>a(a(u("type",e),([t,r])=>a(W(r),([n,o])=>a(u("=",o),([s,m])=>a(v(m),([f,d])=>[[t,n,s,f],d])))),([t,r])=>[_p(t),r]),a$=e=>a(a(a(u("export",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Wp(t),r]),Bu=e=>a(a(a(u(";",e),([t,r])=>a(u(`
|
|
9
|
+
`,r),([n,o])=>[[t,n],o])),([t,r])=>[t,r],()=>a(a(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>a(a(u(`
|
|
10
|
+
`,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]),_u=(e,t=[])=>a(a(Bu(e),([r,n])=>a(ko(n),([o,s])=>[[r,o],s])),([r,n])=>_u(n,[...t,r]),()=>[t,e]),o$=e=>a(a(a(ko(e),([t,r])=>a(_u(r),([n,o])=>a(a(Bu(o),([s,m])=>[[s],m],()=>[[],o]),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>a([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Vp(t),r]),ko=e=>a(a(a$(e),([t,r])=>a(a(e$(r),([n,o])=>[n,o],()=>a(t$(r),([n,o])=>[n,o],()=>a(r$(r),([n,o])=>[n,o],()=>a(n$(r),([n,o])=>[n,o],()=>[])))),([n,o])=>a(Iu(o),([s,m])=>[[t,n,s],m]))),([t,r])=>[Hp(t),r]),i$=e=>a(a(ko(e),([t,r])=>a(o$(r),([n,o])=>[[t,n],o])),([t,r])=>[Zp(t),r]),Wu=e=>a(a(i$(e),([t,r])=>[t,r],()=>a(dy(e),([t,r])=>[t,r],()=>a(v(e),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]);function Oo(e){let t=To(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:J()}function m$(e){return e.join("|")}function p$(e){return e.slice(1,e.length-1)}function u$(e,t,r){return xt(t,`${r}${e}`)}function c$(e,t){return xt(e,`${t}${za}`)}function f$(e,t){return xt(e,`${t}${kr}`)}function l$(e,t){return xt(e,`${t}${Pr}`)}function d$(e,t){return nn(h([O("false"),O("true")]),e,t)}function x$(e,t){return xt(e,`${t}${Rr}`)}function I$(e,t,r){return xt(t,`${r}${p$(e)}`)}function y$(e,t,r){let n=an(e,{});return nn(n,t,r)}function $$(e,t,r){let n=fe(e);return nn(n,t,r)}function Vu(e,t,r,n=[]){return i.ShiftLeft(e,(o,s)=>Vu(s,t,r,[...n,nn(o,[],"")]),()=>xt(t,`${r}(${m$(n)})`))}function nn(e,t,r){return re(e)?$$(e.enum,t,r):ue(e)?f$(t,r):M(e)?u$(e.const,t,r):Ke(e)?c$(t,r):he(e)?d$(t,r):V(e)?l$(t,r):ce(e)?x$(t,r):G(e)?I$(e.pattern,t,r):Ro(e)?y$(e.parameters[0],t,r):y(e)?Vu(e.anyOf,t,r):Oa}function xt(e,t){return i.ShiftLeft(e,(r,n)=>nn(r,n,t),()=>t)}function g$(e){return`^${xt(e,"")}$`}function Po(e){let t=g$(e);return vr(t)}function an(e,t){return b(e)?p.Update(Po(e),{},t):Fr(e,t)}function Hu(e,t,r,n){let o=Pe(e,t,r);return an(o,n)}function Fr(e,t={}){return I("TemplateLiteral",[e],t)}function Ro(e){return Z(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function Mo(e){return an(e,{})}function Zu(e){let t=Oo(e);return Mo(t)}function vo(e,t={}){let r=i.IsString(e)?Zu(e):Mo(e);return p.Update(r,{},t)}function G(e){return x(e,"TemplateLiteral")}var g={};je(g,{ExtendsFalse:()=>T,ExtendsTrue:()=>l,ExtendsUnion:()=>Co,IsExtendsFalse:()=>T$,IsExtendsTrue:()=>Qu,IsExtendsTrueLike:()=>or,IsExtendsUnion:()=>Ju,Match:()=>K});function Co(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Ju(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsUnion")&&i.IsObject(e.inferred)}function l(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Qu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function T(){return p.Create({"~kind":"ExtendsFalse"},{})}function T$(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function or(e){return Ju(e)||Qu(e)}function K(e,t,r){return or(e)?t(e.inferred):r()}function b$(e,t,r,n){return K(R(e,r,n),o=>l(p.Assign(p.Assign(e,o),{[t]:r})),()=>T())}function h$(e,t){return l(e)}function E$(e,t,r,n,o){return K(R(e,t,r),s=>K(R(s,t,n),m=>l(m),()=>T()),()=>K(R(e,t,o),s=>l(s),()=>T()))}function k$(e,t,r){let n=fe(r);return R(e,t,n)}function Xu(e,t,r){return i.ShiftLeft(r,(n,o)=>K(R(e,t,n),s=>Xu(s,t,o),()=>T()),()=>l(e))}function O$(e,t,r){let n=me(r);return R(e,t,n)}function Yu(e,t,r){return i.ShiftLeft(r,(n,o)=>K(R(e,t,n),s=>l(s),()=>Yu(e,t,o)),()=>T())}function j(e,t,r){return U(r)?h$(e,t):N(r)?E$(e,t,r.if,r.then,r.else):re(r)?k$(e,t,r.enum):_(r)?b$(e,r.name,t,r.extends):k(r)?Xu(e,t,r.allOf):G(r)?O$(e,t,r.pattern):y(r)?Yu(e,t,r.anyOf):B(r)?l(e):T()}function ec(e,t,r){return _(r)?j(e,t,r):U(r)?l(e):B(r)?l(e):Co(e)}function P$(e,t){let r=it(e),n=it(t);return r&&n||!r&&n?!0:!(r&&!n)}function tc(e,t,r,n){return F(n)?P$(t,n)?R(e,r,n.items):T():j(e,t,n)}function rc(e,t,r){return Ke(r)?l(e):j(e,t,r)}function nc(e,t,r){return he(r)?l(e):j(e,t,r)}function R$(e,t,r,n,o){let s=_(n)?t:n,m=_(n)?n:t,f=se(t),d=se(n);return!f&&d?T():K(R(e,s,m),q=>on(q,r,o),()=>T())}function M$(e,t,r,n){return i.ShiftLeft(n,(o,s)=>R$(e,t,r,o,s),()=>se(t)?l(e):T())}function v$(e,t,r){return i.ShiftLeft(t,(n,o)=>M$(e,n,o,r),()=>l(e))}function on(e,t,r){return v$(e,t,r)}function Kn(e,t,r){return Ue(r)?l(e):R(e,t,r)}function ac(e,t,r,n){return U(n)?l(e):B(n)?l(e):Q(n)?K(on(e,t,n.parameters),o=>Kn(o,r,n.instanceType),()=>T()):T()}function oc(e,t,r,n,o){return K(R(e,t,o),()=>R(e,r,o),()=>R(e,n,o))}function ic(e,t,r){let n=fe(t);return R(e,n,r)}function sc(e,t,r,n){return U(n)?l(e):B(n)?l(e):X(n)?K(on(e,t,n.parameters),o=>Kn(o,r,n.returnType),()=>T()):T()}function mc(e,t,r){return ue(r)?l(e):V(r)?l(e):j(e,t,r)}function pc(e,t,r){let n=D(t);return R(e,n,r)}function Un(e,t,r){return t===r?l(e):T()}function C$(e,t,r){return M(r)?Un(e,t,r.const):Ke(r)?l(e):j(e,O(t),r)}function S$(e,t,r){return M(r)?Un(e,t,r.const):he(r)?l(e):j(e,O(t),r)}function j$(e,t,r){return M(r)?Un(e,t,r.const):V(r)?l(e):j(e,O(t),r)}function w$(e,t,r){return M(r)?Un(e,t,r.const):ce(r)?l(e):j(e,O(t),r)}function uc(e,t,r){return i.IsBigInt(t.const)?C$(e,t.const,r):i.IsBoolean(t.const)?S$(e,t.const,r):i.IsNumber(t.const)?j$(e,t.const,r):i.IsString(t.const)?w$(e,t.const,r):J()}function cc(e,t,r){return _(r)?j(e,t,r):l(e)}function fc(e,t,r){return kt(r)?l(e):j(e,t,r)}function lc(e,t,r){return V(r)?l(e):j(e,t,r)}function q$(e,t,r){return se(t)?se(r)?l(e):T():l(e)}function L$(e,t,r){return _(r)&&ve(r.extends)?T():K(R(e,t,r),n=>q$(n,t,r),()=>T())}function A$(e,t){return e.reduce((r,n)=>n in t?or(t[n])?{...r,...t[n].inferred}:J():J(),{})}function F$(e,t,r){let n={};for(let m of i.Keys(r))n[m]=m in t?L$({},t[m],r[m]):se(r[m])?_(r[m])?l(p.Assign(e,{[r[m].name]:r[m].extends})):l(e):T();let o=i.Values(n).every(m=>or(m)),s=o?A$(i.Keys(n),n):{};return o?l(s):T()}function D$(e,t,r){let n=F$(e,t,r);return or(n)?l(p.Assign(e,n.inferred)):T()}function K$(e,t,r){return D$(e,t,r)}function U$(e,t){return i.Keys(t).reduce((r,n)=>({...r,[n]:i.HasPropertyKey(e,n)?y(r[n])?h([...r[n].anyOf,t[n]]):h([e[n],t[n]]):t[n]}),e)}function dc(e,t,r,n){return i.ShiftLeft(t,(o,s)=>K(R({},e[o],r),m=>dc(e,s,r,U$(n,m)),()=>T()),()=>l(n))}function N$(e,t,r,n){let o=i.Keys(t);return dc(t,o,n,e)}function xc(e,t,r){return oe(r)?N$(e,t,Oe(r),le(r)):S(r)?K$(e,t,r.properties):j(e,$(t),r)}function G$(e,t){return i.IsEqual(i.Keys(t).length,0)?l(e):T()}function z$(e,t,r,n,o){return R(e,r,o)}function Ic(e,t,r,n){return oe(n)?z$(e,wr(t),r,wr(Oe(n)),le(n)):S(n)?G$(e,n.properties):U(n)?l(e):B(n)?l(e):T()}function yc(e,t,r){return ce(r)?l(e):j(e,t,r)}function $c(e,t,r){return Je(r)?l(e):j(e,t,r)}function gc(e,t,r){let n=me(t);return R(e,n,r)}function So(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function sn(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"name")&&i.HasPropertyKey(e,"type")&&i.IsEqual(e["~kind"],"Inferrable")&&i.IsString(e.name)&&i.IsObject(e.type)}function jo(e){return Ye(e)?_(e.items)?F(e.items.extends)?So(e.items.name,e.items.extends.items):B(e.items.extends)?So(e.items.name,e.items.extends):void 0:J():void 0}function Nn(e){return _(e)?So(e.name,e.extends):void 0}function wo(e,t,r=[]){return i.ShiftLeft(e,(n,o)=>K(R({},n,t),()=>wo(o,t,[...r,n]),()=>{}),()=>r)}function Tc(e,t,r,n){let o=wo(r,n);return i.IsArray(o)?l(p.Assign(e,{[t]:H(o)})):T()}function Gn(e,t,r,n){let o=wo(r,n);return i.IsArray(o)?l(p.Assign(e,{[t]:h(o)})):T()}function B$(e){return[...e].reverse()}function qo(e,t){return t?B$(e):e}function _$(e){let t=e.length>0?e[0]:void 0,r=Z(t)?jo(t):void 0;return Z(r)}function W$(e,t,r,n,o,s){return K(R(e,r,o),m=>bc(m,t,n,s),()=>T())}function V$(e,t,r,n,o){let s=jo(n);return sn(s)?Tc(e,s.name,qo(r,t),s.type):i.ShiftLeft(r,(m,f)=>W$(e,t,m,f,n,o),()=>T())}function H$(e,t,r,n){return i.ShiftLeft(n,(o,s)=>V$(e,t,r,o,s),()=>i.IsEqual(r.length,0)?l(e):T())}function bc(e,t,r,n){return H$(e,t,r,n)}function Z$(e,t,r){let n=It(e,A([],[]),r),o=_$(n);return bc(e,o,qo(t,o),qo(n,o))}function hc(e,t,r){let n=Nn(r);return sn(n)?Gn(e,n.name,t,n.type):i.ShiftLeft(t,(o,s)=>K(R(e,o,r),m=>hc(m,s,r),()=>T()),()=>l(e))}function Ec(e,t,r){let n=It(e,A([],[]),t);return L(r)?Z$(e,n,r.items):F(r)?hc(e,n,r.items):j(e,H(n),r)}function kc(e,t,r){return Ue(r)?l(e):jt(r)?l(e):j(e,t,r)}function Oc(e,t,r){return i.ShiftLeft(r,(n,o)=>K(R(e,t,n),s=>l(s),()=>Oc(e,t,o)),()=>T())}function Lo(e,t,r){return i.ShiftLeft(t,(n,o)=>K(Oc(e,n,r),s=>Lo(s,o,r),()=>T()),()=>l(e))}function Pc(e,t,r){let n=Nn(r);return sn(n)?Gn(e,n.name,t,n.type):y(r)?Lo(e,t,r.anyOf):Lo(e,t,[r])}function Rc(e,t,r){return _(r)?j(e,t,r):U(r)?l(e):B(r)?l(e):T()}function Mc(e,t,r){return Ue(r)?l(e):j(e,t,r)}function R(e,t,r){return U(t)?ec(e,t,r):F(t)?tc(e,t,t.items,r):Ke(t)?rc(e,t,r):he(t)?nc(e,t,r):Q(t)?ac(e,t.parameters,t.instanceType,r):N(t)?oc(e,t.if,t.then,t.else,r):re(t)?ic(e,t.enum,r):X(t)?sc(e,t.parameters,t.returnType,r):ue(t)?mc(e,t,r):k(t)?pc(e,t.allOf,r):M(t)?uc(e,t,r):ve(t)?cc(e,t,r):kt(t)?fc(e,t,r):V(t)?lc(e,t,r):S(t)?xc(e,t.properties,r):oe(t)?Ic(e,Oe(t),le(t),r):ce(t)?yc(e,t,r):Je(t)?$c(e,t,r):G(t)?gc(e,t.pattern,r):L(t)?Ec(e,t.items,r):jt(t)?kc(e,t,r):y(t)?Pc(e,t.anyOf,r):B(t)?Rc(e,t,r):Ue(t)?Mc(e,t,r):T()}function J$(e,t){return D([...e,$(t)])}function zn(e,t,r){return b(e)?p.Update(J$(e,t),{},r):Xt(e,t,r)}function Ao(e,t,r,n,o){let s=Pe(e,t,r),m=mn(e,t,n);return zn(s,m,o)}function Xt(e,t,r={}){return I("Interface",[e,t],r)}function qt(e){return Z(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function Fo(e,t,r={}){return zn(e,t,r)}function Q$(e,t,r){return e.includes(r)?!0:pn([...e,r],t,t[r])}function vc(e,t,r){let n=gr(r);return Lt(e,t,n)}function Lt(e,t,r){return i.ShiftLeft(r,(n,o)=>pn(e,t,n)?!0:Lt(e,t,o),()=>!1)}function pn(e,t,r){return Y(r)?Q$(e,t,r.$ref):F(r)?pn(e,t,r.items):Q(r)?Lt(e,t,[...r.parameters,r.instanceType]):X(r)?Lt(e,t,[...r.parameters,r.returnType]):qt(r)?vc(e,t,r.parameters[1]):k(r)?Lt(e,t,r.allOf):S(r)?vc(e,t,r.properties):y(r)?Lt(e,t,r.anyOf):L(r)?Lt(e,t,r.items):oe(r)?pn(e,t,le(r)):!1}function Do(e,t,r){return pn(e,t,r)}function X$(e,t){return t.reduce((r,n)=>Do([n],e,e[n])?[...r,n]:r,[])}function Ko(e){let t=$r(e);return X$(e,t)}function Y$(e,t,r){return r.includes(t)?r:t in e?un(e,e[t],[...r,t]):J()}function Cc(e,t,r){let n=gr(t);return ir(e,n,r)}function ir(e,t,r){return t.reduce((n,o)=>un(e,o,n),r)}function un(e,t,r){return Y(t)?Y$(e,t.$ref,r):F(t)?un(e,t.items,r):Q(t)?ir(e,[...t.parameters,t.instanceType],r):X(t)?ir(e,[...t.parameters,t.returnType],r):qt(t)?Cc(e,t.parameters[1],r):k(t)?ir(e,t.allOf,r):S(t)?Cc(e,t.properties,r):y(t)?ir(e,t.anyOf,r):L(t)?ir(e,t.items,r):oe(t)?un(e,le(t),r):r}function Uo(e,t,r){return un(e,r,[t])}function eg(e){return bt()}function tg(e){return i.Keys(e).reduce((t,r)=>({...t,[r]:At(e[r])}),{})}function cn(e){return e.reduce((t,r)=>[...t,At(r)],[])}function At(e){return Y(e)?eg(e.$ref):F(e)?Te(At(e.items),yr(e)):Q(e)?qe(cn(e.parameters),At(e.instanceType)):X(e)?Le(cn(e.parameters),At(e.returnType)):k(e)?de(cn(e.allOf)):S(e)?$(tg(e.properties)):oe(e)?jr(Ct(e),At(le(e))):y(e)?h(cn(e.anyOf)):L(e)?H(cn(e.items)):e}function rg(e,t){return t in e?At(e[t]):ee()}function No(e){return rg(e.$defs,e.$ref)}function ng(e,t,r){let n=Pe(e,A([],[]),t),o=mn({},A([],[]),r);return D([...n,$(o)])}function ag(e,t){return i.Keys(e).filter(n=>t.includes(n)).reduce((n,o)=>{let s=e[o],m=qt(s)?ng(e,s.parameters[0],s.parameters[1]):s;return{...n,[o]:m}},{})}function Go(e,t,r){let n=Uo(e,t,r),o=ag(e,n);return Fe(o,t)}function Sc(e,t){return t in e?Y(e[t])?Sc(e,e[t].$ref):e[t]:w()}function Ne(e,t){return Sc(e,t)}function jc(e){return te(e)?No(e):Tr(e)?ee():e}function ae(e,t,r){let n=jc(t),o=jc(r);return R(e,n,o)}var Vt=0,sr=1,Ht=2,Zt=3;function Rt(e,t){let r=[ae({},e,t),ae({},t,e)];return g.IsExtendsTrueLike(r[0])&&g.IsExtendsTrueLike(r[1])?Vt:g.IsExtendsTrueLike(r[0])&&g.IsExtendsFalse(r[1])?Ht:g.IsExtendsFalse(r[0])&&g.IsExtendsTrueLike(r[1])?Zt:sr}function zo(e,t,r=[],n=t){return i.ShiftLeft(t,(o,s)=>{let m=Rt(e,o);return i.IsEqual(m,Ht)||i.IsEqual(m,Vt)?n:i.IsEqual(m,sr)?zo(e,s,[...r,o],n):zo(e,s,r,n)},()=>[...r,e])}function og(e,t,r){let n=ke(e);return U(n)?[n]:B(n)?[n]:ve(n)?Bn(t,r):S(n)?Bn(t,[...r,n]):Bn(t,zo(n,r))}function Bn(e,t=[]){return i.ShiftLeft(e,(r,n)=>og(r,n,t),()=>t)}function Mn(e){let t=Bn(e);return vt(t)}function _n(e,t){return p.Update(ke(e),{},t)}function Bo(e,t,r,n){let o=c(e,t,r);return _n(o,n)}function fn(e,t=[]){return He(e)&&i.IsEqual(e.action,"Conditional")?Y(e.parameters[0])?fn(e.parameters[2],fn(e.parameters[3],[...t,e.parameters[0].$ref])):fn(e.parameters[2],fn(e.parameters[3],t)):He(e)&&i.IsEqual(e.action,"Mapped")&&He(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&Y(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function ig(e,t){return e.reduce((r,n)=>[...r,t.includes(n.name)],[])}function Lc(e,t,r=[]){return i.ShiftLeft(e,(n,o)=>i.ShiftLeft(t,(s,m)=>Lc(o,m,[...r,[s,n]]),()=>r),()=>r)}function sg(e){return G(e)?me(e.pattern):re(e)?fe(e.enum):e}function mg(e){let t=sg(e);return y(t)?[...t.anyOf]:[t]}function pg(e,t){return e.reduce((r,n)=>[...r,[...n,t]],[])}function wc(e,t){return t.reduce((r,n)=>[...r,...pg(e,n)],[])}function qc(e){return e.reduce((t,r)=>i.IsEqual(r[0],!0)?wc(t,mg(r[1])):wc(t,[r[1]]),[[]])}function Ac(e,t,r){let n=fn(r),o=ig(e,n),s=Lc(t,o);return He(r)&&i.IsEqual(r.action,"Conditional")||He(r)&&i.IsEqual(r.action,"Mapped")?qc(s):[t]}function ug(){return["(not-resolvable)",w()]}function cg(){return["(not-generic)",w()]}function fg(e,t,r){return[e,Ze(t,r)]}function lg(e,t,r){return t in e?Fc(e,t,e[t],r):ug()}function Fc(e,t,r,n){return Tt(r)?fg(t,r.parameters,r.expression):Y(r)?lg(e,r.$ref,n):cg()}function Dc(e,t,r){return Fc(e,"(anonymous)",t,r)}function dg(e,t,r){if(_(t)||Ft(t)||g.IsExtendsTrueLike(ae({},t,r)))return;let n={parameter:e,expect:r,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:n})}function Kc(e,t,r,n,o){let s=c(e,t,o);return dg(r,s,n),p.Assign(e,{[r]:s})}function xg(e,t,r,n,o){let s=c(e,t,r.extends),m=c(e,t,r.equals);return i.ShiftLeft(o,(f,d)=>_o(Kc(e,t,r.name,s,f),t,n,d),()=>_o(Kc(e,t,r.name,s,m),t,n,[]))}function _o(e,t,r,n){return i.ShiftLeft(r,(o,s)=>xg(e,t,o,s,n),()=>e)}function Uc(e,t,r,n){return _o(e,t,r,n)}var Wo=0,Vo=0;function Ig(){if(!i.IsLessThan(Vo,Me.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function yg(){Ig(),Vo++,Wo++}function $g(){Wo--,i.IsEqual(Wo,0)&&(Vo=0)}function gg(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function Tg(e,t){return i.IsEqual(gg(e),t)}function bg(e,t,r,n,o,s){yg();try{let m=Uc(e,t,n,s),f=c(m,A([...t.callstack,r.$ref],t.visited),o);return c(m,A([],[]),f)}finally{$g()}}function hg(e,t,r,n,o,s){return s.reduce((m,f)=>{let d=bg(e,t,r,n,o,f);return[...m,d]},[])}function Eg(e,t,r,n,o,s){let m=Ac(n,s,o),f=hg(e,t,r,n,o,m);return i.IsEqual(f.length,1)?f[0]:Ie(f)}function Wn(e,t,r,n){let o=Pe(e,t,n),s=Dc(e,r,n),m=s[0],f=s[1];return Tt(f)?Tg(t,m)?Yt(ze(m),o):Eg(e,t,ze(m),f.parameters,f.expression,o):Yt(r,o)}function Yt(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Ho(e,t){return Wn({},A([],[]),e,t)}function Ft(e){return x(e,"Call")}function kg(e){return p.Discard(e,["~immutable"])}function Zo(e,t){return p.Update(kg(e),{},t)}function Nc(e,t,r,n){let o=c(e,t,r);return Zo(o,n)}function Gc(e,t){return e(t)}function zc(e,t){return i.IsString(t)?O(Gc(e,t)):O(t)}function Bc(e,t){let r=me(t);return tt(e,r)}function _c(e,t){let r=t.map(n=>tt(e,n));return h(r)}function tt(e,t){return M(t)?zc(e,t.const):G(t)?Bc(e,t.pattern):y(t)?_c(e,t.anyOf):t}function Dr(e,t={}){return I("Capitalize",[e],t)}function Jo(e,t={}){return Vn(e,t)}function Kr(e,t={}){return I("Lowercase",[e],t)}function Qo(e,t={}){return Hn(e,t)}function Ur(e,t={}){return I("Uncapitalize",[e],t)}function Xo(e,t={}){return Zn(e,t)}function Nr(e,t={}){return I("Uppercase",[e],t)}function Yo(e,t={}){return Jn(e,t)}var Og=e=>e[0].toUpperCase()+e.slice(1),Pg=e=>e.toLowerCase(),Rg=e=>e[0].toLowerCase()+e.slice(1),Mg=e=>e.toUpperCase();function Vn(e,t){return b([e])?p.Update(tt(Og,e),{},t):Dr(e,t)}function Hn(e,t){return b([e])?p.Update(tt(Pg,e),{},t):Kr(e,t)}function Zn(e,t){return b([e])?p.Update(tt(Rg,e),{},t):Ur(e,t)}function Jn(e,t){return b([e])?p.Update(tt(Mg,e),{},t):Nr(e,t)}function ei(e,t,r,n){let o=c(e,t,r);return Vn(o,n)}function ti(e,t,r,n){let o=c(e,t,r);return Hn(o,n)}function ri(e,t,r,n){let o=c(e,t,r);return Zn(o,n)}function ni(e,t,r,n){let o=c(e,t,r);return Jn(o,n)}function Gr(e,t,r,n,o={}){return I("Conditional",[e,t,r,n],o)}function ai(e,t,r,n,o={}){return Qn({},A([],[]),e,t,r,n,o)}function vg(e,t,r,n,o,s){let m=ae(e,r,n);return g.IsExtendsUnion(m)?h([c(m.inferred,t,o),c(e,t,s)]):g.IsExtendsTrue(m)?c(m.inferred,t,o):c(e,t,s)}function Qn(e,t,r,n,o,s,m){return b([r,n])?p.Update(vg(e,t,r,n,o,s),{},m):Gr(r,n,o,s,m)}function oi(e,t,r,n,o,s,m){let f=c(e,t,r),d=c(e,t,n);return Qn(e,t,f,d,o,s,m)}function zr(e,t={}){return I("ConstructorParameters",[e],t)}function ii(e,t={}){return Xn(e,t)}function Cg(e){let t=Q(e)?e.parameters:[],r=It({},A([],[]),t);return H(r)}function Xn(e,t){return b([e])?p.Update(Cg(e),{},t):zr(e,t)}function si(e,t,r,n){let o=c(e,t,r);return Xn(o,n)}function Br(e,t,r={}){return I("Exclude",[e,t],r)}function mi(e,t,r={}){return mr(e,t,r)}function mr(e,t,r){return b([e,t])?p.Update(Rn(e,t),{},r):Br(e,t,r)}function pi(e,t,r,n,o){let s=c(e,t,r),m=c(e,t,n);return mr(s,m,o)}function _r(e,t,r={}){return I("Extract",[e,t],r)}function ui(e,t,r={}){return Yn(e,t,r)}function Sg(e,t){let r=ae({},e,t);return g.IsExtendsTrueLike(r)?[e]:[]}function Wc(e,t,r=[]){return i.ShiftLeft(e,(n,o)=>Wc(o,t,[...r,...Sg(n,t)]),()=>r)}function Vc(e,t){let r=ke(e),n=y(r)?r.anyOf:[r],o=Wc(n,t);return Ie(o)}function Yn(e,t,r){return b([e,t])?p.Update(Vc(e,t),{},r):_r(e,t,r)}function ci(e,t,r,n,o){let s=c(e,t,r),m=c(e,t,n);return Yn(s,m,o)}function jg(e){return e.reduce((t,r)=>Or(r)?[...t,O(r)]:t,[])}function Dt(e){let t=jg(e);return h(t)}function er(e,t,r={}){return I("Index",[e,t],r)}function fi(e,t,r={}){let n=i.IsArray(t)?Dt(t):t;return ea(e,n,r)}function Hc(e,t){let r=Ne(e,t);return Re(r)}function Zc(e,t,r){let n=Se(e,t,r);return Re(n)}function wg(e,t){let r=i.Keys(e).filter(C=>!i.HasPropertyKey(t,C)),n=i.Keys(t).filter(C=>!i.HasPropertyKey(e,C)),o=i.Keys(e).filter(C=>i.HasPropertyKey(t,C)),s=r.reduce((C,pe)=>({...C,[pe]:e[pe]}),{}),m=n.reduce((C,pe)=>({...C,[pe]:t[pe]}),{}),f=o.reduce((C,pe)=>({...C,[pe]:D([e[pe],t[pe]])}),{}),d=p.Assign(s,m);return p.Assign(d,f)}function Jc(e){return e.reduce((t,r)=>wg(t,Re(r)),{})}function Qc(e){let t=Ds(H(e));return Re(t)}function qg(e,t){return i.Keys(e).filter(o=>o in t).reduce((o,s)=>({...o,[s]:Ie([e[s],t[s]])}),{})}function Xc(e,t){return i.ShiftLeft(e,(r,n)=>Xc(n,qg(t,Re(r))),()=>t)}function Yc(e){return i.ShiftLeft(e,(t,r)=>Xc(r,Re(t)),()=>J())}function Re(e){return te(e)?Hc(e.$defs,e.$ref):N(e)?Zc(e.if,e.then,e.else):k(e)?Jc(e.allOf):y(e)?Yc(e.anyOf):L(e)?Qc(e.items):S(e)?e.properties:{}}function Kt(e){let t=Re(e);return $(t)}var Lg=new RegExp("^(?:0|[1-9][0-9]*)$");function Ut(e){let t=`${e}`;return Lg.test(t)?parseInt(t):e}function Ag(e){return O(Ut(e))}function ef(e){return e.map(t=>tf(t))}function tf(e){return k(e)?de(ef(e.allOf)):y(e)?h(ef(e.anyOf)):M(e)?Ag(e.const):e}function rf(e,t){let r=tf(t),n=ae({},r,ye());return g.IsExtendsTrueLike(n)?e:M(t)&&i.IsEqual(t.const,"length")?ye():w()}function nf(e,t){let r=Ne(e,t);return be(r)}function af(e,t,r){let n=Se(e,t,r);return be(n)}function of(e){let t=fe(e);return be(t)}function sf(e){let t=D(e);return be(t)}function mf(e){return[`${e}`]}function pf(e){let t=me(e);return be(t)}function uf(e){return e.reduce((t,r)=>[...t,...be(r)],[])}function be(e){return te(e)?nf(e.$defs,e.$ref):N(e)?af(e.if,e.then,e.else):re(e)?of(e.enum):k(e)?sf(e.allOf):M(e)?mf(e.const):G(e)?pf(e.pattern):y(e)?uf(e.anyOf):[]}function pr(e){return be(e)}function ln(e,t){return t.map(r=>dn(e,r))}function dn(e,t){return F(t)?Te(dn(e,t.items)):Q(t)?qe(ln(e,t.parameters),dn(e,t.instanceType)):X(t)?Le(ln(e,t.parameters),dn(e,t.returnType)):L(t)?H(ln(e,t.items)):y(t)?h(ln(e,t.anyOf)):k(t)?de(ln(e,t.allOf)):Lr(t)?$(e):t}function cf(e,t){return dn(e,t)}function Fg(e,t){let r=t in e?e[t]:w();return cf(e,r)}function ff(e,t){return t.reduce((r,n)=>[...r,Fg(e,n)],[])}function Dg(e,t){let r=pr(t),n=ff(e,r);return Ie(n)}var Kg=new RegExp(Xe);function Ug(e){return e.filter(r=>Kg.test(r))}function Ng(e){let t=$r(e),r=Ug(t),n=ff(e,r);return Ie(n)}function lf(e,t){return V(t)?Ng(e):Dg(e,t)}function Gg(e){return O(Ut(e))}function df(e){return e.map(t=>li(t))}function li(e){return k(e)?de(df(e.allOf)):y(e)?h(df(e.anyOf)):M(e)?Gg(e.const):e}function zg(e,t){return e.reduceRight((r,n,o)=>{let s=ae({},O(o),t);return g.IsExtendsTrueLike(s)?[n,...r]:r},[])}function Bg(e,t){let r=li(t),n=zg(e,r);return Qe(n)}function _g(e){return Qe(e)}function xf(e,t){return M(t)&&i.IsEqual(t.const,"length")?O(e.length):V(t)||ue(t)?_g(e):Bg(e,t)}function If(e,t){return F(e)?rf(e.items,t):S(e)?lf(e.properties,t):L(e)?xf(e.items,t):w()}function Wg(e){return te(e)||N(e)||k(e)||y(e)?Kt(e):e}function ea(e,t,r){return b([e,t])?p.Update(If(Wg(e),t),{},r):er(e,t,r)}function di(e,t,r,n,o){let s=c(e,t,r),m=c(e,t,n);return ea(s,m,o)}function Wr(e,t={}){return I("InstanceType",[e],t)}function xi(e,t={}){return ta(e,t)}function Vg(e){return Q(e)?e.instanceType:w()}function ta(e,t){return b([e])?p.Update(Vg(e),{},t):Wr(e,t)}function Ii(e,t,r,n={}){let o=c(e,t,r);return ta(o,n)}function tr(e,t={}){return I("KeyOf",[e],t)}function yi(e,t={}){return ra(e,t)}function yf(){return h([ye(),Ee(),Ot()])}function $f(e){return ye()}function Hg(e){return e.reduce((r,n)=>Or(n)?[...r,O(Ut(n))]:J(),[])}function gf(e){let t=i.Keys(e),r=Hg(t);return Qe(r)}function Tf(e){return Ct(e)}function bf(e){let t=e.map((r,n)=>O(n));return Qe(t)}function hf(e){return U(e)?yf():F(e)?$f(e.items):S(e)?gf(e.properties):oe(e)?Tf(e):L(e)?bf(e.items):w()}function Zg(e){return te(e)||N(e)||k(e)||y(e)?Kt(e):e}function ra(e,t){return b([e])?p.Update(hf(Zg(e)),{},t):tr(e,t)}function $i(e,t,r,n){let o=c(e,t,r);return ra(o,n)}function Qt(e,t,r,n,o={}){return I("Mapped",[e,t,r,n],o)}function gi(e,t,r,n,o={}){return na({},A([],[]),e,t,r,n,o)}function Jg(e){let t=me(e);return aa(t)}function Qg(e){return e.reduce((t,r)=>[...t,...aa(r)],[])}function Xg(e){let t=fe(e);return aa(t)}function Yg(e){return i.IsNumber(e)?[O(`${e}`)]:[O(e)]}function aa(e){return re(e)?Xg(e.enum):M(e)?Yg(e.const):G(e)?Jg(e.pattern):y(e)?Qg(e.anyOf):[e]}function Ef(e){return aa(e)}function eT(e){return G(e)?me(e.pattern):e}function tT(e,t,r,n,o,s){let m=p.Assign(e,{[r.name]:n}),f=c(m,t,o),d=eT(f),q=c(m,t,s);return _a(d)||Wa(d)?{[d.const]:q}:{}}function rT(e,t,r,n,o,s){return n.reduce((m,f)=>[...m,tT(e,t,r,f,o,s)],[])}function nT(e){return e.reduce((t,r)=>[...t,$(r)],[])}function kf(e,t,r,n,o,s){let m=Ef(n),f=rT(e,t,r,m,o,s),d=nT(f);return D(d)}function na(e,t,r,n,o,s,m){return b([n])?p.Update(kf(e,t,r,n,o,s),{},m):Qt(r,n,o,s,m)}function Ti(e,t,r,n,o,s,m){let f=c(e,t,n);return na(e,t,r,f,o,s,m)}function aT(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>r.includes(s)).reduce((s,m)=>({...s,[m]:Go(n,m,t[m])}),{})}function oT(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>!r.includes(s)).reduce((s,m)=>({...s,[m]:c(n,A([],[]),t[m])}),{})}function iT(e,t,r){let n=Ko(t),o=aT(e,t,n),s=oT(e,t,n),m={...o,...s};return p.Update(m,{},r)}function xn(e,t,r,n){return iT(e,r,n)}function Vr(e,t={}){return I("NonNullable",[e],t)}function bi(e,t={}){return oa(e,t)}function sT(e){let t=h([Et(),St()]);return mr(e,t,{})}function oa(e,t){return b([e])?p.Update(sT(e),{},t):Vr(e,t)}function hi(e,t,r,n){let o=c(e,t,r);return oa(o,n)}function Hr(e,t,r={}){return I("Omit",[e,t],r)}function Ei(e,t,r={}){let n=i.IsArray(t)?Dt(t):t;return ia(e,n,r)}function sa(e){let t=Kt(e);return S(t)?t.properties:J()}function mT(e,t){return i.Keys(e).reduce((n,o)=>t.includes(o)?n:{...n,[o]:e[o]},{})}function Of(e,t){let r=sa(e),n=pr(t),o=mT(r,n);return $(o)}function ia(e,t,r){return b([e,t])?p.Update(Of(e,t),{},r):Hr(e,t,r)}function ki(e,t,r,n,o){let s=c(e,t,r),m=c(e,t,n);return ia(s,m,o)}function Zr(e,t={}){return I("Parameters",[e],t)}function Oi(e,t={}){return ma(e,t)}function pT(e){let t=X(e)?e.parameters:[],r=It({},A([],[]),t);return H(r)}function ma(e,t){return b([e])?p.Update(pT(e),{},t):Zr(e,t)}function Pi(e,t,r,n){let o=c(e,t,r);return ma(o,n)}function Jr(e,t={}){return I("Partial",[e],t)}function Ri(e,t={}){return pa(e,t)}function Pf(e,t){let r=Ne(e,t),n=_e(r);return Fe(p.Assign(e,{[t]:n}),t)}function Rf(e,t,r){let n=Se(e,t,r);return _e(n)}function Mf(e){let t=D(e);return _e(t)}function vf(e){let t=e.map(r=>_e(r));return h(t)}function Cf(e){let t=i.Keys(e).reduce((n,o)=>({...n,[o]:nt(e[o])}),{});return $(t)}function _e(e){return te(e)?Pf(e.$defs,e.$ref):N(e)?Rf(e.if,e.then,e.else):k(e)?Mf(e.allOf):y(e)?vf(e.anyOf):S(e)?Cf(e.properties):$({})}function pa(e,t){return b([e])?p.Update(_e(e),{},t):Jr(e,t)}function Mi(e,t,r,n){let o=c(e,t,r);return pa(o,n)}function Qr(e,t,r={}){return I("Pick",[e,t],r)}function vi(e,t,r={}){let n=i.IsArray(t)?Dt(t):t;return ua(e,n,r)}function uT(e,t){return i.Keys(e).reduce((n,o)=>t.includes(o)?p.Assign(n,{[o]:e[o]}):n,{})}function Sf(e,t){let r=sa(e),n=pr(t),o=uT(r,n);return $(o)}function ua(e,t,r){return b([e,t])?p.Update(Sf(e,t),{},r):Qr(e,t,r)}function Ci(e,t,r,n,o){let s=c(e,t,r),m=c(e,t,n);return ua(s,m,o)}function Xr(e,t={}){return I("ReadonlyObject",[e],t)}function ca(e,t={}){return fa(e,t)}var Si=ca;function jf(e){return ht(Te(e))}function wf(e,t){let r=Ne(e,t),n=We(r);return Fe(p.Assign(e,{[t]:n}),t)}function qf(e,t,r){let n=Se(e,t,r);return We(n)}function Lf(e){let t=D(e);return We(t)}function Af(e){let t=i.Keys(e).reduce((n,o)=>({...n,[o]:st(e[o])}),{});return $(t)}function Ff(e){return ht(H(e))}function Df(e){let t=e.map(r=>We(r));return h(t)}function We(e){return F(e)?jf(e.items):te(e)?wf(e.$defs,e.$ref):N(e)?qf(e.if,e.then,e.else):k(e)?Lf(e.allOf):S(e)?Af(e.properties):L(e)?Ff(e.items):y(e)?Df(e.anyOf):e}function fa(e,t){return b([e])?p.Update(We(e),{},t):Xr(e)}function ji(e,t,r,n){let o=c(e,t,r);return fa(o,n)}function wi(e,t,r,n){return t.visited.includes(n)?r:n in e?c(e,A(t.callstack,[...t.visited,n]),e[n]):r}function Kf(e,t){let r=Ne(e,t),n=Ve(r);return Fe(p.Assign(e,{[t]:n}),t)}function Uf(e,t,r){let n=Se(e,t,r);return Ve(n)}function Nf(e){let t=D(e);return Ve(t)}function Gf(e){let t=e.map(r=>Ve(r));return h(t)}function zf(e){let t=i.Keys(e).reduce((n,o)=>({...n,[o]:Cr(e[o])}),{});return $(t)}function Ve(e){return te(e)?Kf(e.$defs,e.$ref):N(e)?Uf(e.if,e.then,e.else):k(e)?Nf(e.allOf):y(e)?Gf(e.anyOf):S(e)?zf(e.properties):$({})}function Yr(e,t={}){return I("Required",[e],t)}function qi(e,t={}){return la(e,t)}function la(e,t){return b([e])?p.Update(Ve(e),{},t):Yr(e,t)}function Li(e,t,r,n){let o=c(e,t,r);return la(o,n)}function en(e,t={}){return I("ReturnType",[e],t)}function Ai(e,t={}){return da(e,t)}function cT(e){return X(e)?e.returnType:w()}function da(e,t){return b([e])?p.Update(cT(e),{},t):en(e,t)}function Fi(e,t,r,n={}){let o=c(e,t,r);return da(o,n)}function tn(e,t){return I("With",[e,t],{})}function Di(e,t){return xa(e,t)}function xa(e,t){return b([e])?p.Update(e,{},t):tn(e,t)}function Ki(e,t,r,n){let o=c(e,t,r);return xa(o,n)}function fT(e){return Ye(e)?L(e.items)?Ui(e.items.items):_(e.items)?[e]:Y(e.items)?[e]:[w()]:[e]}function Ui(e){return e.reduce((r,n)=>[...r,...fT(n)],[])}function A(e,t){return{callstack:e,visited:t}}function b(e){return i.ShiftLeft(e,(t,r)=>Y(t)?!1:b(r),()=>!0)}function mn(e,t,r){return i.Keys(r).reduce((n,o)=>({...n,[o]:c(e,t,r[o])}),{})}function It(e,t,r){let n=Pe(e,t,r);return Ui(n)}function Pe(e,t,r){return r.map(n=>c(e,t,n))}function lT(e,t){let r=se(e)?Ir(t,{}):t,n=mt(e)?xr(r,{}):r;return it(e)?In(n,{}):n}function dT(e,t,r,n,o){return i.IsEqual(r,"AddImmutable")?Bf(e,t,n[0],o):i.IsEqual(r,"RemoveImmutable")?Nc(e,t,n[0],o):i.IsEqual(r,"AddReadonly")?cs(e,t,n[0],o):i.IsEqual(r,"RemoveReadonly")?As(e,t,n[0],o):i.IsEqual(r,"AddOptional")?fs(e,t,n[0],o):i.IsEqual(r,"RemoveOptional")?Fs(e,t,n[0],o):i.IsEqual(r,"Capitalize")?ei(e,t,n[0],o):i.IsEqual(r,"Conditional")?oi(e,t,n[0],n[1],n[2],n[3],o):i.IsEqual(r,"ConstructorParameters")?si(e,t,n[0],o):i.IsEqual(r,"Evaluate")?Bo(e,t,n[0],o):i.IsEqual(r,"Exclude")?pi(e,t,n[0],n[1],o):i.IsEqual(r,"Extract")?ci(e,t,n[0],n[1],o):i.IsEqual(r,"Index")?di(e,t,n[0],n[1],o):i.IsEqual(r,"InstanceType")?Ii(e,t,n[0],o):i.IsEqual(r,"Interface")?Ao(e,t,n[0],n[1],o):i.IsEqual(r,"KeyOf")?$i(e,t,n[0],o):i.IsEqual(r,"Lowercase")?ti(e,t,n[0],o):i.IsEqual(r,"Mapped")?Ti(e,t,n[0],n[1],n[2],n[3],o):i.IsEqual(r,"Module")?xn(e,t,n[0],o):i.IsEqual(r,"NonNullable")?hi(e,t,n[0],o):i.IsEqual(r,"Pick")?Ci(e,t,n[0],n[1],o):i.IsEqual(r,"Parameters")?Pi(e,t,n[0],o):i.IsEqual(r,"Partial")?Mi(e,t,n[0],o):i.IsEqual(r,"Omit")?ki(e,t,n[0],n[1],o):i.IsEqual(r,"ReadonlyObject")?ji(e,t,n[0],o):i.IsEqual(r,"Record")?oo(e,t,n[0],n[1],o):i.IsEqual(r,"Required")?Li(e,t,n[0],o):i.IsEqual(r,"ReturnType")?Fi(e,t,n[0],o):i.IsEqual(r,"TemplateLiteral")?Hu(e,t,n[0],o):i.IsEqual(r,"Uncapitalize")?ri(e,t,n[0],o):i.IsEqual(r,"Uppercase")?ni(e,t,n[0],o):i.IsEqual(r,"With")?Ki(e,t,n[0],n[1]):I(r,n,o)}function xT(e,t,r){let n=Y(r)?wi(e,t,r,r.$ref):F(r)?Te(c(e,t,r.items),yr(r)):Ft(r)?Wn(e,t,r.target,r.arguments):Q(r)?qe(Pe(e,t,r.parameters),c(e,t,r.instanceType),Ea(r)):X(r)?Le(Pe(e,t,r.parameters),c(e,t,r.returnType),ka(r)):N(r)?at(c(e,t,r.if),c(e,t,r.then),c(e,t,r.else),Ca(r)):k(r)?de(Pe(e,t,r.allOf),La(r)):S(r)?$(mn(e,t,r.properties),Ma(r)):oe(r)?io(Oe(r),c(e,t,le(r))):Ye(r)?ft(c(e,t,r.items)):L(r)?H(It(e,t,r.items),Ja(r)):y(r)?h(Pe(e,t,r.anyOf),Ha(r)):r;return lT(r,n)}function c(e,t,r){return He(r)?dT(e,t,r.action,r.parameters,r.options):xT(e,t,r)}function Ia(e,t){return c(e,A([],[]),t)}function IT(e){return p.Update(e,{"~immutable":!0},{})}function In(e,t){return p.Update(IT(e),{},t)}function Bf(e,t,r,n){let o=c(e,t,r);return In(o,n)}function mo(e,t={}){return I("AddImmutable",[e],t)}function ht(e,t={}){return In(e,t)}function yT(e,t={}){return I("RemoveImmutable",[e],t)}function $T(e,t={}){return Zo(e,t)}function po(e,t={}){return I("Evaluate",[e],t)}function Ni(e,t={}){return _n(e,t)}function uo(e,t={}){return I("Module",[e],t)}function Gi(e,t={}){return xn({},A([],[]),e,t)}function gT(e,t){let r=Rt(e,t);return i.IsEqual(r,Zt)||i.IsEqual(r,sr)?1:0}function _f(e,t,r=[]){return i.ShiftLeft(t,(n,o)=>i.IsEqual(gT(e,n),1)?_f(e,o,[...r,n]):[...r,e,...t],()=>[...r,e])}function Wf(e,t=[]){return i.ShiftLeft(e,(r,n)=>Wf(n,_f(r,t)),()=>t)}function TT(e){return Wf(e)}function bT(e){let t=Pt(e);return!i.IsEqual(t.length,0)}function zi(...e){let[t,r,n]=Be.Match(e,{2:(m,f)=>i.IsString(m)?[{},m,f]:[m,f,{}],3:(m,f,d)=>[m,f,d],1:m=>[{},m,{}]}),o=Wu(r),s=i.IsArray(o)&&i.IsEqual(o.length,2)?c(t,A([],[]),o[0]):w();return p.Update(s,{},n)}var yn={};je(yn,{Any:()=>bt,Array:()=>Te,BigInt:()=>_t,Boolean:()=>Er,Call:()=>Ho,Capitalize:()=>Jo,Codec:()=>hr,Conditional:()=>ai,Constructor:()=>qe,ConstructorParameters:()=>ii,Cyclic:()=>Fe,Decode:()=>Da,DecodeBuilder:()=>Bt,Dependent:()=>at,Encode:()=>Ka,EncodeBuilder:()=>zt,Enum:()=>qa,Evaluate:()=>Ni,Exclude:()=>mi,Extends:()=>ae,ExtendsResult:()=>g,Extract:()=>ui,Function:()=>Le,Generic:()=>Ze,Identifier:()=>Wt,Immutable:()=>Ua,Index:()=>fi,Infer:()=>Nt,InstanceType:()=>xi,Instantiate:()=>Ia,Integer:()=>pt,Interface:()=>Fo,Intersect:()=>de,IsAny:()=>U,IsArray:()=>F,IsBigInt:()=>Ke,IsBoolean:()=>he,IsCall:()=>Ft,IsCodec:()=>br,IsConstructor:()=>Q,IsCyclic:()=>te,IsDependent:()=>N,IsEnum:()=>re,IsEnumValue:()=>wa,IsFunction:()=>X,IsGeneric:()=>Tt,IsIdentifier:()=>Ba,IsImmutable:()=>it,IsInfer:()=>_,IsInteger:()=>ue,IsIntersect:()=>k,IsKind:()=>x,IsLiteral:()=>M,IsNever:()=>ve,IsNull:()=>kt,IsNumber:()=>V,IsObject:()=>S,IsOptional:()=>se,IsParameter:()=>Va,IsReadonly:()=>mt,IsRecord:()=>oe,IsRef:()=>Y,IsRefine:()=>En,IsRest:()=>Ye,IsSchema:()=>Z,IsString:()=>ce,IsSymbol:()=>Je,IsTemplateLiteral:()=>G,IsThis:()=>Lr,IsTuple:()=>L,IsUndefined:()=>jt,IsUnion:()=>y,IsUnknown:()=>B,IsUnsafe:()=>Tr,IsVoid:()=>Ue,KeyOf:()=>yi,Literal:()=>O,Lowercase:()=>Qo,Mapped:()=>gi,Module:()=>Gi,Never:()=>w,NonNullable:()=>bi,Null:()=>Et,Number:()=>ye,Object:()=>$,Omit:()=>Ei,Optional:()=>Pa,Parameter:()=>ut,Parameters:()=>Oi,Partial:()=>Ri,Pick:()=>vi,Readonly:()=>Na,ReadonlyObject:()=>ca,ReadonlyType:()=>Si,Record:()=>jr,RecordKey:()=>Ct,RecordPattern:()=>Oe,RecordValue:()=>le,Ref:()=>ze,Refine:()=>Ga,Required:()=>qi,Rest:()=>ft,ReturnType:()=>Ai,Script:()=>zi,String:()=>Ee,Symbol:()=>Ot,TemplateLiteral:()=>vo,This:()=>qr,Tuple:()=>H,Uncapitalize:()=>Xo,Undefined:()=>St,Union:()=>h,Unknown:()=>ee,Unsafe:()=>va,Uppercase:()=>Yo,Void:()=>Ar,With:()=>Di});var hT=yn;export{i as a,ps as b,ge as c,OT as d,Me as e,dr as f,Z as g,Te as h,F as i,yr as j,Q as k,X as l,ze as m,Y as n,ve as o,se as p,$ as q,S as r,ee as s,te as t,Be as u,re as v,de as w,k as x,ds as y,J as z,bs as A,Kh as B,br as C,En as D,Ke as E,he as F,ue as G,O as H,vx as I,Cx as J,_a as K,Wa as L,M,kt as N,V as O,Je as P,Ee as Q,ce as R,h as S,y as T,Za as U,H as V,L as W,vt as X,jr as Y,Oe as Z,Ct as _,le as $,oe as aa,jt as ba,Ue as ca,G as da,Di as ea,Ia as fa,Ni as ga,TT as ha,yn as ia,ET as ja};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{A as Z}from"./chunk-HVN37UXD.js";import{w as G}from"./chunk-Y6DGVTKM.js";import{f as Y}from"./chunk-52VCLZS5.js";import{d as X}from"./chunk-SM45TH22.js";import{K as p}from"./chunk-W34AK4SK.js";import{e as T}from"./chunk-TRXLIL7V.js";import{e as c}from"./chunk-7GGPYU5E.js";import{e as S}from"./chunk-7W7VYUTK.js";import{c as y,e as K,j as J,z as x}from"./chunk-T54CZKNJ.js";import*as F from"node:path";var q="environments",R=F.join(J,q),ne=F.join(y,"config",q),Q="main";import{existsSync as M,mkdirSync as Lt,readdirSync as L,readFileSync as st,statSync as Vt,watch as Wt,writeFileSync as Ct}from"node:fs";import*as D from"node:path";import{existsSync as O,readFileSync as Nt}from"node:fs";import*as g from"node:path";import{readFileSync as Et}from"fs";import*as tt from"path";var St=S("prompt-includes");function Rt(t){let e=t.trimStart();if(!e.startsWith("---"))return{frontmatter:null,body:t};let n=e.indexOf(`
|
|
5
|
+
---`,3);if(n===-1)return{frontmatter:null,body:t};let o=e.slice(3,n).trim(),r=e.slice(n+4).replace(/^\n/,""),i={},s;for(let l of o.split(`
|
|
6
|
+
`)){let a=l.match(/^(\w[\w-]*)\s*:\s*(.*)$/);if(!a)continue;let[,h,b]=a,E=b.trim().replace(/^["'](.*)["']$/,"$1");h==="extends"?s=E:i[h]=E}return{frontmatter:{extends:s,vars:i},body:r}}function wt(t){let e=[],n=/^@fill\((\w[\w-]*)\)\s*\n([\s\S]*?)^@endfill\s*$/gm,o;for(;(o=n.exec(t))!==null;)e.push({name:o[1],content:o[2].replace(/\n$/,"")});return e}function Dt(t,e){let n=new Map(e.map(o=>[o.name,o.content]));return t.replace(/^@block\((\w[\w-]*)\)\s*\n([\s\S]*?)^@endblock\s*$/gm,(o,r,i)=>{let s=n.get(r);return s!==void 0?s:i.replace(/\n$/,"")})}function bt(t,e){return t.replace(/\$\{(\w[\w-]*)(?::-([^}]*))?\}/g,(n,o,r)=>o in e?e[o]:r!==void 0?r:"")}function Tt(t,e){return t=t.replace(/^@if\(!(\w[\w-]*)\)\s*\n([\s\S]*?)^@endif\s*\n?/gm,(n,o,r)=>o in e&&e[o]!==""?"":r),t=t.replace(/^@if\((\w[\w-]*)\)\s*\n([\s\S]*?)^@endif\s*\n?/gm,(n,o,r)=>o in e&&e[o]!==""?r:""),t}function et(t,e){let{frontmatter:n,body:o}=Rt(t);if(!n||!n.extends)return n?o:t;let r=tt.join(e,n.extends),i;try{i=Et(r,"utf8")}catch(a){return St.error(`Failed to read template "${n.extends}": ${a.message}`),o}let s=wt(o),l=Dt(i,s);return l=Tt(l,n.vars),l=bt(l,n.vars),l}var Pt=S("environments"),f="file:",w={directive:"directives",promptTemplate:"promptTemplates",systemPrompt:"systemPrompts"},nt=g.join(y,"prompts");function jt(t,e){return O(g.join(x,t,e))?x:O(g.join(nt,t,e))?nt:x}function N(t,e){if(!e||!e.startsWith(f))return e;let n=e.slice(f.length),o=w[t];if(!o)return e;let r=jt(o,n);try{let i=Nt(g.join(r,o,n),"utf8");return et(i,g.join(r,o,"templates"))}catch(i){return Pt.error(`Failed to read ${t} file ref "${e}": ${i.message}`),e}}function ot(){return{promptsDir:x,pluginBaseDir:K,builtinDir:y,join:g.join,exists:O,isAbsolute:g.isAbsolute}}var $t={loadRules:p.boolean().optional(),disableHooks:p.boolean().optional(),skills:p.boolean().optional(),settingSources:p.array(p.enum(["user","project","local"])).optional(),projectContext:p.boolean().optional()},rt=p.object({name:p.string().min(1),description:p.string().optional(),directive:p.string().optional(),systemPrompt:p.string().optional(),promptTemplate:p.string().optional(),claudeAgent:p.string().optional(),outputStyle:p.string().optional(),tools:p.string().optional(),pluginDirs:p.array(p.string()).optional(),disabledPlugins:p.array(p.string()).optional(),mcpComposition:p.enum(["direct","none"]).optional(),mcpToolAllowlist:p.array(p.string()).optional(),...$t}),k=["persistSession","delegable"],_t=new Set([...Object.keys(rt.shape),...k]);function It(t){let e="";for(let n of t)typeof n=="number"?e+=`[${n}]`:e+=e===""?String(n):`.${String(n)}`;return e}function At(t){return t.success?[]:t.error.issues.map(e=>({path:It(e.path)||"(root)",message:e.message}))}function Ft(t,e){return Object.keys(t).filter(n=>!e.has(n)).map(n=>({path:n,message:c("ux.tpl.unknownField",{key:n})}))}function Ot(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function kt(t,e,n,o,r){if(!o||typeof e!="string"||!e.startsWith(f))return;let i=w[t];if(!i)return;let s=e.slice(f.length);o.exists(o.join(o.promptsDir,i,s))||o.exists(o.join(o.builtinDir,"prompts",i,s))||r.push({path:n,message:c("ux.tpl.promptFileMissing",{subdir:i,filename:s,value:e})})}function Mt(t,e,n){!e||!Array.isArray(t)||t.forEach((o,r)=>{if(typeof o!="string")return;let i=e.isAbsolute(o)?o:e.join(e.pluginBaseDir,o),s=!e.isAbsolute(o)&&e.exists(e.join(e.builtinDir,o));!e.exists(i)&&!s&&n.push({path:`pluginDirs[${r}]`,message:c("ux.tpl.pluginDirMissing",{dir:o})})})}function P(t,e,n){if(!Ot(e))return{errors:[{path:"(root)",message:c("ux.tpl.bodyNotObject")}],warnings:[]};let o={errors:At(rt.safeParse(e)),warnings:Ft(e,_t)};typeof e.name=="string"&&e.name!==t&&o.errors.push({path:"name",message:c("ux.tpl.nameMismatch",{name:e.name,file:t})});for(let r of["directive","systemPrompt","promptTemplate"])kt(r,e[r],r,n,o.warnings);return Mt(e.pluginDirs,n,o.warnings),o}var u=S("environments"),v={},lt=!1,at=0;function we(){return at}function Bt(t){if(!M(t))return{};let e={};for(let n of L(t).sort()){if(!n.endsWith(".json"))continue;let o=n.slice(0,-5),r;try{r=JSON.parse(st(D.join(t,n),"utf8"))}catch(a){u.warn(`Skipping malformed environment ${n}: ${a.message}`);continue}let{errors:i,warnings:s}=P(o,r,ot());for(let a of i)u.error(`environment ${o} \u2014 ${a.path}: ${a.message}`);for(let a of s)u.warn(`environment ${o} \u2014 ${a.path}: ${a.message}`);let l=r;if(!l||typeof l!="object"||l.name!==o){u.warn(`Skipping environment ${n}: name field "${l?.name}" \u2260 filename`);continue}for(let a of["profile",...k])delete l[a];e[o]=l}return e}function pt(t=R){try{v=Bt(t)}catch(e){u.error(`Failed to load environments from ${t}: ${e.message}`),v={}}return lt=!0,at+=1,u.info(`Loaded ${Object.keys(v).length} environments`),v}function ct(){lt||pt()}function mt(t){ct();let e=v[t];if(!e)return null;let n=structuredClone(e);n.directive=N("directive",n.directive),n.systemPrompt=N("systemPrompt",n.systemPrompt),n.promptTemplate=N("promptTemplate",n.promptTemplate);let o=Z(n);return o&&(n.pluginDirs=o),n}function De(){return ct(),Object.keys(v).sort().map(t=>v[t])}function be(t,e){if(!M(t))return u.warn(`Cannot read default environments from ${t}`),!1;let n=!1;for(let o of L(t)){if(!o.endsWith(".json"))continue;let r=D.join(e,o);if(!M(r))try{Lt(e,{recursive:!0}),Ct(r,st(D.join(t,o),"utf8"),"utf8"),u.info(`Added environment from defaults: ${o}`),n=!0}catch(i){u.error(`Failed to copy default environment ${o}: ${i.message}`)}}return n}var it=null,j=null;function Ut(t){try{return L(t).filter(e=>e.endsWith(".json")).sort().map(e=>{let n=Vt(D.join(t,e));return`${e}:${n.size}:${n.mtimeMs}:${n.ctimeMs}:${n.ino}`}).join("|")}catch{return"missing"}}function Ht(t){j&&clearTimeout(j),j=setTimeout(()=>{j=null,u.info("Detected change in environments, reloading..."),pt(t)},300)}function Te(t=R){it?.close(),it=X({label:"environments",snapshot:()=>Ut(t),onChange:()=>Ht(t),startWatching:e=>[Wt(t,()=>e())],warn:e=>u.error(e)})}var zt="__active__";function Kt(t,e){return t===zt?G(e)||Q:t}function Jt(t){return{directive:t.directive,systemPrompt:t.systemPrompt,promptTemplate:t.promptTemplate,claudeAgent:t.claudeAgent,outputStyle:t.outputStyle,tools:t.tools,pluginDirs:t.pluginDirs,mcpComposition:t.mcpComposition,mcpToolAllowlist:t.mcpToolAllowlist?Y(t.mcpToolAllowlist):void 0,loadRules:t.loadRules,disableHooks:t.disableHooks,skills:t.skills,settingSources:t.settingSources,projectContext:t.projectContext}}function Ie(t,e){let n=mt(Kt(t,e));return n?Jt(n):null}import{createHash as Xt}from"node:crypto";import{existsSync as $,mkdirSync as Yt,readdirSync as Gt,readFileSync as ut,rmSync as Zt}from"node:fs";import*as _ from"node:path";var qt=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;function m(t,e,n){return Object.assign(new Error(e),{code:t,...n?{issues:n}:{}})}function V(t){return Xt("sha256").update(t,"utf8").digest("hex")}function W(t){if(typeof t!="string"||!qt.test(t))throw m("invalid-args",c("ux.tpl.invalidName",{name:String(t)}))}function C(t,e){return _.join(t,`${e}.json`)}function ft(t){return $(t)?Gt(t).filter(e=>e.endsWith(".json")).map(e=>e.slice(0,-5)).sort():[]}function B(t,e){W(e);let n=C(t,e);if(!$(n))throw m("not-found",c("ux.tpl.unknownEntity",{name:e}));let o=ut(n,"utf8"),r=null;try{let i=JSON.parse(o);i&&typeof i=="object"&&!Array.isArray(i)&&(r=i)}catch{r=null}return{name:e,filePath:n,body:r,content:o,sha256:V(o)}}function U(t,e,n){let{name:o,body:r,baseHash:i}=e;if(W(o),!r||typeof r!="object"||Array.isArray(r))throw m("invalid-args",c("ux.tpl.bodyNotObject"));let s=C(t,o),l=$(s),a=l?ut(s,"utf8"):null;if(i===null&&l)throw m("invalid-args",c("ux.tpl.alreadyExists",{name:o}));if(i!==null&&!l)throw m("not-found",c("ux.tpl.unknownEntity",{name:o}));if(i!==null&&a!==null&&V(a)!==i)throw m("conflict",c("ux.tpl.changedOnDisk",{name:o}));let{errors:h,warnings:b}=P(o,r,n);if(h.length>0)throw m("invalid-args",c("ux.tpl.notValid",{name:o,issues:h.map(z=>`${z.path}: ${z.message}`).join("; ")}),h);let E=`${JSON.stringify(r,null,2)}
|
|
7
|
+
`,H=a!==E;return H&&(Yt(_.dirname(s),{recursive:!0}),T(s,E)),{changed:H,filePath:s,warnings:b,sha256:V(E)}}function Ve(t,e){W(e);let n=C(t,e);if(!$(n))throw m("not-found",c("ux.tpl.unknownEntity",{name:e}));return Zt(n,{force:!0}),{removed:!0,filePath:n}}import{existsSync as dt,readFileSync as Qt,rmSync as te}from"node:fs";import*as d from"node:path";var ht=w.systemPrompt;function yt(t=R){return{envDir:t,promptDir:d.join(x,ht),defaultPromptDir:d.join(y,"prompts",ht)}}function xt(t){return typeof t!="string"||!t.startsWith(f)?null:t.slice(f.length)||null}function I(t){return dt(t)?Qt(t,"utf8"):null}function A(t,e){let n=d.resolve(t,e),o=d.relative(t,n);return o&&!o.startsWith("..")&&!d.isAbsolute(o)?n:null}function vt(t,e,n){let o=`${f}${e}`;return ft(t).filter(r=>{if(r===n)return!1;try{return B(t,r).body?.systemPrompt===o}catch{return!1}})}function Xe(t,e,n=yt()){let o=e?.systemPrompt,r=xt(o);if(r){let s=A(n.promptDir,r),l=A(n.defaultPromptDir,r),a=l?I(l):null;return{kind:"file",file:r,text:(s&&I(s))??a??"",sharedWith:vt(n.envDir,r,t),defaultText:a}}let i=typeof o=="string"&&o.length>0;return{kind:i?"inline":"none",file:null,text:i?o:"",sharedWith:[],defaultText:null}}function gt(t,e,n){let o=A(t.promptDir,e);if(!o)throw m("invalid-args",c("ux.env.promptFileOutside",{file:e}));let r=A(t.defaultPromptDir,e);return r&&I(r)===n?dt(o)?(te(o),!0):!1:I(o)===n?!1:(T(o,n),!0)}function Ye(t,e,n=yt(),o){let r=B(n.envDir,t);if(!r.body)throw m("invalid-args",c("ux.tpl.bodyNotObject"));let i=xt(r.body.systemPrompt);if(i)return{changed:gt(n,i,e),file:i};if(e.trim()===""){let h={...r.body};return delete h.systemPrompt,{changed:U(n.envDir,{name:t,body:h,baseHash:r.sha256},o).changed,file:null}}let s=`${t}.md`,l=vt(n.envDir,s,t);if(l.length>0)throw m("conflict",c("ux.env.promptFileInUse",{file:s,envs:l.join(", ")}));gt(n,s,e);let a={...r.body,systemPrompt:`${f}${s}`};return U(n.envDir,{name:t,body:a,baseHash:r.sha256},o),{changed:!0,file:s}}export{q as a,R as b,ne as c,Q as d,ot as e,P as f,we as g,pt as h,mt as i,De as j,be as k,Te as l,Ie as m,ft as n,B as o,U as p,Ve as q,yt as r,Xe as s,Ye as t};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
var a=(1n<<41n)-1n,s=-1,e;function c(f){let r=f??Date.now();if(!Number.isInteger(r)||r<0||r>0xffffffffffff)throw new RangeError(`UUIDv7 timestamp must be an integer between 0 and ${0xffffffffffff}`);let o=f===void 0?Math.max(r,s):f;f===void 0&&(s=o);let n=new Uint8Array(16);if(globalThis.crypto.getRandomValues(n),e===void 0)e=BigInt(n[1])<<32n|BigInt(n[2])<<24n|BigInt(n[3])<<16n|BigInt(n[4])<<8n|BigInt(n[5]);else{if(e===a)throw new RangeError("UUIDv7 generator sequence exhausted");e++}let u=BigInt(o);for(let t=5;t>=0;t--)n[t]=Number(u>>BigInt((5-t)*8))&255;n[6]=112|Number(e>>37n&0x0fn),n[7]=Number(e>>29n&0xffn),n[8]=128|Number(e>>23n&0x3fn),n[9]=Number(e>>15n&0xffn),n[10]=Number(e>>7n&0xffn),n[11]=Number((e&0x7fn)<<1n)|n[11]&1;let i=Array.from(n,t=>t.toString(16).padStart(2,"0"));return`${i.slice(0,4).join("")}-${i.slice(4,6).join("")}-${i.slice(6,8).join("")}-${i.slice(8,10).join("")}-${i.slice(10).join("")}`}export{c as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
2
|
const require = __cortexCreateRequire(import.meta.url);
|
|
3
3
|
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
-
import{a,
|
|
4
|
+
import{a,c as u}from"./chunk-ZNAMETPQ.js";import*as n from"fs";import*as s from"path";function f(t){return!!(s.isAbsolute(t)||/^[A-Za-z]:[/\\]/.test(t))}function w(t,r){return t&&(t.startsWith(r)?t.slice(r.length):t)}var m=10*6e4;async function c(t,r,e){if(!f(e))throw new Error("file_path must be absolute when `device` is set");let{body:o}=await a("POST",`${t.webhookBaseUrl}/webhook/remote-fetch`,{device:r,filePath:e},u(t),m);if(!o.success)throw new Error(o.error||`Failed to fetch ${e} from ${r}`);return o.data}async function l(t,r,e,o){let i=await c(t,r,e);try{return await o(i)}finally{await n.promises.rm(s.dirname(i.localPath),{recursive:!0,force:!0}).catch(()=>{})}}export{f as a,w as b,l as c};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
2
|
const require = __cortexCreateRequire(import.meta.url);
|
|
3
3
|
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
-
import{a as i}from"./chunk-LCKVYFMD.js";import{e as t}from"./chunk-
|
|
4
|
+
import{a as i}from"./chunk-LCKVYFMD.js";import{e as t}from"./chunk-7GGPYU5E.js";function f(e){return e==="warn"?"warning":e==="info"||e==="warning"||e==="error"?e:null}var u={info:i.info,warning:i.warning,error:i.error};function d(e){return e?u[e]:""}function h(e){let o=[],s=d(e.level);s&&o.push({type:"context",text:`${s} ${e.level}`});let r=e.answers.size===e.questions.length;for(let[l,a]of e.questions.entries()){l>0&&o.push({type:"divider"}),o.push({type:"section",text:`*${a.header}*
|
|
5
5
|
${a.question}`});let n=e.answers.get(a.pendingId);if(n){let c=Array.isArray(n.value)?`[${n.value.join(", ")}]`:n.value;o.push({type:"context",text:`${i.ok} ${c}`})}else{let c=a.options.map(p=>p.label).join(" \xB7 ");o.push({type:"context",text:`_${c}_`})}}return r||o.push({type:"actions",elements:[{type:"button",text:t("modal.answer",{answered:e.answers.size,total:e.questions.length}),actionId:"ask_user_question_open_modal",value:e.groupId,style:"primary"}]}),o}function _(e){let o=[];for(let[r,l]of e.questions.entries()){let a=`*${l.header}*
|
|
6
6
|
${l.question}`;if(l.options.some(n=>n.description))for(let n of l.options)n.description&&(a+=`
|
|
7
7
|
\u2022 *${n.label}*: ${n.description}`);o.push({type:"section",text:a}),l.options.length>0?(o.push({type:l.multiSelect?"multi_select":"select",blockId:`q_${r}`,label:l.multiSelect?t("modal.selectOneOrMore"):t("modal.selectOne"),actionId:"selection",placeholder:l.multiSelect?t("modal.selectOneOrMore"):t("modal.selectOne"),options:l.options.map((n,c)=>({label:n.label,value:String(c)})),optional:!0}),o.push({type:"text_input",blockId:`q_${r}_other`,label:t("modal.typeAnswerLabel"),actionId:"other_text",placeholder:t("modal.customAnswerPlaceholder"),optional:!0})):o.push({type:"text_input",blockId:`q_${r}_other`,label:t("modal.yourAnswerLabel"),actionId:"other_text",placeholder:t("modal.yourAnswerPlaceholder"),optional:!1})}let s=d(e.level);return{callbackId:"ask_user_question_modal_submit",title:s?`${s} ${t("modal.questionsTitle")}`:t("modal.questionsTitle"),submitLabel:t("modal.submit"),closeLabel:t("modal.cancel"),privateMetadata:JSON.stringify({groupId:e.groupId}),fields:o}}function x(e){return{richBlocks:[{type:"section",text:`${i.memo} ${t("modal.planReady")}`}],actions:[{type:"button",text:t("modal.approve"),actionId:"hook_plan_approve",value:e,style:"primary"},{type:"button",text:t("modal.provideFeedback"),actionId:"hook_plan_feedback",value:e}]}}function y(e){return{callbackId:"hook_plan_feedback_submit",title:t("modal.planFeedbackTitle"),submitLabel:t("modal.submit"),closeLabel:t("modal.cancel"),privateMetadata:JSON.stringify({requestId:e}),fields:[{type:"text_input",blockId:"feedback",label:t("modal.feedbackLabel"),actionId:"text",multiline:!0,placeholder:t("modal.feedbackPlaceholder")}]}}export{f as a,d as b,h as c,_ as d,x as e,y as f};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{e as c}from"./chunk-BKYP6AGM.js";import{e as a}from"./chunk-TRXLIL7V.js";import{a as S,k as l}from"./chunk-T54CZKNJ.js";import{e as g}from"./chunk-WHC7AYZD.js";var u=g(S(),1),E=new Set(["CLAUDE_CODE_OAUTH_TOKEN_EXPIRES_AT"]);function O(n,t=process.env){let e={};u.config({path:n,processEnv:e});for(let r of E)delete e[r];u.populate(t,e)}var x="CORTEX_CHILD_EXIT";function I(n){return JSON.stringify(n)}function y(n){if(!n)return null;try{let t=JSON.parse(n);if(typeof t.uptimeMs!="number"||typeof t.backoffMs!="number")return null;let e=Number.isInteger(t.code)?t.code:null,r=typeof t.signal=="string"?t.signal.slice(0,20):null;return{code:e,signal:r,uptimeMs:Math.max(0,t.uptimeMs),backoffMs:Math.max(0,Math.round(t.backoffMs))}}catch{return null}}function M(n=process.env){let t=y(n[x]);!t||t.code===0&&!t.signal||c({component:"server",kind:"childExit",errorName:"ChildExit",message:t.signal?`signal ${t.signal}`:`exit code ${t.code??"unknown"}`,stack:"",uptimeS:Math.round(t.uptimeMs/1e3),exit:{code:t.code,signal:t.signal,backoffMs:t.backoffMs}})}import{existsSync as b,readFileSync as h}from"node:fs";import*as d from"node:path";var p=d.join(l,"daemon-rebuild.json");function C(n){let t=(n.now??(()=>new Date))().toISOString();return{status:"running",reason:n.reason,current:null,steps:n.names.map(e=>({name:e,status:"pending",detail:null,startedAt:null,endedAt:null})),startedAt:t,updatedAt:t,endedAt:null,detail:null,daemonPid:n.daemonPid}}function f(n,t,e,r){return{...n,updatedAt:r,steps:n.steps.map(o=>o.name===t?{...o,...e}:o)}}function P(n,t,e=()=>new Date){let r=e().toISOString();return{...f(n,t,{status:"running",startedAt:r,endedAt:null},r),current:t}}function w(n,t,e,r=null,o=()=>new Date){let s=o().toISOString(),i=f(n,t,{status:e,detail:r,endedAt:s},s);return i.current!==t?i:{...i,current:i.steps.filter(m=>m.status==="running").at(-1)?.name??null}}function L(n,t,e=null,r=()=>new Date){let o=r().toISOString();return{...n,status:t,current:null,detail:e,updatedAt:o,endedAt:o,steps:n.steps.map(s=>s.status==="pending"?{...s,status:"skipped"}:s)}}function A(n){if(!n||typeof n!="object")return!1;let t=n;return typeof t.status=="string"&&typeof t.reason=="string"&&typeof t.startedAt=="string"&&Array.isArray(t.steps)}function T(n=p){try{if(!b(n))return null;let t=JSON.parse(h(n,"utf8"));return A(t)?t:null}catch{return null}}function F(n,t=p){try{return a(t,JSON.stringify(n,null,2)),!0}catch{return!1}}export{O as a,x as b,I as c,M as d,C as e,P as f,w as g,L as h,T as i,F as j};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{a as ge}from"./chunk-B3XBQEFM.js";import{e as me}from"./chunk-WHC7AYZD.js";var y={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603},g=class extends Error{code;data;constructor(e,t,s){super(t),this.name="McpError",this.code=e,this.data=s}},p=class extends Error{constructor(e="MCP connection closed"){super(e),this.name="McpConnectionClosedError"}},O=class extends Error{timeoutMs;constructor(e){super(`MCP request timed out after ${e}ms`),this.name="McpTimeoutError",this.timeoutMs=e}},x=class extends Error{constructor(e="MCP request aborted"){super(e),this.name="AbortError"}};function l(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function R(r){return r instanceof Error?r:new Error(String(r))}function v(r){return typeof r=="string"||typeof r=="number"&&Number.isFinite(r)}function b(r){return l(r)&&r.jsonrpc==="2.0"&&v(r.id)&&typeof r.method=="string"}function k(r){return l(r)&&r.jsonrpc==="2.0"&&!("id"in r)&&typeof r.method=="string"}function M(r){return!l(r)||r.jsonrpc!=="2.0"||!v(r.id)?!1:"result"in r?!("error"in r):!("error"in r)||!l(r.error)?!1:typeof r.error.code=="number"&&typeof r.error.message=="string"}function C(r){if(b(r)||k(r)||M(r))return r;throw new g(y.invalidRequest,"Invalid JSON-RPC message")}var D="2025-11-25",Y=[D,"2025-06-18","2025-03-26","2024-11-05"];var ye=3e4,W=1e3;function Ee(r){if(!l(r)||typeof r.protocolVersion!="string"||!l(r.capabilities)||!l(r.serverInfo)||typeof r.serverInfo.name!="string"||typeof r.serverInfo.version!="string"||r.instructions!==void 0&&typeof r.instructions!="string")throw new g(y.invalidRequest,"Invalid MCP initialize result");return r}function A(r){return new g(y.invalidRequest,r)}function we(r,e,t,s){let n=l(t)?t[e]:void 0;if(!l(t)||!Array.isArray(n))throw A(`Invalid MCP ${r} result`);for(let o of n)if(!l(o)||!s(o))throw A(`Invalid entry in MCP ${r} result`);let i=t.nextCursor===null||t.nextCursor===""?void 0:t.nextCursor;if(i!==void 0&&typeof i!="string")throw A(`Invalid MCP ${r} cursor`);return{items:n,...i===void 0?{}:{nextCursor:i}}}var Se=r=>typeof r.name=="string"&&l(r.inputSchema),K=r=>typeof r.uri=="string"&&(r.name===void 0||typeof r.name=="string"),Z=r=>typeof r.uriTemplate=="string"&&(r.name===void 0||typeof r.name=="string");function Q(r){return{...r,name:r.name??r.uri}}function ee(r){return{...r,name:r.name??r.uriTemplate}}function te(r){return r.nextCursor===void 0?{}:{nextCursor:r.nextCursor}}function xe(r){if(!l(r)||!Array.isArray(r.contents))throw A("Invalid MCP resources/read result");for(let e of r.contents)if(!l(e)||typeof e.uri!="string"||typeof e.text!="string"&&typeof e.blob!="string")throw A("Invalid contents in MCP resources/read result");return r}function Re(r){if(!l(r)||r.content!==void 0&&!Array.isArray(r.content))throw new g(y.invalidRequest,"Invalid MCP tools/call result");return r.content===void 0?{...r,content:[]}:r}var j=class{options;state="idle";transport;nextRequestId=1;serverInfoValue;serverCapabilitiesValue;instructionsValue;protocolVersionValue;pending=new Map;progressRequests=new Map;incoming=new Map;requestHandlers=new Map;notificationListeners=new Map;errorListeners=new Set;closeListeners=new Set;disposers=[];constructor(e){this.options=Object.freeze({...e}),this.requestHandlers.set("ping",()=>({}));let t=e.roots;t&&this.requestHandlers.set("roots/list",async()=>({roots:[...typeof t=="function"?await t():t]}))}get connectionState(){return this.state}get serverInfo(){return this.serverInfoValue}get serverCapabilities(){return this.serverCapabilitiesValue}get instructions(){return this.instructionsValue}get protocolVersion(){return this.protocolVersionValue}async connect(e){if(this.state!=="idle")throw new Error(`Cannot connect MCP client in ${this.state} state`);this.state="connecting",this.transport=e,this.disposers=[e.onMessage(t=>this.handleMessage(t)),e.onError(t=>this.emitError(t)),e.onClose(()=>this.handleTransportClose())];try{await e.start();let t={...this.options.capabilities};this.options.roots&&t.roots===void 0&&(t.roots={});let s=Ee(await this.requestInternal("initialize",{protocolVersion:this.options.protocolVersion??D,capabilities:t,clientInfo:{name:this.options.name,version:this.options.version,...this.options.title===void 0?{}:{title:this.options.title}}},{},!0));if(!Y.includes(s.protocolVersion))throw new Error(`MCP server selected unsupported protocol version ${s.protocolVersion}`);return this.protocolVersionValue=s.protocolVersion,this.serverInfoValue=s.serverInfo,this.serverCapabilitiesValue=s.capabilities,this.instructionsValue=s.instructions,e.setProtocolVersion?.(s.protocolVersion),await this.notifyInternal("notifications/initialized",void 0,!0),this.state="connected",s}catch(t){throw await this.close().catch(()=>{}),t}}request(e,t,s={}){return this.requestInternal(e,t,s,!1)}notify(e,t){return this.notifyInternal(e,t,!1)}setRequestHandler(e,t){return this.requestHandlers.set(e,t),()=>{this.requestHandlers.get(e)===t&&this.requestHandlers.delete(e)}}onNotification(e,t){let s=this.notificationListeners.get(e)??new Set;return this.notificationListeners.set(e,s),s.add(t),()=>{s.delete(t),s.size===0&&this.notificationListeners.delete(e)}}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}onClose(e){return this.closeListeners.add(e),()=>this.closeListeners.delete(e)}async ping(e={}){await this.request("ping",void 0,e)}async listTools(e={}){return await this.listAll("tools/list","tools",Se,e)}async listResources(e={}){return(await this.listAll("resources/list","resources",K,e)).map(Q)}async listResourcesPage(e,t={}){let s=await this.listPage("resources/list","resources",K,e,t);return{resources:s.items.map(Q),...te(s)}}async listResourceTemplates(e={}){return(await this.listAll("resources/templates/list","resourceTemplates",Z,e)).map(ee)}async listResourceTemplatesPage(e,t={}){let s=await this.listPage("resources/templates/list","resourceTemplates",Z,e,t);return{resourceTemplates:s.items.map(ee),...te(s)}}async readResource(e,t={}){return xe(await this.request("resources/read",{uri:e},t))}async listPage(e,t,s,n,i){return we(e,t,await this.request(e,n===void 0?void 0:{cursor:n},i),s)}async listAll(e,t,s,n){let i=[],o=new Set,a;for(let c=0;c<W;c++){let d=await this.listPage(e,t,s,a,n);if(i.push(...d.items),d.nextCursor===void 0)return i;if(o.has(d.nextCursor))throw new Error(`MCP ${e} returned duplicate cursor: ${d.nextCursor}`);o.add(d.nextCursor),a=d.nextCursor}throw new Error(`MCP ${e} exceeded ${W} pages`)}async callTool(e,t,s={}){return Re(await this.request("tools/call",{name:e,...t===void 0?{}:{arguments:t}},s))}async close(){let e=this.transport;this.transport=void 0,this.disposeTransportListeners(),this.markClosed(new p),await e?.close()}async requestInternal(e,t,s,n){let i=this.requireTransport(n);if(s.signal?.aborted)throw new x;let o=this.nextRequestId++,a=s.onProgress?o:void 0,c=a===void 0?t:{...t,_meta:{...l(t?._meta)?t._meta:{},progressToken:a}},d={jsonrpc:"2.0",id:o,method:e,...c===void 0?{}:{params:c}};return new Promise((m,I)=>{let S={resolve:m,reject:I,timeoutMs:s.timeoutMs??this.options.requestTimeoutMs??ye,timer:void 0,signal:s.signal,onAbort:()=>this.cancelPending(o,new x,e!=="initialize",String(s.signal?.reason??"Aborted")),sendController:new AbortController,cancellable:e!=="initialize",onProgress:s.onProgress,progressToken:a};this.pending.set(o,S),a!==void 0&&this.progressRequests.set(a,o),s.signal?.addEventListener("abort",S.onAbort,{once:!0}),this.armTimeout(o,S),i.send(d,{signal:S.sendController.signal}).catch($=>this.cancelPending(o,$,!1))})}async notifyInternal(e,t,s){await this.requireTransport(s).send({jsonrpc:"2.0",method:e,...t===void 0?{}:{params:t}})}requireTransport(e){if(this.transport&&(this.state==="connected"||e&&this.state==="connecting"))return this.transport;throw new p(`MCP client is ${this.state}`)}handleMessage(e){if(M(e)){this.handleResponse(e);return}if(b(e)){this.handleRequest(e);return}if(k(e)){this.handleNotification(e.method,e.params);return}this.emitError(new g(y.invalidRequest,"Received invalid JSON-RPC message"))}handleResponse(e){let t=this.pending.get(e.id);if(!t){this.emitError(new Error(`Received response for unknown MCP request ${String(e.id)}`));return}this.removePending(e.id,t),"error"in e?t.reject(new g(e.error.code,e.error.message,e.error.data)):t.resolve(e.result)}async handleRequest(e){let t=this.transport;if(!t)return;let s=this.requestHandlers.get(e.method);if(!s){await t.send({jsonrpc:"2.0",id:e.id,error:{code:y.methodNotFound,message:`Method not found: ${e.method}`}}).catch(i=>this.emitError(i));return}let n=new AbortController;this.incoming.set(e.id,n);try{let i=await s(e.params,{signal:n.signal});await t.send({jsonrpc:"2.0",id:e.id,result:i??{}})}catch(i){let o=i instanceof g?{code:i.code,message:i.message,data:i.data}:{code:y.internalError,message:R(i).message};await t.send({jsonrpc:"2.0",id:e.id,error:o}).catch(a=>this.emitError(a))}finally{this.incoming.delete(e.id)}}handleNotification(e,t){e==="notifications/progress"?this.handleProgress(t):e==="notifications/cancelled"&&this.handleCancelled(t);for(let s of this.notificationListeners.get(e)??[])try{s(t)}catch(n){this.emitError(n)}}handleProgress(e){if(!l(e)||!v(e.progressToken)||typeof e.progress!="number")return;let t=this.progressRequests.get(e.progressToken),s=t===void 0?void 0:this.pending.get(t);if(!(t===void 0||!s)){this.armTimeout(t,s);try{s.onProgress?.(e)}catch(n){this.emitError(n)}}}handleCancelled(e){l(e)&&v(e.requestId)&&this.incoming.get(e.requestId)?.abort(e.reason)}armTimeout(e,t){t.timer&&clearTimeout(t.timer),!(!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)&&(t.timer=setTimeout(()=>{this.cancelPending(e,new O(t.timeoutMs),t.cancellable,"Request timed out")},t.timeoutMs))}cancelPending(e,t,s,n){let i=this.pending.get(e);i&&(this.removePending(e,i),i.reject(t),s&&this.transport&&this.transport.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:e,...n?{reason:n}:{}}}).catch(o=>this.emitError(o)))}removePending(e,t){this.pending.delete(e),t.timer&&clearTimeout(t.timer),t.progressToken!==void 0&&this.progressRequests.delete(t.progressToken),t.signal?.removeEventListener("abort",t.onAbort),t.sendController.abort()}rejectPending(e){for(let[t,s]of this.pending)this.removePending(t,s),s.reject(e)}handleTransportClose(){this.markClosed(new p)}markClosed(e){let t=this.state==="closed";this.state="closed",this.rejectPending(e);for(let s of this.incoming.values())s.abort(e);if(this.incoming.clear(),!t)for(let s of[...this.closeListeners])try{s()}catch(n){this.emitError(n)}}emitError(e){let t=R(e);for(let s of this.errorListeners)s(t)}disposeTransportListeners(){for(let e of this.disposers.splice(0))e()}};import{createHash as be}from"node:crypto";var re=64;function Me(r,e,t=()=>!1){let s=`mcp__${r}__${e}`.replace(/[^A-Za-z0-9_]/g,"_");if(s.length<=re&&!t(s))return s;let n=be("sha256").update(`${r}\0${e}`).digest("hex").slice(0,8);return`${s.slice(0,re-n.length-1)}_${n}`}function Ce(r){return`mcp__${r.replace(/-/g,"_")}`}function Te(r,e){return((r?.trim()||e?.trim()||"").split(`
|
|
5
|
+
`,1)[0]??"").trim()}var ne=me(ge(),1);import{spawn as _e}from"node:child_process";import _ from"node:process";var P=16*1024*1024,T=class{messageListeners=new Set;errorListeners=new Set;closeListeners=new Set;closeEmitted=!1;onMessage(e){return this.messageListeners.add(e),()=>this.messageListeners.delete(e)}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}onClose(e){return this.closeListeners.add(e),()=>this.closeListeners.delete(e)}emitMessage(e){for(let t of this.messageListeners)t(e)}emitError(e){let t=R(e);for(let s of this.errorListeners)s(t)}emitClose(){if(!this.closeEmitted){this.closeEmitted=!0;for(let e of this.closeListeners)e()}}};var Pe=64*1024,U=class{options;stdoutChunks=[];stdoutPendingBytes=0;stderrBuffer=Buffer.alloc(0);constructor(e){this.options=e}get stderr(){return this.stderrBuffer.toString("utf8")}readStdout(e){let t=Buffer.from(e.buffer,e.byteOffset,e.byteLength),s=this.options.maxMessageBytes??P,n=0;for(;;){let i=t.indexOf(10,n);if(i<0){n<t.length&&(this.stdoutChunks.push(Buffer.from(t.subarray(n))),this.stdoutPendingBytes+=t.length-n),this.stdoutPendingBytes>s&&(this.stdoutChunks=[],this.stdoutPendingBytes=0,this.options.onError(new Error(`MCP stdio message exceeds ${s} bytes`)));return}let o=t.subarray(n,i);if(this.stdoutChunks.length>0&&(this.stdoutChunks.push(o),o=Buffer.concat(this.stdoutChunks,this.stdoutPendingBytes+o.length),this.stdoutChunks=[],this.stdoutPendingBytes=0),n=i+1,o.length>s){this.options.onError(new Error(`MCP stdio message exceeds ${s} bytes`));continue}let a=o.toString("utf8").replace(/\r$/,"");if(a.trim())try{this.options.onMessage(C(JSON.parse(a)))}catch(c){this.options.onError(c)}}}readStderr(e){let t=this.options.maxStderrBytes??Pe;this.stderrBuffer=Buffer.concat([this.stderrBuffer,e]),this.stderrBuffer.length>t&&(this.stderrBuffer=this.stderrBuffer.subarray(-t)),this.options.onStderr?.(Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"))}end(){Buffer.concat(this.stdoutChunks).toString("utf8").trim()&&this.options.onError(new Error("MCP stdio server closed with an incomplete JSON-RPC message")),this.stdoutChunks=[],this.stdoutPendingBytes=0}};var Le=2e3,Oe=500,N=_.platform!=="win32",H=new Set,se=!1;function J(r,e){let t=r.pid;if(_.platform==="win32"&&t!==void 0){if(r.exitCode!==null)return;_e("taskkill",["/pid",String(t),"/T","/F"],{stdio:"ignore",windowsHide:!0}).on("error",()=>{});return}if(N&&t!==void 0)try{_.kill(-t,e);return}catch{}try{r.kill(e)}catch{}}function ve(){se||(se=!0,_.once("exit",()=>{for(let r of H)try{_.kill(-r,"SIGTERM")}catch{}}))}var z=class extends T{options;child;lines;started=!1;closed=!1;constructor(e){super(),this.options=Object.freeze({...e,args:e.args?[...e.args]:void 0}),this.lines=new U({maxMessageBytes:this.options.maxMessageBytes,maxStderrBytes:this.options.maxStderrBytes,onStderr:this.options.onStderr,onMessage:t=>this.emitMessage(t),onError:t=>this.emitError(t)})}get pid(){return this.child?.pid}get stderr(){return this.lines.stderr}async start(){if(this.started)throw new Error("MCP stdio transport already started");if(this.closed)throw new p;this.started=!0;let e=this.options.inheritEnv===!1?{...this.options.env}:{..._.env,...this.options.env},t=(0,ne.default)(this.options.command,this.options.args??[],{cwd:this.options.cwd,env:e,stdio:["pipe","pipe",this.options.stderr==="inherit"?"inherit":"pipe"],windowsHide:!0,detached:N});this.child=t;let s=t.pid;N&&s!==void 0&&(ve(),H.add(s),t.once("close",()=>H.delete(s))),t.stdout?.on("data",n=>this.lines.readStdout(n)),t.stdout?.on("error",n=>this.emitError(n)),t.stdin?.on("error",n=>{this.closed||this.emitError(n)}),t.stderr?.on("data",n=>this.lines.readStderr(n)),t.stderr?.on("error",n=>this.emitError(n)),t.on("close",()=>{this.child=void 0,this.lines.end(),this.emitClose()}),await new Promise((n,i)=>{let o=()=>{t.off("error",a),n()},a=c=>{t.off("spawn",o),i(c)};t.once("spawn",o),t.once("error",a)}),t.on("error",n=>{this.closed||this.emitError(n)})}async send(e){let t=this.child?.stdin;if(!this.started||this.closed||!t?.writable)throw new p;let s=`${JSON.stringify(e)}
|
|
6
|
+
`;await new Promise((n,i)=>{t.write(s,o=>o?i(o):n())})}async close(){if(this.closed)return;this.closed=!0;let e=this.child;if(!e){this.emitClose();return}if(!N&&(e.exitCode!==null||e.signalCode!==null)){e.stdin?.end();return}let t=this.options.closeTimeoutMs??Le;await new Promise(s=>{let n=[];e.once("close",()=>{for(let o of n)clearTimeout(o);J(e,"SIGTERM"),s()});let i=Math.min(Oe,t);n.push(setTimeout(()=>J(e,"SIGTERM"),i)),n.push(setTimeout(()=>J(e,"SIGKILL"),i+t)),e.stdin?.end()})}};var Ae=8*1024,ie=500,Ie=1e3,$e=3e4,ke=5;async function Ue(r,e){let t=r.getReader(),s=new TextDecoder,n="",i,o,a=[],c=0,d=e.maxEventBytes??P,m=()=>{if(a.length===0){i=void 0,o=void 0;return}let u=a.join(`
|
|
7
|
+
`);e.onEvent({...i?{event:i}:{},data:u,...o?{id:o}:{}}),i=void 0,o=void 0,a=[],c=0},I=u=>{if(u===""){m();return}if(u.startsWith(":"))return;let h=u.indexOf(":"),E=h<0?u:u.slice(0,h),f=h<0?"":u.slice(h+1);if(f.startsWith(" ")&&(f=f.slice(1)),E==="data"){if(c+=Buffer.byteLength(f)+(a.length>0?1:0),c>d)throw new Error(`MCP SSE event exceeds ${d} bytes`);a.push(f)}else E==="event"?i=f:E==="id"&&!f.includes("\0")?(o=f,e.onId?.(f)):E==="retry"&&/^\d+$/.test(f)&&e.onRetry?.(Number(f))},S=!1,$=()=>{let u=0;for(let h=0;h<n.length;h++){let E=n[h];E!=="\r"&&E!==`
|
|
8
|
+
`||(I(n.slice(u,h)),E==="\r"&&(h+1<n.length?n[h+1]===`
|
|
9
|
+
`&&h++:S=!0),u=h+1)}n=n.slice(u)};try{for(;;){let{done:h,value:E}=await t.read();if(h)break;let f=s.decode(E,{stream:!0});if(S&&f.length>0&&(f.startsWith(`
|
|
10
|
+
`)&&(f=f.slice(1)),S=!1),n+=f,$(),Buffer.byteLength(n)>d)throw new Error(`MCP SSE event exceeds ${d} bytes`)}let u=s.decode();S&&u.startsWith(`
|
|
11
|
+
`)&&(u=u.slice(1)),n+=u,$(),n&&I(n),m()}catch(u){throw await t.cancel().catch(()=>{}),u}finally{t.releaseLock()}}var w=class extends Error{status;body;constructor(e,t,s=""){super(t),this.name="McpHttpError",this.status=e,this.body=s}},B=class extends w{wwwAuthenticate;constructor(e,t=""){super(401,"MCP server requires authentication",t),this.name="McpAuthRequiredError",this.wwwAuthenticate=e.headers.get("www-authenticate")}},q=class extends w{constructor(e=""){super(404,"MCP session expired",e),this.name="McpSessionExpiredError"}};function oe(r){return r.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()}function Ne(r){return r.status===401?!0:r.status!==403?!1:/(?:^|[\s,])error="?insufficient_scope"?/i.test(r.headers.get("www-authenticate")??"")}function Be(r){return r===408||r===429||r>=500}function L(r){return r.body?.cancel().catch(()=>{})??Promise.resolve()}async function ae(r,e){if(!r.body)return{text:"",truncated:!1};let t=r.body.getReader(),s=new TextDecoder,n="",i=e;try{for(;;){let{done:o,value:a}=await t.read();if(o)return{text:n+s.decode(),truncated:!1};if(a.byteLength>i)return await t.cancel().catch(()=>{}),{text:n+s.decode(a.subarray(0,i),{stream:!0}),truncated:!0};i-=a.byteLength,n+=s.decode(a,{stream:!0})}}finally{t.releaseLock()}}function qe(r,e){let t=e.trim(),s=t.length>ie?`${t.slice(0,ie-3)}...`:t;return`MCP HTTP request failed with status ${r}${s?`: ${s}`:""}`}var F=class extends T{url;options;fetch;controller=new AbortController;started=!1;closed=!1;sessionIdValue;protocolVersion;getStreamStarted=!1;lastToken;constructor(e){super(),this.options=Object.freeze({...e,headers:e.headers?{...e.headers}:void 0}),this.url=new URL(e.url);let t=e.fetch??globalThis.fetch;this.fetch=(s,n)=>t(s,n)}get sessionId(){return this.sessionIdValue}async start(){if(this.started)throw new Error("MCP Streamable HTTP transport already started");if(this.closed)throw new p;this.started=!0}setProtocolVersion(e){this.protocolVersion=e}async send(e,{signal:t}={}){if(!this.started||this.closed)throw new p;let s=await this.authorizedFetch("POST",{headers:{accept:"application/json, text/event-stream","content-type":"application/json"},body:JSON.stringify(e)},t);if(await this.checkResponse(s),this.captureSession(s),!b(e)){await L(s),"method"in e&&e.method==="notifications/initialized"&&this.startGetStream();return}if(s.status===202||s.status===204)throw new w(s.status,`MCP server accepted request ${e.method} without a response`);let n=oe(s);if(n==="application/json"){let i=this.options.maxMessageBytes??P,{text:o,truncated:a}=await ae(s,i);if(a)throw new Error(`MCP JSON response exceeds ${i} bytes`);let c=JSON.parse(o);for(let d of Array.isArray(c)?c:[c])this.emitMessage(C(d));return}if(n==="text/event-stream"&&s.body){this.consumeResponseStream(s.body,e.id);return}throw await L(s),new w(s.status,`Unsupported MCP response content type: ${n??"missing"}`)}async close(){if(!this.closed){if(this.closed=!0,this.controller.abort(),this.started&&this.sessionIdValue)try{let e=await this.fetch(this.url,{method:"DELETE",headers:this.buildHeaders({},this.lastToken),signal:AbortSignal.timeout(1e3)});await L(e)}catch{}this.emitClose()}}async authorizedFetch(e,t,s){let n=this.options.authProvider?.onUnauthorized?.bind(this.options.authProvider);for(let i=0;;i++){let{headers:o,token:a}=await this.headers(t.headers);if(s?.aborted)throw new x;let c=await this.fetch(this.url,{method:e,headers:o,body:t.body,signal:this.controller.signal});if(i>0||!n||!Ne(c))return c;try{await n({response:c,serverUrl:this.url,fetch:this.fetch,token:a})}finally{await L(c)}}}async headers(e={}){let t=await this.options.authProvider?.token();return this.lastToken=t,{headers:this.buildHeaders(e,t),...t?{token:t}:{}}}buildHeaders(e,t){let s=new Headers(this.options.headers);for(let[n,i]of Object.entries(e))s.set(n,i);return this.sessionIdValue&&s.set("Mcp-Session-Id",this.sessionIdValue),this.protocolVersion&&s.set("MCP-Protocol-Version",this.protocolVersion),t&&s.set("Authorization",`Bearer ${t}`),s}captureSession(e){let t=e.headers.get("mcp-session-id");t&&(this.sessionIdValue=t)}async checkResponse(e){if(e.ok)return;let t=(await ae(e,Ae).catch(()=>({text:""}))).text;throw e.status===401?new B(e,t):e.status===404&&this.sessionIdValue?new q(t):new w(e.status,qe(e.status,t),t)}async consumeSse(e,t,s){await Ue(e,{maxEventBytes:this.options.maxMessageBytes??P,onId:n=>{t.lastEventId=n},onRetry:n=>{t.retryMs=n},onEvent:n=>{if(t.received=!0,!n.data.trim()||n.event!==void 0&&n.event!=="message")return;let i;try{i=C(JSON.parse(n.data))}catch(o){this.emitError(o);return}s?.(i),this.emitMessage(i)}})}async consumeResponseStream(e,t){let s={lastEventId:void 0,retryMs:void 0,received:!1},n=!1,i=d=>{M(d)&&d.id===t&&(n=!0)},o=e,a;for(let d=0;;){if(o)try{await this.consumeSse(o,s,i),a=void 0}catch(m){a=m}if(n||this.closed)return;if(a!==void 0&&!this.isRetryable(a)||s.lastEventId===void 0||d>=this.maxRetries())break;if(s.received&&(d=0),s.received=!1,!await this.sleep(this.reconnectDelay(d++,s.retryMs)))return;try{o=await this.openSseStream(s.lastEventId)}catch(m){if(a=m,!this.isRetryable(m))break;o=void 0}}if(this.closed)return;let c=a===void 0?"stream ended without a response":R(a).message;this.emitMessage({jsonrpc:"2.0",id:t,error:{code:y.internalError,message:`MCP response stream failed: ${c}`}})}startGetStream(){this.options.openGetStream===!1||this.getStreamStarted||this.closed||(this.getStreamStarted=!0,this.runGetStream())}async runGetStream(){let e={lastEventId:void 0,retryMs:void 0,received:!1};for(let t=0;!this.closed;){try{let s=await this.openSseStream(e.lastEventId);if(!s)return;let n=Date.now();await this.consumeSse(s,e),(e.received||Date.now()-n>this.maxDelay())&&(t=0)}catch(s){if(this.closed)return;if(!this.isRetryable(s)){this.emitError(s);return}}if(e.received=!1,t>=this.maxRetries()){this.emitError(new Error("MCP server-to-client stream dropped and could not be reopened"));return}if(!await this.sleep(this.reconnectDelay(t++,e.retryMs)))return}}async openSseStream(e){let t=await this.authorizedFetch("GET",{headers:{accept:"text/event-stream",...e===void 0?{}:{"last-event-id":e}}});if(t.status===405){await L(t);return}await this.checkResponse(t),this.captureSession(t);let s=oe(t);if(s!=="text/event-stream"||!t.body)throw await L(t),new w(t.status,`Unsupported MCP GET response content type: ${s??"missing"}`);return t.body}isRetryable(e){if(e instanceof w)return Be(e.status);if(e instanceof TypeError)return!0;let t=e?.code;return typeof t=="string"&&(t.startsWith("E")||t.startsWith("UND_ERR"))}reconnectDelay(e,t){if(t!==void 0)return t;let s=this.options.reconnect?.initialDelayMs??Ie;return Math.min(s*2**e,this.maxDelay())}maxDelay(){return this.options.reconnect?.maxDelayMs??$e}maxRetries(){return this.options.reconnect?.maxRetries??ke}sleep(e){let t=this.controller.signal;return t.aborted?Promise.resolve(!1):new Promise(s=>{let n=()=>{clearTimeout(i),s(!1)},i=setTimeout(()=>{t.removeEventListener("abort",n),s(!0)},e);i.unref?.(),t.addEventListener("abort",n,{once:!0})})}};var Ve=/^[A-Za-z0-9_-]+$/;function G(r,e,t={}){let s=c=>({kind:"invalid",error:c});if(!Ve.test(r))return s(`invalid server name "${r}" (use letters, digits, "_" and "-")`);if(!X(e))return s(`server "${r}" must be an object`);let n=De(e);if(n)return s(`server "${r}": ${n}`);let{type:i,url:o,command:a}=e;if(i==="sse")return s(`server "${r}": legacy SSE transport is not supported; use the streamable HTTP URL`);if(typeof o=="string"&&(i===void 0||i==="http"||i==="streamable-http")){let c=je(e,o,t);return c?s(`server "${r}": ${c}`):{kind:"http",config:e}}if(typeof a=="string"&&(i===void 0||i==="stdio")){let c=Je(e);return c?s(`server "${r}": ${c}`):{kind:"stdio",config:e}}return s(`server "${r}" needs either "command" (stdio) or "url" (streamable HTTP)`)}function X(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function De(r){let{enabled:e,timeout:t,description:s}=r;if(e!==void 0&&typeof e!="boolean")return"enabled must be a boolean";if(s!==void 0&&typeof s!="string")return"description must be a string";if(t!==void 0&&(typeof t!="number"||!(t>0)))return"timeout must be a positive number of seconds"}function je(r,e,t){return!URL.canParse(e)||!/^https?:$/.test(new URL(e).protocol)?"url must be an http or https URL":r.headers!==void 0&&!ce(r.headers)?"headers must map names to strings":He(r.oauth,t)}function Je(r){let{args:e,env:t,cwd:s}=r;if(e!==void 0&&!(Array.isArray(e)&&e.every(n=>typeof n=="string")))return"args must be an array of strings";if(t!==void 0&&!ce(t))return"env must map names to strings";if(s!==void 0&&typeof s!="string")return"cwd must be a string"}function ce(r){return X(r)&&Object.values(r).every(e=>typeof e=="string")}var de=["localhost","127.0.0.1","[::1]"];function He(r,e){if(r===void 0)return;if(!X(r))return"oauth must be an object";if(r.clientId!==void 0&&typeof r.clientId!="string")return"oauth.clientId must be a string";if(r.clientSecret!==void 0&&typeof r.clientSecret!="string")return"oauth.clientSecret must be a string";let t=r.callbackPort;if(t!==void 0&&(typeof t!="number"||!Number.isInteger(t)||t<1||t>65535))return"oauth.callbackPort must be a port number";if(r.callbackUrl!==void 0){if(typeof r.callbackUrl!="string"||!ze(r.callbackUrl))return"oauth.callbackUrl must be an http URI on localhost, 127.0.0.1, or [::1] without query or fragment";let i=new URL(r.callbackUrl).port;if(i&&t!==void 0&&Number(i)!==t)return"oauth.callbackUrl and oauth.callbackPort name different ports"}if(r.scope!==void 0&&typeof r.scope!="string")return"oauth.scope must be a string";if(r.clientName!==void 0&&(typeof r.clientName!="string"||!r.clientName.trim()))return"oauth.clientName must be a non-empty string";let s=r.clientRegistration;if(s!==void 0&&s!=="auto"&&s!=="dcr"){if(s!=="cimd")return'oauth.clientRegistration must be "auto", "dcr", or "cimd"';if(r.clientId!==void 0||r.clientName!==void 0)return'oauth.clientRegistration "cimd" cannot be combined with oauth.clientId or oauth.clientName';if(!e.checkMetadataDocumentCallback)return'oauth.clientRegistration "cimd" is not supported: there are no Client ID Metadata Documents';let i=e.checkMetadataDocumentCallback(typeof r.callbackUrl=="string"?r.callbackUrl:void 0);if(i)return i}let n=r.authServerMetadataUrl;if(n!==void 0){let i=typeof n=="string"&&URL.canParse(n)?new URL(n):void 0;if(!i||!(i.protocol==="https:"||i.protocol==="http:"&&de.includes(i.hostname)))return"oauth.authServerMetadataUrl must be an https URL, or http on localhost, 127.0.0.1, or [::1]"}}function ze(r){if(!URL.canParse(r))return!1;let e=new URL(r);return e.protocol==="http:"&&de.includes(e.hostname)&&e.search===""&&e.hash===""}function Fe(r){return r.command===void 0&&r.url===void 0&&r.type===void 0}function Ge(r){return{...r,type:r.type??"object",...r.properties===void 0?{properties:{}}:{}}}async function Xe(r,e){let t=r.flatMap(c=>c.type==="text"?[c.text]:[]).join(`
|
|
12
|
+
`),s=Ye(t,20480);if(!s)return{content:r};let n,i="";if(e)try{n=await e(t,".txt"),i=`
|
|
13
|
+
|
|
14
|
+
[Full output: ${n} (read it with offset/limit)]`}catch(c){i=`
|
|
15
|
+
|
|
16
|
+
[Could not save the full output: ${c instanceof Error?c.message:String(c)}]`}return{content:[{type:"text",text:`Warning: truncated output (original token count: ${Math.ceil(s.totalBytes/4)})
|
|
17
|
+
Total output lines: ${s.totalLines}
|
|
18
|
+
|
|
19
|
+
${s.content}${i}`},...r.filter(c=>c.type==="image")],...n?{fullOutputPath:n}:{}}}function Ye(r,e){let t=Buffer.from(r,"utf-8");if(t.length<=e)return;let s=m=>m>=t.length||(t[m]&192)!==128,n=Math.floor(e/2);for(;n>0&&!s(n);)n--;let i=t.length-(e-Math.floor(e/2));for(;i<t.length&&!s(i);)i++;let o=t.subarray(0,n).toString("utf-8"),a=t.subarray(i).toString("utf-8"),c=Array.from(t.subarray(n,i).toString("utf-8")).length,d=r.split(`
|
|
20
|
+
`).length-(r.endsWith(`
|
|
21
|
+
`)?1:0);return{content:`${o}\u2026${c} chars truncated\u2026${a}`,totalBytes:t.length,totalLines:d}}function We(r){switch(r.type){case"text":return{type:"text",text:r.text};case"image":return{type:"image",data:r.data,mimeType:r.mimeType};case"audio":return{type:"text",text:`[audio ${r.mimeType} omitted]`};case"resource_link":return{type:"text",text:`${r.name}: ${r.uri}`};case"resource":{let e=r.resource;return"text"in e?{type:"text",text:e.text}:e.mimeType?.startsWith("image/")?{type:"image",data:e.blob,mimeType:e.mimeType}:{type:"text",text:`[binary resource ${e.uri} (${e.mimeType??"unknown type"}) omitted]`}}default:return{type:"text",text:`[unsupported MCP content ${r.type}]`}}}function Ke(r){let e=(r.content??[]).map(We);return e.length===0&&r.structuredContent!==void 0&&e.push({type:"text",text:JSON.stringify(r.structuredContent,null,2)}),e}function he(r){let e=r.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${e}$`)}function zt(r){let e=new Set(r.filter(s=>!s.includes("*"))),t=r.filter(s=>s.includes("*")).map(he);return s=>e.has(s)||t.some(n=>n.test(s))}var Ze="list_mcp_resources",Qe="list_mcp_resource_templates",et="read_mcp_resource",tt=new Set([Ze,Qe,et]);function Ft(r){return r.startsWith("mcp__")||tt.has(r)}var pe=["codemode","deferred","direct","hidden"],rt={"codemode-deferred":"codemode"};function st(r){if(r===void 0)return!0;let e=new URL(r);return e.hostname!=="[::1]"&&e.pathname==="/callback"}function V(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function ue(r){return typeof r=="string"&&pe.includes(r)}function le(r){return typeof r=="string"?rt[r]??r:r}function nt(r){let{exposure:e,toolExposure:t}=r,s={...r};return e!==void 0&&(s.exposure=le(e)),V(t)&&(s.toolExposure=Object.fromEntries(Object.entries(t).map(([n,i])=>[n,le(i)]))),s}function Gt(r,e){let t=r.toolExposure??{},s=t[e];if(s!==void 0)return s;for(let[n,i]of Object.entries(t))if(n.includes("*")&&he(n).test(e))return i;return r.exposure??"codemode"}function it(r){let{exposure:e,toolExposure:t}=r,s=pe.map(n=>`"${n}"`).join(", ");if(e!==void 0&&!ue(e))return`exposure must be one of ${s}`;if(t!==void 0){if(!V(t))return"toolExposure must map tool names to exposures";for(let[n,i]of Object.entries(t))if(!ue(i))return`toolExposure "${n}" must be one of ${s}`}}var ot=["localhost","127.0.0.1","[::1]"];function at(r,e){if(r===void 0)return;if(!V(r)||typeof r.provider!="string"||!r.provider)return"auth.provider must be a provider name";let t=new URL(e);if(t.protocol!=="https:"&&!ot.includes(t.hostname))return"auth requires an https URL, or http on localhost, 127.0.0.1, or [::1]"}function Xt(r,e){let t=G(r,V(e)?nt(e):e,{checkMetadataDocumentCallback:n=>st(n)?void 0:'oauth.clientRegistration "cimd" requires oauth.callbackUrl on localhost or 127.0.0.1 with path /callback'});if(t.kind==="invalid")return t.error;let s=it(t.config)??(t.kind==="http"?at(t.config.auth,t.config.url):void 0);return s?`server "${r}": ${s}`:t.config}var fe=class{servers=new Map;changeListener;register(e){this.servers.set(e.name,e),this.changeListener?.()}unregister(e,t){this.servers.get(e)?.extensionPath===t&&(this.servers.delete(e),this.changeListener?.())}get(e){return this.servers.get(e)}list(){return[...this.servers.values()].map(e=>({...e,config:structuredClone(e.config)}))}setChangeListener(e){this.changeListener=e}};export{y as a,g as b,l as c,D as d,j as e,Fe as f,Ge as g,Me as h,Ce as i,Te as j,Xe as k,Ke as l,z as m,w as n,B as o,q as p,F as q,zt as r,Ze as s,Qe as t,et as u,Ft as v,st as w,Gt as x,Xt as y,fe as z};
|