@mindistryx/pi-arabic-runtime 0.0.0-stage → 1.0.0-beta.2

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.
Files changed (451) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +26 -2
  3. package/THIRD-PARTY-NOTICES.md +17 -0
  4. package/arguments.mjs +20 -0
  5. package/extension/command.mjs +31 -0
  6. package/extension/extension.mjs +32 -0
  7. package/extension/mode.mjs +48 -0
  8. package/extension/reader.mjs +33 -0
  9. package/launcher.mjs +34 -0
  10. package/licenses/Apache-2.0.txt +201 -0
  11. package/licenses/Unicode-3.0.txt +39 -0
  12. package/licenses/_anthropic-ai_sdk-0.129.0-LICENSE +8 -0
  13. package/licenses/_aws-sdk_client-bedrock-runtime-3.1127.0-LICENSE +201 -0
  14. package/licenses/_aws-sdk_core-3.977.9-LICENSE +201 -0
  15. package/licenses/_aws-sdk_credential-provider-env-3.972.70-LICENSE +201 -0
  16. package/licenses/_aws-sdk_credential-provider-ini-3.973.15-LICENSE +201 -0
  17. package/licenses/_aws-sdk_credential-provider-node-3.972.82-LICENSE +201 -0
  18. package/licenses/_aws-sdk_credential-provider-process-3.972.70-LICENSE +201 -0
  19. package/licenses/_aws-sdk_credential-provider-sso-3.973.14-LICENSE +201 -0
  20. package/licenses/_aws-sdk_credential-provider-web-identity-3.972.76-LICENSE +201 -0
  21. package/licenses/_aws-sdk_eventstream-handler-node-3.972.34-LICENSE +201 -0
  22. package/licenses/_aws-sdk_middleware-eventstream-3.972.29-LICENSE +201 -0
  23. package/licenses/_aws-sdk_middleware-websocket-3.972.52-LICENSE +201 -0
  24. package/licenses/_aws-sdk_signature-v4-multi-region-3.996.46-LICENSE +201 -0
  25. package/licenses/_aws-sdk_token-providers-3.1116.0-LICENSE +201 -0
  26. package/licenses/_aws-sdk_token-providers-3.1127.0-LICENSE +201 -0
  27. package/licenses/_aws-sdk_types-3.974.5-LICENSE +201 -0
  28. package/licenses/_aws-sdk_xml-builder-3.972.40-LICENSE +201 -0
  29. package/licenses/_aws_lambda-invoke-store-0.3.0-LICENSE +175 -0
  30. package/licenses/_babel_runtime-7.29.10-LICENSE +22 -0
  31. package/licenses/_google_genai-3.6.1-LICENSE +202 -0
  32. package/licenses/_isaacs_nonrecursive-glob-match-1.1.0-LICENSE.md +55 -0
  33. package/licenses/_protobufjs_aspromise-1.1.2-LICENSE +26 -0
  34. package/licenses/_protobufjs_base64-1.1.2-LICENSE +26 -0
  35. package/licenses/_protobufjs_codegen-2.0.5-LICENSE +26 -0
  36. package/licenses/_protobufjs_eventemitter-1.1.1-LICENSE +26 -0
  37. package/licenses/_protobufjs_fetch-1.1.1-LICENSE +26 -0
  38. package/licenses/_protobufjs_float-1.0.2-LICENSE +26 -0
  39. package/licenses/_protobufjs_path-1.1.2-LICENSE +26 -0
  40. package/licenses/_protobufjs_pool-1.1.0-LICENSE +26 -0
  41. package/licenses/_protobufjs_utf8-1.1.1-LICENSE +26 -0
  42. package/licenses/_silvia-odwyer_photon-node-0.3.4-LICENSE.md +201 -0
  43. package/licenses/_smithy_core-3.33.3-LICENSE +201 -0
  44. package/licenses/_smithy_credential-provider-imds-4.5.2-LICENSE +201 -0
  45. package/licenses/_smithy_fetch-http-handler-5.8.0-LICENSE +201 -0
  46. package/licenses/_smithy_node-http-handler-4.12.1-LICENSE +201 -0
  47. package/licenses/_smithy_signature-v4-5.7.3-LICENSE +201 -0
  48. package/licenses/_smithy_types-4.18.0-LICENSE +201 -0
  49. package/licenses/_stablelib_base64-1.0.1-LICENSE +21 -0
  50. package/licenses/_types_node-22.19.19-LICENSE +21 -0
  51. package/licenses/_types_retry-0.12.0-LICENSE +21 -0
  52. package/licenses/agent-base-7.1.4-LICENSE +22 -0
  53. package/licenses/agent-base-9.0.0-LICENSE +22 -0
  54. package/licenses/balanced-match-4.0.4-LICENSE.md +23 -0
  55. package/licenses/base64-js-1.5.1-LICENSE +21 -0
  56. package/licenses/bidi-js-1.1.0-LICENSE.txt +22 -0
  57. package/licenses/bignumber.js-9.3.1-LICENCE.md +26 -0
  58. package/licenses/bowser-2.14.1-LICENSE +39 -0
  59. package/licenses/brace-expansion-5.0.12-LICENSE +23 -0
  60. package/licenses/buffer-equal-constant-time-1.0.1-LICENSE.txt +12 -0
  61. package/licenses/chalk-6.0.0-license +9 -0
  62. package/licenses/cross-spawn-7.1.2-LICENSE +21 -0
  63. package/licenses/data-uri-to-buffer-4.0.1-LICENSE.generated.txt +22 -0
  64. package/licenses/debug-4.4.3-LICENSE +20 -0
  65. package/licenses/dependency-index.json +994 -0
  66. package/licenses/diff-8.0.4-LICENSE +29 -0
  67. package/licenses/ecdsa-sig-formatter-1.0.11-LICENSE +201 -0
  68. package/licenses/extend-3.0.2-LICENSE +23 -0
  69. package/licenses/fast-sha256-1.3.0-LICENSE +24 -0
  70. package/licenses/fetch-blob-3.2.0-LICENSE +21 -0
  71. package/licenses/formdata-polyfill-4.0.10-LICENSE +21 -0
  72. package/licenses/gaxios-7.1.4-LICENSE +202 -0
  73. package/licenses/gcp-metadata-8.1.2-LICENSE +202 -0
  74. package/licenses/get-east-asian-width-1.6.0-license +9 -0
  75. package/licenses/google-auth-library-10.6.2-LICENSE +202 -0
  76. package/licenses/google-logging-utils-1.1.3-LICENSE +202 -0
  77. package/licenses/graceful-fs-4.2.11-LICENSE +15 -0
  78. package/licenses/highlight.js-10.7.3-LICENSE +29 -0
  79. package/licenses/hosted-git-info-9.0.3-LICENSE +13 -0
  80. package/licenses/http-proxy-agent-9.1.0-LICENSE +22 -0
  81. package/licenses/https-proxy-agent-7.0.6-LICENSE +22 -0
  82. package/licenses/https-proxy-agent-9.1.0-LICENSE +22 -0
  83. package/licenses/ignore-7.0.8-LICENSE-MIT +21 -0
  84. package/licenses/isexe-2.0.0-LICENSE +15 -0
  85. package/licenses/jiti-2.7.0-LICENSE +21 -0
  86. package/licenses/json-bigint-1.0.0-LICENSE +20 -0
  87. package/licenses/json-schema-to-ts-3.1.1-LICENSE +21 -0
  88. package/licenses/jwa-2.0.1-LICENSE +17 -0
  89. package/licenses/jws-4.0.1-LICENSE +17 -0
  90. package/licenses/long-5.3.2-LICENSE +202 -0
  91. package/licenses/lovely-mermaid-0.3.3-LICENSE +205 -0
  92. package/licenses/lru-cache-11.4.0-LICENSE.md +55 -0
  93. package/licenses/marked-18.0.11-LICENSE +44 -0
  94. package/licenses/marked-cjk-friendly-0.1.2-LICENSE +22 -0
  95. package/licenses/mcp/modelcontextprotocol-typescript-sdk.txt +21 -0
  96. package/licenses/minimatch-11.0.9-LICENSE.md +55 -0
  97. package/licenses/ms-2.1.3-license.md +21 -0
  98. package/licenses/node-domexception-1.0.0-LICENSE +21 -0
  99. package/licenses/node-fetch-3.3.2-LICENSE.md +22 -0
  100. package/licenses/openai-7.59.0-LICENSE +201 -0
  101. package/licenses/p-retry-4.6.2-license +9 -0
  102. package/licenses/partial-json-0.1.7-LICENSE +21 -0
  103. package/licenses/path-key-3.1.1-license +9 -0
  104. package/licenses/proper-lockfile-4.1.2-LICENSE +21 -0
  105. package/licenses/protobufjs-7.6.6-LICENSE +39 -0
  106. package/licenses/proxy-agent-negotiate-1.1.0-LICENSE.generated.txt +22 -0
  107. package/licenses/quickjs-wasi-3.6.2-LICENSE +21 -0
  108. package/licenses/require-from-string-2.0.2-license +21 -0
  109. package/licenses/retry-0.12.0-License +21 -0
  110. package/licenses/retry-0.13.1-License +21 -0
  111. package/licenses/safe-buffer-5.2.1-LICENSE +21 -0
  112. package/licenses/schema/typebox-LICENSE +23 -0
  113. package/licenses/semver-7.8.5-LICENSE +15 -0
  114. package/licenses/shebang-command-2.0.0-license +9 -0
  115. package/licenses/shebang-regex-3.0.0-license +9 -0
  116. package/licenses/signal-exit-3.0.7-LICENSE.txt +16 -0
  117. package/licenses/standardwebhooks-1.1.1-LICENSE.generated.txt +22 -0
  118. package/licenses/ts-algebra-2.0.0-LICENSE +21 -0
  119. package/licenses/tslib-2.8.1-LICENSE.txt +12 -0
  120. package/licenses/typebox-1.3.27-license +23 -0
  121. package/licenses/undici-8.12.4-LICENSE +21 -0
  122. package/licenses/undici-types-6.21.0-LICENSE +21 -0
  123. package/licenses/upstream-pi.MIT.txt +21 -0
  124. package/licenses/web-streams-polyfill-3.3.3-LICENSE +22 -0
  125. package/licenses/which-2.0.2-LICENSE +15 -0
  126. package/licenses/ws-8.23.1-LICENSE +20 -0
  127. package/licenses/yaml-2.9.0-LICENSE +13 -0
  128. package/package.json +46 -4
  129. package/pi/CHANGELOG.md +6869 -0
  130. package/pi/README.md +95 -0
  131. package/pi/dist/bundle/chunks/anthropic-messages-TZF4LOZ3.js +3 -0
  132. package/pi/dist/bundle/chunks/anthropic.js +75 -0
  133. package/pi/dist/bundle/chunks/azure-openai-responses-OPCDWPFL.js +2 -0
  134. package/pi/dist/bundle/chunks/bedrock-converse-stream.js +89 -0
  135. package/pi/dist/bundle/chunks/chunk-2BKJ4UF2.js +6 -0
  136. package/pi/dist/bundle/chunks/chunk-3TDGKLEK.js +4 -0
  137. package/pi/dist/bundle/chunks/chunk-4L3MQGA6.js +2 -0
  138. package/pi/dist/bundle/chunks/chunk-4MIF4MCH.js +2 -0
  139. package/pi/dist/bundle/chunks/chunk-4OXX5KPU.js +1237 -0
  140. package/pi/dist/bundle/chunks/chunk-5AGIVGSV.js +6 -0
  141. package/pi/dist/bundle/chunks/chunk-6F2YCHJI.js +55 -0
  142. package/pi/dist/bundle/chunks/chunk-6MVVCNIJ.js +2 -0
  143. package/pi/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
  144. package/pi/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
  145. package/pi/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
  146. package/pi/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
  147. package/pi/dist/bundle/chunks/chunk-BSRKXBKS.js +2 -0
  148. package/pi/dist/bundle/chunks/chunk-BXIXP3HJ.js +16 -0
  149. package/pi/dist/bundle/chunks/chunk-E3JXGAHC.js +2 -0
  150. package/pi/dist/bundle/chunks/chunk-EANOEWGP.js +2 -0
  151. package/pi/dist/bundle/chunks/chunk-FFMDRXC4.js +10 -0
  152. package/pi/dist/bundle/chunks/chunk-H5S7TE7A.js +20 -0
  153. package/pi/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
  154. package/pi/dist/bundle/chunks/chunk-IKKTFUAW.js +82 -0
  155. package/pi/dist/bundle/chunks/chunk-INODY4DR.js +2 -0
  156. package/pi/dist/bundle/chunks/chunk-JCDBIE47.js +131 -0
  157. package/pi/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
  158. package/pi/dist/bundle/chunks/chunk-KBNQNV33.js +8 -0
  159. package/pi/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  160. package/pi/dist/bundle/chunks/chunk-L6EYYEJG.js +2 -0
  161. package/pi/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
  162. package/pi/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
  163. package/pi/dist/bundle/chunks/chunk-LWG2CUTI.js +31 -0
  164. package/pi/dist/bundle/chunks/chunk-OVXT2WQH.js +2 -0
  165. package/pi/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
  166. package/pi/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  167. package/pi/dist/bundle/chunks/chunk-PHM5C7IG.js +9 -0
  168. package/pi/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  169. package/pi/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  170. package/pi/dist/bundle/chunks/chunk-QGY2QT6O.js +30 -0
  171. package/pi/dist/bundle/chunks/chunk-QLVTCW2U.js +2 -0
  172. package/pi/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
  173. package/pi/dist/bundle/chunks/chunk-SSLDNFEJ.js +2 -0
  174. package/pi/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
  175. package/pi/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
  176. package/pi/dist/bundle/chunks/chunk-WHLWHMLX.js +14 -0
  177. package/pi/dist/bundle/chunks/chunk-YMIUSQL3.js +44 -0
  178. package/pi/dist/bundle/chunks/chunk-ZFO73KYQ.js +2 -0
  179. package/pi/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
  180. package/pi/dist/bundle/chunks/cli-66VDVHXA.js +53 -0
  181. package/pi/dist/bundle/chunks/cloudflare-workers-ai-system-one-BCB6I5BD.js +2 -0
  182. package/pi/dist/bundle/chunks/codemode-worker.js +480 -0
  183. package/pi/dist/bundle/chunks/easter-egg-3d-2XVDERXF.js +2 -0
  184. package/pi/dist/bundle/chunks/execute-CLOD3DVG.js +507 -0
  185. package/pi/dist/bundle/chunks/github-copilot.js +2 -0
  186. package/pi/dist/bundle/chunks/google-generative-ai-YXFPI4IA.js +2 -0
  187. package/pi/dist/bundle/chunks/google-vertex-SI54R6EC.js +2 -0
  188. package/pi/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
  189. package/pi/dist/bundle/chunks/image-resize-worker.js +2 -0
  190. package/pi/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +21 -0
  191. package/pi/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +2 -0
  192. package/pi/dist/bundle/chunks/kimi-coding.js +2 -0
  193. package/pi/dist/bundle/chunks/lib-4AVRLBHM.js +9 -0
  194. package/pi/dist/bundle/chunks/llama-cpp-classify-PRGRPOMM.js +22 -0
  195. package/pi/dist/bundle/chunks/meta.js +2 -0
  196. package/pi/dist/bundle/chunks/mistral-conversations-D5VW6GSS.js +4 -0
  197. package/pi/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
  198. package/pi/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
  199. package/pi/dist/bundle/chunks/node-KCMANYC2.js +16 -0
  200. package/pi/dist/bundle/chunks/openai-chatgpt.js +75 -0
  201. package/pi/dist/bundle/chunks/openai-codex-responses-NM5HSETG.js +2 -0
  202. package/pi/dist/bundle/chunks/openai-codex.js +75 -0
  203. package/pi/dist/bundle/chunks/openai-completions-QZF567FN.js +7 -0
  204. package/pi/dist/bundle/chunks/openai-decisions-YJYDQHYN.js +5 -0
  205. package/pi/dist/bundle/chunks/openai-responses-AVMLOXIQ.js +4 -0
  206. package/pi/dist/bundle/chunks/openrouter-chat-images-3V4TR7TT.js +2 -0
  207. package/pi/dist/bundle/chunks/openrouter-images-UBTJFBR6.js +4 -0
  208. package/pi/dist/bundle/chunks/openrouter.js +75 -0
  209. package/pi/dist/bundle/chunks/pi-decision-XC3CEYXE.js +2 -0
  210. package/pi/dist/bundle/chunks/pi-image-GRYH565R.js +2 -0
  211. package/pi/dist/bundle/chunks/pi-messages-5Z2U3PEK.js +2 -0
  212. package/pi/dist/bundle/chunks/radius.js +75 -0
  213. package/pi/dist/bundle/chunks/runtime-PSL6AEOU.js +2 -0
  214. package/pi/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
  215. package/pi/dist/bundle/chunks/typesafe-system-one-3JC45JJT.js +2 -0
  216. package/pi/dist/bundle/chunks/virtual-modules-AG72WCIK.js +2 -0
  217. package/pi/dist/bundle/chunks/xai.js +2 -0
  218. package/pi/dist/bundle/cli-runtime.js +3 -0
  219. package/pi/dist/bundle/cli.js +5 -0
  220. package/pi/dist/bundle/index.js +2 -0
  221. package/pi/dist/bundle/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
  222. package/pi/dist/bundle/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
  223. package/pi/dist/bundle/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
  224. package/pi/dist/bundle/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
  225. package/pi/dist/bundle/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
  226. package/pi/dist/bundle/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
  227. package/pi/dist/bundle/rpc-entry.js +3 -0
  228. package/pi/dist/core/export-html/ansi-to-html.d.ts +27 -0
  229. package/pi/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  230. package/pi/dist/core/export-html/ansi-to-html.js +286 -0
  231. package/pi/dist/core/export-html/ansi-to-html.js.map +1 -0
  232. package/pi/dist/core/export-html/index.d.ts +37 -0
  233. package/pi/dist/core/export-html/index.d.ts.map +1 -0
  234. package/pi/dist/core/export-html/index.js +230 -0
  235. package/pi/dist/core/export-html/index.js.map +1 -0
  236. package/pi/dist/core/export-html/template.css +1085 -0
  237. package/pi/dist/core/export-html/template.html +56 -0
  238. package/pi/dist/core/export-html/template.js +2044 -0
  239. package/pi/dist/core/export-html/tool-renderer.d.ts +34 -0
  240. package/pi/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  241. package/pi/dist/core/export-html/tool-renderer.js +112 -0
  242. package/pi/dist/core/export-html/tool-renderer.js.map +1 -0
  243. package/pi/dist/core/export-html/vendor/highlight.min.js +1213 -0
  244. package/pi/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  245. package/pi/dist/core/export-html/vendor/marked.min.js +79 -0
  246. package/pi/dist/modes/interactive/assets/clankolas.png +0 -0
  247. package/pi/dist/modes/interactive/theme/dark.json +78 -0
  248. package/pi/dist/modes/interactive/theme/light.json +78 -0
  249. package/pi/dist/modes/interactive/theme/system-theme.d.ts +55 -0
  250. package/pi/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
  251. package/pi/dist/modes/interactive/theme/system-theme.js +546 -0
  252. package/pi/dist/modes/interactive/theme/system-theme.js.map +1 -0
  253. package/pi/dist/modes/interactive/theme/theme-controller.d.ts +81 -0
  254. package/pi/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  255. package/pi/dist/modes/interactive/theme/theme-controller.js +210 -0
  256. package/pi/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  257. package/pi/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
  258. package/pi/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  259. package/pi/dist/modes/interactive/theme/theme-schema.js +105 -0
  260. package/pi/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  261. package/pi/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
  262. package/pi/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
  263. package/pi/dist/modes/interactive/theme/theme-tokens.js +94 -0
  264. package/pi/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
  265. package/pi/dist/modes/interactive/theme/theme.d.ts +165 -0
  266. package/pi/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  267. package/pi/dist/modes/interactive/theme/theme.js +918 -0
  268. package/pi/dist/modes/interactive/theme/theme.js.map +1 -0
  269. package/pi/docs/cli-integration.md +106 -0
  270. package/pi/docs/cli.md +358 -0
  271. package/pi/docs/codemode.md +241 -0
  272. package/pi/docs/compaction.md +463 -0
  273. package/pi/docs/configuration.md +47 -0
  274. package/pi/docs/containerization.md +183 -0
  275. package/pi/docs/custom-provider.md +227 -0
  276. package/pi/docs/docs.json +224 -0
  277. package/pi/docs/environment-variables.md +104 -0
  278. package/pi/docs/extensions.md +3394 -0
  279. package/pi/docs/how-pi-works.md +49 -0
  280. package/pi/docs/images/doom-extension.png +0 -0
  281. package/pi/docs/images/exy.png +0 -0
  282. package/pi/docs/images/interactive-mode.png +0 -0
  283. package/pi/docs/images/tree-view.png +0 -0
  284. package/pi/docs/index.md +39 -0
  285. package/pi/docs/json.md +226 -0
  286. package/pi/docs/keybindings.md +195 -0
  287. package/pi/docs/llama-cpp.md +138 -0
  288. package/pi/docs/mcp.md +301 -0
  289. package/pi/docs/message-types.md +280 -0
  290. package/pi/docs/models-configuration.md +213 -0
  291. package/pi/docs/models.md +248 -0
  292. package/pi/docs/nvidia-rtx-llama-cpp.md +96 -0
  293. package/pi/docs/packages.md +153 -0
  294. package/pi/docs/prompt-templates.md +59 -0
  295. package/pi/docs/providers.md +251 -0
  296. package/pi/docs/quickstart.md +140 -0
  297. package/pi/docs/rpc-commands.md +860 -0
  298. package/pi/docs/rpc-extension-ui.md +200 -0
  299. package/pi/docs/rpc.md +195 -0
  300. package/pi/docs/sdk.md +147 -0
  301. package/pi/docs/security.md +99 -0
  302. package/pi/docs/session-format.md +293 -0
  303. package/pi/docs/sessions.md +82 -0
  304. package/pi/docs/settings.md +175 -0
  305. package/pi/docs/shell-aliases.md +93 -0
  306. package/pi/docs/skills.md +93 -0
  307. package/pi/docs/slash-commands.md +61 -0
  308. package/pi/docs/subscriptions.md +96 -0
  309. package/pi/docs/terminal-setup.md +298 -0
  310. package/pi/docs/termux.md +117 -0
  311. package/pi/docs/themes.md +138 -0
  312. package/pi/docs/tmux.md +61 -0
  313. package/pi/docs/tui.md +199 -0
  314. package/pi/docs/usage.md +94 -0
  315. package/pi/docs/virtual-models.md +114 -0
  316. package/pi/docs/windows.md +109 -0
  317. package/pi/examples/README.md +36 -0
  318. package/pi/examples/extensions/README.md +215 -0
  319. package/pi/examples/extensions/auto-commit-on-exit.ts +49 -0
  320. package/pi/examples/extensions/bash-spawn-hook.ts +30 -0
  321. package/pi/examples/extensions/bookmark.ts +50 -0
  322. package/pi/examples/extensions/border-status-editor.ts +150 -0
  323. package/pi/examples/extensions/built-in-tool-renderer.ts +225 -0
  324. package/pi/examples/extensions/claude-rules.ts +86 -0
  325. package/pi/examples/extensions/commands.ts +72 -0
  326. package/pi/examples/extensions/confirm-destructive.ts +59 -0
  327. package/pi/examples/extensions/custom-compaction.ts +117 -0
  328. package/pi/examples/extensions/custom-footer.ts +64 -0
  329. package/pi/examples/extensions/custom-header.ts +73 -0
  330. package/pi/examples/extensions/custom-provider-anthropic/index.ts +613 -0
  331. package/pi/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  332. package/pi/examples/extensions/custom-provider-anthropic/package.json +19 -0
  333. package/pi/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
  334. package/pi/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  335. package/pi/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  336. package/pi/examples/extensions/debug-provider.ts +90 -0
  337. package/pi/examples/extensions/dirty-repo-guard.ts +56 -0
  338. package/pi/examples/extensions/doom-overlay/README.md +46 -0
  339. package/pi/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  340. package/pi/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  341. package/pi/examples/extensions/doom-overlay/doom/build.sh +152 -0
  342. package/pi/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  343. package/pi/examples/extensions/doom-overlay/doom-component.ts +132 -0
  344. package/pi/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  345. package/pi/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  346. package/pi/examples/extensions/doom-overlay/index.ts +74 -0
  347. package/pi/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  348. package/pi/examples/extensions/dynamic-resources/SKILL.md +8 -0
  349. package/pi/examples/extensions/dynamic-resources/dynamic.json +81 -0
  350. package/pi/examples/extensions/dynamic-resources/dynamic.md +5 -0
  351. package/pi/examples/extensions/dynamic-resources/index.ts +15 -0
  352. package/pi/examples/extensions/dynamic-tools.ts +74 -0
  353. package/pi/examples/extensions/entry-renderer.ts +41 -0
  354. package/pi/examples/extensions/event-bus.ts +43 -0
  355. package/pi/examples/extensions/file-trigger.ts +41 -0
  356. package/pi/examples/extensions/git-checkpoint.ts +53 -0
  357. package/pi/examples/extensions/git-merge-and-resolve.ts +115 -0
  358. package/pi/examples/extensions/github-issue-autocomplete.ts +185 -0
  359. package/pi/examples/extensions/gondolin/index.ts +528 -0
  360. package/pi/examples/extensions/gondolin/package-lock.json +175 -0
  361. package/pi/examples/extensions/gondolin/package.json +19 -0
  362. package/pi/examples/extensions/handoff.ts +190 -0
  363. package/pi/examples/extensions/hello.ts +26 -0
  364. package/pi/examples/extensions/hidden-thinking-label.ts +53 -0
  365. package/pi/examples/extensions/inline-bash.ts +94 -0
  366. package/pi/examples/extensions/input-transform-streaming.ts +39 -0
  367. package/pi/examples/extensions/input-transform.ts +43 -0
  368. package/pi/examples/extensions/interactive-shell.ts +196 -0
  369. package/pi/examples/extensions/jev-router.ts +113 -0
  370. package/pi/examples/extensions/mac-system-theme.ts +47 -0
  371. package/pi/examples/extensions/message-renderer.ts +59 -0
  372. package/pi/examples/extensions/minimal-mode.ts +353 -0
  373. package/pi/examples/extensions/modal-editor.ts +85 -0
  374. package/pi/examples/extensions/model-status.ts +31 -0
  375. package/pi/examples/extensions/notify.ts +57 -0
  376. package/pi/examples/extensions/overlay-qa-tests.ts +1456 -0
  377. package/pi/examples/extensions/overlay-test.ts +165 -0
  378. package/pi/examples/extensions/permission-gate.ts +34 -0
  379. package/pi/examples/extensions/pirate.ts +47 -0
  380. package/pi/examples/extensions/plan-mode/README.md +66 -0
  381. package/pi/examples/extensions/plan-mode/index.ts +404 -0
  382. package/pi/examples/extensions/plan-mode/utils.ts +194 -0
  383. package/pi/examples/extensions/preset.ts +438 -0
  384. package/pi/examples/extensions/project-trust.ts +64 -0
  385. package/pi/examples/extensions/prompt-customizer.ts +49 -0
  386. package/pi/examples/extensions/protected-paths.ts +30 -0
  387. package/pi/examples/extensions/provider-payload.ts +18 -0
  388. package/pi/examples/extensions/qna.ts +118 -0
  389. package/pi/examples/extensions/question.ts +286 -0
  390. package/pi/examples/extensions/questionnaire.ts +448 -0
  391. package/pi/examples/extensions/rainbow-editor.ts +88 -0
  392. package/pi/examples/extensions/reload-runtime.ts +49 -0
  393. package/pi/examples/extensions/rpc-demo.ts +118 -0
  394. package/pi/examples/extensions/send-user-message.ts +97 -0
  395. package/pi/examples/extensions/session-name.ts +27 -0
  396. package/pi/examples/extensions/shutdown-command.ts +63 -0
  397. package/pi/examples/extensions/snake.ts +343 -0
  398. package/pi/examples/extensions/space-invaders.ts +560 -0
  399. package/pi/examples/extensions/ssh.ts +220 -0
  400. package/pi/examples/extensions/status-line.ts +32 -0
  401. package/pi/examples/extensions/structured-output.ts +65 -0
  402. package/pi/examples/extensions/subagent/README.md +180 -0
  403. package/pi/examples/extensions/subagent/agents/planner.md +37 -0
  404. package/pi/examples/extensions/subagent/agents/reviewer.md +35 -0
  405. package/pi/examples/extensions/subagent/agents/scout.md +50 -0
  406. package/pi/examples/extensions/subagent/agents/worker.md +24 -0
  407. package/pi/examples/extensions/subagent/agents.ts +157 -0
  408. package/pi/examples/extensions/subagent/index.ts +1258 -0
  409. package/pi/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  410. package/pi/examples/extensions/subagent/prompts/implement.md +10 -0
  411. package/pi/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  412. package/pi/examples/extensions/summarize.ts +199 -0
  413. package/pi/examples/extensions/system-prompt-header.ts +17 -0
  414. package/pi/examples/extensions/tic-tac-toe.ts +1008 -0
  415. package/pi/examples/extensions/timed-confirm.ts +70 -0
  416. package/pi/examples/extensions/titlebar-spinner.ts +58 -0
  417. package/pi/examples/extensions/todo.ts +304 -0
  418. package/pi/examples/extensions/tool-override.ts +144 -0
  419. package/pi/examples/extensions/tools.ts +148 -0
  420. package/pi/examples/extensions/trigger-compact.ts +50 -0
  421. package/pi/examples/extensions/truncated-tool.ts +195 -0
  422. package/pi/examples/extensions/widget-placement.ts +9 -0
  423. package/pi/examples/extensions/with-deps/index.ts +32 -0
  424. package/pi/examples/extensions/with-deps/package-lock.json +31 -0
  425. package/pi/examples/extensions/with-deps/package.json +22 -0
  426. package/pi/examples/extensions/working-indicator.ts +123 -0
  427. package/pi/examples/extensions/working-message-test.ts +25 -0
  428. package/pi/examples/rpc-client.ts +35 -0
  429. package/pi/examples/rpc-extension-ui.ts +662 -0
  430. package/pi/examples/sdk/01-minimal.ts +26 -0
  431. package/pi/examples/sdk/02-custom-model.ts +49 -0
  432. package/pi/examples/sdk/03-custom-prompt.ts +75 -0
  433. package/pi/examples/sdk/04-skills.ts +55 -0
  434. package/pi/examples/sdk/05-tools.ts +48 -0
  435. package/pi/examples/sdk/06-extensions.ts +99 -0
  436. package/pi/examples/sdk/07-context-files.ts +47 -0
  437. package/pi/examples/sdk/08-prompt-templates.ts +51 -0
  438. package/pi/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  439. package/pi/examples/sdk/10-settings.ts +53 -0
  440. package/pi/examples/sdk/11-sessions.ts +52 -0
  441. package/pi/examples/sdk/12-full-control.ts +74 -0
  442. package/pi/examples/sdk/13-session-runtime.ts +67 -0
  443. package/pi/examples/sdk/14-codemode-mcp.ts +61 -0
  444. package/pi/examples/sdk/README.md +141 -0
  445. package/pi/examples/tsconfig.json +208 -0
  446. package/pi/package.json +5 -0
  447. package/pi/schemas/keybindings.schema.json +393 -0
  448. package/pi/schemas/mcp.schema.json +306 -0
  449. package/pi/schemas/models.schema.json +1253 -0
  450. package/pi/schemas/settings.schema.json +820 -0
  451. package/pi/schemas/theme.schema.json +365 -0
@@ -0,0 +1,6 @@
1
+ /**
2
+ * marked-cjk-friendly v0.1.2
3
+ * Copyright (c) 2024 Tatsunori Uchino, and authors and contributors of original packages (MIT License)
4
+ * https://github.com/tats-u/markdown-cjk-friendly/tree/main/packages/marked-cjk-friendly
5
+ */
6
+ (function(){const d="\\u1100-\\u11ff\\u20a9\\u2329-\\u232a\\u2630-\\u2637\\u268a-\\u268f\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u2ff0-\\u303e\\u3041-\\u3096\\u3099-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u3190-\\u31e5\\u31ef-\\u321e\\u3220-\\u3247\\u3250-\\ua48c\\ua490-\\ua4c6\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufaff\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe66\\ufe68-\\ufe6b\\uff01-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\\uffe0-\\uffe6\\uffe8-\\uffee\\u{16fe0}-\\u{16fe4}\\u{16ff0}-\\u{16ff6}\\u{17000}-\\u{18cda}\\u{18cff}-\\u{18d20}\\u{18d80}-\\u{18df2}\\u{18e00}-\\u{19191}\\u{191a0}-\\u{191d2}\\u{1aff0}-\\u{1aff3}\\u{1aff5}-\\u{1affb}\\u{1affd}-\\u{1affe}\\u{1b000}-\\u{1b128}\\u{1b132}\\u{1b150}-\\u{1b152}\\u{1b155}\\u{1b164}-\\u{1b168}\\u{1b170}-\\u{1b2fb}\\u{1d300}-\\u{1d356}\\u{1d360}-\\u{1d376}\\u{1f1ae}\\u{1f200}\\u{1f202}\\u{1f210}-\\u{1f219}\\u{1f21b}-\\u{1f22e}\\u{1f230}-\\u{1f231}\\u{1f237}\\u{1f23b}\\u{1f240}-\\u{1f248}\\u{1f260}-\\u{1f265}\\u{1f7da}\\u{20000}-\\u{3fffd}",k=new RegExp(`[${d}]`,"u"),y=new RegExp(`^((?![*_])[\\s\\p{P}\\p{S}${d}])`,"u");function P(e,t,n){return new RegExp(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)${e}(\\*+)(?=[\\s]|$)|${n}(\\*+)(?!\\*)(?=${t}|$)|(?!\\*)${t}(\\*+)(?=${n})|[\\s](\\*+)(?!\\*)(?=${e})|(?!\\*)${e}(\\*+)(?!\\*)(?=${e})|${n}(\\*+)(?=${n})`,"gu")}function B(e,t,n){return new RegExp(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)${e}(_+)(?=[\\s]|$)|${n}(_+)(?!_)(?=${t}|$)|(?!_)${t}(_+)(?=${n})|[\\s](_+)(?!_)(?=${e})|(?!_)${e}(_+)(?!_)(?=${e})`,"gu")}function I(e,t,n){return new RegExp(`^[^~]+(?=[^~])|(?!~)${e}(~~?)(?=[\\s]|$)|${n}(~~?)(?!~)(?=${t}|$)|(?!~)${t}(~~?)(?=${n})|[\\s](~~?)(?!~)(?=${e})|(?!~)${e}(~~?)(?!~)(?=${e})|${n}(~~?)(?=${n})`,"gu")}const h=`[\\p{P}\\p{S}${d}]`,D=`[\\s\\p{P}\\p{S}${d}]`,p=`[^\\s\\p{P}\\p{S}${d}]`,G=`(?![*_])[\\p{P}\\p{S}${d}]`,N=`(?![*_])[\\s\\p{P}\\p{S}${d}]`,U=`(?:[^\\s\\p{P}\\p{S}${d}]|[*_])`,F=`(?!~)[\\p{P}\\p{S}${d}]`,O=`(?!~)[\\s\\p{P}\\p{S}${d}]`,z=`(?:[^\\s\\p{P}\\p{S}${d}]|~)`,J=P(h,D,p),K=P(F,O,z),M=B(h,D,p),S=I(G,N,U);function A(e,t,n){let f=y.test(e);if(!f&&e){const u=t.length-n.length;if(u>=1){let c=u-1,a=t.charCodeAt(c);if(a>=65024&&a<=65038&&c>=1&&(c--,a=t.charCodeAt(c)),(a&64512)===56320&&c>=1){const s=t.codePointAt(c-1);s!==void 0&&s>65535&&(s>=917760&&s<=917999?f=!0:f=k.test(String.fromCodePoint(s)))}else f=k.test(String.fromCharCode(a))}}return f}function R(e,t){if(!(e[1]||e[2]||e[3]||e[4]))return!1;const n=String.fromCodePoint(e[0].codePointAt(0)),f=e.index+e[0].length,u=f<t.length?String.fromCodePoint(t.codePointAt(f)):"";return k.test(n)||k.test(u)}function x(e){return e.length>=5}function W(e){return!!(e[1]||e[2]||e[3]||e[4])}function q(e){return x(e)?!!e[4]:!!e[3]}function v(e){return x(e)?e[1]||e[3]||"":e[1]||e[2]||""}function H(){return{tokenizer:{emStrong(e,t,n=""){const{rules:f}=this,u=f.inline.emStrongLDelim.exec(e);if(!u)return!1;const c=x(u);if(c&&!W(u))return;if(q(u)&&n.match(f.other.unicodeAlphaNumeric))return!1;const a=v(u),s=A(n,t,e);if(!a||!n||f.inline.punctuation.exec(n)||s||k.test(a)){const $=[...u[0]].length-1;let r,o,g=$,i=0;const b=c&&n===u[0][0],C=f.inline.emStrongRDelimAst.source.includes("(?!~)");let m;u[0][0]==="*"?m=C?K:J:m=M,m.lastIndex=0;const _=t.slice(-1*e.length+$);let l;for(;(l=m.exec(_))!=null;){if(r=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!r)continue;o=[...r].length;const L=R(l,_),Q=!!(l[3]||l[4]),E=!!(l[5]||l[6]);if(Q&&!L){g+=o;continue}if(E||L){if($%3&&!(($+o)%3)){i+=o;continue}if(b&&E)break}if(g-=o,g>0)continue;o=Math.min(o,o+g+i);const V=l[0].codePointAt(0)>65535?2:1,j=e.slice(0,$+l.index+V+o);if(Math.min($,o)%2){const T=j.slice(1,-1);return{type:"em",raw:j,text:T,tokens:this.lexer.inlineTokens(T)}}const w=j.slice(2,-2);return{type:"strong",raw:j,text:w,tokens:this.lexer.inlineTokens(w)}}}},del(e,t,n=""){const{rules:f}=this,u=f.inline.delLDelim.exec(e);if(!u)return!1;const c=u[1]||"",a=A(n,t,e);if(!c||!n||f.inline.punctuation.exec(n)||a||k.test(c)){const s=[...u[0]].length-1;let $,r,o=s;S.lastIndex=0;const g=t.slice(-1*e.length+s);let i;for(;(i=S.exec(g))!=null;){if($=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!$||(r=[...$].length,r!==s))continue;const b=R(i,g);if((i[3]||i[4])&&!b){o+=r;continue}if(o-=r,o>0)continue;r=Math.min(r,r+o);const C=i[0].codePointAt(0)>65535?2:1,m=e.slice(0,s+i.index+C+r),_=m.slice(s,-s);return{type:"del",raw:m,text:_,tokens:this.lexer.inlineTokens(_)}}}}}}}globalThis.markedCjkFriendly=H})();
@@ -0,0 +1,79 @@
1
+ /**
2
+ * marked v18.0.11 - a markdown parser
3
+ * Copyright (c) 2018-2026, MarkedJS. (MIT License)
4
+ * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
5
+ * https://github.com/markedjs/marked
6
+ */
7
+
8
+ /**
9
+ * DO NOT EDIT THIS FILE
10
+ * The code in this file is generated from files in ./src/
11
+ */
12
+ (function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f()}else if("function"==typeof define && define.amd){define("marked",f)}else {g["marked"]=f()}}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : this,function(){var exports={};var __exports=exports;var module={exports};
13
+ "use strict";var j=Object.defineProperty;var we=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var Pe=Object.prototype.hasOwnProperty;var Se=(l,e)=>{for(var t in e)j(l,t,{get:e[t],enumerable:!0})},_e=(l,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ye(e))!Pe.call(l,s)&&s!==t&&j(l,s,{get:()=>e[s],enumerable:!(n=we(e,s))||n.enumerable});return l};var $e=l=>_e(j({},"__esModule",{value:!0}),l);var Lt={};Se(Lt,{Hooks:()=>P,Lexer:()=>x,Marked:()=>D,Parser:()=>b,Renderer:()=>y,TextRenderer:()=>_,Tokenizer:()=>w,defaults:()=>R,getDefaults:()=>z,lexer:()=>$t,marked:()=>g,options:()=>Tt,parse:()=>St,parseInline:()=>Pt,parser:()=>_t,setOptions:()=>wt,use:()=>Re,walkTokens:()=>yt});module.exports=$e(Lt);function z(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var R=z();function F(l){R=l}var M={exec:()=>null};function I(l){let e=[];return t=>{let n=Math.max(0,Math.min(3,t-1)),s=e[n];return s||(s=l(n),e[n]=s),s}}function k(l,e=""){let t=typeof l=="string"?l:l.source,n={replace:(s,r)=>{let i=typeof r=="string"?r:r.source;return i=i.replace(m.caret,"$1"),t=t.replace(s,i),n},getRegex:()=>new RegExp(t,e)};return n}var Le=((l="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+l)}catch{return!1}})(),m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:l=>new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:I(l=>new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:I(l=>new RegExp(`^ {0,${l}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:I(l=>new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)),headingBeginRegex:I(l=>new RegExp(`^ {0,${l}}#`)),htmlBeginRegex:I(l=>new RegExp(`^ {0,${l}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:I(l=>new RegExp(`^ {0,${l}}>`))},Ee=/^(?:[ \t]*(?:\n|$))+/,ze=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Me=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,v=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ae=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,K=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ae=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,le=k(ae).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ie=k(ae).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),W=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ce=/^[^\n]+/,X=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Be=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",X).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),De=k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,K).getRegex(),Q="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",J=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,qe=k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",J).replace("tag",Q).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ue=l=>k(W).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",l).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex(),ve=ue(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),He=ue(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ze=k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",He).getRegex(),V={blockquote:Ze,code:ze,def:Be,fences:Me,heading:Ae,hr:v,html:qe,lheading:le,list:De,newline:Ee,paragraph:ve,table:M,text:Ce},ie=k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex(),Ge={...V,lheading:Ie,table:ie,paragraph:k(W).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ie).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex()},Qe={...V,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",J).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:M,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(W).replace("hr",v).replace("heading",` *#{1,6} *[^
14
+ ]`).replace("lheading",le).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ne=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,je=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,pe=/^( {2,}|\\)\n(?!\s*$)/,Fe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$=/[\p{P}\p{S}]/u,C=/[\s\p{P}\p{S}]/u,H=/[^\s\p{P}\p{S}]/u,Ue=k(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,C).getRegex(),Ke=/[\p{Pi}\p{Ps}"']/u,ce=/(?!~)[\p{P}\p{S}]/u,We=/(?!~)[\s\p{P}\p{S}]/u,Xe=/(?:[^\s\p{P}\p{S}]|~)/u,Je=k(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Le?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),he=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ve=k(he,"u").replace(/punct/g,$).getRegex(),Ye=k(he,"u").replace(/punct/g,ce).getRegex(),et=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,tt=k(et,"u").replace(/openQuote/g,Ke).replace(/punct/g,$).getRegex(),ke="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",nt=k(ke,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,C).replace(/punct/g,$).getRegex(),rt=k(ke,"gu").replace(/notPunctSpace/g,Xe).replace(/punctSpace/g,We).replace(/punct/g,ce).getRegex(),st="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",it=k(st,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,C).replace(/punct/g,$).getRegex(),ot=k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,C).replace(/punct/g,$).getRegex(),at="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",lt=k(at,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,C).replace(/punct/g,$).getRegex(),ut=k(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,$).getRegex(),pt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ct=k(pt,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,C).replace(/punct/g,$).getRegex(),ht=k(/\\(punct)/,"gu").replace(/punct/g,$).getRegex(),kt=k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),dt=k(J).replace("(?:-->|$)","-->").getRegex(),gt=k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",dt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),G=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ft=k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",G).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),de=k(/^!?\[(label)\]\[(ref)\]/).replace("label",G).replace("ref",X).getRegex(),ge=k(/^!?\[(ref)\](?:\[\])?/).replace("ref",X).getRegex(),mt=k("reflink|nolink(?!\\()","g").replace("reflink",de).replace("nolink",ge).getRegex(),oe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Y={_backpedal:M,anyPunctuation:ht,autolink:kt,blockSkip:Je,br:pe,code:je,del:M,delLDelim:M,delRDelim:M,emStrongLDelim:Ve,emStrongRDelimAst:nt,emStrongRDelimUnd:ot,escape:Ne,link:ft,nolink:ge,punctuation:Ue,reflink:de,reflinkSearch:mt,tag:gt,text:Fe,url:M},xt={...Y,emStrongLDelim:tt,emStrongRDelimAst:it,emStrongRDelimUnd:lt,link:k(/^!?\[(label)\]\((.*?)\)/).replace("label",G).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",G).getRegex()},U={...Y,emStrongRDelimAst:rt,emStrongLDelim:Ye,delLDelim:ut,delRDelim:ct,url:k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",oe).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:k(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",oe).getRegex()},bt={...U,br:k(pe).replace("{2,}","*").getRegex(),text:k(U.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Z={normal:V,gfm:Ge,pedantic:Qe},B={normal:Y,gfm:U,breaks:bt,pedantic:xt};var Rt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},fe=l=>Rt[l];function T(l,e){if(e){if(m.escapeTest.test(l))return l.replace(m.escapeReplace,fe)}else if(m.escapeTestNoEncode.test(l))return l.replace(m.escapeReplaceNoEncode,fe);return l}function ee(l){try{l=encodeURI(l).replace(m.percentDecode,"%")}catch{return null}return l}function te(l,e){let t=l.replace(m.findPipe,(r,i,o)=>{let u=!1,a=i;for(;--a>=0&&o[a]==="\\";)u=!u;return u?"|":" |"}),n=t.split(m.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(m.slashPipe,"|");return n}function L(l,e,t){let n=l.length;if(n===0)return"";let s=0;for(;s<n;){let r=l.charAt(n-s-1);if(r===e&&!t)s++;else if(r!==e&&t)s++;else break}return l.slice(0,n-s)}function ne(l){let e=l.split(`
15
+ `),t=e.length-1;for(;t>=0&&m.blankLine.test(e[t]);)t--;return e.length-t<=2?l:e.slice(0,t+1).join(`
16
+ `)}function me(l,e){if(l.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function xe(l,e=0){let t=e,n="";for(let s of l)if(s===" "){let r=4-t%4;n+=" ".repeat(r),t+=r}else n+=s,t++;return n}function be(l,e,t,n,s){let r=e.href,i=e.title||null,o=l[1].replace(s.other.outputLinkReplace,"$1"),u=l[0].charAt(0)==="!";n.state.inLink=!0;let a=n.state.linkEmitted,p=n.state.inRawBlock;n.state.linkEmitted=!1;let c=n.inlineTokens(o),h=n.state.linkEmitted;if(n.state.linkEmitted=a,n.state.inLink=!1,!u){if(h){n.state.inRawBlock=p;return}n.state.linkEmitted=!0}return{type:u?"image":"link",raw:t,href:r,title:i,text:o,tokens:c}}function Ot(l,e,t){let n=l.match(t.other.indentCodeCompensation);if(n===null)return e;let s=n[1];return e.split(`
17
+ `).map(r=>{let i=r.match(t.other.beginningSpace);if(i===null)return r;let[o]=i;return o.length>=s.length?r.slice(s.length):r}).join(`
18
+ `)}var w=class{options;rules;lexer;constructor(e){this.options=e||R}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:ne(t[0]),s=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:s}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=Ot(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=L(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:L(t[0],`
19
+ `),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:L(t[0],`
20
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=L(t[0],`
21
+ `).split(`
22
+ `),s="",r="",i=[];for(;n.length>0;){let o=!1,u=[],a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))u.push(n[a]),o=!0;else if(!o)u.push(n[a]);else break;n=n.slice(a);let p=u.join(`
23
+ `),c=p.replace(this.rules.other.blockquoteSetextReplace,`
24
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
25
+ ${p}`:p,r=r?`${r}
26
+ ${c}`:c;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=h,n.length===0)break;let d=i.at(-1);if(d?.type==="code")break;if(d?.type==="blockquote"){let O=d,f=n.join(`
27
+ `),S=O.raw+`
28
+ `+f.replace(this.rules.other.blockquoteSetextReplace2,""),E=this.blockquote(S);i[i.length-1]=E,s=`${s}
29
+ ${f}`,r=r.substring(0,r.length-O.text.length)+E.text;break}else if(d?.type==="list"){let O=d,f=O.raw+`
30
+ `+n.join(`
31
+ `),S=this.list(f);i[i.length-1]=S,s=s.substring(0,s.length-d.raw.length)+S.raw,r=r.substring(0,r.length-O.raw.length)+S.raw,n=f.substring(i.at(-1).raw.length).split(`
32
+ `);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let i=this.rules.other.listItemRegex(n),o=!1;for(;e;){let a=!1,p="",c="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let h=xe(t[2].split(`
33
+ `,1)[0],t[1].length),d=e.split(`
34
+ `,1)[0],O=!h.trim(),f=0;if(this.options.pedantic?(f=2,c=h.trimStart()):O?f=t[1].length+1:(f=h.search(this.rules.other.nonSpaceChar),f=f>4?1:f,c=h.slice(f),f+=t[1].length),O&&this.rules.other.blankLine.test(d)&&(p+=d+`
35
+ `,e=e.substring(d.length+1),a=!0),!a){let S=this.rules.other.nextBulletRegex(f),E=this.rules.other.hrRegex(f),re=this.rules.other.fencesBeginRegex(f),se=this.rules.other.headingBeginRegex(f),Oe=this.rules.other.htmlBeginRegex(f),Te=this.rules.other.blockquoteBeginRegex(f);for(;e;){let N=e.split(`
36
+ `,1)[0],q;if(d=N,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),q=d):q=d.replace(this.rules.other.tabCharGlobal," "),re.test(d)||se.test(d)||Oe.test(d)||Te.test(d)||S.test(d)||E.test(d))break;if(q.search(this.rules.other.nonSpaceChar)>=f||!d.trim())c+=`
37
+ `+q.slice(f);else{if(O||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||re.test(h)||se.test(h)||E.test(h))break;c+=`
38
+ `+d}O=!d.trim(),p+=N+`
39
+ `,e=e.substring(N.length+1),h=q.slice(f)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(o=!0)),r.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),r.raw+=p}let u=r.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let a of r.items)if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),!r.loose){let p=a.tokens.filter(h=>h.type==="space"),c=p.length>0&&p.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=c}for(let a of r.items){let p=a.tokens[0];if(a.task&&(p?.type==="text"||p?.type==="paragraph")){a.text=a.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let c=this.rules.other.listTaskCheckbox.exec(a.raw);if(c){let h={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};a.checked=h.checked,r.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=h.raw+a.tokens[0].raw,a.tokens[0].text=h.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(h)):a.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):a.tokens.unshift(h)}}else a.task&&(a.task=!1)}if(r.loose)for(let a of r.items){a.loose=!0;for(let p of a.tokens)p.type==="text"&&(p.type="paragraph")}return r}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=ne(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:L(t[0],`
40
+ `),href:s,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=te(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
41
+ `):[],i={type:"table",raw:L(t[0],`
42
+ `),header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<n.length;o++)i.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:i.align[o]});for(let o of r)i.rows.push(te(o,i.header.length).map((u,a)=>({text:u,tokens:this.lexer.inline(u),header:!1,align:i.align[a]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:L(t[0],`
43
+ `),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
44
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=L(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=me(t[2],"()");if(i===-2)return;if(i>-1){let u=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let s=t[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],r=i[3])}else r=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),be(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[s.toLowerCase()];if(!r){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return be(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[3]||"")||!n||this.rules.inline.punctuation.exec(n)){let i=[...s[0]].length-1,o,u,a=i,p=0,c=s[0][0],h=n===c,d=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(s=d.exec(t))!==null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(u=[...o].length,s[3]||s[4]){a+=u;continue}else if(s[5]||s[6]){if(i%3&&!((i+u)%3)){p+=u;continue}if(h)break}if(a-=u,a>0)continue;u=Math.min(u,u+a+p);let O=[...s[0]][0].length,f=e.slice(0,i+s.index+O+u);if(Math.min(i,u)%2){let E=f.slice(1,-1);return{type:"em",raw:f,text:E,tokens:this.lexer.inlineTokens(E)}}let S=f.slice(2,-2);return{type:"strong",raw:f,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let s=this.rules.inline.delLDelim.exec(e);if(!s)return;if(!(s[1]||"")||!n||this.rules.inline.punctuation.exec(n)){let i=[...s[0]].length-1,o,u,a=i,p=this.rules.inline.delRDelim;for(p.lastIndex=0,t=t.slice(-1*e.length+i);(s=p.exec(t))!==null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o||(u=[...o].length,u!==i))continue;if(s[3]||s[4]){a+=u;continue}if(a-=u,a>0)continue;u=Math.min(u,u+a);let c=[...s[0]][0].length,h=e.slice(0,i+s.index+c+u),d=h.slice(i,-i);return{type:"del",raw:h,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}};var x=class l{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||R,this.options.tokenizer=this.options.tokenizer||new w,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:m,block:Z.normal,inline:B.normal};this.options.pedantic?(t.block=Z.pedantic,t.inline=B.pedantic):this.options.gfm&&(t.block=Z.gfm,this.options.breaks?t.inline=B.breaks:t.inline=B.gfm),this.tokenizer.rules=t}static get rules(){return{block:Z,inline:B}}static lex(e,t){return new l(t).lex(e)}static lexInline(e,t){return new l(t).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
45
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));let s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(o=>(r=o.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let o=t.at(-1);r.raw.length===1&&o!==void 0?o.raw+=`
46
+ `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
47
+ `)?"":`
48
+ `)+r.raw,o.text+=`
49
+ `+r.text,this.inlineQueue.at(-1).src=o.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
50
+ `)?"":`
51
+ `)+r.raw,o.text+=`
52
+ `+r.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let o=1/0,u=e.slice(1),a;this.options.extensions.startBlock.forEach(p=>{a=p.call({lexer:this},u),typeof a=="number"&&a>=0&&(o=Math.min(o,a))}),o<1/0&&o>=0&&(i=e.substring(0,o+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let o=t.at(-1);n&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
53
+ `)?"":`
54
+ `)+r.raw,o.text+=`
55
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
56
+ `)?"":`
57
+ `)+r.raw,o.text+=`
58
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!=="!")return!0;for(let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let s=n[0],r=s.lastIndexOf("[");if(!(s.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,s.slice(r+1,-1)))&&!(r>1&&this.linkInText(s.slice(1,r-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes("[")){let o=this.tokenizer.rules.inline.reflinkSearch,u=a=>{let p=a.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,a.slice(p+1,-1)))return a;if(p>1&&a.charAt(0)!=="!"){let c=a.slice(1,p-1);if(this.linkInText(c))return"["+c.replace(o,u)+"]["+"a".repeat(a.length-p-2)+"]"}return"["+"a".repeat(a.length-2)+"]"};n=n.replace(o,u)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,o=>"+".repeat(o.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(o,u,a)=>{let p=a?a.length:0;return o.slice(0,p)+"["+"a".repeat(o.length-p-2)+"]"}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let s=!1,r="",i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}s||(r=""),s=!1;let o;if(this.options.extensions?.inline?.some(a=>(o=a.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let a=t.at(-1);o.type==="text"&&a?.type==="text"?(a.raw+=o.raw,a.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,r)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,r)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let u=e;if(this.options.extensions?.startInline){let a=1/0,p=e.slice(1),c;this.options.extensions.startInline.forEach(h=>{c=h.call({lexer:this},p),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(u=e.substring(0,a+1))}if(o=this.tokenizer.inlineText(u)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(r=o.raw.slice(-1)),s=!0;let a=t.at(-1);a?.type==="text"?(a.raw+=o.raw,a.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}};var y=class{options;parser;constructor(e){this.options=e||R}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(m.notSpaceStart)?.[0],r=e.replace(m.endingNewline,"")+`
59
+ `;return s?'<pre><code class="language-'+T(s)+'">'+(n?r:T(r,!0))+`</code></pre>
60
+ `:"<pre><code>"+(n?r:T(r,!0))+`</code></pre>
61
+ `}blockquote({tokens:e}){return`<blockquote>
62
+ ${this.parser.parse(e)}</blockquote>
63
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
64
+ `}hr(e){return`<hr>
65
+ `}list(e){let t=e.ordered,n=e.start,s="";for(let o=0;o<e.items.length;o++){let u=e.items[o];s+=this.listitem(u)}let r=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+r+i+`>
66
+ `+s+"</"+r+`>
67
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
68
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
69
+ `}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let s="";for(let r=0;r<e.rows.length;r++){let i=e.rows[r];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
70
+ <thead>
71
+ `+t+`</thead>
72
+ `+s+`</table>
73
+ `}tablerow({text:e}){return`<tr>
74
+ ${e}</tr>
75
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
76
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${T(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),r=ee(e);if(r===null)return s;e=r;let i='<a href="'+e+'"';return t&&(i+=' title="'+T(t)+'"'),i+=">"+s+"</a>",i}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let r=ee(e);if(r===null)return T(n);e=r;let i=`<img src="${e}" alt="${T(n)}"`;return t&&(i+=` title="${T(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:T(e.text)}};var _=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}};var b=class l{options;renderer;textRenderer;constructor(e){this.options=e||R,this.options.renderer=this.options.renderer||new y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _}static parse(e,t){return new l(t).parse(e)}static parseInline(e,t){return new l(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let n=0;n<e.length;n++){let s=e[n];if(this.options.extensions?.renderers?.[s.type]){let i=s,o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(i.type)){t+=o||"";continue}}let r=s;switch(r.type){case"space":{t+=this.renderer.space(r);break}case"hr":{t+=this.renderer.hr(r);break}case"heading":{t+=this.renderer.heading(r);break}case"code":{t+=this.renderer.code(r);break}case"table":{t+=this.renderer.table(r);break}case"blockquote":{t+=this.renderer.blockquote(r);break}case"list":{t+=this.renderer.list(r);break}case"checkbox":{t+=this.renderer.checkbox(r);break}case"html":{t+=this.renderer.html(r);break}case"def":{t+=this.renderer.def(r);break}case"paragraph":{t+=this.renderer.paragraph(r);break}case"text":{t+=this.renderer.text(r);break}default:{let i='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let o=this.options.extensions.renderers[r.type].call({parser:this},r);if(o!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(r.type)){n+=o||"";continue}}let i=r;switch(i.type){case"escape":{n+=t.text(i);break}case"html":{n+=t.html(i);break}case"link":{n+=t.link(i);break}case"image":{n+=t.image(i);break}case"checkbox":{n+=t.checkbox(i);break}case"strong":{n+=t.strong(i);break}case"em":{n+=t.em(i);break}case"codespan":{n+=t.codespan(i);break}case"br":{n+=t.br(i);break}case"del":{n+=t.del(i);break}case"text":{n+=t.text(i);break}default:{let o='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}};var P=class{options;block;constructor(e){this.options=e||R}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?x.lex:x.lexInline}provideParser(e=this.block){return e?b.parse:b.parseInline}};var D=class{defaults=z();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=b;Renderer=y;TextRenderer=_;Lexer=x;Tokenizer=w;Hooks=P;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let r=s;for(let i of r.header)n=n.concat(this.walkTokens(i.tokens,t));for(let i of r.rows)for(let o of i)n=n.concat(this.walkTokens(o.tokens,t));break}case"list":{let r=s;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(i=>{let o=r[i].flat(1/0);n=n.concat(this.walkTokens(o,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=t.renderers[r.name];i?t.renderers[r.name]=function(...o){let u=r.renderer.apply(this,o);return u===!1&&(u=i.apply(this,o)),u}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[r.level];i?i.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),s.extensions=t),n.renderer){let r=this.defaults.renderer||new y(this.defaults);for(let i in n.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,u=n.renderer[o],a=r[o];r[o]=(...p)=>{let c=u.apply(r,p);return c===!1&&(c=a.apply(r,p)),c||""}}s.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new w(this.defaults);for(let i in n.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,u=n.tokenizer[o],a=r[o];r[o]=(...p)=>{let c=u.apply(r,p);return c===!1&&(c=a.apply(r,p)),c}}s.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new P;for(let i in n.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,u=n.hooks[o],a=r[o];P.passThroughHooks.has(i)?r[o]=p=>{if(this.defaults.async&&P.passThroughHooksRespectAsync.has(i))return(async()=>{let h=await u.call(r,p);return a.call(r,h)})();let c=u.call(r,p);return a.call(r,c)}:r[o]=(...p)=>{if(this.defaults.async)return(async()=>{let h=await u.apply(r,p);return h===!1&&(h=await a.apply(r,p)),h})();let c=u.apply(r,p);return c===!1&&(c=a.apply(r,p)),c}}s.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,i=n.walkTokens;s.walkTokens=function(o){let u=[];return u.push(i.call(this,o)),r&&(u=u.concat(r.call(this,o))),u}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return x.lex(e,t??this.defaults)}parser(e,t){return b.parse(e,t??this.defaults)}parseMarkdown(e){return(n,s)=>{let r={...s},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let u=i.hooks?await i.hooks.preprocess(n):n,p=await(i.hooks?await i.hooks.provideLexer(e):e?x.lex:x.lexInline)(u,i),c=i.hooks?await i.hooks.processAllTokens(p):p;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(e):e?b.parse:b.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(o);try{i.hooks&&(n=i.hooks.preprocess(n));let a=(i.hooks?i.hooks.provideLexer(e):e?x.lex:x.lexInline)(n,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let c=(i.hooks?i.hooks.provideParser(e):e?b.parse:b.parseInline)(a,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}catch(u){return o(u)}}}onError(e,t){return n=>{if(n.message+=`
77
+ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+T(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}};var A=new D;function g(l,e){return A.parse(l,e)}g.options=g.setOptions=function(l){return A.setOptions(l),g.defaults=A.defaults,F(g.defaults),g};g.getDefaults=z;g.defaults=R;function Re(...l){return A.use(...l),g.defaults=A.defaults,F(g.defaults),g}g.use=Re;g.walkTokens=function(l,e){return A.walkTokens(l,e)};g.parseInline=A.parseInline;g.Parser=b;g.parser=b.parse;g.Renderer=y;g.TextRenderer=_;g.Lexer=x;g.lexer=x.lex;g.Tokenizer=w;g.Hooks=P;g.parse=g;var Tt=g.options,wt=g.setOptions,yt=g.walkTokens,Pt=g.parseInline,St=g,_t=b.parse,$t=x.lex;
78
+
79
+ if(__exports != exports)module.exports = exports;return module.exports}));
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "https://pi.dev/schemas/theme.schema.json",
3
+ "name": "dark",
4
+ "appearance": "dark",
5
+ "vars": {
6
+ "text": "okhsl(234 3% 89%)",
7
+ "muted": "okhsl(229 6% 67%)",
8
+ "violet": "okhsl(295 50% 67%)",
9
+ "blue": "okhsl(232 54% 67%)",
10
+ "green": "okhsl(159 59% 67%)",
11
+ "red": "okhsl(20 72% 67%)",
12
+ "yellow": "okhsl(83 88% 67%)",
13
+ "blueBg": "okhsl(233 41% 24%)"
14
+ },
15
+ "colors": {
16
+ "accent": "violet",
17
+ "border": "okhsl(231 57% 65%)",
18
+ "borderAccent": "okhsl(295 53% 64%)",
19
+ "borderMuted": "okhsl(229 8% 53%)",
20
+ "success": "green",
21
+ "error": "red",
22
+ "warning": "yellow",
23
+ "muted": "muted",
24
+ "dim": "okhsl(229 8% 56%)",
25
+ "text": "text",
26
+ "thinkingText": "okhsl(226 7% 65%)",
27
+ "selectedBg": "blueBg",
28
+ "scrollbarTrack": "okhsl(237 7% 33%)",
29
+ "scrollbarThumb": "okhsl(232 7% 65%)",
30
+ "searchMatchBg": "okhsl(53 51% 24%)",
31
+ "searchMatchText": "muted",
32
+ "userMessageBg": "blueBg",
33
+ "userMessageText": "text",
34
+ "customMessageBg": "okhsl(295 42% 24%)",
35
+ "customMessageText": "muted",
36
+ "customMessageLabel": "violet",
37
+ "toolPendingBg": "okhsl(229 5% 24%)",
38
+ "toolSuccessBg": "okhsl(158 46% 25%)",
39
+ "toolErrorBg": "okhsl(19 54% 25%)",
40
+ "toolTitle": "text",
41
+ "toolOutput": "muted",
42
+ "mdHeading": "yellow",
43
+ "mdLink": "blue",
44
+ "mdLinkUrl": "muted",
45
+ "mdCode": "violet",
46
+ "mdCodeBlock": "green",
47
+ "mdCodeBlockBorder": "muted",
48
+ "mdQuote": "muted",
49
+ "mdQuoteBorder": "muted",
50
+ "mdHr": "muted",
51
+ "mdListBullet": "violet",
52
+ "toolDiffAdded": "green",
53
+ "toolDiffRemoved": "red",
54
+ "toolDiffContext": "muted",
55
+ "syntaxComment": "muted",
56
+ "syntaxKeyword": "blue",
57
+ "syntaxFunction": "yellow",
58
+ "syntaxVariable": "okhsl(202 58% 67%)",
59
+ "syntaxString": "okhsl(52 67% 67%)",
60
+ "syntaxNumber": "green",
61
+ "syntaxType": "violet",
62
+ "syntaxOperator": "muted",
63
+ "syntaxPunctuation": "muted",
64
+ "thinkingOff": "okhsl(229 8% 49%)",
65
+ "thinkingMinimal": "okhsl(232 20% 52%)",
66
+ "thinkingLow": "okhsl(232 45% 54%)",
67
+ "thinkingMedium": "okhsl(263 59% 56%)",
68
+ "thinkingHigh": "okhsl(295 73% 59%)",
69
+ "thinkingXhigh": "okhsl(337 81% 61%)",
70
+ "thinkingMax": "okhsl(20 99% 63%)",
71
+ "bashMode": "okhsl(159 64% 65%)"
72
+ },
73
+ "export": {
74
+ "pageBg": "okhsl(262 14% 16%)",
75
+ "cardBg": "okhsl(264 13% 19%)",
76
+ "infoBg": "okhsl(53 51% 24%)"
77
+ }
78
+ }
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "https://pi.dev/schemas/theme.schema.json",
3
+ "name": "light",
4
+ "appearance": "light",
5
+ "vars": {
6
+ "text": "okhsl(225 5% 27%)",
7
+ "muted": "okhsl(229 8% 47%)",
8
+ "violet": "okhsl(295 60% 46%)",
9
+ "blue": "okhsl(231 68% 47%)",
10
+ "green": "okhsl(159 75% 46%)",
11
+ "red": "okhsl(20 91% 47%)",
12
+ "yellow": "okhsl(83 99% 47%)",
13
+ "blueBg": "okhsl(235 19% 91%)"
14
+ },
15
+ "colors": {
16
+ "accent": "violet",
17
+ "border": "okhsl(231 67% 55%)",
18
+ "borderAccent": "okhsl(295 59% 55%)",
19
+ "borderMuted": "okhsl(235 7% 66%)",
20
+ "success": "green",
21
+ "error": "red",
22
+ "warning": "yellow",
23
+ "muted": "muted",
24
+ "dim": "okhsl(229 7% 59%)",
25
+ "text": "text",
26
+ "thinkingText": "okhsl(234 8% 55%)",
27
+ "selectedBg": "blueBg",
28
+ "scrollbarTrack": "okhsl(248 3% 90%)",
29
+ "scrollbarThumb": "okhsl(226 7% 65%)",
30
+ "searchMatchBg": "okhsl(56 22% 91%)",
31
+ "searchMatchText": "muted",
32
+ "userMessageBg": "blueBg",
33
+ "userMessageText": "text",
34
+ "customMessageBg": "okhsl(295 25% 91%)",
35
+ "customMessageText": "muted",
36
+ "customMessageLabel": "violet",
37
+ "toolPendingBg": "okhsl(248 3% 91%)",
38
+ "toolSuccessBg": "okhsl(156 21% 91%)",
39
+ "toolErrorBg": "okhsl(24 23% 91%)",
40
+ "toolTitle": "text",
41
+ "toolOutput": "muted",
42
+ "mdHeading": "yellow",
43
+ "mdLink": "blue",
44
+ "mdLinkUrl": "muted",
45
+ "mdCode": "violet",
46
+ "mdCodeBlock": "green",
47
+ "mdCodeBlockBorder": "muted",
48
+ "mdQuote": "muted",
49
+ "mdQuoteBorder": "muted",
50
+ "mdHr": "muted",
51
+ "mdListBullet": "violet",
52
+ "toolDiffAdded": "green",
53
+ "toolDiffRemoved": "red",
54
+ "toolDiffContext": "muted",
55
+ "syntaxComment": "muted",
56
+ "syntaxKeyword": "blue",
57
+ "syntaxFunction": "yellow",
58
+ "syntaxVariable": "okhsl(203 73% 46%)",
59
+ "syntaxString": "okhsl(52 84% 46%)",
60
+ "syntaxNumber": "green",
61
+ "syntaxType": "violet",
62
+ "syntaxOperator": "muted",
63
+ "syntaxPunctuation": "muted",
64
+ "thinkingOff": "okhsl(223 5% 80%)",
65
+ "thinkingMinimal": "okhsl(229 14% 78%)",
66
+ "thinkingLow": "okhsl(232 33% 76%)",
67
+ "thinkingMedium": "okhsl(264 48% 74%)",
68
+ "thinkingHigh": "okhsl(295 62% 72%)",
69
+ "thinkingXhigh": "okhsl(337 74% 70%)",
70
+ "thinkingMax": "okhsl(20 98% 68%)",
71
+ "bashMode": "okhsl(159 74% 55%)"
72
+ },
73
+ "export": {
74
+ "pageBg": "okhsl(17 3% 94%)",
75
+ "cardBg": "okhsl(17 5% 97%)",
76
+ "infoBg": "okhsl(56 22% 91%)"
77
+ }
78
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The `system` theme: pi's colors derived from the terminal's own theme.
3
+ *
4
+ * Every token belongs to a color family (its hue) and has contrast rules: it must reach a contrast level
5
+ * on the background and on the panels it is drawn on. Hue and saturation come from the terminal's palette
6
+ * color for the family's ANSI slot, or from the family's own hue when the terminal reports no palette.
7
+ * Lightness comes from the rules alone. Colors are built in OKHSL, whose saturation is relative to the
8
+ * sRGB gamut, and fade toward gray near black and white. A palette color never gains OKLCH chroma when it
9
+ * moves to another lightness, so pastel palettes stay pastel.
10
+ *
11
+ * A contrast level is a target-lightness curve: the OKLab lightness a token needs, given the lightness of
12
+ * the surface below it. The curves were fitted to the reference theme design from the "Pi themes: system
13
+ * and light/dark" review. On dark backgrounds they aim for nearly fixed lightness; on light backgrounds the
14
+ * required difference grows as the background darkens.
15
+ *
16
+ * Depending on what the terminal reports, the theme is generated in one of three tiers:
17
+ * - background and palette: hues from the palette, lightness from the background;
18
+ * - background only: the families' own hues, lightness from the background;
19
+ * - nothing: ANSI palette indices and the default colors, which the terminal renders itself.
20
+ */
21
+ import { type RgbColor } from "@earendil-works/pi-tui";
22
+ import type { ThemeAppearance, ThemeColor, ThemeToken } from "./theme.ts";
23
+ export declare const SYSTEM_THEME_NAME = "system";
24
+ export interface SystemThemeInput {
25
+ foreground?: RgbColor;
26
+ background?: RgbColor;
27
+ /** ANSI colors 0-15. */
28
+ palette?: RgbColor[];
29
+ /** Saturation multiplier from 0 (grayscale) to 1. The first frame renders in grayscale until colors arrive. */
30
+ saturation?: number;
31
+ /** Appearance when the terminal did not report its background, e.g. from its light/dark report or COLORFGBG. */
32
+ appearanceHint?: ThemeAppearance;
33
+ }
34
+ export interface SystemThemeColors {
35
+ /** Hex colors, ANSI palette indices, or "" for the terminal default. */
36
+ colors: Record<ThemeToken, string | number>;
37
+ /** Foreground tokens rendered faint (SGR 2), for terminals that did not report colors. */
38
+ dim: ThemeColor[];
39
+ appearance: ThemeAppearance | undefined;
40
+ }
41
+ /** WCAG 2 relative luminance. */
42
+ export declare function relativeLuminance({ r, g, b }: RgbColor): number;
43
+ /** WCAG 2 contrast ratio, 1-21. */
44
+ export declare function wcagContrast(first: RgbColor, second: RgbColor): number;
45
+ /**
46
+ * Whether a terminal is dark or light, from its reported colors: the direction of its own foreground
47
+ * when text can be readable that way, otherwise dark when white text has more contrast on the
48
+ * background than black text.
49
+ */
50
+ export declare function terminalAppearance(background: RgbColor, foreground?: RgbColor): ThemeAppearance;
51
+ /**
52
+ * Generate the system theme's colors from the terminal's reported colors.
53
+ */
54
+ export declare function generateSystemThemeColors(input: SystemThemeInput): SystemThemeColors;
55
+ //# sourceMappingURL=system-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-theme.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/system-theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAQN,KAAK,QAAQ,EAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAW,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEnF,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAgV1C,MAAM,WAAW,gBAAgB;IAChC,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,wBAAwB;IACxB,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB,+GAA+G;IAC/G,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gHAAgH;IAChH,cAAc,CAAC,EAAE,eAAe,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IACjC,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC5C,0FAA0F;IAC1F,GAAG,EAAE,UAAU,EAAE,CAAC;IAClB,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC;CACxC;AAOD,iCAAiC;AACjC,wBAAgB,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,CAM/D;AAED,mCAAmC;AACnC,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAG,MAAM,CAItE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,QAAQ,GAAG,eAAe,CAe/F;AA+BD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB,CA0HpF"}