@inkeep/open-knowledge 0.59.0-beta.26 → 0.59.0-beta.27

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 (139) hide show
  1. package/dist/{acp-harness-probe-DYbo4bT-.mjs → acp-harness-probe-CHDRVQpq.mjs} +2 -2
  2. package/dist/cli.mjs +11 -11
  3. package/dist/config-schema.json +2 -36
  4. package/dist/config.project.schema.json +2 -36
  5. package/dist/constants-DSNC3wSl.mjs +2 -0
  6. package/dist/{fs-traced-6G_aFzgy.mjs → fs-traced-1KTQL4h-.mjs} +6 -6
  7. package/dist/fs-traced-Dak_kryQ.mjs +1 -0
  8. package/dist/git-handle-DmslHvlR.mjs +1 -0
  9. package/dist/{git-handle-BamU1o3R.mjs → git-handle-v3HRk0k0.mjs} +2 -2
  10. package/dist/index.d.mts +0 -5
  11. package/dist/index.mjs +144 -144
  12. package/dist/init-CcwKgR9R.mjs +1 -0
  13. package/dist/{init-B14cFSch.mjs → init-zTOfz-Hi.mjs} +3 -3
  14. package/dist/{launch-json-removal-D9Dn9ans.mjs → launch-json-removal-CK23LZq3.mjs} +2 -2
  15. package/dist/loader-Bbx1ChcV.mjs +1 -0
  16. package/dist/{loader-DlLkJi3f.mjs → loader-ChVnFNzU.mjs} +2 -2
  17. package/dist/md-manager-7voOTrzM.mjs +2 -0
  18. package/dist/{open-browser-CD86-cP6.mjs → open-browser-DD5VHxHl.mjs} +2 -2
  19. package/dist/parse-worker.mjs +1 -1
  20. package/dist/{preview-Dr5MviTF.mjs → preview-CIkhwrjV.mjs} +2 -2
  21. package/dist/preview-DcSm8SQu.mjs +1 -0
  22. package/dist/public/assets/{ActivityModeContent-BH3nUmKi.js → ActivityModeContent-DJkcYUFG.js} +1 -1
  23. package/dist/public/assets/{AgentDiffPane-ulYiZICp.js → AgentDiffPane-QpnE2RxP.js} +1 -1
  24. package/dist/public/assets/{AgentThreadClientBinder-DyRJbgYV.js → AgentThreadClientBinder-BNxw9YWy.js} +1 -1
  25. package/dist/public/assets/{CodeMirrorPropInput-D5dluJAa.js → CodeMirrorPropInput-DlJxY2cd.js} +1 -1
  26. package/dist/public/assets/{DocumentContext-C0nL2SXC.js → DocumentContext-BI0smsxZ.js} +1 -1
  27. package/dist/public/assets/{EditorModeToggle-CPc75zv0.js → EditorModeToggle-DVfUE-Hx.js} +1 -1
  28. package/dist/public/assets/{EnableSyncConfirmDialog-_4B5kdmf.js → EnableSyncConfirmDialog-CH3AktRr.js} +1 -1
  29. package/dist/public/assets/{ExcalidrawDocEditor-C5fCyPDa.js → ExcalidrawDocEditor-HqU6SXrF.js} +1 -1
  30. package/dist/public/assets/FeedbackForm-DfjQFt_o.js +1 -0
  31. package/dist/public/assets/{GraphPanel-DjOi0m6N.js → GraphPanel-MtHSCEEc.js} +1 -1
  32. package/dist/public/assets/{ImportSkillDialog-CfhVYZbV.js → ImportSkillDialog-DqbRbXfG.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-BJZcVBKl.js → LintConfigEditor-DQQlzcbN.js} +1 -1
  34. package/dist/public/assets/{ManagedArtifactProperties-COaU0QeT.js → ManagedArtifactProperties-CPsIQVz8.js} +1 -1
  35. package/dist/public/assets/ManagedArtifactProperties-DkmtIVIZ.js +1 -0
  36. package/dist/public/assets/{MermaidDocEditor-B6o0wQi9.js → MermaidDocEditor-UIF1Y7PM.js} +1 -1
  37. package/dist/public/assets/{PropertyDisplayRow-CRD3p4U5.js → PropertyDisplayRow-BPCVo30u.js} +1 -1
  38. package/dist/public/assets/{ReportBugDialogBody-DI4KGY6b.js → ReportBugDialogBody-BoQrLPkN.js} +1 -1
  39. package/dist/public/assets/{SchemaConfigEditor-DWv0rRAz.js → SchemaConfigEditor-D5aVltyV.js} +1 -1
  40. package/dist/public/assets/{SessionsHost-4Dzze9r3.js → SessionsHost-B0WtFo-7.js} +2 -2
  41. package/dist/public/assets/{SettingsDialogBody-DCoAb0Bd.js → SettingsDialogBody-Cbsyvnqh.js} +1 -1
  42. package/dist/public/assets/{ShareBranchSwitchDialog-DzKK9STn.js → ShareBranchSwitchDialog-DxracRWc.js} +1 -1
  43. package/dist/public/assets/{ShareReceiveDialog-DH2fH5Ep.js → ShareReceiveDialog-Cfp4wdzT.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveMissDialog-DUdi0fBR.js → ShareReceiveMissDialog-DxcAaxnj.js} +1 -1
  45. package/dist/public/assets/{SkillCostValue-CcR1g_YK.js → SkillCostValue-CDg_lpMT.js} +1 -1
  46. package/dist/public/assets/{SkillEditBanner-Bygl2n7y.js → SkillEditBanner-BEG94SMV.js} +1 -1
  47. package/dist/public/assets/{SkillInstallMenu-BVG38yZJ.js → SkillInstallMenu-xkIcUjyz.js} +1 -1
  48. package/dist/public/assets/{SkillOriginInline-wsT9RocF.js → SkillOriginInline-WxvVrIDh.js} +1 -1
  49. package/dist/public/assets/{SkillToolbarControls-BpFI6ORp.js → SkillToolbarControls-BvIlOBgX.js} +1 -1
  50. package/dist/public/assets/{SlidesToolbarControls-Bli5Kfnf.js → SlidesToolbarControls-DMGLRgXN.js} +1 -1
  51. package/dist/public/assets/{SourceEditor-DinqAqAo.js → SourceEditor-BoCr54OC.js} +1 -1
  52. package/dist/public/assets/{TerminalPanel-ByZlnAVD.js → TerminalPanel-B136_x01.js} +1 -1
  53. package/dist/public/assets/{TerminalWindowApp-DQNGwwgH.js → TerminalWindowApp-C7xQ_h9C.js} +1 -1
  54. package/dist/public/assets/{TextDocEditor-CPa4xvfB.js → TextDocEditor-DZYfekpd.js} +1 -1
  55. package/dist/public/assets/{ThreadView-kSlERwEa.js → ThreadView-DenCwvfW.js} +1 -1
  56. package/dist/public/assets/{TimelineDiffPane-DXgcXY3B.js → TimelineDiffPane-XlGr0GTw.js} +1 -1
  57. package/dist/public/assets/{agent-diff-store-CK_MxQ13.js → agent-diff-store-BVPptGby.js} +1 -1
  58. package/dist/public/assets/{auth-state-cache-BIQOr5wy.js → auth-state-cache-DWZvELXg.js} +1 -1
  59. package/dist/public/assets/client-version-D2k9ZCWX.js +1 -0
  60. package/dist/public/assets/{comment-chips-DS7pK-yD.js → comment-chips-D_lOHAKs.js} +1 -1
  61. package/dist/public/assets/{config-provider-mFv1sqH4.js → config-provider-CDwrJPp7.js} +1 -1
  62. package/dist/public/assets/{dist-C1cuuJXO2.js → dist-Cjt7VASv2.js} +38 -38
  63. package/dist/public/assets/{doc-paths-Bc7iTgnL.js → doc-paths-B8neiW-a.js} +1 -1
  64. package/dist/public/assets/{documents-events-ChHRY_IT.js → documents-events-XYcpMExe.js} +1 -1
  65. package/dist/public/assets/{file-tree-adapter-Cn1x6E2_.js → file-tree-adapter-D09K46if.js} +1 -1
  66. package/dist/public/assets/{file-tree-utils-CE3Y3N48.js → file-tree-utils-D46TNM8I.js} +1 -1
  67. package/dist/public/assets/{folder-config-api-Drl7C-wY.js → folder-config-api-BF1s5fn5.js} +1 -1
  68. package/dist/public/assets/i18n-DyGGRo1x.js +1 -0
  69. package/dist/public/assets/{index-yY_6Xj9r.js → index-DVAzmNmM.js} +7 -7
  70. package/dist/public/assets/{lint-config-client-BeZysGOL.js → lint-config-client-CexP4XjM.js} +1 -1
  71. package/dist/public/assets/{markdownlint-rule-browser-B7QG3apY.js → markdownlint-rule-browser-RW_wnt3c.js} +1 -1
  72. package/dist/public/assets/{navigation-targets-dmO4e4Qm.js → navigation-targets-B81SRxAl.js} +1 -1
  73. package/dist/public/assets/{open-managed-artifact-tab-D99Uwfo7.js → open-managed-artifact-tab-ONxSWsRO.js} +1 -1
  74. package/dist/public/assets/{pending-receive-nav-store-DY9saaUe.js → pending-receive-nav-store-EbqHz-1O.js} +1 -1
  75. package/dist/public/assets/{progress-D6Zw3AMw.js → progress-BNa6s6eY.js} +1 -1
  76. package/dist/public/assets/{prop-types-CekqkyBi.js → prop-types-Bi69iPbr.js} +1 -1
  77. package/dist/public/assets/{receive-store-C4_wYBmA.js → receive-store-DvP10j_m.js} +1 -1
  78. package/dist/public/assets/{selection-context-CoupzfPD.js → selection-context-BT0IXs_k.js} +1 -1
  79. package/dist/public/assets/{skill-actions-D9yzisvl.js → skill-actions-C6XMzsRk.js} +1 -1
  80. package/dist/public/assets/{skill-scope-BNRIoNFW.js → skill-scope-D_Zsy3lJ.js} +1 -1
  81. package/dist/public/assets/{skills-api-BHNlkzLI.js → skills-api-BM2BLHCX.js} +1 -1
  82. package/dist/public/assets/{src-7eans9jB.js → src-DMrqP3nT.js} +1 -1
  83. package/dist/public/assets/{tag-pill-input-9XCv-eGc.js → tag-pill-input-BFaMBmJa.js} +1 -1
  84. package/dist/public/assets/{target-navigation-intent-BHn4lUYz.js → target-navigation-intent-CWvy9cE2.js} +1 -1
  85. package/dist/public/assets/{telemetry-impl-T0tYRMlO.js → telemetry-impl-CuZ-qtZC.js} +1 -1
  86. package/dist/public/assets/{telemetry-startup-cht6PIz2.js → telemetry-startup-CSHPwDgJ.js} +1 -1
  87. package/dist/public/assets/{terminal-cli-display-C9RSSYZZ.js → terminal-cli-display-BbYqTPWX.js} +1 -1
  88. package/dist/public/assets/{terminal-launch-events-CJ5--wwM.js → terminal-launch-events-BPjoquS2.js} +1 -1
  89. package/dist/public/assets/{terminal-telemetry-g2Rame0f.js → terminal-telemetry-DxMhdnxk.js} +1 -1
  90. package/dist/public/assets/{typing-burst-detector-HcBOgWZw.js → typing-burst-detector-B7DPFEEZ.js} +1 -1
  91. package/dist/public/assets/{uninstall-OtG696J2.js → uninstall-DDXNRWQJ.js} +1 -1
  92. package/dist/public/assets/{use-activity-panel-DA5KxLH2.js → use-activity-panel-CsxwP-4j.js} +1 -1
  93. package/dist/public/assets/{use-apply-config-color-theme-g3ghtVU3.js → use-apply-config-color-theme-cAcJ-HL5.js} +1 -1
  94. package/dist/public/assets/{use-collab-url-C0l9GQW6.js → use-collab-url-C79vcmVC.js} +1 -1
  95. package/dist/public/assets/{use-live-xterm-theme-CURX_Vkk.js → use-live-xterm-theme-D63CLflu.js} +1 -1
  96. package/dist/public/assets/{use-open-skill-qA__uomh.js → use-open-skill-BXh-h1Gy.js} +1 -1
  97. package/dist/public/assets/{use-popular-skills-CkOc4ZFI.js → use-popular-skills-Dzx69gvR.js} +1 -1
  98. package/dist/public/assets/{use-settings-route-BzQtFbVz.js → use-settings-route-DT_sDrP6.js} +1 -1
  99. package/dist/public/assets/{use-skill-origin-BM7aK7w5.js → use-skill-origin-djszP4BX.js} +1 -1
  100. package/dist/public/assets/{use-terminal-enabled-mj1HMZEE.js → use-terminal-enabled-D8pfw24f.js} +1 -1
  101. package/dist/public/assets/{use-timeline-entry-diff-eQroikMP.js → use-timeline-entry-diff-CJndzyXq.js} +1 -1
  102. package/dist/public/assets/{use-workspace-uQYd5g6N.js → use-workspace-DanpYgc9.js} +1 -1
  103. package/dist/public/index.html +45 -45
  104. package/dist/public/uninstall.html +3 -3
  105. package/dist/{repair-launch-json-BCz2SZyH.mjs → repair-launch-json-CSJT9xyg.mjs} +2 -2
  106. package/dist/{repair-mcp-configs-NcGaQH45.mjs → repair-mcp-configs-DHHaYqN1.mjs} +2 -2
  107. package/dist/{repair-skills-CGrC_7UB.mjs → repair-skills-DTu-V4yJ.mjs} +2 -2
  108. package/dist/repair-skills-DpzyUqvM.mjs +1 -0
  109. package/dist/{resolve-project-root--qXrA21F.mjs → resolve-project-root-CjlK19bg.mjs} +2 -2
  110. package/dist/schemas/v0/config.project.schema.json +2 -36
  111. package/dist/server-lock-BZd8WJ5h.mjs +1 -0
  112. package/dist/{server-lock-BbnnWHQ-.mjs → server-lock-D3OwE6nq.mjs} +2 -2
  113. package/dist/{skill-teardown-BOfnXWGl.mjs → skill-teardown-dynTQKdJ.mjs} +2 -2
  114. package/dist/{sleep-CEs13Om_.mjs → sleep-DXvB05wr.mjs} +5 -5
  115. package/dist/src-BgcwWUW8.mjs +1 -0
  116. package/dist/{src-D8oYpCos.mjs → src-D81I39eV.mjs} +3 -3
  117. package/dist/{src-CUzcBQEu.mjs → src-DC0dXNgq.mjs} +248 -248
  118. package/dist/{src-oOfi47J8.mjs → src-DRQtLkln.mjs} +1 -1
  119. package/dist/src-UoW_X1C6.mjs +357 -0
  120. package/dist/start-CZTOPPJD.mjs +1 -0
  121. package/dist/start-Cxm5f8Vn.mjs +4 -0
  122. package/package.json +4 -4
  123. package/dist/constants-BfbnQ1zg.mjs +0 -2
  124. package/dist/fs-traced-C9RP1mJ2.mjs +0 -1
  125. package/dist/git-handle-B8IJwypU.mjs +0 -1
  126. package/dist/init-CyJV_J-z.mjs +0 -1
  127. package/dist/loader-DZrXpupn.mjs +0 -1
  128. package/dist/md-manager-CE7LjnX6.mjs +0 -2
  129. package/dist/preview-8qVct0-k.mjs +0 -1
  130. package/dist/public/assets/FeedbackForm-D_sc5CWU.js +0 -1
  131. package/dist/public/assets/ManagedArtifactProperties-DqkbIYRf.js +0 -1
  132. package/dist/public/assets/client-version-B8t572qZ.js +0 -1
  133. package/dist/public/assets/i18n-BphO6l4i.js +0 -1
  134. package/dist/repair-skills-Bxm3hryZ.mjs +0 -1
  135. package/dist/server-lock-DAYx4_kR.mjs +0 -1
  136. package/dist/src-RQsLXRLR.mjs +0 -1
  137. package/dist/src-_JbAf6nM.mjs +0 -357
  138. package/dist/start-AtCGtYSd.mjs +0 -1
  139. package/dist/start-BGvZNtV7.mjs +0 -8
@@ -1,7 +1,7 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./markdownit-BZnioq-C.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
2
2
  import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-CYidjpOJ.js";import{t as o}from"./preload-helper-Chd9yIcd.js";import{t as s}from"./trace-api-CUqficfR.js";import{t as c}from"./status-BO9JLhw4.js";import{A as l,C as u,D as d,E as f,F as p,G as m,H as h,I as g,J as _,K as v,L as y,M as b,N as x,O as S,P as C,R as w,S as T,T as E,U as D,V as ee,X as te,Y as ne,_ as re,a as ie,at as ae,b as oe,c as se,d as ce,f as O,g as le,h as ue,i as de,it as k,j as A,k as fe,l as pe,m as me,n as he,o as ge,p as _e,q as ve,s as ye,t as be,tt as xe,u as Se,v as Ce,w as we,x as Te,y as Ee}from"./lib-CGuuJXlL.js";import{n as De,t as Oe}from"./w3c-keyname-DlL_314g.js";import{i as ke,n as Ae,r as je}from"./html-void-elements-Biw85x38.js";import{n as Me,r as Ne,t as Pe}from"./lib-BoSom6iA.js";import{n as Fe,t as Ie}from"./markdownit-BZnioq-C.js";var Le;function j(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Re=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ze=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Le=globalThis).__zod_globalConfig??(Le.__zod_globalConfig={});var Be=globalThis.__zod_globalConfig;function Ve(e){return e&&Object.assign(Be,e),Be}function He(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ue(e,t){return typeof t==`bigint`?t.toString():t}function We(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Ge(e){return e==null}function Ke(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function qe(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Je=Symbol(`evaluating`);function Ye(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Je)return r===void 0&&(r=Je,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Xe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ze(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Qe(e){return JSON.stringify(e)}function $e(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var et=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function tt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var nt=We(()=>{if(Be.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function rt(e){if(tt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(tt(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function it(e){return rt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var eee=new Set([`string`,`number`,`symbol`]);function at(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ot(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function M(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function st(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ct={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function lt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return ot(e,Ze(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Xe(this,`shape`,e),e},checks:[]}))}function ut(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return ot(e,Ze(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Xe(this,`shape`,r),r},checks:[]}))}function dt(e,t){if(!rt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ot(e,Ze(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Xe(this,`shape`,n),n}}))}function ft(e,t){if(!rt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ot(e,Ze(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Xe(this,`shape`,n),n}}))}function pt(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return ot(e,Ze(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Xe(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function mt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return ot(t,Ze(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Xe(this,`shape`,i),i},checks:[]}))}function ht(e,t,n){return ot(t,Ze(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Xe(this,`shape`,i),i}}))}function gt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function _t(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function vt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function yt(e){return typeof e==`string`?e:e?.message}function bt(e,t,n){let r=e.message?e.message:yt(e.inst?._zod.def?.error?.(e))??yt(t?.error?.(e))??yt(n.customError?.(e))??yt(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function xt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function St(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ct=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ue,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},wt=j(`$ZodError`,Ct),Tt=j(`$ZodError`,Ct,{Parent:Error});function Et(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Dt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Ot=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Re;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>bt(e,a,Ve())));throw et(t,i?.callee),t}return o.value},kt=Ot(Tt),At=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>bt(e,a,Ve())));throw et(t,i?.callee),t}return o.value},jt=At(Tt),Mt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Re;return a.issues.length?{success:!1,error:new(e??wt)(a.issues.map(e=>bt(e,i,Ve())))}:{success:!0,data:a.value}},Nt=Mt(Tt),Pt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>bt(e,i,Ve())))}:{success:!0,data:a.value}},tee=Pt(Tt),nee=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ot(e)(t,n,i)},ree=e=>(t,n,r)=>Ot(e)(t,n,r),iee=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return At(e)(t,n,i)},aee=e=>async(t,n,r)=>At(e)(t,n,r),oee=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Mt(e)(t,n,i)},see=e=>(t,n,r)=>Mt(e)(t,n,r),cee=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Pt(e)(t,n,i)},lee=e=>async(t,n,r)=>Pt(e)(t,n,r),uee=/^[cC][0-9a-z]{6,}$/,dee=/^[0-9a-z]+$/,fee=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pee=/^[0-9a-vA-V]{20}$/,mee=/^[A-Za-z0-9]{27}$/,hee=/^[a-zA-Z0-9_-]{21}$/,gee=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_ee=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ft=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,It=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Lt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Rt(){return new RegExp(Lt,`u`)}var zt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Vt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ht=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ut=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wt=/^[A-Za-z0-9_-]*$/,Gt=/^https?$/,Kt=/^\+[1-9]\d{6,14}$/,qt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Jt=RegExp(`^${qt}$`);function Yt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Xt(e){return RegExp(`^${Yt(e)}$`)}function Zt(e){let t=Yt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${qt}T(?:${r})$`)}var Qt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},$t=/^-?\d+$/,en=/^-?\d+(?:\.\d+)?$/,tn=/^(?:true|false)$/i,nn=/^null$/i,rn=/^[^A-Z]*$/,an=/^[^a-z]*$/,on=j(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),sn={number:`number`,bigint:`bigint`,object:`date`},cn=j(`$ZodCheckLessThan`,(e,t)=>{on.init(e,t);let n=sn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ln=j(`$ZodCheckGreaterThan`,(e,t)=>{on.init(e,t);let n=sn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=j(`$ZodCheckMultipleOf`,(e,t)=>{on.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):qe(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),dn=j(`$ZodCheckNumberFormat`,(e,t)=>{on.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ct[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=$t)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),fn=j(`$ZodCheckMaxLength`,(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ge(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=xt(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pn=j(`$ZodCheckMinLength`,(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ge(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=xt(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mn=j(`$ZodCheckLengthEquals`,(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ge(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=xt(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),hn=j(`$ZodCheckStringFormat`,(e,t)=>{var n,r;on.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),gn=j(`$ZodCheckRegex`,(e,t)=>{hn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_n=j(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=rn,hn.init(e,t)}),vn=j(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=an,hn.init(e,t)}),yn=j(`$ZodCheckIncludes`,(e,t)=>{on.init(e,t);let n=at(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),bn=j(`$ZodCheckStartsWith`,(e,t)=>{on.init(e,t);let n=RegExp(`^${at(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),xn=j(`$ZodCheckEndsWith`,(e,t)=>{on.init(e,t);let n=RegExp(`.*${at(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Sn=j(`$ZodCheckOverwrite`,(e,t)=>{on.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Cn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
3
3
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
4
- `))}},wn={major:4,minor:4,patch:3},Tn=j(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=gt(e),i;for(let a of t){if(a._zod.def.when){if(_t(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Re;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=gt(e,t))});else{if(e.issues.length===t)continue;r||=gt(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(gt(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Re;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Re;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Ye(e,`~standard`,()=>({validate:t=>{try{let n=Nt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return tee(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),En=j(`$ZodString`,(e,t)=>{Tn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Dn=j(`$ZodStringFormat`,(e,t)=>{hn.init(e,t),En.init(e,t)}),On=j(`$ZodGUID`,(e,t)=>{t.pattern??=_ee,Dn.init(e,t)}),kn=j(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ft(e)}else t.pattern??=Ft();Dn.init(e,t)}),An=j(`$ZodEmail`,(e,t)=>{t.pattern??=It,Dn.init(e,t)}),jn=j(`$ZodURL`,(e,t)=>{Dn.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Gt.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Mn=j(`$ZodEmoji`,(e,t)=>{t.pattern??=Rt(),Dn.init(e,t)}),Nn=j(`$ZodNanoID`,(e,t)=>{t.pattern??=hee,Dn.init(e,t)}),Pn=j(`$ZodCUID`,(e,t)=>{t.pattern??=uee,Dn.init(e,t)}),Fn=j(`$ZodCUID2`,(e,t)=>{t.pattern??=dee,Dn.init(e,t)}),In=j(`$ZodULID`,(e,t)=>{t.pattern??=fee,Dn.init(e,t)}),Ln=j(`$ZodXID`,(e,t)=>{t.pattern??=pee,Dn.init(e,t)}),Rn=j(`$ZodKSUID`,(e,t)=>{t.pattern??=mee,Dn.init(e,t)}),zn=j(`$ZodISODateTime`,(e,t)=>{t.pattern??=Zt(t),Dn.init(e,t)}),Bn=j(`$ZodISODate`,(e,t)=>{t.pattern??=Jt,Dn.init(e,t)}),Vn=j(`$ZodISOTime`,(e,t)=>{t.pattern??=Xt(t),Dn.init(e,t)}),Hn=j(`$ZodISODuration`,(e,t)=>{t.pattern??=gee,Dn.init(e,t)}),Un=j(`$ZodIPv4`,(e,t)=>{t.pattern??=zt,Dn.init(e,t),e._zod.bag.format=`ipv4`}),Wn=j(`$ZodIPv6`,(e,t)=>{t.pattern??=Bt,Dn.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Gn=j(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Vt,Dn.init(e,t)}),Kn=j(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ht,Dn.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function qn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Jn=j(`$ZodBase64`,(e,t)=>{t.pattern??=Ut,Dn.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{qn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Yn(e){if(!Wt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return qn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Xn=j(`$ZodBase64URL`,(e,t)=>{t.pattern??=Wt,Dn.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Yn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Zn=j(`$ZodE164`,(e,t)=>{t.pattern??=Kt,Dn.init(e,t)});function Qn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var $n=j(`$ZodJWT`,(e,t)=>{Dn.init(e,t),e._zod.check=n=>{Qn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),er=j(`$ZodNumber`,(e,t)=>{Tn.init(e,t),e._zod.pattern=e._zod.bag.pattern??en,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),tr=j(`$ZodNumberFormat`,(e,t)=>{dn.init(e,t),er.init(e,t)}),nr=j(`$ZodBoolean`,(e,t)=>{Tn.init(e,t),e._zod.pattern=tn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),rr=j(`$ZodNull`,(e,t)=>{Tn.init(e,t),e._zod.pattern=nn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),ir=j(`$ZodUnknown`,(e,t)=>{Tn.init(e,t),e._zod.parse=e=>e}),ar=j(`$ZodNever`,(e,t)=>{Tn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function or(e,t,n){e.issues.length&&t.issues.push(...vt(n,e.issues)),t.value[n]=e.value}var sr=j(`$ZodArray`,(e,t)=>{Tn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>or(t,n,e))):or(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function cr(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...vt(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function lr(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=st(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ur(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>cr(e,n,i,t,u,d))):cr(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var dr=j(`$ZodObject`,(e,t)=>{if(Tn.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=We(()=>lr(t));Ye(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=tt,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>cr(n,t,e,s,r,i))):cr(a,t,e,s,r,i)}return i?ur(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),fr=j(`$ZodObjectJIT`,(e,t)=>{dr.init(e,t);let n=e._zod.parse,r=We(()=>lr(t)),i=e=>{let t=new Cn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Qe(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Qe(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
4
+ `))}},wn={major:4,minor:4,patch:3},Tn=j(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=gt(e),i;for(let a of t){if(a._zod.def.when){if(_t(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Re;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=gt(e,t))});else{if(e.issues.length===t)continue;r||=gt(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(gt(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Re;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Re;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Ye(e,`~standard`,()=>({validate:t=>{try{let n=Nt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return tee(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),En=j(`$ZodString`,(e,t)=>{Tn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Dn=j(`$ZodStringFormat`,(e,t)=>{hn.init(e,t),En.init(e,t)}),On=j(`$ZodGUID`,(e,t)=>{t.pattern??=_ee,Dn.init(e,t)}),kn=j(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ft(e)}else t.pattern??=Ft();Dn.init(e,t)}),An=j(`$ZodEmail`,(e,t)=>{t.pattern??=It,Dn.init(e,t)}),jn=j(`$ZodURL`,(e,t)=>{Dn.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Gt.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Mn=j(`$ZodEmoji`,(e,t)=>{t.pattern??=Rt(),Dn.init(e,t)}),Nn=j(`$ZodNanoID`,(e,t)=>{t.pattern??=hee,Dn.init(e,t)}),Pn=j(`$ZodCUID`,(e,t)=>{t.pattern??=uee,Dn.init(e,t)}),Fn=j(`$ZodCUID2`,(e,t)=>{t.pattern??=dee,Dn.init(e,t)}),In=j(`$ZodULID`,(e,t)=>{t.pattern??=fee,Dn.init(e,t)}),Ln=j(`$ZodXID`,(e,t)=>{t.pattern??=pee,Dn.init(e,t)}),Rn=j(`$ZodKSUID`,(e,t)=>{t.pattern??=mee,Dn.init(e,t)}),zn=j(`$ZodISODateTime`,(e,t)=>{t.pattern??=Zt(t),Dn.init(e,t)}),Bn=j(`$ZodISODate`,(e,t)=>{t.pattern??=Jt,Dn.init(e,t)}),Vn=j(`$ZodISOTime`,(e,t)=>{t.pattern??=Xt(t),Dn.init(e,t)}),Hn=j(`$ZodISODuration`,(e,t)=>{t.pattern??=gee,Dn.init(e,t)}),Un=j(`$ZodIPv4`,(e,t)=>{t.pattern??=zt,Dn.init(e,t),e._zod.bag.format=`ipv4`}),Wn=j(`$ZodIPv6`,(e,t)=>{t.pattern??=Bt,Dn.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Gn=j(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Vt,Dn.init(e,t)}),Kn=j(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ht,Dn.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function qn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Jn=j(`$ZodBase64`,(e,t)=>{t.pattern??=Ut,Dn.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{qn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Yn(e){if(!Wt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return qn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Xn=j(`$ZodBase64URL`,(e,t)=>{t.pattern??=Wt,Dn.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Yn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Zn=j(`$ZodE164`,(e,t)=>{t.pattern??=Kt,Dn.init(e,t)});function Qn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var $n=j(`$ZodJWT`,(e,t)=>{Dn.init(e,t),e._zod.check=n=>{Qn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),er=j(`$ZodNumber`,(e,t)=>{Tn.init(e,t),e._zod.pattern=e._zod.bag.pattern??en,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),tr=j(`$ZodNumberFormat`,(e,t)=>{dn.init(e,t),er.init(e,t)}),nr=j(`$ZodBoolean`,(e,t)=>{Tn.init(e,t),e._zod.pattern=tn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),rr=j(`$ZodNull`,(e,t)=>{Tn.init(e,t),e._zod.pattern=nn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),ir=j(`$ZodUnknown`,(e,t)=>{Tn.init(e,t),e._zod.parse=e=>e}),ar=j(`$ZodNever`,(e,t)=>{Tn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function or(e,t,n){e.issues.length&&t.issues.push(...vt(n,e.issues)),t.value[n]=e.value}var sr=j(`$ZodArray`,(e,t)=>{Tn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>or(t,n,e))):or(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function cr(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...vt(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function lr(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=st(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ur(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>cr(e,n,i,t,u,d))):cr(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var dr=j(`$ZodObject`,(e,t)=>{if(Tn.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=We(()=>lr(t));Ye(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=tt,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>cr(n,t,e,s,r,i))):cr(a,t,e,s,r,i)}return i?ur(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),vee=j(`$ZodObjectJIT`,(e,t)=>{dr.init(e,t);let n=e._zod.parse,r=We(()=>lr(t)),i=e=>{let t=new Cn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Qe(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Qe(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
5
5
  if (${n}.issues.length) {
6
6
  if (${o} in input) {
7
7
  payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
@@ -60,10 +60,10 @@ import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-CYidjpOJ.js";import{t a
60
60
  }
61
61
  }
62
62
 
63
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=tt,s=!Be.jitless,c=s&&nt.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?ur([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function pr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!gt(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>bt(e,r,Ve())))}),t)}var mr=j(`$ZodUnion`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Ye(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Ye(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ye(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Ke(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>pr(t,r,e,i)):pr(o,r,e,i)}}),vee=j(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,mr.init(e,t);let n=e._zod.parse;Ye(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=We(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!tt(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),yee=j(`$ZodIntersection`,(e,t)=>{Tn.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>gr(e,t,n)):gr(e,i,a)}});function hr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(rt(e)&&rt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=hr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=hr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function gr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),gt(e))return e;let o=hr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var bee=j(`$ZodRecord`,(e,t)=>{Tn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!rt(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>bt(e,r,Ve())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...vt(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...vt(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&en.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>bt(e,r,Ve())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...vt(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...vt(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),xee=j(`$ZodEnum`,(e,t)=>{Tn.init(e,t);let n=He(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>eee.has(typeof e)).map(e=>typeof e==`string`?at(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),See=j(`$ZodLiteral`,(e,t)=>{if(Tn.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?at(e):e?at(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Cee=j(`$ZodTransform`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ze(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Re;return n.value=i,n.fallback=!0,n}});function _r(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var vr=j(`$ZodOptional`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Ye(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ye(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ke(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>_r(e,r)):_r(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),wee=j(`$ZodExactOptional`,(e,t)=>{vr.init(e,t),Ye(e._zod,`values`,()=>t.innerType._zod.values),Ye(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Tee=j(`$ZodNullable`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`optin`,()=>t.innerType._zod.optin),Ye(e._zod,`optout`,()=>t.innerType._zod.optout),Ye(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ke(e.source)}|null)$`):void 0}),Ye(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Eee=j(`$ZodDefault`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,Ye(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>yr(e,t)):yr(r,t)}});function yr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Dee=j(`$ZodPrefault`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,Ye(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Oee=j(`$ZodNonOptional`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>br(t,e)):br(i,e)}});function br(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var kee=j(`$ZodCatch`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,Ye(e._zod,`optout`,()=>t.innerType._zod.optout),Ye(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>bt(e,n,Ve()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>bt(e,n,Ve()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),xr=j(`$ZodPipe`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`values`,()=>t.in._zod.values),Ye(e._zod,`optin`,()=>t.in._zod.optin),Ye(e._zod,`optout`,()=>t.out._zod.optout),Ye(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Sr(e,t.in,n)):Sr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Sr(e,t.out,n)):Sr(r,t.out,n)}});function Sr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Aee=j(`$ZodPreprocess`,(e,t)=>{xr.init(e,t)}),jee=j(`$ZodReadonly`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`propValues`,()=>t.innerType._zod.propValues),Ye(e._zod,`values`,()=>t.innerType._zod.values),Ye(e._zod,`optin`,()=>t.innerType?._zod?.optin),Ye(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Cr):Cr(r)}});function Cr(e){return e.value=Object.freeze(e.value),e}var Mee=j(`$ZodLazy`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Ye(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Ye(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Ye(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Ye(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Nee=j(`$ZodCustom`,(e,t)=>{on.init(e,t),Tn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>wr(t,n,r,e));wr(i,n,r,e)}});function wr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(St(e))}}var Tr,Pee=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Er(){return new Pee}(Tr=globalThis).__zod_globalRegistry??(Tr.__zod_globalRegistry=Er());var Dr=globalThis.__zod_globalRegistry;function Fee(e,t){return new e({type:`string`,...M(t)})}function Or(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}function kr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}function Iee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}function Lee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}function Ree(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}function zee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}function Ar(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}function Bee(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}function Vee(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}function Hee(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}function Uee(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}function Wee(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}function Gee(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}function Kee(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}function qee(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}function Jee(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}function jr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}function Mr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}function Nr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}function Pr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}function Fr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}function Ir(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}function Lr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...M(t)})}function Rr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}function zr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}function Br(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}function Vr(e,t){return new e({type:`number`,checks:[],...M(t)})}function Hr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...M(t)})}function Ur(e,t){return new e({type:`boolean`,...M(t)})}function Wr(e,t){return new e({type:`null`,...M(t)})}function Gr(e){return new e({type:`unknown`})}function Kr(e,t){return new e({type:`never`,...M(t)})}function qr(e,t){return new cn({check:`less_than`,...M(t),value:e,inclusive:!1})}function Jr(e,t){return new cn({check:`less_than`,...M(t),value:e,inclusive:!0})}function Yr(e,t){return new ln({check:`greater_than`,...M(t),value:e,inclusive:!1})}function Xr(e,t){return new ln({check:`greater_than`,...M(t),value:e,inclusive:!0})}function Zr(e,t){return new un({check:`multiple_of`,...M(t),value:e})}function Qr(e,t){return new fn({check:`max_length`,...M(t),maximum:e})}function $r(e,t){return new pn({check:`min_length`,...M(t),minimum:e})}function ei(e,t){return new mn({check:`length_equals`,...M(t),length:e})}function ti(e,t){return new gn({check:`string_format`,format:`regex`,...M(t),pattern:e})}function ni(e){return new _n({check:`string_format`,format:`lowercase`,...M(e)})}function ri(e){return new vn({check:`string_format`,format:`uppercase`,...M(e)})}function ii(e,t){return new yn({check:`string_format`,format:`includes`,...M(t),includes:e})}function ai(e,t){return new bn({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}function oi(e,t){return new xn({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}function si(e){return new Sn({check:`overwrite`,tx:e})}function ci(e){return si(t=>t.normalize(e))}function li(){return si(e=>e.trim())}function ui(){return si(e=>e.toLowerCase())}function di(){return si(e=>e.toUpperCase())}function fi(){return si(e=>$e(e))}function pi(e,t,n){return new e({type:`array`,element:t,...M(n)})}function mi(e,t,n){let r=M(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function hi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}function gi(e,t){let n=_i(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(St(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(St(r))}},e(t.value,t)),t);return n}function _i(e,t){let n=new on({check:`custom`,...M(t)});return n._zod.check=e,n}function vi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Dr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function yi(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,yi(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Si(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function bi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
63
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=tt,s=!Be.jitless,c=s&&nt.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?ur([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function fr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!gt(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>bt(e,r,Ve())))}),t)}var pr=j(`$ZodUnion`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Ye(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Ye(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ye(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Ke(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>fr(t,r,e,i)):fr(o,r,e,i)}}),yee=j(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,pr.init(e,t);let n=e._zod.parse;Ye(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=We(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!tt(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),bee=j(`$ZodIntersection`,(e,t)=>{Tn.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>hr(e,t,n)):hr(e,i,a)}});function mr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(rt(e)&&rt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=mr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=mr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function hr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),gt(e))return e;let o=mr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var xee=j(`$ZodRecord`,(e,t)=>{Tn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!rt(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>bt(e,r,Ve())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...vt(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...vt(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&en.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>bt(e,r,Ve())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...vt(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...vt(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),See=j(`$ZodEnum`,(e,t)=>{Tn.init(e,t);let n=He(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>eee.has(typeof e)).map(e=>typeof e==`string`?at(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Cee=j(`$ZodLiteral`,(e,t)=>{if(Tn.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?at(e):e?at(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),wee=j(`$ZodTransform`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ze(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Re;return n.value=i,n.fallback=!0,n}});function gr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var _r=j(`$ZodOptional`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Ye(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ye(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ke(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>gr(e,r)):gr(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Tee=j(`$ZodExactOptional`,(e,t)=>{_r.init(e,t),Ye(e._zod,`values`,()=>t.innerType._zod.values),Ye(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Eee=j(`$ZodNullable`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`optin`,()=>t.innerType._zod.optin),Ye(e._zod,`optout`,()=>t.innerType._zod.optout),Ye(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ke(e.source)}|null)$`):void 0}),Ye(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Dee=j(`$ZodDefault`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,Ye(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>vr(e,t)):vr(r,t)}});function vr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Oee=j(`$ZodPrefault`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,Ye(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),kee=j(`$ZodNonOptional`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>yr(t,e)):yr(i,e)}});function yr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Aee=j(`$ZodCatch`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,Ye(e._zod,`optout`,()=>t.innerType._zod.optout),Ye(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>bt(e,n,Ve()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>bt(e,n,Ve()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),br=j(`$ZodPipe`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`values`,()=>t.in._zod.values),Ye(e._zod,`optin`,()=>t.in._zod.optin),Ye(e._zod,`optout`,()=>t.out._zod.optout),Ye(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>xr(e,t.in,n)):xr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>xr(e,t.out,n)):xr(r,t.out,n)}});function xr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var jee=j(`$ZodPreprocess`,(e,t)=>{br.init(e,t)}),Mee=j(`$ZodReadonly`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`propValues`,()=>t.innerType._zod.propValues),Ye(e._zod,`values`,()=>t.innerType._zod.values),Ye(e._zod,`optin`,()=>t.innerType?._zod?.optin),Ye(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Sr):Sr(r)}});function Sr(e){return e.value=Object.freeze(e.value),e}var Nee=j(`$ZodLazy`,(e,t)=>{Tn.init(e,t),Ye(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Ye(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Ye(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Ye(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Ye(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Pee=j(`$ZodCustom`,(e,t)=>{on.init(e,t),Tn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Cr(t,n,r,e));Cr(i,n,r,e)}});function Cr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(St(e))}}var wr,Fee=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Tr(){return new Fee}(wr=globalThis).__zod_globalRegistry??(wr.__zod_globalRegistry=Tr());var Er=globalThis.__zod_globalRegistry;function Iee(e,t){return new e({type:`string`,...M(t)})}function Dr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}function Or(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}function Lee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}function Ree(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}function zee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}function Bee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}function kr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}function Vee(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}function Hee(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}function Uee(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}function Wee(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}function Gee(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}function Kee(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}function qee(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}function Ar(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}function jr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}function Mr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}function Nr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}function Pr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}function Fr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}function Ir(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}function Lr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}function Rr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...M(t)})}function zr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}function Br(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}function Vr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}function Hr(e,t){return new e({type:`number`,checks:[],...M(t)})}function Ur(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...M(t)})}function Wr(e,t){return new e({type:`boolean`,...M(t)})}function Gr(e,t){return new e({type:`null`,...M(t)})}function Kr(e){return new e({type:`unknown`})}function qr(e,t){return new e({type:`never`,...M(t)})}function Jr(e,t){return new cn({check:`less_than`,...M(t),value:e,inclusive:!1})}function Yr(e,t){return new cn({check:`less_than`,...M(t),value:e,inclusive:!0})}function Xr(e,t){return new ln({check:`greater_than`,...M(t),value:e,inclusive:!1})}function Zr(e,t){return new ln({check:`greater_than`,...M(t),value:e,inclusive:!0})}function Qr(e,t){return new un({check:`multiple_of`,...M(t),value:e})}function $r(e,t){return new fn({check:`max_length`,...M(t),maximum:e})}function ei(e,t){return new pn({check:`min_length`,...M(t),minimum:e})}function ti(e,t){return new mn({check:`length_equals`,...M(t),length:e})}function ni(e,t){return new gn({check:`string_format`,format:`regex`,...M(t),pattern:e})}function ri(e){return new _n({check:`string_format`,format:`lowercase`,...M(e)})}function ii(e){return new vn({check:`string_format`,format:`uppercase`,...M(e)})}function ai(e,t){return new yn({check:`string_format`,format:`includes`,...M(t),includes:e})}function oi(e,t){return new bn({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}function si(e,t){return new xn({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}function ci(e){return new Sn({check:`overwrite`,tx:e})}function li(e){return ci(t=>t.normalize(e))}function ui(){return ci(e=>e.trim())}function di(){return ci(e=>e.toLowerCase())}function fi(){return ci(e=>e.toUpperCase())}function pi(){return ci(e=>$e(e))}function mi(e,t,n){return new e({type:`array`,element:t,...M(n)})}function hi(e,t,n){let r=M(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function gi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}function _i(e,t){let n=vi(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(St(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(St(r))}},e(t.value,t)),t);return n}function vi(e,t){let n=new on({check:`custom`,...M(t)});return n._zod.check=e,n}function yi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Er,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function bi(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,bi(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Ci(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function xi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
64
64
 
65
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function xi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:wi(t,`input`,e.processors),output:wi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Si(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Si(r.element,n);if(r.type===`set`)return Si(r.valueType,n);if(r.type===`lazy`)return Si(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Si(r.innerType,n);if(r.type===`intersection`)return Si(r.left,n)||Si(r.right,n);if(r.type===`record`||r.type===`map`)return Si(r.keyType,n)||Si(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Si(r.in,n)||Si(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Si(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Si(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Si(e,n))return!0;return!!(r.rest&&Si(r.rest,n))}return!1}var Ci=(e,t={})=>n=>{let r=vi({...n,processors:t});return yi(e,r),bi(r,e),xi(r,e)},wi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=vi({...i??{},target:a,io:t,processors:n});return yi(e,o),bi(o,e),xi(o,e)},Ti={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ei=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ti[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Di=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Oi=(e,t,n,r)=>{n.type=`boolean`},ki=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ai=(e,t,n,r)=>{n.not={}},ji=(e,t,n,r)=>{let i=e._zod.def,a=He(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Mi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Ni=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Pi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Fi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=yi(a.element,t,{...r,path:[...r.path,`items`]})},Ii=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=yi(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=yi(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Li=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>yi(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ri=(e,t,n,r)=>{let i=e._zod.def,a=yi(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=yi(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},zi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=yi(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=yi(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=yi(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Bi=(e,t,n,r)=>{let i=e._zod.def,a=yi(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Vi=(e,t,n,r)=>{let i=e._zod.def;yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Hi=(e,t,n,r)=>{let i=e._zod.def;yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ui=(e,t,n,r)=>{let i=e._zod.def;yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Wi=(e,t,n,r)=>{let i=e._zod.def;yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Gi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;yi(o,t,r);let s=t.seen.get(e);s.ref=o},Ki=(e,t,n,r)=>{let i=e._zod.def;yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},qi=(e,t,n,r)=>{let i=e._zod.def;yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ji=(e,t,n,r)=>{let i=e._zod.innerType;yi(i,t,r);let a=t.seen.get(e);a.ref=i},Yi=j(`ZodISODateTime`,(e,t)=>{zn.init(e,t),xa.init(e,t)});function Xi(e){return Lr(Yi,e)}var Zi=j(`ZodISODate`,(e,t)=>{Bn.init(e,t),xa.init(e,t)});function Qi(e){return Rr(Zi,e)}var $i=j(`ZodISOTime`,(e,t)=>{Vn.init(e,t),xa.init(e,t)});function ea(e){return zr($i,e)}var ta=j(`ZodISODuration`,(e,t)=>{Hn.init(e,t),xa.init(e,t)});function na(e){return Br(ta,e)}var ra=j(`ZodError`,(e,t)=>{wt.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Dt(e,t)},flatten:{value:t=>Et(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ue,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ue,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),ia=Ot(ra),aa=At(ra),oa=Mt(ra),sa=Pt(ra),ca=nee(ra),la=ree(ra),ua=iee(ra),da=aee(ra),fa=oee(ra),pa=see(ra),ma=cee(ra),ha=lee(ra),ga=new WeakMap;function _a(e,t,n){let r=Object.getPrototypeOf(e),i=ga.get(r);if(i||(i=new Set,ga.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var va=j(`ZodType`,(e,t)=>(Tn.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:wi(e,`input`),output:wi(e,`output`)}}),e.toJSONSchema=Ci(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>ia(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>oa(e,t,n),e.parseAsync=async(t,n)=>aa(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>sa(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ca(e,t,n),e.decode=(t,n)=>la(e,t,n),e.encodeAsync=async(t,n)=>ua(e,t,n),e.decodeAsync=async(t,n)=>da(e,t,n),e.safeEncode=(t,n)=>fa(e,t,n),e.safeDecode=(t,n)=>pa(e,t,n),e.safeEncodeAsync=async(t,n)=>ma(e,t,n),e.safeDecodeAsync=async(t,n)=>ha(e,t,n),_a(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ze(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ot(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Lo(e,t))},superRefine(e,t){return this.check(Ro(e,t))},overwrite(e){return this.check(si(e))},optional(){return ho(this)},exactOptional(){return _o(this)},nullable(){return yo(this)},nullish(){return ho(yo(this))},nonoptional(e){return To(this,e)},array(){return I(this)},or(e){return no([this,e])},and(e){return oo(this,e)},transform(e){return ko(this,po(e))},default(e){return xo(this,e)},prefault(e){return Co(this,e)},catch(e){return Do(this,e)},pipe(e){return ko(this,e)},readonly(){return Mo(this)},describe(e){let t=this.clone();return Dr.add(t,{description:e}),t},meta(...e){if(e.length===0)return Dr.get(this);let t=this.clone();return Dr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return Dr.get(e)?.description},configurable:!0}),e)),ya=j(`_ZodString`,(e,t)=>{En.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,_a(e,`_ZodString`,{regex(...e){return this.check(ti(...e))},includes(...e){return this.check(ii(...e))},startsWith(...e){return this.check(ai(...e))},endsWith(...e){return this.check(oi(...e))},min(...e){return this.check($r(...e))},max(...e){return this.check(Qr(...e))},length(...e){return this.check(ei(...e))},nonempty(...e){return this.check($r(1,...e))},lowercase(e){return this.check(ni(e))},uppercase(e){return this.check(ri(e))},trim(){return this.check(li())},normalize(...e){return this.check(ci(...e))},toLowerCase(){return this.check(ui())},toUpperCase(){return this.check(di())},slugify(){return this.check(fi())}})}),ba=j(`ZodString`,(e,t)=>{En.init(e,t),ya.init(e,t),e.email=t=>e.check(Or(Sa,t)),e.url=t=>e.check(Ar(Ea,t)),e.jwt=t=>e.check(Ir(Ha,t)),e.emoji=t=>e.check(Bee(Oa,t)),e.guid=t=>e.check(kr(wa,t)),e.uuid=t=>e.check(Iee(Ta,t)),e.uuidv4=t=>e.check(Lee(Ta,t)),e.uuidv6=t=>e.check(Ree(Ta,t)),e.uuidv7=t=>e.check(zee(Ta,t)),e.nanoid=t=>e.check(Vee(ka,t)),e.guid=t=>e.check(kr(wa,t)),e.cuid=t=>e.check(Hee(Aa,t)),e.cuid2=t=>e.check(Uee(ja,t)),e.ulid=t=>e.check(Wee(Ma,t)),e.base64=t=>e.check(Nr(za,t)),e.base64url=t=>e.check(Pr(Ba,t)),e.xid=t=>e.check(Gee(Na,t)),e.ksuid=t=>e.check(Kee(Pa,t)),e.ipv4=t=>e.check(qee(Fa,t)),e.ipv6=t=>e.check(Jee(Ia,t)),e.cidrv4=t=>e.check(jr(La,t)),e.cidrv6=t=>e.check(Mr(Ra,t)),e.e164=t=>e.check(Fr(Va,t)),e.datetime=t=>e.check(Xi(t)),e.date=t=>e.check(Qi(t)),e.time=t=>e.check(ea(t)),e.duration=t=>e.check(na(t))});function N(e){return Fee(ba,e)}var xa=j(`ZodStringFormat`,(e,t)=>{Dn.init(e,t),ya.init(e,t)}),Sa=j(`ZodEmail`,(e,t)=>{An.init(e,t),xa.init(e,t)});function Ca(e){return Or(Sa,e)}var wa=j(`ZodGUID`,(e,t)=>{On.init(e,t),xa.init(e,t)}),Ta=j(`ZodUUID`,(e,t)=>{kn.init(e,t),xa.init(e,t)}),Ea=j(`ZodURL`,(e,t)=>{jn.init(e,t),xa.init(e,t)});function Da(e){return Ar(Ea,e)}var Oa=j(`ZodEmoji`,(e,t)=>{Mn.init(e,t),xa.init(e,t)}),ka=j(`ZodNanoID`,(e,t)=>{Nn.init(e,t),xa.init(e,t)}),Aa=j(`ZodCUID`,(e,t)=>{Pn.init(e,t),xa.init(e,t)}),ja=j(`ZodCUID2`,(e,t)=>{Fn.init(e,t),xa.init(e,t)}),Ma=j(`ZodULID`,(e,t)=>{In.init(e,t),xa.init(e,t)}),Na=j(`ZodXID`,(e,t)=>{Ln.init(e,t),xa.init(e,t)}),Pa=j(`ZodKSUID`,(e,t)=>{Rn.init(e,t),xa.init(e,t)}),Fa=j(`ZodIPv4`,(e,t)=>{Un.init(e,t),xa.init(e,t)}),Ia=j(`ZodIPv6`,(e,t)=>{Wn.init(e,t),xa.init(e,t)}),La=j(`ZodCIDRv4`,(e,t)=>{Gn.init(e,t),xa.init(e,t)}),Ra=j(`ZodCIDRv6`,(e,t)=>{Kn.init(e,t),xa.init(e,t)}),za=j(`ZodBase64`,(e,t)=>{Jn.init(e,t),xa.init(e,t)}),Ba=j(`ZodBase64URL`,(e,t)=>{Xn.init(e,t),xa.init(e,t)}),Va=j(`ZodE164`,(e,t)=>{Zn.init(e,t),xa.init(e,t)}),Ha=j(`ZodJWT`,(e,t)=>{$n.init(e,t),xa.init(e,t)}),Ua=j(`ZodNumber`,(e,t)=>{er.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),_a(e,`ZodNumber`,{gt(e,t){return this.check(Yr(e,t))},gte(e,t){return this.check(Xr(e,t))},min(e,t){return this.check(Xr(e,t))},lt(e,t){return this.check(qr(e,t))},lte(e,t){return this.check(Jr(e,t))},max(e,t){return this.check(Jr(e,t))},int(e){return this.check(Ga(e))},safe(e){return this.check(Ga(e))},positive(e){return this.check(Yr(0,e))},nonnegative(e){return this.check(Xr(0,e))},negative(e){return this.check(qr(0,e))},nonpositive(e){return this.check(Jr(0,e))},multipleOf(e,t){return this.check(Zr(e,t))},step(e,t){return this.check(Zr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function P(e){return Vr(Ua,e)}var Wa=j(`ZodNumberFormat`,(e,t)=>{tr.init(e,t),Ua.init(e,t)});function Ga(e){return Hr(Wa,e)}var Ka=j(`ZodBoolean`,(e,t)=>{nr.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r)});function F(e){return Ur(Ka,e)}var qa=j(`ZodNull`,(e,t)=>{rr.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r)});function Ja(e){return Wr(qa,e)}var Ya=j(`ZodUnknown`,(e,t)=>{ir.init(e,t),va.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Xa(){return Gr(Ya)}var Za=j(`ZodNever`,(e,t)=>{ar.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r)});function Qa(e){return Kr(Za,e)}var $a=j(`ZodArray`,(e,t)=>{sr.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.element=t.element,_a(e,`ZodArray`,{min(e,t){return this.check($r(e,t))},nonempty(e){return this.check($r(1,e))},max(e,t){return this.check(Qr(e,t))},length(e,t){return this.check(ei(e,t))},unwrap(){return this.element}})});function I(e,t){return pi($a,e,t)}var eo=j(`ZodObject`,(e,t)=>{fr.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),Ye(e,`shape`,()=>t.shape),_a(e,`ZodObject`,{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Xa()})},loose(){return this.clone({...this._zod.def,catchall:Xa()})},strict(){return this.clone({...this._zod.def,catchall:Qa()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return dt(this,e)},safeExtend(e){return ft(this,e)},merge(e){return pt(this,e)},pick(e){return lt(this,e)},omit(e){return ut(this,e)},partial(...e){return mt(mo,this,e[0])},required(...e){return ht(wo,this,e[0])}})});function L(e,t){return new eo({type:`object`,shape:e??{},...M(t)})}function R(e,t){return new eo({type:`object`,shape:e,catchall:Xa(),...M(t)})}var to=j(`ZodUnion`,(e,t)=>{mr.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),e.options=t.options});function no(e,t){return new to({type:`union`,options:e,...M(t)})}var ro=j(`ZodDiscriminatedUnion`,(e,t)=>{to.init(e,t),vee.init(e,t)});function io(e,t,n){return new ro({type:`union`,options:t,discriminator:e,...M(n)})}var ao=j(`ZodIntersection`,(e,t)=>{yee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r)});function oo(e,t){return new ao({type:`intersection`,left:e,right:t})}var so=j(`ZodRecord`,(e,t)=>{bee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function co(e,t,n){return!t||!t._zod?new so({type:`record`,keyType:N(),valueType:e,...M(t)}):new so({type:`record`,keyType:e,valueType:t,...M(n)})}var lo=j(`ZodEnum`,(e,t)=>{xee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new lo({...t,checks:[],...M(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new lo({...t,checks:[],...M(r),entries:i})}});function z(e,t){return new lo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...M(t)})}var uo=j(`ZodLiteral`,(e,t)=>{See.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function B(e,t){return new uo({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}var fo=j(`ZodTransform`,(e,t)=>{Cee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ze(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(St(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(St(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function po(e){return new fo({type:`transform`,transform:e})}var mo=j(`ZodOptional`,(e,t)=>{vr.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ho(e){return new mo({type:`optional`,innerType:e})}var go=j(`ZodExactOptional`,(e,t)=>{wee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _o(e){return new go({type:`optional`,innerType:e})}var vo=j(`ZodNullable`,(e,t)=>{Tee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yo(e){return new vo({type:`nullable`,innerType:e})}var bo=j(`ZodDefault`,(e,t)=>{Eee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xo(e,t){return new bo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():it(t)}})}var So=j(`ZodPrefault`,(e,t)=>{Dee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Co(e,t){return new So({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():it(t)}})}var wo=j(`ZodNonOptional`,(e,t)=>{Oee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function To(e,t){return new wo({type:`nonoptional`,innerType:e,...M(t)})}var Eo=j(`ZodCatch`,(e,t)=>{kee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Do(e,t){return new Eo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Oo=j(`ZodPipe`,(e,t)=>{xr.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.in=t.in,e.out=t.out});function ko(e,t){return new Oo({type:`pipe`,in:e,out:t})}var Ao=j(`ZodPreprocess`,(e,t)=>{Oo.init(e,t),Aee.init(e,t)}),jo=j(`ZodReadonly`,(e,t)=>{jee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mo(e){return new jo({type:`readonly`,innerType:e})}var No=j(`ZodLazy`,(e,t)=>{Mee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Po(e){return new No({type:`lazy`,getter:e})}var Fo=j(`ZodCustom`,(e,t)=>{Nee.init(e,t),va.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r)});function Io(e,t){return mi(Fo,e??(()=>!0),t)}function Lo(e,t={}){return hi(Fo,e,t)}function Ro(e,t){return gi(e,t)}function zo(e,t={}){let n=new Fo({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...M(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Bo(e,t){return new Ao({type:`pipe`,in:po(e),out:t})}var Vo=Symbol.for(`yaml.alias`),Ho=Symbol.for(`yaml.document`),Uo=Symbol.for(`yaml.map`),Wo=Symbol.for(`yaml.pair`),Go=Symbol.for(`yaml.scalar`),Ko=Symbol.for(`yaml.seq`),qo=Symbol.for(`yaml.node.type`),Jo=e=>!!e&&typeof e==`object`&&e[qo]===Vo,Yo=e=>!!e&&typeof e==`object`&&e[qo]===Ho,Xo=e=>!!e&&typeof e==`object`&&e[qo]===Uo,Zo=e=>!!e&&typeof e==`object`&&e[qo]===Wo,Qo=e=>!!e&&typeof e==`object`&&e[qo]===Go,$o=e=>!!e&&typeof e==`object`&&e[qo]===Ko;function es(e){if(e&&typeof e==`object`)switch(e[qo]){case Uo:case Ko:return!0}return!1}function ts(e){if(e&&typeof e==`object`)switch(e[qo]){case Vo:case Uo:case Go:case Ko:return!0}return!1}var ns=e=>(Qo(e)||es(e))&&!!e.anchor,rs=Symbol(`break visit`),is=Symbol(`skip children`),as=Symbol(`remove node`);function ss(e,t){let n=ds(t);Yo(e)?cs(null,e.contents,n,Object.freeze([e]))===as&&(e.contents=null):cs(null,e,n,Object.freeze([]))}ss.BREAK=rs,ss.SKIP=is,ss.REMOVE=as;function cs(e,t,n,r){let i=fs(e,t,n,r);if(ts(i)||Zo(i))return ps(e,r,i),cs(e,i,n,r);if(typeof i!=`symbol`){if(es(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=cs(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===rs)return rs;else i===as&&(t.items.splice(e,1),--e)}}else if(Zo(t)){r=Object.freeze(r.concat(t));let e=cs(`key`,t.key,n,r);if(e===rs)return rs;e===as&&(t.key=null);let i=cs(`value`,t.value,n,r);if(i===rs)return rs;i===as&&(t.value=null)}}return i}async function ls(e,t){let n=ds(t);Yo(e)?await us(null,e.contents,n,Object.freeze([e]))===as&&(e.contents=null):await us(null,e,n,Object.freeze([]))}ls.BREAK=rs,ls.SKIP=is,ls.REMOVE=as;async function us(e,t,n,r){let i=await fs(e,t,n,r);if(ts(i)||Zo(i))return ps(e,r,i),us(e,i,n,r);if(typeof i!=`symbol`){if(es(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await us(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===rs)return rs;else i===as&&(t.items.splice(e,1),--e)}}else if(Zo(t)){r=Object.freeze(r.concat(t));let e=await us(`key`,t.key,n,r);if(e===rs)return rs;e===as&&(t.key=null);let i=await us(`value`,t.value,n,r);if(i===rs)return rs;i===as&&(t.value=null)}}return i}function ds(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function fs(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Xo(t))return n.Map?.(e,t,r);if($o(t))return n.Seq?.(e,t,r);if(Zo(t))return n.Pair?.(e,t,r);if(Qo(t))return n.Scalar?.(e,t,r);if(Jo(t))return n.Alias?.(e,t,r)}function ps(e,t,n){let r=t[t.length-1];if(es(r))r.items[e]=n;else if(Zo(r))e===`key`?r.key=n:r.value=n;else if(Yo(r))r.contents=n;else{let e=Jo(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var ms={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},hs=e=>e.replace(/[!,[\]{}]/g,e=>ms[e]),gs=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+hs(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&ts(e.contents)){let t={};ss(e.contents,(e,n)=>{ts(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
66
- `)}};gs.defaultYaml={explicit:!1,version:`1.2`},gs.defaultTags={"!!":`tag:yaml.org,2002:`};function _s(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function vs(e){let t=new Set;return ss(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function ys(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Yee(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=vs(e);let a=ys(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(Qo(t.node)||es(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function bs(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=bs(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=bs(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=bs(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=bs(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function xs(e,t,n){if(Array.isArray(e))return e.map((e,t)=>xs(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ns(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Ss=class{constructor(e){Object.defineProperty(this,qo,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Yo(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=xs(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?bs(i,{"":o},``,o):o}},Cs=class extends Ss{constructor(e){super(Vo),this.source=e,Object.defineProperty(this,`tag`,{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ss(e,{Node:(e,t)=>{(Jo(t)||ns(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(xs(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ws(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(_s(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ws(e,t,n){if(Jo(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(es(t)){let r=0;for(let i of t.items){let t=ws(e,i,n);t>r&&(r=t)}return r}else if(Zo(t)){let r=ws(e,t.key,n),i=ws(e,t.value,n);return Math.max(r,i)}return 1}var Ts=e=>!e||typeof e!=`function`&&typeof e!=`object`,V=class extends Ss{constructor(e){super(Go),this.value=e}toJSON(e,t){return t?.keep?this.value:xs(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.QUOTE_SINGLE=`QUOTE_SINGLE`;var Xee=`tag:yaml.org,2002:`;function Zee(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Es(e,t,n){if(Yo(e)&&(e=e.contents),ts(e))return e;if(Zo(e)){let t=n.schema[Uo].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new Cs(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Xee+t.slice(2));let l=Zee(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new V(e);return c&&(c.node=t),t}l=e instanceof Map?o[Uo]:Symbol.iterator in Object(e)?o[Ko]:o[Uo]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new V(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ds(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Es(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var Os=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,ks=class extends Ss{constructor(e,t){super(e),Object.defineProperty(this,`schema`,{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>ts(t)||Zo(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Os(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(es(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ds(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(es(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&Qo(i)?i.value:i:es(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Zo(t))return!1;let n=t.value;return n==null||e&&Qo(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return es(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(es(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ds(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Qee=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function As(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var js=(e,t,n)=>e.endsWith(`
65
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Si(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Ti(t,`input`,e.processors),output:Ti(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ci(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Ci(r.element,n);if(r.type===`set`)return Ci(r.valueType,n);if(r.type===`lazy`)return Ci(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Ci(r.innerType,n);if(r.type===`intersection`)return Ci(r.left,n)||Ci(r.right,n);if(r.type===`record`||r.type===`map`)return Ci(r.keyType,n)||Ci(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ci(r.in,n)||Ci(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ci(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ci(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ci(e,n))return!0;return!!(r.rest&&Ci(r.rest,n))}return!1}var wi=(e,t={})=>n=>{let r=yi({...n,processors:t});return bi(e,r),xi(r,e),Si(r,e)},Ti=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=yi({...i??{},target:a,io:t,processors:n});return bi(e,o),xi(o,e),Si(o,e)},Ei={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Di=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ei[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Oi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},ki=(e,t,n,r)=>{n.type=`boolean`},Ai=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ji=(e,t,n,r)=>{n.not={}},Mi=(e,t,n,r)=>{let i=e._zod.def,a=He(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ni=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Pi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Fi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ii=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=bi(a.element,t,{...r,path:[...r.path,`items`]})},Li=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=bi(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=bi(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ri=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>bi(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},zi=(e,t,n,r)=>{let i=e._zod.def,a=bi(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=bi(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Bi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=bi(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=bi(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=bi(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Vi=(e,t,n,r)=>{let i=e._zod.def,a=bi(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Hi=(e,t,n,r)=>{let i=e._zod.def;bi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ui=(e,t,n,r)=>{let i=e._zod.def;bi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Wi=(e,t,n,r)=>{let i=e._zod.def;bi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Gi=(e,t,n,r)=>{let i=e._zod.def;bi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ki=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;bi(o,t,r);let s=t.seen.get(e);s.ref=o},qi=(e,t,n,r)=>{let i=e._zod.def;bi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ji=(e,t,n,r)=>{let i=e._zod.def;bi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Yi=(e,t,n,r)=>{let i=e._zod.innerType;bi(i,t,r);let a=t.seen.get(e);a.ref=i},Xi=j(`ZodISODateTime`,(e,t)=>{zn.init(e,t),Sa.init(e,t)});function Zi(e){return Rr(Xi,e)}var Qi=j(`ZodISODate`,(e,t)=>{Bn.init(e,t),Sa.init(e,t)});function $i(e){return zr(Qi,e)}var ea=j(`ZodISOTime`,(e,t)=>{Vn.init(e,t),Sa.init(e,t)});function ta(e){return Br(ea,e)}var na=j(`ZodISODuration`,(e,t)=>{Hn.init(e,t),Sa.init(e,t)});function ra(e){return Vr(na,e)}var ia=j(`ZodError`,(e,t)=>{wt.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Dt(e,t)},flatten:{value:t=>Et(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ue,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ue,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),aa=Ot(ia),oa=At(ia),sa=Mt(ia),ca=Pt(ia),la=nee(ia),ua=ree(ia),da=iee(ia),fa=aee(ia),pa=oee(ia),ma=see(ia),ha=cee(ia),ga=lee(ia),_a=new WeakMap;function va(e,t,n){let r=Object.getPrototypeOf(e),i=_a.get(r);if(i||(i=new Set,_a.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var ya=j(`ZodType`,(e,t)=>(Tn.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ti(e,`input`),output:Ti(e,`output`)}}),e.toJSONSchema=wi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>aa(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>sa(e,t,n),e.parseAsync=async(t,n)=>oa(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ca(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>la(e,t,n),e.decode=(t,n)=>ua(e,t,n),e.encodeAsync=async(t,n)=>da(e,t,n),e.decodeAsync=async(t,n)=>fa(e,t,n),e.safeEncode=(t,n)=>pa(e,t,n),e.safeDecode=(t,n)=>ma(e,t,n),e.safeEncodeAsync=async(t,n)=>ha(e,t,n),e.safeDecodeAsync=async(t,n)=>ga(e,t,n),va(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ze(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ot(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ro(e,t))},superRefine(e,t){return this.check(zo(e,t))},overwrite(e){return this.check(ci(e))},optional(){return go(this)},exactOptional(){return vo(this)},nullable(){return bo(this)},nullish(){return go(bo(this))},nonoptional(e){return Eo(this,e)},array(){return I(this)},or(e){return ro([this,e])},and(e){return so(this,e)},transform(e){return Ao(this,mo(e))},default(e){return So(this,e)},prefault(e){return wo(this,e)},catch(e){return Oo(this,e)},pipe(e){return Ao(this,e)},readonly(){return No(this)},describe(e){let t=this.clone();return Er.add(t,{description:e}),t},meta(...e){if(e.length===0)return Er.get(this);let t=this.clone();return Er.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return Er.get(e)?.description},configurable:!0}),e)),ba=j(`_ZodString`,(e,t)=>{En.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,va(e,`_ZodString`,{regex(...e){return this.check(ni(...e))},includes(...e){return this.check(ai(...e))},startsWith(...e){return this.check(oi(...e))},endsWith(...e){return this.check(si(...e))},min(...e){return this.check(ei(...e))},max(...e){return this.check($r(...e))},length(...e){return this.check(ti(...e))},nonempty(...e){return this.check(ei(1,...e))},lowercase(e){return this.check(ri(e))},uppercase(e){return this.check(ii(e))},trim(){return this.check(ui())},normalize(...e){return this.check(li(...e))},toLowerCase(){return this.check(di())},toUpperCase(){return this.check(fi())},slugify(){return this.check(pi())}})}),xa=j(`ZodString`,(e,t)=>{En.init(e,t),ba.init(e,t),e.email=t=>e.check(Dr(Ca,t)),e.url=t=>e.check(kr(Da,t)),e.jwt=t=>e.check(Lr(Ua,t)),e.emoji=t=>e.check(Vee(ka,t)),e.guid=t=>e.check(Or(Ta,t)),e.uuid=t=>e.check(Lee(Ea,t)),e.uuidv4=t=>e.check(Ree(Ea,t)),e.uuidv6=t=>e.check(zee(Ea,t)),e.uuidv7=t=>e.check(Bee(Ea,t)),e.nanoid=t=>e.check(Hee(Aa,t)),e.guid=t=>e.check(Or(Ta,t)),e.cuid=t=>e.check(Uee(ja,t)),e.cuid2=t=>e.check(Wee(Ma,t)),e.ulid=t=>e.check(Gee(Na,t)),e.base64=t=>e.check(Pr(Ba,t)),e.base64url=t=>e.check(Fr(Va,t)),e.xid=t=>e.check(Kee(Pa,t)),e.ksuid=t=>e.check(qee(Fa,t)),e.ipv4=t=>e.check(Ar(Ia,t)),e.ipv6=t=>e.check(jr(La,t)),e.cidrv4=t=>e.check(Mr(Ra,t)),e.cidrv6=t=>e.check(Nr(za,t)),e.e164=t=>e.check(Ir(Ha,t)),e.datetime=t=>e.check(Zi(t)),e.date=t=>e.check($i(t)),e.time=t=>e.check(ta(t)),e.duration=t=>e.check(ra(t))});function N(e){return Iee(xa,e)}var Sa=j(`ZodStringFormat`,(e,t)=>{Dn.init(e,t),ba.init(e,t)}),Ca=j(`ZodEmail`,(e,t)=>{An.init(e,t),Sa.init(e,t)});function wa(e){return Dr(Ca,e)}var Ta=j(`ZodGUID`,(e,t)=>{On.init(e,t),Sa.init(e,t)}),Ea=j(`ZodUUID`,(e,t)=>{kn.init(e,t),Sa.init(e,t)}),Da=j(`ZodURL`,(e,t)=>{jn.init(e,t),Sa.init(e,t)});function Oa(e){return kr(Da,e)}var ka=j(`ZodEmoji`,(e,t)=>{Mn.init(e,t),Sa.init(e,t)}),Aa=j(`ZodNanoID`,(e,t)=>{Nn.init(e,t),Sa.init(e,t)}),ja=j(`ZodCUID`,(e,t)=>{Pn.init(e,t),Sa.init(e,t)}),Ma=j(`ZodCUID2`,(e,t)=>{Fn.init(e,t),Sa.init(e,t)}),Na=j(`ZodULID`,(e,t)=>{In.init(e,t),Sa.init(e,t)}),Pa=j(`ZodXID`,(e,t)=>{Ln.init(e,t),Sa.init(e,t)}),Fa=j(`ZodKSUID`,(e,t)=>{Rn.init(e,t),Sa.init(e,t)}),Ia=j(`ZodIPv4`,(e,t)=>{Un.init(e,t),Sa.init(e,t)}),La=j(`ZodIPv6`,(e,t)=>{Wn.init(e,t),Sa.init(e,t)}),Ra=j(`ZodCIDRv4`,(e,t)=>{Gn.init(e,t),Sa.init(e,t)}),za=j(`ZodCIDRv6`,(e,t)=>{Kn.init(e,t),Sa.init(e,t)}),Ba=j(`ZodBase64`,(e,t)=>{Jn.init(e,t),Sa.init(e,t)}),Va=j(`ZodBase64URL`,(e,t)=>{Xn.init(e,t),Sa.init(e,t)}),Ha=j(`ZodE164`,(e,t)=>{Zn.init(e,t),Sa.init(e,t)}),Ua=j(`ZodJWT`,(e,t)=>{$n.init(e,t),Sa.init(e,t)}),Wa=j(`ZodNumber`,(e,t)=>{er.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),va(e,`ZodNumber`,{gt(e,t){return this.check(Xr(e,t))},gte(e,t){return this.check(Zr(e,t))},min(e,t){return this.check(Zr(e,t))},lt(e,t){return this.check(Jr(e,t))},lte(e,t){return this.check(Yr(e,t))},max(e,t){return this.check(Yr(e,t))},int(e){return this.check(Ka(e))},safe(e){return this.check(Ka(e))},positive(e){return this.check(Xr(0,e))},nonnegative(e){return this.check(Zr(0,e))},negative(e){return this.check(Jr(0,e))},nonpositive(e){return this.check(Yr(0,e))},multipleOf(e,t){return this.check(Qr(e,t))},step(e,t){return this.check(Qr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function P(e){return Hr(Wa,e)}var Ga=j(`ZodNumberFormat`,(e,t)=>{tr.init(e,t),Wa.init(e,t)});function Ka(e){return Ur(Ga,e)}var qa=j(`ZodBoolean`,(e,t)=>{nr.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r)});function F(e){return Wr(qa,e)}var Ja=j(`ZodNull`,(e,t)=>{rr.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r)});function Ya(e){return Gr(Ja,e)}var Xa=j(`ZodUnknown`,(e,t)=>{ir.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Za(){return Kr(Xa)}var Qa=j(`ZodNever`,(e,t)=>{ar.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r)});function $a(e){return qr(Qa,e)}var eo=j(`ZodArray`,(e,t)=>{sr.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.element=t.element,va(e,`ZodArray`,{min(e,t){return this.check(ei(e,t))},nonempty(e){return this.check(ei(1,e))},max(e,t){return this.check($r(e,t))},length(e,t){return this.check(ti(e,t))},unwrap(){return this.element}})});function I(e,t){return mi(eo,e,t)}var to=j(`ZodObject`,(e,t)=>{vee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),Ye(e,`shape`,()=>t.shape),va(e,`ZodObject`,{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Za()})},loose(){return this.clone({...this._zod.def,catchall:Za()})},strict(){return this.clone({...this._zod.def,catchall:$a()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return dt(this,e)},safeExtend(e){return ft(this,e)},merge(e){return pt(this,e)},pick(e){return lt(this,e)},omit(e){return ut(this,e)},partial(...e){return mt(ho,this,e[0])},required(...e){return ht(To,this,e[0])}})});function L(e,t){return new to({type:`object`,shape:e??{},...M(t)})}function R(e,t){return new to({type:`object`,shape:e,catchall:Za(),...M(t)})}var no=j(`ZodUnion`,(e,t)=>{pr.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r),e.options=t.options});function ro(e,t){return new no({type:`union`,options:e,...M(t)})}var io=j(`ZodDiscriminatedUnion`,(e,t)=>{no.init(e,t),yee.init(e,t)});function ao(e,t,n){return new io({type:`union`,options:t,discriminator:e,...M(n)})}var oo=j(`ZodIntersection`,(e,t)=>{bee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r)});function so(e,t){return new oo({type:`intersection`,left:e,right:t})}var co=j(`ZodRecord`,(e,t)=>{xee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function lo(e,t,n){return!t||!t._zod?new co({type:`record`,keyType:N(),valueType:e,...M(t)}):new co({type:`record`,keyType:e,valueType:t,...M(n)})}var uo=j(`ZodEnum`,(e,t)=>{See.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new uo({...t,checks:[],...M(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new uo({...t,checks:[],...M(r),entries:i})}});function z(e,t){return new uo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...M(t)})}var fo=j(`ZodLiteral`,(e,t)=>{Cee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function B(e,t){return new fo({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}var po=j(`ZodTransform`,(e,t)=>{wee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ze(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(St(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(St(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function mo(e){return new po({type:`transform`,transform:e})}var ho=j(`ZodOptional`,(e,t)=>{_r.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function go(e){return new ho({type:`optional`,innerType:e})}var _o=j(`ZodExactOptional`,(e,t)=>{Tee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vo(e){return new _o({type:`optional`,innerType:e})}var yo=j(`ZodNullable`,(e,t)=>{Eee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bo(e){return new yo({type:`nullable`,innerType:e})}var xo=j(`ZodDefault`,(e,t)=>{Dee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function So(e,t){return new xo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():it(t)}})}var Co=j(`ZodPrefault`,(e,t)=>{Oee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wo(e,t){return new Co({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():it(t)}})}var To=j(`ZodNonOptional`,(e,t)=>{kee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Eo(e,t){return new To({type:`nonoptional`,innerType:e,...M(t)})}var Do=j(`ZodCatch`,(e,t)=>{Aee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Oo(e,t){return new Do({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var ko=j(`ZodPipe`,(e,t)=>{br.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),e.in=t.in,e.out=t.out});function Ao(e,t){return new ko({type:`pipe`,in:e,out:t})}var jo=j(`ZodPreprocess`,(e,t)=>{ko.init(e,t),jee.init(e,t)}),Mo=j(`ZodReadonly`,(e,t)=>{Mee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function No(e){return new Mo({type:`readonly`,innerType:e})}var Po=j(`ZodLazy`,(e,t)=>{Nee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yi(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Fo(e){return new Po({type:`lazy`,getter:e})}var Io=j(`ZodCustom`,(e,t)=>{Pee.init(e,t),ya.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r)});function Lo(e,t){return hi(Io,e??(()=>!0),t)}function Ro(e,t={}){return gi(Io,e,t)}function zo(e,t){return _i(e,t)}function Bo(e,t={}){let n=new Io({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...M(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Vo(e,t){return new jo({type:`pipe`,in:mo(e),out:t})}var Ho=Symbol.for(`yaml.alias`),Uo=Symbol.for(`yaml.document`),Wo=Symbol.for(`yaml.map`),Go=Symbol.for(`yaml.pair`),Ko=Symbol.for(`yaml.scalar`),qo=Symbol.for(`yaml.seq`),Jo=Symbol.for(`yaml.node.type`),Yo=e=>!!e&&typeof e==`object`&&e[Jo]===Ho,Xo=e=>!!e&&typeof e==`object`&&e[Jo]===Uo,Zo=e=>!!e&&typeof e==`object`&&e[Jo]===Wo,Qo=e=>!!e&&typeof e==`object`&&e[Jo]===Go,$o=e=>!!e&&typeof e==`object`&&e[Jo]===Ko,es=e=>!!e&&typeof e==`object`&&e[Jo]===qo;function ts(e){if(e&&typeof e==`object`)switch(e[Jo]){case Wo:case qo:return!0}return!1}function ns(e){if(e&&typeof e==`object`)switch(e[Jo]){case Ho:case Wo:case Ko:case qo:return!0}return!1}var rs=e=>($o(e)||ts(e))&&!!e.anchor,is=Symbol(`break visit`),as=Symbol(`skip children`),ss=Symbol(`remove node`);function cs(e,t){let n=fs(t);Xo(e)?ls(null,e.contents,n,Object.freeze([e]))===ss&&(e.contents=null):ls(null,e,n,Object.freeze([]))}cs.BREAK=is,cs.SKIP=as,cs.REMOVE=ss;function ls(e,t,n,r){let i=ps(e,t,n,r);if(ns(i)||Qo(i))return ms(e,r,i),ls(e,i,n,r);if(typeof i!=`symbol`){if(ts(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=ls(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===is)return is;else i===ss&&(t.items.splice(e,1),--e)}}else if(Qo(t)){r=Object.freeze(r.concat(t));let e=ls(`key`,t.key,n,r);if(e===is)return is;e===ss&&(t.key=null);let i=ls(`value`,t.value,n,r);if(i===is)return is;i===ss&&(t.value=null)}}return i}async function us(e,t){let n=fs(t);Xo(e)?await ds(null,e.contents,n,Object.freeze([e]))===ss&&(e.contents=null):await ds(null,e,n,Object.freeze([]))}us.BREAK=is,us.SKIP=as,us.REMOVE=ss;async function ds(e,t,n,r){let i=await ps(e,t,n,r);if(ns(i)||Qo(i))return ms(e,r,i),ds(e,i,n,r);if(typeof i!=`symbol`){if(ts(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await ds(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===is)return is;else i===ss&&(t.items.splice(e,1),--e)}}else if(Qo(t)){r=Object.freeze(r.concat(t));let e=await ds(`key`,t.key,n,r);if(e===is)return is;e===ss&&(t.key=null);let i=await ds(`value`,t.value,n,r);if(i===is)return is;i===ss&&(t.value=null)}}return i}function fs(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function ps(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Zo(t))return n.Map?.(e,t,r);if(es(t))return n.Seq?.(e,t,r);if(Qo(t))return n.Pair?.(e,t,r);if($o(t))return n.Scalar?.(e,t,r);if(Yo(t))return n.Alias?.(e,t,r)}function ms(e,t,n){let r=t[t.length-1];if(ts(r))r.items[e]=n;else if(Qo(r))e===`key`?r.key=n:r.value=n;else if(Xo(r))r.contents=n;else{let e=Yo(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var hs={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Jee=e=>e.replace(/[!,[\]{}]/g,e=>hs[e]),gs=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Jee(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&ns(e.contents)){let t={};cs(e.contents,(e,n)=>{ns(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
66
+ `)}};gs.defaultYaml={explicit:!1,version:`1.2`},gs.defaultTags={"!!":`tag:yaml.org,2002:`};function _s(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function vs(e){let t=new Set;return cs(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function ys(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Yee(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=vs(e);let a=ys(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&($o(t.node)||ts(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function bs(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=bs(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=bs(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=bs(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=bs(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function xs(e,t,n){if(Array.isArray(e))return e.map((e,t)=>xs(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!rs(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Ss=class{constructor(e){Object.defineProperty(this,Jo,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Xo(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=xs(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?bs(i,{"":o},``,o):o}},Cs=class extends Ss{constructor(e){super(Ho),this.source=e,Object.defineProperty(this,`tag`,{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],cs(e,{Node:(e,t)=>{(Yo(t)||rs(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(xs(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ws(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(_s(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ws(e,t,n){if(Yo(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(ts(t)){let r=0;for(let i of t.items){let t=ws(e,i,n);t>r&&(r=t)}return r}else if(Qo(t)){let r=ws(e,t.key,n),i=ws(e,t.value,n);return Math.max(r,i)}return 1}var Ts=e=>!e||typeof e!=`function`&&typeof e!=`object`,V=class extends Ss{constructor(e){super(Ko),this.value=e}toJSON(e,t){return t?.keep?this.value:xs(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.QUOTE_SINGLE=`QUOTE_SINGLE`;var Xee=`tag:yaml.org,2002:`;function Zee(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Es(e,t,n){if(Xo(e)&&(e=e.contents),ns(e))return e;if(Qo(e)){let t=n.schema[Wo].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new Cs(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Xee+t.slice(2));let l=Zee(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new V(e);return c&&(c.node=t),t}l=e instanceof Map?o[Wo]:Symbol.iterator in Object(e)?o[qo]:o[Wo]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new V(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ds(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Es(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var Os=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,ks=class extends Ss{constructor(e,t){super(e),Object.defineProperty(this,`schema`,{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>ns(t)||Qo(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Os(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(ts(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ds(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(ts(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&$o(i)?i.value:i:ts(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Qo(t))return!1;let n=t.value;return n==null||e&&$o(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return ts(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(ts(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ds(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Qee=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function As(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var js=(e,t,n)=>e.endsWith(`
67
67
  `)?As(n,t):n.includes(`
68
68
  `)?`
69
69
  `+As(n,t):(e.endsWith(` `)?``:` `)+n,Ms=`flow`,$ee=`block`,ete=`quoted`;function Ns(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=Ps(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
@@ -88,29 +88,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
88
88
  $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Fs(r,!0);o!==`folded`&&t!==V.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=Ns(`${v}${e}${p}`,l,$ee,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function nte(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
89
89
  `)||u&&/[[\]{},]/.test(a))return zs(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
90
90
  `)?zs(a,t):Vs(e,t,n,r);if(!s&&!u&&i!==V.PLAIN&&a.includes(`
91
- `))return Vs(e,t,n,r);if(Is(a)){if(c===``)return t.forceBlockIndent=!0,Vs(e,t,n,r);if(s&&c===l)return zs(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return zs(a,t)}return s?d:Ns(d,c,Ms,Fs(t,!1))}function Hs(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==V.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=V.QUOTE_DOUBLE);let c=e=>{switch(e){case V.BLOCK_FOLDED:case V.BLOCK_LITERAL:return i||a?zs(o.value,t):Vs(o,t,n,r);case V.QUOTE_DOUBLE:return Ls(o.value,t);case V.QUOTE_SINGLE:return Rs(o.value,t);case V.PLAIN:return nte(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Us(e,t){let n=Object.assign({blockQuote:!0,commentString:Qee,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function rte(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(Qo(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function ite(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Qo(e)||es(e))&&e.anchor;a&&_s(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Ws(e,t,n,r){if(Zo(e))return e.toString(t,n,r);if(Jo(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=ts(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=rte(t.doc.schema.tags,a);let o=ite(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):Qo(a)?Hs(a,t,n,r):a.toString(t,n,r);return o?Qo(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function ate({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=ts(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(es(e)||!ts(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||es(e)||(Qo(e)?e.type===V.BLOCK_FOLDED||e.type===V.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Ws(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=js(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=js(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=js(g,n.indent,l(f))));let _,v,y;ts(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&Qo(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&$o(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Ws(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
91
+ `))return Vs(e,t,n,r);if(Is(a)){if(c===``)return t.forceBlockIndent=!0,Vs(e,t,n,r);if(s&&c===l)return zs(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return zs(a,t)}return s?d:Ns(d,c,Ms,Fs(t,!1))}function Hs(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==V.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=V.QUOTE_DOUBLE);let c=e=>{switch(e){case V.BLOCK_FOLDED:case V.BLOCK_LITERAL:return i||a?zs(o.value,t):Vs(o,t,n,r);case V.QUOTE_DOUBLE:return Ls(o.value,t);case V.QUOTE_SINGLE:return Rs(o.value,t);case V.PLAIN:return nte(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Us(e,t){let n=Object.assign({blockQuote:!0,commentString:Qee,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function rte(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if($o(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function ite(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=($o(e)||ts(e))&&e.anchor;a&&_s(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Ws(e,t,n,r){if(Qo(e))return e.toString(t,n,r);if(Yo(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=ns(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=rte(t.doc.schema.tags,a);let o=ite(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):$o(a)?Hs(a,t,n,r):a.toString(t,n,r);return o?$o(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function ate({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=ns(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(ts(e)||!ns(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||ts(e)||($o(e)?e.type===V.BLOCK_FOLDED||e.type===V.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Ws(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=js(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=js(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=js(g,n.indent,l(f))));let _,v,y;ns(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&$o(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&es(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Ws(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
92
92
  `:``,v){let e=l(v);S+=`\n${As(e,n.indent)}`}x===``&&!n.inFlow?S===`
93
93
  `&&y&&(S=`
94
94
 
95
- `):S+=`\n${n.indent}`}else if(!p&&es(t)){let e=x[0],r=x.indexOf(`
95
+ `):S+=`\n${n.indent}`}else if(!p&&ts(t)){let e=x[0],r=x.indexOf(`
96
96
  `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else (x===``||x[0]===`
97
- `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=js(g,n.indent,l(y)):h&&i&&i(),g}function Gs(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Ks=`<<`,qs={identify:e=>e===Ks||typeof e==`symbol`&&e.description===Ks,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new V(Symbol(Ks)),{addToJSMap:Js}),stringify:()=>Ks},ote=(e,t)=>(qs.identify(t)||Qo(t)&&(!t.type||t.type===V.PLAIN)&&qs.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===qs.tag&&e.default);function Js(e,t,n){let r=Xs(e,n);if($o(r))for(let n of r.items)Ys(e,t,n);else if(Array.isArray(r))for(let n of r)Ys(e,t,n);else Ys(e,t,r)}function Ys(e,t,n){let r=Xs(e,n);if(!Xo(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Xs(e,t){return e&&Jo(t)?t.resolve(e.doc,e):t}function Zs(e,t,{key:n,value:r}){if(ts(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(ote(e,n))Js(e,t,r);else{let i=xs(n,``,e);if(t instanceof Map)t.set(i,xs(r,i,e));else if(t instanceof Set)t.add(i);else{let a=ste(n,i,e),o=xs(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function ste(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(ts(e)&&n?.doc){let t=Us(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Gs(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Qs(e,t,n){return new $s(Es(e,void 0,n),Es(t,void 0,n))}var $s=class e{constructor(e,t=null){Object.defineProperty(this,qo,{value:Wo}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return ts(n)&&(n=n.clone(t)),ts(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Zs(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?ate(this,e,t,n):JSON.stringify(this)}};function ec(e,t,n){return(t.inFlow??e.flow?lte:cte)(e,t,n)}function cte({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(ts(i))!d&&i.spaceBefore&&f.push(``),tc(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Zo(i)){let e=ts(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),tc(n,f,e.commentBefore,d))}d=!1;let s=Ws(i,u,()=>o=null,()=>d=!0);o&&(s+=js(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
97
+ `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=js(g,n.indent,l(y)):h&&i&&i(),g}function Gs(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Ks=`<<`,qs={identify:e=>e===Ks||typeof e==`symbol`&&e.description===Ks,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new V(Symbol(Ks)),{addToJSMap:Js}),stringify:()=>Ks},ote=(e,t)=>(qs.identify(t)||$o(t)&&(!t.type||t.type===V.PLAIN)&&qs.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===qs.tag&&e.default);function Js(e,t,n){let r=Xs(e,n);if(es(r))for(let n of r.items)Ys(e,t,n);else if(Array.isArray(r))for(let n of r)Ys(e,t,n);else Ys(e,t,r)}function Ys(e,t,n){let r=Xs(e,n);if(!Zo(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Xs(e,t){return e&&Yo(t)?t.resolve(e.doc,e):t}function Zs(e,t,{key:n,value:r}){if(ns(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(ote(e,n))Js(e,t,r);else{let i=xs(n,``,e);if(t instanceof Map)t.set(i,xs(r,i,e));else if(t instanceof Set)t.add(i);else{let a=ste(n,i,e),o=xs(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function ste(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(ns(e)&&n?.doc){let t=Us(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Gs(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Qs(e,t,n){return new $s(Es(e,void 0,n),Es(t,void 0,n))}var $s=class e{constructor(e,t=null){Object.defineProperty(this,Jo,{value:Go}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return ns(n)&&(n=n.clone(t)),ns(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Zs(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?ate(this,e,t,n):JSON.stringify(this)}};function ec(e,t,n){return(t.inFlow??e.flow?lte:cte)(e,t,n)}function cte({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(ns(i))!d&&i.spaceBefore&&f.push(``),tc(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Qo(i)){let e=ns(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),tc(n,f,e.commentBefore,d))}d=!1;let s=Ws(i,u,()=>o=null,()=>d=!0);o&&(s+=js(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
98
98
  `}}return e?(p+=`
99
- `+As(l(e),c),s&&s()):d&&o&&o(),p}function lte({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(ts(i))i.spaceBefore&&d.push(``),tc(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Zo(i)){let e=ts(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),tc(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=ts(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Ws(i,c,()=>a=null);l||=d.length>u||o.includes(`
99
+ `+As(l(e),c),s&&s()):d&&o&&o(),p}function lte({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(ns(i))i.spaceBefore&&d.push(``),tc(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Qo(i)){let e=ns(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),tc(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=ns(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Ws(i,c,()=>a=null);l||=d.length>u||o.includes(`
100
100
  `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=js(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
101
- `;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function tc({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=As(t(r),e);n.push(i.trimStart())}}function nc(e,t){let n=Qo(t)?t.value:t;for(let r of e)if(Zo(r)&&(r.key===t||r.key===n||Qo(r.key)&&r.key.value===n))return r}var rc=class extends ks{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Uo,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Qs(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=Zo(e)?e:!e||typeof e!=`object`||!(`key`in e)?new $s(e,e?.value):new $s(e.key,e.value);let r=nc(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Qo(r.value)&&Ts(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=nc(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=nc(this.items,e)?.value;return(!t&&Qo(n)?n.value:n)??void 0}has(e){return!!nc(this.items,e)}set(e,t){this.add(new $s(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Zs(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Zo(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),ec(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},ic={collection:`map`,default:!0,nodeClass:rc,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Xo(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>rc.from(e,t,n)},ac=class extends ks{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Ko,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=oc(e);return typeof t==`number`?this.items.splice(t,1).length>0:!1}get(e,t){let n=oc(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Qo(r)?r.value:r}has(e){let t=oc(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=oc(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Qo(r)&&Ts(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(xs(e,String(r++),t));return n}toString(e,t,n){return e?ec(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Es(a,void 0,n))}}return i}};function oc(e){let t=Qo(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var sc={collection:`seq`,default:!0,nodeClass:ac,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return $o(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>ac.from(e,t,n)},cc={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Hs(e,t,n,r)}},lc={identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new V(null),stringify:({source:e},t)=>typeof e==`string`&&lc.test.test(e)?e:t.options.nullStr},uc={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new V(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&uc.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function dc({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-- >0;)a+=`0`}return a}var fc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:dc},pc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():dc(e)}},mc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new V(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:dc},hc=e=>typeof e==`bigint`||Number.isInteger(e),gc=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function _c(e,t,n){let{value:r}=e;return hc(r)&&r>=0?n+r.toString(t):dc(e)}var vc={identify:e=>hc(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>gc(e,2,8,n),stringify:e=>_c(e,8,`0o`)},yc={identify:hc,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>gc(e,0,10,n),stringify:dc},bc={identify:e=>hc(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>gc(e,2,16,n),stringify:e=>_c(e,16,`0x`)},xc=[ic,sc,cc,lc,uc,vc,yc,bc,fc,pc,mc];function Sc(e){return typeof e==`bigint`||Number.isInteger(e)}var Cc=({value:e})=>JSON.stringify(e),wc=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Cc},{identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Cc},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Cc},{identify:Sc,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Sc(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Cc}],Tc=[ic,sc].concat(wc,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Ec={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}else return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=V.BLOCK_LITERAL,t!==V.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===V.BLOCK_LITERAL?`
102
- `:` `)}return Hs({comment:e,type:t,value:s},r,i,a)}};function Dc(e,t){if($o(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Zo(r)){if(Xo(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new $s(new V(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=Zo(r)?r:new $s(r)}}else t(`Expected a sequence for this tag`);return e}function Oc(e,t,n){let{replacer:r}=n,i=new ac(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Qs(o,s,n))}return i}var kc={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Dc,createNode:Oc},Ac=class e extends ac{constructor(){super(),this.add=rc.prototype.add.bind(this),this.delete=rc.prototype.delete.bind(this),this.get=rc.prototype.get.bind(this),this.has=rc.prototype.has.bind(this),this.set=rc.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(Zo(e)?(r=xs(e.key,``,t),i=xs(e.value,r,t)):r=xs(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Oc(e,t,n),i=new this;return i.items=r.items,i}};Ac.tag=`tag:yaml.org,2002:omap`;var jc={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Ac,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Dc(e,t),r=[];for(let{key:e}of n.items)Qo(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Ac,n)},createNode:(e,t,n)=>Ac.from(e,t,n)};function Mc({value:e,source:t},n){return t&&(e?Nc:Pc).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Nc={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new V(!0),stringify:Mc},Pc={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new V(!1),stringify:Mc},Fc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:dc},Ic={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():dc(e)}},Lc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new V(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:dc},Rc=e=>typeof e==`bigint`||Number.isInteger(e);function zc(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function Bc(e,t,n){let{value:r}=e;if(Rc(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return dc(e)}var Vc={identify:Rc,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>zc(e,2,2,n),stringify:e=>Bc(e,2,`0b`)},Hc={identify:Rc,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>zc(e,1,8,n),stringify:e=>Bc(e,8,`0`)},Uc={identify:Rc,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>zc(e,0,10,n),stringify:dc},Wc={identify:Rc,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>zc(e,2,16,n),stringify:e=>Bc(e,16,`0x`)},Gc=class e extends rc{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Zo(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new $s(e.key,null):new $s(e,null),nc(this.items,t.key)||this.items.push(t)}get(e,t){let n=nc(this.items,e);return!t&&Zo(n)?Qo(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=nc(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new $s(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Qs(e,null,n));return i}};Gc.tag=`tag:yaml.org,2002:set`;var Kc={collection:`map`,identify:e=>e instanceof Set,nodeClass:Gc,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Gc.from(e,t,n),resolve(e,t){if(Xo(e)){if(e.hasAllNullValues(!0))return Object.assign(new Gc,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function qc(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function Jc(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return dc(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var Yc={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>qc(e,n),stringify:Jc},Xc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>qc(e,!1),stringify:Jc},Zc={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(Zc.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=qc(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},Qc=[ic,sc,cc,lc,Nc,Pc,Vc,Hc,Uc,Wc,Fc,Ic,Lc,Ec,qs,jc,kc,Kc,Yc,Xc,Zc],$c=new Map([[`core`,xc],[`failsafe`,[ic,sc,cc]],[`json`,Tc],[`yaml11`,Qc],[`yaml-1.1`,Qc]]),el={binary:Ec,bool:uc,float:mc,floatExp:pc,floatNaN:fc,floatTime:Xc,int:yc,intHex:bc,intOct:vc,intTime:Yc,map:ic,merge:qs,null:lc,omap:jc,pairs:kc,seq:sc,set:Kc,timestamp:Zc},tl={"tag:yaml.org,2002:binary":Ec,"tag:yaml.org,2002:merge":qs,"tag:yaml.org,2002:omap":jc,"tag:yaml.org,2002:pairs":kc,"tag:yaml.org,2002:set":Kc,"tag:yaml.org,2002:timestamp":Zc};function nl(e,t,n){let r=$c.get(t);if(r&&!e)return n&&!r.includes(qs)?r.concat(qs):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let e=Array.from($c.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(qs)),i.reduce((e,t)=>{let n=typeof t==`string`?el[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(el).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var rl=(e,t)=>e.key<t.key?-1:+(e.key>t.key),il=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?nl(e,`compat`):e?nl(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?tl:{},this.tags=nl(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,Uo,{value:ic}),Object.defineProperty(this,Go,{value:cc}),Object.defineProperty(this,Ko,{value:sc}),this.sortMapEntries=typeof a==`function`?a:a===!0?rl:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function al(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=Us(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(As(t,``))}let o=!1,s=null;if(e.contents){if(ts(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(As(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Ws(e.contents,i,()=>s=null,t);s&&(c+=js(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Ws(e.contents,i));if(e.directives?.docEnd)if(e.comment){let t=a(e.comment);t.includes(`
101
+ `;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function tc({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=As(t(r),e);n.push(i.trimStart())}}function nc(e,t){let n=$o(t)?t.value:t;for(let r of e)if(Qo(r)&&(r.key===t||r.key===n||$o(r.key)&&r.key.value===n))return r}var rc=class extends ks{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Wo,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Qs(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=Qo(e)?e:!e||typeof e!=`object`||!(`key`in e)?new $s(e,e?.value):new $s(e.key,e.value);let r=nc(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);$o(r.value)&&Ts(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=nc(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=nc(this.items,e)?.value;return(!t&&$o(n)?n.value:n)??void 0}has(e){return!!nc(this.items,e)}set(e,t){this.add(new $s(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Zs(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Qo(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),ec(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},ic={collection:`map`,default:!0,nodeClass:rc,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Zo(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>rc.from(e,t,n)},ac=class extends ks{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(qo,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=oc(e);return typeof t==`number`?this.items.splice(t,1).length>0:!1}get(e,t){let n=oc(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&$o(r)?r.value:r}has(e){let t=oc(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=oc(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];$o(r)&&Ts(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(xs(e,String(r++),t));return n}toString(e,t,n){return e?ec(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Es(a,void 0,n))}}return i}};function oc(e){let t=$o(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var sc={collection:`seq`,default:!0,nodeClass:ac,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return es(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>ac.from(e,t,n)},cc={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Hs(e,t,n,r)}},lc={identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new V(null),stringify:({source:e},t)=>typeof e==`string`&&lc.test.test(e)?e:t.options.nullStr},uc={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new V(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&uc.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function dc({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-- >0;)a+=`0`}return a}var fc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:dc},pc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():dc(e)}},mc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new V(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:dc},hc=e=>typeof e==`bigint`||Number.isInteger(e),gc=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function _c(e,t,n){let{value:r}=e;return hc(r)&&r>=0?n+r.toString(t):dc(e)}var vc={identify:e=>hc(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>gc(e,2,8,n),stringify:e=>_c(e,8,`0o`)},yc={identify:hc,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>gc(e,0,10,n),stringify:dc},bc={identify:e=>hc(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>gc(e,2,16,n),stringify:e=>_c(e,16,`0x`)},xc=[ic,sc,cc,lc,uc,vc,yc,bc,fc,pc,mc];function Sc(e){return typeof e==`bigint`||Number.isInteger(e)}var Cc=({value:e})=>JSON.stringify(e),wc=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Cc},{identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Cc},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Cc},{identify:Sc,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Sc(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Cc}],Tc=[ic,sc].concat(wc,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Ec={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}else return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=V.BLOCK_LITERAL,t!==V.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===V.BLOCK_LITERAL?`
102
+ `:` `)}return Hs({comment:e,type:t,value:s},r,i,a)}};function Dc(e,t){if(es(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Qo(r)){if(Zo(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new $s(new V(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=Qo(r)?r:new $s(r)}}else t(`Expected a sequence for this tag`);return e}function Oc(e,t,n){let{replacer:r}=n,i=new ac(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Qs(o,s,n))}return i}var kc={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Dc,createNode:Oc},Ac=class e extends ac{constructor(){super(),this.add=rc.prototype.add.bind(this),this.delete=rc.prototype.delete.bind(this),this.get=rc.prototype.get.bind(this),this.has=rc.prototype.has.bind(this),this.set=rc.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(Qo(e)?(r=xs(e.key,``,t),i=xs(e.value,r,t)):r=xs(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Oc(e,t,n),i=new this;return i.items=r.items,i}};Ac.tag=`tag:yaml.org,2002:omap`;var jc={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Ac,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Dc(e,t),r=[];for(let{key:e}of n.items)$o(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Ac,n)},createNode:(e,t,n)=>Ac.from(e,t,n)};function Mc({value:e,source:t},n){return t&&(e?Nc:Pc).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Nc={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new V(!0),stringify:Mc},Pc={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new V(!1),stringify:Mc},Fc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:dc},Ic={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():dc(e)}},Lc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new V(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:dc},Rc=e=>typeof e==`bigint`||Number.isInteger(e);function zc(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function Bc(e,t,n){let{value:r}=e;if(Rc(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return dc(e)}var Vc={identify:Rc,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>zc(e,2,2,n),stringify:e=>Bc(e,2,`0b`)},Hc={identify:Rc,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>zc(e,1,8,n),stringify:e=>Bc(e,8,`0`)},Uc={identify:Rc,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>zc(e,0,10,n),stringify:dc},Wc={identify:Rc,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>zc(e,2,16,n),stringify:e=>Bc(e,16,`0x`)},Gc=class e extends rc{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Qo(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new $s(e.key,null):new $s(e,null),nc(this.items,t.key)||this.items.push(t)}get(e,t){let n=nc(this.items,e);return!t&&Qo(n)?$o(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=nc(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new $s(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Qs(e,null,n));return i}};Gc.tag=`tag:yaml.org,2002:set`;var Kc={collection:`map`,identify:e=>e instanceof Set,nodeClass:Gc,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Gc.from(e,t,n),resolve(e,t){if(Zo(e)){if(e.hasAllNullValues(!0))return Object.assign(new Gc,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function qc(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function Jc(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return dc(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var Yc={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>qc(e,n),stringify:Jc},Xc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>qc(e,!1),stringify:Jc},Zc={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(Zc.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=qc(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},Qc=[ic,sc,cc,lc,Nc,Pc,Vc,Hc,Uc,Wc,Fc,Ic,Lc,Ec,qs,jc,kc,Kc,Yc,Xc,Zc],$c=new Map([[`core`,xc],[`failsafe`,[ic,sc,cc]],[`json`,Tc],[`yaml11`,Qc],[`yaml-1.1`,Qc]]),el={binary:Ec,bool:uc,float:mc,floatExp:pc,floatNaN:fc,floatTime:Xc,int:yc,intHex:bc,intOct:vc,intTime:Yc,map:ic,merge:qs,null:lc,omap:jc,pairs:kc,seq:sc,set:Kc,timestamp:Zc},tl={"tag:yaml.org,2002:binary":Ec,"tag:yaml.org,2002:merge":qs,"tag:yaml.org,2002:omap":jc,"tag:yaml.org,2002:pairs":kc,"tag:yaml.org,2002:set":Kc,"tag:yaml.org,2002:timestamp":Zc};function nl(e,t,n){let r=$c.get(t);if(r&&!e)return n&&!r.includes(qs)?r.concat(qs):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let e=Array.from($c.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(qs)),i.reduce((e,t)=>{let n=typeof t==`string`?el[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(el).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var rl=(e,t)=>e.key<t.key?-1:+(e.key>t.key),il=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?nl(e,`compat`):e?nl(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?tl:{},this.tags=nl(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,Wo,{value:ic}),Object.defineProperty(this,Ko,{value:cc}),Object.defineProperty(this,qo,{value:sc}),this.sortMapEntries=typeof a==`function`?a:a===!0?rl:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function al(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=Us(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(As(t,``))}let o=!1,s=null;if(e.contents){if(ns(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(As(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Ws(e.contents,i,()=>s=null,t);s&&(c+=js(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Ws(e.contents,i));if(e.directives?.docEnd)if(e.comment){let t=a(e.comment);t.includes(`
103
103
  `)?(n.push(`...`),n.push(As(t,``))):n.push(`... ${t}`)}else n.push(`...`);else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(As(a(t),``)))}return n.join(`
104
104
  `)+`
105
- `}var ol=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,qo,{value:Ho});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new gs({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[qo]:{value:Ho}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=ts(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){sl(this.contents)&&this.contents.add(e)}addIn(e,t){sl(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=vs(this);e.anchor=!t||n.has(t)?ys(t||`a`,n):t}return new Cs(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=Yee(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=Es(e,l,p);return o&&es(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new $s(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return sl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Os(e)?this.contents==null?!1:(this.contents=null,!0):sl(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return es(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Os(e)?!t&&Qo(this.contents)?this.contents.value:this.contents:es(this.contents)?this.contents.getIn(e,t):void 0}has(e){return es(this.contents)?this.contents.has(e):!1}hasIn(e){return Os(e)?this.contents!==void 0:es(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ds(this.schema,[e],t):sl(this.contents)&&this.contents.set(e,t)}setIn(e,t){Os(e)?this.contents=t:this.contents==null?this.contents=Ds(this.schema,Array.from(e),t):sl(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new gs({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new gs({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new il(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=xs(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?bs(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return al(this,e)}};function sl(e){if(es(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var cl=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},ll=class extends cl{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},ul=class extends cl{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},dl=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
105
+ `}var ol=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Jo,{value:Uo});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new gs({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Jo]:{value:Uo}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=ns(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){sl(this.contents)&&this.contents.add(e)}addIn(e,t){sl(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=vs(this);e.anchor=!t||n.has(t)?ys(t||`a`,n):t}return new Cs(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=Yee(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=Es(e,l,p);return o&&ts(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new $s(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return sl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Os(e)?this.contents==null?!1:(this.contents=null,!0):sl(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return ts(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Os(e)?!t&&$o(this.contents)?this.contents.value:this.contents:ts(this.contents)?this.contents.getIn(e,t):void 0}has(e){return ts(this.contents)?this.contents.has(e):!1}hasIn(e){return Os(e)?this.contents!==void 0:ts(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ds(this.schema,[e],t):sl(this.contents)&&this.contents.set(e,t)}setIn(e,t){Os(e)?this.contents=t:this.contents==null?this.contents=Ds(this.schema,Array.from(e),t):sl(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new gs({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new gs({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new il(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=xs(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?bs(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return al(this,e)}};function sl(e){if(ts(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var cl=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},ll=class extends cl{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},ul=class extends cl{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},dl=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
106
106
  `),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function fl(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function pl(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
107
- `))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(pl(t.key)||pl(t.value))return!0}return!1;default:return!0}}function ml(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&pl(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function hl(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||Qo(e)&&Qo(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var gl=`All mapping items must start at the same column`;function _l({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new(a?.nodeClass??rc)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=fl(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,gl)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
107
+ `))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(pl(t.key)||pl(t.value))return!0}return!1;default:return!0}}function ml(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&pl(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function hl(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||$o(e)&&$o(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var gl=`All mapping items must start at the same column`;function _l({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new(a?.nodeClass??rc)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=fl(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,gl)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
108
108
  `+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||pl(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,gl);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&ml(r.indent,u,i),n.atKey=!1,hl(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=fl(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&ml(r.indent,f,i),s=c.range[2];let l=new $s(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
109
109
  `+_.comment:g.comment=_.comment);let e=new $s(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function vl({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new(a?.nodeClass??ac)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=fl(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&ml(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function yl(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var bl=`Block collections are not allowed within flow collections`,xl=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Sl({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new(a?.nodeClass??(o?rc:ac))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=fl(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
110
- `+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&pl(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];Zo(t)&&(t=t.value??t.key),t.comment?t.comment+=`
110
+ `+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&pl(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];Qo(t)&&(t=t.value??t.key),t.comment?t.comment+=`
111
111
  `+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],xl(m)&&i(r.range,`BLOCK_IN_FLOW`,bl)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);xl(f)&&i(g.range,`BLOCK_IN_FLOW`,bl),n.atKey=!1;let _=fl(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?xl(m)&&i(v.range,`BLOCK_IN_FLOW`,bl):_.comment&&(g.comment?g.comment+=`
112
112
  `+_.comment:g.comment=_.comment);let y=new $s(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;hl(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new rc(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=yl(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
113
- `+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function Cl(e,t,n,r,i,a){let o=n.type===`block-map`?_l(e,t,n,r,a):n.type===`block-seq`?vl(e,t,n,r,a):Sl(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function wl(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===rc.tagName&&s===`map`||o===ac.tagName&&s===`seq`)return Cl(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),Cl(e,t,n,i,o)}let l=Cl(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=ts(u)?u:new V(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Tl(e,t,n){let r=t.offset,i=El(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?V.BLOCK_FOLDED:V.BLOCK_LITERAL,o=t.source?Dl(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
113
+ `+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function Cl(e,t,n,r,i,a){let o=n.type===`block-map`?_l(e,t,n,r,a):n.type===`block-seq`?vl(e,t,n,r,a):Sl(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function wl(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===rc.tagName&&s===`map`||o===ac.tagName&&s===`seq`)return Cl(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),Cl(e,t,n,i,o)}let l=Cl(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=ns(u)?u:new V(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Tl(e,t,n){let r=t.offset,i=El(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?V.BLOCK_FOLDED:V.BLOCK_LITERAL,o=t.source?Dl(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
114
114
  `.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
115
115
  `;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===V.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
116
116
  `):t.length>c||r[0]===` `?(f===` `?f=`
@@ -140,10 +140,10 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
140
140
  `);)r===`
141
141
  `&&(n+=`
142
142
  `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var Pl={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
143
- `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Fl(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function Il(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Tl(e,t,r):Ol(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Go]:c?Ll(e.schema,i,c,n,r):t.type===`scalar`?Rl(e,i,t,r):e.schema[Go];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=Qo(a)?a:new V(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new V(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Ll(e,t,n,r,i){if(n===`!`)return e[Go];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n)if(t.default&&t.test)a.push(t);else return t;for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Go])}function Rl({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Go];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Go];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function zl(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var Bl={composeNode:Vl,composeEmptyNode:Hl};function Vl(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Ul(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=Il(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=wl(Bl,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=Hl(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!Qo(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Hl(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Il(e,{type:`scalar`,offset:zl(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Ul({options:e},{offset:t,source:n,end:r},i){let a=new Cs(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=yl(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Wl(e,t,{offset:n,start:r,value:i,end:a},o){let s=new ol(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=fl(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Vl(c,i,l,o):Hl(c,l.end,r,null,l,o);let u=s.contents.range[2],d=yl(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Gl(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function Kl(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
143
+ `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Fl(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function Il(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Tl(e,t,r):Ol(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Ko]:c?Ll(e.schema,i,c,n,r):t.type===`scalar`?Rl(e,i,t,r):e.schema[Ko];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=$o(a)?a:new V(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new V(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Ll(e,t,n,r,i){if(n===`!`)return e[Ko];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n)if(t.default&&t.test)a.push(t);else return t;for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Ko])}function Rl({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Ko];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Ko];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function zl(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var Bl={composeNode:Vl,composeEmptyNode:Hl};function Vl(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Ul(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=Il(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=wl(Bl,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=Hl(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!$o(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Hl(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Il(e,{type:`scalar`,offset:zl(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Ul({options:e},{offset:t,source:n,end:r},i){let a=new Cs(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=yl(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Wl(e,t,{offset:n,start:r,value:i,end:a},o){let s=new ol(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=fl(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Vl(c,i,l,o):Hl(c,l.end,r,null,l,o);let u=s.contents.range[2],d=yl(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Gl(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function Kl(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
144
144
 
145
145
  `:`
146
- `)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var ql=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Gl(e);r?this.warnings.push(new ul(i,t,n)):this.errors.push(new ll(i,t,n))},this.directives=new gs({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Kl(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(es(i)&&!i.flow&&i.items.length>0){let e=i.items[0];Zo(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Kl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Gl(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Wl(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new ll(Gl(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new ll(Gl(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=yl(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new ll(Gl(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new ol(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},Jl=Symbol(`break visit`),Yl=Symbol(`skip children`),Xl=Symbol(`remove item`);function Zl(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Ql(Object.freeze([]),e,t)}Zl.BREAK=Jl,Zl.SKIP=Yl,Zl.REMOVE=Xl,Zl.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Zl.parentCollection=(e,t)=>{let n=Zl.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Ql(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Ql(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Jl)return Jl;else r===Xl&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function $l(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
146
+ `)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var ql=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Gl(e);r?this.warnings.push(new ul(i,t,n)):this.errors.push(new ll(i,t,n))},this.directives=new gs({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Kl(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(ts(i)&&!i.flow&&i.items.length>0){let e=i.items[0];Qo(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Kl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Gl(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Wl(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new ll(Gl(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new ll(Gl(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=yl(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new ll(Gl(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new ol(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},Jl=Symbol(`break visit`),Yl=Symbol(`skip children`),Xl=Symbol(`remove item`);function Zl(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Ql(Object.freeze([]),e,t)}Zl.BREAK=Jl,Zl.SKIP=Yl,Zl.REMOVE=Xl,Zl.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Zl.parentCollection=(e,t)=>{let n=Zl.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Ql(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Ql(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Jl)return Jl;else r===Xl&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function $l(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
147
147
  `:case`\r
148
148
  `:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function eu(e){switch(e){case void 0:case` `:case`
149
149
  `:case`\r`:case` `:return!0;default:return!1}}var tu=new Set(`0123456789ABCDEFabcdef`),nu=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),ru=new Set(`,[]{}`),iu=new Set(` ,[]{}
@@ -170,16 +170,16 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
170
170
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
171
171
  `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=fu(du(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=fu(du(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function gu(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new su||null,prettyErrors:t}}function _u(e,t={}){let{lineCounter:n,prettyErrors:r}=gu(t),i=new hu(n?.addNewLine),a=new ql(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new ll(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(dl(e,n)),o.warnings.forEach(dl(e,n))),o}function vu(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=_u(e,n);if(!i)return null;if(i.warnings.forEach(e=>Gs(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}var yu=[`off`,`follow`,`full`],bu=[`follow`,`full`],xu=`pull`,Su=[`off`,`follow`,`full`,xu],Cu=[`follow`,`full`,xu];function wu(e){return e===xu?`follow`:Tu(e)?e:null}function Tu(e){return typeof e==`string`&&yu.includes(e)}function Eu(e){return typeof e==`string`&&bu.includes(e)}function Du(e){let t=e?.resumeMode;return t===xu?`follow`:Eu(t)?t:null}function Ou(e){return Nu(e)===`off`&&Du(e)!==null}function ku(e){let t=Nu(e);return t===`follow`||t===`full`||Ou(e)}function Au(e){let t=Nu(e);return Eu(t)?t:Du(e)??`full`}function ju(e){return e===!0?`full`:e===!1?`off`:null}function Mu(e){return e===!0?`full`:e===!1?`off`:wu(e)}function Nu(e){let t=wu(e?.mode);return t===null?ju(e?.enabled):t}var Pu={sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`},Fu=new Set(Object.keys(Pu));function Iu(e){return Pu[e.toLowerCase().replace(/^\./,``)]??null}var Lu=new Set([`md`,`mdx`,`mmd`,`mermaid`]),Ru=new Set([...Fu,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!Lu.has(e))),zu={html:`html`,htm:`html`,svg:`xml`,vue:`html`,svelte:`html`,astro:`html`,lock:`yaml`};function Bu(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:Ru.has(t.slice(n+1).toLowerCase())}var Vu=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Hu=[`video/mp4`,`video/webm`,`video/ogg`],Uu=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Wu=[`application/pdf`],Gu=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Ku=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),qu=new Set([`pdf`]),Ju=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Yu=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Xu=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Zu=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),Qu=`wikiembed`,$u=`toast`,ed=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),td=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],nd=[`mp4`,`webm`,`mov`,`m4v`],rd=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],id=[`pdf`],ad=[`json`,`toml`,`lock`];function od(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}od(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,td,Gu),od(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,nd,Ku),od(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,rd,Ju),od(`SIDEBAR_PDF_ASSET_EXTENSIONS`,id,qu),od(`FILE_ATTACHMENT_EXTENSIONS`,[...Yu],ed),od(`WIKI_EMBED_EXTENSIONS`,[...ed],Xu);var sd=new Set(td),cd=new Set(nd),ld=new Set(rd),ud=new Set(id),dd=new Set(ad);od(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...td,...nd,...rd,...id,...ad])],Zu);var fd=new Set([`base`,`canvas`]),pd=new Set([`mmd`,`mermaid`]);function md(e){let t=e.lastIndexOf(`.`);return t<0?!1:pd.has(e.slice(t+1).toLowerCase())}var hd=new Set([`excalidraw`]);function gd(e){let t=e.lastIndexOf(`.`);return t<0?!1:hd.has(e.slice(t+1).toLowerCase())}new Set([...Xu,...fd,...pd,...hd]);function _d(e){let t=e.toLowerCase().replace(/^\./,``);return sd.has(t)?`image`:cd.has(t)?`video`:ld.has(t)?`audio`:ud.has(t)?`pdf`:dd.has(t)||fd.has(t)?`text`:pd.has(t)?`mermaid`:hd.has(t)?`excalidraw`:Fu.has(t)?`text`:null}var vd=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`,`ko`],yd=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`fr`,`bn`,`pt-BR`,`id`,`ko`],bd=new Set([`ar`,`ur`]),xd=vd.filter(e=>!bd.has(e)),Sd=[`off`,`warning`,`error`],Cd=`warning`,wd=[`error`,`warning`],Td=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],Ed={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`},Dd=/^#[0-9a-fA-F]{6}$/,Od=/\P{White_Space}/u;function kd(e){return Od.test(e)}function Ad(e){return typeof e==`string`&&Dd.test(e)}function jd(e){let t=e.palette;return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...Pd(t)}}var Md={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},Nd=Object.keys(Md);function Pd(e){let t={};for(let n of Nd)t[`ansi-${Fd(n)}`]=e[Md[n]];return t}function Fd(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function Id(e){return JSON.stringify(e).replace(/[\u007f-\u009f\u2028\u2029\ufffe\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function Ld(e){return`${[`system: "base16"`,`name: ${Id(e.name)}`,...e.author?[`author: ${Id(e.author)}`]:[],`variant: ${Id(e.variant)}`,`palette:`,...Td.map(t=>` ${t}: ${Id(e.palette[t])}`)].join(`
172
172
  `)}\n`}function Rd(e){let t;try{t=vu(e,{schema:`failsafe`})}catch(e){let t=e?.linePos;return{ok:!1,error:{kind:`unparseable`,line:typeof t?.[0]?.line==`number`?t[0].line:void 0}}}if(!t||typeof t!=`object`||Array.isArray(t))return{ok:!1,error:{kind:`not-a-scheme`}};let n=t,r=n.palette,i=r&&typeof r==`object`&&!Array.isArray(r)?r:n,a={},o=[],s=[];for(let e of Td){let t=i[e]??i[e.toLowerCase()];if(t==null){o.push(e);continue}let n=zd(t);if(!n){s.push(e);continue}a[e]=n}return o.length?{ok:!1,error:{kind:`missing-slots`,slots:o}}:s.length?{ok:!1,error:{kind:`bad-hex`,slots:s}}:typeof n.name==`string`&&!kd(n.name)||typeof n.author==`string`&&!kd(n.author)?{ok:!1,error:{kind:`not-a-scheme`}}:{ok:!0,scheme:{name:typeof n.name==`string`?n.name:`Imported`,author:typeof n.author==`string`?n.author:void 0,variant:n.variant===`light`||n.variant===`dark`?n.variant:Hd(a),palette:a}}}function zd(e){if(typeof e!=`string`)return null;let t=e.trim();return t.startsWith(`#`)||(t=`#${t}`),/^#[0-9a-fA-F]{3}$/.test(t)&&(t=`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`),Dd.test(t)?t.toLowerCase():null}function Bd(e,t,n){let r=Ad(e)?e:`#000000`,i=Ad(t)?t:`#000000`,a=Math.min(1,Math.max(0,n)),o=`#`;for(let e=0;e<3;e++){let t=Number.parseInt(r.slice(1+e*2,3+e*2),16),n=Number.parseInt(i.slice(1+e*2,3+e*2),16);o+=Math.round(t+(n-t)*a).toString(16).padStart(2,`0`)}return o}function Vd(e){let t=Ad(e)?e:`#000000`,n=e=>{let n=Number.parseInt(t.slice(1+e*2,3+e*2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(0)+.7152*n(1)+.0722*n(2)}function Hd(e){return Vd(e.base00)<Vd(e.base05)?`dark`:`light`}var Ud={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},Wd={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},Gd={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1d62ec`,base0E:`#8839ef`,base0F:`#dd7878`}},Kd={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},qd={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},Jd={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#2995e1`,base0E:`#6c71c4`,base0F:`#d33682`}};function Yd(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>jd(n)}}function Xd(e,t){return{id:e,label:t,kind:`system`}}var Zd=[Xd(`default`,`Default`),Yd(`dracula`,`Dracula`,Ud),Yd(`catppuccin-frappe`,`Catppuccin Frappé`,Wd),Yd(`catppuccin-latte`,`Catppuccin Latte`,Gd),Yd(`monokai`,`Monokai`,Kd),Yd(`gruvbox`,`Gruvbox`,qd),Yd(`solarized`,`Solarized`,Jd),Xd(`custom`,`Custom`)],Qd=Zd.map(e=>e.id),$d=/^[a-z0-9-]{1,32}$/,ef=`saved-`,tf=26,nf=/\p{M}+/gu,rf=/['\u2019\u02bc]+/gu,af=/[^a-z0-9]+/g;function of(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function sf(e){let t=e.trim();if(t.length===0)return{ok:!1,code:`empty`};let n=t.normalize(`NFKD`).replace(nf,``).toLowerCase().replace(rf,``).replace(af,`-`).replace(/^-+|-+$/g,``),r=of(t),i=n.length===0?`theme-${r}`:n.length<=tf?n:`${n.slice(0,tf-r.length-1).replace(/-+$/g,``)}-${r}`,a=cf(i);if(!a.ok)throw Error(`Saved theme name derivation produced an invalid id`);return{ok:!0,name:t,stem:i,id:a.id}}function cf(e){if(e.length===0)return{ok:!1,code:`empty`};let t=ef+e;return $d.test(t)?{ok:!0,id:t}:{ok:!1,code:/^[a-z0-9-]+$/.test(t)?`too-long`:`invalid-chars`}}function lf(e){if(!$d.test(e)||!e.startsWith(`saved-`))return{ok:!1};let t=e.slice(6);return t.length===0?{ok:!1}:{ok:!0,stem:t}}var uf=new Map(Zd.map(e=>[e.id,e]));function df(e){return e&&uf.get(e)||Zd[0]}function ff(e,t=Zd){let n=new Set(t.map(e=>e.id)),r=e?.colorTheme,i=r&&n.has(r)?r:Zd[0].id,a=e=>e===void 0?i:n.has(e)?e:Zd[0].id;return{light:a(e?.colorThemeLight),dark:a(e?.colorThemeDark)}}function pf(e,t){return e===`light`||e===`dark`?e:t?`dark`:`light`}function mf(e,t,n){return`${e} {\n color-scheme: ${t};\n${Object.entries(n).map(([e,t])=>` --${e}: ${t};`).join(`
173
- `)}\n}`}var hf=Symbol.for(`@inkeep/open-knowledge/field-registry`),gf=globalThis;gf[hf]===void 0&&(gf[hf]=Er());var H=gf[hf];function _f(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=vf(t)?H.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function vf(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function yf(){return Object.fromEntries(Td.map(e=>[e,N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${Ed[e]}, as a #rrggbb hex string.`}).optional()]))}function bf(){return Qd.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}var xf=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Sf=52428800,Cf=26214400,wf=12582912,Tf=`https://api.openai.com/v1`,Ef=`text-embedding-3-small`,Df=Object.freeze([`127.0.0.1`]),Of=/^[1-9]\d*(s|m|h)$/,kf=/^https?:\/\//,Af=24550;function jf(e){let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.toLowerCase();return n===`localhost`||n===`127.0.0.1`||n===`[::1]`}function Mf(e){let t;try{t=new URL(e)}catch{return`invalid-url`}return t.protocol===`https:`||t.protocol===`http:`&&jf(e)?null:`insecure-scheme`}function Nf(e){let t=e.trim();return t===``?`./`:t}function Pf(e){let t=Nf(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}var Ff=R({content:R({dir:N().register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:N().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Pf,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:R({theme:z([`light`,`dark`,`system`]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:z([`system`,...vd]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${bf()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex($d,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${bf()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex($d,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex($d,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:R({name:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:z([`dark`,`light`]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...yf()}).optional(),preview:R({autoOpen:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:R({showHiddenFiles:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:R({wordWrap:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:R({autoApproveOkTools:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:R({mode:z(Su).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`How this machine syncs this project with its git remote: 'off' (no sync), 'follow' (one-directional — pull remote changes, never push your own; 'pull' is accepted as a legacy alias), or 'full' (bidirectional pull and push). null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:z(Cu).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),default:no([F(),z(Su)]).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),slides:R({enabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:R({localSink:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:R({maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Sf)}).default({maxBytes:Sf}),logs:R({maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Cf)}).default({maxBytes:Cf}),attributeDenylist:I(N()).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...xf])}).default({enabled:!0,spans:{maxBytes:Sf},logs:{maxBytes:Cf},attributeDenylist:[...xf]}),skillInstallReports:R({enabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:Sf},logs:{maxBytes:Cf},attributeDenylist:[...xf]},skillInstallReports:{enabled:!0}}),lossCapture:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(wf)}).default({enabled:!0,maxBytes:wf}),bridge:R({backgroundThrottle:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:R({semantic:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:N().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(Tf),model:N().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(Ef),dimensions:P().int().positive().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:P().min(0).max(1).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Tf,model:Ef})}).default({semantic:{enabled:!1,baseUrl:Tf,model:Ef}}),contentRules:R({markdownlint:L({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:L({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:I(L({appliesTo:no([N(),I(N())]).optional(),file:N(),enabled:F().optional()})).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]}),okf:L({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write.`}).default(!1),rules:co(N(),F()).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on.`}).optional(),generate:L({index:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild.`}).default(!1)}).default({index:!1})}).default({enabled:!1,generate:{index:!1}})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]},okf:{enabled:!1,generate:{index:!1}}}),validation:R({links:z(Sd).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Cd),fileTreeIndicators:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:Cd,fileTreeIndicators:!0}),linkPreviews:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),remote:R({url:N().register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:"Superseded by server.externalUrl — read only while server.externalUrl (and its deprecated server.publicUrl spelling) is absent. Public URL your tunnel gives you, e.g. https://myproject.ngrok.app. Used only with `ok start --remote` (config alone never enables remote access); its host is admitted through the Host-header allowlist. There is no server-side auth, so restrict access at the tunnel (ngrok OAuth, Cloudflare Access, Tailscale ACLs)."}).optional(),port:P().int().min(1).max(65535).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Superseded by server.port — read only while server.port is absent. TCP port the server binds when remote access is enabled (default 24550). Fixed so the tunnel's port mapping survives restarts. Set it only on a conflict. An explicit --port still wins; the PORT env var is ignored in remote mode.`}).optional()}).default({}),server:R({port:P().int().min(1).max(65535).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Supersedes remote.port (still read while this key is absent). Read at server start; changing it requires a restart.`}).optional(),bind:I(N().min(1)).min(1).register(H,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...Df]),externalUrl:Da({protocol:/^https?$/}).regex(kf).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — its host joins the Host/Origin allowlists (external-Host + CORS admission). Unset by default: the server admits only loopback Hosts. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Supersedes server.publicUrl (its former name) and remote.url — both still read while this key is absent. Read at server start; changing it requires a restart.`}).optional(),publicUrl:Da({protocol:/^https?$/}).regex(kf).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Deprecated alias of server.externalUrl (the former name of that key) — read only while server.externalUrl is absent, with identical semantics. Use server.externalUrl instead; if this config is committed and shared, keep both keys until every collaborator has upgraded (older versions read only server.publicUrl).`}).optional(),allowExternal:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. Once the unified server boot lands, a non-loopback server.bind or a server.externalUrl without allowExternal: true will be refused at boot with a one-line fix. Default off. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:no([B(`off`),N().regex(Of)]).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' when every bind address is loopback, 'off' otherwise (an exposed or containerized server stays up). Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...Df],allowExternal:!1})}),If=`open-knowledge-config`;function Lf(e,t,n){let r=s.getTracer(If),i=t?{attributes:t}:{};return r.startActiveSpan(e,i,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:c.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Rf(e,t){let n=s.getActiveSpan();n&&n.addEvent(e,t)}function zf(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Bf(e,t){let n=e;for(let e of t){n=zf(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Vf(e,t){let n=Bf(e,t);if(n!==void 0)return _f(n)}function Hf(e,t){return e===`either`?!0:e===t}function Uf(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}let a=Vf(Ff,i);a?.scope!==void 0&&(Hf(a.scope,t)||(n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t}))}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}function Wf(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(es(e.getIn(r,!0))||e.deleteIn(r))}}function Gf(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Wf(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Wf(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Kf(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var qf=L({file:N(),line:P().int().min(1),column:P().int().min(1),snippet:N().optional()}),Jf=L({path:I(no([N(),P()])),message:N(),issueCode:N(),params:co(N(),Xa()).optional(),source:qf.optional()}),Yf=z([`user`,`project`,`project-local`,`either`]),Xf=z([`user`,`project`,`project-local`]),Zf=L({code:B(`YAML_PARSE`),detail:N()}),Qf=L({code:B(`UNREADABLE`),detail:N()}),$f=L({code:B(`SCHEMA_INVALID`),issues:I(Jf)}),ep=L({code:B(`REMOVED_KEY`),path:I(N()),redirect:N(),source:qf.optional()}),tp=io(`code`,[Zf,$f,Qf,L({code:B(`SCOPE_VIOLATION`),path:I(N()),expectedScope:Yf,actualScope:Xf}),L({code:B(`NOT_AGENT_SETTABLE`),path:I(N())}),L({code:B(`MIXED_SCOPE`),paths:I(L({path:I(N()),scope:Xf}))}),ep,L({code:B(`WRITE_ERROR`),detail:N()}),L({code:B(`OKIGNORE_INVALID`),detail:N(),lineNumber:P().int().min(1).optional()}),L({code:B(`UNKNOWN`),message:N().optional()})]);io(`code`,[ep,Zf,$f,Qf]),L({diagnostics:I(io(`code`,[L({code:B(`REMOVED_KEY`),scope:Xf,file:N(),path:I(N()),redirect:N()}),L({code:B(`YAML_PARSE`),scope:Xf,file:N()}),L({code:B(`SCHEMA_INVALID`),scope:Xf,file:N()}),L({code:B(`UNREADABLE`),scope:Xf,file:N()})]))});var np=new Set(tp.options.map(e=>e.shape.code.value)),rp=no([tp,R({code:N(),message:N().optional()})]);function ip(e){return np.has(e.code)}function ap(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function op(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function sp(e){if(!ip(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`UNREADABLE`:return`Could not read the file: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
173
+ `)}\n}`}var hf=Symbol.for(`@inkeep/open-knowledge/field-registry`),gf=globalThis;gf[hf]===void 0&&(gf[hf]=Tr());var H=gf[hf];function _f(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=vf(t)?H.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function vf(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function yf(){return Object.fromEntries(Td.map(e=>[e,N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${Ed[e]}, as a #rrggbb hex string.`}).optional()]))}function bf(){return Qd.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}var xf=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Sf=52428800,Cf=26214400,wf=12582912,Tf=`https://api.openai.com/v1`,Ef=`text-embedding-3-small`,Df=Object.freeze([`127.0.0.1`]),Of=/^[1-9]\d*(s|m|h)$/,kf=/^https?:\/\//,Af=24550;function jf(e){let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.toLowerCase();return n===`localhost`||n===`127.0.0.1`||n===`[::1]`}function Mf(e){let t;try{t=new URL(e)}catch{return`invalid-url`}return t.protocol===`https:`||t.protocol===`http:`&&jf(e)?null:`insecure-scheme`}function Nf(e){let t=e.trim();return t===``?`./`:t}function Pf(e){let t=Nf(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}var Ff=R({content:R({dir:N().register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:N().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Pf,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:R({theme:z([`light`,`dark`,`system`]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:z([`system`,...vd]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${bf()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex($d,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${bf()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex($d,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex($d,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:R({name:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:z([`dark`,`light`]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...yf()}).optional(),preview:R({autoOpen:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:R({showHiddenFiles:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:R({wordWrap:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:R({autoApproveOkTools:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:R({mode:z(Su).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`How this machine syncs this project with its git remote: 'off' (no sync), 'follow' (one-directional — pull remote changes, never push your own; 'pull' is accepted as a legacy alias), or 'full' (bidirectional pull and push). null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:z(Cu).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),default:ro([F(),z(Su)]).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),slides:R({enabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:R({localSink:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:R({maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Sf)}).default({maxBytes:Sf}),logs:R({maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Cf)}).default({maxBytes:Cf}),attributeDenylist:I(N()).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...xf])}).default({enabled:!0,spans:{maxBytes:Sf},logs:{maxBytes:Cf},attributeDenylist:[...xf]}),skillInstallReports:R({enabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:Sf},logs:{maxBytes:Cf},attributeDenylist:[...xf]},skillInstallReports:{enabled:!0}}),lossCapture:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(wf)}).default({enabled:!0,maxBytes:wf}),bridge:R({backgroundThrottle:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:R({semantic:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:N().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(Tf),model:N().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(Ef),dimensions:P().int().positive().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:P().min(0).max(1).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Tf,model:Ef})}).default({semantic:{enabled:!1,baseUrl:Tf,model:Ef}}),contentRules:R({markdownlint:L({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:L({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:I(L({appliesTo:ro([N(),I(N())]).optional(),file:N(),enabled:F().optional()})).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]}),okf:L({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write.`}).default(!1),rules:lo(N(),F()).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on.`}).optional(),generate:L({index:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild.`}).default(!1)}).default({index:!1})}).default({enabled:!1,generate:{index:!1}})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]},okf:{enabled:!1,generate:{index:!1}}}),validation:R({links:z(Sd).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Cd),fileTreeIndicators:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:Cd,fileTreeIndicators:!0}),linkPreviews:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),server:R({port:P().int().min(1).max(65535).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Read at server start; changing it requires a restart.`}).optional(),bind:I(N().min(1)).min(1).register(H,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...Df]),externalUrl:Oa({protocol:/^https?$/}).regex(kf).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — its host joins the Host/Origin allowlists (external-Host + CORS admission). Unset by default: the server admits only loopback Hosts. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Read at server start; changing it requires a restart.`}).optional(),allowExternal:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. Once the unified server boot lands, a non-loopback server.bind or a server.externalUrl without allowExternal: true will be refused at boot with a one-line fix. Default off. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:ro([B(`off`),N().regex(Of)]).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' when every bind address is loopback, 'off' otherwise (an exposed or containerized server stays up). Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...Df],allowExternal:!1})}),If=`open-knowledge-config`;function Lf(e,t,n){let r=s.getTracer(If),i=t?{attributes:t}:{};return r.startActiveSpan(e,i,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:c.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Rf(e,t){let n=s.getActiveSpan();n&&n.addEvent(e,t)}function zf(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Bf(e,t){let n=e;for(let e of t){n=zf(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Vf(e,t){let n=Bf(e,t);if(n!==void 0)return _f(n)}function Hf(e,t){return e===`either`?!0:e===t}function Uf(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}let a=Vf(Ff,i);a?.scope!==void 0&&(Hf(a.scope,t)||(n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t}))}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}function Wf(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(ts(e.getIn(r,!0))||e.deleteIn(r))}}function Gf(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Wf(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Wf(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Kf(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var qf=L({file:N(),line:P().int().min(1),column:P().int().min(1),snippet:N().optional()}),Jf=L({path:I(ro([N(),P()])),message:N(),issueCode:N(),params:lo(N(),Za()).optional(),source:qf.optional()}),Yf=z([`user`,`project`,`project-local`,`either`]),Xf=z([`user`,`project`,`project-local`]),Zf=L({code:B(`YAML_PARSE`),detail:N()}),Qf=L({code:B(`UNREADABLE`),detail:N()}),$f=L({code:B(`SCHEMA_INVALID`),issues:I(Jf)}),ep=L({code:B(`REMOVED_KEY`),path:I(N()),redirect:N(),source:qf.optional()}),tp=ao(`code`,[Zf,$f,Qf,L({code:B(`SCOPE_VIOLATION`),path:I(N()),expectedScope:Yf,actualScope:Xf}),L({code:B(`NOT_AGENT_SETTABLE`),path:I(N())}),L({code:B(`MIXED_SCOPE`),paths:I(L({path:I(N()),scope:Xf}))}),ep,L({code:B(`WRITE_ERROR`),detail:N()}),L({code:B(`OKIGNORE_INVALID`),detail:N(),lineNumber:P().int().min(1).optional()}),L({code:B(`UNKNOWN`),message:N().optional()})]);ao(`code`,[ep,Zf,$f,Qf]),L({diagnostics:I(ao(`code`,[L({code:B(`REMOVED_KEY`),scope:Xf,file:N(),path:I(N()),redirect:N()}),L({code:B(`YAML_PARSE`),scope:Xf,file:N()}),L({code:B(`SCHEMA_INVALID`),scope:Xf,file:N()}),L({code:B(`UNREADABLE`),scope:Xf,file:N()})]))});var np=new Set(tp.options.map(e=>e.shape.code.value)),rp=ro([tp,R({code:N(),message:N().optional()})]);function ip(e){return np.has(e.code)}function ap(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function op(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function sp(e){if(!ip(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`UNREADABLE`:return`Could not read the file: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
174
174
  `))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
175
175
  `)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${ap(e.expectedScope)} — ${op(e.expectedScope)}),`,`but it was set in the ${e.actualScope} config (${ap(e.actualScope)}).`,`Move it to ${ap(e.expectedScope)}.`].join(` `);case`NOT_AGENT_SETTABLE`:return[`Setting ${e.path.join(`.`)} is human-only and can't be changed by an agent.`,`Change it in the Settings pane, or edit the config.yml by hand.`].join(` `);case`MIXED_SCOPE`:return[`This change touches settings that live in different config files. Apply them one file at a time:`,e.paths.map(({path:e,scope:t})=>` ${e.join(`.`)} → ${ap(t)} (${t})`).join(`
176
176
  `)].join(`
177
177
  `);case`REMOVED_KEY`:{let t=e.path.join(`.`),n=[`${e.source?`Removed key at ${e.source.file}:${e.source.line}:${e.source.column}`:`Removed key in configuration`}: ${t}`,e.redirect];if(e.source?.snippet&&e.source.snippet.length>0)for(let t of e.source.snippet.split(`
178
178
  `))n.push(` ${t}`);return n.join(`
179
- `)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}var cp="Run `ok config migrate` to strip the obsolete key automatically, or remove it by hand.";[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,cp].join(` `),[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,cp].join(` `),[`folders is no longer a top-level config field.`,"A folder's own frontmatter (open-shape, like a doc's) lives in nested `<folder>/.ok/frontmatter.yml`; new-doc starting properties come from templates in `<folder>/.ok/templates/`.","Edit via the folder overview in the editor sidebar, or `edit({ folder: { path, frontmatter } })` via the MCP.",cp].join(` `),[`appearance.editorModeDefault was removed and is never read — new docs always open in WYSIWYG; toggle mode via the editor mode button.`,cp].join(` `),[`streaming uploads have no user-facing cap; the value is hardcoded in @inkeep/open-knowledge-core.`,cp].join(` `),[`Use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID environment variable instead.`,cp].join(` `),[`Use server.bind in .ok/config.yml instead — a list of bind addresses, e.g. [127.0.0.1]; a non-loopback bind additionally requires server.allowExternal.`,`The --host CLI flag and HOST environment variable also remain available.`,cp].join(` `),[`This behavior was removed; the value is hardcoded.`,cp].join(` `),[`To disable MCP auto-start, set OK_MCP_AUTOSTART=0.`,cp].join(` `),[`This value is hardcoded in @inkeep/open-knowledge-core.`,cp].join(` `),[`This value is hardcoded in @inkeep/open-knowledge-core.`,cp].join(` `),[`The search result cap is hardcoded in @inkeep/open-knowledge-core; this config key was removed.`,cp].join(` `),["preview URLs now resolve only to the running server — start one with `ok start`.",cp].join(` `),[`preview.scriptSrc has been removed.`,`The code-block preview iframe now runs a fixed open network policy (it is no longer configurable).`,cp].join(` `),[`appearance.sidebar.showAllFiles has been removed.`,`The sidebar lists every file on disk by default; dot-prefixed entries are gated by appearance.sidebar.showHiddenFiles, and appearance.sidebar.showOnlyMarkdownFiles scopes the tree down to markdown documents as a per-machine view preference.`,cp].join(` `);function lp(e){try{let t=Intl.getCanonicalLocales(e)[0];return t===void 0?null:t}catch{return null}}function up(e){let t=[];for(let n of e){let e=lp(n);e!==null&&t.push(e)}return t}function dp(e){try{let t=Intl.getCanonicalLocales(e)[0];if(t===void 0)return null;let n=new Intl.Locale(t).maximize();return!n.language||!n.script?null:`${n.language}-${n.script}`}catch{return null}}var fp=`__system__`,pp=`__config__/project`,mp=`__user__/config.yml`,hp=`__local__/project`,gp=`__config__/okignore`;Object.freeze([pp,hp,mp,gp]);var _p=`__skill__/`,vp=`__extskill__/`,yp=[`project`,`global`];function bp(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)||e.startsWith(`__extskill__/`)}function xp(e){return`${vp}${e}`}function Sp(e,t){return`${vp}${e}/${Tp(t)}`}function Cp(e){return e.startsWith(vp)}function wp(e){if(!e.startsWith(`__extskill__/`))return null;let t=e.slice(13),n=t.indexOf(`/`),r=n<0?t:t.slice(0,n),i=n<0?null:t.slice(n+1);return/^[a-z0-9-]+$/.test(r)?{name:r,rel:i&&i.length>0?i:null}:null}function Tp(e){return e.replace(/\.mdx?$/i,``)}var Ep=`.ok/skills`;function Dp(e){return`${Ep}/${e}/SKILL`}var Op=[`references`,`scripts`];function kp(e,t){let n=e.trim();if(!n.startsWith(`/`))return null;let r=n.slice(1);if(r===``||r.includes(`/`))return null;let i=/^(\.[A-Za-z0-9_-]+\/skills)\/[^/]+\/(?:SKILL|references\/.+)$/.exec(t);return i?`${i[1]}/${r}/SKILL`:/^__skill__\/(global)\/[^/]+(?:\/references\/.+)?$/.exec(t)?Fp(`global`,r):null}function Ap(e,t){let n=/^(\.[A-Za-z0-9_-]+\/skills\/[^/]+)\/(?:SKILL|references\/.+)$/.exec(t)??/^(__skill__\/global\/[^/]+)(?:\/references\/.+)?$/.exec(t)??/^(__extskill__\/[^/]+)(?:\/.+)?$/.exec(t);if(!n)return null;let r=n[1],i=Tp(e.trim()).split(`/`).filter(e=>e!==``&&e!==`.`),[a]=i;return!a||!Op.includes(a)||i.includes(`..`)||i.length<2?null:`${r}/${i.join(`/`)}`}var jp=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(SKILL|references\/.+)$/;function Mp(e){let t=jp.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===`SKILL`?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}var Np=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function Pp(e){let t=Np.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===void 0?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}function Fp(e,t){return e===`project`?Dp(t):`${_p}${e}/${t}`}function Ip(e,t,n){let r=Tp(n);return e===`project`?`${Ep}/${t}/${r}`:`${_p}${e}/${t}/${r}`}function Lp(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function Rp(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);if(!i)return null;let a=Lp(i),o=a.indexOf(`/`),s=o<0?a:a.slice(0,o);return s?{kind:`skill`,scope:r,name:s,rel:o<0?null:a.slice(o+1)}:null}return null}var zp=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.md)?$/;function Bp(e,t){let n=e.replace(/^\/+|\/+$/g,``);return n?`${n}/.ok/templates/${t}`:`.ok/templates/${t}`}function Vp(e){let t=zp.exec(e);return t?{folder:(t[1]??``).replace(/^\/+|\/+$/g,``),name:t[2]}:null}function Hp(e){if(!e.startsWith(`__template__/`))return null;let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{folder:Lp(n<0?``:t.slice(0,n)),name:Lp(r)}:null}var Up=[`claude`,`claude-desktop`,`cursor`,`codex`,`copilot`,`opencode`,`openclaw`,`pi`,`antigravity`,`lm-studio`,`hermes`],Wp={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,copilot:`GitHub Copilot`,opencode:`OpenCode`,openclaw:`OpenClaw`,pi:`Pi`,antigravity:`Antigravity`,"lm-studio":`LM Studio`,hermes:`Hermes`},Gp={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.github/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/skills`,antigravity:null,"lm-studio":null,hermes:null},Kp={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.copilot/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/agent/skills`,antigravity:`.gemini/skills`,"lm-studio":null,hermes:null},qp=Up.filter(e=>Gp[e]!==null),Jp=`open-knowledge`;Up.flatMap(e=>{let t=Gp[e];return t===null?[]:[`${t}/${Jp}/`]}),qp.filter(e=>e!==`pi`&&e!==`copilot`).map(e=>({hostDir:(Gp[e]??``).split(`/`)[0],editorId:e})),Up.flatMap(e=>{let t=Kp[e];if(t===null)return[];let n=t.split(`/`)[0];return n===void 0?[]:[{hostDir:n,skillsRoot:t,editorId:e}]});var Yp={claude:`claude-code`,"claude-desktop":`claude-code`,cursor:`cursor`,codex:`codex`,copilot:`github-copilot-cli`,opencode:`opencode`,openclaw:`openclaw`,pi:`pi`,antigravity:`antigravity`,"lm-studio":`lm-studio`,hermes:`hermes`},Xp={claude:`.mcp.json`,"claude-desktop":null,cursor:`.cursor/mcp.json`,codex:`.codex/config.toml`,copilot:null,opencode:`opencode.json`,openclaw:null,pi:`.pi/extensions/open-knowledge.ts`,antigravity:null,"lm-studio":null,hermes:null},Zp=[`copilot`];function Qp(e,t){return Xp[e]===null?Gp[e]===null?!1:!Zp.includes(e)||t.userMcpEntryInstalled:!0}var $p=`.agents/skills`,em=`open-knowledge-pack-`,tm=`inkeep/open-knowledge-skills`,nm=/(^|[\s([])\/([a-z0-9][a-z0-9-]{1,63})(?=$|[\s.,;:!?)\]])/g,rm=new Set([`tmp`,`usr`,`etc`,`var`,`dev`,`opt`,`bin`,`api`,`home`,`root`]);function im(e){return!rm.has(e)}var am=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/,om=/^---[ \t]*$/;function sm(e){let t=e.match(am);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function cm(e,t){return e?t===``||/\r?\n$/.test(e)?e+t:e+(e.includes(`\r
179
+ `)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}var cp="Run `ok config migrate` to strip the obsolete key automatically, or remove it by hand.";[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,cp].join(` `),[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,cp].join(` `),[`folders is no longer a top-level config field.`,"A folder's own frontmatter (open-shape, like a doc's) lives in nested `<folder>/.ok/frontmatter.yml`; new-doc starting properties come from templates in `<folder>/.ok/templates/`.","Edit via the folder overview in the editor sidebar, or `edit({ folder: { path, frontmatter } })` via the MCP.",cp].join(` `),[`appearance.editorModeDefault was removed and is never read — new docs always open in WYSIWYG; toggle mode via the editor mode button.`,cp].join(` `),[`streaming uploads have no user-facing cap; the value is hardcoded in @inkeep/open-knowledge-core.`,cp].join(` `),[`Use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID environment variable instead.`,cp].join(` `),[`Use server.bind in .ok/config.yml instead — a list of bind addresses, e.g. [127.0.0.1]; a non-loopback bind additionally requires server.allowExternal.`,`The --bind CLI flag and HOST environment variable also remain available.`,cp].join(` `),[`remote.url has been removed. Use server.externalUrl in .ok/config.yml instead (the public origin your tunnel serves).`,cp].join(` `),[`remote.port has been removed. Use server.port in .ok/config.yml instead.`,cp].join(` `),[`server.publicUrl has been removed. Use server.externalUrl in .ok/config.yml instead (the same key under its current name).`,cp].join(` `),[`This behavior was removed; the value is hardcoded.`,cp].join(` `),[`To disable MCP auto-start, set OK_MCP_AUTOSTART=0.`,cp].join(` `),[`This value is hardcoded in @inkeep/open-knowledge-core.`,cp].join(` `),[`This value is hardcoded in @inkeep/open-knowledge-core.`,cp].join(` `),[`The search result cap is hardcoded in @inkeep/open-knowledge-core; this config key was removed.`,cp].join(` `),["preview URLs now resolve only to the running server — start one with `ok start`.",cp].join(` `),[`preview.scriptSrc has been removed.`,`The code-block preview iframe now runs a fixed open network policy (it is no longer configurable).`,cp].join(` `),[`appearance.sidebar.showAllFiles has been removed.`,`The sidebar lists every file on disk by default; dot-prefixed entries are gated by appearance.sidebar.showHiddenFiles, and appearance.sidebar.showOnlyMarkdownFiles scopes the tree down to markdown documents as a per-machine view preference.`,cp].join(` `);function lp(e){try{let t=Intl.getCanonicalLocales(e)[0];return t===void 0?null:t}catch{return null}}function up(e){let t=[];for(let n of e){let e=lp(n);e!==null&&t.push(e)}return t}function dp(e){try{let t=Intl.getCanonicalLocales(e)[0];if(t===void 0)return null;let n=new Intl.Locale(t).maximize();return!n.language||!n.script?null:`${n.language}-${n.script}`}catch{return null}}var fp=`__system__`,pp=`__config__/project`,mp=`__user__/config.yml`,hp=`__local__/project`,gp=`__config__/okignore`;Object.freeze([pp,hp,mp,gp]);var _p=`__skill__/`,vp=`__extskill__/`,yp=[`project`,`global`];function bp(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)||e.startsWith(`__extskill__/`)}function xp(e){return`${vp}${e}`}function Sp(e,t){return`${vp}${e}/${Tp(t)}`}function Cp(e){return e.startsWith(vp)}function wp(e){if(!e.startsWith(`__extskill__/`))return null;let t=e.slice(13),n=t.indexOf(`/`),r=n<0?t:t.slice(0,n),i=n<0?null:t.slice(n+1);return/^[a-z0-9-]+$/.test(r)?{name:r,rel:i&&i.length>0?i:null}:null}function Tp(e){return e.replace(/\.mdx?$/i,``)}var Ep=`.ok/skills`;function Dp(e){return`${Ep}/${e}/SKILL`}var Op=[`references`,`scripts`];function kp(e,t){let n=e.trim();if(!n.startsWith(`/`))return null;let r=n.slice(1);if(r===``||r.includes(`/`))return null;let i=/^(\.[A-Za-z0-9_-]+\/skills)\/[^/]+\/(?:SKILL|references\/.+)$/.exec(t);return i?`${i[1]}/${r}/SKILL`:/^__skill__\/(global)\/[^/]+(?:\/references\/.+)?$/.exec(t)?Fp(`global`,r):null}function Ap(e,t){let n=/^(\.[A-Za-z0-9_-]+\/skills\/[^/]+)\/(?:SKILL|references\/.+)$/.exec(t)??/^(__skill__\/global\/[^/]+)(?:\/references\/.+)?$/.exec(t)??/^(__extskill__\/[^/]+)(?:\/.+)?$/.exec(t);if(!n)return null;let r=n[1],i=Tp(e.trim()).split(`/`).filter(e=>e!==``&&e!==`.`),[a]=i;return!a||!Op.includes(a)||i.includes(`..`)||i.length<2?null:`${r}/${i.join(`/`)}`}var jp=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(SKILL|references\/.+)$/;function Mp(e){let t=jp.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===`SKILL`?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}var Np=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function Pp(e){let t=Np.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===void 0?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}function Fp(e,t){return e===`project`?Dp(t):`${_p}${e}/${t}`}function Ip(e,t,n){let r=Tp(n);return e===`project`?`${Ep}/${t}/${r}`:`${_p}${e}/${t}/${r}`}function Lp(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function Rp(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);if(!i)return null;let a=Lp(i),o=a.indexOf(`/`),s=o<0?a:a.slice(0,o);return s?{kind:`skill`,scope:r,name:s,rel:o<0?null:a.slice(o+1)}:null}return null}var zp=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.md)?$/;function Bp(e,t){let n=e.replace(/^\/+|\/+$/g,``);return n?`${n}/.ok/templates/${t}`:`.ok/templates/${t}`}function Vp(e){let t=zp.exec(e);return t?{folder:(t[1]??``).replace(/^\/+|\/+$/g,``),name:t[2]}:null}function Hp(e){if(!e.startsWith(`__template__/`))return null;let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{folder:Lp(n<0?``:t.slice(0,n)),name:Lp(r)}:null}var Up=[`claude`,`claude-desktop`,`cursor`,`codex`,`copilot`,`opencode`,`openclaw`,`pi`,`antigravity`,`lm-studio`,`hermes`],Wp={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,copilot:`GitHub Copilot`,opencode:`OpenCode`,openclaw:`OpenClaw`,pi:`Pi`,antigravity:`Antigravity`,"lm-studio":`LM Studio`,hermes:`Hermes`},Gp={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.github/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/skills`,antigravity:null,"lm-studio":null,hermes:null},Kp={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.copilot/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/agent/skills`,antigravity:`.gemini/skills`,"lm-studio":null,hermes:null},qp=Up.filter(e=>Gp[e]!==null),Jp=`open-knowledge`;Up.flatMap(e=>{let t=Gp[e];return t===null?[]:[`${t}/${Jp}/`]}),qp.filter(e=>e!==`pi`&&e!==`copilot`).map(e=>({hostDir:(Gp[e]??``).split(`/`)[0],editorId:e})),Up.flatMap(e=>{let t=Kp[e];if(t===null)return[];let n=t.split(`/`)[0];return n===void 0?[]:[{hostDir:n,skillsRoot:t,editorId:e}]});var Yp={claude:`claude-code`,"claude-desktop":`claude-code`,cursor:`cursor`,codex:`codex`,copilot:`github-copilot-cli`,opencode:`opencode`,openclaw:`openclaw`,pi:`pi`,antigravity:`antigravity`,"lm-studio":`lm-studio`,hermes:`hermes`},Xp={claude:`.mcp.json`,"claude-desktop":null,cursor:`.cursor/mcp.json`,codex:`.codex/config.toml`,copilot:null,opencode:`opencode.json`,openclaw:null,pi:`.pi/extensions/open-knowledge.ts`,antigravity:null,"lm-studio":null,hermes:null},Zp=[`copilot`];function Qp(e,t){return Xp[e]===null?Gp[e]===null?!1:!Zp.includes(e)||t.userMcpEntryInstalled:!0}var $p=`.agents/skills`,em=`open-knowledge-pack-`,tm=`inkeep/open-knowledge-skills`,nm=/(^|[\s([])\/([a-z0-9][a-z0-9-]{1,63})(?=$|[\s.,;:!?)\]])/g,rm=new Set([`tmp`,`usr`,`etc`,`var`,`dev`,`opt`,`bin`,`api`,`home`,`root`]);function im(e){return!rm.has(e)}var am=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/,om=/^---[ \t]*$/;function sm(e){let t=e.match(am);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function cm(e,t){return e?t===``||/\r?\n$/.test(e)?e+t:e+(e.includes(`\r
180
180
  `)?`\r
181
181
  `:`
182
- `)+t:t}function lm(e){if(e===``)return``;let t=e.match(am);return t?(t[1]??``).replace(/\r?\n$/,``):e}var um=`frontmatter`,dm=[`text`,`number`,`boolean`,`date`,`list`,`object`];z(dm);var fm=no([N(),P(),F()]),pm=Po(()=>no([fm.transform(e=>String(e)),co(N(),mm),I(pm)])),mm=Po(()=>no([N(),P(),F(),I(pm),co(N(),mm)])),hm=/^\d{4}-\d{2}-\d{2}$/;function gm(e){return typeof e==`string`&&hm.test(e)}function _m(e){return Array.isArray(e)?`list`:typeof e==`object`&&e?`object`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:gm(e)?`date`:`text`}function vm(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(vm(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:vm(r);return t}return e}var ym=Bo(vm,co(N(),mm)),bm=co(N(),no([mm,Ja()]));function xm(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}function Sm(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Sm(e[n],t[n]))return!1;return!0}if(e!==null&&t!==null&&typeof e==`object`&&typeof t==`object`&&!Array.isArray(e)&&!Array.isArray(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.hasOwn(t,r)||!Sm(e[r],t[r]))return!1;return!0}return!1}var Cm={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function wm(e){if(e.trim()===``)return{doc:new ol({}),map:{}};let t;try{t=_u(e)}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new ol({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=ym.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function Tm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Em(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=$o(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(Tm(n)){let r=e.createNode(n),i=Xo(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function Dm(e){return e===``?``:`---\n${e.endsWith(`
182
+ `)+t:t}function lm(e){if(e===``)return``;let t=e.match(am);return t?(t[1]??``).replace(/\r?\n$/,``):e}var um=`frontmatter`,dm=[`text`,`number`,`boolean`,`date`,`list`,`object`];z(dm);var fm=ro([N(),P(),F()]),pm=Fo(()=>ro([fm.transform(e=>String(e)),lo(N(),mm),I(pm)])),mm=Fo(()=>ro([N(),P(),F(),I(pm),lo(N(),mm)])),hm=/^\d{4}-\d{2}-\d{2}$/;function gm(e){return typeof e==`string`&&hm.test(e)}function _m(e){return Array.isArray(e)?`list`:typeof e==`object`&&e?`object`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:gm(e)?`date`:`text`}function vm(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(vm(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:vm(r);return t}return e}var ym=Vo(vm,lo(N(),mm)),bm=lo(N(),ro([mm,Ya()]));function xm(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}function Sm(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Sm(e[n],t[n]))return!1;return!0}if(e!==null&&t!==null&&typeof e==`object`&&typeof t==`object`&&!Array.isArray(e)&&!Array.isArray(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.hasOwn(t,r)||!Sm(e[r],t[r]))return!1;return!0}return!1}var Cm={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function wm(e){if(e.trim()===``)return{doc:new ol({}),map:{}};let t;try{t=_u(e)}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new ol({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=ym.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function Tm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Em(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=es(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(Tm(n)){let r=e.createNode(n),i=Zo(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function Dm(e){return e===``?``:`---\n${e.endsWith(`
183
183
  `)?e.slice(0,-1):e}\n---\n`}function Om(e){let t=e.contents;return typeof t!=`object`||!t||!(`items`in t)?[]:t.items.map(e=>{let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}).filter(e=>e!==null)}var km=R({name:N(),description:N(),files:R({skillMd:N(),scripts:I(N()),references:I(N())})}),Am=R({pluginProvider:N().optional(),plugin:N().optional(),marketplace:N().optional(),version:N().optional(),gitCommitSha:N().optional(),scope:N().optional(),projectPath:N().optional()}),jm=R({commands:F(),hooks:F(),mcp:F()}),Mm=R({...km.shape,sourceHarness:N(),sourceHarnesses:I(N()),home:N(),provenance:Am,inert:jm,outsideProject:F().optional()}),Nm=R({schema:B(1),name:N(),version:N(),description:N().optional(),author:R({name:N()}).optional(),skills:I(N()),hostCompatibility:I(N()).optional(),capabilities:R({scripts:N(),network:N(),inert:I(N())}).optional(),provenance:R({source:N(),ref:N(),contentHash:N()}).optional()});L({skills:I(Mm),packs:I(Nm)}).loose(),L({results:I(L({id:N().min(1),name:N().min(1),source:N().min(1),description:N(),installs:P().int().nonnegative().nullable(),publisher:N().nullable()}).loose()),backend:z([`skills.sh`,`github-fallback`]),degraded:F()}).loose(),L({title:N(),description:N(),image:N().nullable(),skillsUrl:N().nullable(),sourceKind:z([`github`,`site`]),sourceUrl:N()}).loose(),L({skills:I(L({name:N(),description:N().nullable()}).loose())}).loose(),L({kind:z([`local`,`import`,`none`]),scope:z(yp).optional(),name:N().optional(),dir:N().optional(),source:N().optional(),ref:N().optional(),via:z([`source`,`publisher`]).optional()}).loose();var Pm=L({relPath:N(),content:N().nullable()}).loose(),Fm=L({provider:N(),plugin:N(),version:N().optional(),marketplace:N().optional(),repositoryUrl:N().optional()}).loose(),Im=L({provider:N(),plugin:N(),version:N().optional(),description:N().optional(),repositoryUrl:N().optional(),bundledSkills:I(N()),capabilities:L({commands:F(),hooks:F(),mcp:F(),agents:F()}),setupSupported:F()}).loose();L({name:N(),description:N().nullable(),skillMd:N(),files:I(Pm),plugin:Fm.optional(),pluginBundle:Im.optional()}).loose();var Lm=new Set([`project`,`local`]);function Rm(e){return e!==void 0&&Lm.has(e)?`project`:`global`}var zm=/^([\w.-]+)\/([\w.-]+)$/,Bm=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Vm(e){let t=zm.exec(e);if(t){let[,e,n]=t;if(e&&n)return{kind:`github`,owner:e,repo:n}}return Bm.test(e)?{kind:`site`,hostname:e}:null}function Hm(e,t){let n=Vm(e),r=t.trim();if(!n||!r)return null;let i=encodeURIComponent(r);if(n.kind===`github`){let e=encodeURIComponent(n.owner),t=encodeURIComponent(n.repo);return{sourceKind:`github`,skillsUrl:`https://www.skills.sh/${e}/${t}/${i}`,sourceUrl:`https://github.com/${e}/${t}`}}return{sourceKind:`site`,skillsUrl:`https://www.skills.sh/site/${encodeURIComponent(n.hostname)}/${i}`,sourceUrl:`https://${n.hostname}`}}var Um={"bridge-merge-loss":{visibility:`surfaced`,gcBucket:`bridge-merge-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"producer-guard-loss":{visibility:`surfaced`,gcBucket:`producer-guard-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-duplication":{visibility:`surfaced`,gcBucket:`observer-a-duplication`,bundleExposure:`metadata`,chainAnchor:!1},"external-change-rescue":{visibility:`surfaced`,gcBucket:`external-change-rescue`,bundleExposure:`metadata`,chainAnchor:!1},"defer-exhaustion-loss":{visibility:`surfaced`,gcBucket:`defer-exhaustion-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-apply-loss":{visibility:`surfaced`,gcBucket:`observer-a-apply-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-derive-loss":{visibility:`surfaced`,gcBucket:`bridge-derive-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-backstop-trip":{visibility:`surfaced`,gcBucket:`bridge-backstop-trip`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-reconcile-loss":{visibility:`surfaced`,gcBucket:`persistence-reconcile-loss`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-duplication-reset":{visibility:`surfaced`,gcBucket:`persistence-duplication-reset`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-divergence-realign":{visibility:`surfaced`,gcBucket:`persistence-divergence-realign`,bundleExposure:`metadata`,chainAnchor:!1},"managed-artifact-reconcile":{visibility:`surfaced`,gcBucket:`managed-artifact-reconcile`,bundleExposure:`metadata`,chainAnchor:!1},"auto-consolidation":{visibility:`hidden`,gcBucket:`auto-consolidation`,bundleExposure:`none`,chainAnchor:!0}};function Wm(e){return e==null?!0:Um[e].visibility===`surfaced`}function Gm(e){this.content=e}Gm.prototype={constructor:Gm,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new Gm(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Gm(n)},addToStart:function(e,t){return new Gm([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Gm(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new Gm(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Gm.from(e),e.size?new Gm(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Gm.from(e),e.size?new Gm(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Gm.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Gm.from=function(e){if(e instanceof Gm)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Gm(t)};function Km(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Km(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function qm(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=qm(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var U=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Km(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return qm(this,e,t,n)}findIndex(e){if(e==0)return Ym(0,e);if(e==this.size)return Ym(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Ym(t+1,i):Ym(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};U.empty=new U([],0);var Jm={index:0,offset:0};function Ym(e,t){return Jm.index=e,Jm.offset=t,Jm}function Xm(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Xm(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Xm(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Zm=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Xm(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Zm.none=[];var Qm=class extends Error{},W=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=eh(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e($m(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(U.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};W.empty=new W(U.empty,0,0);function $m(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy($m(a.content,t-i-1,n-i-1)))}function eh(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=eh(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function th(e,t,n){if(n.openStart>e.depth)throw new Qm(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Qm(`Inconsistent open depths`);return nh(e,t,n,0)}function nh(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=nh(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return sh(a,lh(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return sh(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=uh(n,e);return sh(a,ch(e,i,o,t,r))}}function rh(e,t){if(!t.type.compatibleContent(e.type))throw new Qm(`Cannot join `+t.type.name+` onto `+e.type.name)}function ih(e,t,n){let r=e.node(n);return rh(r,t.node(n)),r}function ah(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function oh(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ah(e.nodeAfter,r),a++));for(let e=a;e<o;e++)ah(i.child(e),r);t&&t.depth==n&&t.textOffset&&ah(t.nodeBefore,r)}function sh(e,t){return e.type.checkContent(t),e.copy(t)}function ch(e,t,n,r,i){let a=e.depth>i&&ih(e,t,i+1),o=r.depth>i&&ih(n,r,i+1),s=[];return oh(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(rh(a,o),ah(sh(a,ch(e,t,n,r,i+1)),s)):(a&&ah(sh(a,lh(e,t,i+1)),s),oh(t,n,i,s),o&&ah(sh(o,lh(n,r,i+1)),s)),oh(r,null,i,s),new U(s)}function lh(e,t,n){let r=[];return oh(null,e,n,r),e.depth>n&&ah(sh(ih(e,t,n+1),lh(e,t,n+1)),r),oh(t,null,n,r),new U(r)}function uh(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(U.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var dh=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Zm.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new hh(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=mh.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else mh.set(t,r=new fh);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%ph,i}},fh=class{constructor(){this.elts=[],this.i=0}},ph=12,mh=new WeakMap,hh=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},gh=Object.create(null),_h=class e{constructor(e,t,n,r=Zm.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||U.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Xm(this.attrs,t||e.defaultAttrs||gh)&&Zm.sameSet(this.marks,n||Zm.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return W.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new W(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return th(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return dh.resolveCached(this,e)}resolveNoCache(e){return dh.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),yh(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=U.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Zm.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Zm.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=U.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};_h.prototype.text=void 0;var vh=class e extends _h{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):yh(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function yh(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var bh=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new xh(t,n);if(r.next==null)return e.empty;let i=Sh(r);r.next&&r.err(`Unexpected trailing text`);let a=Mh(kh(i));return Nh(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return U.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
184
184
  `)}};bh.empty=new bh(!0);var xh=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Sh(e){let t=[];do t.push(Ch(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Ch(e){let t=[];do t.push(wh(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function wh(e){let t=Oh(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Eh(e,t);else break;return t}function Th(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Eh(e,t){let n=Th(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Th(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Dh(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Oh(e){if(e.eat(`(`)){let t=Sh(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Dh(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function kh(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Ah(e,t){return t-e}function jh(e,t){let n=[];return r(t),n.sort(Ah);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Mh(e){let t=Object.create(null);return n(jh(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);jh(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new bh(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Ah);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Nh(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Ph(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Fh(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Ih(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Lh(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new dte(e,r,t[r]);return n}var Rh=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Lh(e,n.attrs),this.defaultAttrs=Ph(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==bh.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Fh(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new _h(this,this.computeAttrs(e),U.from(t),Zm.setFrom(n))}createChecked(e=null,t,n){return t=U.from(t),this.checkContent(t),new _h(this,this.computeAttrs(e),t,Zm.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=U.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(U.empty,!0);return i?new _h(this,e,t.append(i),Zm.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ih(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:Zm.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function ute(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var dte=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?ute(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},zh=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Lh(e,r.attrs),this.excluded=null;let i=Ph(this.attrs);this.instance=i?new Zm(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Zm(this,Fh(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ih(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Bh=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Gm.from(e.nodes),t.marks=Gm.from(e.marks||{}),this.nodes=Rh.compile(this.spec.nodes,this),this.marks=zh.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=bh.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Vh(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Vh(this,n.split(` `))}this.nodeFromJSON=e=>_h.fromJSON(this,e),this.markFromJSON=e=>Zm.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Rh))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new vh(n,n.defaultAttrs,e,Zm.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Vh(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function fte(e){return e.tag!=null}function pte(e){return e.style!=null}var Hh=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(fte(e))this.tags.push(e);else if(pte(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Xh(this,t,!1);return n.addAll(e,Zm.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Xh(this,t,!0);return n.addAll(e,Zm.none,t.from,t.to),W.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(gte(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Zh(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Zh(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Uh={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},mte={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Wh={ol:!0,ul:!0},Gh=1,Kh=2,qh=4;function Jh(e,t,n){return t==null?e&&e.whitespace==`pre`?Gh|Kh:n&~qh:(t?Gh:0)|(t===`full`?Kh:0)}var Yh=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=Zm.none,this.match=i||(a&qh?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(U.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Gh)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=U.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(U.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Uh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Xh=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Jh(null,t.preserveWhitespace,0)|(n?qh:0);i=r?new Yh(r.type,r.attrs,Zm.none,!0,t.topMatch||r.type.contentMatch,a):n?new Yh(null,null,Zm.none,!0,null,a):new Yh(e.schema.topNodeType,null,Zm.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Kh?`full`:this.localPreserveWS||(r.options&Gh)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
185
185
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Wh.hasOwnProperty(a)&&this.parser.normalizeLists&&hte(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:mte.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Uh.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
@@ -304,28 +304,28 @@ ${n}`}}),s}var xE=new WeakMap;function SE(e,t){let n=xE.get(e);if(!n){let t={cal
304
304
  `,EO=`️`,DO=`‍`,OO=``,kO=null,AO=null;function jO(e=[]){let t={};pD.groups=t;let n=new pD;kO??=FO(QE),AO??=FO($E),Y(n,`'`,KD),Y(n,`{`,kD),Y(n,`}`,AD),Y(n,`[`,jD),Y(n,`]`,MD),Y(n,`(`,ND),Y(n,`)`,PD),Y(n,`<`,FD),Y(n,`>`,ID),Y(n,`(`,LD),Y(n,`)`,RD),Y(n,`「`,zD),Y(n,`」`,BD),Y(n,`『`,VD),Y(n,`』`,HD),Y(n,`<`,UD),Y(n,`>`,WD),Y(n,`&`,GD),Y(n,`*`,qD),Y(n,`@`,JD),Y(n,"`",XD),Y(n,`^`,ZD),Y(n,`:`,QD),Y(n,`,`,$D),Y(n,`$`,eO),Y(n,`.`,tO),Y(n,`=`,nO),Y(n,`!`,rO),Y(n,`-`,iO),Y(n,`%`,aO),Y(n,`|`,oO),Y(n,`+`,sO),Y(n,`#`,cO),Y(n,`?`,lO),Y(n,`"`,uO),Y(n,`/`,pO),Y(n,`;`,fO),Y(n,`~`,mO),Y(n,`_`,hO),Y(n,`\\`,YD),Y(n,`・`,dO);let r=hD(n,SO,ED,{[eD]:!0});hD(r,SO,r);let i=hD(r,yO,yD,{[rD]:!0}),a=hD(r,bO,bD,{[iD]:!0}),o=hD(n,yO,_D,{[tD]:!0});hD(o,SO,i),hD(o,yO,o),hD(i,SO,i),hD(i,yO,i);let s=hD(n,bO,vD,{[nD]:!0});hD(s,yO),hD(s,SO,a),hD(s,bO,s),hD(a,SO,a),hD(a,yO),hD(a,bO,a);let c=Y(n,TO,OD,{[lD]:!0}),l=Y(n,wO,DD,{[lD]:!0}),u=hD(n,CO,DD,{[lD]:!0});Y(n,OO,u),Y(l,TO,c),Y(l,OO,u),hD(l,CO,u),Y(u,wO),Y(u,TO),hD(u,CO,u),Y(u,OO,u);let d=hD(n,xO,gO,{[oD]:!0});Y(d,`#`),hD(d,xO,d),Y(d,EO,d);let f=Y(d,DO);Y(f,`#`),hD(f,xO,d);let p=[[yO,o],[SO,i]],m=[[yO,null],[bO,s],[SO,a]];for(let e=0;e<kO.length;e++)PO(n,kO[e],SD,_D,p);for(let e=0;e<AO.length;e++)PO(n,AO[e],CD,vD,m);dD(SD,{tld:!0,ascii:!0},t),dD(CD,{utld:!0,alpha:!0},t),PO(n,`file`,wD,_D,p),PO(n,`mailto`,wD,_D,p),PO(n,`http`,TD,_D,p),PO(n,`https`,TD,_D,p),PO(n,`ftp`,TD,_D,p),PO(n,`ftps`,TD,_D,p),dD(wD,{scheme:!0,ascii:!0},t),dD(TD,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[sD]:!0}:{[cD]:!0};r.indexOf(`-`)>=0?i[aD]=!0:yO.test(r)?SO.test(r)?i[rD]=!0:i[tD]=!0:i[eD]=!0,gD(n,r,r,i)}return gD(n,`localhost`,xD,{ascii:!0}),n.jd=new pD(_O),{start:n,tokens:Object.assign({groups:t},vO)}}function MO(e,t){let n=NO(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function NO(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function PO(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new pD(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new pD(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function FO(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var IO={defaultProtocol:`http`,events:null,format:RO,formatHref:RO,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function LO(e,t=null){let n=Object.assign({},IO);e&&(n=Object.assign(n,e instanceof LO?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}LO.prototype={o:IO,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:IO[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function RO(e){return e}function zO(e,t){this.t=`token`,this.v=e,this.tk=t}zO.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=IO.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function BO(e,t){class n extends zO{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var VO=BO(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),HO=BO(`text`),UO=BO(`nl`),WO=BO(`url`,{isLink:!0,toHref(e=IO.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==xD&&e[1].t===QD}}),GO=e=>new pD(e);function KO({groups:e}){let t=e.domain.concat([GD,qD,JD,YD,XD,ZD,eO,nO,iO,ED,aO,oO,sO,cO,pO,_O,mO,hO]),n=[KD,QD,$D,tO,rO,aO,lO,uO,fO,FD,ID,kD,AD,MD,jD,ND,PD,LD,RD,zD,BD,VD,HD,UD,WD],r=[GD,KD,qD,YD,XD,ZD,eO,nO,iO,kD,AD,aO,oO,sO,cO,lO,pO,_O,mO,hO],i=GO(),a=Y(i,mO);mD(a,r,a),mD(a,e.domain,a);let o=GO(),s=GO(),c=GO();mD(i,e.domain,o),mD(i,e.scheme,s),mD(i,e.slashscheme,c),mD(o,r,a),mD(o,e.domain,o);let l=Y(o,JD);Y(a,JD,l),Y(s,JD,l),Y(c,JD,l);let u=Y(a,tO);mD(u,r,a),mD(u,e.domain,a);let d=GO();mD(l,e.domain,d),mD(d,e.domain,d);let f=Y(d,tO);mD(f,e.domain,d);let p=GO(VO);mD(f,e.tld,p),mD(f,e.utld,p),Y(l,xD,p);let m=Y(d,iO);Y(m,iO,m),mD(m,e.domain,d),mD(p,e.domain,d),Y(p,tO,f),Y(p,iO,m);let h=Y(o,iO),g=Y(o,tO);Y(h,iO,h),mD(h,e.domain,o),mD(g,r,a),mD(g,e.domain,o);let _=GO(WO);mD(g,e.tld,_),mD(g,e.utld,_),mD(_,e.domain,o),mD(_,r,a),Y(_,tO,g),Y(_,iO,h),Y(_,JD,l);let v=Y(_,QD),y=GO(WO);mD(v,e.numeric,y);let b=GO(WO),x=GO();mD(b,t,b),mD(b,n,x),mD(x,t,b),mD(x,n,x),Y(_,pO,b),Y(y,pO,b);let S=Y(s,QD),C=Y(Y(Y(c,QD),pO),pO);mD(s,e.domain,o),Y(s,tO,g),Y(s,iO,h),mD(c,e.domain,o),Y(c,tO,g),Y(c,iO,h),mD(S,e.domain,b),Y(S,pO,b),Y(S,lO,b),mD(C,e.domain,b),mD(C,t,b),Y(C,pO,b);let w=[[kD,AD],[jD,MD],[ND,PD],[FD,ID],[LD,RD],[zD,BD],[VD,HD],[UD,WD]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=Y(b,r);Y(x,r,a);let o=GO(WO);mD(a,t,o);let s=GO();mD(a,n,s),Y(a,i,b),mD(o,t,o),mD(o,n,s),mD(s,t,o),mD(s,n,s),Y(o,i,b),Y(s,i,b)}return Y(i,xD,_),Y(i,OD,UO),{start:i,tokens:vO}}function qO(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(JO(HO,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(JO(e,t,r))}}return o.length>0&&a.push(JO(HO,t,o)),a}function JO(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var YO=typeof console<`u`&&console&&console.warn||(()=>{}),XO=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,ZO={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function QO(){return pD.groups={},ZO.scanner=null,ZO.parser=null,ZO.tokenQueue=[],ZO.pluginQueue=[],ZO.customSchemes=[],ZO.initialized=!1,ZO}function $O(e,t=!1){if(ZO.initialized&&YO(`linkifyjs: already initialized - will not register custom scheme "${e}" ${XO}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
305
305
  1. Must only contain digits, lowercase ASCII letters or "-"
306
306
  2. Cannot start or end with "-"
307
- 3. "-" cannot repeat`);ZO.customSchemes.push([e,t])}function ek(){ZO.scanner=jO(ZO.customSchemes);for(let e=0;e<ZO.tokenQueue.length;e++)ZO.tokenQueue[e][1]({scanner:ZO.scanner});ZO.parser=KO(ZO.scanner.tokens);for(let e=0;e<ZO.pluginQueue.length;e++)ZO.pluginQueue[e][1]({scanner:ZO.scanner,parser:ZO.parser});return ZO.initialized=!0,ZO}function tk(e){return ZO.initialized||ek(),qO(ZO.parser.start,e,MO(ZO.scanner.start,e))}tk.scan=MO;function nk(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new LO(n),i=tk(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var rk=`[\0- \xA0 ᠎ -\u2029  ]`,ik=new RegExp(rk),Vte=RegExp(`${rk}$`),Hte=new RegExp(rk,`g`);function Ute(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function Wte(e){return new h_({key:new v_(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(Pw(tw(n.doc,[...t])).forEach(({newRange:t})=>{let n=iw(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!Vte.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(ik).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=tk(n).map(t=>t.toObject(e.defaultProtocol));if(!Ute(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Fw(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function Gte(e){return new h_({key:new v_(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=jw(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function Kte(e){return new h_({key:new v_(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=nk(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function ak(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(Hte,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var ok=MT.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){$O(e);return}$O(e.scheme,e.optionalSlashes)})},onDestroy(){QO()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!ak(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!ak(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!ak(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,gw(this.options.HTMLAttributes,e),0]:[`a`,gw(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!ak(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!ak(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[DE({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=nk(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!ak(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Wte({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!ak(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Gte({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Kte({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),qte=ok,Jte=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Yte=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Xte=MT.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,gw(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark(`highlight`,t.parseInline(e.tokens||[])),markdownTokenizer:{name:`highlight`,level:`inline`,start:e=>e.indexOf(`==`),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:`highlight`,raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[rE({find:Jte,type:this.type})]},addPasteRules(){return[DE({find:Yte,type:this.type})]}}),sk,ck;if(typeof WeakMap<`u`){let e=new WeakMap;sk=t=>e.get(t),ck=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;sk=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},ck=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var lk=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return sk(e)||ck(e,Zte(e))}};function Zte(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=Qte(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new lk(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&$te(s,o,e),s}function Qte(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function $te(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=ene(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function ene(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function uk(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var dk=new v_(`selectingCells`);function fk(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function tne(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function pk(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function mk(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=fk(t.$head)||nne(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function nne(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function hk(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function rne(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function gk(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function _k(e,t,n){let r=e.node(-1),i=lk.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function vk(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function yk(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function ine(e,t,n){let r=uk(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var bk=class e extends G{constructor(e,t=e){let n=e.node(-1),r=lk.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new Xg(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(hk(r)&&hk(i)&&gk(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return K.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=lk.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=vk(e,0,l)),u>0&&(e=vk(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(U.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new W(U.from(o),1,1)}replace(e,t=W.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?W.empty:t)}let i=G.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new W(U.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=lk.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=lk.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=lk.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=lk.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new ane(this.$anchorCell.pos,this.$headCell.pos)}};bk.prototype.visible=!1,G.jsonID(`cell`,bk);var ane=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&gk(t,n)?new bk(t,n):G.near(n,1)}};function one(e){if(!(e.selection instanceof bk))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(Vx.node(n,n+e.nodeSize,{class:`selectedCell`}))}),Wx.create(e.doc,t)}function sne({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function cne({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function lne(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof q&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=bk.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=bk.rowSelection(e,e)}else if(!n){let e=lk.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=bk.create(i,t+1,n)}}else r instanceof K&&sne(r)?a=K.create(i,r.from):r instanceof K&&cne(r)&&(a=K.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var une=new v_(`fix-tables`);function xk(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?xk(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function Sk(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=dne(e,t,r,n))};return t?t.doc!=e.doc&&xk(t.doc,e.doc,0,r):e.doc.descendants(r),n}function dne(e,t,n,r){let i=lk.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,vk(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=uk(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(une,{fixTables:!0})}function fne(e){return pne(e=>e.type.spec.tableRole===`table`,e)}function pne(e,t){for(let n=t.depth;n>=0;--n){let r=t.node(n);if(e(r))return{node:r,pos:n===0?0:t.before(n),start:t.start(n),depth:n}}return null}function Ck(e){let t=e.selection,n=mk(e),r=n.node(-1),i=n.start(-1),a=lk.get(r);return{...t instanceof bk?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function wk(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;ine(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,yk(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?uk(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function mne(e,t){if(!pk(e))return!1;if(t){let n=Ck(e);t(wk(e.tr,n,n.left))}return!0}function hne(e,t){if(!pk(e))return!1;if(t){let n=Ck(e);t(wk(e.tr,n,n.right))}return!0}function gne(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,vk(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function _ne(e,t){if(!pk(e))return!1;if(t){let n=Ck(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;gne(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=lk.get(e)}t(r)}return!0}function vne(e,t,n){let r=uk(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function Tk(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;vne(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?uk(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,uk(r.type.schema).row.create(null,o)),e}function yne(e,t){if(!pk(e))return!1;if(t){let n=Ck(e);t(Tk(e.tr,n,n.top))}return!0}function bne(e,t){if(!pk(e))return!1;if(t){let n=Ck(e);t(Tk(e.tr,n,n.bottom))}return!0}function xne(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function Sne(e,t){if(!pk(e))return!1;if(t){let n=Ck(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;xne(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=lk.get(n.table)}t(r)}return!0}function Ek(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function Cne({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function Dk(e,t){let n=e.selection;if(!(n instanceof bk)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=Ck(e),{map:i}=r;if(Cne(i,r))return!1;if(t){let n=e.tr,a={},o=U.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{Ek(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...yk(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=Ek(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new bk(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function Ok(e,t){let n=uk(e.schema);return wne(({node:e})=>n[e.type.spec.tableRole])(e,t)}function wne(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof bk){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=tne(r.$from),!i)return!1;a=fk(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=Ck(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof bk&&u.setSelection(new bk(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function Tne(e,t){return function(n,r){if(!pk(n))return!1;let i=mk(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof bk?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Ene(e){return function(t,n){if(!pk(t))return!1;if(n){let r=uk(t.schema),i=Ck(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function kk(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Ak(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Ene(e):function(t,n){if(!pk(t))return!1;if(n){let r=uk(t.schema),i=Ck(t),a=t.tr,o=kk(`row`,i,r),s=kk(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Ak(`row`,{useDeprecatedLogic:!0}),Ak(`column`,{useDeprecatedLogic:!0});var Dne=Ak(`cell`,{useDeprecatedLogic:!0});function One(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function jk(e){return function(t,n){if(!pk(t))return!1;let r=One(mk(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(K.between(e,rne(e))).scrollIntoView())}return!0}}function kne(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Mk(e,t){let n=e.selection;if(!(n instanceof bk))return!1;if(t){let r=e.tr,i=uk(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new W(i,0,0))}),r.docChanged&&t(r)}return!0}function Ane(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=Nk(uk(o).row,new W(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?Nk(uk(o).row,new W(t,n,r)).content:t);else return null;return jne(o,s)}function jne(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(U.empty),n[i]<r){let a=uk(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(U.from(o))}return{height:t.length,width:r,rows:t}}function Nk(e,t){let n=e.createAndFill();return new Jg(n).replace(0,n.content.size,t).doc}function Mne({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(vk(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(U.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(U.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function Nne(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=uk(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,U.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function Pk(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function Fk(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,vk(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(vk(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function Ik(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=lk.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=lk.get(a),f=d.mapping.maps.length}Nne(d,o,a,n,l,u,f)&&p(),Pk(d,o,a,n,c,l,s,f)&&p(),Pk(d,o,a,n,c,l,u,f)&&p(),Fk(d,o,a,n,s,u,c,f)&&p(),Fk(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new W(i.rows[e-s],0,0))}p(),d.setSelection(new bk(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var Pne=RS({ArrowLeft:Rk(`horiz`,-1),ArrowRight:Rk(`horiz`,1),ArrowUp:Rk(`vert`,-1),ArrowDown:Rk(`vert`,1),"Shift-ArrowLeft":zk(`horiz`,-1),"Shift-ArrowRight":zk(`horiz`,1),"Shift-ArrowUp":zk(`vert`,-1),"Shift-ArrowDown":zk(`vert`,1),Backspace:Mk,"Mod-Backspace":Mk,Delete:Mk,"Mod-Delete":Mk});function Lk(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Rk(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof bk)return Lk(n,r,G.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=Bk(i,e,t);if(o==null)return!1;if(e==`horiz`)return Lk(n,r,G.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=_k(i,e,t),s;return s=a?G.near(a,1):t<0?G.near(n.doc.resolve(i.before(-1)),-1):G.near(n.doc.resolve(i.after(-1)),1),Lk(n,r,s)}}}function zk(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof bk)o=a;else{let r=Bk(i,e,t);if(r==null)return!1;o=new bk(n.doc.resolve(r))}let s=_k(o.$headCell,e,t);return s?Lk(n,r,new bk(o.$anchorCell,s)):!1}}function Fne(e,t){let n=e.state.doc,r=fk(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new bk(r))),!0):!1}function Ine(e,t,n){if(!pk(e.state))return!1;let r=Ane(n),i=e.state.selection;if(i instanceof bk){r||={width:1,height:1,rows:[U.from(Nk(uk(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=lk.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=Mne(r,o.right-o.left,o.bottom-o.top),Ik(e.state,e.dispatch,a,o,r),!0}else if(r){let t=mk(e.state),n=t.start(-1);return Ik(e.state,e.dispatch,n,lk.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function Lne(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=Vk(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof bk)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=fk(e.state.selection.$anchor))!=null&&Hk(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=Hk(e,n),i=dk.getState(e.state)==null;if(!r||!gk(t,r))if(i)r=t;else return;let a=new bk(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(dk,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),dk.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(dk,-1))}function o(r){let o=r,s=dk.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(Vk(e,o.target)!=n&&(c=Hk(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function Bk(e,t,n){if(!(e.state.selection instanceof K))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function Vk(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function Hk(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&fk(e.state.doc.resolve(r))||fk(e.state.doc.resolve(i))}var Rne=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),Uk(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,Uk(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function Uk(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var Wk=new v_(`tableColumnResizing`);function zne({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=Rne,lastColumnResizable:i=!0}={}){let a=new h_({key:Wk,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=uk(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new Bne(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=Wk.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{Vne(t,n,e,i)},mouseleave:e=>{Hne(e)},mousedown:(e,r)=>{Une(e,r,t,n)}},decorations:e=>{let t=Wk.getState(e);if(t&&t.activeHandle>-1)return Jne(e,t.activeHandle)},nodeViews:{}}});return a}var Bne=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(Wk);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return hk(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function Vne(e,t,n,r){if(!e.editable)return;let i=Wk.getState(e.state);if(i&&!i.dragging){let a=Gne(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=Gk(e,t,`left`,n):i-t.clientX<=n&&(o=Gk(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=lk.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}qk(e,o)}}}function Hne(e){if(!e.editable)return;let t=Wk.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&qk(e,-1)}function Une(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=Wk.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=Wne(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(Wk,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=Wk.getState(e.state);r?.dragging&&(Kne(e,r.activeHandle,Kk(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(Wk,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=Wk.getState(e.state);if(i&&i.dragging){let a=Kk(i.dragging,t,n);Jk(e,i.activeHandle,a,r)}}return Jk(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function Wne(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function Gne(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function Gk(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=fk(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=lk.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function Kk(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function qk(e,t){e.dispatch(e.state.tr.setMeta(Wk,{setHandle:t}))}function Kne(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=lk.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():qne(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function Jk(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=lk.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&Uk(a,c.firstChild,c,r,s,n)}function qne(e){return Array(e).fill(0)}function Jne(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return Wx.empty;let a=lk.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,Wk.getState(e)?.dragging&&n.push(Vx.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(Vx.widget(s,c))}}return Wx.create(e.doc,n)}function Yne({allowTableNodeSelection:e=!1}={}){return new h_({key:dk,state:{init(){return null},apply(e,t){let n=e.getMeta(dk);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:one,handleDOMEvents:{mousedown:Lne},createSelectionBetween(e){return dk.getState(e.state)==null?null:e.state.selection},handleTripleClick:Fne,handleKeyDown:Pne,handlePaste:Ine},appendTransaction(t,n,r){return lne(r,Sk(r,n),e)}})}function Yk(e){return e===`left`||e===`right`||e===`center`?e:null}function Xne(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return Yk(t||n)}function Zne(e){return Yk(e?.align)}function Xk(){return{default:null,parseHTML:e=>Xne(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}var Zk=TE.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`),n=t?t.split(`,`).map(e=>parseInt(e,10)):null;if(!n){let t=e.closest(`table`)?.querySelectorAll(`colgroup > col`),n=Array.from(e.parentElement?.children||[]).indexOf(e);if(n&&n>-1&&t&&t[n]){let e=t[n].getAttribute(`width`);return e?[parseInt(e,10)]:null}}return n}},align:Xk()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,gw(this.options.HTMLAttributes,e),0]}}),Qk=TE.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):null}},align:Xk()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,gw(this.options.HTMLAttributes,e),0]}}),$k=TE.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,gw(this.options.HTMLAttributes,e),0]}});function eA(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function tA(e,t,n,r,i,a){var o;let s=0,c=!0,l=t.firstChild,u=e.firstChild;if(u!==null)for(let e=0,n=0;e<u.childCount;e+=1){let{colspan:o,colwidth:d}=u.child(e).attrs;for(let e=0;e<o;e+=1,n+=1){let o=i===n?a:d&&d[e],u=o?`${o}px`:``;if(s+=o||r,o||(c=!1),l){if(l.style.width!==u){let[e,t]=eA(r,o);l.style.setProperty(e,t)}l=l.nextSibling}else{let e=document.createElement(`col`),[n,i]=eA(r,o);e.style.setProperty(n,i),t.appendChild(e)}}}for(;l;){let e=l.nextSibling;(o=l.parentNode)==null||o.removeChild(l),l=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);c&&!d?(n.style.width=`${s}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${s}px`)}var Qne=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),tA(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,tA(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}};function $ne(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=eA(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function nA(e,t){return t?e.createChecked(null,t):e.createAndFill()}function ere(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function tre(e,t,n,r,i){let a=ere(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=nA(a.cell,i);if(e&&s.push(e),r){let e=nA(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function nre(e){return e instanceof bk}var rA=({editor:e})=>{let{selection:t}=e.state;if(!nre(t))return!1;let n=0;return aw(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1};function rre(e){return(e||``).replace(/\s+/g,` `).trim()}function ire(e,t,n={}){let r=n.cellLineSeparator??``;if(!e||!e.content||e.content.length===0)return``;let i=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{let i=``;i=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(r):e.content?t.renderChildren(e.content):``;let a=rre(i),o=e.type===`tableHeader`,s=Zne(e.attrs);n.push({text:a,isHeader:o,align:s})}),i.push(n)});let a=i.reduce((e,t)=>Math.max(e,t.length),0);if(a===0)return``;let o=Array(a).fill(0);i.forEach(e=>{for(let t=0;t<a;t+=1){let n=(e[t]?.text||``).length;n>o[t]&&(o[t]=n),o[t]<3&&(o[t]=3)}});let s=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),c=i[0],l=c.some(e=>e.isHeader),u=Array(a).fill(null);i.forEach(e=>{for(let t=0;t<a;t+=1)!u[t]&&e[t]?.align&&(u[t]=e[t].align)});let d=`
307
+ 3. "-" cannot repeat`);ZO.customSchemes.push([e,t])}function ek(){ZO.scanner=jO(ZO.customSchemes);for(let e=0;e<ZO.tokenQueue.length;e++)ZO.tokenQueue[e][1]({scanner:ZO.scanner});ZO.parser=KO(ZO.scanner.tokens);for(let e=0;e<ZO.pluginQueue.length;e++)ZO.pluginQueue[e][1]({scanner:ZO.scanner,parser:ZO.parser});return ZO.initialized=!0,ZO}function tk(e){return ZO.initialized||ek(),qO(ZO.parser.start,e,MO(ZO.scanner.start,e))}tk.scan=MO;function nk(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new LO(n),i=tk(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var rk=`[\0- \xA0 ᠎ -\u2029  ]`,Vte=new RegExp(rk),Hte=RegExp(`${rk}$`),Ute=new RegExp(rk,`g`);function Wte(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function Gte(e){return new h_({key:new v_(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(Pw(tw(n.doc,[...t])).forEach(({newRange:t})=>{let n=iw(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!Hte.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(Vte).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=tk(n).map(t=>t.toObject(e.defaultProtocol));if(!Wte(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Fw(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function Kte(e){return new h_({key:new v_(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=jw(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function qte(e){return new h_({key:new v_(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=nk(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function ik(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(Ute,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var ak=MT.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){$O(e);return}$O(e.scheme,e.optionalSlashes)})},onDestroy(){QO()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!ik(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!ik(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!ik(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,gw(this.options.HTMLAttributes,e),0]:[`a`,gw(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!ik(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!ik(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[DE({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=nk(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!ik(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Gte({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!ik(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Kte({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(qte({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Jte=ak,Yte=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Xte=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Zte=MT.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,gw(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark(`highlight`,t.parseInline(e.tokens||[])),markdownTokenizer:{name:`highlight`,level:`inline`,start:e=>e.indexOf(`==`),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:`highlight`,raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[rE({find:Yte,type:this.type})]},addPasteRules(){return[DE({find:Xte,type:this.type})]}}),ok,sk;if(typeof WeakMap<`u`){let e=new WeakMap;ok=t=>e.get(t),sk=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;ok=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},sk=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var ck=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return ok(e)||sk(e,Qte(e))}};function Qte(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=$te(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new ck(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&ene(s,o,e),s}function $te(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function ene(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=tne(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function tne(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function lk(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var uk=new v_(`selectingCells`);function dk(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function nne(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function fk(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function pk(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=dk(t.$head)||rne(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function rne(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function mk(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function ine(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function hk(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function gk(e,t,n){let r=e.node(-1),i=ck.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function _k(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function vk(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function ane(e,t,n){let r=lk(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var yk=class e extends G{constructor(e,t=e){let n=e.node(-1),r=ck.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new Xg(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(mk(r)&&mk(i)&&hk(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return K.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=ck.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=_k(e,0,l)),u>0&&(e=_k(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(U.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new W(U.from(o),1,1)}replace(e,t=W.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?W.empty:t)}let i=G.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new W(U.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=ck.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=ck.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=ck.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=ck.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new one(this.$anchorCell.pos,this.$headCell.pos)}};yk.prototype.visible=!1,G.jsonID(`cell`,yk);var one=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&hk(t,n)?new yk(t,n):G.near(n,1)}};function sne(e){if(!(e.selection instanceof yk))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(Vx.node(n,n+e.nodeSize,{class:`selectedCell`}))}),Wx.create(e.doc,t)}function cne({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function lne({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function une(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof q&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=yk.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=yk.rowSelection(e,e)}else if(!n){let e=ck.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=yk.create(i,t+1,n)}}else r instanceof K&&cne(r)?a=K.create(i,r.from):r instanceof K&&lne(r)&&(a=K.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var dne=new v_(`fix-tables`);function bk(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?bk(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function xk(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=fne(e,t,r,n))};return t?t.doc!=e.doc&&bk(t.doc,e.doc,0,r):e.doc.descendants(r),n}function fne(e,t,n,r){let i=ck.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,_k(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=lk(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(dne,{fixTables:!0})}function pne(e){return mne(e=>e.type.spec.tableRole===`table`,e)}function mne(e,t){for(let n=t.depth;n>=0;--n){let r=t.node(n);if(e(r))return{node:r,pos:n===0?0:t.before(n),start:t.start(n),depth:n}}return null}function Sk(e){let t=e.selection,n=pk(e),r=n.node(-1),i=n.start(-1),a=ck.get(r);return{...t instanceof yk?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function Ck(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;ane(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,vk(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?lk(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function hne(e,t){if(!fk(e))return!1;if(t){let n=Sk(e);t(Ck(e.tr,n,n.left))}return!0}function gne(e,t){if(!fk(e))return!1;if(t){let n=Sk(e);t(Ck(e.tr,n,n.right))}return!0}function _ne(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,_k(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function vne(e,t){if(!fk(e))return!1;if(t){let n=Sk(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;_ne(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=ck.get(e)}t(r)}return!0}function yne(e,t,n){let r=lk(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function wk(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;yne(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?lk(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,lk(r.type.schema).row.create(null,o)),e}function bne(e,t){if(!fk(e))return!1;if(t){let n=Sk(e);t(wk(e.tr,n,n.top))}return!0}function xne(e,t){if(!fk(e))return!1;if(t){let n=Sk(e);t(wk(e.tr,n,n.bottom))}return!0}function Sne(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function Cne(e,t){if(!fk(e))return!1;if(t){let n=Sk(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;Sne(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=ck.get(n.table)}t(r)}return!0}function Tk(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function wne({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function Ek(e,t){let n=e.selection;if(!(n instanceof yk)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=Sk(e),{map:i}=r;if(wne(i,r))return!1;if(t){let n=e.tr,a={},o=U.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{Tk(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...vk(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=Tk(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new yk(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function Dk(e,t){let n=lk(e.schema);return Tne(({node:e})=>n[e.type.spec.tableRole])(e,t)}function Tne(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof yk){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=nne(r.$from),!i)return!1;a=dk(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=Sk(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof yk&&u.setSelection(new yk(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function Ene(e,t){return function(n,r){if(!fk(n))return!1;let i=pk(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof yk?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Dne(e){return function(t,n){if(!fk(t))return!1;if(n){let r=lk(t.schema),i=Sk(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Ok(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function kk(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Dne(e):function(t,n){if(!fk(t))return!1;if(n){let r=lk(t.schema),i=Sk(t),a=t.tr,o=Ok(`row`,i,r),s=Ok(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}kk(`row`,{useDeprecatedLogic:!0}),kk(`column`,{useDeprecatedLogic:!0});var One=kk(`cell`,{useDeprecatedLogic:!0});function kne(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function Ak(e){return function(t,n){if(!fk(t))return!1;let r=kne(pk(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(K.between(e,ine(e))).scrollIntoView())}return!0}}function Ane(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function jk(e,t){let n=e.selection;if(!(n instanceof yk))return!1;if(t){let r=e.tr,i=lk(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new W(i,0,0))}),r.docChanged&&t(r)}return!0}function jne(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=Mk(lk(o).row,new W(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?Mk(lk(o).row,new W(t,n,r)).content:t);else return null;return Mne(o,s)}function Mne(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(U.empty),n[i]<r){let a=lk(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(U.from(o))}return{height:t.length,width:r,rows:t}}function Mk(e,t){let n=e.createAndFill();return new Jg(n).replace(0,n.content.size,t).doc}function Nne({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(_k(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(U.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(U.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function Pne(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=lk(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,U.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function Nk(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function Pk(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,_k(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(_k(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function Fk(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=ck.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=ck.get(a),f=d.mapping.maps.length}Pne(d,o,a,n,l,u,f)&&p(),Nk(d,o,a,n,c,l,s,f)&&p(),Nk(d,o,a,n,c,l,u,f)&&p(),Pk(d,o,a,n,s,u,c,f)&&p(),Pk(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new W(i.rows[e-s],0,0))}p(),d.setSelection(new yk(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var Fne=RS({ArrowLeft:Lk(`horiz`,-1),ArrowRight:Lk(`horiz`,1),ArrowUp:Lk(`vert`,-1),ArrowDown:Lk(`vert`,1),"Shift-ArrowLeft":Rk(`horiz`,-1),"Shift-ArrowRight":Rk(`horiz`,1),"Shift-ArrowUp":Rk(`vert`,-1),"Shift-ArrowDown":Rk(`vert`,1),Backspace:jk,"Mod-Backspace":jk,Delete:jk,"Mod-Delete":jk});function Ik(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Lk(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof yk)return Ik(n,r,G.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=zk(i,e,t);if(o==null)return!1;if(e==`horiz`)return Ik(n,r,G.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=gk(i,e,t),s;return s=a?G.near(a,1):t<0?G.near(n.doc.resolve(i.before(-1)),-1):G.near(n.doc.resolve(i.after(-1)),1),Ik(n,r,s)}}}function Rk(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof yk)o=a;else{let r=zk(i,e,t);if(r==null)return!1;o=new yk(n.doc.resolve(r))}let s=gk(o.$headCell,e,t);return s?Ik(n,r,new yk(o.$anchorCell,s)):!1}}function Ine(e,t){let n=e.state.doc,r=dk(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new yk(r))),!0):!1}function Lne(e,t,n){if(!fk(e.state))return!1;let r=jne(n),i=e.state.selection;if(i instanceof yk){r||={width:1,height:1,rows:[U.from(Mk(lk(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=ck.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=Nne(r,o.right-o.left,o.bottom-o.top),Fk(e.state,e.dispatch,a,o,r),!0}else if(r){let t=pk(e.state),n=t.start(-1);return Fk(e.state,e.dispatch,n,ck.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function Rne(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=Bk(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof yk)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=dk(e.state.selection.$anchor))!=null&&Vk(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=Vk(e,n),i=uk.getState(e.state)==null;if(!r||!hk(t,r))if(i)r=t;else return;let a=new yk(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(uk,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),uk.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(uk,-1))}function o(r){let o=r,s=uk.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(Bk(e,o.target)!=n&&(c=Vk(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function zk(e,t,n){if(!(e.state.selection instanceof K))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function Bk(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function Vk(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&dk(e.state.doc.resolve(r))||dk(e.state.doc.resolve(i))}var zne=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),Hk(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,Hk(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function Hk(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var Uk=new v_(`tableColumnResizing`);function Bne({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=zne,lastColumnResizable:i=!0}={}){let a=new h_({key:Uk,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=lk(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new Vne(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=Uk.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{Hne(t,n,e,i)},mouseleave:e=>{Une(e)},mousedown:(e,r)=>{Wne(e,r,t,n)}},decorations:e=>{let t=Uk.getState(e);if(t&&t.activeHandle>-1)return Yne(e,t.activeHandle)},nodeViews:{}}});return a}var Vne=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(Uk);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return mk(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function Hne(e,t,n,r){if(!e.editable)return;let i=Uk.getState(e.state);if(i&&!i.dragging){let a=Kne(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=Wk(e,t,`left`,n):i-t.clientX<=n&&(o=Wk(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=ck.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}Kk(e,o)}}}function Une(e){if(!e.editable)return;let t=Uk.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Kk(e,-1)}function Wne(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=Uk.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=Gne(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(Uk,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=Uk.getState(e.state);r?.dragging&&(qne(e,r.activeHandle,Gk(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(Uk,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=Uk.getState(e.state);if(i&&i.dragging){let a=Gk(i.dragging,t,n);qk(e,i.activeHandle,a,r)}}return qk(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function Gne(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function Kne(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function Wk(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=dk(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=ck.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function Gk(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function Kk(e,t){e.dispatch(e.state.tr.setMeta(Uk,{setHandle:t}))}function qne(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=ck.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():Jne(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function qk(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=ck.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&Hk(a,c.firstChild,c,r,s,n)}function Jne(e){return Array(e).fill(0)}function Yne(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return Wx.empty;let a=ck.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,Uk.getState(e)?.dragging&&n.push(Vx.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(Vx.widget(s,c))}}return Wx.create(e.doc,n)}function Xne({allowTableNodeSelection:e=!1}={}){return new h_({key:uk,state:{init(){return null},apply(e,t){let n=e.getMeta(uk);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:sne,handleDOMEvents:{mousedown:Rne},createSelectionBetween(e){return uk.getState(e.state)==null?null:e.state.selection},handleTripleClick:Ine,handleKeyDown:Fne,handlePaste:Lne},appendTransaction(t,n,r){return une(r,xk(r,n),e)}})}function Jk(e){return e===`left`||e===`right`||e===`center`?e:null}function Zne(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return Jk(t||n)}function Qne(e){return Jk(e?.align)}function Yk(){return{default:null,parseHTML:e=>Zne(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}var Xk=TE.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`),n=t?t.split(`,`).map(e=>parseInt(e,10)):null;if(!n){let t=e.closest(`table`)?.querySelectorAll(`colgroup > col`),n=Array.from(e.parentElement?.children||[]).indexOf(e);if(n&&n>-1&&t&&t[n]){let e=t[n].getAttribute(`width`);return e?[parseInt(e,10)]:null}}return n}},align:Yk()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,gw(this.options.HTMLAttributes,e),0]}}),Zk=TE.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):null}},align:Yk()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,gw(this.options.HTMLAttributes,e),0]}}),Qk=TE.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,gw(this.options.HTMLAttributes,e),0]}});function $k(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function eA(e,t,n,r,i,a){var o;let s=0,c=!0,l=t.firstChild,u=e.firstChild;if(u!==null)for(let e=0,n=0;e<u.childCount;e+=1){let{colspan:o,colwidth:d}=u.child(e).attrs;for(let e=0;e<o;e+=1,n+=1){let o=i===n?a:d&&d[e],u=o?`${o}px`:``;if(s+=o||r,o||(c=!1),l){if(l.style.width!==u){let[e,t]=$k(r,o);l.style.setProperty(e,t)}l=l.nextSibling}else{let e=document.createElement(`col`),[n,i]=$k(r,o);e.style.setProperty(n,i),t.appendChild(e)}}}for(;l;){let e=l.nextSibling;(o=l.parentNode)==null||o.removeChild(l),l=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);c&&!d?(n.style.width=`${s}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${s}px`)}var $ne=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),eA(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,eA(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}};function ere(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=$k(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function tA(e,t){return t?e.createChecked(null,t):e.createAndFill()}function tre(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function nre(e,t,n,r,i){let a=tre(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=tA(a.cell,i);if(e&&s.push(e),r){let e=tA(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function rre(e){return e instanceof yk}var nA=({editor:e})=>{let{selection:t}=e.state;if(!rre(t))return!1;let n=0;return aw(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1};function ire(e){return(e||``).replace(/\s+/g,` `).trim()}function are(e,t,n={}){let r=n.cellLineSeparator??``;if(!e||!e.content||e.content.length===0)return``;let i=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{let i=``;i=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(r):e.content?t.renderChildren(e.content):``;let a=ire(i),o=e.type===`tableHeader`,s=Qne(e.attrs);n.push({text:a,isHeader:o,align:s})}),i.push(n)});let a=i.reduce((e,t)=>Math.max(e,t.length),0);if(a===0)return``;let o=Array(a).fill(0);i.forEach(e=>{for(let t=0;t<a;t+=1){let n=(e[t]?.text||``).length;n>o[t]&&(o[t]=n),o[t]<3&&(o[t]=3)}});let s=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),c=i[0],l=c.some(e=>e.isHeader),u=Array(a).fill(null);i.forEach(e=>{for(let t=0;t<a;t+=1)!u[t]&&e[t]?.align&&(u[t]=e[t].align)});let d=`
308
308
  `,f=Array(a).fill(0).map((e,t)=>l&&c[t]&&c[t].text||``);return d+=`| ${f.map((e,t)=>s(e,o[t])).join(` | `)} |
309
309
  `,d+=`| ${o.map((e,t)=>{let n=Math.max(3,e),r=u[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} |
310
310
  `,(l?i.slice(1):i).forEach(e=>{d+=`| ${Array(a).fill(0).map((t,n)=>s(e[n]&&e[n].text||``,o[n])).join(` | `)} |
311
- `}),d}var are=ire,iA=TE.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Qne,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=$ne(e,this.options.cellMinWidth),a=t.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}let s=[`table`,gw(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=Yk(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=Yk(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>are(e,t),addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=tre(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(K.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>mne(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>hne(e,t),deleteColumn:()=>({state:e,dispatch:t})=>_ne(e,t),addRowBefore:()=>({state:e,dispatch:t})=>yne(e,t),addRowAfter:()=>({state:e,dispatch:t})=>bne(e,t),deleteRow:()=>({state:e,dispatch:t})=>Sne(e,t),deleteTable:()=>({state:e,dispatch:t})=>kne(e,t),mergeCells:()=>({state:e,dispatch:t})=>Dk(e,t),splitCell:()=>({state:e,dispatch:t})=>Ok(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>Ak(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>Ak(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>Dne(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>Dk(e,t)?!0:Ok(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>Tne(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>jk(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>jk(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&Sk(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=bk.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:rA,"Mod-Backspace":rA,Delete:rA,"Mod-Delete":rA}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[zne({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Yne({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){return{tableRole:uw(J(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}});VT.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(iA.configure(this.options.table)),this.options.tableCell!==!1&&e.push(Zk.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(Qk.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push($k.configure(this.options.tableRow)),e}});var ore=/^\s*>\s$/,aA=TE.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return NE(`blockquote`,{...gw(this.options.HTMLAttributes,e),children:NE(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
311
+ `}),d}var ore=are,rA=TE.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:$ne,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=ere(e,this.options.cellMinWidth),a=t.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}let s=[`table`,gw(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=Jk(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=Jk(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>ore(e,t),addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=nre(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(K.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>hne(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>gne(e,t),deleteColumn:()=>({state:e,dispatch:t})=>vne(e,t),addRowBefore:()=>({state:e,dispatch:t})=>bne(e,t),addRowAfter:()=>({state:e,dispatch:t})=>xne(e,t),deleteRow:()=>({state:e,dispatch:t})=>Cne(e,t),deleteTable:()=>({state:e,dispatch:t})=>Ane(e,t),mergeCells:()=>({state:e,dispatch:t})=>Ek(e,t),splitCell:()=>({state:e,dispatch:t})=>Dk(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>kk(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>kk(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>One(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>Ek(e,t)?!0:Dk(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>Ene(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>Ak(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>Ak(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&xk(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=yk.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:nA,"Mod-Backspace":nA,Delete:nA,"Mod-Delete":nA}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Bne({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Xne({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){return{tableRole:uw(J(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}});VT.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(rA.configure(this.options.table)),this.options.tableCell!==!1&&e.push(Xk.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(Zk.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(Qk.configure(this.options.tableRow)),e}});var sre=/^\s*>\s$/,iA=TE.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return NE(`blockquote`,{...gw(this.options.HTMLAttributes,e),children:NE(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
312
312
  `).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
313
313
  `))}),n.join(`
314
314
  >
315
- `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[oE({find:ore,type:this.type})]}}),sre=aA,cre=/(^|[^`])`([^`]+)`(?!`)$/,lre=/(^|[^`])`([^`]+)`(?!`)/g,oA=MT.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[rE({find:cre,type:this.type})]},addPasteRules(){return[DE({find:lre,type:this.type})]}}),ure=oA,dre=TE.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
315
+ `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[oE({find:sre,type:this.type})]}}),cre=iA,lre=/(^|[^`])`([^`]+)`(?!`)$/,ure=/(^|[^`])`([^`]+)`(?!`)/g,aA=MT.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[rE({find:lre,type:this.type})]},addPasteRules(){return[DE({find:ure,type:this.type})]}}),dre=aA,fre=TE.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
316
316
 
317
- `):``}),sA=TE.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,gw(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!lE(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return qw(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(K.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(q.create(t.doc,n.pos)):t.setSelection(K.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(K.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[iE({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),fre=sA,pre=Object.defineProperty,mre=(e,t)=>{for(var n in t)pre(e,n,{get:t[n],enumerable:!0})},hre=`listItem`,cA=`textStyle`,lA=/^\s*([-+*])\s$/,uA=TE.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
318
- `):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(hre,this.editor.getAttributes(cA)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=oE({find:lA,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=oE({find:lA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(cA),editor:this.editor})),[e]}}),dA=TE.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>bE(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});mre({},{findListItemPos:()=>fA,getNextListDepth:()=>pA,handleBackspace:()=>_A,handleDelete:()=>bA,hasListBefore:()=>mA,hasListItemAfter:()=>gre,hasListItemBefore:()=>hA,listItemHasSubList:()=>gA,nextListIsDeeper:()=>vA,nextListIsHigher:()=>yA});var fA=(e,t)=>{let{$from:n}=t.selection,r=ZS(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},pA=(e,t)=>{let n=fA(e,t);if(!n)return!1;let[,r]=Iw(t,e,n.$pos.pos+4);return r},mA=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},hA=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},gA=(e,t,n)=>{if(!n)return!1;let r=ZS(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},_A=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!LC(e.state,t)&&mA(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!LC(e.state,t)||!Uw(e.state))return!1;let r=fA(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=gA(t,e.state,i);return hA(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},vA=(e,t)=>{let n=pA(e,t),r=fA(e,t);return!r||!n?!1:n>r.depth},yA=(e,t)=>{let n=pA(e,t),r=fA(e,t);return!r||!n?!1:n<r.depth},bA=(e,t)=>{if(!LC(e.state,t)||!Hw(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:vA(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():yA(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},gre=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},xA=VT.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&bA(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&bA(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&_A(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&_A(e,n,r)&&(t=!0)}),t}}}}),SA=/^(\s*)(\d+)\.\s+(.*)$/,_re=/^\s/;function vre(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(SA);if(!a)break;let[,o,s,c]=a,l=o.length,u=c,d=n+1,f=[i];for(;d<e.length;){let t=e[d];if(t.match(SA))break;if(t.trim()===``)f.push(t),u+=`
319
- `,d+=1;else if(t.match(_re))f.push(t),u+=`
317
+ `):``}),oA=TE.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,gw(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!lE(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return qw(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(K.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(q.create(t.doc,n.pos)):t.setSelection(K.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(K.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[iE({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),pre=oA,mre=Object.defineProperty,hre=(e,t)=>{for(var n in t)mre(e,n,{get:t[n],enumerable:!0})},gre=`listItem`,sA=`textStyle`,cA=/^\s*([-+*])\s$/,lA=TE.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
318
+ `):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(gre,this.editor.getAttributes(sA)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=oE({find:cA,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=oE({find:cA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(sA),editor:this.editor})),[e]}}),uA=TE.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>bE(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});hre({},{findListItemPos:()=>dA,getNextListDepth:()=>fA,handleBackspace:()=>gA,handleDelete:()=>yA,hasListBefore:()=>pA,hasListItemAfter:()=>_re,hasListItemBefore:()=>mA,listItemHasSubList:()=>hA,nextListIsDeeper:()=>_A,nextListIsHigher:()=>vA});var dA=(e,t)=>{let{$from:n}=t.selection,r=ZS(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},fA=(e,t)=>{let n=dA(e,t);if(!n)return!1;let[,r]=Iw(t,e,n.$pos.pos+4);return r},pA=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},mA=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},hA=(e,t,n)=>{if(!n)return!1;let r=ZS(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},gA=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!LC(e.state,t)&&pA(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!LC(e.state,t)||!Uw(e.state))return!1;let r=dA(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=hA(t,e.state,i);return mA(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},_A=(e,t)=>{let n=fA(e,t),r=dA(e,t);return!r||!n?!1:n>r.depth},vA=(e,t)=>{let n=fA(e,t),r=dA(e,t);return!r||!n?!1:n<r.depth},yA=(e,t)=>{if(!LC(e.state,t)||!Hw(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:_A(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():vA(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},_re=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},bA=VT.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&yA(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&yA(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&gA(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&gA(e,n,r)&&(t=!0)}),t}}}}),xA=/^(\s*)(\d+)\.\s+(.*)$/,vre=/^\s/;function yre(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(xA);if(!a)break;let[,o,s,c]=a,l=o.length,u=c,d=n+1,f=[i];for(;d<e.length;){let t=e[d];if(t.match(xA))break;if(t.trim()===``)f.push(t),u+=`
319
+ `,d+=1;else if(t.match(vre))f.push(t),u+=`
320
320
  ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:u.trim(),raw:f.join(`
321
- `)}),r=d,n=d}return[t,r]}function CA(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let o=a.content.split(`
321
+ `)}),r=d,n=d}return[t,r]}function SA(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let o=a.content.split(`
322
322
  `),s=o[0]?.trim()||``,c=[];s&&c.push({type:`paragraph`,raw:s,tokens:n.inlineTokens(s)});let l=o.slice(1).join(`
323
- `).trim();if(l){let e=n.blockTokens(l);c.push(...e)}let u=i+1,d=[];for(;u<e.length&&e[u].indent>t;)d.push(e[u]),u+=1;if(d.length>0){let e=CA(d,Math.min(...d.map(e=>e.indent)),n);c.push({type:`list`,ordered:!0,start:d[0].number,items:e,raw:d.map(e=>e.raw).join(`
324
- `)})}r.push({type:`list_item`,raw:a.raw,tokens:c}),i=u}else i+=1}return r}function yre(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var bre=`listItem`,wA=`textStyle`,TA=/^(\d+)\.\s$/,EA=TE.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,gw(this.options.HTMLAttributes,n),0]:[`ol`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?yre(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
323
+ `).trim();if(l){let e=n.blockTokens(l);c.push(...e)}let u=i+1,d=[];for(;u<e.length&&e[u].indent>t;)d.push(e[u]),u+=1;if(d.length>0){let e=SA(d,Math.min(...d.map(e=>e.indent)),n);c.push({type:`list`,ordered:!0,start:d[0].number,items:e,raw:d.map(e=>e.raw).join(`
324
+ `)})}r.push({type:`list_item`,raw:a.raw,tokens:c}),i=u}else i+=1}return r}function bre(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var xre=`listItem`,CA=`textStyle`,wA=/^(\d+)\.\s$/,TA=TE.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,gw(this.options.HTMLAttributes,n),0]:[`ol`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?bre(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
325
325
  `):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
326
- `),[i,a]=vre(r);if(i.length===0)return;let o=CA(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
327
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bre,this.editor.getAttributes(wA)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=oE({find:TA,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=oE({find:TA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(wA)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),xre=/^\s*(\[([( |x])?\])\s$/,Sre=TE.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,gw(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>bE(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=_w(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[oE({find:xre,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Cre=TE.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,gw(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
328
- `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=yE(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=yE(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});VT.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(uA.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(dA.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(xA.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(EA.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Sre.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Cre.configure(this.options.taskList)),e}});var DA=`&nbsp;`,OA=`\xA0`,wre=TE.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,gw(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===DA||n[0].text===DA||n[0].raw===OA||n[0].text===OA)&&r.length===1&&r[0].type===`text`&&(r[0].text===DA||r[0].text===OA)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?DA:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Tre=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ere=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,kA=MT.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[rE({find:Tre,type:this.type})]},addPasteRules(){return[DE({find:Ere,type:this.type})]}}),Dre=kA,Ore=TE.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),AA=MT.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,gw(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),kre=AA;function Are(e={}){return new h_({view(t){return new jre(t,e)}})}var jre=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=Fg(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},jA=class e extends G{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):G.near(r)}content(){return W.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Mre(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Nre(e)||!Pre(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!q.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};jA.prototype.visible=!1,jA.findFrom=jA.findGapCursorFrom,G.jsonID(`gapcursor`,jA);var Mre=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return jA.valid(t)?new jA(t):G.near(t)}};function MA(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Nre(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||MA(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Pre(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||MA(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Fre(){return new h_({props:{decorations:zre,createSelectionBetween(e,t,n){return t.pos==n.pos&&jA.valid(n)?new jA(n):null},handleClick:Lre,handleKeyDown:Ire,handleDOMEvents:{beforeinput:Rre}}})}var Ire=RS({ArrowLeft:NA(`horiz`,-1),ArrowRight:NA(`horiz`,1),ArrowUp:NA(`vert`,-1),ArrowDown:NA(`vert`,1)});function NA(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof K){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=jA.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new jA(c))),!0):!1}}function Lre(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!jA.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&q.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new jA(r))),!0)}function Rre(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof jA))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=U.empty;for(let e=r.length-1;e>=0;e--)i=U.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new W(i,0,0));return a.setSelection(K.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function zre(e){if(!(e.selection instanceof jA))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,Wx.create(e.doc,[Vx.widget(e.selection.head,t,{key:`gapcursor`})])}var PA=200,FA=function(){};FA.prototype.append=function(e){return e.length?(e=FA.from(e),!this.length&&e||e.length<PA&&this.leafAppend(e)||this.length<PA&&e.leafPrepend(this)||this.appendInner(e)):this},FA.prototype.prepend=function(e){return e.length?FA.from(e).append(this):this},FA.prototype.appendInner=function(e){return new Bre(this,e)},FA.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?FA.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},FA.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},FA.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},FA.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},FA.from=function(e){return e instanceof FA?e:e&&e.length?new IA(e):FA.empty};var IA=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=PA)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=PA)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(FA);FA.empty=new IA([]);var Bre=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(FA),Vre=500,LA=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new RA(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new RA(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new RA(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>Ure&&(s=Hre(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new pg;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new RA(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new RA(i,o,l))}else r.push(new RA(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new RA(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>Vre&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new RA(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(FA.from(i.reverse()),a)}};LA.empty=new LA(FA.empty,0);function Hre(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var RA=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},zA=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},Ure=20;function Wre(e,t,n,r){let i=n.getMeta(GA),a;if(i)return i.historyState;n.getMeta(qre)&&(e=new zA(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(GA))return o.getMeta(GA).redo?new zA(e.done.addTransform(n,void 0,r,WA(t)),e.undone,BA(n.mapping.maps),e.prevTime,e.prevComposition):new zA(e.done,e.undone.addTransform(n,void 0,r,WA(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!Gre(n,e.prevRanges)),s=o?VA(e.prevRanges,n.mapping):BA(n.mapping.maps);return new zA(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,WA(t)),LA.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new zA(e.done.rebased(n,a),e.undone.rebased(n,a),VA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new zA(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),VA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Gre(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function BA(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function VA(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function Kre(e,t,n){let r=WA(t),i=GA.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new zA(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(GA,{redo:n,historyState:c})}var HA=!1,UA=null;function WA(e){let t=e.plugins;if(UA!=t){HA=!1,UA=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){HA=!0;break}}return HA}var GA=new v_(`history`),qre=new v_(`closeHistory`);function KA(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new h_({key:GA,state:{init(){return new zA(LA.empty,LA.empty,null,0,-1)},apply(t,n,r){return Wre(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?JA:n==`historyRedo`?YA:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function qA(e,t){return(n,r)=>{let i=GA.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=Kre(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var JA=qA(!1,!0),YA=qA(!0,!0);VT.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new h_({key:new v_(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(i==null||i===0){e=!0;return}let a=this.storage.characters({node:r.doc});if(a>i){let t=a-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var XA=VT.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Are(this.options)]}});VT.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new h_({key:new v_(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return Wx.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(Vx.node(t,t+e.nodeSize,{class:this.options.className}))}),Wx.create(e,a)}}})]}});var ZA=VT.create({name:`gapCursor`,addProseMirrorPlugins(){return[Fre()]},extendNodeSchema(e){return{allowGapCursor:uw(J(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),QA=`placeholder`;function $A(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}var ej=VT.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:QA,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${$A(this.options.dataAttribute)}`:`data-${QA}`;return[new h_({key:new v_(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&Kw(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=Vx.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),Wx.create(t,a)}}})]}});VT.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new h_({key:new v_(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||qw(n.selection)||e.view.dragging?null:Wx.create(n.doc,[Vx.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function tj({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var nj=VT.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new v_(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new h_({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!tj({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!tj({node:r,types:n})}}})]}}),rj=VT.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>JA(e,t),redo:()=>({state:e,dispatch:t})=>YA(e,t)}},addProseMirrorPlugins(){return[KA(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ij=VT.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(RE.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(aA.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(uA.configure(this.options.bulletList)),this.options.code!==!1&&e.push(oA.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(jE.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(dre.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(XA.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(ZA.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(KE.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(JE.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(rj.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(sA.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(WE.configure(this.options.italic)),this.options.listItem!==!1&&e.push(dA.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(xA.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(ok.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(EA.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(wre.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(kA.configure(this.options.strike)),this.options.text!==!1&&e.push(Ore.configure(this.options.text)),this.options.underline!==!1&&e.push(AA.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(nj.configure(this.options?.trailingNode)),e}}),aj={abandonedHeadElementChild:{reason:`Unexpected metadata element after head`,description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:`Unexpected abruptly closed empty comment`,description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:`Unexpected abruptly closed public identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:`Unexpected abruptly closed system identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:`Unexpected non-digit at start of numeric character reference`,description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:`Unexpected CDATA section in HTML`,description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:`Unexpected too big numeric character reference`,description:`Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)`},closingOfElementWithOpenChildElements:{reason:`Unexpected closing tag with open child elements`,description:`Unexpectedly closing tag. Expected other tags to be closed first`,url:!1},controlCharacterInInputStream:{reason:`Unexpected control character`,description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:`Unexpected control character reference`,description:`Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace`},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:`Unexpected duplicate attribute`,description:`Unexpectedly double attribute. Expected attributes to occur only once`},endTagWithAttributes:{reason:`Unexpected attribute on closing tag`,description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:`Unexpected slash at end of closing tag`,description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:`Unexpected unopened end tag`,description:`Unexpected end tag. Expected no end tag or another end tag`,url:!1},eofBeforeTagName:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected tag name instead`},eofInCdata:{reason:`Unexpected end of file in CDATA`,description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:`Unexpected end of file in comment`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:`Unexpected end of file in doctype`,description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:`Unexpected end of file in element that can only contain text`,description:`Unexpected end of file. Expected text or a closing tag`,url:!1},eofInScriptHtmlCommentLikeText:{reason:`Unexpected end of file in comment inside script`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:`Unexpected end of file in tag`,description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:`Incorrectly closed comment`,description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:`Incorrectly opened comment`,description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:`Invalid sequence after doctype name`,description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:`Invalid first character in tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:`Misplaced doctype`,description:`Unexpected doctype. Expected doctype before head`,url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:`Missing attribute value`,description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:`Missing doctype before other content`,description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:`Missing doctype name`,description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:`Missing public identifier in doctype`,description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:`Missing system identifier in doctype`,description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:`Missing name in end tag`,description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:`Missing quote before public identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:`Missing quote before system identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:`Missing semicolon after character reference`,description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:`Missing whitespace after public identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:`Missing whitespace after system identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:`Missing whitespace before doctype name`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:`Missing whitespace between attributes`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:`Missing whitespace between public and system identifiers in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:`Unexpected nested comment`,description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:`Unexpected non-conforming doctype declaration`,description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:`Unexpected trailing slash on start tag of non-void element`,description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:`Unexpected noncharacter code point referenced by character reference`,description:`Unexpected code point. Do not use noncharacters in HTML`},noncharacterInInputStream:{reason:`Unexpected noncharacter character`,description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:`Unexpected NULL character referenced by character reference`,description:`Unexpected code point. Do not use NULL characters in HTML`},openElementsLeftAfterEof:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected closing tag instead`,url:!1},surrogateCharacterReference:{reason:`Unexpected surrogate character referenced by character reference`,description:`Unexpected code point. Do not use lone surrogate characters in HTML`},surrogateInInputStream:{reason:`Unexpected surrogate character`,description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:`Invalid character after system identifier in doctype`,description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:`Unexpected character in attribute name`,description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:`Unexpected character in unquoted attribute value`,description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:`Unexpected equals sign before attribute name`,description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:`Unexpected NULL character`,description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:`Unexpected question mark instead of tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:`Unexpected slash in tag`,description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:`Unexpected unknown named character reference`,description:`Unexpected character reference. Expected known named character references`}},oj=`https://html.spec.whatwg.org/multipage/parsing.html#parse-error-`,sj=/-[a-z]/g,cj=/%c(?:([-+])(\d+))?/g,lj=/%x/g,uj={2:!0,1:!1,0:null},dj={};function fj(e,t){let n=t||dj,r=n.onerror,i=e instanceof _?e:new _(e),a=n.fragment?te:ne,o=String(i);return xe(a(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?s:null,scriptingEnabled:!1}),{file:i,space:n.space,verbose:n.verbose});function s(e){let t=e.code,a=pj(t),s=n[a]??!0,c=typeof s==`number`?s:+!!s;if(c){let n=aj[a],o=new k(l(n.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:`hast-util-from-html`});i.path&&(o.file=i.path,o.name=i.path+`:`+o.name),o.fatal=uj[c],o.note=l(n.description),o.url=n.url===!1?void 0:oj+t,r(o)}function l(t){return t.replace(cj,n).replace(lj,r);function n(t,n,r){let i=(r?Number.parseInt(r,10):0)*(n===`-`?-1:1);return hj(o.charAt(e.startOffset+i))}function r(){return gj(o.charCodeAt(e.startOffset))}}}}function pj(e){return e.replace(sj,mj)}function mj(e){return e.charAt(1).toUpperCase()}function hj(e){return e==="`"?"` ` `":e}function gj(e){return`0x`+e.toString(16).toUpperCase()}function _j(e){let t=this,{emitParseErrors:n,...r}={...t.data(`settings`),...e};t.parser=i;function i(e,t){return fj(e,{...r,onerror:n?function(e){t.path&&(e.name=t.path+`:`+e.name,e.file=t.path),t.messages.push(e)}:void 0})}}var vj=(function(e,t,n,r,i){let a=yj(t);if(n!=null&&(typeof n!=`number`||n<0||n===1/0))throw Error("Expected positive finite `index`");if(r!=null&&(!r.type||!r.children))throw Error("Expected valid `parent`");if(n==null!=(r==null))throw Error("Expected both `index` and `parent`");return wj(e)?a.call(i,e,n,r):!1}),yj=(function(e){if(e==null)return Cj;if(typeof e==`string`)return xj(e);if(typeof e==`object`)return bj(e);if(typeof e==`function`)return Sj(e);throw Error("Expected function, string, or array as `test`")});function bj(e){let t=[],n=-1;for(;++n<e.length;)t[n]=yj(e[n]);return Sj(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function xj(e){return Sj(t);function t(t){return t.tagName===e}}function Sj(e){return t;function t(t,n,r){return!!(wj(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Cj(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`element`&&`tagName`in e&&typeof e.tagName==`string`)}function wj(e){return typeof e==`object`&&!!e&&`type`in e&&`tagName`in e}var Tj=yj(function(e){return e.tagName===`audio`||e.tagName===`canvas`||e.tagName===`embed`||e.tagName===`iframe`||e.tagName===`img`||e.tagName===`math`||e.tagName===`object`||e.tagName===`picture`||e.tagName===`svg`||e.tagName===`video`}),Ej=`address.article.aside.blockquote.body.br.caption.center.col.colgroup.dd.dialog.dir.div.dl.dt.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.legend.li.li.listing.main.menu.nav.ol.optgroup.option.p.plaintext.pre.section.summary.table.tbody.td.td.tfoot.th.th.thead.tr.ul.wbr.xmp`.split(`.`),Dj=[`button`,`input`,`select`,`textarea`],Oj=[`area`,`base`,`basefont`,`dialog`,`datalist`,`head`,`link`,`meta`,`noembed`,`noframes`,`param`,`rp`,`script`,`source`,`style`,`template`,`track`,`title`],kj={},Aj=m([`comment`,`doctype`]);function jj(e,t){Mj(e,{collapse:Uj((t||kj).newlines?Vj:Hj),whitespace:`normal`})}function Mj(e,t){if(`children`in e){let n={...t};return(e.type===`root`||Rj(e))&&(n.before=!0,n.after=!0),n.whitespace=Wj(e,t),Pj(e,n)}if(e.type===`text`){if(t.whitespace===`normal`)return Nj(e,t);t.whitespace===`nowrap`&&(e.value=t.collapse(e.value))}return{ignore:Aj(e),stripAtStart:!1,remove:!1}}function Nj(e,t){let n=t.collapse(e.value),r={ignore:!1,stripAtStart:!1,remove:!1},i=0,a=n.length;return t.before&&Bj(n.charAt(0))&&i++,i!==a&&Bj(n.charAt(a-1))&&(t.after?a--:r.stripAtStart=!0),i===a?r.remove=!0:e.value=n.slice(i,a),r}function Pj(e,t){let n=t.before,r=t.after,i=e.children,a=i.length,o=-1;for(;++o<a;){let e=Mj(i[o],{...t,after:Fj(i,o,r),before:n});e.remove?(i.splice(o,1),o--,a--):e.ignore||(n=e.stripAtStart),Lj(i[o])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function Fj(e,t,n){for(;++t<e.length;){let n=e[t],r=Ij(n);if(r===void 0&&`children`in n&&!zj(n)&&(r=Fj(n.children,-1)),typeof r==`boolean`)return r}return n}function Ij(e){if(e.type===`element`){if(Lj(e))return!1;if(Rj(e))return!0}else if(e.type===`text`){if(!ke(e))return!1}else if(!Aj(e))return!1}function Lj(e){return Tj(e)||vj(e,Dj)}function Rj(e){return vj(e,Ej)}function zj(e){return!!(e.type===`element`&&e.properties.hidden)||Aj(e)||vj(e,Oj)}function Bj(e){return e===` `||e===`
326
+ `),[i,a]=yre(r);if(i.length===0)return;let o=SA(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
327
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(xre,this.editor.getAttributes(CA)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=oE({find:wA,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=oE({find:wA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(CA)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Sre=/^\s*(\[([( |x])?\])\s$/,Cre=TE.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,gw(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>bE(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=_w(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[oE({find:Sre,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),wre=TE.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,gw(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
328
+ `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=yE(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=yE(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});VT.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(lA.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(uA.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(bA.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(TA.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Cre.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(wre.configure(this.options.taskList)),e}});var EA=`&nbsp;`,DA=`\xA0`,Tre=TE.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,gw(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===EA||n[0].text===EA||n[0].raw===DA||n[0].text===DA)&&r.length===1&&r[0].type===`text`&&(r[0].text===EA||r[0].text===DA)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?EA:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ere=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Dre=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,OA=MT.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[rE({find:Ere,type:this.type})]},addPasteRules(){return[DE({find:Dre,type:this.type})]}}),Ore=OA,kre=TE.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),kA=MT.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,gw(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Are=kA;function jre(e={}){return new h_({view(t){return new Mre(t,e)}})}var Mre=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=Fg(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},AA=class e extends G{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):G.near(r)}content(){return W.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Nre(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Pre(e)||!Fre(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!q.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};AA.prototype.visible=!1,AA.findFrom=AA.findGapCursorFrom,G.jsonID(`gapcursor`,AA);var Nre=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return AA.valid(t)?new AA(t):G.near(t)}};function jA(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Pre(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||jA(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Fre(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||jA(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Ire(){return new h_({props:{decorations:Bre,createSelectionBetween(e,t,n){return t.pos==n.pos&&AA.valid(n)?new AA(n):null},handleClick:Rre,handleKeyDown:Lre,handleDOMEvents:{beforeinput:zre}}})}var Lre=RS({ArrowLeft:MA(`horiz`,-1),ArrowRight:MA(`horiz`,1),ArrowUp:MA(`vert`,-1),ArrowDown:MA(`vert`,1)});function MA(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof K){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=AA.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new AA(c))),!0):!1}}function Rre(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!AA.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&q.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new AA(r))),!0)}function zre(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof AA))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=U.empty;for(let e=r.length-1;e>=0;e--)i=U.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new W(i,0,0));return a.setSelection(K.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function Bre(e){if(!(e.selection instanceof AA))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,Wx.create(e.doc,[Vx.widget(e.selection.head,t,{key:`gapcursor`})])}var NA=200,PA=function(){};PA.prototype.append=function(e){return e.length?(e=PA.from(e),!this.length&&e||e.length<NA&&this.leafAppend(e)||this.length<NA&&e.leafPrepend(this)||this.appendInner(e)):this},PA.prototype.prepend=function(e){return e.length?PA.from(e).append(this):this},PA.prototype.appendInner=function(e){return new Vre(this,e)},PA.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?PA.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},PA.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},PA.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},PA.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},PA.from=function(e){return e instanceof PA?e:e&&e.length?new FA(e):PA.empty};var FA=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=NA)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=NA)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(PA);PA.empty=new FA([]);var Vre=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(PA),Hre=500,IA=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new LA(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new LA(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new LA(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>Wre&&(s=Ure(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new pg;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new LA(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new LA(i,o,l))}else r.push(new LA(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new LA(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>Hre&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new LA(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(PA.from(i.reverse()),a)}};IA.empty=new IA(PA.empty,0);function Ure(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var LA=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},RA=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},Wre=20;function Gre(e,t,n,r){let i=n.getMeta(WA),a;if(i)return i.historyState;n.getMeta(GA)&&(e=new RA(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(WA))return o.getMeta(WA).redo?new RA(e.done.addTransform(n,void 0,r,UA(t)),e.undone,zA(n.mapping.maps),e.prevTime,e.prevComposition):new RA(e.done,e.undone.addTransform(n,void 0,r,UA(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!Kre(n,e.prevRanges)),s=o?BA(e.prevRanges,n.mapping):zA(n.mapping.maps);return new RA(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,UA(t)),IA.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new RA(e.done.rebased(n,a),e.undone.rebased(n,a),BA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new RA(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),BA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Kre(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function zA(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function BA(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function qre(e,t,n){let r=UA(t),i=WA.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new RA(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(WA,{redo:n,historyState:c})}var VA=!1,HA=null;function UA(e){let t=e.plugins;if(HA!=t){VA=!1,HA=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){VA=!0;break}}return VA}var WA=new v_(`history`),GA=new v_(`closeHistory`);function KA(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new h_({key:WA,state:{init(){return new RA(IA.empty,IA.empty,null,0,-1)},apply(t,n,r){return Gre(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?JA:n==`historyRedo`?YA:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function qA(e,t){return(n,r)=>{let i=WA.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=qre(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var JA=qA(!1,!0),YA=qA(!0,!0);VT.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new h_({key:new v_(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(i==null||i===0){e=!0;return}let a=this.storage.characters({node:r.doc});if(a>i){let t=a-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var XA=VT.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[jre(this.options)]}});VT.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new h_({key:new v_(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return Wx.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(Vx.node(t,t+e.nodeSize,{class:this.options.className}))}),Wx.create(e,a)}}})]}});var ZA=VT.create({name:`gapCursor`,addProseMirrorPlugins(){return[Ire()]},extendNodeSchema(e){return{allowGapCursor:uw(J(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),QA=`placeholder`;function $A(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}var ej=VT.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:QA,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${$A(this.options.dataAttribute)}`:`data-${QA}`;return[new h_({key:new v_(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&Kw(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=Vx.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),Wx.create(t,a)}}})]}});VT.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new h_({key:new v_(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||qw(n.selection)||e.view.dragging?null:Wx.create(n.doc,[Vx.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function tj({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var nj=VT.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new v_(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new h_({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!tj({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!tj({node:r,types:n})}}})]}}),rj=VT.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>JA(e,t),redo:()=>({state:e,dispatch:t})=>YA(e,t)}},addProseMirrorPlugins(){return[KA(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ij=VT.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(RE.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(iA.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(lA.configure(this.options.bulletList)),this.options.code!==!1&&e.push(aA.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(jE.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(fre.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(XA.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(ZA.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(KE.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(JE.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(rj.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(oA.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(WE.configure(this.options.italic)),this.options.listItem!==!1&&e.push(uA.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(bA.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(ak.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(TA.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Tre.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(OA.configure(this.options.strike)),this.options.text!==!1&&e.push(kre.configure(this.options.text)),this.options.underline!==!1&&e.push(kA.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(nj.configure(this.options?.trailingNode)),e}}),aj={abandonedHeadElementChild:{reason:`Unexpected metadata element after head`,description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:`Unexpected abruptly closed empty comment`,description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:`Unexpected abruptly closed public identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:`Unexpected abruptly closed system identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:`Unexpected non-digit at start of numeric character reference`,description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:`Unexpected CDATA section in HTML`,description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:`Unexpected too big numeric character reference`,description:`Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)`},closingOfElementWithOpenChildElements:{reason:`Unexpected closing tag with open child elements`,description:`Unexpectedly closing tag. Expected other tags to be closed first`,url:!1},controlCharacterInInputStream:{reason:`Unexpected control character`,description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:`Unexpected control character reference`,description:`Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace`},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:`Unexpected duplicate attribute`,description:`Unexpectedly double attribute. Expected attributes to occur only once`},endTagWithAttributes:{reason:`Unexpected attribute on closing tag`,description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:`Unexpected slash at end of closing tag`,description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:`Unexpected unopened end tag`,description:`Unexpected end tag. Expected no end tag or another end tag`,url:!1},eofBeforeTagName:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected tag name instead`},eofInCdata:{reason:`Unexpected end of file in CDATA`,description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:`Unexpected end of file in comment`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:`Unexpected end of file in doctype`,description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:`Unexpected end of file in element that can only contain text`,description:`Unexpected end of file. Expected text or a closing tag`,url:!1},eofInScriptHtmlCommentLikeText:{reason:`Unexpected end of file in comment inside script`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:`Unexpected end of file in tag`,description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:`Incorrectly closed comment`,description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:`Incorrectly opened comment`,description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:`Invalid sequence after doctype name`,description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:`Invalid first character in tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:`Misplaced doctype`,description:`Unexpected doctype. Expected doctype before head`,url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:`Missing attribute value`,description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:`Missing doctype before other content`,description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:`Missing doctype name`,description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:`Missing public identifier in doctype`,description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:`Missing system identifier in doctype`,description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:`Missing name in end tag`,description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:`Missing quote before public identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:`Missing quote before system identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:`Missing semicolon after character reference`,description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:`Missing whitespace after public identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:`Missing whitespace after system identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:`Missing whitespace before doctype name`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:`Missing whitespace between attributes`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:`Missing whitespace between public and system identifiers in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:`Unexpected nested comment`,description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:`Unexpected non-conforming doctype declaration`,description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:`Unexpected trailing slash on start tag of non-void element`,description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:`Unexpected noncharacter code point referenced by character reference`,description:`Unexpected code point. Do not use noncharacters in HTML`},noncharacterInInputStream:{reason:`Unexpected noncharacter character`,description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:`Unexpected NULL character referenced by character reference`,description:`Unexpected code point. Do not use NULL characters in HTML`},openElementsLeftAfterEof:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected closing tag instead`,url:!1},surrogateCharacterReference:{reason:`Unexpected surrogate character referenced by character reference`,description:`Unexpected code point. Do not use lone surrogate characters in HTML`},surrogateInInputStream:{reason:`Unexpected surrogate character`,description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:`Invalid character after system identifier in doctype`,description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:`Unexpected character in attribute name`,description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:`Unexpected character in unquoted attribute value`,description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:`Unexpected equals sign before attribute name`,description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:`Unexpected NULL character`,description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:`Unexpected question mark instead of tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:`Unexpected slash in tag`,description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:`Unexpected unknown named character reference`,description:`Unexpected character reference. Expected known named character references`}},oj=`https://html.spec.whatwg.org/multipage/parsing.html#parse-error-`,sj=/-[a-z]/g,cj=/%c(?:([-+])(\d+))?/g,lj=/%x/g,uj={2:!0,1:!1,0:null},dj={};function fj(e,t){let n=t||dj,r=n.onerror,i=e instanceof _?e:new _(e),a=n.fragment?te:ne,o=String(i);return xe(a(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?s:null,scriptingEnabled:!1}),{file:i,space:n.space,verbose:n.verbose});function s(e){let t=e.code,a=pj(t),s=n[a]??!0,c=typeof s==`number`?s:+!!s;if(c){let n=aj[a],o=new k(l(n.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:`hast-util-from-html`});i.path&&(o.file=i.path,o.name=i.path+`:`+o.name),o.fatal=uj[c],o.note=l(n.description),o.url=n.url===!1?void 0:oj+t,r(o)}function l(t){return t.replace(cj,n).replace(lj,r);function n(t,n,r){let i=(r?Number.parseInt(r,10):0)*(n===`-`?-1:1);return hj(o.charAt(e.startOffset+i))}function r(){return gj(o.charCodeAt(e.startOffset))}}}}function pj(e){return e.replace(sj,mj)}function mj(e){return e.charAt(1).toUpperCase()}function hj(e){return e==="`"?"` ` `":e}function gj(e){return`0x`+e.toString(16).toUpperCase()}function _j(e){let t=this,{emitParseErrors:n,...r}={...t.data(`settings`),...e};t.parser=i;function i(e,t){return fj(e,{...r,onerror:n?function(e){t.path&&(e.name=t.path+`:`+e.name,e.file=t.path),t.messages.push(e)}:void 0})}}var vj=(function(e,t,n,r,i){let a=yj(t);if(n!=null&&(typeof n!=`number`||n<0||n===1/0))throw Error("Expected positive finite `index`");if(r!=null&&(!r.type||!r.children))throw Error("Expected valid `parent`");if(n==null!=(r==null))throw Error("Expected both `index` and `parent`");return wj(e)?a.call(i,e,n,r):!1}),yj=(function(e){if(e==null)return Cj;if(typeof e==`string`)return xj(e);if(typeof e==`object`)return bj(e);if(typeof e==`function`)return Sj(e);throw Error("Expected function, string, or array as `test`")});function bj(e){let t=[],n=-1;for(;++n<e.length;)t[n]=yj(e[n]);return Sj(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function xj(e){return Sj(t);function t(t){return t.tagName===e}}function Sj(e){return t;function t(t,n,r){return!!(wj(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Cj(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`element`&&`tagName`in e&&typeof e.tagName==`string`)}function wj(e){return typeof e==`object`&&!!e&&`type`in e&&`tagName`in e}var Tj=yj(function(e){return e.tagName===`audio`||e.tagName===`canvas`||e.tagName===`embed`||e.tagName===`iframe`||e.tagName===`img`||e.tagName===`math`||e.tagName===`object`||e.tagName===`picture`||e.tagName===`svg`||e.tagName===`video`}),Ej=`address.article.aside.blockquote.body.br.caption.center.col.colgroup.dd.dialog.dir.div.dl.dt.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.legend.li.li.listing.main.menu.nav.ol.optgroup.option.p.plaintext.pre.section.summary.table.tbody.td.td.tfoot.th.th.thead.tr.ul.wbr.xmp`.split(`.`),Dj=[`button`,`input`,`select`,`textarea`],Oj=[`area`,`base`,`basefont`,`dialog`,`datalist`,`head`,`link`,`meta`,`noembed`,`noframes`,`param`,`rp`,`script`,`source`,`style`,`template`,`track`,`title`],kj={},Aj=m([`comment`,`doctype`]);function jj(e,t){Mj(e,{collapse:Uj((t||kj).newlines?Vj:Hj),whitespace:`normal`})}function Mj(e,t){if(`children`in e){let n={...t};return(e.type===`root`||Rj(e))&&(n.before=!0,n.after=!0),n.whitespace=Wj(e,t),Pj(e,n)}if(e.type===`text`){if(t.whitespace===`normal`)return Nj(e,t);t.whitespace===`nowrap`&&(e.value=t.collapse(e.value))}return{ignore:Aj(e),stripAtStart:!1,remove:!1}}function Nj(e,t){let n=t.collapse(e.value),r={ignore:!1,stripAtStart:!1,remove:!1},i=0,a=n.length;return t.before&&Bj(n.charAt(0))&&i++,i!==a&&Bj(n.charAt(a-1))&&(t.after?a--:r.stripAtStart=!0),i===a?r.remove=!0:e.value=n.slice(i,a),r}function Pj(e,t){let n=t.before,r=t.after,i=e.children,a=i.length,o=-1;for(;++o<a;){let e=Mj(i[o],{...t,after:Fj(i,o,r),before:n});e.remove?(i.splice(o,1),o--,a--):e.ignore||(n=e.stripAtStart),Lj(i[o])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function Fj(e,t,n){for(;++t<e.length;){let n=e[t],r=Ij(n);if(r===void 0&&`children`in n&&!zj(n)&&(r=Fj(n.children,-1)),typeof r==`boolean`)return r}return n}function Ij(e){if(e.type===`element`){if(Lj(e))return!1;if(Rj(e))return!0}else if(e.type===`text`){if(!ke(e))return!1}else if(!Aj(e))return!1}function Lj(e){return Tj(e)||vj(e,Dj)}function Rj(e){return vj(e,Ej)}function zj(e){return!!(e.type===`element`&&e.properties.hidden)||Aj(e)||vj(e,Oj)}function Bj(e){return e===` `||e===`
329
329
  `}function Vj(e){let t=/\r?\n|\r/.exec(e);return t?t[0]:` `}function Hj(){return` `}function Uj(e){return t;function t(t){return String(t).replace(/[\t\n\v\f\r ]+/g,e)}}function Wj(e,t){if(`tagName`in e&&e.properties)switch(e.tagName){case`listing`:case`plaintext`:case`script`:case`style`:case`xmp`:return`pre`;case`nobr`:return`nowrap`;case`pre`:return e.properties.wrap?`pre-wrap`:`pre`;case`td`:case`th`:return e.properties.noWrap?`nowrap`:t.whitespace;case`textarea`:return`pre-wrap`;default:}return t.whitespace}function Gj(e){return function(t){jj(t,e)}}function Kj(e,t){let n=t.properties||{},r=e.all(t),i={type:`link`,url:e.resolve(String(n.href||``)||null),title:n.title?String(n.title):null,children:r};return e.patch(t,i),i}function qj(e,t){e.baseFound||=(e.frozenBaseUrl=String(t.properties&&t.properties.href||``)||void 0,!0)}function Jj(e,t){let n={type:`blockquote`,children:e.toFlow(e.all(t))};return e.patch(t,n),n}function Yj(e,t){let n={type:`break`};return e.patch(t,n),n}var Xj=(function(e,t,n){let r=m(n);if(!e||!e.type||!e.children)throw Error(`Expected parent node`);if(typeof t==`number`){if(t<0||t===1/0)throw Error(`Expected positive finite number as index`)}else if(t=e.children.indexOf(t),t<0)throw Error(`Expected child node or index`);for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),Zj=/\n/g,Qj=/[\t ]+/g,$j=yj(`br`),eM=yj(pM),tM=yj(`p`),nM=yj(`tr`),rM=yj([`datalist`,`head`,`noembed`,`noframes`,`noscript`,`rp`,`script`,`style`,`template`,`title`,fM,mM]),iM=yj(`address.article.aside.blockquote.body.caption.center.dd.dialog.dir.dl.dt.div.figure.figcaption.footer.form,.h1.h2.h3.h4.h5.h6.header.hgroup.hr.html.legend.li.listing.main.menu.nav.ol.p.plaintext.pre.section.ul.xmp`.split(`.`));function aM(e,t){let n=t||{},r=`children`in e?e.children:[],i=iM(e),a=dM(e,{whitespace:n.whitespace||`normal`,breakBefore:!1,breakAfter:!1}),o=[];(e.type===`text`||e.type===`comment`)&&o.push(...cM(e,{whitespace:a,breakBefore:!0,breakAfter:!0}));let s=-1;for(;++s<r.length;)o.push(...oM(r[s],e,{whitespace:a,breakBefore:s?void 0:i,breakAfter:s<r.length-1?$j(r[s+1]):i}));let c=[],l;for(s=-1;++s<o.length;){let e=o[s];typeof e==`number`?l!==void 0&&e>l&&(l=e):e&&(l!==void 0&&l>-1&&c.push(`
330
330
  `.repeat(l)||` `),l=-1,c.push(e))}return c.join(``)}function oM(e,t,n){return e.type===`element`?sM(e,t,n):e.type===`text`?n.whitespace===`normal`?cM(e,n):lM(e):[]}function sM(e,t,n){let r=dM(e,n),i=e.children||[],a=-1,o=[];if(rM(e))return o;let s,c;for($j(e)||nM(e)&&Xj(t,e,nM)?c=`
331
331
  `:tM(e)?(s=2,c=2):iM(e)&&(s=1,c=1);++a<i.length;)o=o.concat(oM(i[a],e,{whitespace:r,breakBefore:a?void 0:s,breakAfter:a<i.length-1?$j(i[a+1]):c}));return eM(e)&&Xj(t,e,eM)&&o.push(` `),s&&o.unshift(s),c&&o.push(c),o}function cM(e,t){let n=String(e.value),r=[],i=[],a=0;for(;a<=n.length;){Zj.lastIndex=a;let e=Zj.exec(n),i=e&&`index`in e?e.index:n.length;r.push(uM(n.slice(a,i).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,``),a===0?t.breakBefore:!0,i===n.length?t.breakAfter:!0)),a=i+1}let o=-1,s;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),s=void 0):r[o]?(typeof s==`number`&&i.push(s),i.push(r[o]),s=0):(o===0||o===r.length-1)&&i.push(0);return i}function lM(e){return[String(e.value)]}function uM(e,t,n){let r=[],i=0,a;for(;i<e.length;){Qj.lastIndex=i;let n=Qj.exec(e);a=n?n.index:e.length,!i&&!a&&n&&!t&&r.push(``),i!==a&&r.push(e.slice(i,a)),i=n?a+n[0].length:a}return i!==a&&!n&&r.push(``),r.join(` `)}function dM(e,t){if(e.type===`element`){let n=e.properties||{};switch(e.tagName){case`listing`:case`plaintext`:case`xmp`:return`pre`;case`nobr`:return`nowrap`;case`pre`:return n.wrap?`pre-wrap`:`pre`;case`td`:case`th`:return n.noWrap?`nowrap`:t.whitespace;case`textarea`:return`pre-wrap`;default:}}return t.whitespace}function fM(e){return!!(e.properties||{}).hidden}function pM(e){return e.tagName===`td`||e.tagName===`th`}function mM(e){return e.tagName===`dialog`&&!(e.properties||{}).open}function hM(e){let t=String(e),n=t.length;for(;n>0;){let e=t.codePointAt(n-1);if(e!==void 0&&(e===10||e===13))n--;else break}return t.slice(0,n)}var gM=`language-`;function _M(e,t){let n=t.children,r=-1,i,a;if(t.tagName===`pre`)for(;++r<n.length;){let e=n[r];if(e.type===`element`&&e.tagName===`code`&&e.properties&&e.properties.className&&Array.isArray(e.properties.className)){i=e.properties.className;break}}if(i){for(r=-1;++r<i.length;)if(String(i[r]).slice(0,9)===gM){a=String(i[r]).slice(9);break}}let o={type:`code`,lang:a||null,meta:null,value:hM(aM(t))};return e.patch(t,o),o}function vM(e,t){let n={type:`html`,value:`<!--`+t.value+`-->`};return e.patch(t,n),n}function yM(e,t){let n={type:`delete`,children:e.all(t)};return e.patch(t,n),n}function bM(e){let t=-1;if(e.length>1){for(;++t<e.length;)if(e[t].spread)return!0}return!1}function xM(e,t){let n=[],r=[],i=-1;for(;++i<t.children.length;){let e=t.children[i];e.type===`element`&&e.tagName===`div`?n.push(...e.children):n.push(e)}let a={definitions:[],titles:[]};for(i=-1;++i<n.length;){let e=n[i];if(e.type===`element`&&e.tagName===`dt`){let t=n[i-1];t&&t.type===`element`&&t.tagName===`dd`&&(r.push(a),a={definitions:[],titles:[]}),a.titles.push(e)}else a.definitions.push(e)}r.push(a),i=-1;let o=[];for(;++i<r.length;){let t=[...SM(e,r[i].titles),...SM(e,r[i].definitions)];t.length>0&&o.push({type:`listItem`,spread:t.length>1,checked:null,children:t})}if(o.length>0){let n={type:`list`,ordered:!1,start:null,spread:bM(o),children:o};return e.patch(t,n),n}}function SM(e,t){let n=e.all({type:`root`,children:t}),r=e.toSpecificContent(n,CM);return r.length===0?[]:r.length===1?r[0].children:[{type:`list`,ordered:!1,start:null,spread:bM(r),children:r}]}function CM(){return{type:`listItem`,spread:!1,checked:null,children:[]}}function wM(e,t){let n={type:`emphasis`,children:e.all(t)};return e.patch(t,n),n}function TM(e){let t=0,n=e.length;for(;t<n&&e[t].type===`break`;)t++;for(;n>t&&e[n-1].type===`break`;)n--;return t===0&&n===e.length?e:e.slice(t,n)}function EM(e,t){let n={type:`heading`,depth:Number(t.tagName.charAt(1))||1,children:TM(e.all(t))};return e.patch(t,n),n}function DM(e,t){let n={type:`thematicBreak`};return e.patch(t,n),n}function OM(e,t){let n=t.properties||{},r=String(n.src||``),i=String(n.title||``);if(r&&i){let n={type:`link`,title:null,url:e.resolve(r),children:[{type:`text`,value:i}]};return e.patch(t,n),n}}function kM(e,t){let n=t.properties||{},r={type:`image`,url:e.resolve(String(n.src||``)||null),title:n.title?String(n.title):null,alt:n.alt?String(n.alt):``};return e.patch(t,r),r}function AM(e,t){let n={type:`inlineCode`,value:aM(t)};return e.patch(t,n),n}function jM(e,t){let n=[],r=[],i=t||e.properties||{},a=MM(e),o=Math.min(Number.parseInt(String(i.size),10),0)||(i.multiple?4:1),s=-1;for(;++s<a.length;){let e=a[s];e&&e.properties&&e.properties.selected&&n.push(e)}let c=n.length>0?n:a,l=Math.min(c.length,o);for(s=-1;++s<l;){let e=c[s],t=e.properties||{},n=aM(e),i=n||String(t.label||``),a=String(t.value||``)||n;r.push([a,i===a?void 0:i])}return r}function MM(e){let t=[],n=-1;for(;++n<e.children.length;){let r=e.children[n];`children`in r&&Array.isArray(r.children)&&t.push(...MM(r)),r.type===`element`&&r.tagName===`option`&&(!r.properties||!r.properties.disabled)&&t.push(r)}return t}var NM=`[x]`,PM=`[ ]`;function FM(e,t){let n=t.properties||{},r=String(n.value||n.placeholder||``);if(n.disabled||n.type===`hidden`||n.type===`file`)return;if(n.type===`checkbox`||n.type===`radio`){let r={type:`text`,value:n.checked?e.options.checked||NM:e.options.unchecked||PM};return e.patch(t,r),r}if(n.type===`image`){let i=n.alt||r;if(i){let r={type:`image`,url:e.resolve(String(n.src||``)||null),title:String(n.title||``)||null,alt:String(i)};return e.patch(t,r),r}return}let i=[];if(r)i=[[r,void 0]];else if(n.type!==`button`&&n.type!==`file`&&n.type!==`password`&&n.type!==`reset`&&n.type!==`submit`&&n.list){let t=String(n.list),r=e.elementById.get(t);r&&r.tagName===`datalist`&&(i=jM(r,n))}if(i.length===0)return;if(n.type===`password`&&(i[0]=[`•`.repeat(i[0][0].length),void 0]),n.type===`email`||n.type===`url`){let t=[],r=-1;for(;++r<i.length;){let a=e.resolve(i[r][0]),o={type:`link`,title:null,url:n.type===`email`?`mailto:`+a:a,children:[{type:`text`,value:i[r][1]||a}]};t.push(o),r!==i.length-1&&t.push({type:`text`,value:`, `})}return t}let a=[],o=-1;for(;++o<i.length;)a.push(i[o][1]?i[o][1]+` (`+i[o][0]+`)`:i[o][0]);let s={type:`text`,value:a.join(`, `)};return e.patch(t,s),s}var IM={}.hasOwnProperty;function LM(e,t){let n=e.type===`element`&&IM.call(e.properties,t)&&e.properties[t];return n!=null&&n!==!1}var RM=new Set([`pingback`,`prefetch`,`stylesheet`]);function zM(e){if(e.type!==`element`||e.tagName!==`link`)return!1;if(e.properties.itemProp)return!0;let t=e.properties.rel,n=-1;if(!Array.isArray(t)||t.length===0)return!1;for(;++n<t.length;)if(!RM.has(String(t[n])))return!1;return!0}var BM=yj(`a.abbr.area.b.bdi.bdo.br.button.cite.code.data.datalist.del.dfn.em.i.input.ins.kbd.keygen.label.map.mark.meter.noscript.output.progress.q.ruby.s.samp.script.select.small.span.strong.sub.sup.template.textarea.time.u.var.wbr`.split(`.`)),VM=yj(`meta`);function HM(e){return!!(e.type===`text`||BM(e)||Tj(e)||zM(e)||VM(e)&&LM(e,`itemProp`))}function UM(e,t){let{rest:n,checkbox:r}=GM(t),i=r?!!r.properties.checked:null,a={type:`listItem`,spread:WM(n),checked:i,children:e.toFlow(e.all(n))};return e.patch(t,a),a}function WM(e){let t=-1,n=!1;for(;++t<e.children.length;){let r=e.children[t];if(r.type===`element`){if(HM(r))continue;if(r.tagName===`p`||n||WM(r))return!0;n=!0}}return!1}function GM(e){let t=e.children[0];if(t&&t.type===`element`&&t.tagName===`input`&&t.properties&&(t.properties.type===`checkbox`||t.properties.type===`radio`))return{checkbox:t,rest:{...e,children:e.children.slice(1)}};if(t&&t.type===`element`&&t.tagName===`p`){let{checkbox:n,rest:r}=GM(t);if(n)return{checkbox:n,rest:{...e,children:[r,...e.children.slice(1)]}}}return{checkbox:void 0,rest:e}}function KM(e,t){let n=t.tagName===`ol`,r=e.toSpecificContent(e.all(t),qM),i=null;n&&(i=t.properties&&t.properties.start?Number.parseInt(String(t.properties.start),10):1);let a={type:`list`,ordered:n,start:i,spread:bM(r),children:r};return e.patch(t,a),a}function qM(){return{type:`listItem`,spread:!1,checked:null,children:[]}}function JM(e){let t=-1;for(;++t<e.length;){let n=e[t];if(!$M(n)||`children`in n&&JM(n.children))return!0}return!1}function YM(e){return ZM(e,t,function(e){return e});function t(e){return e.every(function(e){return e.type===`text`?ke(e.value):!1})?[]:[{type:`paragraph`,children:TM(e)}]}}function XM(e){return ZM(e.children,t,n);function t(t){let n=eN(e);return n.children=t,[n]}function n(t){if(`children`in t&&`children`in e){let n=eN(e),r=eN(t);return n.children=t.children,r.children.push(n),r}return{...t}}}function ZM(e,t,n){let r=QM(e),i=[],a=[],o=-1;for(;++o<r.length;){let e=r[o];$M(e)?a.push(e):(a.length>0&&(i.push(...t(a)),a=[]),i.push(n(e)))}return a.length>0&&(i.push(...t(a)),a=[]),i}function QM(e){let t=[],n=-1;for(;++n<e.length;){let r=e[n];(r.type===`delete`||r.type===`link`)&&JM(r.children)?t.push(...XM(r)):t.push(r)}return t}function $M(e){let t=e.data&&e.data.hName;return t?HM({type:`element`,tagName:t,properties:{},children:[]}):y(e)}function eN(e){return ve({...e,children:[]})}function tN(e,t){let n=t.properties||{},r=t.tagName===`video`?String(n.poster||``):``,i=String(n.src||``),a=-1,o=!1,s=e.all(t);if(h({type:`root`,children:s},function(e){if(e.type===`link`)return o=!0,!1}),o||JM(s))return s;for(;!i&&++a<t.children.length;){let e=t.children[a];e.type===`element`&&e.tagName===`source`&&e.properties&&(i=String(e.properties.src||``))}if(r){let n={type:`image`,title:null,url:e.resolve(r),alt:w(s)};e.patch(t,n),s=[n]}let c=s,l={type:`link`,title:n.title?String(n.title):null,url:e.resolve(i),children:c};return e.patch(t,l),l}function nN(e,t){let n=TM(e.all(t));if(n.length>0){let r={type:`paragraph`,children:n};return e.patch(t,r),r}}var rN=[`"`];function iN(e,t){let n=e.options.quotes||rN;e.qNesting++;let r=e.all(t);e.qNesting--;let i=n[e.qNesting%n.length],a=r[0],o=r[r.length-1],s=i.charAt(0),c=i.length>1?i.charAt(1):i;return a&&a.type===`text`?a.value=s+a.value:r.unshift({type:`text`,value:s}),o&&o.type===`text`?o.value+=c:r.push({type:`text`,value:c}),r}function aN(e,t){let n=e.all(t);(e.options.document||JM(n))&&(n=YM(n));let r={type:`root`,children:n};return e.patch(t,r),r}function oN(e,t){let n=jM(t),r=-1,i=[];for(;++r<n.length;){let e=n[r];i.push(e[1]?e[1]+` (`+e[0]+`)`:e[0])}if(i.length>0){let n={type:`text`,value:i.join(`, `)};return e.patch(t,n),n}}function sN(e,t){let n={type:`strong`,children:e.all(t)};return e.patch(t,n),n}function cN(e,t){let n={type:`tableCell`,children:e.all(t)};if(e.patch(t,n),t.properties){let e=t.properties.rowSpan,r=t.properties.colSpan;if(e||r){let t=n.data||={};e&&(t.hastUtilToMdastTemporaryRowSpan=e),r&&(t.hastUtilToMdastTemporaryColSpan=r)}}return n}function lN(e,t){let n={type:`tableRow`,children:e.toSpecificContent(e.all(t),uN)};return e.patch(t,n),n}function uN(){return{type:`tableCell`,children:[]}}function dN(e,t){if(e.inTable){let n={type:`text`,value:aM(t)};return e.patch(t,n),n}e.inTable=!0;let{align:n,headless:r}=fN(t),i=e.toSpecificContent(e.all(t),mN);r&&i.unshift(mN());let a=-1;for(;++a<i.length;){let t=i[a];t.children=e.toSpecificContent(t.children,pN)}let o=1;for(a=-1;++a<i.length;){let e=i[a].children,t=-1;for(;++t<e.length;){let n=e[t];if(n.data){let e=n.data,r=Number.parseInt(String(e.hastUtilToMdastTemporaryColSpan),10)||1,o=Number.parseInt(String(e.hastUtilToMdastTemporaryRowSpan),10)||1;if(r>1||o>1){let e=a-1;for(;++e<a+o;){let n=t-1;for(;++n<t+r&&i[e];){let r=[];(e!==a||n!==t)&&r.push({type:`tableCell`,children:[]}),i[e].children.splice(n,0,...r)}}}`hastUtilToMdastTemporaryColSpan`in n.data&&delete n.data.hastUtilToMdastTemporaryColSpan,`hastUtilToMdastTemporaryRowSpan`in n.data&&delete n.data.hastUtilToMdastTemporaryRowSpan,Object.keys(n.data).length===0&&delete n.data}}e.length>o&&(o=e.length)}for(a=-1;++a<i.length;){let e=i[a].children,t=e.length-1;for(;++t<o;)e.push({type:`tableCell`,children:[]})}let s=n.length-1;for(;++s<o;)n.push(null);e.inTable=!1;let c={type:`table`,align:n,children:i};return e.patch(t,c),c}function fN(e){let t={align:[null],headless:!0},n=0,r=0;return h(e,function(i){if(i.type===`element`){if(i.tagName===`table`&&e!==i)return D;if((i.tagName===`th`||i.tagName===`td`)&&i.properties){if(!t.align[r]){let e=String(i.properties.align||``)||null;(e===`center`||e===`left`||e===`right`||e===null)&&(t.align[r]=e)}t.headless&&n<2&&i.tagName===`th`&&(t.headless=!1),r++}else i.tagName===`thead`?t.headless=!1:i.tagName===`tr`&&(n++,r=0)}}),t}function pN(){return{type:`tableCell`,children:[]}}function mN(){return{type:`tableRow`,children:[]}}function hN(e,t){let n={type:`text`,value:t.value};return e.patch(t,n),n}function gN(e,t){let n={type:`text`,value:aM(t)};return e.patch(t,n),n}function _N(e,t){let n={type:`text`,value:`​`};return e.patch(t,n),n}var vN={comment:vM,doctype:SN,root:aN,text:hN},yN={applet:SN,area:SN,basefont:SN,bgsound:SN,caption:SN,col:SN,colgroup:SN,command:SN,content:SN,datalist:SN,dialog:SN,element:SN,embed:SN,frame:SN,frameset:SN,isindex:SN,keygen:SN,link:SN,math:SN,menu:SN,menuitem:SN,meta:SN,nextid:SN,noembed:SN,noframes:SN,optgroup:SN,option:SN,param:SN,script:SN,shadow:SN,source:SN,spacer:SN,style:SN,svg:SN,template:SN,title:SN,track:SN,abbr:bN,acronym:bN,bdi:bN,bdo:bN,big:bN,blink:bN,button:bN,canvas:bN,cite:bN,data:bN,details:bN,dfn:bN,font:bN,ins:bN,label:bN,map:bN,marquee:bN,meter:bN,nobr:bN,noscript:bN,object:bN,output:bN,progress:bN,rb:bN,rbc:bN,rp:bN,rt:bN,rtc:bN,ruby:bN,slot:bN,small:bN,span:bN,sup:bN,sub:bN,tbody:bN,tfoot:bN,thead:bN,time:bN,address:xN,article:xN,aside:xN,body:xN,center:xN,div:xN,fieldset:xN,figcaption:xN,figure:xN,form:xN,footer:xN,header:xN,hgroup:xN,html:xN,legend:xN,main:xN,multicol:xN,nav:xN,picture:xN,section:xN,a:Kj,audio:tN,b:sN,base:qj,blockquote:Jj,br:Yj,code:AM,dir:KM,dl:xM,dt:UM,dd:UM,del:yM,em:wM,h1:EM,h2:EM,h3:EM,h4:EM,h5:EM,h6:EM,hr:DM,i:wM,iframe:OM,img:kM,image:kM,input:FM,kbd:AM,li:UM,listing:_M,mark:wM,ol:KM,p:nN,plaintext:_M,pre:_M,q:iN,s:yM,samp:AM,select:oN,strike:yM,strong:sN,summary:nN,table:dN,td:cN,textarea:gN,th:cN,tr:lN,tt:AM,u:wM,ul:KM,var:AM,video:tN,wbr:_N,xmp:_M};function bN(e,t){return e.all(t)}function xN(e,t){return e.toFlow(e.all(t))}function SN(){}var CN={}.hasOwnProperty;function wN(e){return{all:TN,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...yN,...e.handlers},inTable:!1,nodeHandlers:{...vN,...e.nodeHandlers},one:EN,options:e,patch:DN,qNesting:0,resolve:ON,toFlow:kN,toSpecificContent:AN}}function TN(e){let t=e.children||[],n=[],r=-1;for(;++r<t.length;){let i=t[r],a=this.one(i,e);Array.isArray(a)?n.push(...a):a&&n.push(a)}return n}function EN(e,t){if(e.type===`element`){if(e.properties&&e.properties.dataMdast===`ignore`)return;if(CN.call(this.handlers,e.tagName))return this.handlers[e.tagName](this,e,t)||void 0}else if(CN.call(this.nodeHandlers,e.type))return this.nodeHandlers[e.type](this,e,t)||void 0;if(`value`in e&&typeof e.value==`string`){let t={type:`text`,value:e.value};return this.patch(e,t),t}if(`children`in e)return this.all(e)}function DN(e,t){e.position&&(t.position=ee(e))}function ON(e){let t=this.frozenBaseUrl;return e==null?``:t?String(new URL(e,t)):e}function kN(e){return YM(e)}function AN(e,t){let n=t(),r=[],i=[],a=-1;for(;++a<e.length;){let t=e[a];if(o(t))i.length>0&&(t.children.unshift(...i),i=[]),r.push(t);else{let e=t;i.push(e)}}if(i.length>0){let e=r[r.length-1];e||(e=t(),r.push(e)),e.children.push(...i),i=[]}return r;function o(e){return e.type===n.type}}var jN={};function MN(e,t){let n=ve(e),r=t||jN,i=Gj({newlines:r.newlines===!0}),a=wN(r),o;i(n),h(n,function(e){if(e&&e.type===`element`&&e.properties){let t=String(e.properties.id||``)||void 0;t&&!a.elementById.has(t)&&a.elementById.set(t,e)}});let s=a.one(n,void 0);return o=s?Array.isArray(s)?{type:`root`,children:s}:s:{type:`root`,children:[]},h(o,function(e,t,n){if(e.type===`text`&&t!==void 0&&n){let r=n.children[t-1];if(r&&r.type===e.type)return r.value+=e.value,n.children.splice(t,1),r.position&&e.position&&(r.position.end=e.position.end),t-1;if(e.value=e.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,`$1`),n&&(n.type===`heading`||n.type===`paragraph`||n.type===`root`)&&(t||(e.value=e.value.replace(/^[\t ]+/,``)),t===n.children.length-1&&(e.value=e.value.replace(/[\t ]+$/,``))),!e.value)return n.children.splice(t,1),t}}),o}var NN={document:!0};function PN(e,t){return e&&`run`in e?async function(n,r){let i=MN(n,{...NN,...t});await e.run(i,r)}:function(t){return MN(t,{...NN,...e})}}var FN={}.hasOwnProperty;function IN(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)IN(e,t.extensions[n]);for(r in t)if(FN.call(t,r))switch(r){case`extensions`:break;case`unsafe`:LN(e[r],t[r]);break;case`join`:LN(e[r],t[r]);break;case`handlers`:RN(e[r],t[r]);break;default:e.options[r]=t[r]}return e}function LN(e,t){t&&e.push(...t)}function RN(e,t){t&&Object.assign(e,t)}var zN=[BN];function BN(e,t,n,r){if(t.type===`code`&&S(t,r)&&(e.type===`list`||e.type===t.type&&S(e,r)))return!1;if(`spread`in n&&typeof n.spread==`boolean`)return e.type===`paragraph`&&(e.type===t.type||t.type===`definition`||t.type===`heading`&&E(t,r))?void 0:+!!n.spread}var VN=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],HN=[{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`\r`,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:`
@@ -402,7 +402,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
402
402
  `,{inlineOnly:i=!1}={}){let a=``,o=!0;return e.nodesBetween(t,n,(e,s)=>{let c=e.isText?(e.text??``).slice(Math.max(t,s)-s,n-s):i&&e.isBlock?``:_Y(e);return e.isBlock&&(e.isTextblock||c.length>0)&&r&&(o?o=!1:a+=r),a+=c,!0},0),a}var yY=new Set([`*`,`_`,"`",`~`,`\\`,`$`]),bY=/^={2,}/,xY=/^<(?:[A-Za-z][A-Za-z0-9+.-]*:[^<>\s]*|[^\s<>@]+@[^\s<>]+)>/,SY=512;function CY(e,t){return xY.test(e.slice(t,t+SY))}function wY(e,t){let n=e.lastIndexOf(`<`,t);return n<0||t-n>SY?!1:xY.exec(e.slice(n,t+1))?.[0].length===t+1-n}var TY=/^<\/?[A-Za-z][A-Za-z0-9-]*(?:\s[^>]*?)?\/?>/,EY=512,DY=/^!(?=\[)/,OY=/^\[\^/,kY=/^\]\[[^\]]*\]/,AY=/^\[\[[^\][|]*\|/,jY=/^#[^\][|]*(?=\]\])/,MY=512,NY=/^\]\([^)]*\)/,PY=512,FY=/^(?:#{1,6}[ \t]+|>[ \t]?|(?:[-*+]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?)/,IY=32,LY=`|`,RY=/^(?:`{3,}[^`\n]*|~{3,}[^\n]*)$/,zY=/^(?:(?:[-*_][ \t]*){3,}|=+[ \t]*|[|\-: \t]*-[|\-: \t]*)$/,BY=1024;function VY(e,t){let n=e.indexOf(`
403
403
  `,t),r=n===-1?e.length:n;if(r>t&&e[r-1]===`\r`&&--r,r-t>BY)return 0;let i=e.slice(t,r);return i.length===0||!RY.test(i)&&!zY.test(i)?0:i.length}function HY(e){return e===` `||e===` `||e===`
404
404
  `||e===`\r`||e===`\f`||e===`\v`}function UY(e,t){for(let n=t-1;n>=0;--n){let t=e[n];if(t===`
405
- `)return!0;if(t!==` `&&t!==` `)return!1}return!0}function WY(e,t){let n=e[t];if(n===void 0)return 0;if(UY(e,t)){let n=VY(e,t);if(n>0)return n}if(n===LY)return 1;if(n===`<`){let n=TY.exec(e.slice(t,t+EY))?.[0].length;return n===void 0?+!!CY(e,t):n}if(n===`>`&&wY(e,t))return 1;if(n===`=`){let n=bY.exec(e.slice(t,t+3))?.[0].length;if(n!==void 0)return n}if(n===`!`)return+!!DY.test(e.slice(t,t+2));if(yY.has(n))return 1;if(n===`[`){let n=e.slice(t,t+MY),r=AY.exec(n)?.[0].length;return r===void 0?OY.test(n)?2:1:r}if(n===`#`){let n=jY.exec(e.slice(t,t+MY))?.[0].length;if(n!==void 0)return n}if(n===`]`){if(e[t+1]===`]`)return 2;let n=e.slice(t,t+Math.max(PY,MY)),r=NY.exec(n)?.[0].length;if(r!==void 0)return r;let i=kY.exec(n)?.[0].length;return i===void 0?1:i}return UY(e,t)?FY.exec(e.slice(t,t+IY))?.[0].length??0:0}function GY(e,t,{syntaxIn:n}){let r=[];if(t.length===0)return r;let i=n===`haystack`;for(let n=0;n<e.length;n+=1){let a=e[n];if(a===void 0||HY(a)||i&&a!==t[0]&&WY(e,n)>0)continue;let o=n,s=0;for(;o<e.length&&s<t.length;){let n=e[o],r=t[s];if(n===r){o+=1,s+=1;continue}if(HY(r)){s+=1;continue}if(HY(n)){o+=1;continue}let a=i?WY(e,o):WY(t,s);if(a>0){i?o+=a:s+=a;continue}break}for(;s<t.length&&HY(t[s]);)s+=1;s===t.length&&r.push({start:n,end:o})}return r}var KY=8,qY=64;function JY(e,t,n,r){let i=``,a=Math.max(0,t),o=Math.min(e.length,n);for(;a<o;){let t=e[a];if(HY(t)){a+=1;continue}if(r){let t=WY(e,a);if(t>0){a+=t;continue}}i+=t,a+=1}return i}function YY(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[e.length-1-r]===t[t.length-1-r];)r+=1;return r}function XY(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r+=1;return r}function ZY(e,t,n,{syntaxIn:r,syntaxInContext:i=!1}){let a=n.prefix??``,o=n.suffix??``,s=r===`haystack`,c=0;if(a.length>0){let n=a.length*KY+qY;c+=YY(JY(a,0,a.length,i),JY(e,t.start-n,t.start,s))}if(o.length>0){let n=o.length*KY+qY;c+=XY(JY(o,0,o.length,i),JY(e,t.end,t.end+n,s))}return c}function QY(e,{syntaxInContext:t=!1}={}){let n=JY(e.prefix??``,0,1/0,t).length+JY(e.suffix??``,0,1/0,t).length;return Math.min(8,n)}function $Y(e){return Math.max(e*4,e+64)}var eX=`source`;function tX(e){return{ok:!1,error:e}}function nX(e){return{ok:!0,...e}}function rX(){return Ff.parse({})}function iX(e,t){let n=e.toString();if(n.length===0)return rX();let r=_u(n);if(r.errors.length>0)return console.warn(`[bindConfigDoc:${t}] Y.Text contains invalid YAML; returning schema defaults. Errors: ${r.errors.map(e=>e.message).join(`; `)}`),rX();let i=r.toJSON()??{},a=Ff.safeParse(i);return a.success?a.data:(console.warn(`[bindConfigDoc:${t}] Y.Text content fails schema validation; returning schema defaults. First issue: ${a.error.issues[0]?.message??`(unknown)`}`),rX())}function aX(e,t,n={}){return Lf(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>oX(e,t,n))}function oX(e,t,n){let{ytextKey:r=eX}=n,i=e.document,a=i.getText(r),o=new Set,s=new Set,c=!1,l=!1;function u(){if(c)return;let e=iX(a,t);for(let n of o)try{n(e)}catch(e){console.warn(`[bindConfigDoc:${t}] listener threw:`,e)}}function d(){if(c||(u(),l))return;l=!0;let e=[...s];s.clear();for(let n of e)try{n()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}a.observe(u),e.on(`synced`,d);function f(e){if(c)return tX({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=Uf(e,t);if(n!==null)return tX(n);let r=_u(a.toString()),o=r.contents!==null&&!Xo(r.contents);if(r.errors.length>0||o){Rf(`config.corrupt-ytext-reset`,{"config.scope":t,"config.parse.errorCount":r.errors.length,"config.parse.topLevelNonMap":o});let e=r.errors.length>0?r.errors.map(e=>e.message).join(`; `):`top-level YAML is not a mapping`;console.warn(`[bindConfigDoc:${t}] dropping corrupt Y.Text and re-applying patch onto empty doc. Reason: ${e}`),r=_u(``)}r.contents===null&&(r.contents=r.createNode({}));let s=Gf(r,e),l=r.toJSON()??{},u=Lf(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=Ff.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)Rf(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return tX({code:`SCHEMA_INVALID`,issues:u.error.issues.map(Kf)});let d=r.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,d)}),nX({effective:u.data,appliedPaths:s})}return{current(){return iX(a,t)},patch(e){return Lf(`config.patch`,{"config.scope":t,"config.transport":`ytext`},t=>{let n=f(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})},subscribe(e){return o.add(e),()=>{o.delete(e)}},hasSynced(){return l},subscribeSynced(e){if(c)return()=>{};if(l){let n=!1;return queueMicrotask(()=>{if(!(n||c))try{e()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}),()=>{n=!0}}return s.add(e),()=>{s.delete(e)}},dispose(){c||(c=!0,a.unobserve(u),e.off(`synced`,d),o.clear(),s.clear())}}}var sX=`source`,cX=800;function lX(e){return{ok:!1,error:e}}function uX(e){return{ok:!0,...e}}function dX(e,t={}){let{ytextKey:n=sX,acceptanceDelayMs:r=cX}=t,i=e.document,a=i.getText(n),o=new Set,s=new Set,c=new Set,l=!1,u=`idle`,d=null;function f(){d!==null&&(clearTimeout(d),d=null)}function p(e){if(!l&&u!==e){u=e;for(let t of c)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] status listener threw:`,e)}}}function m(){if(l)return;let e=a.toString();for(let t of o)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] text listener threw:`,e)}}function h(e){if(!l)for(let t of s)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] rejection listener threw:`,e)}}return a.observe(m),e.on(`synced`,m),{current(){return a.toString()},patch(e){return l?lX({code:`WRITE_ERROR`,detail:`OkignoreBinding has been disposed`}):(i.transact(()=>{a.length>0&&a.delete(0,a.length),e.length>0&&a.insert(0,e)}),f(),p(`pending`),d=setTimeout(()=>{d=null,!l&&u===`pending`&&p(`accepted`)},r),uX({text:e}))},subscribe(e){return o.add(e),()=>{o.delete(e)}},subscribeRejection(e){return s.add(e),()=>{s.delete(e)}},subscribeStatus(e){return c.add(e),()=>{c.delete(e)}},status(){return u},notifyRejection(e){l||(f(),p(`rejected`),h({error:e,text:a.toString()}))},dispose(){l||(l=!0,f(),a.unobserve(m),e.off(`synced`,m),o.clear(),s.clear(),c.clear())}}}function fX(e,t,n){return pX([e,t,n],[])}function pX(e,t){if(t.length>0){let n=Vf(Ff,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[0]}let n=mX(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>hX(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=pX(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function mX(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function hX(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var gX=`(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)`;RegExp(`^127\\.${gX}\\.${gX}\\.${gX}$`);var _X=2e3;function vX(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function yX(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var bX=`#fafafa`,xX=`#171717`,SX=[`invalid-args`,`nested-project`,`target-not-empty`,`mkdir-failed`,`git-init-failed`,`init-failed`,`discovery-failed`],CX=[`.mdx`,`.md`],wX=`epoch`,TX=512*1024;function EX(e,t=TX){return typeof e==`number`&&Number.isFinite(e)&&e>t}var DX=10*1024*1024,OX={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function kX(){if(typeof navigator>`u`)return null;let e=navigator.userAgent;for(let[t,n]of Object.entries(OX))if(n.test(e))return t;return null}var AX=[`incoming`,`outgoing`,`both`];function jX(e){return AX.includes(e)}var MX=`open-knowledge`,NX=[`exec`,`search`,`history`,`links`,`skills`,`config`,`palette`,`preview_url`,`share_link`,`lint`,`audit`,`write`,`edit`,`delete`,`move`,`install`,`import`,`checkpoint`,`restore_version`,`conflicts`,`resolve_conflict`],PX=`https://github.com/inkeep/open-knowledge`,FX=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
405
+ `)return!0;if(t!==` `&&t!==` `)return!1}return!0}function WY(e,t){let n=e[t];if(n===void 0)return 0;if(UY(e,t)){let n=VY(e,t);if(n>0)return n}if(n===LY)return 1;if(n===`<`){let n=TY.exec(e.slice(t,t+EY))?.[0].length;return n===void 0?+!!CY(e,t):n}if(n===`>`&&wY(e,t))return 1;if(n===`=`){let n=bY.exec(e.slice(t,t+3))?.[0].length;if(n!==void 0)return n}if(n===`!`)return+!!DY.test(e.slice(t,t+2));if(yY.has(n))return 1;if(n===`[`){let n=e.slice(t,t+MY),r=AY.exec(n)?.[0].length;return r===void 0?OY.test(n)?2:1:r}if(n===`#`){let n=jY.exec(e.slice(t,t+MY))?.[0].length;if(n!==void 0)return n}if(n===`]`){if(e[t+1]===`]`)return 2;let n=e.slice(t,t+Math.max(PY,MY)),r=NY.exec(n)?.[0].length;if(r!==void 0)return r;let i=kY.exec(n)?.[0].length;return i===void 0?1:i}return UY(e,t)?FY.exec(e.slice(t,t+IY))?.[0].length??0:0}function GY(e,t,{syntaxIn:n}){let r=[];if(t.length===0)return r;let i=n===`haystack`;for(let n=0;n<e.length;n+=1){let a=e[n];if(a===void 0||HY(a)||i&&a!==t[0]&&WY(e,n)>0)continue;let o=n,s=0;for(;o<e.length&&s<t.length;){let n=e[o],r=t[s];if(n===r){o+=1,s+=1;continue}if(HY(r)){s+=1;continue}if(HY(n)){o+=1;continue}let a=i?WY(e,o):WY(t,s);if(a>0){i?o+=a:s+=a;continue}break}for(;s<t.length&&HY(t[s]);)s+=1;s===t.length&&r.push({start:n,end:o})}return r}var KY=8,qY=64;function JY(e,t,n,r){let i=``,a=Math.max(0,t),o=Math.min(e.length,n);for(;a<o;){let t=e[a];if(HY(t)){a+=1;continue}if(r){let t=WY(e,a);if(t>0){a+=t;continue}}i+=t,a+=1}return i}function YY(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[e.length-1-r]===t[t.length-1-r];)r+=1;return r}function XY(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r+=1;return r}function ZY(e,t,n,{syntaxIn:r,syntaxInContext:i=!1}){let a=n.prefix??``,o=n.suffix??``,s=r===`haystack`,c=0;if(a.length>0){let n=a.length*KY+qY;c+=YY(JY(a,0,a.length,i),JY(e,t.start-n,t.start,s))}if(o.length>0){let n=o.length*KY+qY;c+=XY(JY(o,0,o.length,i),JY(e,t.end,t.end+n,s))}return c}function QY(e,{syntaxInContext:t=!1}={}){let n=JY(e.prefix??``,0,1/0,t).length+JY(e.suffix??``,0,1/0,t).length;return Math.min(8,n)}function $Y(e){return Math.max(e*4,e+64)}var eX=`source`;function tX(e){return{ok:!1,error:e}}function nX(e){return{ok:!0,...e}}function rX(){return Ff.parse({})}function iX(e,t){let n=e.toString();if(n.length===0)return rX();let r=_u(n);if(r.errors.length>0)return console.warn(`[bindConfigDoc:${t}] Y.Text contains invalid YAML; returning schema defaults. Errors: ${r.errors.map(e=>e.message).join(`; `)}`),rX();let i=r.toJSON()??{},a=Ff.safeParse(i);return a.success?a.data:(console.warn(`[bindConfigDoc:${t}] Y.Text content fails schema validation; returning schema defaults. First issue: ${a.error.issues[0]?.message??`(unknown)`}`),rX())}function aX(e,t,n={}){return Lf(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>oX(e,t,n))}function oX(e,t,n){let{ytextKey:r=eX}=n,i=e.document,a=i.getText(r),o=new Set,s=new Set,c=!1,l=!1;function u(){if(c)return;let e=iX(a,t);for(let n of o)try{n(e)}catch(e){console.warn(`[bindConfigDoc:${t}] listener threw:`,e)}}function d(){if(c||(u(),l))return;l=!0;let e=[...s];s.clear();for(let n of e)try{n()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}a.observe(u),e.on(`synced`,d);function f(e){if(c)return tX({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=Uf(e,t);if(n!==null)return tX(n);let r=_u(a.toString()),o=r.contents!==null&&!Zo(r.contents);if(r.errors.length>0||o){Rf(`config.corrupt-ytext-reset`,{"config.scope":t,"config.parse.errorCount":r.errors.length,"config.parse.topLevelNonMap":o});let e=r.errors.length>0?r.errors.map(e=>e.message).join(`; `):`top-level YAML is not a mapping`;console.warn(`[bindConfigDoc:${t}] dropping corrupt Y.Text and re-applying patch onto empty doc. Reason: ${e}`),r=_u(``)}r.contents===null&&(r.contents=r.createNode({}));let s=Gf(r,e),l=r.toJSON()??{},u=Lf(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=Ff.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)Rf(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return tX({code:`SCHEMA_INVALID`,issues:u.error.issues.map(Kf)});let d=r.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,d)}),nX({effective:u.data,appliedPaths:s})}return{current(){return iX(a,t)},patch(e){return Lf(`config.patch`,{"config.scope":t,"config.transport":`ytext`},t=>{let n=f(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})},subscribe(e){return o.add(e),()=>{o.delete(e)}},hasSynced(){return l},subscribeSynced(e){if(c)return()=>{};if(l){let n=!1;return queueMicrotask(()=>{if(!(n||c))try{e()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}),()=>{n=!0}}return s.add(e),()=>{s.delete(e)}},dispose(){c||(c=!0,a.unobserve(u),e.off(`synced`,d),o.clear(),s.clear())}}}var sX=`source`,cX=800;function lX(e){return{ok:!1,error:e}}function uX(e){return{ok:!0,...e}}function dX(e,t={}){let{ytextKey:n=sX,acceptanceDelayMs:r=cX}=t,i=e.document,a=i.getText(n),o=new Set,s=new Set,c=new Set,l=!1,u=`idle`,d=null;function f(){d!==null&&(clearTimeout(d),d=null)}function p(e){if(!l&&u!==e){u=e;for(let t of c)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] status listener threw:`,e)}}}function m(){if(l)return;let e=a.toString();for(let t of o)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] text listener threw:`,e)}}function h(e){if(!l)for(let t of s)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] rejection listener threw:`,e)}}return a.observe(m),e.on(`synced`,m),{current(){return a.toString()},patch(e){return l?lX({code:`WRITE_ERROR`,detail:`OkignoreBinding has been disposed`}):(i.transact(()=>{a.length>0&&a.delete(0,a.length),e.length>0&&a.insert(0,e)}),f(),p(`pending`),d=setTimeout(()=>{d=null,!l&&u===`pending`&&p(`accepted`)},r),uX({text:e}))},subscribe(e){return o.add(e),()=>{o.delete(e)}},subscribeRejection(e){return s.add(e),()=>{s.delete(e)}},subscribeStatus(e){return c.add(e),()=>{c.delete(e)}},status(){return u},notifyRejection(e){l||(f(),p(`rejected`),h({error:e,text:a.toString()}))},dispose(){l||(l=!0,f(),a.unobserve(m),e.off(`synced`,m),o.clear(),s.clear(),c.clear())}}}function fX(e,t,n){return pX([e,t,n],[])}function pX(e,t){if(t.length>0){let n=Vf(Ff,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[0]}let n=mX(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>hX(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=pX(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function mX(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function hX(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var gX=`(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)`;RegExp(`^127\\.${gX}\\.${gX}\\.${gX}$`);var _X=2e3;function vX(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function yX(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var bX=`#fafafa`,xX=`#171717`,SX=[`invalid-args`,`nested-project`,`target-not-empty`,`mkdir-failed`,`git-init-failed`,`init-failed`,`discovery-failed`],CX=[`.mdx`,`.md`],wX=`epoch`,TX=512*1024;function EX(e,t=TX){return typeof e==`number`&&Number.isFinite(e)&&e>t}var DX=10*1024*1024,OX={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function kX(){if(typeof navigator>`u`)return null;let e=navigator.userAgent;for(let[t,n]of Object.entries(OX))if(n.test(e))return t;return null}var AX=[`incoming`,`outgoing`,`both`];function jX(e){return AX.includes(e)}var MX=`open-knowledge`,NX=[`exec`,`search`,`history`,`links`,`skills`,`config`,`palette`,`preview_url`,`share_link`,`lint`,`audit`,`write`,`edit`,`delete`,`move`,`install`,`import`,`checkpoint`,`restore_version`,`conflicts`,`resolve_conflict`],PX=`https://github.com/inkeep/open-knowledge`,FX=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
406
406
  <h3 style="margin:0 0 14px;font-size:15px;font-weight:600">Revenue by region</h3>
407
407
  <div id="bars" style="display:flex;align-items:flex-end;gap:14px;height:170px"></div>
408
408
  <script>
@@ -464,9 +464,9 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
464
464
  out.textContent = '$' + Number(amt.value).toLocaleString();
465
465
  });
466
466
  <\/script>
467
- </div>`}],IX=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.5621 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],LX=Object.freeze([{value:`workflow-fit`,label:`It didn't fit into my workflow`},{value:`missing-feature`,label:`It was missing a feature I needed`},{value:`hard-to-start`,label:`It was too hard to set up or get started`},{value:`unreliable`,label:`Bugs, crashes, or it felt unreliable`},{value:`switched-tool`,label:`I'm switching to another tool`},{value:`one-off`,label:`It was a trial or one-off project`},{value:`other`,label:`Something else`}]),RX=1e4;new Set(LX.map(e=>e.value));var zX=ME.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceUnclosedFence:{default:!1,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),BX=GE.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[rE({find:BE,type:this.type,getAttributes:{sourceDelimiter:`*`}}),rE({find:HE,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),VX=zE.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[rE({find:PE,type:this.type,getAttributes:{sourceDelimiter:`**`}}),rE({find:IE,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),HX=MT.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),UX=TE.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}});function WX({node:e}){return``.repeat(e.nodeSize-e.content.size)}function GX(e){let t=0;for(let n of e){let e=Number.parseInt(n,10);!Number.isNaN(e)&&e>t&&(t=e)}return String(t+1)}function KX(e){let t=[];return e.descendants(e=>(e.type.name===`footnoteDefinition`&&t.push(String(e.attrs.identifier??``)),!0)),t}function qX(e){let t=null;return e.forEach((e,n)=>{e.type.name===`footnoteDefinition`&&(t=n+e.nodeSize)}),t??e.content.size}var JX=TE.create({name:`footnoteReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,renderText:WX,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),YX=qE.extend({marks:`_`,priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`},sourceRaw:{default:null}}}}),XX=YE.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),ZX=TE.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),QX=TE.create({name:`imageReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:WX,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:t||n}]}});function $X(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}var eZ=ZE.extend({marks:`_`,priority:60,renderText:WX,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=gw(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=$X(t.src)),[`img`,t]}}),tZ=TE.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),nZ=TE.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,renderText:WX,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`span[data-jsx-inline]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-jsx-inline":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]}}),rZ=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],iZ=rZ.map(e=>`${e}:`).join(`|`),aZ=RegExp(`^(?:${iZ}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function oZ(e){let t=e.trim();return t===``?!0:aZ.test(t)}function sZ(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}var cZ=new Set(rZ.map(e=>`${e}:`)),lZ=`https://placeholder.invalid`;function uZ(e){try{let t=new URL(e,lZ);return cZ.has(t.protocol.toLowerCase())}catch{return!1}}var dZ=qte.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:uZ,validate:uZ,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),fZ=TE.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function pZ(e){return e.type.name===`list`&&!e.attrs.ordered}function mZ(e){return e.type.name===`list`&&!!e.attrs.ordered}function hZ(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function gZ(e,t,n,r,i,a,o){let s=ow(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?av(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o})}}),t(n),!0}return nv(n,a)(e,void 0)?t?nv(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}var _Z=TE.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,gw(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:gZ(e,t,n,r,e=>pZ(e)&&!hZ(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:gZ(e,t,n,r,e=>mZ(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:gZ(e,t,n,r,e=>pZ(e)&&hZ(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[oE({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),oE({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]}),joinPredicate:(e,t)=>t.attrs.ordered===!0}),new wT({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Dg(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),vZ=TE.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,gw(t),0]:[`li`,gw(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(gw(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`),c=()=>{o&&(o.disabled=!n.isEditable)};return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,c(),n.on(`update`,c),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,o.disabled=!n.isEditable,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)},destroy(){n.off(`update`,c)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),yZ=_Z,bZ=vZ,xZ=TE.create({name:`mathInline`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:WX,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),SZ=TE.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),CZ=sre.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),wZ=ure.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),TZ=TE.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),EZ=MT.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),DZ=VT.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}});function OZ(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function kZ(e){let t=!1;return e.descendants(e=>t?!1:(e.type.name===`list`&&(t=!0),!t)),t}function AZ(e){let{selection:t}=e;return t instanceof K?t.$cursor:null}function jZ(e){let t=AZ(e);if(!t||t.parentOffset!==0)return!1;let n=OZ(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r===0?!1:kZ(t.node(n-1).child(r-1))}function MZ(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function NZ(e){let t=AZ(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=OZ(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=MZ(t,n);return r!==null&&r<n}var PZ=VT.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!jZ(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return S_(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!NZ(e.state))return!1;let{state:t,view:n}=e;return C_(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),FZ=VT.create({name:`plainTextClipboard`,priority:1e3,addProseMirrorPlugins(){return[new h_({key:new v_(`okPlainTextClipboard`),props:{clipboardTextSerializer:e=>e.content.textBetween(0,e.content.size,`
467
+ </div>`}],IX=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.5621 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],LX=Object.freeze([{value:`workflow-fit`,label:`It didn't fit into my workflow`},{value:`missing-feature`,label:`It was missing a feature I needed`},{value:`hard-to-start`,label:`It was too hard to set up or get started`},{value:`unreliable`,label:`Bugs, crashes, or it felt unreliable`},{value:`switched-tool`,label:`I'm switching to another tool`},{value:`one-off`,label:`It was a trial or one-off project`},{value:`other`,label:`Something else`}]),RX=1e4;new Set(LX.map(e=>e.value));var zX=ME.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceUnclosedFence:{default:!1,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),BX=GE.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[rE({find:BE,type:this.type,getAttributes:{sourceDelimiter:`*`}}),rE({find:HE,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),VX=zE.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[rE({find:PE,type:this.type,getAttributes:{sourceDelimiter:`**`}}),rE({find:IE,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),HX=MT.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),UX=TE.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}});function WX({node:e}){return``.repeat(e.nodeSize-e.content.size)}function GX(e){let t=0;for(let n of e){let e=Number.parseInt(n,10);!Number.isNaN(e)&&e>t&&(t=e)}return String(t+1)}function KX(e){let t=[];return e.descendants(e=>(e.type.name===`footnoteDefinition`&&t.push(String(e.attrs.identifier??``)),!0)),t}function qX(e){let t=null;return e.forEach((e,n)=>{e.type.name===`footnoteDefinition`&&(t=n+e.nodeSize)}),t??e.content.size}var JX=TE.create({name:`footnoteReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,renderText:WX,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),YX=qE.extend({marks:`_`,priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`},sourceRaw:{default:null}}}}),XX=YE.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),ZX=TE.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),QX=TE.create({name:`imageReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:WX,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:t||n}]}});function $X(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}var eZ=ZE.extend({marks:`_`,priority:60,renderText:WX,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=gw(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=$X(t.src)),[`img`,t]}}),tZ=TE.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),nZ=TE.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,renderText:WX,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`span[data-jsx-inline]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-jsx-inline":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]}}),rZ=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],iZ=rZ.map(e=>`${e}:`).join(`|`),aZ=RegExp(`^(?:${iZ}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function oZ(e){let t=e.trim();return t===``?!0:aZ.test(t)}function sZ(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}var cZ=new Set(rZ.map(e=>`${e}:`)),lZ=`https://placeholder.invalid`;function uZ(e){try{let t=new URL(e,lZ);return cZ.has(t.protocol.toLowerCase())}catch{return!1}}var dZ=Jte.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:uZ,validate:uZ,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),fZ=TE.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function pZ(e){return e.type.name===`list`&&!e.attrs.ordered}function mZ(e){return e.type.name===`list`&&!!e.attrs.ordered}function hZ(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function gZ(e,t,n,r,i,a,o){let s=ow(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?av(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o})}}),t(n),!0}return nv(n,a)(e,void 0)?t?nv(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}var _Z=TE.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,gw(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:gZ(e,t,n,r,e=>pZ(e)&&!hZ(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:gZ(e,t,n,r,e=>mZ(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:gZ(e,t,n,r,e=>pZ(e)&&hZ(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[oE({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),oE({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]}),joinPredicate:(e,t)=>t.attrs.ordered===!0}),new wT({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Dg(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),vZ=TE.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,gw(t),0]:[`li`,gw(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(gw(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`),c=()=>{o&&(o.disabled=!n.isEditable)};return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,c(),n.on(`update`,c),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,o.disabled=!n.isEditable,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)},destroy(){n.off(`update`,c)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),yZ=_Z,bZ=vZ,xZ=TE.create({name:`mathInline`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:WX,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),SZ=TE.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),CZ=cre.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),wZ=dre.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),TZ=TE.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),EZ=MT.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),DZ=VT.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}});function OZ(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function kZ(e){let t=!1;return e.descendants(e=>t?!1:(e.type.name===`list`&&(t=!0),!t)),t}function AZ(e){let{selection:t}=e;return t instanceof K?t.$cursor:null}function jZ(e){let t=AZ(e);if(!t||t.parentOffset!==0)return!1;let n=OZ(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r===0?!1:kZ(t.node(n-1).child(r-1))}function MZ(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function NZ(e){let t=AZ(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=OZ(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=MZ(t,n);return r!==null&&r<n}var PZ=VT.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!jZ(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return S_(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!NZ(e.state))return!1;let{state:t,view:n}=e;return C_(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),FZ=VT.create({name:`plainTextClipboard`,priority:1e3,addProseMirrorPlugins(){return[new h_({key:new v_(`okPlainTextClipboard`),props:{clipboardTextSerializer:e=>e.content.textBetween(0,e.content.size,`
468
468
 
469
- `)}})]}}),IZ=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function LZ(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function RZ(e){let t=LZ(e);return t!==null&&IZ.has(t)}function zZ(e){let t=LZ(e);return t===null?null:IZ.get(t)??null}var BZ=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function VZ(e){BZ.lastIndex=0;let t=e.match(BZ);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=zZ(e);if(t===null)return null;n+=t}return n}var HZ=MT.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function UZ(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||WZ(n)===r?!0:VZ(e)===t}function WZ(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}var GZ=Dre.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),KZ=iA.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),qZ=Zk.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),JZ=Qk.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),YZ=TE.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:WX,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),XZ=/^(?:---|—-|___\s|\*\*\*\s)$/;function ZZ(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}var QZ=fre.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[iE({find:XZ,type:this.type,getAttributes:e=>({sourceRaw:ZZ(e)})})]}}),$Z=kre.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}}),eQ=/^\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/;function tQ(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function nQ(e){let t=e.match(eQ);if(!t)return null;let n=t[1]?.trim()??``;return n?{type:`wikilink`,raw:t[0],target:n,anchor:tQ(t[2]),alias:tQ(t[3])}:null}function rQ(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var iQ=TE.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:WX,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:tQ(e.getAttribute(`data-alias`)),anchor:tQ(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:tQ(e.getAttribute(`data-alias`)),anchor:tQ(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=tQ(e.attrs.alias),i=tQ(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},rQ({target:n,alias:r,anchor:i})]}});function aQ(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function oQ(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var sQ=TE.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:WX,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:tQ(e.getAttribute(`data-alias`)),anchor:tQ(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=tQ(e.attrs.alias),i=tQ(e.attrs.anchor),a=tQ(e.attrs.resolvedSrc),o=aQ(n);if(Gu.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},oQ({target:n,alias:r,anchor:i})]}}),cQ=[tZ,SZ,nZ,xZ,iQ,sQ,YZ,yZ,bZ,BX,VX,GZ,$Z,wZ,zX,CZ,XX,QZ,dZ,ZX,fZ,YX,HX,DZ,HZ,FZ,ij.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,underline:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),PZ,KZ.configure({resizable:!0}),$k,JZ,qZ,eZ.configure({inline:!0}),QX,Xte,EZ,TZ,JX,UX];function lQ(e){let t=e.indexOf(`/`);return t===-1?e:e.slice(t+1)}function uQ(e,t){let n=encodeURIComponent(t.projectDir);if(t.prompt===``)return`claude://${e.mode}/new?folder=${n}`;let r=encodeURIComponent(t.prompt);return`claude://${e.mode}/new?q=${r}&folder=${n}`}function dQ(e){let t=encodeURIComponent(e.projectDir);return e.prompt===``?`codex://new?path=${t}`:`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${t}`}function fQ(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function pQ(e){let t=encodeURIComponent(fQ(e.projectDir));return e.prompt===``?`cursor://anysphere.cursor-deeplink/prompt?workspace=${t}&mode=agent`:`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(encodeURIComponent(e.prompt))}&workspace=${t}&mode=agent`}function mQ(e){return`'${e.replace(/'/g,`'\\''`)}'`}var hQ=[`mcp__${MX}`,`Bash(ok open:*)`],gQ=[`delete`,`move`,`share_link`,`install`,`import`].map(e=>`mcp__${MX}__${e}`),_Q=`-c ${mQ(`mcp_servers.${MX}.default_tools_approval_mode="approve"`)}`;function vQ(e){let t={};return e.mcpPreApprove===!0&&(t.enabledMcpjsonServers=[MX]),e.autoApproveOkTools===!0&&(t.permissions={allow:[...hQ],ask:[...gQ]}),t.enabledMcpjsonServers===void 0&&t.permissions===void 0?``:`--settings ${mQ(JSON.stringify(t))}`}var yQ=`\x1B`,bQ=`${yQ}[200~`,xQ=`${yQ}[201~`,SQ={claude:{bin:`claude`,displayName:`Claude`,docsUrl:`https://docs.claude.com/en/docs/claude-code`,handoffTarget:`claude-code`},codex:{bin:`codex`,displayName:`Codex`,docsUrl:`https://developers.openai.com/codex/cli`,handoffTarget:`codex`,autoApproveArg:_Q},copilot:{bin:`copilot`,displayName:`GitHub Copilot`,docsUrl:`https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-getting-started`,handoffTarget:`copilot`,promptFlag:`--interactive`},cursor:{bin:`cursor-agent`,displayName:`Cursor`,docsUrl:`https://cursor.com/docs/cli/overview`,handoffTarget:`cursor`},opencode:{bin:`opencode`,displayName:`OpenCode`,docsUrl:`https://opencode.ai/docs`,handoffTarget:`opencode`,promptFlag:`--prompt`},pi:{bin:`pi`,displayName:`Pi`,docsUrl:`https://pi.dev`,handoffTarget:`pi`},antigravity:{bin:`agy`,displayName:`Antigravity`,docsUrl:`https://antigravity.google/docs/cli-getting-started`,handoffTarget:`antigravity`,promptFlag:`--prompt-interactive`},openclaw:{bin:`openclaw`,subcommand:`chat`,displayName:`OpenClaw`,docsUrl:`https://docs.openclaw.ai/cli/tui`,handoffTarget:`openclaw`,promptFlag:`--message`},hermes:{bin:`hermes`,subcommand:`chat`,displayName:`Hermes`,docsUrl:`https://hermes-agent.nousresearch.com/docs/user-guide/cli`,handoffTarget:`hermes`,startupInjection:{submit:`\r`,readyMarker:`\x1B[?2004h`,settleMs:300,capMs:4e3}}},CQ=[`claude`,`codex`,`opencode`,`cursor`,`copilot`,`pi`,`antigravity`,`openclaw`,`hermes`];function wQ(e,t,n={}){let r=SQ[e],i=e===`claude`?vQ(n):n.autoApproveOkTools===!0&&r.autoApproveArg?r.autoApproveArg:``,a=i?`${i} `:``,o=r.subcommand?`${r.subcommand} `:``;if(r.startupInjection!=null||t==null||t.length===0)return`${r.bin} ${o}${a}`.trimEnd();let s=r.promptFlag?`${r.promptFlag} `:``;return`${r.bin} ${o}${a}${s}${mQ(t)}`}function TQ(e){return SQ[e].startupInjection}function EQ(e,t){let n=TQ(e);return n==null||t==null||t.length===0?null:`${bQ}${t.replaceAll(yQ,``)}${xQ}${n.submit}`}var DQ=RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`),OQ=RegExp("[ \\u00a0\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`);function kQ(e){return e.replace(DQ,`_`)}function AQ(e){return e.replace(OQ,`_`)}var jQ="This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`.";function MQ(e){return`${jQ} ${e}`}var NQ=`You're running in the terminal of the OpenKnowledge desktop app.`,PQ=`You're an agent working inside OpenKnowledge, with its MCP tools available to you.`;function FQ(e){return`${PQ} ${jQ} ${e===null?`Then stop.`:`Read \`${kQ(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function IQ(e){return`${NQ} ${jQ} ${e===null?`Then stop.`:`Read \`${kQ(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function LQ(e,t,n,r=`url`){let i=`Let's work on \`${kQ(e)}\` using OpenKnowledge.`;return o$(t?`${i} Open the OK editor in web view.`:i,n,r)}function RQ(e,t,n){let r=`Use your open-knowledge-write-skill skill to author the ${t} Open Knowledge skill \`${kQ(e)}\`. Edit it with the Open Knowledge tools.`;return n?`${r} Open the OK editor in web view.`:r}function zQ(e,t,n,r=`url`){let i=`Let's work on the \`${kQ(e)}\` folder using OpenKnowledge.`;return o$(t?`${i} Open the OK editor in web view.`:i,n,r)}function BQ(e,t,n=`url`){let r=`Let's work on this project using OpenKnowledge.`;return o$(e?`${r} Open the OK editor in web view.`:r,t,n)}function VQ(e,t,n,r,i=`url`){let a=t?`Open the OK editor in web view.`:``,o=e=>a===``?e:e.includes(`
469
+ `)}})]}}),IZ=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function LZ(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function RZ(e){let t=LZ(e);return t!==null&&IZ.has(t)}function zZ(e){let t=LZ(e);return t===null?null:IZ.get(t)??null}var BZ=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function VZ(e){BZ.lastIndex=0;let t=e.match(BZ);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=zZ(e);if(t===null)return null;n+=t}return n}var HZ=MT.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function UZ(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||WZ(n)===r?!0:VZ(e)===t}function WZ(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}var GZ=Ore.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),KZ=rA.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),qZ=Xk.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),JZ=Zk.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),YZ=TE.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:WX,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),XZ=/^(?:---|—-|___\s|\*\*\*\s)$/;function ZZ(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}var QZ=pre.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[iE({find:XZ,type:this.type,getAttributes:e=>({sourceRaw:ZZ(e)})})]}}),$Z=Are.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}}),eQ=/^\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/;function tQ(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function nQ(e){let t=e.match(eQ);if(!t)return null;let n=t[1]?.trim()??``;return n?{type:`wikilink`,raw:t[0],target:n,anchor:tQ(t[2]),alias:tQ(t[3])}:null}function rQ(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var iQ=TE.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:WX,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:tQ(e.getAttribute(`data-alias`)),anchor:tQ(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:tQ(e.getAttribute(`data-alias`)),anchor:tQ(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=tQ(e.attrs.alias),i=tQ(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},rQ({target:n,alias:r,anchor:i})]}});function aQ(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function oQ(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var sQ=TE.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:WX,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:tQ(e.getAttribute(`data-alias`)),anchor:tQ(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=tQ(e.attrs.alias),i=tQ(e.attrs.anchor),a=tQ(e.attrs.resolvedSrc),o=aQ(n);if(Gu.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},oQ({target:n,alias:r,anchor:i})]}}),cQ=[tZ,SZ,nZ,xZ,iQ,sQ,YZ,yZ,bZ,BX,VX,GZ,$Z,wZ,zX,CZ,XX,QZ,dZ,ZX,fZ,YX,HX,DZ,HZ,FZ,ij.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,underline:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),PZ,KZ.configure({resizable:!0}),Qk,JZ,qZ,eZ.configure({inline:!0}),QX,Zte,EZ,TZ,JX,UX];function lQ(e){let t=e.indexOf(`/`);return t===-1?e:e.slice(t+1)}function uQ(e,t){let n=encodeURIComponent(t.projectDir);if(t.prompt===``)return`claude://${e.mode}/new?folder=${n}`;let r=encodeURIComponent(t.prompt);return`claude://${e.mode}/new?q=${r}&folder=${n}`}function dQ(e){let t=encodeURIComponent(e.projectDir);return e.prompt===``?`codex://new?path=${t}`:`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${t}`}function fQ(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function pQ(e){let t=encodeURIComponent(fQ(e.projectDir));return e.prompt===``?`cursor://anysphere.cursor-deeplink/prompt?workspace=${t}&mode=agent`:`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(encodeURIComponent(e.prompt))}&workspace=${t}&mode=agent`}function mQ(e){return`'${e.replace(/'/g,`'\\''`)}'`}var hQ=[`mcp__${MX}`,`Bash(ok open:*)`],gQ=[`delete`,`move`,`share_link`,`install`,`import`].map(e=>`mcp__${MX}__${e}`),_Q=`-c ${mQ(`mcp_servers.${MX}.default_tools_approval_mode="approve"`)}`;function vQ(e){let t={};return e.mcpPreApprove===!0&&(t.enabledMcpjsonServers=[MX]),e.autoApproveOkTools===!0&&(t.permissions={allow:[...hQ],ask:[...gQ]}),t.enabledMcpjsonServers===void 0&&t.permissions===void 0?``:`--settings ${mQ(JSON.stringify(t))}`}var yQ=`\x1B`,bQ=`${yQ}[200~`,xQ=`${yQ}[201~`,SQ={claude:{bin:`claude`,displayName:`Claude`,docsUrl:`https://docs.claude.com/en/docs/claude-code`,handoffTarget:`claude-code`},codex:{bin:`codex`,displayName:`Codex`,docsUrl:`https://developers.openai.com/codex/cli`,handoffTarget:`codex`,autoApproveArg:_Q},copilot:{bin:`copilot`,displayName:`GitHub Copilot`,docsUrl:`https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-getting-started`,handoffTarget:`copilot`,promptFlag:`--interactive`},cursor:{bin:`cursor-agent`,displayName:`Cursor`,docsUrl:`https://cursor.com/docs/cli/overview`,handoffTarget:`cursor`},opencode:{bin:`opencode`,displayName:`OpenCode`,docsUrl:`https://opencode.ai/docs`,handoffTarget:`opencode`,promptFlag:`--prompt`},pi:{bin:`pi`,displayName:`Pi`,docsUrl:`https://pi.dev`,handoffTarget:`pi`},antigravity:{bin:`agy`,displayName:`Antigravity`,docsUrl:`https://antigravity.google/docs/cli-getting-started`,handoffTarget:`antigravity`,promptFlag:`--prompt-interactive`},openclaw:{bin:`openclaw`,subcommand:`chat`,displayName:`OpenClaw`,docsUrl:`https://docs.openclaw.ai/cli/tui`,handoffTarget:`openclaw`,promptFlag:`--message`},hermes:{bin:`hermes`,subcommand:`chat`,displayName:`Hermes`,docsUrl:`https://hermes-agent.nousresearch.com/docs/user-guide/cli`,handoffTarget:`hermes`,startupInjection:{submit:`\r`,readyMarker:`\x1B[?2004h`,settleMs:300,capMs:4e3}}},CQ=[`claude`,`codex`,`opencode`,`cursor`,`copilot`,`pi`,`antigravity`,`openclaw`,`hermes`];function wQ(e,t,n={}){let r=SQ[e],i=e===`claude`?vQ(n):n.autoApproveOkTools===!0&&r.autoApproveArg?r.autoApproveArg:``,a=i?`${i} `:``,o=r.subcommand?`${r.subcommand} `:``;if(r.startupInjection!=null||t==null||t.length===0)return`${r.bin} ${o}${a}`.trimEnd();let s=r.promptFlag?`${r.promptFlag} `:``;return`${r.bin} ${o}${a}${s}${mQ(t)}`}function TQ(e){return SQ[e].startupInjection}function EQ(e,t){let n=TQ(e);return n==null||t==null||t.length===0?null:`${bQ}${t.replaceAll(yQ,``)}${xQ}${n.submit}`}var DQ=RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`),OQ=RegExp("[ \\u00a0\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`);function kQ(e){return e.replace(DQ,`_`)}function AQ(e){return e.replace(OQ,`_`)}var jQ="This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`.";function MQ(e){return`${jQ} ${e}`}var NQ=`You're running in the terminal of the OpenKnowledge desktop app.`,PQ=`You're an agent working inside OpenKnowledge, with its MCP tools available to you.`;function FQ(e){return`${PQ} ${jQ} ${e===null?`Then stop.`:`Read \`${kQ(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function IQ(e){return`${NQ} ${jQ} ${e===null?`Then stop.`:`Read \`${kQ(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function LQ(e,t,n,r=`url`){let i=`Let's work on \`${kQ(e)}\` using OpenKnowledge.`;return o$(t?`${i} Open the OK editor in web view.`:i,n,r)}function RQ(e,t,n){let r=`Use your open-knowledge-write-skill skill to author the ${t} Open Knowledge skill \`${kQ(e)}\`. Edit it with the Open Knowledge tools.`;return n?`${r} Open the OK editor in web view.`:r}function zQ(e,t,n,r=`url`){let i=`Let's work on the \`${kQ(e)}\` folder using OpenKnowledge.`;return o$(t?`${i} Open the OK editor in web view.`:i,n,r)}function BQ(e,t,n=`url`){let r=`Let's work on this project using OpenKnowledge.`;return o$(e?`${r} Open the OK editor in web view.`:r,t,n)}function VQ(e,t,n,r,i=`url`){let a=t?`Open the OK editor in web view.`:``,o=e=>a===``?e:e.includes(`
470
470
  `)?[e,``,a].join(`
471
471
  `):`${e} ${a}`,s=e=>e.split(`
472
472
  `).map(e=>`> ${e}`).join(`
@@ -495,7 +495,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
495
495
  `)}function x$(e,t,n,r,i,a,o){if(e.kind===`lines`)return _$(e.startLine,e.endLine,n);if(e.kind===`anchor`)return g$(e.markdown,n);let s=h$(e.markdown);return KQ(b$(t,``,s,r,i),a,o)<=qQ(o,HQ)?s:g$(e.markdown,n)}function S$(e,t,n,r){let{target:i}=e,a=e.transport??`url`,o=AQ(e.docRelativePath),s=`Let's work on @${o} using OpenKnowledge.`,c=x$(t,s,o,n,r,i,a);return b$(s,l$(e.instruction,i,e=>b$(s,e,c,n,r),a),c,n,r)}function C$(e){let{target:t}=e,n=e.autoOpen?p$:``,r=v$(e.mentions);if(e.scope===`doc`&&e.selection!==void 0)return S$(e,e.selection,r,n);let i=y$(e);return b$(i,l$(e.instruction,t,e=>b$(i,e,``,r,n),e.transport??`url`),``,r,n)}function w$(e){let t=AQ(e.relativePath),n=e.ruleAlias===void 0?`${e.source}/${e.code}`:`${e.source}/${e.code} (${e.ruleAlias})`,r=[`Fix this lint problem in @${t} using OpenKnowledge.`,``,`Problem: ${n} at line ${e.line}, column ${e.column}:`,``,m$(e.message.trim())],i=e.lineText??``;if(i.trim()!==``){let t=QQ(i);r.push(``,`Line ${e.line} reads:`,``,t,i,t)}return r.push(``,`Edit @${t} via the OpenKnowledge MCP server, then re-lint it to confirm the problem is resolved.`),r.join(`
496
496
  `)}function T$(e){if(e===null)return[`Fix every problem across this project's documents using OpenKnowledge.`,``,"Run the `audit` tool for the current list of lint violations and broken links, then work file by file — the `lint` tool with `fix: true` clears one document's mechanically-fixable problems at a time — and re-audit until it reports no problems."].join(`
497
497
  `);let t=AQ(e);return[`Fix every problem in @${t} using OpenKnowledge.`,``,`Run the \`audit\` tool scoped to it for the current list of lint violations and broken links, then fix each one — the \`lint\` tool with \`fix: true\` clears the mechanically-fixable ones — and re-audit @${t} until it reports no problems.`].join(`
498
- `)}function E$(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}var D$=new Set([`opencode.json`]),O$=/^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;function k$(e){return O$.test(e)}function A$(e){return k$(e)?!1:e.split(`/`).some(e=>e.startsWith(`.`))?!0:D$.has(e.slice(e.lastIndexOf(`/`)+1))}function j$(e,t){let n=E$(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var M$=N().superRefine(j$).optional(),N$=N().superRefine(j$),P$={agentId:N().optional(),agentName:N().optional(),colorSeed:N().optional(),clientName:N().optional(),clientVersion:N().optional(),label:N().optional()},F$=N().optional(),I$=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;io(`kind`,[L({kind:B(`doc`),docPath:N().min(1)}).loose(),L({kind:B(`folder`),folderPath:N()}).loose()]);var L$=z([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),R$=z([`current`,`stale`,`absent`,`empty`]),z$=io(`ok`,[L({ok:B(!0),shareUrl:N().min(1),sharedUrl:N().min(1),branch:N().min(1),freshness:R$.optional().catch(void 0)}).loose(),L({ok:B(!1),error:L$,branch:N().min(1).optional()}).loose()]),B$=z([`user`,`org`]),V$=L({login:N().min(1),kind:B$,avatarUrl:N().optional()}).loose(),H$=z([`auth-required`,`network`]),U$=io(`ok`,[L({ok:B(!0),owners:I(V$)}).loose(),L({ok:B(!1),error:H$}).loose()]),W$=io(`ok`,[L({ok:B(!0),available:F()}).loose(),L({ok:B(!1),error:H$}).loose()]),G$=z([`public`,`private`]);L({owner:N().min(1),name:N().min(1),visibility:G$,description:N().optional()}).loose();var K$=z([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),q$=io(`ok`,[L({ok:B(!0),ownerLogin:N().min(1),repoName:N().min(1),cloneUrl:N().min(1),defaultBranch:N().min(1)}).loose(),L({ok:B(!1),error:K$}).loose()]);function J$(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var Y$=e=>e.refine(J$,`invalid branch name`),X$={shareTargetExists:F(),dirtyConflicts:L({conflicts:F(),files:I(N().min(1))}).loose(),branchIsLocal:F(),shareTargetOnOriginBranch:F().optional()};io(`detached`,[L({detached:B(!1),currentBranch:N().min(1).nullable(),currentHeadSha:Ja(),...X$}).loose(),L({detached:B(!0),currentBranch:Ja(),currentHeadSha:N().min(1),...X$}).loose()]),L({branch:Y$(N().min(1)),principalId:N().optional(),fastForward:F().optional()}).loose();var Z$=z([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);io(`ok`,[L({ok:B(!0)}).loose(),L({ok:B(!1),reason:Z$,files:I(N().min(1)).optional(),otherWorktreePath:N().min(1).optional()}).loose()]),z([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),L({branch:Y$(N().min(1)),path:N(),kind:z([`doc`,`folder`]),contentRootDepth:P().int().min(1).max(65535).optional()}).loose(),io(`verdict`,[L({verdict:B(`on-origin`)}).loose(),L({verdict:B(`renamed`),renamedTo:N().min(1)}).loose(),L({verdict:B(`deleted`)}).loose(),L({verdict:B(`never-on-branch`)}).loose(),L({verdict:B(`changed-locally`)}).loose(),L({verdict:B(`unknown`)}).loose()]).catch({verdict:`unknown`});var Q$=L({startedAt:N().min(1),httpListenMs:P().nonnegative().optional(),seedWalkMs:P().nonnegative().optional(),indexesMs:P().nonnegative().optional(),readyMs:P().nonnegative().optional(),fileCount:P().nonnegative().optional()}),$$=L({serverInstanceId:N().min(1),currentBranch:N().min(1).optional(),currentDiskAckSVs:co(N().min(1),N().min(1)).optional(),boot:Q$.optional()}).loose(),e1=L({id:N().min(1),display_name:N().min(1),display_email:N(),source:z([`git-config`,`synthesized`]),created_at:N().min(1)}).loose();L({collabUrl:N().nullable(),previewUrl:N().nullable(),port:P(),singleFile:F().default(!1)}).loose();var t1=z(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`)),n1=L({type:t1,title:N().min(1),status:P().int().min(400).max(599),instance:N().regex(I$,`instance must be urn:uuid:<uuid>`).optional(),detail:N().optional()}).loose();L({parentDocName:N().min(1),placement:z([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:N().min(1).optional(),agentName:N().min(1).optional()}).loose();var r1=L({src:N().min(1),path:N().min(1).optional(),deduped:F().optional()}).loose();L({url:N().min(1),dir:N().min(1),branch:N().min(1).refine(J$,`invalid branch name`).optional()}).loose(),L({type:B(`error`),problem:n1}).loose();function i1(e){let t=e??(typeof navigator>`u`?void 0:navigator);return t===void 0?[]:t.languages!==void 0&&t.languages.length>0?up(t.languages):t.language===void 0?[]:up([t.language])}var a1={en:`ltr`,"zh-Hans":`ltr`,"zh-Hant":`ltr`,hi:`ltr`,es:`ltr`,ar:`rtl`,fr:`ltr`,bn:`ltr`,"pt-BR":`ltr`,id:`ltr`,ur:`rtl`,ko:`ltr`};function Jre(e){let t=new Intl.Locale(e).getTextInfo?.().direction;return t===`rtl`||t===`ltr`?t:a1[e]}function o1(e,t){let n=t.map(e=>[dp(e),e]);for(let t of e){let e=dp(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function s1(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=o1([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=o1(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}function c1(e){return e.includes("`")?`~`:"`"}function l1(e,t,n=3){let r=RegExp(`^ {0,3}(\\${e}+)[ \\t]*$`),i=Math.max(3,n);for(let e of t.split(`
498
+ `)}function E$(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}var D$=new Set([`opencode.json`]),O$=/^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;function k$(e){return O$.test(e)}function A$(e){return k$(e)?!1:e.split(`/`).some(e=>e.startsWith(`.`))?!0:D$.has(e.slice(e.lastIndexOf(`/`)+1))}function j$(e,t){let n=E$(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var M$=N().superRefine(j$).optional(),N$=N().superRefine(j$),P$={agentId:N().optional(),agentName:N().optional(),colorSeed:N().optional(),clientName:N().optional(),clientVersion:N().optional(),label:N().optional()},F$=N().optional(),I$=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;ao(`kind`,[L({kind:B(`doc`),docPath:N().min(1)}).loose(),L({kind:B(`folder`),folderPath:N()}).loose()]);var L$=z([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),R$=z([`current`,`stale`,`absent`,`empty`]),z$=ao(`ok`,[L({ok:B(!0),shareUrl:N().min(1),sharedUrl:N().min(1),branch:N().min(1),freshness:R$.optional().catch(void 0)}).loose(),L({ok:B(!1),error:L$,branch:N().min(1).optional()}).loose()]),B$=z([`user`,`org`]),V$=L({login:N().min(1),kind:B$,avatarUrl:N().optional()}).loose(),H$=z([`auth-required`,`network`]),U$=ao(`ok`,[L({ok:B(!0),owners:I(V$)}).loose(),L({ok:B(!1),error:H$}).loose()]),W$=ao(`ok`,[L({ok:B(!0),available:F()}).loose(),L({ok:B(!1),error:H$}).loose()]),G$=z([`public`,`private`]);L({owner:N().min(1),name:N().min(1),visibility:G$,description:N().optional()}).loose();var K$=z([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),q$=ao(`ok`,[L({ok:B(!0),ownerLogin:N().min(1),repoName:N().min(1),cloneUrl:N().min(1),defaultBranch:N().min(1)}).loose(),L({ok:B(!1),error:K$}).loose()]);function J$(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var Y$=e=>e.refine(J$,`invalid branch name`),X$={shareTargetExists:F(),dirtyConflicts:L({conflicts:F(),files:I(N().min(1))}).loose(),branchIsLocal:F(),shareTargetOnOriginBranch:F().optional()};ao(`detached`,[L({detached:B(!1),currentBranch:N().min(1).nullable(),currentHeadSha:Ya(),...X$}).loose(),L({detached:B(!0),currentBranch:Ya(),currentHeadSha:N().min(1),...X$}).loose()]),L({branch:Y$(N().min(1)),principalId:N().optional(),fastForward:F().optional()}).loose();var Z$=z([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);ao(`ok`,[L({ok:B(!0)}).loose(),L({ok:B(!1),reason:Z$,files:I(N().min(1)).optional(),otherWorktreePath:N().min(1).optional()}).loose()]),z([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),L({branch:Y$(N().min(1)),path:N(),kind:z([`doc`,`folder`]),contentRootDepth:P().int().min(1).max(65535).optional()}).loose(),ao(`verdict`,[L({verdict:B(`on-origin`)}).loose(),L({verdict:B(`renamed`),renamedTo:N().min(1)}).loose(),L({verdict:B(`deleted`)}).loose(),L({verdict:B(`never-on-branch`)}).loose(),L({verdict:B(`changed-locally`)}).loose(),L({verdict:B(`unknown`)}).loose()]).catch({verdict:`unknown`});var Q$=L({startedAt:N().min(1),httpListenMs:P().nonnegative().optional(),seedWalkMs:P().nonnegative().optional(),indexesMs:P().nonnegative().optional(),readyMs:P().nonnegative().optional(),fileCount:P().nonnegative().optional()}),$$=L({serverInstanceId:N().min(1),currentBranch:N().min(1).optional(),currentDiskAckSVs:lo(N().min(1),N().min(1)).optional(),boot:Q$.optional()}).loose(),e1=L({id:N().min(1),display_name:N().min(1),display_email:N(),source:z([`git-config`,`synthesized`]),created_at:N().min(1)}).loose();L({collabUrl:N().nullable(),previewUrl:N().nullable(),port:P(),singleFile:F().default(!1)}).loose();var t1=z(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`)),n1=L({type:t1,title:N().min(1),status:P().int().min(400).max(599),instance:N().regex(I$,`instance must be urn:uuid:<uuid>`).optional(),detail:N().optional()}).loose();L({parentDocName:N().min(1),placement:z([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:N().min(1).optional(),agentName:N().min(1).optional()}).loose();var r1=L({src:N().min(1),path:N().min(1).optional(),deduped:F().optional()}).loose();L({url:N().min(1),dir:N().min(1),branch:N().min(1).refine(J$,`invalid branch name`).optional()}).loose(),L({type:B(`error`),problem:n1}).loose();function i1(e){let t=e??(typeof navigator>`u`?void 0:navigator);return t===void 0?[]:t.languages!==void 0&&t.languages.length>0?up(t.languages):t.language===void 0?[]:up([t.language])}var Jre={en:`ltr`,"zh-Hans":`ltr`,"zh-Hant":`ltr`,hi:`ltr`,es:`ltr`,ar:`rtl`,fr:`ltr`,bn:`ltr`,"pt-BR":`ltr`,id:`ltr`,ur:`rtl`,ko:`ltr`};function a1(e){let t=new Intl.Locale(e).getTextInfo?.().direction;return t===`rtl`||t===`ltr`?t:Jre[e]}function o1(e,t){let n=t.map(e=>[dp(e),e]);for(let t of e){let e=dp(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function s1(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=o1([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=o1(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}function c1(e){return e.includes("`")?`~`:"`"}function l1(e,t,n=3){let r=RegExp(`^ {0,3}(\\${e}+)[ \\t]*$`),i=Math.max(3,n);for(let e of t.split(`
499
499
  `)){let t=r.exec(e);t&&t[1].length>=i&&(i=t[1].length+1)}return i}function u1(e){return e>=2?e:0}function d1(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,n=t.replace(/^\n+/,``);return n.replace(/\n+$/,``).length===0?{leading:0,trailing:0}:{leading:u1(t.length-n.length),trailing:u1(n.length-n.replace(/\n+$/,``).length-1)}}function f1(e,t){let n={line:e,column:1,offset:t};return{type:`paragraph`,children:[],position:{start:n,end:{...n}}}}function p1(e,t){let n=e.children,r=n.length===0||t.leading===void 0?0:u1(t.leading.length),i=n.length===0||t.trailing===void 0?0:u1(t.trailing.length-1);if(r===0&&i===0)return t;let a=n[n.length-1]?.position?.end,o=[],s=[];if(r>0)for(let e=0;e<r;e++)o.push(f1(1+e,e));if(i>0&&typeof a?.offset==`number`&&typeof a.line==`number`)for(let e=0;e<i;e++)s.push(f1(a.line+1+e,a.offset+1+e));if(o.length===0&&s.length===0||(e.children=[...o,...n,...s],o.length>0&&delete t.leading,s.length>0&&delete t.trailing,t.bom!==void 0||t.leading!==void 0||t.trailing!==void 0))return t;e.data!==void 0&&delete e.data.sourceDocBoundary}var m1=/notionvc:/i,h1=()=>e=>{g1(e)&&(_1(e),v1(e))};function g1(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(m1.test(e))return!0}if(t.type===`element`&&g1(t))return!0}return!1}function _1(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&_1(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
500
500
  `)){t.push(n);continue}let r=e.split(`
501
501
  `);for(let e=0;e<r.length;e++)r[e]&&t.push({type:`text`,value:r[e]??``}),e<r.length-1&&t.push({type:`element`,tagName:`br`,properties:{},children:[]})}e.children=t}function v1(e){if(!(!(`children`in e)||!Array.isArray(e.children))){e.children=e.children.filter(e=>e.type===`comment`?!m1.test(String(e.value??``)):!0);for(let t of e.children)t.type===`element`&&v1(t)}}var y1=new Set([`Apple-tab-span`,`Apple-converted-space`,`Apple-style-span`]),b1=()=>e=>{x1(e)};function x1(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&x1(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return S1(t)?[]:C1(t)?t.children:[t]})}}function S1(e){if(e.tagName!==`meta`)return!1;let t=e.properties?.name,n=e.properties?.content;return t===`Generator`&&typeof n==`string`&&/Cocoa/i.test(n)}function C1(e){if(e.tagName!==`span`)return!1;let t=e.properties?.className;return Array.isArray(t)?t.length>0&&t.every(e=>y1.has(String(e))):!1}var w1=`docs-internal-guid-`;function T1(e,t){let n=e.children[t];!n||n.type!==`element`||e.children.splice(t,1,...n.children)}var E1=()=>e=>{D1(e)};function D1(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&D1(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(!n||n.type!==`element`){t++;continue}let r=n;if(O1(r)||k1(r)){T1(e,t);continue}t++}}function O1(e){if(e.tagName!==`b`)return!1;let t=e.properties?.id;return typeof t==`string`&&t.startsWith(w1)}function k1(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.children.filter(e=>e.type===`element`);return t.length===1?t[0]?.tagName===`table`:!1}var A1=new Set([`commit-link`,`user-mention`,`team-mention`,`issue-link`]),j1=()=>e=>{M1(e)};function M1(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&M1(t);for(let t of e.children)t.type===`element`&&N1(t)}}function N1(e){if(!e.properties)return;for(let t of Object.keys(e.properties))t.startsWith(`dataHovercard`)&&delete e.properties[t];let t=e.properties.className;if(Array.isArray(t)){let n=t.filter(e=>!A1.has(String(e)));n.length===0?delete e.properties.className:e.properties.className=n}}var P1=/^gmail_/,F1=()=>e=>{I1(e)};function I1(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&I1(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(n.type!==`element`){t++;continue}let r=n;if(r.tagName===`div`&&L1(r,`gmail_quote`)&&(r.tagName=`blockquote`),R1(r),z1(r)){e.children.splice(t,1,...r.children);continue}t++}}function L1(e,t){let n=e.properties?.className;return Array.isArray(n)?n.some(e=>String(e)===t):!1}function R1(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!P1.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}function z1(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.properties?.className;return t!=null&&!(Array.isArray(t)&&t.length===0)?!1:e.children.filter(e=>e.type===`element`).length<=1}var B1=()=>e=>{V1(e)};function V1(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&V1(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return t.tagName===`google-sheets-html-origin`?t.children:t.tagName===`style`?[]:(H1(t),[t])})}}function H1(e){if(e.properties)for(let t of Object.keys(e.properties))t.startsWith(`dataSheets`)&&delete e.properties[t]}var U1=[`o:`,`w:`,`m:`,`v:`,`u1:`],W1=/^Mso[A-Z]/,G1=/^\s*\[if\s+[^\]]*\]/,K1=()=>e=>{q1(e)};function q1(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&q1(t);e.children=e.children.flatMap(e=>{if(e.type===`comment`){let t=String(e.value??``);return G1.test(t)?[]:[e]}if(e.type!==`element`)return[e];let t=e;return J1(t)?[]:(Y1(t),[t])})}}function J1(e){return U1.some(t=>e.tagName.startsWith(t))}function Y1(e){let t=e.properties;if(!t)return;let n=t.className;if(Array.isArray(n)){let e=n.filter(e=>typeof e==`string`&&!W1.test(e));e.length===0?delete t.className:t.className=e}else typeof n==`string`&&W1.test(n)&&delete t.className;let r=t.style;typeof r==`string`&&/mso-/i.test(r)&&delete t.style;for(let e of Object.keys(t))if(e.startsWith(`xmlns:`)){let n=e.slice(6);U1.some(e=>e===`${n}:`)&&delete t[e]}}var X1=/^c-(message_kit__|message__|compose|timestamp)/,Z1=()=>e=>{Q1(e)};function Q1(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&Q1(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return $1(t)?[]:(e0(t),[t])})}}function $1(e){let t=e.properties?.className;return Array.isArray(t)?t.some(e=>String(e)===`c-timestamp`||String(e).startsWith(`c-timestamp`)):!1}function e0(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!X1.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}var t0=()=>e=>{n0(e)};function n0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&n0(t);for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`element`)continue;let r=n;r0(r)&&(e.children[t]=a0(r))}}}function r0(e){if(e.tagName!==`div`)return!1;let t=e.children.filter(e=>e.type===`element`&&e.tagName===`div`);return t.length<2?!1:t.some(e=>i0(e))}function i0(e){for(let t of e.children){if(t.type!==`element`)continue;let e=t,n=e.properties?.style;if(typeof n==`string`&&/color\s*:/i.test(n)||i0(e))return!0}return!1}function a0(e){return{type:`element`,tagName:`pre`,properties:{},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:e.children.filter(e=>e.type===`element`&&e.tagName===`div`).map(e=>o0(e)).join(`
@@ -565,11 +565,11 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
565
565
  `;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=[],s=e.children??[];for(let e of s){let t=e.children??[],i=[],s=[];for(let e of t){let t=n.enter(`tableCell`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:` `,after:` `});a(),t(),i.push(o);let c=e.data?.sourcePadding;s.push(c&&typeof c.left==`number`&&typeof c.right==`number`?{left:c.left,right:c.right}:null)}a.push(i),o.push(s)}i();let c=e.align??[],l=e.data?.sourceDashCounts,u=a[0]?.length??0,d=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),f=Math.max(u,d,c.length);if(f===0)return console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:s.length})),``;let p=[];for(let e=0;e<f;e++){let t=c[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=l?.[e],a=typeof i==`number`&&i>=1?i:1;p.push(n+`-`.repeat(a)+r)}let m=(e,t)=>{let n=[];for(let r=0;r<f;r++){let i=e[r]??``,a=t[r]??{left:1,right:1};n.push(` `.repeat(a.left)+i+` `.repeat(a.right))}let r=v&&!v.leading?``:`|`,i=v&&!v.trailing?``:`|`;return`${r}${n.join(`|`)}${i}`},h=e.data?.sourceAlignmentPadding,g=Array.from({length:f},(e,t)=>{let n=h?.[t];return n&&typeof n.left==`number`&&typeof n.right==`number`?n:null}),_=e.data?.sourceOuterPipes,v=_&&f>=2&&a.every(e=>{let t=(e[0]??``).trim(),n=(e[f-1]??``).trim();return(_.leading||t.length>0)&&(_.trailing||n.length>0&&!n.endsWith(`\\`))})?_:null;if(a.length===0)return m(p,g);let y=[];y.push(m(a[0],o[0]??[])),y.push(m(p,g));for(let e=1;e<a.length;e++)y.push(m(a[e],o[e]??[]));return y.join(`
566
566
  `)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=q8(i.attributes??[]);return!i.children||i.children.length===0?s?c?`<${s} ${c} />`:`<${s} />`:``:cae({...i,attributes:(i.attributes??[]).map(dae)},t,n,r)},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=n5(n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),r,`==`),o+=i.move(`==`),a(),o},underline(e,t,n,r){let i=e.data?.sourceForm===`ins`?`<ins>`:`<u>`,a=e.data?.sourceForm===`ins`?`</ins>`:`</u>`,o=n.createTracker(r),s=n.enter(`underline`),c=o.move(i);return c+=n.containerPhrasing(e,{before:c,after:a,...o.current()}),c+=o.move(a),s(),c},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=q8(e.attributes??[]),i=(e.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return i?r?`<${n} ${r}>${i}</${n}>`:`<${n}>${i}</${n}>`:r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>{if(n)return`>`;let r=c++,i=s?.[r];return i===`lazy`&&r>0&&!lae.test(e)?e:i===`none`||i===0?`>${e}`:typeof i==`number`&&i>=2&&!e.startsWith(` `)?`>${` `.repeat(i)}${e}`:`> ${e}`})}};function q8(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){n.value.includes(`"`)?t.push(`${e}={${J8(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function J8(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function dae(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:J8(e.value)}}:e}function Y8(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function X8(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function fae(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>pae(t)?e:`\\${e}`)}function pae(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32||t===160}var Z8=``,mae=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function hae(e){return e.replace(mae,e=>RZ(e)?Z8+e.slice(1):e)}function gae(e){return/[\r\n][\t ]*$/.test(e)}function Q8(e,t,n){let{matched:r}=t3(t,{escapeAware:!1});if(r.length===0)return $8(e,t,n);let i=``,a=0,o=r=>{r>a&&(i+=$8(e,t.slice(a,r),{...n,before:n.before+i,after:t.slice(r,r+1)||n.after})),a=r};for(let e of r)o(e.start),!gae(n.before+i)&&(i+=t.slice(e.start,e.end),a=e.end);return o(t.length),i}function $8(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character===`!`&&e.after===`\\[`&&e.inConstruct===`phrasing`||e.character===`@`&&e.before===`[+\\-.\\w]`||e.character===`{`&&Array.isArray(e.inConstruct)&&e.inConstruct.includes(`phrasing`)||e.character==="`"||(e.character===`*`||e.character===`_`||e.character===`~`)&&e.inConstruct===`phrasing`||e.character===`=`&&e.atBreak===!0||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`)),e.unsafe=e.unsafe.map(e=>{if(e.character!==`)`||e.atBreak!==!0||e.before!==`\\d+`||e.after!==void 0)return e;let t={...e,after:`(?:[ \r
567
567
  ]|$)`};return delete t._compiled,t});let i;try{i=e.safe(hae(t),n)}finally{e.unsafe=r}return i=i.replaceAll(Z8,`\\&`),fae(bae(i,n))}var e5=1,_ae=2;function t5(e){if(Number.isNaN(e))return`ws`;let t=f(e);return t===e5?`ws`:t===_ae?`punct`:`other`}function vae(e,t,n){let r=t5(t),i=t5(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function yae(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
568
- `||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function bae(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&yae(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=vae(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function n5(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);r5(i.charCodeAt(i.length-1),s,r)&&(o=i5(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return r5(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+i5(c)),o}function r5(e,t,n){return!(f(t)!==e5||n===`_`&&f(e)===void 0)}function i5(e){return`&#x${e.toString(16).toUpperCase()};`}function xae(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!Cae(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function Sae(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=n5(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function Cae(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function a5(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var wae=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=Ew(e.extensions),this.handlers=kae(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?Y0({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=Aae(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=Xie({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=Zie({toMarkdownHandlers:uae})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return $ie(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?eae(e,this.parseProcessor):{type:`root`,children:[]}}parseToEditorMdast(e){return e.trim()?tae(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?m4(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return nae(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}},o5=U2();function s5(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function Tae(e){let t=!1;return e.descendants(e=>t?!1:e.type.name===`jsxInline`?(e.attrs.sourceDirty&&(t=!0),!1):e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function Eae(e,t){return e.attrs.sourceDirty||Tae(e)?!0:t?t.isDiverged(e.toJSON()):!1}function Dae(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function c5(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function l5(e,t){if(e.length===0)return c5({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return c5({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[l5(n.children,t)]}}return c5({type:`inlineCode`,value:u5(e)},t)}function u5(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=u5(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}var Oae=Gu;function kae(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=_P(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=_P(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=K8(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&VZ(t.raw)!==null&&RZ(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=VZ(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=vP(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=vP(r.highlight)),r.underline&&(i.underline=vP(r.underline,e=>({sourceForm:e.data?.sourceForm===`ins`?`ins`:`u`}))),r.comment&&(i.comment=vP(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=_P(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=vP(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=vP(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=_P(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceUnclosedFence:t.data?.sourceUnclosedFence??!1,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=_P(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=_P(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.data?.resolvedUrl??``,title:n.data?.resolvedTitle??null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=o5.getOrWildcard(o),c=s5(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=K8(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}let i=t.name??``,o=i?o5.get(i):void 0;if(o&&n.jsxInline){let e=s5(t.attributes,o.props),a=r(t.data)??``,s=(t.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return s&&(e.children=s),n.jsxInline.createAndFill({componentName:i,attributes:t.attributes,sourceRaw:a,sourceDirty:!1,props:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=aQ(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&Oae.has(l)&&n.jsxComponent&&o5.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&Ku.has(l)&&n.jsxComponent&&o5.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Ju.has(l)&&n.jsxComponent&&o5.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Yu.has(l)&&n.jsxComponent&&o5.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:a5(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=_P(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function Aae(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=CP(`paragraph`)),i.blockquote&&(n.blockquote=CP(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=CP(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceUnclosedFence:e.attrs.sourceUnclosedFence===!0?!0:void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=CP(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&Dae(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=CP(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:d0(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!Eae(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:o5.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:o5,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.componentName||``;if(t&&e.attrs.sourceDirty)return e2(t,e,o5.get(t)?.props);let n=e.attrs.attributes,r=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:t||null,attributes:Array.isArray(n)?n:[],children:[],data:{sourceRaw:String(r)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=wP(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=wP(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return l5(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=wP(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=wP(`mark`)),a.underline&&(r.underline=wP(`underline`,e=>({data:{sourceForm:e.attrs.sourceForm===`ins`?`ins`:`u`}}))),a.comment&&(r.comment=wP(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=CP(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=CP(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return UZ(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}var d5={default:!0,MD013:!1};function f5(e){return e??d5}function p5(e){let t=e.replace(/\\/g,`/`);for(;t.startsWith(`./`);)t=t.slice(2);let n=t.toLowerCase();for(let e of CX)if(n.endsWith(e))return t.slice(0,-e.length);return t}function m5(e){let t=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),n=[],r=[],i=[],a=[],o=0;for(let e of t){let t=e.startsWith(`!`),s=t?e.slice(1):e;if(t||(o+=1),s.length===0){n.push({pattern:e,detail:`empty pattern`});continue}try{let e=(0,fV.default)(s,{dot:!0,strictBrackets:!0});(t?a:i).push(e)}catch(t){n.push({pattern:e,detail:t instanceof Error?t.message:String(t)});continue}if(s.endsWith(`/`))r.push({pattern:e,reason:`trailing-slash`});else if(s.startsWith(`/`))r.push({pattern:e,reason:`leading-slash`});else{let t=s.toLowerCase();CX.some(e=>t.endsWith(e))&&r.push({pattern:e,reason:`doc-extension`})}}let s=o===0;return{invalidPatterns:n,suspiciousPatterns:r,matches(e){if(e===void 0||e===``)return!1;let t=p5(e);return t===``||!(s||i.some(e=>e(t)))?!1:!a.some(e=>e(t))}}}function jae(e,t){if(t.length===0)return[];let n=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),r=t.map(p5).filter(e=>e!==``),i=[];for(let e of n){let t=e.startsWith(`!`)?e.slice(1):e;if(t.length===0)continue;let n;try{n=(0,fV.default)(t,{dot:!0,strictBrackets:!0})}catch{continue}r.some(e=>n(e))||i.push(e)}return i}var h5=/[*?[\]{}()+@!|]/;function Mae(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);if(n===-1||e.indexOf(`{`,t+1)!==-1||e.indexOf(`}`,n+1)!==-1)return null;let r=e.slice(t+1,n).split(`,`);return r.length<2||r.some(e=>e.trim()===``||h5.test(e))?null:r.map(r=>e.slice(0,t)+r+e.slice(n+1))}function g5(e){if(e.endsWith(`/`)||e.startsWith(`/`))return{kind:`matches-nothing`,pattern:e};try{(0,fV.default)(e,{dot:!0,strictBrackets:!0})}catch{return{kind:`invalid`,pattern:e}}if(e===`**`||e===`**/*`)return{kind:`everything`};{let t=e.match(/^\*\*\/(.+)\/\*\*$/)?.[1];if(t!==void 0&&!h5.test(t))return{kind:`folder-anywhere`,folder:t};let n=e.match(/^(.+)\/\*\*\/(.+)\/\*\*$/),r=n?.[1],i=n?.[2];if(r!==void 0&&i!==void 0&&!h5.test(r)&&!h5.test(i))return{kind:`folder-recursive-nested`,root:r,folder:i}}for(let t of[`/**/*`,`/**`])if(e.endsWith(t)){let n=e.slice(0,-t.length);if(n.length>0&&!h5.test(n))return{kind:`folder-recursive`,folder:n}}if(e.endsWith(`/*`)){let t=e.slice(0,-2);if(t.length>0&&!h5.test(t))return{kind:`folder-direct`,folder:t}}if(e.startsWith(`**/`)){let t=e.slice(3);if(t.length>0&&!t.includes(`/`)&&!h5.test(t))return{kind:`name-anywhere`,name:t}}return h5.test(e)?{kind:`pattern`,pattern:e}:{kind:`exact`,target:e}}function Nae(e){let t=g5(e);if(t.kind!==`pattern`)return[t];let n=Mae(e);if(n!==null){let e=n.map(g5);if(e.every(e=>e.kind!==`pattern`))return e}return[t]}function Pae(e){let t=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),n=[],r=[];for(let e of t){let t=e.startsWith(`!`),i=t?e.slice(1):e;i.length!==0&&(t?r:n).push(...Nae(i))}return{includes:n,excludes:r}}function _5(e,t){let n=new Set,r=[];for(let i of e){if(i.enabled===!1||!i.schema||!m5(i.appliesTo).matches(t))continue;let e=i.key??i.file;n.has(e)||(n.add(e),r.push({file:i.file,schema:i.schema}))}return r}var v5={"draft-06":`http://json-schema.org/draft-06/schema#`,"draft-07":`http://json-schema.org/draft-07/schema#`,"2019-09":`https://json-schema.org/draft/2019-09/schema`,"2020-12":`https://json-schema.org/draft/2020-12/schema`},Fae=Object.keys(v5),Iae=`draft-07`,Lae=new Map(Fae.map(e=>[y5(v5[e]),e]));function y5(e){return e.replace(/^https?:\/\//,``).replace(/#$/,``)}function Rae(e){let t=e.$schema;return t===void 0?Iae:typeof t==`string`?Lae.get(y5(t))??null:null}var b5=new Map;function zae(e){throw Error(`Unhandled FrontmatterSchemaDialect: ${JSON.stringify(e)}`)}function Bae(e){let t=b5.get(e);if(t)return t;let n={allErrors:!0,strict:!1},r;switch(e){case`2020-12`:r=new uV.default(n);break;case`2019-09`:r=new lV.default(n);break;case`draft-06`:case`draft-07`:r=new cV.default(n);break;default:return zae(e)}return(0,dV.default)(r),b5.set(e,r),r}function Vae(e){let{$schema:t,...n}=e;return n}function Hae(e,t){let n=Bae(e),r=t.$id;return typeof r==`string`&&r!==``&&n.removeSchema(r),n.compile(Vae(t))}var x5=new Map,Uae=256;function Wae(e){let t=JSON.stringify(e),n=x5.get(t);if(n!==void 0)return n;let r=null,i=Rae(e);if(i!==null)try{r=Hae(i,e)}catch{r=null}return x5.size>=Uae&&x5.clear(),x5.set(t,r),r}function Gae(e){let t=new Map;if(!am.test(e))return{data:{},keyLines:t};let{frontmatter:n}=sm(e),r=lm(n);if(r.trim()===``)return{data:{},keyLines:t};let i=_u(r,{uniqueKeys:!1});if(i.errors.length>0)return{data:{},keyLines:t};let a=i.toJS();if(typeof a!=`object`||!a||Array.isArray(a))return{data:{},keyLines:t};if(Xo(i.contents))for(let e of i.contents.items){let n=e.key;if(!Qo(n)||typeof n.value!=`string`||!n.range)continue;let i=0,a=Math.min(n.range[0],r.length);for(let e=0;e<a;e++)r.charCodeAt(e)===10&&i++;t.has(n.value)||t.set(n.value,i+1)}return{data:a,keyLines:t}}function Kae(e){if(e===void 0)return``;let t;if(typeof e==`string`)t=`"${e}"`;else try{t=JSON.stringify(e)??String(e)}catch{t=String(e)}return t.length>60&&(t=`${t.slice(0,57)}…`),` (got ${t})`}function qae(e){if(!e.startsWith(`/`))return null;let t=e.slice(1).split(`/`)[0]??``;return t===``?null:t.replace(/~1/g,`/`).replace(/~0/g,`~`)}function Jae(e){return e.split(`/`).slice(1).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)).join(`.`)}function S5(e,t,n){if(t.length===0)return[];let r=n?.source??`frontmatter`,{data:i,keyLines:a}=Gae(e),o=e.split(`
568
+ `||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function bae(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&yae(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=vae(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function n5(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);r5(i.charCodeAt(i.length-1),s,r)&&(o=i5(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return r5(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+i5(c)),o}function r5(e,t,n){return!(f(t)!==e5||n===`_`&&f(e)===void 0)}function i5(e){return`&#x${e.toString(16).toUpperCase()};`}function xae(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!Cae(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function Sae(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=n5(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function Cae(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function a5(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var wae=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=Ew(e.extensions),this.handlers=kae(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?Y0({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=Aae(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=Xie({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=Zie({toMarkdownHandlers:uae})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return $ie(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?eae(e,this.parseProcessor):{type:`root`,children:[]}}parseToEditorMdast(e){return e.trim()?tae(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?m4(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return nae(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}},o5=U2();function s5(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function Tae(e){let t=!1;return e.descendants(e=>t?!1:e.type.name===`jsxInline`?(e.attrs.sourceDirty&&(t=!0),!1):e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function Eae(e,t){return e.attrs.sourceDirty||Tae(e)?!0:t?t.isDiverged(e.toJSON()):!1}function Dae(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function c5(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function l5(e,t){if(e.length===0)return c5({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return c5({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[l5(n.children,t)]}}return c5({type:`inlineCode`,value:u5(e)},t)}function u5(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=u5(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}var Oae=Gu;function kae(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=_P(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=_P(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=K8(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&VZ(t.raw)!==null&&RZ(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=VZ(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=vP(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=vP(r.highlight)),r.underline&&(i.underline=vP(r.underline,e=>({sourceForm:e.data?.sourceForm===`ins`?`ins`:`u`}))),r.comment&&(i.comment=vP(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=_P(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=vP(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=vP(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=_P(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceUnclosedFence:t.data?.sourceUnclosedFence??!1,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=_P(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=_P(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.data?.resolvedUrl??``,title:n.data?.resolvedTitle??null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=o5.getOrWildcard(o),c=s5(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=K8(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}let i=t.name??``,o=i?o5.get(i):void 0;if(o&&n.jsxInline){let e=s5(t.attributes,o.props),a=r(t.data)??``,s=(t.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return s&&(e.children=s),n.jsxInline.createAndFill({componentName:i,attributes:t.attributes,sourceRaw:a,sourceDirty:!1,props:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=aQ(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&Oae.has(l)&&n.jsxComponent&&o5.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&Ku.has(l)&&n.jsxComponent&&o5.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Ju.has(l)&&n.jsxComponent&&o5.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Yu.has(l)&&n.jsxComponent&&o5.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:a5(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=_P(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function Aae(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=CP(`paragraph`)),i.blockquote&&(n.blockquote=CP(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=CP(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceUnclosedFence:e.attrs.sourceUnclosedFence===!0?!0:void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=CP(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&Dae(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=CP(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:d0(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!Eae(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:o5.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:o5,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.componentName||``;if(t&&e.attrs.sourceDirty)return e2(t,e,o5.get(t)?.props);let n=e.attrs.attributes,r=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:t||null,attributes:Array.isArray(n)?n:[],children:[],data:{sourceRaw:String(r)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=wP(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=wP(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return l5(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=wP(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=wP(`mark`)),a.underline&&(r.underline=wP(`underline`,e=>({data:{sourceForm:e.attrs.sourceForm===`ins`?`ins`:`u`}}))),a.comment&&(r.comment=wP(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=CP(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=CP(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return UZ(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}var d5={default:!0,MD013:!1};function f5(e){return e??d5}function p5(e){let t=e.replace(/\\/g,`/`);for(;t.startsWith(`./`);)t=t.slice(2);let n=t.toLowerCase();for(let e of CX)if(n.endsWith(e))return t.slice(0,-e.length);return t}function m5(e){let t=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),n=[],r=[],i=[],a=[],o=0;for(let e of t){let t=e.startsWith(`!`),s=t?e.slice(1):e;if(t||(o+=1),s.length===0){n.push({pattern:e,detail:`empty pattern`});continue}try{let e=(0,fV.default)(s,{dot:!0,strictBrackets:!0});(t?a:i).push(e)}catch(t){n.push({pattern:e,detail:t instanceof Error?t.message:String(t)});continue}if(s.endsWith(`/`))r.push({pattern:e,reason:`trailing-slash`});else if(s.startsWith(`/`))r.push({pattern:e,reason:`leading-slash`});else{let t=s.toLowerCase();CX.some(e=>t.endsWith(e))&&r.push({pattern:e,reason:`doc-extension`})}}let s=o===0;return{invalidPatterns:n,suspiciousPatterns:r,matches(e){if(e===void 0||e===``)return!1;let t=p5(e);return t===``||!(s||i.some(e=>e(t)))?!1:!a.some(e=>e(t))}}}function jae(e,t){if(t.length===0)return[];let n=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),r=t.map(p5).filter(e=>e!==``),i=[];for(let e of n){let t=e.startsWith(`!`)?e.slice(1):e;if(t.length===0)continue;let n;try{n=(0,fV.default)(t,{dot:!0,strictBrackets:!0})}catch{continue}r.some(e=>n(e))||i.push(e)}return i}var h5=/[*?[\]{}()+@!|]/;function Mae(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);if(n===-1||e.indexOf(`{`,t+1)!==-1||e.indexOf(`}`,n+1)!==-1)return null;let r=e.slice(t+1,n).split(`,`);return r.length<2||r.some(e=>e.trim()===``||h5.test(e))?null:r.map(r=>e.slice(0,t)+r+e.slice(n+1))}function g5(e){if(e.endsWith(`/`)||e.startsWith(`/`))return{kind:`matches-nothing`,pattern:e};try{(0,fV.default)(e,{dot:!0,strictBrackets:!0})}catch{return{kind:`invalid`,pattern:e}}if(e===`**`||e===`**/*`)return{kind:`everything`};{let t=e.match(/^\*\*\/(.+)\/\*\*$/)?.[1];if(t!==void 0&&!h5.test(t))return{kind:`folder-anywhere`,folder:t};let n=e.match(/^(.+)\/\*\*\/(.+)\/\*\*$/),r=n?.[1],i=n?.[2];if(r!==void 0&&i!==void 0&&!h5.test(r)&&!h5.test(i))return{kind:`folder-recursive-nested`,root:r,folder:i}}for(let t of[`/**/*`,`/**`])if(e.endsWith(t)){let n=e.slice(0,-t.length);if(n.length>0&&!h5.test(n))return{kind:`folder-recursive`,folder:n}}if(e.endsWith(`/*`)){let t=e.slice(0,-2);if(t.length>0&&!h5.test(t))return{kind:`folder-direct`,folder:t}}if(e.startsWith(`**/`)){let t=e.slice(3);if(t.length>0&&!t.includes(`/`)&&!h5.test(t))return{kind:`name-anywhere`,name:t}}return h5.test(e)?{kind:`pattern`,pattern:e}:{kind:`exact`,target:e}}function Nae(e){let t=g5(e);if(t.kind!==`pattern`)return[t];let n=Mae(e);if(n!==null){let e=n.map(g5);if(e.every(e=>e.kind!==`pattern`))return e}return[t]}function Pae(e){let t=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),n=[],r=[];for(let e of t){let t=e.startsWith(`!`),i=t?e.slice(1):e;i.length!==0&&(t?r:n).push(...Nae(i))}return{includes:n,excludes:r}}function _5(e,t){let n=new Set,r=[];for(let i of e){if(i.enabled===!1||!i.schema||!m5(i.appliesTo).matches(t))continue;let e=i.key??i.file;n.has(e)||(n.add(e),r.push({file:i.file,schema:i.schema}))}return r}var v5={"draft-06":`http://json-schema.org/draft-06/schema#`,"draft-07":`http://json-schema.org/draft-07/schema#`,"2019-09":`https://json-schema.org/draft/2019-09/schema`,"2020-12":`https://json-schema.org/draft/2020-12/schema`},Fae=Object.keys(v5),Iae=`draft-07`,Lae=new Map(Fae.map(e=>[y5(v5[e]),e]));function y5(e){return e.replace(/^https?:\/\//,``).replace(/#$/,``)}function Rae(e){let t=e.$schema;return t===void 0?Iae:typeof t==`string`?Lae.get(y5(t))??null:null}var b5=new Map;function zae(e){throw Error(`Unhandled FrontmatterSchemaDialect: ${JSON.stringify(e)}`)}function Bae(e){let t=b5.get(e);if(t)return t;let n={allErrors:!0,strict:!1},r;switch(e){case`2020-12`:r=new uV.default(n);break;case`2019-09`:r=new lV.default(n);break;case`draft-06`:case`draft-07`:r=new cV.default(n);break;default:return zae(e)}return(0,dV.default)(r),b5.set(e,r),r}function Vae(e){let{$schema:t,...n}=e;return n}function Hae(e,t){let n=Bae(e),r=t.$id;return typeof r==`string`&&r!==``&&n.removeSchema(r),n.compile(Vae(t))}var x5=new Map,Uae=256;function Wae(e){let t=JSON.stringify(e),n=x5.get(t);if(n!==void 0)return n;let r=null,i=Rae(e);if(i!==null)try{r=Hae(i,e)}catch{r=null}return x5.size>=Uae&&x5.clear(),x5.set(t,r),r}function Gae(e){let t=new Map;if(!am.test(e))return{data:{},keyLines:t};let{frontmatter:n}=sm(e),r=lm(n);if(r.trim()===``)return{data:{},keyLines:t};let i=_u(r,{uniqueKeys:!1});if(i.errors.length>0)return{data:{},keyLines:t};let a=i.toJS();if(typeof a!=`object`||!a||Array.isArray(a))return{data:{},keyLines:t};if(Zo(i.contents))for(let e of i.contents.items){let n=e.key;if(!$o(n)||typeof n.value!=`string`||!n.range)continue;let i=0,a=Math.min(n.range[0],r.length);for(let e=0;e<a;e++)r.charCodeAt(e)===10&&i++;t.has(n.value)||t.set(n.value,i+1)}return{data:a,keyLines:t}}function Kae(e){if(e===void 0)return``;let t;if(typeof e==`string`)t=`"${e}"`;else try{t=JSON.stringify(e)??String(e)}catch{t=String(e)}return t.length>60&&(t=`${t.slice(0,57)}…`),` (got ${t})`}function qae(e){if(!e.startsWith(`/`))return null;let t=e.slice(1).split(`/`)[0]??``;return t===``?null:t.replace(/~1/g,`/`).replace(/~0/g,`~`)}function Jae(e){return e.split(`/`).slice(1).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)).join(`.`)}function S5(e,t,n){if(t.length===0)return[];let r=n?.source??`frontmatter`,{data:i,keyLines:a}=Gae(e),o=e.split(`
569
569
  `),s=e=>({start:{line:e,character:0},end:{line:e,character:o[e]?.length??0}}),c=[];for(let{schema:e,ruleId:n}of t){let t=Wae(e);if(t&&!t(i))for(let e of t.errors??[]){let t=e.keyword;if(t===`if`)continue;let o=0,l,u=`invalid`,d;if(t===`maxProperties`&&e.instancePath===``)l=`This document must not have frontmatter`;else if(t===`required`&&e.instancePath===``){let t=String(e.params.missingProperty??``);l=`Frontmatter property "${t}" is required`,u=`missing`,t!==``&&(d=t)}else if(e.instancePath===``)l=`Frontmatter ${e.message??`violates "${t}"`}`;else{let n=qae(e.instancePath);n!==null&&(o=a.get(n)??0);let r=Jae(e.instancePath);if(t===`enum`){let t=e.params.allowedValues??[],a=n!==null&&r===n?i[n]:void 0;l=`Frontmatter property "${r}" must be one of: ${t.map(String).join(`, `)}${Kae(a)}`}else l=`Frontmatter property "${r}" ${e.message??`violates "${t}"`}`}c.push({range:s(o),severity:`warning`,source:r,code:n??t,message:l,frontmatterScope:u,...d===void 0?{}:{frontmatterProperty:d}})}}return c}var C5=`doc`;function Yae(e,t){return aG(e,nG({strings:{[C5]:e},config:t})[C5]??[])}function Xae(e,t){let n=nG({strings:{[C5]:e},config:t})[C5]??[],r=e.split(`
570
570
  `),i=Zae(t);return n.map(e=>$ae(e,r,Qae(e,i)))}function Zae(e){let t=new Map;return Object.entries(e).forEach(([e,n],r)=>{let i=e.toUpperCase();if(i===`DEFAULT`)return;let a=null;if(n===`error`||n===`warning`)a=n;else if(typeof n==`object`&&n&&!Array.isArray(n)){let e=n.severity;(e===`error`||e===`warning`)&&(a=e)}a!==null&&t.set(i,{entryIndex:r,severity:a})}),t}function Qae(e,t){let n;for(let r of e.ruleNames){let e=t.get(r.toUpperCase());e!==void 0&&(n===void 0||e.entryIndex>n.entryIndex)&&(n=e)}return n?.severity??`warning`}function $ae(e,t,n){let[r,i]=e.errorRange??[1,null],a=e.lineNumber-1,o=(r??1)-1,s=t[a]?.length??0,c=i==null?s:Math.min(o+i,s),l=e.fixInfo?[eoe(e.fixInfo,e.lineNumber,t)]:void 0;return{range:{start:{line:a,character:o},end:{line:a,character:Math.max(c,o)}},severity:n,source:`markdownlint`,code:e.ruleNames[0]??`MD000`,message:e.errorDetail?`${e.ruleDescription}: ${e.errorDetail}`:e.ruleDescription,...l?{fixes:l}:{}}}function eoe(e,t,n){let r=e.lineNumber??t,i=r-1;if(e.deleteCount===-1){if(r<n.length)return{range:{start:{line:i,character:0},end:{line:i+1,character:0}},newText:``};if(i>0){let e=n[i-1]?.length??0;return{range:{start:{line:i-1,character:e},end:{line:i,character:n[i]?.length??0}},newText:``}}return{range:{start:{line:0,character:0},end:{line:0,character:n[0]?.length??0}},newText:``}}let a=(e.editColumn??1)-1;return{range:{start:{line:i,character:a},end:{line:i,character:a+Math.max(0,e.deleteCount??0)}},newText:e.insertText??``}}var toe=[`no-wiki-links`,`log-shape`,`index-shape`,`reserved-casing`,`frontmatter-required`,`frontmatter-recommended`,`frontmatter-provenance`,`frontmatter-computation`,`frontmatter-reserved-index`,`frontmatter-root-index`,`project-no-mdx`];function w5(e,t){return e?.[t]!==!1}var noe=[{id:`structure`,ids:[`no-wiki-links`,`log-shape`,`index-shape`,`reserved-casing`]},{id:`frontmatter`,ids:[`frontmatter-required`,`frontmatter-recommended`,`frontmatter-provenance`,`frontmatter-computation`,`frontmatter-reserved-index`,`frontmatter-root-index`]},{id:`project`,ids:[`project-no-mdx`]}];function roe(e){throw Error(`Unhandled OkfRuleId variant: ${JSON.stringify(e)}`)}function ioe(e){throw Error(`Unhandled OkfRuleGroupId variant: ${JSON.stringify(e)}`)}var aoe=`.ok/okf`;function ooe(e){return`${e.replace(/^frontmatter-/,``)}.schema.json`}function soe(e){return`${aoe}/${ooe(e)}`}var coe={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — required frontmatter`,description:"The OKF v0.2 conformance floor. A bundle is conformant when every non-reserved .md file contains a parseable YAML frontmatter block whose `type` is non-empty. This schema is the whole of that floor: a concept carrying only `type` is fully conformant. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md#11-conformance",type:`object`,required:[`type`],properties:{type:{type:`string`,pattern:`\\S`,description:"REQUIRED, and the only always-required key in OKF. A short string identifying the kind of concept; consumers use it for routing, filtering, and presentation. Type values are not registered centrally — pick something descriptive and self-explanatory (`BigQuery Table`, `BigQuery Dataset`, `API Endpoint`, `Metric`, `Playbook`, `Reference`, `Attested Computation`). Consumers must tolerate unknown types, typically by treating them as generic concepts. The `\\S` pattern is what makes §11 rule 2 mean what it says, and it replaces a `minLength` rather than joining one: a length check alone accepts a whitespace-only value that no consumer can route on, and having both would report one mistake twice. OKF v0.2 §4.1, §11."}}},loe={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — recommended frontmatter`,description:"Shapes for the OKF v0.2 recommended keys. Every key here is optional, and nothing is constrained beyond the shape OKF states: declaring a key pins its YAML type when present (so `tags` written as a comma-separated string warns) and advertises it to agents at read time. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md#41-frontmatter",type:`object`,properties:{title:{type:`string`,description:`Human-readable display name. If omitted, consumers MAY derive a title from the filename. OKF v0.2 §4.1.`},description:{type:`string`,description:"A single sentence summarizing the concept. Used by `index.md` generators, search snippets, and previews. OKF v0.2 §4.1."},resource:{type:`string`,format:`uri-reference`,description:"A URI that uniquely identifies the underlying asset the concept describes. Absent for concepts that describe abstract ideas rather than physical resources. Path-valued: an absolute URL, a bundle-relative path beginning with `/`, or an ordinary relative path — hence `uri-reference`, not `uri`, which would reject `/tables/customers.md`. OKF v0.2 §4.1, §6.2."},tags:{type:`array`,items:{type:`string`},description:`A YAML list of short strings for cross-cutting categorization. Tags stay a first-class concept through this field; OKF specifies no separate per-tag file format, so a consumer that wants a tag-browsing view synthesizes one by scanning frontmatter. OKF v0.2 §3.1, §4.1.`},timestamp:{description:"LEGACY (OKF v0.1), superseded by `generated.at` in v0.2 — one of the two deliberate breaking changes. Consumers MAY fall back to it when `generated` is absent; new documents SHOULD write `generated: { by, at }` instead. Documented here so agents are told what it is and what replaced it, but deliberately left unconstrained: v0.2 does not define it as a producer field, so validating its shape would be a rule OKF no longer has. OKF v0.2 §5.2, §13.1."}}},uoe={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — provenance, trust, and lifecycle frontmatter`,description:'The optional OKF v0.2 families that make "where did this come from", "how much should I trust it", and "is it still current" answerable from frontmatter alone. Every key is optional, and absence carries meaning rather than being an error: a concept with no `verified` is unverified, and a consumer must not reject it. Only `sources[].resource` and `generated.by` are required-when-their-parent-is-present, because those are the two fields OKF marks REQUIRED in this family; every other field is described but not mandated, so nothing else is enforced. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md#5-provenance-trust-and-lifecycle',type:`object`,properties:{sources:{type:`array`,description:"The materials this concept derives from, external or internal to the bundle. Lineage is expressed through links rather than a dedicated field: when an entry's `resource` points at another OKF concept, the derivation edge already exists in the bundle graph, so a consumer may recurse into that source's own `sources`. OKF v0.2 §5.1.",items:{type:`object`,required:[`resource`],properties:{resource:{type:`string`,description:"REQUIRED within an entry. Either a concrete artifact a consumer can follow (an absolute URL, a bundle-relative path, or a path into a `references/` subdirectory) or a population or scope descriptor it cannot, for example `all queries in BigQuery project X`. Deliberately NOT format-constrained: a scope descriptor is prose, so a `uri-reference` check here would warn on conformant documents. OKF v0.2 §5.1, §6.2, §6.3."},id:{type:`string`,description:"Optional. A stable key used to attribute individual claims: a markdown footnote whose label is this id (`[^ga4-schema]`) attributes the claim it follows. SHOULD be present when the body cites the source. Keyed rather than positional because agents constantly rewrite these documents — a positional index misattributes silently the moment the list is reordered. OKF v0.2 §5.1."},title:{type:`string`,description:`Optional. Human-readable label for the source. OKF v0.2 §5.1.`},author:{type:`string`,description:"Optional credibility signal — an authority signal: who or what produced the source. OKF describes this as following the actor convention (§7), but its own examples use a `team:<id>` prefix that the three §7 forms do not cover, so no pattern is enforced. OKF v0.2 §5.1, §7."},usage_count:{type:`integer`,description:"Optional credibility signal — an adoption and liveness signal: how often `resource` was exercised (dashboard views, query executions, page reads) over `usage_window`. For a single artifact it is that artifact's own exercise count; for a scope descriptor it is the number of exercises within the scope that touch the concept. Coarse by design: comparable at the alive-versus-dead and order-of-magnitude level and against a source's own history, but not a precise cross-kind ranking. Read as liveness and trend, not as a score. OKF v0.2 §5.1."},last_modified:{type:`string`,format:`date`,description:"Optional credibility signal — a recency signal: when the source itself last changed, as `YYYY-MM-DD`. Distinct from `generated.at`, which records when the concept was written. OKF v0.2 §5.1."},usage_window:{type:`object`,description:"Optional per-entry override of the `usage_window` written as a sibling of `sources`. OKF v0.2 §5.1.",properties:{from:{type:`string`,format:`date`,description:"Start of the window framing this entry's `usage_count`, as `YYYY-MM-DD`. OKF v0.2 §5.1."},to:{type:`string`,format:`date`,description:"End of the window framing this entry's `usage_count`, as `YYYY-MM-DD`. OKF v0.2 §5.1."}}}}}},usage_window:{type:`object`,description:"Written once as a sibling of `sources`, this frames every `usage_count` in the list with a `{ from, to }` date range. A single entry may carry its own `usage_window` to override it. OKF v0.2 §5.1.",properties:{from:{type:`string`,format:`date`,description:"Start of the shared usage window, as `YYYY-MM-DD`. OKF v0.2 §5.1."},to:{type:`string`,format:`date`,description:"End of the shared usage window, as `YYYY-MM-DD`. OKF v0.2 §5.1."}}},generated:{type:`object`,required:[`by`],description:"How the current content was produced. Kept distinct from `verified` because who wrote a concept need not be who confirmed it. OKF v0.2 §5.2.",properties:{by:{type:`string`,description:"REQUIRED within `generated`. An actor in the OKF convention: `<producer>/<version>` for agents and tools (`reference_agent/gemini-2.5-pro`), `human:<id>` for a person (`human:ahormati`), or `process:<id>` for an automated process (`process:finance-nightly`). Consumers that classify trust key off the `human:` prefix, so producers MUST use it for hand-authored or human-confirmed content — a rule about which form to pick for which content, which frontmatter alone cannot check, so the three forms are documented here rather than enforced by a pattern. OKF v0.2 §5.2, §7."},at:{type:`string`,format:`date-time`,description:"An ISO 8601 datetime marking the content's last meaningful change. Consumers use it to tell a recent edit from a stale fact. Supersedes v0.1's top-level `timestamp`. OKF v0.2 §5.2, §13.1."}}},verified:{description:'Who or what has confirmed the content against its sources or `resource` — a list of verification events. Multiple entries capture independent checks, for example a human sign-off plus a nightly process; "how recently" is the latest `at`. Independent of `generated.at`: content can change without re-confirmation, and facts can be re-confirmed without regeneration. A single verifier MAY be written as one bare `{ by, at }` mapping without the list dash, and consumers MUST treat that as a one-element list — hence the two accepted shapes here. Absence means unverified, which is a valid state, never a rejection. OKF v0.2 §5.2, §5.3, §11.',anyOf:[{type:`object`,description:`The bare single-verifier mapping form. OKF v0.2 §5.2.`,properties:{by:{type:`string`,description:"The verifying actor: `<producer>/<version>`, `human:<id>`, or `process:<id>`. A `human:` verifier is what raises the trust tier to human-reviewed; non-human verifiers alone yield machine-confirmed. OKF v0.2 §5.2, §5.3, §7."},at:{type:`string`,format:`date-time`,description:`ISO 8601 datetime of the verification event. OKF v0.2 §5.2.`}}},{type:`array`,description:`The list form: one entry per independent verification event. OKF v0.2 §5.2.`,items:{type:`object`,properties:{by:{type:`string`,description:"The verifying actor: `<producer>/<version>`, `human:<id>`, or `process:<id>`. A `human:` verifier is what raises the trust tier to human-reviewed; non-human verifiers alone yield machine-confirmed. OKF v0.2 §5.2, §5.3, §7."},at:{type:`string`,format:`date-time`,description:`ISO 8601 datetime of the verification event. OKF v0.2 §5.2.`}}}}]},status:{enum:[`draft`,`stable`,`deprecated`],description:"Lifecycle state. `draft` = not yet reviewed, possibly incomplete. `stable` = ready for consumption. `deprecated` = kept for links and history, no longer current. Absent means `stable`, so the key is only worth writing to say draft or deprecated. These three values are the whole set OKF defines, which is why this is the pack's only enum. OKF v0.2 §5.4."},stale_after:{type:`string`,format:`date`,description:"An absolute date, `YYYY-MM-DD`: the concept is stale when `today >= stale_after`. Absolute rather than a relative TTL so staleness stays a plain date comparison with no reference to when the concept was read. A date in the past is a freshness signal for consumers, not a violation. OKF v0.2 §5.5, §10.5."}}},doe={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — Attested Computation frontmatter`,description:'Shapes for the OKF v0.2 computation keys, which turn a concept into a sanctioned way to compute a value so a consumer can confirm the agent ran the blessed computation instead of improvising its own. Provenance answers "where did this claim come from"; attestation answers "was this number produced the way we said it must be". This file also carries the one value-shaped rule in the pack: `runtime` is the single key OKF marks REQUIRED here, and only when `type` is `Attested Computation`. Ordinary concepts never match that condition and are unaffected, and no other key in the family is mandated. OKF records the computation and the means to check it and executes nothing itself; receipts and verdicts are runtime artifacts that are never stored in the bundle. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md#10-attested-computations-concept',type:`object`,if:{required:[`type`],properties:{type:{const:`Attested Computation`,description:"The condition, not a constraint: everything in `then` applies only to documents whose `type` is exactly `Attested Computation`. An ordinary concept never matches, so nothing in this schema is ever asked of it. `type` is also required inside the condition so a document with no type at all fails the conformance floor once, rather than also being told it is missing a `runtime` for a type it never claimed."}}},then:{required:[`runtime`]},properties:{runtime:{type:`string`,description:"REQUIRED for `type: Attested Computation`. The single field that says how to run the computation, and therefore how the executor and attester interpret it and what `parameters` mean — a parameter is a SQL bind variable, a dbt var, or a Python argument depending on the runtime. Keeping `runtime` and `parameters` in one frontmatter is what makes the binding semantics self-evident. Example values: `bigquery`, `postgres`, `dbt`, `python`, `Looker`. Not a closed set, so no enum. OKF v0.2 §10.1, §10.2."},parameters:{type:`array`,description:`The typed, named holes the agent may fill. An agent MAY only supply values for these parameters; it MUST NOT author or edit the computation. That parameter-only surface is what makes "did the sanctioned thing run" a mechanical comparison rather than a judgement call. OKF v0.2 §10.2, §10.3.`,items:{type:`object`,properties:{name:{type:`string`,description:"The parameter name the computation binds, for example `year` bound as `@year` in BigQuery SQL or `{{ var('year') }}` in dbt. OKF v0.2 §10.2, §10.3."},type:{type:`string`,description:"The parameter's type, interpreted by `runtime` (`integer`, `string`, and so on). Deliberately not constrained to JSON Schema type names, because the vocabulary belongs to the runtime. OKF v0.2 §10.2."},required:{type:`boolean`,description:`Whether the agent must supply a value for this parameter. OKF v0.2 §10.2.`}}}},computation:{type:`string`,format:`uri-reference`,description:"Optional. A path to a file holding the computation, used instead of an inline body fence — best for a long or generated computation, or one already kept as a real file shared with non-OKF tooling. When absent, the body's `# Computation` fence IS the computation. Path-valued: an absolute URL, a bundle-relative path beginning with `/`, or a relative path. OKF v0.2 §6.2, §10.2, §10.3."},executor:{type:`object`,description:"How the computation is run. A runner — an agent, or deterministic consumer code — follows `resource`, and the run returns a receipt shaped by `receipt`. Binding the computation with the parameter values into the executable artifact is the consumer's job. OKF v0.2 §10.2, §10.5.",properties:{resource:{type:`string`,format:`uri-reference`,description:"Names the run instructions or code. What sits behind it — a Skill, a script, a container — is a packaging choice; OKF fixes the interface, not the packaging. Conventionally points into a `references/` subdirectory, for example `references/skills/run-on-bq.md`. OKF v0.2 §1, §6.2, §6.3, §10.2."},receipt:{type:`array`,items:{type:`string`},description:"Declares the fields a run must return — the evidence the attester inspects, for example `[job_id, executed_sql, result]` for BigQuery or `[run_id, compiled_sql, result]` for dbt. Because the attester compares the expanded, compiled artifact the receipt carries, a rewritten query, a swapped computation file, or a mutated dependency fails the check. The receipt itself is a runtime artifact and is never stored in the bundle. OKF v0.2 §10.2, §10.3, §10.5."}}},attester:{type:`object`,description:"The deterministic check that inspects a receipt and returns a verdict. Meant to run consumer-side. Distinct from `verified`: `verified` confirms the definition still matches policy and is recorded in the bundle, while attestation confirms a single run produced the value the sanctioned way and is not stored. OKF v0.2 §10.2, §10.6.",properties:{resource:{type:`string`,format:`uri-reference`,description:"Names code — no LLM — that takes a receipt and returns a verdict, independently re-deriving the binding of `computation` with the claimed parameter values to compare against what actually ran. Conventionally points into a `references/` subdirectory, for example `references/attesters/sql-equality.py`. OKF v0.2 §6.2, §6.3, §10.2, §10.3."}}}}},foe={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — index files carry no frontmatter`,description:"`index.md` is a reserved filename at any level of the hierarchy and must not be used for a concept document. Index files contain no frontmatter, with exactly one exception — a bundle-root `index.md` may carry `okf_version` — which the scope carves out with a `!index` exclusion rather than a keyword here. `maxProperties: 0` is the mechanism rather than the boolean schema `false`, because a document with no frontmatter block validates as `{}` and `false` would reject that too, flagging the very documents that are correct. `log.md` is deliberately NOT covered: §9 constrains a log's date headings, ordering, and prose entries but never its frontmatter, and OKF's own reference bundle ships a `log.md` carrying `type` and `title`. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md#8-index-files",type:`object`,maxProperties:0},poe={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — bundle-root index.md`,description:"The bundle-root `index.md` is the only index file OKF permits frontmatter in, and `okf_version` is the key it names there. OKF states the declaration as a MAY, so it is not required here. Nor is the frontmatter closed to other keys: §8 grants the exception for `okf_version` specifically, but §11 tells consumers not to reject a bundle over unknown additional keys, and that ambiguity is resolved in favor of the looser reading. The one thing pinned is the value's shape, because a YAML float is provably lossy where a version string is not. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md#12-versioning",type:`object`,properties:{okf_version:{type:`string`,pattern:`^[0-9]+\\.[0-9]+$`,description:'The OKF version this bundle targets, as `<major>.<minor>` — currently `"0.2"`. Quote it: unquoted `0.2` parses as a YAML number, so a consumer comparing version strings sees a float instead, and `0.10` would silently become `0.1`. A minor bump is backward-compatible additions; a major bump may rename required fields or change reserved filenames. Consumers that do not understand the declared version should attempt best-effort consumption rather than refusing the bundle. OKF v0.2 §12.'}}},T5=[`**`,`!**/{index,log}`],moe=[{id:`frontmatter-required`,appliesTo:T5,schema:coe},{id:`frontmatter-recommended`,appliesTo:T5,schema:loe},{id:`frontmatter-provenance`,appliesTo:T5,schema:uoe},{id:`frontmatter-computation`,appliesTo:T5,schema:doe},{id:`frontmatter-reserved-index`,appliesTo:[`**/index`,`!index`],schema:foe},{id:`frontmatter-root-index`,appliesTo:[`index`],schema:poe}];function E5(e,t){return t===void 0?[]:moe.filter(n=>w5(e,n.id)&&m5([...n.appliesTo]).matches(t))}function hoe(e,t,n){let r=E5(t,n);return r.length===0?[]:S5(e,r.map(e=>({file:soe(e.id),schema:e.schema,ruleId:e.id})),{source:`okf`})}function D5(e,t){return oG(`okf:${e}`,(n,r)=>{try{t(n,r)}catch(t){console.warn(`[lint] OKF rule "${e}" failed${r.data.okfDocName?` on "${r.data.okfDocName}"`:``}`,t)}})}function O5(e,t,n){let r=m5(t);return D5(e,(e,t)=>{r.matches(t.data.okfDocName)&&n(e,t)})}var k5=e=>({line:e.line-1,character:e.column-1});function goe(e,t){if(e&&`start`in e)return{start:k5(e.start),end:k5(e.end)};if(e){let n=k5(e);return{start:n,end:{line:n.line,character:t[n.line]?.length??0}}}return{start:{line:0,character:0},end:{line:0,character:t[0]?.length??0}}}function _oe(e,t){return{range:goe(e.place,t),severity:`warning`,source:`okf`,code:e.ruleId??`okf`,message:e.reason}}function voe(e,t,n){if(t.length===0)return[];let r=Se().use(ie).use(O).use(GP,[`yaml`]);for(let e of t)r.use(e);let i=new _({value:e});n!==void 0&&(i.data.okfDocName=n);let a=r.parse(i);r.runSync(a,i);let o=e.split(`
571
571
  `);return i.messages.map(e=>_oe(e,o))}var yoe=`**/index`;function boe(e){let t=!1;return h(e,[`link`,`linkReference`],()=>(t=!0,!1)),t}var xoe=O5(`index-shape`,yoe,(e,t)=>{let n=!1;for(let r of e.children){if(r.type===`heading`){n=!0;continue}r.type===`list`&&!n&&t.message(`This index list is not under a section heading, so an Open Knowledge Format consumer reading the file as navigation has no name to file its entries under — an index is one or more heading-led sections of bulleted links.`,r)}h(e,`listItem`,e=>{e.children.some(e=>e.type===`list`)||boe(e)||t.message(`This index entry has no link, so an Open Knowledge Format consumer reading the file as navigation has nowhere to follow it. Every entry in the format's own reference bundles is a link followed by a short description.`,e)})}),Soe=`**/log`,Coe=/^\s*(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(?!\d)/;function woe(e,t,n){let r=new Date(Date.UTC(e,t-1,n));return r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n}var Toe=/^\s*\d{4}[-/.]\d{1,2}[-/.]\d{1,2}/;function A5(e){let t=e.trim();return t.length>60?`${t.slice(0,59)}…`:t}var Eoe=O5(`log-shape`,Soe,(e,t)=>{let n;h(e,`heading`,e=>{if(e.depth!==2)return;let r=w(e),i=Coe.exec(r);if(!i){t.message(Toe.test(r)?`Log date heading "${A5(r)}" is not in ISO 8601 YYYY-MM-DD form, the one form an Open Knowledge Format log requires of its date headings.`:`Log entry heading "${A5(r)}" is not a date, so it falls outside the dated-entry format an Open Knowledge Format consumer reads a log as — nothing under it reaches the change-history timeline.`,e);return}let a=`${i[1]}-${i[2]}-${i[3]}`;if(!woe(Number(i[1]),Number(i[2]),Number(i[3]))){t.message(`Log date heading "${a}" is not a real calendar date, so it is not ISO 8601 — the one form an Open Knowledge Format log requires of its date headings.`,e);return}n!==void 0&&a>n&&t.message(`Log date heading "${a}" is newer than the entry above it — an Open Knowledge Format log is a flat list of date-grouped entries, newest first.`,e),n=a})}),Doe=/\[\[[^[\]\n]+\]\]/g;function Ooe(e){let t=`Wiki-link ${e} won't resolve for an external Open Knowledge Format consumer — it renders as literal text and its graph edge is lost.`;return e.includes(`|`)?`${t} The alias "|" also splits a GFM table cell.`:t}var koe=D5(`no-wiki-links`,(e,t)=>{let n=typeof t.value==`string`?t.value:String(t.value);h(e,`text`,e=>{let r=e.position?.start,i=e.position?.end,a=r?.offset,o=a===void 0||i?.offset===void 0?e.value:n.slice(a,i.offset),s=0,c=r?.line??0,l=r?.column??0,u=e=>{for(;s<e;s+=1)o[s]===`
572
- `?(c+=1,l=1):l+=1;return{line:c,column:l}};for(let e of o.matchAll(Doe)){let{index:i}=e;if((a===void 0?o[i-1]:n[a+i-1])===`!`)continue;let s=r&&a!==void 0?{start:u(i),end:u(i+e[0].length)}:void 0;t.message(Ooe(e[0]),s)}})}),Aoe=[`index`,`log`];function joe(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return t;let r=t.slice(n).toLowerCase();return CX.includes(r)?t.slice(0,n):t}var Moe=D5(`reserved-casing`,(e,t)=>{let n=t.data.okfDocName;if(n===void 0)return;let r=joe(n),i=r.toLowerCase();Aoe.includes(i)&&r!==i&&t.message(`This file is named "${r}", but the Open Knowledge Format only recognizes "${i}". On a case-sensitive filesystem a consumer reads it as an ordinary concept document rather than the reserved file it is meant to be.`)}),j5=[{id:`no-wiki-links`,rule:koe},{id:`log-shape`,rule:Eoe},{id:`index-shape`,rule:xoe},{id:`reserved-casing`,rule:Moe}],Noe=j5.map(e=>e.rule);function Poe(e){return e===void 0?Noe:j5.filter(t=>w5(e,t.id)).map(e=>e.rule)}var Foe=no([F(),z(wd),co(N(),Xa())]),Ioe={id:`markdownlint`,sliceSchema:L({enabled:F(),rules:co(N(),Foe)}),defaultSlice:{enabled:!1,rules:d5},async lint(e,t){return Xae(e,f5(t.rules))},fix(e,t){return Yae(e,f5(t.rules))}},Loe=L({appliesTo:no([N(),I(N())]).optional(),file:N(),enabled:F().optional(),key:N().optional(),schema:co(N(),Xa()).optional()}),M5=[Ioe,{id:`frontmatter`,sliceSchema:L({enabled:F(),schemas:I(Loe)}),defaultSlice:{enabled:!1,schemas:[]},async lint(e,t,n){return S5(e,_5(t.schemas,n.docName))}},{id:`okf`,sliceSchema:L({enabled:F(),rules:co(N(),F()).optional(),generate:L({index:F().optional()}).optional()}),defaultSlice:{enabled:!1},async lint(e,t,n){return[...voe(e,Poe(t.rules),n.docName),...hoe(e,t.rules,n.docName)]}}],Roe={enabled:!0,plugins:Object.fromEntries(M5.map(e=>[e.id,e.defaultSlice]))},zoe=new Set([`.markdownlint.json`,`.markdownlint.jsonc`]);function Boe(e){return zoe.has(e)}L({docName:M$,summary:F$,content:N().optional(),...P$}).loose(),L({docName:M$,summary:F$,markdown:N(),position:z([`append`,`prepend`,`replace`]).optional(),extension:z(CX).optional(),...P$}).loose(),L({docName:M$,summary:F$,find:N().min(1),replace:N(),offset:P().int().nonnegative().optional(),...P$}).loose(),L({docName:M$,connectionId:N().min(1),scope:z([`last`,`session`,`file`,`count`]).optional(),count:P().int().positive().optional(),...P$}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});var N5=L({value:N(),truncatedFrom:P().int().nonnegative().optional(),hint:N().optional()}).loose(),Voe=io(`kind`,[L({kind:B(`inline`),content:N()}),L({kind:B(`truncated`),byteLength:P().int().nonnegative(),hint:N()})]),P5=L({kind:B(`content-divergence`),intendedBytes:P().int().nonnegative(),actualBytes:P().int().nonnegative(),byteDelta:P().int(),divergenceType:N().optional(),currentState:Voe.optional(),hint:N().optional()}).loose(),Hoe=L({type:B(`orphan`),parentCandidates:I(N()),message:N()}).loose(),F5=L({kind:B(`disk-edit-reconciled`),intendedBytes:P().int().nonnegative(),actualBytes:P().int().nonnegative(),byteDelta:P().int(),mergeOutcome:N().optional(),hint:N().optional()}).loose(),I5=io(`kind`,[P5,F5]),Uoe=L({kind:B(`mermaid-parse-error`),fenceIndex:P().int().positive(),fenceFirstLine:N(),message:N(),line:P().int().positive().optional()}).loose(),L5=L({href:N(),targetKind:N(),role:N(),sourceForm:N(),resolvedTarget:N().nullable(),reason:N(),resolutionMethod:N(),fallbackTarget:N().nullable().optional(),definition:L({line:P().int().nonnegative(),label:N()}).loose().optional()}).loose(),R5=I(io(`kind`,[P5,F5,Uoe,L({kind:B(`lint-violation`),source:N(),code:N(),message:N(),severity:z([`error`,`warning`,`info`,`hint`]),line:P().int().positive(),column:P().int().positive(),linkTarget:N().optional(),localTarget:L5.optional()}).loose()])).min(1),z5=I(L({href:N(),resolvedTo:N().nullable(),reason:z([`no-such-doc`,`no-such-file`,`unresolvable`]),localTarget:L5.optional()}).loose());L({timestamp:N().min(1),summary:N5.optional(),warning:I5.optional(),warnings:R5.optional()}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),hints:I(Hoe).optional(),summary:N5.optional(),warning:I5.optional(),warnings:R5.optional(),brokenLinks:z5}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),summary:N5.optional(),warning:I5.optional(),warnings:R5.optional(),brokenLinks:z5}).loose(),L({docName:N().min(1),scope:z([`last`,`session`,`count`]),undone:F()}).loose(),L({docs:I(L({docName:N$,markdown:N(),position:z([`append`,`prepend`,`replace`]).optional(),extension:z(CX).optional(),summary:F$}).loose()).min(1).max(100),...P$}).loose();var Woe=L({type:t1,title:N(),detail:N().optional()}).loose(),Goe=io(`status`,[L({status:B(`written`),docName:N().min(1),summary:N5.optional(),warnings:R5.optional(),brokenLinks:z5}).loose(),L({status:B(`error`),docName:N().min(1),error:Woe}).loose()]);L({timestamp:N().min(1),results:I(Goe),written:P().int().nonnegative(),failed:P().int().nonnegative()}).loose(),L({docName:M$,patch:co(N(),no([mm,Ja()])),types:co(N(),z(dm)).optional(),summary:F$,...P$}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),appliedKeys:I(N()),summary:N5.optional(),warning:I5.optional(),warnings:R5.optional(),brokenLinks:z5}).loose();function Koe(e){return{enabled:e.enabled??!0,plugins:{markdownlint:{...e.markdownlint,rules:e.markdownlint.rules??d5},frontmatter:{enabled:e.frontmatter?.enabled??!1,schemas:e.frontmatter?.schemas??[]},okf:{enabled:e.okf?.enabled??!1,...e.okf?.rules===void 0?{}:{rules:e.okf.rules},generate:{index:e.okf?.generate?.index??!1}}}}}var qoe=Object.fromEntries(M5.map(e=>[e.id,e.sliceSchema])),Joe=L({effective:L({enabled:F(),plugins:L(qoe)}),configFile:N().nullable().optional(),configProblems:I(N()).optional()}),Yoe=no([F(),co(N(),Xa())]);L({ruleId:N().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:no([Yoe,Ja()])}),L({file:N().min(1).max(512),delete:B(!0).optional(),field:N().min(1).max(256).optional(),parentPath:I(no([N().min(1).max(256),L({items:B(!0)}).strict()])).max(8).optional(),removeField:B(!0).optional(),renameTo:N().min(1).max(256).optional(),constraint:L({type:z([`string`,`number`,`boolean`,`array`,`object`]).nullable().optional(),enum:I(no([N(),P(),F()])).nullable().optional(),itemsEnum:I(no([N(),P(),F()])).nullable().optional(),itemsType:z([`string`,`number`,`boolean`,`object`]).nullable().optional(),pattern:N().nullable().optional(),format:N().nullable().optional(),description:N().max(2048).nullable().optional(),required:F().optional()}).optional()}).refine(e=>e.delete===void 0||e.field===void 0&&e.constraint===void 0&&e.removeField===void 0&&e.renameTo===void 0,{message:`delete cannot be combined with a field edit`}).refine(e=>[e.constraint,e.removeField,e.renameTo].filter(e=>e!==void 0).length<=1,{message:`constraint, removeField, and renameTo are mutually exclusive`}).refine(e=>e.removeField===void 0&&e.renameTo===void 0||e.field!==void 0,{message:`removeField and renameTo require field`}).refine(e=>e.parentPath===void 0||e.field!==void 0,{message:`parentPath requires field`}).refine(e=>e.field===void 0?e.constraint===void 0:e.constraint!==void 0||e.removeField!==void 0||e.renameTo!==void 0,{message:`field requires constraint, removeField, or renameTo`});var Xoe=L({schemas:I(N()),truncated:F()}).strict(),B5=L({line:P(),character:P()}),V5=L({start:B5,end:B5}),H5=L({range:V5,severity:z([`error`,`warning`,`info`,`hint`]),source:N(),code:N(),message:N(),fixes:I(L({range:V5,newText:N()})).optional(),frontmatterScope:z([`missing`,`invalid`]).optional(),frontmatterProperty:N().optional()});L({files:I(L({file:N(),diagnostics:I(H5),warnings:I(N()).optional()})),fileCount:P(),errorCount:P(),warningCount:P(),warnings:I(N())});var Zoe=H5.extend({linkTarget:N().optional(),localTarget:L5.optional()}),Qoe=L({files:I(L({file:N(),diagnostics:I(Zoe)})),fileCount:P(),errorCount:P(),warningCount:P(),warnings:I(N())}),U5=L({errorCount:P().int().nonnegative(),warningCount:P().int().nonnegative()}),$oe=L({files:I(L({file:N(),lint:U5,links:U5})),fileCount:P().int().nonnegative(),errorCount:P().int().nonnegative(),warningCount:P().int().nonnegative(),warnings:I(N())});L({docName:M$,summary:F$,...P$}).loose();var ese=L({file:N(),fixedCount:P(),diagnostics:I(H5),errorCount:P(),warningCount:P(),warning:N().optional()});function tse(e){let t=e.trim().replace(/^\.\//,``);if(!t.startsWith(`.ok/schemas/`))return!1;let n=t.slice(12);return n.length>0&&!n.includes(`/`)&&!n.includes(`\\`)&&n!==`.`&&n!==`..`}function nse(e){let t=e.trim().toLowerCase().split(`/`).pop()??``;return t.endsWith(`.schema.json`)&&t.length>12?!0:tse(e)&&t.endsWith(`.json`)}var W5=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}],rse=(()=>{let e=new Map;for(let t of W5){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();function G5(e){return rse.get(e.toUpperCase())??null}function ise(e,t){let n=G5(t);if(n===null)return;let r;for(let[t,i]of Object.entries(e))G5(t)===n&&(r={key:t,value:i});return r}var ase=[`Headings`,`Lists`,`Whitespace`,`Code`,`Links & images`,`Style`],ose=[[`headings`,`Headings`],[`bullet`,`Lists`],[`ul`,`Lists`],[`ol`,`Lists`],[`links`,`Links & images`],[`images`,`Links & images`],[`accessibility`,`Links & images`],[`code`,`Code`],[`language`,`Code`],[`emphasis`,`Style`],[`html`,`Style`],[`line_length`,`Whitespace`],[`whitespace`,`Whitespace`],[`hard_tab`,`Whitespace`],[`blank_lines`,`Whitespace`],[`indentation`,`Whitespace`]];function sse(e){for(let[t,n]of ose)if(e.tags.includes(t))return n;return`Style`}function cse(e){let t={lint:{errorCount:0,warningCount:0},links:{errorCount:0,warningCount:0}};for(let n of e){let e=n.source===`links`?t.links:t.lint;n.severity===`error`?e.errorCount+=1:e.warningCount+=1}return t}async function lse(e,t,n){if(!t.enabled)return[];let r=[];for(let i of M5){let a=t.plugins[i.id];if(a.enabled)try{r.push(...await i.lint(e,a,{docName:n}))}catch(e){console.warn(`[lint] plugin "${i.id}" failed${n?` on "${n}"`:``}`,e)}}return r}var use=/\p{M}+/gu,dse=/[^\p{L}\p{N}]+/gu,fse=/^-+|-+$/g;function K5(e){return e.trim().normalize(`NFKD`).replace(use,``).toLowerCase().replace(dse,`-`).replace(fse,``)}function pse(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function q5(e,t){let n=K5(e);return n?pse(n,t):``}function J5(e,t){let n=K5(e);return t?`#${n}-${K5(t)}`:`#${n}`}var Y5=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]),mse=new Map(V2.flatMap(e=>e.surface===`compat`&&Y5.has(e.rendersAs)?[[e.name,e]]:[]));function X5(e){let t={};for(let n of e.attributes){if(n.type!==`mdxJsxAttribute`)return null;let e=n.name.toLowerCase();if(!(e.length>=3&&e.startsWith(`on`)))if(n.value===null)t[n.name]=!0;else if(typeof n.value==`string`)t[n.name]=n.value;else return null}return t}function Z5(e){let t=e.name;if(!t||!Y5.has(t))return null;let n=X5(e);return n===null?null:{type:`element`,tagName:t,properties:n,children:[]}}function Q5(e){let t=e.name;if(!t)return null;let n=mse.get(t);if(!n)return null;let r=X5(e);if(r===null)return null;let i=n.translateProps(r),a={};for(let[e,t]of Object.entries(i))(typeof t==`string`||typeof t==`boolean`)&&(a[e]=t);return{type:`element`,tagName:n.rendersAs,properties:a,children:[]}}var hse=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-link`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:J5(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},gse=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-embed`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:J5(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},_se=(e,t)=>{let n=t,r=Z5(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=Q5(n);if(i){e.patch(t,i);let n=e.applyData(t,i);return n.tagName===`img`?{type:`element`,tagName:`p`,properties:{},children:[n]}:n}let a={type:`element`,tagName:`pre`,properties:{className:[`mdx-component`]},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]}]};return e.patch(t,a),e.applyData(t,a)},vse=(e,t)=>{let n=t,r=Z5(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=Q5(n);if(i)return e.patch(t,i),e.applyData(t,i);let a={type:`element`,tagName:`span`,properties:{className:[`mdx-inline`],dataJsxInline:``},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]};return e.patch(t,a),e.applyData(t,a)},yse=(e,t)=>{let n=t,r=n.data.reason||`unknown`,i=n.value||``,a=r.replace(/--/g,`—`),o={type:`comment`,value:` Parse error: ${a} `},s={type:`element`,tagName:`pre`,properties:{className:[`mdx-fallback`],dataRawMdxFallback:``,dataReason:a},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:i}]}]};return e.patch(t,s),[o,e.applyData(t,s)]},bse=(e,t)=>{let n={type:`element`,tagName:`mark`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},xse=(e,t)=>{let n=t,r={type:`element`,tagName:n.data?.sourceForm===`ins`?`ins`:`u`,properties:{},children:e.all(n)};return e.patch(t,r),e.applyData(t,r)};function $5(e){if(typeof e!=`object`||!e)return``;let t=e;return typeof t.value==`string`?t.value:Array.isArray(t.children)?t.children.map($5).join(``):``}var e7={wikiLink:hse,wikiLinkEmbed:gse,mdxJsxFlowElement:_se,mdxJsxTextElement:vse,rawMdxFallback:yse,mark:bse,underline:xse,tag:(e,t)=>{let n=t.value,r={type:`element`,tagName:`a`,properties:{className:[`tag`],dataTag:n,href:`#tag/${n}`},children:[{type:`text`,value:`#${n}`}]};return e.patch(t,r),e.applyData(t,r)},comment:(e,t)=>{let n={type:`comment`,value:$5(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},commentBlock:(e,t)=>{let n={type:`comment`,value:$5(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`sup`,properties:{id:`fnref-${n}`,dataFootnoteRef:``,dataFootnoteId:n,className:[`footnote-ref`]},children:[{type:`element`,tagName:`a`,properties:{href:`#fn-${n}`,className:[`footnote-ref-link`]},children:[{type:`text`,value:`[${n}]`}]}]};return e.patch(t,r),e.applyData(t,r)},footnoteDefinition:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`aside`,properties:{id:`fn-${n}`,dataFootnoteDef:``,dataFootnoteId:n,className:[`footnote-def`]},children:[{type:`element`,tagName:`div`,properties:{className:[`footnote-body`]},children:e.all(t)},{type:`element`,tagName:`a`,properties:{href:`#fnref-${n}`,className:[`footnote-backref`],ariaLabel:`Back to reference`},children:[{type:`text`,value:`↩`}]}]};return e.patch(t,r),e.applyData(t,r)}},Sse=/url\s*\(\s*['"]?\s*(?:javascript|vbscript|data)\s*:/i,Cse=/\bexpression\s*\(/i,wse=1e4;function Tse(e){return!(e.length>wse||Sse.test(e)||Cse.test(e))}function t7(e){for(let t of e.split(`,`)){let e=t.trim();if(e!==``&&!oZ(e.split(/\s+/)[0]??``))return!1}return!0}var Ese={a:[`href`,`title`],img:[`src`,`alt`,`title`],video:[`src`,`title`],audio:[`src`,`title`],code:[`className`]},Dse=new Set([`href`,`src`]),Ose=Ce(`<>`),n7=()=>e=>{h(e,`element`,e=>{let t=Ese[e.tagName.toLowerCase()],n=e.properties;if(!(!t||!n))for(let e of t){let t=n[e];if(Array.isArray(t)){let r=t.map(e=>typeof e==`string`?p3(e):e);r.some((e,n)=>e!==t[n])&&(n[e]=r);continue}if(typeof t!=`string`)continue;let r;if(Dse.has(e))if(t===`<>`||t===Ose)r=``;else{let e=p3(t);r=e===t?t:Ce(e)}else r=p3(t);r!==t&&(n[e]=r)}})},r7=()=>e=>{h(e,`element`,e=>{let t=e.tagName.toLowerCase(),n=e.properties;if(!n)return;if(t===`a`||t===`area`||t===`link`||t===`base`){let e=n.href;typeof e==`string`&&!oZ(e)&&delete n.href}if(t===`img`||t===`iframe`||t===`script`||t===`embed`||t===`source`||t===`audio`||t===`video`||t===`track`){let e=n.src;typeof e==`string`&&!oZ(e)&&delete n.src}if(t===`form`){let e=n.action;typeof e==`string`&&!oZ(e)&&delete n.action}if(t===`img`||t===`source`){let e=n.srcSet;typeof e==`string`&&!t7(e)&&delete n.srcSet;let t=n.srcset;typeof t==`string`&&!t7(t)&&delete n.srcset}if(t===`video`){let e=n.poster;typeof e==`string`&&!oZ(e)&&delete n.poster}let r=n.style;typeof r==`string`&&!Tse(r)&&delete n.style})};function kse(e){let t=Se().use(be,{handlers:e7}).use(n7).use(r7).use(cG),n=t.runSync(e);return String(t.stringify(n))}function Ase(e){let t=/\r?\n|\r/g,n=[],r=0,i=t.exec(e);for(;i!==null;)n.push(i7(e.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=t.exec(e);return n.push(i7(e.slice(r),r>0,!1)),n.join(``)}function i7(e,t,n){let r=0,i=e.length,a=e=>e===9||e===32;for(;t&&r<i&&a(e.charCodeAt(r));)r++;for(;n&&i>r&&a(e.charCodeAt(i-1));)i--;return i>r?e.slice(r,i):``}var a7=/\r?\n|\r/,jse=(e,t)=>{let n=Ase(String(t.value));if(!a7.test(n)){let r={type:`text`,value:n};return e.patch(t,r),e.applyData(t,r)}let r=n.split(a7),i=[];for(let e=0;e<r.length;e++)e>0&&i.push({type:`element`,tagName:`br`,properties:{},children:[]}),r[e].length>0&&i.push({type:`text`,value:r[e]});return i};function Mse(e){let t=Se().use(ie).use(GP,[`yaml`]).use(b8).use(O).use(B8).use(o3).use(O8).use(x3).use(be,{handlers:{...e7,text:jse}}).use(n7).use(r7).use(cG);return String(t.processSync(i3(b3(e))))}vI(),LF(),RF(),L({entries:I(L({level:z([`info`,`warn`,`error`]),message:N().max(oY),event:N().optional(),fields:co(N(),Xa()).optional(),ts:P().optional(),sourceId:N().optional(),lineNumber:P().optional()}).loose()).max(100),droppedSinceLastFlush:P().int().min(0).optional()}).loose(),L({accepted:P().int().min(0)}).loose();var Nse=L({exact:N().min(1),prefix:N(),suffix:N(),start:P().int().nonnegative(),end:P().int().nonnegative()}),Pse=I(no([N(),P().int().nonnegative()])),Fse=io(`kind`,[L({kind:B(`body`)}),L({kind:B(`property`),key:N().min(1),path:Pse.default([])})]).default({kind:`body`}),Ise=z([`anchored`,`orphaned`,`resolved`]),o7=L({threadId:N().min(1),docName:N().min(1),target:Fse,anchor:Nse.nullable(),state:Ise,queued:F(),latestComment:N(),createdBy:N().min(1),createdAt:P(),updatedAt:P().optional()}),s7=L({docName:N(),instruction:N(),property:N().nullable(),passage:L({exact:N(),prefix:N(),suffix:N()}).nullable(),anchorLost:F(),passageRepeats:F()}).loose(),c7=L({threadId:N(),ok:B(!0)}),l7=L({threadId:N(),ok:B(!1),error:B(`not-found`)});L({threads:I(o7)}).loose();var Lse=L({meta:o7,orphaned:F()}).loose(),Rse=L({threadId:N()}).loose();L({meta:o7,payload:s7}).loose();var zse=L({results:I(no([c7.extend({meta:o7,payload:s7}),l7]))}).loose(),Bse=L({results:I(no([c7.extend({meta:o7}),l7]))}).loose(),Vse=L({status:N().min(1),reason:N()}).loose(),Hse=L({docName:N().min(1),content:N(),lifecycle:Vse.nullable()}).loose(),u7=L({kind:z([`document`,`asset`,`folder`,`file`]).default(`document`),docName:N().min(1).optional(),docExt:N().min(1).default(`.md`),size:P().int().nonnegative(),modified:N().min(1),isSymlink:F().default(!1),canonicalDocName:N().nullable().default(null),targetPath:N().nullable().default(null),path:N().min(1).optional(),assetExt:N().min(1).optional(),mediaKind:z([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`,`excalidraw`]).nullable().optional(),referencedBy:I(N().min(1)).optional(),hasChildren:F().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`}),Use=L({documents:I(u7),truncated:F().optional()}).loose(),Wse=L({source:N().min(1),anchor:N().nullable(),title:N(),snippet:N().nullable()}).loose(),Gse=L({docName:N().min(1),backlinks:I(Wse)}).loose(),Kse=L({counts:co(N().min(1),P().int().nonnegative())}).loose();L({counts:co(N().min(1),P().int().nonnegative())}).loose();var qse=io(`kind`,[L({kind:B(`doc`),docName:N().min(1),anchor:N().nullable(),title:N(),snippet:N().nullable()}).loose(),L({kind:B(`external`),url:N().min(1),title:N(),snippet:N().nullable()}).loose()]),Jse=L({role:N().min(1),sourceForm:N().min(1),targetKind:N().min(1),href:N(),resolvedTarget:N().nullable(),status:N().min(1),reason:N().nullable(),resolutionMethod:N().min(1),fallbackTarget:N().nullable().default(null),range:L({start:P().int().nonnegative(),end:P().int().nonnegative()}),line:P().int().nonnegative(),column:P().int().nonnegative(),definition:L({label:N(),line:P().int().nonnegative()}).nullable().default(null)}).loose(),Yse=L({docName:N().min(1),forwardLinks:I(qse),localTargets:I(Jse).optional()}).loose(),Xse=io(`kind`,[L({id:N().min(1),kind:B(`doc`),docName:N().min(1),anchor:N().nullable(),label:N(),cluster:N().nullable(),category:N().nullable(),tags:I(N()).nullable(),managed:F().optional()}).loose(),L({id:N().min(1),kind:B(`external`),url:N().min(1),label:N()}).loose()]),Zse=L({source:N().min(1),target:N().min(1)}).loose(),Qse=L({nodes:I(Xse),links:I(Zse)}).loose(),$se=L({ts:P().int().min(0),url:N(),method:N(),ua:N().optional(),origin:N().optional(),referer:N().optional(),host:N().optional(),remote:N().optional(),secChUa:N().optional(),secChUaMobile:N().optional(),secChUaPlatform:N().optional(),secFetchSite:N().optional(),secFetchDest:N().optional(),secFetchMode:N().optional(),secFetchUser:N().optional()}).loose(),ece=L({app:no([B(`cursor`),B(`codex`),B(`claude`),Ja()]),signals_fired:I(N())}).loose();L({entries:I($se),count:P().int().min(0),detection:ece}).loose(),L({writers:I(L({id:N().min(1),name:N().optional(),email:N().optional()}).loose()).optional(),summary:F$,...P$}).loose(),L({checkpointRef:N().min(1)}).loose();var tce=L({v:P().int().optional(),id:N().min(1),name:N().min(1),colorSeed:N().optional(),docs:I(N()),summaries:I(N()).optional()}).loose();L({entries:I(L({sha:N().min(1),timestamp:N().min(1),author:N(),authorEmail:N(),type:z([`checkpoint`,`wip`,`upstream`,`park`]),message:N(),contributors:I(tce),checkpoint:Xa().nullable(),parentSha:N().nullable().optional()}).loose()),total:P().int().nonnegative().optional(),truncated:F().optional(),hasMore:F().optional()}).loose(),L({sha:N().regex(/^[0-9a-f]{40}$/i),content:N(),timestamp:N(),author:N()}).loose();var nce=L({contentDir:N().min(1),pathSeparator:z([`/`,`\\`]),symlinkResolved:F()}).loose();I(io(`source`,[L({docName:N().min(1),timestamp:N().min(1),size:P().int().nonnegative(),source:B(`flat`)}).loose(),L({docName:N().min(1),timestamp:N().min(1),source:B(`timeline`),sha:N().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});var rce=L({domain:N().min(1),title:N().optional(),description:N().optional(),siteName:N().optional(),faviconDataUri:N().optional()}).loose();L({url:N()}).loose();var ice=io(`ok`,[L({ok:B(!0),metadata:rce}).loose(),L({ok:B(!1),reason:N()}).loose()]),ace=L({orphans:I(L({docName:N().min(1),title:N()}).loose())}).loose(),oce=L({hubs:I(L({docName:N().min(1),title:N(),count:P().int().nonnegative()}).loose())}).loose(),sce=L({source:N().min(1),title:N(),snippet:N().nullable()}).loose();L({deadLinks:I(L({target:N().min(1),sources:I(sce)}).loose())}).loose(),L({target:L({docName:N().min(1),title:N(),aliases:I(N())}).loose(),mentions:I(L({source:N().min(1),excerpt:N(),offset:P().int().nonnegative()}).loose()),truncated:F()}).loose(),L({projectPath:N().min(1)}).loose();var cce=z([`not-a-git-worktree`,`init-failed`]);io(`ok`,[L({ok:B(!0),projectPath:N().min(1)}).loose(),L({ok:B(!1),reason:cce,message:N().min(1)}).loose()]),L({host:N().min(1).optional()}).loose(),L({host:N().min(1).optional(),token:N().min(1)}).loose(),L({host:N(),login:N()}).loose(),L({key:N().min(1)}).loose(),L({keyPresent:F()}).loose();var lce=z([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]),uce=io(`ok`,[L({ok:B(!0),endpoint:N().min(1),model:N().min(1),dimensions:P().int().positive()}).loose(),L({ok:B(!1),endpoint:N().min(1),model:N().min(1),reason:lce,status:P().int().optional()}).loose()]);L({name:N().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:N().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),L({authenticated:F()}).loose(),L({channel:z([`login`,`gh-login`]).default(`login`)}).loose(),L({}).loose();var d7=65536;function f7(e){let t=e.match(am);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function dce(e){if(e.trim()===``)return{doc:new ol({}),map:{}};let t;try{t=_u(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new ol({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=ym.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function p7(e){return e===``?{doc:new ol({}),map:{}}:dce(lm(e))}function m7(e){let{fenced:t}=f7(e),{map:n,parseError:r}=p7(t);return{map:n??{},parseError:r}}function h7(e){let{fenced:t}=f7(e);if(t===``)return[];let{doc:n,map:r}=p7(t);return r===null?[]:y7(n)}function g7(e){return typeof e==`object`&&!!e&&`key`in e}function _7(e){let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}function v7(e,t){let n=e.key;if(typeof n==`string`){e.key=t;return}if(n&&typeof n==`object`){n.value=t;return}e.key=t}function y7(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!g7(e))continue;let t=_7(e);t!==null&&n.push(t)}return n}function b7(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function fce(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:Dm(e.toString(Cm))}function pce(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:d7}:null}function x7(e){let t=fce(e),n=pce(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function mce(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:um}};let{doc:n,map:r}=p7(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{b7(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=mm.safeParse(r);if(!t.success)return{ok:!1,error:{kind:`invalid_value`,key:e,reason:t.error.issues[0]?.message??`invalid value`}};n.set(e,Em(n,n.get(e,!0),t.data))}return x7(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function hce(e,t,n,r={}){if(t===`frontmatter`||n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:um}};let{doc:i,map:a}=p7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(t===n)return{ok:!0,nextFenced:e};let o=i.contents;if(!o||!(`items`in o)||!Array.isArray(o.items))return{ok:!1,error:{kind:`unknown_key`,key:t}};let s=o.items.find(e=>g7(e)&&_7(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>g7(e)&&e!==s&&_7(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return v7(s,n),x7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function S7(e,t){let{doc:n,map:r}=p7(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let i=n.contents;if(!i||!(`items`in i)||!Array.isArray(i.items))return{ok:!0,nextFenced:e};let a=y7(n);if(a.length!==t.length||!C7(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(g7),r=[];for(let n of t){let i=e.findIndex(e=>_7(e)===n);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};let[o]=e.splice(i,1);o&&r.push(o)}return i.items=r,x7(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function C7(e,t){let n=new Map;for(let t of e)n.set(t,(n.get(t)??0)+1);for(let e of t){let t=(n.get(e)??0)-1;if(t<0)return!1;n.set(e,t)}for(let e of n.values())if(e!==0)return!1;return!0}function w7(e){if(e.length===0)return{kind:`invalid_path`,path:[...e],reason:`path must have at least one segment`};for(let t=0;t<e.length;t++){let n=e[t];if(typeof n!=`string`&&typeof n!=`number`)return{kind:`invalid_path`,path:[...e],reason:`path segment at index ${t} must be string or number`};if(typeof n==`number`&&(!Number.isInteger(n)||n<0))return{kind:`invalid_path`,path:[...e],reason:`numeric path segment at index ${t} must be a non-negative integer`}}return e[0]===`frontmatter`?{kind:`reserved_key`,key:um}:null}function gce(e,t,n){let r=w7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=p7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=mm.safeParse(n);if(!o.success)return{ok:!1,error:{kind:`invalid_value`,key:String(t[t.length-1]),reason:o.error.issues[0]?.message??`invalid value`}};try{return b7(i),i.setIn(t,Em(i,i.getIn(t,!0),o.data)),x7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function _ce(e,t){let n=w7(t);if(n)return{ok:!1,error:n};let{doc:r,map:i}=p7(e);if(i===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{return r.getIn(t,!0)===void 0?{ok:!0,nextFenced:e}:(r.deleteIn(t),x7(r))}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function vce(e,t){if(t.length===0){let t=e.contents;return Xo(t)?t:null}let n=e.getIn(t,!0);return Xo(n)?n:null}function yce(e,t,n,r={}){let i=w7(t);if(i)return{ok:!1,error:i};let a=t[t.length-1];if(typeof a!=`string`)return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot rename: last path segment must be a string (map key)`}};if(t.length===1&&n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:um}};let{doc:o,map:s}=p7(e);if(s===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(a===n)return{ok:!0,nextFenced:e};let c=vce(o,t.slice(0,-1));if(!c)return{ok:!1,error:{kind:`unknown_key`,key:a}};let l=c.items.find(e=>g7(e)&&_7(e)===a);if(!l)return{ok:!1,error:{kind:`unknown_key`,key:a}};if(!r.allowDuplicate&&c.items.some(e=>g7(e)&&e!==l&&_7(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return v7(l,n),x7(o)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function bce(e,t,n){if(t.length===0)return S7(e,n);let r=w7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=p7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!Xo(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a map`}};let s=[];for(let e of o.items){if(!g7(e))continue;let t=_7(e);t!==null&&s.push(t)}if(s.length!==n.length||!C7(s,n))return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};try{let e=o.items.filter(g7),t=[];for(let r of n){let i=e.findIndex(e=>_7(e)===r);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};let[a]=e.splice(i,1);a&&t.push(a)}return o.items=t,x7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function xce(e,t,n){let r=w7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=p7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!$o(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a sequence`}};let s=o,c=s.items.length,l=Array.from({length:c},(e,t)=>t),u=[...n];if(!Sce(u,c))return{ok:!1,error:{kind:`reorder_mismatch`,expected:l.map(String),got:u.map(String)}};try{let e=s.items.slice();return s.items=u.map(t=>e[t]),x7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Sce(e,t){if(e.length!==t)return!1;let n=Array(t).fill(!1);for(let r of e){if(!Number.isInteger(r)||r<0||r>=t||n[r])return!1;n[r]=!0}return!0}var Cce=L({changes:I(io(`kind`,[L({key:N(),kind:B(`added`),after:mm}).loose(),L({key:N(),kind:B(`removed`),before:mm}).loose(),L({key:N(),kind:B(`changed`),before:mm,after:mm}).loose()])),unparseable:L({before:N(),after:N()}).loose().nullable()}).loose();function T7(e){let{fenced:t}=f7(e),n=p7(t);if(n.map===null)return{fenced:t,map:{},keys:[],parseError:n.parseError};let r=Om(n.doc);return{fenced:t,map:n.map,keys:r.length>0?r:Object.keys(n.map),parseError:void 0}}function wce(e,t){let n=T7(e),r=T7(t);if(n.parseError!==void 0||r.parseError!==void 0)return{changes:[],unparseable:{before:n.fenced,after:r.fenced}};let i=[],a=new Set;for(let e of r.keys){if(a.has(e))continue;a.add(e);let t=r.map[e];if(t===void 0)continue;let o=n.map[e];if(o===void 0){i.push({key:e,kind:`added`,after:t});continue}Sm(o,t)||i.push({key:e,kind:`changed`,before:o,after:t})}for(let e of n.keys){if(a.has(e))continue;a.add(e);let t=n.map[e];t!==void 0&&i.push({key:e,kind:`removed`,before:t})}return{changes:i,unparseable:null}}var Tce=L({stackIndex:P().int().min(0),ts:P().int().min(0),additions:P().int().min(0),deletions:P().int().min(0)}).loose(),Ece=L({docName:N().min(1),additionsTotal:P().int().min(0),deletionsTotal:P().int().min(0),lastTs:P().int().min(0),bursts:I(Tce)}).loose(),Dce=L({displayName:N().min(1),color:N().min(1),icon:N().optional(),connectionId:N().min(1)}).loose(),Oce=L({sessionAlive:F(),agent:Dce.nullable(),files:I(Ece)}).loose(),kce=L({diff:N(),before:N(),after:N(),properties:Cce,generatedAt:P().int().min(0)}).loose();L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose();var Ace=L({displayName:N().min(1),icon:N(),color:N().min(1),currentDoc:N().nullable(),mode:z([`idle`,`writing`]),ts:P().int().min(0)}).loose();L({presence:co(N().min(1),Ace)}).loose();var jce=L({sessionId:N().min(1),agentType:N().min(1),ts:P().int().min(0),insertedChars:P().int().min(0),deletedChars:P().int().min(0)}).loose();L({effects:I(L({"doc.name":N().min(1),entries:I(jce)}).loose())}).loose(),L({decisions:I(L({ts:P().int().min(0),decision:N().min(1),kind:N().min(1),"doc.name":N().min(1),pathRole:N().min(1)}).loose())}).loose(),co(N().min(1),F()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),L({path:N().min(1,`path must be non-empty`)}).loose(),L({}).loose();var Mce=L({fromDocName:N().min(1),toDocName:N().min(1)}).loose(),Nce=L({fromPath:N().min(1),toPath:N().min(1)}).loose();L({}).loose(),L({path:N().min(1),...P$,summary:F$}).loose();var Pce=L({docName:N().min(1)}).loose();L({path:N().min(1),...P$,summary:F$}).loose();var Fce=L({path:N().min(1)}).loose();L({kind:z([`file`,`folder`]),path:N().min(1),...P$,summary:F$}).loose();var Ice=L({kind:z([`file`,`folder`]),path:N().min(1),duplicatedDocNames:I(N().min(1))}).loose(),Lce=L({pages:I(L({docName:N().min(1),title:N(),docExt:N().min(1),size:P().int().nonnegative(),modified:N().min(1),icon:N().min(1).max(2048).optional()}).loose())}).loose(),Rce=L({level:P().int().min(1).max(6),text:N(),slug:N()}).loose(),zce=L({docName:N().min(1),headings:I(Rce)}).loose(),Bce=L({docName:N().min(1),rewrites:P().int().nonnegative()}).loose();L({kind:z([`file`,`folder`,`asset`]),fromPath:N().min(1),toPath:N().min(1),...P$,summary:F$}).loose();var Vce=L({renamed:I(Mce),renamedAssets:I(Nce),rewrittenDocs:I(Bce).optional(),summary:N5.optional()}).loose();L({kind:z([`file`,`folder`,`asset`]),path:N().min(1),...P$}).loose();var Hce=L({deletedDocNames:I(N().min(1))}).loose();L({kind:z([`file`,`folder`,`asset`]),path:N().min(1),...P$,summary:F$}).loose();var Uce=L({deletedDocNames:I(N().min(1))}).loose();L({docName:N().min(1),commitSha:N().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:F$,...P$}).loose(),L({restoredFrom:N().min(1),timestamp:N().min(1),summary:N5.optional(),warning:P5.optional(),warnings:R5.optional()}).loose();var Wce=/^#[0-9a-fA-F]{6}$/,Gce=L(Object.fromEntries(Td.map(e=>[e,N().regex(Wce,`must be a #rrggbb hex color`)]))),E7=N().min(1).refine(kd,{message:`must contain a non-whitespace character`}),D7=L({name:E7,author:E7.optional(),variant:z([`dark`,`light`]),palette:Gce}).loose(),Kce=L({name:N().min(1),scheme:D7,stem:N().min(1).optional(),extension:z([`.yaml`,`.yml`]).optional()}).loose(),qce=L({id:N().min(1),filename:N().min(1)}).loose(),Jce=L({id:N().min(1),scheme:D7}).loose(),Yce=L({id:N().min(1),filename:N().min(1)}).loose(),Xce=io(`existed`,[L({existed:B(!1)}).loose(),L({existed:B(!0),filename:N().min(1),scheme:D7}).loose()]),Zce=L({themes:I(io(`ok`,[L({ok:B(!0),id:N().min(1),filename:N().min(1),scheme:D7}),L({ok:B(!1),filename:N().min(1),id:N().min(1).optional(),code:N().min(1),conflictingFilenames:I(N().min(1)).min(2).optional()})])),truncated:F()}).loose(),Qce=z([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),$ce=L({label:N().min(1),webUrl:Da().nullable()}).loose(),ele=io(`checkStatus`,[L({checkStatus:B(`allowed`)}).loose(),L({checkStatus:B(`denied`),deniedReason:z([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`])}).loose(),L({checkStatus:B(`unknown`),unknownError:z([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),O7=z([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),tle=z(yu),nle=z([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);L({state:Qce,lastSyncUtc:N().nullable(),lastFetchUtc:N().nullable(),lastPushedSha:N().nullable(),ahead:P().int().min(0),behind:P().int().min(0),consecutiveFailures:P().int().min(0),conflictCount:P().int().min(0),hasRemote:F(),syncEnabled:F(),identityUnresolved:F(),remote:$ce.nullable().optional(),pushError:N().optional(),pushErrorCode:O7.optional(),pullError:N().optional(),pullErrorCode:O7.optional(),pausedReason:N().optional(),pushPermission:ele.optional(),syncMode:tle.optional(),lastPullUtc:N().nullable().optional(),lastPullOutcome:nle.nullable().optional()}).loose(),L({op:z([`sync`,`push`,`pull`]).optional()}).loose(),L({op:z([`sync`,`push`,`pull`])}).loose(),L({conflicts:I(L({file:N().min(1),detectedAt:N().min(1),oursSha:N().optional(),theirsSha:N().optional(),baseSha:N().optional()}).loose())}).loose(),L({file:N().min(1),strategy:z([`mine`,`theirs`,`content`,`delete`]),content:N().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),L({}).loose(),L({file:N().min(1),base:N(),ours:N(),theirs:N(),kind:z([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:N().nullable()}).loose(),L({plan:Io(e=>e!==void 0,{message:`plan is required`})}).loose(),L({plan:Io(e=>e!==void 0,{message:`plan is required`})}).loose(),L({result:Io(e=>e!==void 0,{message:`result is required`})}).loose(),L({packId:N().min(1)}).strict(),L({installedHosts:I(N()),skills:I(L({name:N().min(1),created:F()}).strict())}).strict();var rle=L({path:N().min(1),summary:N().min(1)}).loose(),ile=L({files:P().int().nonnegative(),folders:P().int().nonnegative()}).loose();L({packs:I(L({id:N().min(1),name:N().min(1),description:N().min(1),defaultSubfolder:N().optional(),folders:I(rle),entryCounts:ile}).loose())}).loose(),L({noOpen:F().optional(),out:N().min(1).optional()}).loose();var k7=L({reason:z([`unsupported-platform`,`spawn-error`]),message:N()}).loose();io(`status`,[L({status:B(`installed`),outputPath:N(),size:P().int().nonnegative(),sha256:N(),skillVersion:N()}).loose(),L({status:B(`built`),outputPath:N(),size:P().int().nonnegative(),sha256:N(),skillVersion:N(),handoffError:k7.optional()}).loose(),L({status:B(`failed`),buildError:N()}).loose(),L({status:B(`skip-current`),skillVersion:N(),recordedAt:N().optional()}).loose()]);var A7=z(qp);function ale(e){return e===`agents`||qp.includes(e)}var ole=L({alwaysOn:P().int().nonnegative(),onTrigger:P().int().nonnegative(),onDemand:P().int().nonnegative()}).strict(),sle=[`.md`,`.mdx`,`.txt`],cle=5e3,lle=4;function j7(e){return Math.round(e/lle)}function ule(e){let t=e.lastIndexOf(`.`);return t===-1?!1:sle.includes(e.slice(t).toLowerCase())}function dle(e){let t=j7((e.name??``).length+(e.description??``).length),n=j7(sm(e.skillMd).body.length),r=0;for(let t of e.files)t.content!==null&&t.relPath!==`SKILL.md`&&ule(t.relPath)&&(r+=t.content.length);return{alwaysOn:t,onTrigger:n,onDemand:j7(r)}}L({tags:I(L({name:N().min(1),count:P().int().nonnegative(),isLeaf:F()}).loose())}).loose();var fle=L({docName:N().min(1),title:N(),matchingTags:I(N().min(1)),snippet:N().nullable()}).loose();L({name:N().min(1),docs:I(fle)}).loose(),L({folder:Xa(),frontmatter_local:co(N(),Xa()).nullable()}).loose(),L({path:N(),frontmatter:co(N(),Xa()).optional()}).loose(),L({applied:Xa()}).loose();var M7=co(N(),Xa()).meta({description:`Free-form frontmatter map embedded in template payloads.`});L({template:L({name:N().min(1),folder:N(),scope:z([`local`,`inherited`]),path:N().min(1),frontmatter:M7,body:N()}).strict()}).strict();var ple=L({templates:I(L({name:N().min(1),title:N().optional(),description:N().optional(),path:N().min(1),source_folder:N()}).strict()),truncated:F()}).strict();L({folder:N(),name:N(),body:N().optional(),frontmatter:M7.optional(),...P$,summary:F$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({sourcePath:N().min(1),targetFolder:N(),name:N().optional(),title:N().optional(),deleteSource:F().optional(),...P$,summary:F$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({existed:F(),path:N().min(1)}).strict(),L({fromFolder:N(),fromName:N(),toFolder:N(),toName:N(),body:N().optional(),frontmatter:M7.optional(),...P$,summary:F$}).strict(),L({from:N().min(1),to:N().min(1),committed:F()}).strict();var N7=z(yp),mle=/^[a-z0-9-]+$/,hle=/^[A-Za-z0-9_-]+$/,P7=L({name:N(),description:N()}).strict();L({skill:L({name:N().min(1),scope:N7,path:N().min(1),frontmatter:P7,body:N(),files:I(L({path:N().min(1),text:N().nullable()})).optional(),managed:F().optional()}).strict()}).strict();var gle=L({source:N().min(1),publisher:N().optional(),skill:N().optional(),marketplaceUrl:N().optional(),importedAt:N().min(1),autoUpdate:F().optional()}).strict(),_le=L({name:N().min(1),description:N().optional(),scope:N7,path:N().min(1),canonicalPath:N().min(1).optional(),absolutePath:N().min(1).optional(),installed:F(),hosts:I(N()),driftPaths:I(N()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:co(N(),N()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:I(N()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:I(N()).optional(),installableEditors:I(N()).optional(),linkMode:F().optional(),customPlacements:I(L({path:N(),mode:z([`copy`,`link`])}).strict()).optional(),managed:F().optional(),origin:gle.optional(),modified:F().optional(),revertable:F().optional(),ignored:F().optional(),size:ole.optional()}).strict();L({name:N().min(1),scope:N7,apply:F().optional()}).strict(),L({line:N().min(1),gitignorePath:N().min(1),applied:F(),alreadyTracked:F().optional()}).strict();var vle=L({skills:I(_le),truncated:F()}).strict();L({scope:N7.default(`project`),name:N().meta({description:`Managed skill name to create or update.`}),body:N().optional(),frontmatter:P7,...P$,summary:F$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({scope:N7.default(`project`),name:N(),dryRun:F().optional(),setAutoUpdate:F().optional(),...P$,summary:F$}).strict(),L({name:N().min(1),updated:F(),source:N().min(1),localBody:N().optional(),upstreamBody:N().optional(),gitTracked:F().optional(),warnings:I(N())}).strict(),L({scope:N7.default(`project`),name:N(),...P$,summary:F$}).strict(),L({name:N().min(1),baselineRef:N().min(1),restoredFiles:I(N()),warnings:I(N())}).strict(),L({existed:F(),path:N().min(1)}).strict(),L({scope:N7.default(`project`),fromName:N(),toName:N(),body:N().optional(),frontmatter:P7.optional(),...P$,summary:F$}).strict(),L({from:N().min(1),to:N().min(1),committed:F()}).strict(),L({name:N(),fromScope:N7,toScope:N7,...P$,summary:F$}).strict(),L({scope:N7,path:N().optional()}).strict(),L({scope:N7,name:N(),toName:N(),...P$,summary:F$}).strict(),L({name:N().min(1)}).strict(),L({name:N(),home:N().min(1)}).strict(),L({docName:N().min(1)}).strict();var F7=z([`reference`,`script`,`file`]);L({scope:N7.default(`project`),name:N(),path:N().min(1),content:N(),...P$,summary:F$}).strict(),L({path:N().min(1),created:F(),kind:F7,content:F()}).strict(),L({scope:N7.default(`project`),name:N(),from:N().min(1),to:N().min(1),...P$,summary:F$}).strict(),L({from:N().min(1),to:N().min(1),fromDocName:N().optional(),toDocName:N().optional()}).strict(),L({path:N().min(1),kind:F7,text:N()}).strict(),L({path:N().min(1),existed:F(),kind:F7}).strict();var I7=no([A7,B(`agents`)]),L7=N().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),R7=no([I7,L7]);L({scope:N7.default(`project`),name:N(),targets:I(I7).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:I(R7).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:I(R7).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:z([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:R7.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:F().optional(),setSource:N().min(1).optional(),place:L({dir:N().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:z([`copy`,`link`])}).strict().optional(),convert:L({target:R7.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:z([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:L({path:N().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...P$,summary:F$,fork:L({editor:N().min(1),action:z([`align`,`make-source`,`rename`]),toName:N().optional()}).strict().optional()}).strict().refine(e=>!(e.targets!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>!(e.source!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"}),L({name:N().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:I(N()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:F().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:I(N()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:I(z([`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`])).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:N().optional(),sourceMovedTo:N().optional()}).strict(),L({scope:N7.default(`project`),name:N().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),L({name:N().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:F().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict();var yle=L({targets:I(A7),configured:F(),folders:I(L({scope:N7,host:N(),root:N(),state:z([`own`,`linked`,`linked-parent`,`absent`]),target:N().optional(),drift:B(!0).optional(),expected:N().optional()}).strict()).optional()}).strict(),z7=L({action:B(`link`),scope:N7,root:N().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:N().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}),B7=L({action:B(`unlink`),scope:N7,root:N().min(1).meta({description:`The linked folder to materialize back.`}),exclude:I(N().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),V7=L({action:B(`add-root`),scope:N7,root:L7.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),ble=io(`action`,[z7.extend({preview:F().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),B7,V7]);io(`action`,[z7.strict(),B7,V7]),L({folderAction:ble}).strict();var H7=L({moves:I(N()),drops:I(N()),removes:I(N()),replaces:I(N()),conflicts:I(N()),strays:I(N())}).strict();L({targets:I(A7),reprojected:I(L({name:N(),hosts:I(N())}).strict()),bundleHosts:I(N()),removedFrom:I(N()),folder:L({moved:I(N()),dropped:I(N()),linked:I(N())}).strict().optional(),preview:H7.optional()}).strict(),L({scope:N7.default(`project`),name:N(),version:N().regex(/^[0-9a-f]{40}$/i),...P$,summary:F$}).strict(),L({name:N().min(1),version:N(),restoredFiles:I(N()),warnings:I(N())}).strict(),L({query:N().optional(),intent:z([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:z([`navigation`,`relevance`]).optional(),scopes:I(z([`page`,`folder`,`content`,`file`])).optional(),scope:N().optional(),limit:P().int().nonnegative().optional(),semantic:F().optional(),source:z([`omnibar`,`mcp`,`http`]).optional()}).loose();var xle=L({kind:z([`page`,`folder`,`content`,`file`]),path:N().min(1),title:N(),score:P(),signals:co(N(),Xa()),snippet:N().optional()}).loose(),Sle=L({capable:F(),applied:F(),coverage:L({embedded:P().int().nonnegative(),total:P().int().nonnegative()})}).loose();L({enabled:F(),keyPresent:F(),keyNotRequired:F(),keySource:z([`project`,`file`,`env`]).nullable(),keyHint:N().nullable(),ready:F(),capable:F(),embedded:P().int().nonnegative(),total:P().int().nonnegative()}).loose(),L({query:N(),intent:z([`autocomplete`,`full_text`,`omnibar`]),results:I(xle),elapsedMs:P().nonnegative(),semantic:Sle.optional(),truncated:F().optional(),ready:F().optional()}).loose();var Cle=L({version:N().min(1),recordedAt:N().min(1)}).loose();L({currentVersion:N().min(1),targets:co(N(),Cle.nullable())}).loose(),L({scope:N7.default(`project`),source:N().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:N().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:F().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:F().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...P$,summary:F$}).strict(),L({scope:N7.default(`project`),source:N().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:I(N().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:F().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:F().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...P$,summary:F$}).strict(),L({results:I(L({requested:N(),status:z([`imported`,`already-imported`,`not-found`,`failed`]),name:N().optional(),collisionRenamedFrom:N().optional(),warnings:I(N()),error:N().optional()}).loose()),imported:P(),alreadyImported:P(),failed:P()}).loose();var wle=L({source:N(),ref:N().optional(),contentHash:N(),publisher:N().optional()}).loose();L({name:N().min(1).meta({description:`Managed skill name created or matched.`}),path:N().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:F().meta({description:`True when this request created new source files.`}),alreadyImported:F().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:N().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:wle,warnings:I(N()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`})}).loose();var Tle=`server-info`,Ele=`branch-switched`,Dle=`disk-ack`,Ole=`config-validation-rejected`,kle=`config-ignore-nested-error`,U7=z([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]),Ale=L({v:B(1),ch:B(Tle),seq:P(),serverInstanceId:N().min(1),currentBranch:N().min(1).optional()}).loose(),jle=L({v:B(1),ch:B(Ele),seq:P(),branch:N().min(1)}).loose(),Mle=L({v:B(1),ch:U7,seq:P()}).loose(),Nle=L({v:B(1),ch:B(Dle),seq:P(),docName:N().min(1),sv:N().min(1)}).loose(),Ple=L({v:B(1),ch:B(Ole),seq:P(),docName:N().min(1),error:rp}).loose(),Fle=L({v:B(1),ch:B(kle),seq:P(),path:N().min(1),error:N().min(1)}).loose();function Ile(e){let t;try{t=new URL(e)}catch{return null}let n=t.pathname.match(/^\/video\/(\d+)/);if(n)return n[1]??null;let r=t.pathname.match(/^\/(\d+)/);return r?r[1]??null:null}function Lle(e){if(typeof e!=`string`||e.length===0)return e;let t=p2(e);if(t){let e=t.noCookie?`www.youtube-nocookie.com`:`www.youtube.com`,n=t.startSeconds===null?``:`?start=${t.startSeconds}`;return`https://${e}/embed/${t.id}${n}`}if(c2(e)){let t=Ile(e);return t?`https://player.vimeo.com/video/${t}`:e}let n=a2(e);if(n){let e=n.startRaw===null?``:`?t=${n.startRaw}`;return`https://www.loom.com/embed/${n.id}${e}`}return e}var Rle=`https://api.github.com/repos/inkeep/open-knowledge`;async function zle(e){let{signal:t,...n}=e??{},r=t?AbortSignal.any([AbortSignal.timeout(5e3),t]):AbortSignal.timeout(5e3);try{let e=await fetch(Rle,{headers:{accept:`application/vnd.github+json`,"user-agent":`openknowledge.ai`},...n,signal:r});if(!e.ok)return console.warn(`[github-stars] GitHub API responded ${e.status}`),null;let t=await e.json();return typeof t.stargazers_count==`number`?t.stargazers_count:null}catch(e){return console.warn(`[github-stars] fetch failed: ${e instanceof Error?e.message:String(e)}`),null}}function Ble(e){if(!e)return{height:null,viewerFragment:``};let t=e.split(`&`).filter(e=>e.length>0),n=null,r=[];for(let e of t){let t=e.indexOf(`=`);if(t===-1){r.push(e);continue}let i=e.slice(0,t),a=e.slice(t+1);if(i===`height`){let e=Number.parseInt(a,10);!Number.isNaN(e)&&e>0&&(n=e);continue}r.push(e)}return{height:n,viewerFragment:r.join(`&`)}}new YJ.default;var Vle=L({path:I(no([N(),P()])),message:N(),issueCode:N()});io(`code`,[L({code:B(`SCHEMA_INVALID`),issues:I(Vle)}),L({code:B(`WRITE_ERROR`),detail:N()})]);function Hle(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function Ule(e){if(e.code!==`SCHEMA_INVALID`)return{};let t={};for(let n of e.issues){let e=n.path[0];typeof e==`string`&&(t[e]=t[e]?`${t[e]}; ${n.message}`:n.message)}return t}var W7=/^---[ \t]*\r?\n---[ \t]*(\r?\n|$)/,Wle=/^---([ \t]*)(?=\r?\n|$)/,G7=e=>e.includes(`\r
572
+ `?(c+=1,l=1):l+=1;return{line:c,column:l}};for(let e of o.matchAll(Doe)){let{index:i}=e;if((a===void 0?o[i-1]:n[a+i-1])===`!`)continue;let s=r&&a!==void 0?{start:u(i),end:u(i+e[0].length)}:void 0;t.message(Ooe(e[0]),s)}})}),Aoe=[`index`,`log`];function joe(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return t;let r=t.slice(n).toLowerCase();return CX.includes(r)?t.slice(0,n):t}var Moe=D5(`reserved-casing`,(e,t)=>{let n=t.data.okfDocName;if(n===void 0)return;let r=joe(n),i=r.toLowerCase();Aoe.includes(i)&&r!==i&&t.message(`This file is named "${r}", but the Open Knowledge Format only recognizes "${i}". On a case-sensitive filesystem a consumer reads it as an ordinary concept document rather than the reserved file it is meant to be.`)}),j5=[{id:`no-wiki-links`,rule:koe},{id:`log-shape`,rule:Eoe},{id:`index-shape`,rule:xoe},{id:`reserved-casing`,rule:Moe}],Noe=j5.map(e=>e.rule);function Poe(e){return e===void 0?Noe:j5.filter(t=>w5(e,t.id)).map(e=>e.rule)}var Foe=ro([F(),z(wd),lo(N(),Za())]),Ioe={id:`markdownlint`,sliceSchema:L({enabled:F(),rules:lo(N(),Foe)}),defaultSlice:{enabled:!1,rules:d5},async lint(e,t){return Xae(e,f5(t.rules))},fix(e,t){return Yae(e,f5(t.rules))}},Loe=L({appliesTo:ro([N(),I(N())]).optional(),file:N(),enabled:F().optional(),key:N().optional(),schema:lo(N(),Za()).optional()}),M5=[Ioe,{id:`frontmatter`,sliceSchema:L({enabled:F(),schemas:I(Loe)}),defaultSlice:{enabled:!1,schemas:[]},async lint(e,t,n){return S5(e,_5(t.schemas,n.docName))}},{id:`okf`,sliceSchema:L({enabled:F(),rules:lo(N(),F()).optional(),generate:L({index:F().optional()}).optional()}),defaultSlice:{enabled:!1},async lint(e,t,n){return[...voe(e,Poe(t.rules),n.docName),...hoe(e,t.rules,n.docName)]}}],Roe={enabled:!0,plugins:Object.fromEntries(M5.map(e=>[e.id,e.defaultSlice]))},zoe=new Set([`.markdownlint.json`,`.markdownlint.jsonc`]);function Boe(e){return zoe.has(e)}L({docName:M$,summary:F$,content:N().optional(),...P$}).loose(),L({docName:M$,summary:F$,markdown:N(),position:z([`append`,`prepend`,`replace`]).optional(),extension:z(CX).optional(),...P$}).loose(),L({docName:M$,summary:F$,find:N().min(1),replace:N(),offset:P().int().nonnegative().optional(),...P$}).loose(),L({docName:M$,connectionId:N().min(1),scope:z([`last`,`session`,`file`,`count`]).optional(),count:P().int().positive().optional(),...P$}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});var N5=L({value:N(),truncatedFrom:P().int().nonnegative().optional(),hint:N().optional()}).loose(),Voe=ao(`kind`,[L({kind:B(`inline`),content:N()}),L({kind:B(`truncated`),byteLength:P().int().nonnegative(),hint:N()})]),P5=L({kind:B(`content-divergence`),intendedBytes:P().int().nonnegative(),actualBytes:P().int().nonnegative(),byteDelta:P().int(),divergenceType:N().optional(),currentState:Voe.optional(),hint:N().optional()}).loose(),Hoe=L({type:B(`orphan`),parentCandidates:I(N()),message:N()}).loose(),F5=L({kind:B(`disk-edit-reconciled`),intendedBytes:P().int().nonnegative(),actualBytes:P().int().nonnegative(),byteDelta:P().int(),mergeOutcome:N().optional(),hint:N().optional()}).loose(),I5=ao(`kind`,[P5,F5]),Uoe=L({kind:B(`mermaid-parse-error`),fenceIndex:P().int().positive(),fenceFirstLine:N(),message:N(),line:P().int().positive().optional()}).loose(),L5=L({href:N(),targetKind:N(),role:N(),sourceForm:N(),resolvedTarget:N().nullable(),reason:N(),resolutionMethod:N(),fallbackTarget:N().nullable().optional(),definition:L({line:P().int().nonnegative(),label:N()}).loose().optional()}).loose(),R5=I(ao(`kind`,[P5,F5,Uoe,L({kind:B(`lint-violation`),source:N(),code:N(),message:N(),severity:z([`error`,`warning`,`info`,`hint`]),line:P().int().positive(),column:P().int().positive(),linkTarget:N().optional(),localTarget:L5.optional()}).loose()])).min(1),z5=I(L({href:N(),resolvedTo:N().nullable(),reason:z([`no-such-doc`,`no-such-file`,`unresolvable`]),localTarget:L5.optional()}).loose());L({timestamp:N().min(1),summary:N5.optional(),warning:I5.optional(),warnings:R5.optional()}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),hints:I(Hoe).optional(),summary:N5.optional(),warning:I5.optional(),warnings:R5.optional(),brokenLinks:z5}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),summary:N5.optional(),warning:I5.optional(),warnings:R5.optional(),brokenLinks:z5}).loose(),L({docName:N().min(1),scope:z([`last`,`session`,`count`]),undone:F()}).loose(),L({docs:I(L({docName:N$,markdown:N(),position:z([`append`,`prepend`,`replace`]).optional(),extension:z(CX).optional(),summary:F$}).loose()).min(1).max(100),...P$}).loose();var Woe=L({type:t1,title:N(),detail:N().optional()}).loose(),Goe=ao(`status`,[L({status:B(`written`),docName:N().min(1),summary:N5.optional(),warnings:R5.optional(),brokenLinks:z5}).loose(),L({status:B(`error`),docName:N().min(1),error:Woe}).loose()]);L({timestamp:N().min(1),results:I(Goe),written:P().int().nonnegative(),failed:P().int().nonnegative()}).loose(),L({docName:M$,patch:lo(N(),ro([mm,Ya()])),types:lo(N(),z(dm)).optional(),summary:F$,...P$}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),appliedKeys:I(N()),summary:N5.optional(),warning:I5.optional(),warnings:R5.optional(),brokenLinks:z5}).loose();function Koe(e){return{enabled:e.enabled??!0,plugins:{markdownlint:{...e.markdownlint,rules:e.markdownlint.rules??d5},frontmatter:{enabled:e.frontmatter?.enabled??!1,schemas:e.frontmatter?.schemas??[]},okf:{enabled:e.okf?.enabled??!1,...e.okf?.rules===void 0?{}:{rules:e.okf.rules},generate:{index:e.okf?.generate?.index??!1}}}}}var qoe=Object.fromEntries(M5.map(e=>[e.id,e.sliceSchema])),Joe=L({effective:L({enabled:F(),plugins:L(qoe)}),configFile:N().nullable().optional(),configProblems:I(N()).optional()}),Yoe=ro([F(),lo(N(),Za())]);L({ruleId:N().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:ro([Yoe,Ya()])}),L({file:N().min(1).max(512),delete:B(!0).optional(),field:N().min(1).max(256).optional(),parentPath:I(ro([N().min(1).max(256),L({items:B(!0)}).strict()])).max(8).optional(),removeField:B(!0).optional(),renameTo:N().min(1).max(256).optional(),constraint:L({type:z([`string`,`number`,`boolean`,`array`,`object`]).nullable().optional(),enum:I(ro([N(),P(),F()])).nullable().optional(),itemsEnum:I(ro([N(),P(),F()])).nullable().optional(),itemsType:z([`string`,`number`,`boolean`,`object`]).nullable().optional(),pattern:N().nullable().optional(),format:N().nullable().optional(),description:N().max(2048).nullable().optional(),required:F().optional()}).optional()}).refine(e=>e.delete===void 0||e.field===void 0&&e.constraint===void 0&&e.removeField===void 0&&e.renameTo===void 0,{message:`delete cannot be combined with a field edit`}).refine(e=>[e.constraint,e.removeField,e.renameTo].filter(e=>e!==void 0).length<=1,{message:`constraint, removeField, and renameTo are mutually exclusive`}).refine(e=>e.removeField===void 0&&e.renameTo===void 0||e.field!==void 0,{message:`removeField and renameTo require field`}).refine(e=>e.parentPath===void 0||e.field!==void 0,{message:`parentPath requires field`}).refine(e=>e.field===void 0?e.constraint===void 0:e.constraint!==void 0||e.removeField!==void 0||e.renameTo!==void 0,{message:`field requires constraint, removeField, or renameTo`});var Xoe=L({schemas:I(N()),truncated:F()}).strict(),B5=L({line:P(),character:P()}),V5=L({start:B5,end:B5}),H5=L({range:V5,severity:z([`error`,`warning`,`info`,`hint`]),source:N(),code:N(),message:N(),fixes:I(L({range:V5,newText:N()})).optional(),frontmatterScope:z([`missing`,`invalid`]).optional(),frontmatterProperty:N().optional()});L({files:I(L({file:N(),diagnostics:I(H5),warnings:I(N()).optional()})),fileCount:P(),errorCount:P(),warningCount:P(),warnings:I(N())});var Zoe=H5.extend({linkTarget:N().optional(),localTarget:L5.optional()}),Qoe=L({files:I(L({file:N(),diagnostics:I(Zoe)})),fileCount:P(),errorCount:P(),warningCount:P(),warnings:I(N())}),U5=L({errorCount:P().int().nonnegative(),warningCount:P().int().nonnegative()}),$oe=L({files:I(L({file:N(),lint:U5,links:U5})),fileCount:P().int().nonnegative(),errorCount:P().int().nonnegative(),warningCount:P().int().nonnegative(),warnings:I(N())});L({docName:M$,summary:F$,...P$}).loose();var ese=L({file:N(),fixedCount:P(),diagnostics:I(H5),errorCount:P(),warningCount:P(),warning:N().optional()});function tse(e){let t=e.trim().replace(/^\.\//,``);if(!t.startsWith(`.ok/schemas/`))return!1;let n=t.slice(12);return n.length>0&&!n.includes(`/`)&&!n.includes(`\\`)&&n!==`.`&&n!==`..`}function nse(e){let t=e.trim().toLowerCase().split(`/`).pop()??``;return t.endsWith(`.schema.json`)&&t.length>12?!0:tse(e)&&t.endsWith(`.json`)}var W5=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}],rse=(()=>{let e=new Map;for(let t of W5){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();function G5(e){return rse.get(e.toUpperCase())??null}function ise(e,t){let n=G5(t);if(n===null)return;let r;for(let[t,i]of Object.entries(e))G5(t)===n&&(r={key:t,value:i});return r}var ase=[`Headings`,`Lists`,`Whitespace`,`Code`,`Links & images`,`Style`],ose=[[`headings`,`Headings`],[`bullet`,`Lists`],[`ul`,`Lists`],[`ol`,`Lists`],[`links`,`Links & images`],[`images`,`Links & images`],[`accessibility`,`Links & images`],[`code`,`Code`],[`language`,`Code`],[`emphasis`,`Style`],[`html`,`Style`],[`line_length`,`Whitespace`],[`whitespace`,`Whitespace`],[`hard_tab`,`Whitespace`],[`blank_lines`,`Whitespace`],[`indentation`,`Whitespace`]];function sse(e){for(let[t,n]of ose)if(e.tags.includes(t))return n;return`Style`}function cse(e){let t={lint:{errorCount:0,warningCount:0},links:{errorCount:0,warningCount:0}};for(let n of e){let e=n.source===`links`?t.links:t.lint;n.severity===`error`?e.errorCount+=1:e.warningCount+=1}return t}async function lse(e,t,n){if(!t.enabled)return[];let r=[];for(let i of M5){let a=t.plugins[i.id];if(a.enabled)try{r.push(...await i.lint(e,a,{docName:n}))}catch(e){console.warn(`[lint] plugin "${i.id}" failed${n?` on "${n}"`:``}`,e)}}return r}var use=/\p{M}+/gu,dse=/[^\p{L}\p{N}]+/gu,fse=/^-+|-+$/g;function K5(e){return e.trim().normalize(`NFKD`).replace(use,``).toLowerCase().replace(dse,`-`).replace(fse,``)}function pse(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function q5(e,t){let n=K5(e);return n?pse(n,t):``}function J5(e,t){let n=K5(e);return t?`#${n}-${K5(t)}`:`#${n}`}var Y5=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]),mse=new Map(V2.flatMap(e=>e.surface===`compat`&&Y5.has(e.rendersAs)?[[e.name,e]]:[]));function X5(e){let t={};for(let n of e.attributes){if(n.type!==`mdxJsxAttribute`)return null;let e=n.name.toLowerCase();if(!(e.length>=3&&e.startsWith(`on`)))if(n.value===null)t[n.name]=!0;else if(typeof n.value==`string`)t[n.name]=n.value;else return null}return t}function Z5(e){let t=e.name;if(!t||!Y5.has(t))return null;let n=X5(e);return n===null?null:{type:`element`,tagName:t,properties:n,children:[]}}function Q5(e){let t=e.name;if(!t)return null;let n=mse.get(t);if(!n)return null;let r=X5(e);if(r===null)return null;let i=n.translateProps(r),a={};for(let[e,t]of Object.entries(i))(typeof t==`string`||typeof t==`boolean`)&&(a[e]=t);return{type:`element`,tagName:n.rendersAs,properties:a,children:[]}}var hse=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-link`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:J5(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},gse=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-embed`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:J5(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},_se=(e,t)=>{let n=t,r=Z5(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=Q5(n);if(i){e.patch(t,i);let n=e.applyData(t,i);return n.tagName===`img`?{type:`element`,tagName:`p`,properties:{},children:[n]}:n}let a={type:`element`,tagName:`pre`,properties:{className:[`mdx-component`]},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]}]};return e.patch(t,a),e.applyData(t,a)},vse=(e,t)=>{let n=t,r=Z5(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=Q5(n);if(i)return e.patch(t,i),e.applyData(t,i);let a={type:`element`,tagName:`span`,properties:{className:[`mdx-inline`],dataJsxInline:``},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]};return e.patch(t,a),e.applyData(t,a)},yse=(e,t)=>{let n=t,r=n.data.reason||`unknown`,i=n.value||``,a=r.replace(/--/g,`—`),o={type:`comment`,value:` Parse error: ${a} `},s={type:`element`,tagName:`pre`,properties:{className:[`mdx-fallback`],dataRawMdxFallback:``,dataReason:a},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:i}]}]};return e.patch(t,s),[o,e.applyData(t,s)]},bse=(e,t)=>{let n={type:`element`,tagName:`mark`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},xse=(e,t)=>{let n=t,r={type:`element`,tagName:n.data?.sourceForm===`ins`?`ins`:`u`,properties:{},children:e.all(n)};return e.patch(t,r),e.applyData(t,r)};function $5(e){if(typeof e!=`object`||!e)return``;let t=e;return typeof t.value==`string`?t.value:Array.isArray(t.children)?t.children.map($5).join(``):``}var e7={wikiLink:hse,wikiLinkEmbed:gse,mdxJsxFlowElement:_se,mdxJsxTextElement:vse,rawMdxFallback:yse,mark:bse,underline:xse,tag:(e,t)=>{let n=t.value,r={type:`element`,tagName:`a`,properties:{className:[`tag`],dataTag:n,href:`#tag/${n}`},children:[{type:`text`,value:`#${n}`}]};return e.patch(t,r),e.applyData(t,r)},comment:(e,t)=>{let n={type:`comment`,value:$5(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},commentBlock:(e,t)=>{let n={type:`comment`,value:$5(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`sup`,properties:{id:`fnref-${n}`,dataFootnoteRef:``,dataFootnoteId:n,className:[`footnote-ref`]},children:[{type:`element`,tagName:`a`,properties:{href:`#fn-${n}`,className:[`footnote-ref-link`]},children:[{type:`text`,value:`[${n}]`}]}]};return e.patch(t,r),e.applyData(t,r)},footnoteDefinition:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`aside`,properties:{id:`fn-${n}`,dataFootnoteDef:``,dataFootnoteId:n,className:[`footnote-def`]},children:[{type:`element`,tagName:`div`,properties:{className:[`footnote-body`]},children:e.all(t)},{type:`element`,tagName:`a`,properties:{href:`#fnref-${n}`,className:[`footnote-backref`],ariaLabel:`Back to reference`},children:[{type:`text`,value:`↩`}]}]};return e.patch(t,r),e.applyData(t,r)}},Sse=/url\s*\(\s*['"]?\s*(?:javascript|vbscript|data)\s*:/i,Cse=/\bexpression\s*\(/i,wse=1e4;function Tse(e){return!(e.length>wse||Sse.test(e)||Cse.test(e))}function t7(e){for(let t of e.split(`,`)){let e=t.trim();if(e!==``&&!oZ(e.split(/\s+/)[0]??``))return!1}return!0}var Ese={a:[`href`,`title`],img:[`src`,`alt`,`title`],video:[`src`,`title`],audio:[`src`,`title`],code:[`className`]},Dse=new Set([`href`,`src`]),Ose=Ce(`<>`),n7=()=>e=>{h(e,`element`,e=>{let t=Ese[e.tagName.toLowerCase()],n=e.properties;if(!(!t||!n))for(let e of t){let t=n[e];if(Array.isArray(t)){let r=t.map(e=>typeof e==`string`?p3(e):e);r.some((e,n)=>e!==t[n])&&(n[e]=r);continue}if(typeof t!=`string`)continue;let r;if(Dse.has(e))if(t===`<>`||t===Ose)r=``;else{let e=p3(t);r=e===t?t:Ce(e)}else r=p3(t);r!==t&&(n[e]=r)}})},r7=()=>e=>{h(e,`element`,e=>{let t=e.tagName.toLowerCase(),n=e.properties;if(!n)return;if(t===`a`||t===`area`||t===`link`||t===`base`){let e=n.href;typeof e==`string`&&!oZ(e)&&delete n.href}if(t===`img`||t===`iframe`||t===`script`||t===`embed`||t===`source`||t===`audio`||t===`video`||t===`track`){let e=n.src;typeof e==`string`&&!oZ(e)&&delete n.src}if(t===`form`){let e=n.action;typeof e==`string`&&!oZ(e)&&delete n.action}if(t===`img`||t===`source`){let e=n.srcSet;typeof e==`string`&&!t7(e)&&delete n.srcSet;let t=n.srcset;typeof t==`string`&&!t7(t)&&delete n.srcset}if(t===`video`){let e=n.poster;typeof e==`string`&&!oZ(e)&&delete n.poster}let r=n.style;typeof r==`string`&&!Tse(r)&&delete n.style})};function kse(e){let t=Se().use(be,{handlers:e7}).use(n7).use(r7).use(cG),n=t.runSync(e);return String(t.stringify(n))}function Ase(e){let t=/\r?\n|\r/g,n=[],r=0,i=t.exec(e);for(;i!==null;)n.push(i7(e.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=t.exec(e);return n.push(i7(e.slice(r),r>0,!1)),n.join(``)}function i7(e,t,n){let r=0,i=e.length,a=e=>e===9||e===32;for(;t&&r<i&&a(e.charCodeAt(r));)r++;for(;n&&i>r&&a(e.charCodeAt(i-1));)i--;return i>r?e.slice(r,i):``}var a7=/\r?\n|\r/,jse=(e,t)=>{let n=Ase(String(t.value));if(!a7.test(n)){let r={type:`text`,value:n};return e.patch(t,r),e.applyData(t,r)}let r=n.split(a7),i=[];for(let e=0;e<r.length;e++)e>0&&i.push({type:`element`,tagName:`br`,properties:{},children:[]}),r[e].length>0&&i.push({type:`text`,value:r[e]});return i};function Mse(e){let t=Se().use(ie).use(GP,[`yaml`]).use(b8).use(O).use(B8).use(o3).use(O8).use(x3).use(be,{handlers:{...e7,text:jse}}).use(n7).use(r7).use(cG);return String(t.processSync(i3(b3(e))))}vI(),LF(),RF(),L({entries:I(L({level:z([`info`,`warn`,`error`]),message:N().max(oY),event:N().optional(),fields:lo(N(),Za()).optional(),ts:P().optional(),sourceId:N().optional(),lineNumber:P().optional()}).loose()).max(100),droppedSinceLastFlush:P().int().min(0).optional()}).loose(),L({accepted:P().int().min(0)}).loose();var Nse=L({exact:N().min(1),prefix:N(),suffix:N(),start:P().int().nonnegative(),end:P().int().nonnegative()}),Pse=I(ro([N(),P().int().nonnegative()])),Fse=ao(`kind`,[L({kind:B(`body`)}),L({kind:B(`property`),key:N().min(1),path:Pse.default([])})]).default({kind:`body`}),Ise=z([`anchored`,`orphaned`,`resolved`]),o7=L({threadId:N().min(1),docName:N().min(1),target:Fse,anchor:Nse.nullable(),state:Ise,queued:F(),latestComment:N(),createdBy:N().min(1),createdAt:P(),updatedAt:P().optional()}),s7=L({docName:N(),instruction:N(),property:N().nullable(),passage:L({exact:N(),prefix:N(),suffix:N()}).nullable(),anchorLost:F(),passageRepeats:F()}).loose(),c7=L({threadId:N(),ok:B(!0)}),l7=L({threadId:N(),ok:B(!1),error:B(`not-found`)});L({threads:I(o7)}).loose();var Lse=L({meta:o7,orphaned:F()}).loose(),Rse=L({threadId:N()}).loose();L({meta:o7,payload:s7}).loose();var zse=L({results:I(ro([c7.extend({meta:o7,payload:s7}),l7]))}).loose(),Bse=L({results:I(ro([c7.extend({meta:o7}),l7]))}).loose(),Vse=L({status:N().min(1),reason:N()}).loose(),Hse=L({docName:N().min(1),content:N(),lifecycle:Vse.nullable()}).loose(),u7=L({kind:z([`document`,`asset`,`folder`,`file`]).default(`document`),docName:N().min(1).optional(),docExt:N().min(1).default(`.md`),size:P().int().nonnegative(),modified:N().min(1),isSymlink:F().default(!1),canonicalDocName:N().nullable().default(null),targetPath:N().nullable().default(null),path:N().min(1).optional(),assetExt:N().min(1).optional(),mediaKind:z([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`,`excalidraw`]).nullable().optional(),referencedBy:I(N().min(1)).optional(),hasChildren:F().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`}),Use=L({documents:I(u7),truncated:F().optional()}).loose(),Wse=L({source:N().min(1),anchor:N().nullable(),title:N(),snippet:N().nullable()}).loose(),Gse=L({docName:N().min(1),backlinks:I(Wse)}).loose(),Kse=L({counts:lo(N().min(1),P().int().nonnegative())}).loose();L({counts:lo(N().min(1),P().int().nonnegative())}).loose();var qse=ao(`kind`,[L({kind:B(`doc`),docName:N().min(1),anchor:N().nullable(),title:N(),snippet:N().nullable()}).loose(),L({kind:B(`external`),url:N().min(1),title:N(),snippet:N().nullable()}).loose()]),Jse=L({role:N().min(1),sourceForm:N().min(1),targetKind:N().min(1),href:N(),resolvedTarget:N().nullable(),status:N().min(1),reason:N().nullable(),resolutionMethod:N().min(1),fallbackTarget:N().nullable().default(null),range:L({start:P().int().nonnegative(),end:P().int().nonnegative()}),line:P().int().nonnegative(),column:P().int().nonnegative(),definition:L({label:N(),line:P().int().nonnegative()}).nullable().default(null)}).loose(),Yse=L({docName:N().min(1),forwardLinks:I(qse),localTargets:I(Jse).optional()}).loose(),Xse=ao(`kind`,[L({id:N().min(1),kind:B(`doc`),docName:N().min(1),anchor:N().nullable(),label:N(),cluster:N().nullable(),category:N().nullable(),tags:I(N()).nullable(),managed:F().optional()}).loose(),L({id:N().min(1),kind:B(`external`),url:N().min(1),label:N()}).loose()]),Zse=L({source:N().min(1),target:N().min(1)}).loose(),Qse=L({nodes:I(Xse),links:I(Zse)}).loose(),$se=L({ts:P().int().min(0),url:N(),method:N(),ua:N().optional(),origin:N().optional(),referer:N().optional(),host:N().optional(),remote:N().optional(),secChUa:N().optional(),secChUaMobile:N().optional(),secChUaPlatform:N().optional(),secFetchSite:N().optional(),secFetchDest:N().optional(),secFetchMode:N().optional(),secFetchUser:N().optional()}).loose(),ece=L({app:ro([B(`cursor`),B(`codex`),B(`claude`),Ya()]),signals_fired:I(N())}).loose();L({entries:I($se),count:P().int().min(0),detection:ece}).loose(),L({writers:I(L({id:N().min(1),name:N().optional(),email:N().optional()}).loose()).optional(),summary:F$,...P$}).loose(),L({checkpointRef:N().min(1)}).loose();var tce=L({v:P().int().optional(),id:N().min(1),name:N().min(1),colorSeed:N().optional(),docs:I(N()),summaries:I(N()).optional()}).loose();L({entries:I(L({sha:N().min(1),timestamp:N().min(1),author:N(),authorEmail:N(),type:z([`checkpoint`,`wip`,`upstream`,`park`]),message:N(),contributors:I(tce),checkpoint:Za().nullable(),parentSha:N().nullable().optional()}).loose()),total:P().int().nonnegative().optional(),truncated:F().optional(),hasMore:F().optional()}).loose(),L({sha:N().regex(/^[0-9a-f]{40}$/i),content:N(),timestamp:N(),author:N()}).loose();var nce=L({contentDir:N().min(1),pathSeparator:z([`/`,`\\`]),symlinkResolved:F()}).loose();I(ao(`source`,[L({docName:N().min(1),timestamp:N().min(1),size:P().int().nonnegative(),source:B(`flat`)}).loose(),L({docName:N().min(1),timestamp:N().min(1),source:B(`timeline`),sha:N().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});var rce=L({domain:N().min(1),title:N().optional(),description:N().optional(),siteName:N().optional(),faviconDataUri:N().optional()}).loose();L({url:N()}).loose();var ice=ao(`ok`,[L({ok:B(!0),metadata:rce}).loose(),L({ok:B(!1),reason:N()}).loose()]),ace=L({orphans:I(L({docName:N().min(1),title:N()}).loose())}).loose(),oce=L({hubs:I(L({docName:N().min(1),title:N(),count:P().int().nonnegative()}).loose())}).loose(),sce=L({source:N().min(1),title:N(),snippet:N().nullable()}).loose();L({deadLinks:I(L({target:N().min(1),sources:I(sce)}).loose())}).loose(),L({target:L({docName:N().min(1),title:N(),aliases:I(N())}).loose(),mentions:I(L({source:N().min(1),excerpt:N(),offset:P().int().nonnegative()}).loose()),truncated:F()}).loose(),L({projectPath:N().min(1)}).loose();var cce=z([`not-a-git-worktree`,`init-failed`]);ao(`ok`,[L({ok:B(!0),projectPath:N().min(1)}).loose(),L({ok:B(!1),reason:cce,message:N().min(1)}).loose()]),L({host:N().min(1).optional()}).loose(),L({host:N().min(1).optional(),token:N().min(1)}).loose(),L({host:N(),login:N()}).loose(),L({key:N().min(1)}).loose(),L({keyPresent:F()}).loose();var lce=z([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]),uce=ao(`ok`,[L({ok:B(!0),endpoint:N().min(1),model:N().min(1),dimensions:P().int().positive()}).loose(),L({ok:B(!1),endpoint:N().min(1),model:N().min(1),reason:lce,status:P().int().optional()}).loose()]);L({name:N().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:N().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),L({authenticated:F()}).loose(),L({channel:z([`login`,`gh-login`]).default(`login`)}).loose(),L({}).loose();var d7=65536;function f7(e){let t=e.match(am);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function dce(e){if(e.trim()===``)return{doc:new ol({}),map:{}};let t;try{t=_u(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new ol({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=ym.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function p7(e){return e===``?{doc:new ol({}),map:{}}:dce(lm(e))}function m7(e){let{fenced:t}=f7(e),{map:n,parseError:r}=p7(t);return{map:n??{},parseError:r}}function h7(e){let{fenced:t}=f7(e);if(t===``)return[];let{doc:n,map:r}=p7(t);return r===null?[]:y7(n)}function g7(e){return typeof e==`object`&&!!e&&`key`in e}function _7(e){let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}function v7(e,t){let n=e.key;if(typeof n==`string`){e.key=t;return}if(n&&typeof n==`object`){n.value=t;return}e.key=t}function y7(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!g7(e))continue;let t=_7(e);t!==null&&n.push(t)}return n}function b7(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function fce(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:Dm(e.toString(Cm))}function pce(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:d7}:null}function x7(e){let t=fce(e),n=pce(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function mce(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:um}};let{doc:n,map:r}=p7(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{b7(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=mm.safeParse(r);if(!t.success)return{ok:!1,error:{kind:`invalid_value`,key:e,reason:t.error.issues[0]?.message??`invalid value`}};n.set(e,Em(n,n.get(e,!0),t.data))}return x7(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function hce(e,t,n,r={}){if(t===`frontmatter`||n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:um}};let{doc:i,map:a}=p7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(t===n)return{ok:!0,nextFenced:e};let o=i.contents;if(!o||!(`items`in o)||!Array.isArray(o.items))return{ok:!1,error:{kind:`unknown_key`,key:t}};let s=o.items.find(e=>g7(e)&&_7(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>g7(e)&&e!==s&&_7(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return v7(s,n),x7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function S7(e,t){let{doc:n,map:r}=p7(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let i=n.contents;if(!i||!(`items`in i)||!Array.isArray(i.items))return{ok:!0,nextFenced:e};let a=y7(n);if(a.length!==t.length||!C7(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(g7),r=[];for(let n of t){let i=e.findIndex(e=>_7(e)===n);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};let[o]=e.splice(i,1);o&&r.push(o)}return i.items=r,x7(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function C7(e,t){let n=new Map;for(let t of e)n.set(t,(n.get(t)??0)+1);for(let e of t){let t=(n.get(e)??0)-1;if(t<0)return!1;n.set(e,t)}for(let e of n.values())if(e!==0)return!1;return!0}function w7(e){if(e.length===0)return{kind:`invalid_path`,path:[...e],reason:`path must have at least one segment`};for(let t=0;t<e.length;t++){let n=e[t];if(typeof n!=`string`&&typeof n!=`number`)return{kind:`invalid_path`,path:[...e],reason:`path segment at index ${t} must be string or number`};if(typeof n==`number`&&(!Number.isInteger(n)||n<0))return{kind:`invalid_path`,path:[...e],reason:`numeric path segment at index ${t} must be a non-negative integer`}}return e[0]===`frontmatter`?{kind:`reserved_key`,key:um}:null}function gce(e,t,n){let r=w7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=p7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=mm.safeParse(n);if(!o.success)return{ok:!1,error:{kind:`invalid_value`,key:String(t[t.length-1]),reason:o.error.issues[0]?.message??`invalid value`}};try{return b7(i),i.setIn(t,Em(i,i.getIn(t,!0),o.data)),x7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function _ce(e,t){let n=w7(t);if(n)return{ok:!1,error:n};let{doc:r,map:i}=p7(e);if(i===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{return r.getIn(t,!0)===void 0?{ok:!0,nextFenced:e}:(r.deleteIn(t),x7(r))}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function vce(e,t){if(t.length===0){let t=e.contents;return Zo(t)?t:null}let n=e.getIn(t,!0);return Zo(n)?n:null}function yce(e,t,n,r={}){let i=w7(t);if(i)return{ok:!1,error:i};let a=t[t.length-1];if(typeof a!=`string`)return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot rename: last path segment must be a string (map key)`}};if(t.length===1&&n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:um}};let{doc:o,map:s}=p7(e);if(s===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(a===n)return{ok:!0,nextFenced:e};let c=vce(o,t.slice(0,-1));if(!c)return{ok:!1,error:{kind:`unknown_key`,key:a}};let l=c.items.find(e=>g7(e)&&_7(e)===a);if(!l)return{ok:!1,error:{kind:`unknown_key`,key:a}};if(!r.allowDuplicate&&c.items.some(e=>g7(e)&&e!==l&&_7(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return v7(l,n),x7(o)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function bce(e,t,n){if(t.length===0)return S7(e,n);let r=w7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=p7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!Zo(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a map`}};let s=[];for(let e of o.items){if(!g7(e))continue;let t=_7(e);t!==null&&s.push(t)}if(s.length!==n.length||!C7(s,n))return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};try{let e=o.items.filter(g7),t=[];for(let r of n){let i=e.findIndex(e=>_7(e)===r);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};let[a]=e.splice(i,1);a&&t.push(a)}return o.items=t,x7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function xce(e,t,n){let r=w7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=p7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!es(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a sequence`}};let s=o,c=s.items.length,l=Array.from({length:c},(e,t)=>t),u=[...n];if(!Sce(u,c))return{ok:!1,error:{kind:`reorder_mismatch`,expected:l.map(String),got:u.map(String)}};try{let e=s.items.slice();return s.items=u.map(t=>e[t]),x7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Sce(e,t){if(e.length!==t)return!1;let n=Array(t).fill(!1);for(let r of e){if(!Number.isInteger(r)||r<0||r>=t||n[r])return!1;n[r]=!0}return!0}var Cce=L({changes:I(ao(`kind`,[L({key:N(),kind:B(`added`),after:mm}).loose(),L({key:N(),kind:B(`removed`),before:mm}).loose(),L({key:N(),kind:B(`changed`),before:mm,after:mm}).loose()])),unparseable:L({before:N(),after:N()}).loose().nullable()}).loose();function T7(e){let{fenced:t}=f7(e),n=p7(t);if(n.map===null)return{fenced:t,map:{},keys:[],parseError:n.parseError};let r=Om(n.doc);return{fenced:t,map:n.map,keys:r.length>0?r:Object.keys(n.map),parseError:void 0}}function wce(e,t){let n=T7(e),r=T7(t);if(n.parseError!==void 0||r.parseError!==void 0)return{changes:[],unparseable:{before:n.fenced,after:r.fenced}};let i=[],a=new Set;for(let e of r.keys){if(a.has(e))continue;a.add(e);let t=r.map[e];if(t===void 0)continue;let o=n.map[e];if(o===void 0){i.push({key:e,kind:`added`,after:t});continue}Sm(o,t)||i.push({key:e,kind:`changed`,before:o,after:t})}for(let e of n.keys){if(a.has(e))continue;a.add(e);let t=n.map[e];t!==void 0&&i.push({key:e,kind:`removed`,before:t})}return{changes:i,unparseable:null}}var Tce=L({stackIndex:P().int().min(0),ts:P().int().min(0),additions:P().int().min(0),deletions:P().int().min(0)}).loose(),Ece=L({docName:N().min(1),additionsTotal:P().int().min(0),deletionsTotal:P().int().min(0),lastTs:P().int().min(0),bursts:I(Tce)}).loose(),Dce=L({displayName:N().min(1),color:N().min(1),icon:N().optional(),connectionId:N().min(1)}).loose(),Oce=L({sessionAlive:F(),agent:Dce.nullable(),files:I(Ece)}).loose(),kce=L({diff:N(),before:N(),after:N(),properties:Cce,generatedAt:P().int().min(0)}).loose();L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose();var Ace=L({displayName:N().min(1),icon:N(),color:N().min(1),currentDoc:N().nullable(),mode:z([`idle`,`writing`]),ts:P().int().min(0)}).loose();L({presence:lo(N().min(1),Ace)}).loose();var jce=L({sessionId:N().min(1),agentType:N().min(1),ts:P().int().min(0),insertedChars:P().int().min(0),deletedChars:P().int().min(0)}).loose();L({effects:I(L({"doc.name":N().min(1),entries:I(jce)}).loose())}).loose(),L({decisions:I(L({ts:P().int().min(0),decision:N().min(1),kind:N().min(1),"doc.name":N().min(1),pathRole:N().min(1)}).loose())}).loose(),lo(N().min(1),F()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),L({path:N().min(1,`path must be non-empty`)}).loose(),L({}).loose();var Mce=L({fromDocName:N().min(1),toDocName:N().min(1)}).loose(),Nce=L({fromPath:N().min(1),toPath:N().min(1)}).loose();L({}).loose(),L({path:N().min(1),...P$,summary:F$}).loose();var Pce=L({docName:N().min(1)}).loose();L({path:N().min(1),...P$,summary:F$}).loose();var Fce=L({path:N().min(1)}).loose();L({kind:z([`file`,`folder`]),path:N().min(1),...P$,summary:F$}).loose();var Ice=L({kind:z([`file`,`folder`]),path:N().min(1),duplicatedDocNames:I(N().min(1))}).loose(),Lce=L({pages:I(L({docName:N().min(1),title:N(),docExt:N().min(1),size:P().int().nonnegative(),modified:N().min(1),icon:N().min(1).max(2048).optional()}).loose())}).loose(),Rce=L({level:P().int().min(1).max(6),text:N(),slug:N()}).loose(),zce=L({docName:N().min(1),headings:I(Rce)}).loose(),Bce=L({docName:N().min(1),rewrites:P().int().nonnegative()}).loose();L({kind:z([`file`,`folder`,`asset`]),fromPath:N().min(1),toPath:N().min(1),...P$,summary:F$}).loose();var Vce=L({renamed:I(Mce),renamedAssets:I(Nce),rewrittenDocs:I(Bce).optional(),summary:N5.optional()}).loose();L({kind:z([`file`,`folder`,`asset`]),path:N().min(1),...P$}).loose();var Hce=L({deletedDocNames:I(N().min(1))}).loose();L({kind:z([`file`,`folder`,`asset`]),path:N().min(1),...P$,summary:F$}).loose();var Uce=L({deletedDocNames:I(N().min(1))}).loose();L({docName:N().min(1),commitSha:N().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:F$,...P$}).loose(),L({restoredFrom:N().min(1),timestamp:N().min(1),summary:N5.optional(),warning:P5.optional(),warnings:R5.optional()}).loose();var Wce=/^#[0-9a-fA-F]{6}$/,Gce=L(Object.fromEntries(Td.map(e=>[e,N().regex(Wce,`must be a #rrggbb hex color`)]))),E7=N().min(1).refine(kd,{message:`must contain a non-whitespace character`}),D7=L({name:E7,author:E7.optional(),variant:z([`dark`,`light`]),palette:Gce}).loose(),Kce=L({name:N().min(1),scheme:D7,stem:N().min(1).optional(),extension:z([`.yaml`,`.yml`]).optional()}).loose(),qce=L({id:N().min(1),filename:N().min(1)}).loose(),Jce=L({id:N().min(1),scheme:D7}).loose(),Yce=L({id:N().min(1),filename:N().min(1)}).loose(),Xce=ao(`existed`,[L({existed:B(!1)}).loose(),L({existed:B(!0),filename:N().min(1),scheme:D7}).loose()]),Zce=L({themes:I(ao(`ok`,[L({ok:B(!0),id:N().min(1),filename:N().min(1),scheme:D7}),L({ok:B(!1),filename:N().min(1),id:N().min(1).optional(),code:N().min(1),conflictingFilenames:I(N().min(1)).min(2).optional()})])),truncated:F()}).loose(),Qce=z([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),$ce=L({label:N().min(1),webUrl:Oa().nullable()}).loose(),ele=ao(`checkStatus`,[L({checkStatus:B(`allowed`)}).loose(),L({checkStatus:B(`denied`),deniedReason:z([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`])}).loose(),L({checkStatus:B(`unknown`),unknownError:z([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),O7=z([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),tle=z(yu),nle=z([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);L({state:Qce,lastSyncUtc:N().nullable(),lastFetchUtc:N().nullable(),lastPushedSha:N().nullable(),ahead:P().int().min(0),behind:P().int().min(0),consecutiveFailures:P().int().min(0),conflictCount:P().int().min(0),hasRemote:F(),syncEnabled:F(),identityUnresolved:F(),remote:$ce.nullable().optional(),pushError:N().optional(),pushErrorCode:O7.optional(),pullError:N().optional(),pullErrorCode:O7.optional(),pausedReason:N().optional(),pushPermission:ele.optional(),syncMode:tle.optional(),lastPullUtc:N().nullable().optional(),lastPullOutcome:nle.nullable().optional()}).loose(),L({op:z([`sync`,`push`,`pull`]).optional()}).loose(),L({op:z([`sync`,`push`,`pull`])}).loose(),L({conflicts:I(L({file:N().min(1),detectedAt:N().min(1),oursSha:N().optional(),theirsSha:N().optional(),baseSha:N().optional()}).loose())}).loose(),L({file:N().min(1),strategy:z([`mine`,`theirs`,`content`,`delete`]),content:N().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),L({}).loose(),L({file:N().min(1),base:N(),ours:N(),theirs:N(),kind:z([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:N().nullable()}).loose(),L({plan:Lo(e=>e!==void 0,{message:`plan is required`})}).loose(),L({plan:Lo(e=>e!==void 0,{message:`plan is required`})}).loose(),L({result:Lo(e=>e!==void 0,{message:`result is required`})}).loose(),L({packId:N().min(1)}).strict(),L({installedHosts:I(N()),skills:I(L({name:N().min(1),created:F()}).strict())}).strict();var rle=L({path:N().min(1),summary:N().min(1)}).loose(),ile=L({files:P().int().nonnegative(),folders:P().int().nonnegative()}).loose();L({packs:I(L({id:N().min(1),name:N().min(1),description:N().min(1),defaultSubfolder:N().optional(),folders:I(rle),entryCounts:ile}).loose())}).loose(),L({noOpen:F().optional(),out:N().min(1).optional()}).loose();var k7=L({reason:z([`unsupported-platform`,`spawn-error`]),message:N()}).loose();ao(`status`,[L({status:B(`installed`),outputPath:N(),size:P().int().nonnegative(),sha256:N(),skillVersion:N()}).loose(),L({status:B(`built`),outputPath:N(),size:P().int().nonnegative(),sha256:N(),skillVersion:N(),handoffError:k7.optional()}).loose(),L({status:B(`failed`),buildError:N()}).loose(),L({status:B(`skip-current`),skillVersion:N(),recordedAt:N().optional()}).loose()]);var A7=z(qp);function ale(e){return e===`agents`||qp.includes(e)}var ole=L({alwaysOn:P().int().nonnegative(),onTrigger:P().int().nonnegative(),onDemand:P().int().nonnegative()}).strict(),sle=[`.md`,`.mdx`,`.txt`],cle=5e3,lle=4;function j7(e){return Math.round(e/lle)}function ule(e){let t=e.lastIndexOf(`.`);return t===-1?!1:sle.includes(e.slice(t).toLowerCase())}function dle(e){let t=j7((e.name??``).length+(e.description??``).length),n=j7(sm(e.skillMd).body.length),r=0;for(let t of e.files)t.content!==null&&t.relPath!==`SKILL.md`&&ule(t.relPath)&&(r+=t.content.length);return{alwaysOn:t,onTrigger:n,onDemand:j7(r)}}L({tags:I(L({name:N().min(1),count:P().int().nonnegative(),isLeaf:F()}).loose())}).loose();var fle=L({docName:N().min(1),title:N(),matchingTags:I(N().min(1)),snippet:N().nullable()}).loose();L({name:N().min(1),docs:I(fle)}).loose(),L({folder:Za(),frontmatter_local:lo(N(),Za()).nullable()}).loose(),L({path:N(),frontmatter:lo(N(),Za()).optional()}).loose(),L({applied:Za()}).loose();var M7=lo(N(),Za()).meta({description:`Free-form frontmatter map embedded in template payloads.`});L({template:L({name:N().min(1),folder:N(),scope:z([`local`,`inherited`]),path:N().min(1),frontmatter:M7,body:N()}).strict()}).strict();var ple=L({templates:I(L({name:N().min(1),title:N().optional(),description:N().optional(),path:N().min(1),source_folder:N()}).strict()),truncated:F()}).strict();L({folder:N(),name:N(),body:N().optional(),frontmatter:M7.optional(),...P$,summary:F$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({sourcePath:N().min(1),targetFolder:N(),name:N().optional(),title:N().optional(),deleteSource:F().optional(),...P$,summary:F$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({existed:F(),path:N().min(1)}).strict(),L({fromFolder:N(),fromName:N(),toFolder:N(),toName:N(),body:N().optional(),frontmatter:M7.optional(),...P$,summary:F$}).strict(),L({from:N().min(1),to:N().min(1),committed:F()}).strict();var N7=z(yp),mle=/^[a-z0-9-]+$/,hle=/^[A-Za-z0-9_-]+$/,P7=L({name:N(),description:N()}).strict();L({skill:L({name:N().min(1),scope:N7,path:N().min(1),frontmatter:P7,body:N(),files:I(L({path:N().min(1),text:N().nullable()})).optional(),managed:F().optional()}).strict()}).strict();var gle=L({source:N().min(1),publisher:N().optional(),skill:N().optional(),marketplaceUrl:N().optional(),importedAt:N().min(1),autoUpdate:F().optional()}).strict(),_le=L({name:N().min(1),description:N().optional(),scope:N7,path:N().min(1),canonicalPath:N().min(1).optional(),absolutePath:N().min(1).optional(),installed:F(),hosts:I(N()),driftPaths:I(N()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:lo(N(),N()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:I(N()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:I(N()).optional(),installableEditors:I(N()).optional(),linkMode:F().optional(),customPlacements:I(L({path:N(),mode:z([`copy`,`link`])}).strict()).optional(),managed:F().optional(),origin:gle.optional(),modified:F().optional(),revertable:F().optional(),ignored:F().optional(),size:ole.optional()}).strict();L({name:N().min(1),scope:N7,apply:F().optional()}).strict(),L({line:N().min(1),gitignorePath:N().min(1),applied:F(),alreadyTracked:F().optional()}).strict();var vle=L({skills:I(_le),truncated:F()}).strict();L({scope:N7.default(`project`),name:N().meta({description:`Managed skill name to create or update.`}),body:N().optional(),frontmatter:P7,...P$,summary:F$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({scope:N7.default(`project`),name:N(),dryRun:F().optional(),setAutoUpdate:F().optional(),...P$,summary:F$}).strict(),L({name:N().min(1),updated:F(),source:N().min(1),localBody:N().optional(),upstreamBody:N().optional(),gitTracked:F().optional(),warnings:I(N())}).strict(),L({scope:N7.default(`project`),name:N(),...P$,summary:F$}).strict(),L({name:N().min(1),baselineRef:N().min(1),restoredFiles:I(N()),warnings:I(N())}).strict(),L({existed:F(),path:N().min(1)}).strict(),L({scope:N7.default(`project`),fromName:N(),toName:N(),body:N().optional(),frontmatter:P7.optional(),...P$,summary:F$}).strict(),L({from:N().min(1),to:N().min(1),committed:F()}).strict(),L({name:N(),fromScope:N7,toScope:N7,...P$,summary:F$}).strict(),L({scope:N7,path:N().optional()}).strict(),L({scope:N7,name:N(),toName:N(),...P$,summary:F$}).strict(),L({name:N().min(1)}).strict(),L({name:N(),home:N().min(1)}).strict(),L({docName:N().min(1)}).strict();var F7=z([`reference`,`script`,`file`]);L({scope:N7.default(`project`),name:N(),path:N().min(1),content:N(),...P$,summary:F$}).strict(),L({path:N().min(1),created:F(),kind:F7,content:F()}).strict(),L({scope:N7.default(`project`),name:N(),from:N().min(1),to:N().min(1),...P$,summary:F$}).strict(),L({from:N().min(1),to:N().min(1),fromDocName:N().optional(),toDocName:N().optional()}).strict(),L({path:N().min(1),kind:F7,text:N()}).strict(),L({path:N().min(1),existed:F(),kind:F7}).strict();var I7=ro([A7,B(`agents`)]),L7=N().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),R7=ro([I7,L7]);L({scope:N7.default(`project`),name:N(),targets:I(I7).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:I(R7).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:I(R7).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:z([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:R7.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:F().optional(),setSource:N().min(1).optional(),place:L({dir:N().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:z([`copy`,`link`])}).strict().optional(),convert:L({target:R7.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:z([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:L({path:N().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...P$,summary:F$,fork:L({editor:N().min(1),action:z([`align`,`make-source`,`rename`]),toName:N().optional()}).strict().optional()}).strict().refine(e=>!(e.targets!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>!(e.source!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"}),L({name:N().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:I(N()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:F().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:I(N()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:I(z([`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`])).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:N().optional(),sourceMovedTo:N().optional()}).strict(),L({scope:N7.default(`project`),name:N().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),L({name:N().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:F().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict();var yle=L({targets:I(A7),configured:F(),folders:I(L({scope:N7,host:N(),root:N(),state:z([`own`,`linked`,`linked-parent`,`absent`]),target:N().optional(),drift:B(!0).optional(),expected:N().optional()}).strict()).optional()}).strict(),z7=L({action:B(`link`),scope:N7,root:N().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:N().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}),B7=L({action:B(`unlink`),scope:N7,root:N().min(1).meta({description:`The linked folder to materialize back.`}),exclude:I(N().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),V7=L({action:B(`add-root`),scope:N7,root:L7.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),ble=ao(`action`,[z7.extend({preview:F().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),B7,V7]);ao(`action`,[z7.strict(),B7,V7]),L({folderAction:ble}).strict();var H7=L({moves:I(N()),drops:I(N()),removes:I(N()),replaces:I(N()),conflicts:I(N()),strays:I(N())}).strict();L({targets:I(A7),reprojected:I(L({name:N(),hosts:I(N())}).strict()),bundleHosts:I(N()),removedFrom:I(N()),folder:L({moved:I(N()),dropped:I(N()),linked:I(N())}).strict().optional(),preview:H7.optional()}).strict(),L({scope:N7.default(`project`),name:N(),version:N().regex(/^[0-9a-f]{40}$/i),...P$,summary:F$}).strict(),L({name:N().min(1),version:N(),restoredFiles:I(N()),warnings:I(N())}).strict(),L({query:N().optional(),intent:z([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:z([`navigation`,`relevance`]).optional(),scopes:I(z([`page`,`folder`,`content`,`file`])).optional(),scope:N().optional(),limit:P().int().nonnegative().optional(),semantic:F().optional(),source:z([`omnibar`,`mcp`,`http`]).optional()}).loose();var xle=L({kind:z([`page`,`folder`,`content`,`file`]),path:N().min(1),title:N(),score:P(),signals:lo(N(),Za()),snippet:N().optional()}).loose(),Sle=L({capable:F(),applied:F(),coverage:L({embedded:P().int().nonnegative(),total:P().int().nonnegative()})}).loose();L({enabled:F(),keyPresent:F(),keyNotRequired:F(),keySource:z([`project`,`file`,`env`]).nullable(),keyHint:N().nullable(),ready:F(),capable:F(),embedded:P().int().nonnegative(),total:P().int().nonnegative()}).loose(),L({query:N(),intent:z([`autocomplete`,`full_text`,`omnibar`]),results:I(xle),elapsedMs:P().nonnegative(),semantic:Sle.optional(),truncated:F().optional(),ready:F().optional()}).loose();var Cle=L({version:N().min(1),recordedAt:N().min(1)}).loose();L({currentVersion:N().min(1),targets:lo(N(),Cle.nullable())}).loose(),L({scope:N7.default(`project`),source:N().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:N().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:F().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:F().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...P$,summary:F$}).strict(),L({scope:N7.default(`project`),source:N().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:I(N().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:F().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:F().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...P$,summary:F$}).strict(),L({results:I(L({requested:N(),status:z([`imported`,`already-imported`,`not-found`,`failed`]),name:N().optional(),collisionRenamedFrom:N().optional(),warnings:I(N()),error:N().optional()}).loose()),imported:P(),alreadyImported:P(),failed:P()}).loose();var wle=L({source:N(),ref:N().optional(),contentHash:N(),publisher:N().optional()}).loose();L({name:N().min(1).meta({description:`Managed skill name created or matched.`}),path:N().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:F().meta({description:`True when this request created new source files.`}),alreadyImported:F().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:N().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:wle,warnings:I(N()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`})}).loose();var Tle=`server-info`,Ele=`branch-switched`,Dle=`disk-ack`,Ole=`config-validation-rejected`,kle=`config-ignore-nested-error`,U7=z([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]),Ale=L({v:B(1),ch:B(Tle),seq:P(),serverInstanceId:N().min(1),currentBranch:N().min(1).optional()}).loose(),jle=L({v:B(1),ch:B(Ele),seq:P(),branch:N().min(1)}).loose(),Mle=L({v:B(1),ch:U7,seq:P()}).loose(),Nle=L({v:B(1),ch:B(Dle),seq:P(),docName:N().min(1),sv:N().min(1)}).loose(),Ple=L({v:B(1),ch:B(Ole),seq:P(),docName:N().min(1),error:rp}).loose(),Fle=L({v:B(1),ch:B(kle),seq:P(),path:N().min(1),error:N().min(1)}).loose();function Ile(e){let t;try{t=new URL(e)}catch{return null}let n=t.pathname.match(/^\/video\/(\d+)/);if(n)return n[1]??null;let r=t.pathname.match(/^\/(\d+)/);return r?r[1]??null:null}function Lle(e){if(typeof e!=`string`||e.length===0)return e;let t=p2(e);if(t){let e=t.noCookie?`www.youtube-nocookie.com`:`www.youtube.com`,n=t.startSeconds===null?``:`?start=${t.startSeconds}`;return`https://${e}/embed/${t.id}${n}`}if(c2(e)){let t=Ile(e);return t?`https://player.vimeo.com/video/${t}`:e}let n=a2(e);if(n){let e=n.startRaw===null?``:`?t=${n.startRaw}`;return`https://www.loom.com/embed/${n.id}${e}`}return e}var Rle=`https://api.github.com/repos/inkeep/open-knowledge`;async function zle(e){let{signal:t,...n}=e??{},r=t?AbortSignal.any([AbortSignal.timeout(5e3),t]):AbortSignal.timeout(5e3);try{let e=await fetch(Rle,{headers:{accept:`application/vnd.github+json`,"user-agent":`openknowledge.ai`},...n,signal:r});if(!e.ok)return console.warn(`[github-stars] GitHub API responded ${e.status}`),null;let t=await e.json();return typeof t.stargazers_count==`number`?t.stargazers_count:null}catch(e){return console.warn(`[github-stars] fetch failed: ${e instanceof Error?e.message:String(e)}`),null}}function Ble(e){if(!e)return{height:null,viewerFragment:``};let t=e.split(`&`).filter(e=>e.length>0),n=null,r=[];for(let e of t){let t=e.indexOf(`=`);if(t===-1){r.push(e);continue}let i=e.slice(0,t),a=e.slice(t+1);if(i===`height`){let e=Number.parseInt(a,10);!Number.isNaN(e)&&e>0&&(n=e);continue}r.push(e)}return{height:n,viewerFragment:r.join(`&`)}}new YJ.default;var Vle=L({path:I(ro([N(),P()])),message:N(),issueCode:N()});ao(`code`,[L({code:B(`SCHEMA_INVALID`),issues:I(Vle)}),L({code:B(`WRITE_ERROR`),detail:N()})]);function Hle(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function Ule(e){if(e.code!==`SCHEMA_INVALID`)return{};let t={};for(let n of e.issues){let e=n.path[0];typeof e==`string`&&(t[e]=t[e]?`${t[e]}; ${n.message}`:n.message)}return t}var W7=/^---[ \t]*\r?\n---[ \t]*(\r?\n|$)/,Wle=/^---([ \t]*)(?=\r?\n|$)/,G7=e=>e.includes(`\r
573
573
  `)?`\r
574
574
  `:`
575
575
  `,Gle=e=>e.replace(Wle,`***$1`),K7=e=>`---${e}${e}---${e}`;function q7(e,t){let n=cm(e,t);return{md:n,frontmatter:n.slice(0,n.length-t.length)}}function J7(e,t){let{md:n,frontmatter:r}=q7(e,t),i=sm(n);return i.frontmatter===r&&i.body===t}function Y7(e,t,n,r){let{md:i,frontmatter:a}=q7(t,n);return{md:i,frontmatter:a,body:n,adjusted:r===`none`&&a!==e?`frontmatter`:r}}function Kle(e,t){if(J7(e,t))return Y7(e,e,t,`none`);let n=Gle(t);if(n!==t&&J7(e,n))return Y7(e,e,n,`body`);if(W7.test(e)){let n=K7(G7(e));if(J7(n,t))return Y7(e,n,t,`frontmatter`)}return Y7(e,e,t,`unresolved`)}function qle(e,t){if(J7(e,t))return Y7(e,e,t,`none`);let n=K7(G7(e||t));return(e===``||W7.test(e))&&J7(n,t)?Y7(e,n,t,`frontmatter`):Y7(e,e,t,`unresolved`)}var Jle=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function X7(e){return{ok:!1,error:e}}function Yle(e){return{ok:!0,...e}}function Xle(e){return{ok:!0,...e}}function Zle(e){return{ok:!0,...e}}function Z7(e){return{ok:!0,...e}}function Q7(e){switch(e.kind){case`unknown_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`unknown key '${e.key}'`,issueCode:`unknown_key`}]};case`duplicate_target`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`key '${e.key}' already exists`,issueCode:`duplicate_target`}]};case`invalid_value`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:e.reason,issueCode:`invalid_value`}]};case`reserved_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`'${e.key}' is a reserved frontmatter key`,issueCode:`reserved_key`}]};case`reorder_mismatch`:return{code:`WRITE_ERROR`,detail:`reorder list does not match current keys (state changed mid-drag)`};case`region_too_large`:return{code:`SCHEMA_INVALID`,issues:[{path:[],message:`Frontmatter region exceeds ${d7}-byte limit (would be ${e.bytes})`,issueCode:`region_too_large`}]};case`parse_failed`:return{code:`WRITE_ERROR`,detail:`Frontmatter YAML is malformed; fix in source mode to commit (${e.reason})`};case`invalid_path`:return{code:`SCHEMA_INVALID`,issues:[{path:[...e.path],message:e.reason,issueCode:`invalid_path`}]}}}function Qle(e,t){if(e.parseError!==t.parseError||e.keys.length!==t.keys.length)return!1;for(let n=0;n<e.keys.length;n++)if(e.keys[n]!==t.keys[n])return!1;for(let n of e.keys)if(!Sm(e.map[n],t.map[n]))return!1;return!0}var $le=5;function $7(e){let t=e.toString();return{snapshot:eue(t),raw:t}}function eue(e){let{map:t,parseError:n}=m7(e);return{map:t,keys:h7(e),parseError:n}}function e9(e){return e.startsWith(`---`)}function tue(e){let t=e.document,n=t.getText(`source`),r=new Set,i=$7(n),a=i.snapshot,o=f7(i.raw).fenced,s=e9(i.raw),c=!1;function l(e=!1){if(c)return;let t,i;try{let e=$7(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!e&&Qle(a,t)){s=e9(i);return}a=t,o=f7(i).fenced,s=e9(i);for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}let u=e=>{c||nue(e,o.length,s)&&l()};n.observe(u),e.on(`synced`,d);function d(){l(!0)}function f(e){let r;return t.transact(()=>{let t=n.toString(),{fenced:i}=f7(t);if(r=e(i),!r.ok||r.nextFenced===i)return;let a=qle(r.nextFenced,t.slice(i.length)).frontmatter;n.delete(0,i.length),a!==``&&n.insert(0,a)},Jle),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function p(e){if(c)return X7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,`frontmatter`))return X7({code:`SCHEMA_INVALID`,issues:[{path:[um],message:`'${um}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=bm.safeParse(e);if(!t.success)return X7({code:`SCHEMA_INVALID`,issues:t.error.issues.map(Hle)});let n=t.data,r=Object.keys(n),i=f(e=>mce(e,n));return i.ok?Yle({appliedKeys:r}):X7(Q7(i.error))}function m(e,t,n={}){if(c)return X7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>hce(r,e,t,n));return r.ok?Xle({oldKey:e,newKey:t}):X7(Q7(r.error))}function h(e){if(c)return X7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>S7(t,e));return t.ok?Zle({orderedKeys:[...e]}):X7(Q7(t.error))}function g(e,t){if(c)return X7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>gce(n,e,t));return n.ok?Z7({path:[...e]}):X7(Q7(n.error))}function _(e){if(c)return X7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>_ce(t,e));return t.ok?Z7({path:[...e]}):X7(Q7(t.error))}function v(e,t,n={}){if(c)return X7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>yce(r,e,t,n));return r.ok?Z7({path:[...e]}):X7(Q7(r.error))}function y(e,t){if(c)return X7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>bce(n,e,t));return n.ok?Z7({path:[...e]}):X7(Q7(n.error))}function b(e,t){if(c)return X7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>xce(n,e,t));return n.ok?Z7({path:[...e]}):X7(Q7(n.error))}return{current(){return $7(n).snapshot},patch(e){return p(e)},rename(e,t,n){return m(e,t,n)},reorder(e){return h(e)},patchPath(e,t){return g(e,t)},deletePath(e){return _(e)},renamePath(e,t,n){return v(e,t,n)},reorderPath(e,t){return y(e,t)},reorderSeqPath(e,t){return b(e,t)},subscribe(e){return r.add(e),()=>{r.delete(e)}},dispose(){c||(c=!0,n.unobserve(u),e.off(`synced`,d),r.clear())}}}function nue(e,t,n){if(t===0&&n)return!0;let r=t>0?t:$le,i=0;for(let t of e.delta){if(typeof t.retain==`number`){i+=t.retain;continue}if(typeof t.insert==`string`){if(i<r)return!0;i+=t.insert.length;continue}if(t.insert!==void 0){if(i<r)return!0;i+=1;continue}if(typeof t.delete==`number`&&i<r)return!0}return!1}function rue(e,t){if(e===``)return{slot:``,body:t};let n=t.match(/^\r?\n/);return n?{slot:n[0],body:t.slice(n[0].length)}:{slot:``,body:t}}function t9(e){let{frontmatter:t,body:n}=sm(e);if(t===``)return d1(e);let r=rue(t,n).body;return/^\n*$/.test(r)?d1(e):d1(r)}var iue=new YJ.default;iue.Match_Threshold=.5;var aue=/\\([!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~])/g,n9=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/,r9=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/,oue=/^\d+([.)])(?=\s)/,sue=`1`,cue=/\*\*\s*(`[^`]+`)\s*\*\*/g,lue=/^(`{3,}|~{3,})/;function uue(e){let t=new Set,n=null;for(let r=0;r<e.length;r++){let i=e[r].trimEnd(),a=lue.exec(i);if(a){let e=a[1][0];if(n===null){n=e;continue}if(n===e){n=null;continue}}if(n!==null||r===0||!n9.test(i))continue;let o=e[r-1].trimEnd();if(!(!o.startsWith(`|`)||n9.test(o))){t.add(r-1),t.add(r);for(let n=r+1;n<e.length&&e[n].trimEnd().startsWith(`|`);n++)t.add(n)}}return t}function i9(e){return e.slice(0,-1).trimEnd()}var a9=/^(?:#{1,6}[ \t]|>|(?:[-+*]|\d{1,9}[.)])[ \t]|`{3,}|~{3,}|=+[ \t]*$|-+[ \t]*$|(?:\*[ \t]*){3,}$|(?:_[ \t]*){3,}$)/;function o9(e){let t=new Set,n=null;for(let r=0;r<e.length;r++){let i=e[r]??``,a=/^(`{3,}|~{3,})/.exec(i.trimStart());if(a?.[1]){let e=a[1][0];if(n===null){n=e;continue}if(n===e){n=null;continue}}n!==null&&t.add(r)}return t}var due=/^<\/?[A-Z][A-Za-z0-9.]*(?:\s[^>]*)?>$/,fue=/^<[A-Z][A-Za-z0-9.]*(?:\s[^>]*)?>$/,pue=/^<\/[A-Z][A-Za-z0-9.]*\s*>$/,mue=/<\/?[A-Z]/;function hue(e){let t=!1;for(let n=0;n<e.length;n++)if(mue.test(e[n]??``)){t=!0;break}if(!t)return e;let n=o9(e),r=[],i=[],a=0;for(let t=0;t<e.length;t++){let o=e[t]??``,s=o.trim();if(n.has(t)){r.push(!1),i.push(a);continue}let c=a>=1||!/^[ \t]/.test(o);r.push(c&&due.test(s));let l=c&&pue.test(s),u=c&&!l&&fue.test(s)&&!s.endsWith(`/>`);l?(a=Math.max(0,a-1),i.push(a)):(i.push(a),u&&(a+=1))}let o=Array(e.length);for(let t=0,n=-1;t<e.length;t++)o[t]=n,(e[t]??``).trim()!==``&&(n=t);let s=Array(e.length);for(let t=e.length-1,n=e.length;t>=0;t--)s[t]=n,(e[t]??``).trim()!==``&&(n=t);let c=new Set;for(let t=0;t<e.length;t++){if((e[t]??``).trim()!==``||n.has(t)||(i[t]??0)<1)continue;let a=o[t]??-1,l=s[t]??e.length;(a>=0&&r[a]===!0||l<e.length&&r[l]===!0)&&c.add(t)}let l=[];for(let t=0;t<e.length;t++){if(c.has(t))continue;let n=e[t]??``;l.push(r[t]===!0&&(i[t]??0)>=1?n.replace(/^[ \t]+/,``):n)}return l}function gue(e){let t=hue(e.replace(/^/,``).replace(/\r/g,``).replace(aue,`$1`).replace(cue,`$1`).replace(/^\n+/,``).replace(/^[*-]{3,}(?=\n|$)/,`---`).replace(/(\n)([#>+-]|\d+[.)]|`{3,}|~{3,})/g,`
@@ -580,4 +580,4 @@ $2`).split(`
580
580
  `)),n=uue(t),r=o9(t);return t.map((e,i)=>{let a=e.trimEnd();if(i>0&&!r.has(i)&&/^[ \t]+\S/.test(a)&&(t[i-1]??``).trim()!==``&&!r9.test(a)&&!a9.test(a.trimStart())){let e=(t[i-1]??``).trimStart();if(!a9.test(e)&&!e.startsWith(`|`))return a.replace(/^[ \t]+/,``)}if(n9.test(a)){let e=a.replace(/\s+/g,``);return n.has(i)&&e.length>1&&e.startsWith(`|`)&&e.endsWith(`|`)?i9(e):e}let o=r9.test(a)?a.replace(/^[ \t]+/,``):a;return n.has(i)&&o.length>1&&o.startsWith(`|`)&&o.endsWith(`|`)&&(o=i9(o)),o.replace(oue,`${sue}$1`)}).join(`
581
581
  `).replace(/\n{3,}/g,`
582
582
 
583
- `).replace(/\n+$/,``)}function s9(e){return[...e.replace(/^\n+/,``).replace(/\n+$/,``).matchAll(/\n{2,}/g)].map(e=>e[0].length)}function _ue(e,t){let n=t9(e),r=t9(t);if(r.leading>n.leading||r.trailing>n.trailing)return!0;let i=s9(sm(e).body),a=s9(sm(t).body);return i.length===a.length?a.some((e,t)=>e>(i[t]??0)):!1}var c9=/^[a-zA-Z0-9][\w/-]*$/;function vue(e){if(typeof e!=`string`)return!1;let t=e.startsWith(`#`)?e.slice(1):e;return c9.test(t)}var yue=`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`;function bue(e){return e.startsWith(`#`)?e.slice(1):e}function xue(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Sue(e){if(!e||e.trim()===``)return[];let{map:t}=wm(e);if(!t)return[];let n=xue(t.tags),r=[];for(let e of n){let t=bue(e);c9.test(t)&&r.push(t)}return r}var Cue=z(yp),wue=R({hosts:I(N()),scope:Cue,scripts:F(),installedAt:Xi(),projection:z([`symlink`,`copy`]).optional(),contentHash:N().optional()});R({schema:B(1),skills:co(N(),wue).default({})});var Tue=100,Eue=500,Due=450,Oue={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},l9=new WeakMap;function kue(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function u9(e){return e.trim().toLowerCase()}var Aue=/\.(?:md|mdx)$/;function jue(e,t){if(t!==`page`)return e;let n=e.replace(Aue,``);return n.length>0?n:e}function d9(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function Mue(e){let t=d9(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}var f9=/[^\P{L}a-zàèéìòóù]|[^\P{Nd}0-9]|\p{Nl}/iu,p9=(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();function Nue(){let e=Gq({language:`english`}),t=e.tokenize.bind(e);return e.tokenize=(e,n,r,i)=>{let a=t(e,n,r,i);if(!p9||typeof e!=`string`||!f9.test(e))return a;let o=new Set(a);for(let{segment:t,isWordLike:n}of p9.segment(e)){if(!n||!f9.test(t))continue;let e=t.toLowerCase();o.has(e)||(o.add(e),a.push(e))}return a},e}function m9(e){let t=aJ({schema:Oue,components:{tokenizer:Nue()}});return e.length>0&&gJ(t,e),t}function Pue(e){let t={documents:e};return l9.set(t,m9(e)),t}function Fue(e){let t=l9.get(e);if(t)return t;let n=m9(e.documents);return l9.set(e,n),n}function Iue(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function h9(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function Lue(e,t){let n=u9(t);if(!n)return 0;let r=jue(n,e.kind),i=u9(e.title),a=u9(e.name),o=u9(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}var Rue=.5;function g9(e,t){let n=Lue(e,t);return n<=0?n:A$(e.path)?n*Rue:n}var zue=60;function Bue(e){return e===`file`?-zue:0}var Vue=1e3,_9=50,Hue=1,Uue=1,Wue=.001;function Gue(e,t,n,r,i){let a=i>0?t/i:0,o=_9>0?n/_9:0,s=r===`file`?-Wue:0,c=Hue*a+Uue*o+s;return e*Vue+c}function v9(e,t,n,r){return e+t*20+n+Bue(r)}function y9(e,t,n,r,i,a){return e===`relevance`?v9(t,n,r,i):Gue(t,n,r,i,a)}function Kue(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function b9(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function que(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function Jue(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function Yue(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}var Xue=/[฀-๿ក-៿ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿\uf900-﫿＀-￯\u1100-\u11ff\u3130-\u318f\ua960-\ua97f\uac00-\ud7ff]/;function Zue(e,t){let n=u9(t);return n.length<4||Xue.test(n)?0:+(e===`full_text`)}function Que(e){let{lexical:t,fullText:n}=e.signals;return t>=Eue?`lexical`:t===Due&&n<=0?`pathOnly`:`body`}function $ue(e){let t=[],n=[],r=[];for(let i of e){let e=Que(i);e===`lexical`?t.length<Tue&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function x9(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=$ue(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function ede(e,t,n={}){let r=n.intent??`omnibar`,i=Kue(r,n.ranking),a=kue(n.limit),o=new Set(n.scopes??Iue(r)),s=e.documents.filter(e=>h9(e,o)),c=u9(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=KJ(Fue(e),{term:c,properties:Jue(r),boost:Yue(r),tolerance:Zue(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>h9(e.document,o)).map(e=>[e.document.id,e.score])),d=que(s),f=new Map;for(let e of s)g9(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)h9(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=b9(f.values(),u);return x9([...f.values()].map(t=>{let n=Math.max(0,g9(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:y9(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return x9(tde({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function S9(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function tde(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=b9(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,g9(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?y9(o,t,n,s,e.kind,m):v9(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=S9(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=S9(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=+(e.lexical>0),r=+(t.lexical>0);if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function nde(e){return e.created.length>0||e.packSkills?.some(e=>e.pending)===!0||e.requiredPlugins?.some(e=>e.pending)===!0}function rde(e){return`https://${e.host}/${e.owner}/${e.repo}.git`}function ide(e,t){return!e||e.length===0?`true`:t.detached?`detached`:t.currentBranch===null||t.currentBranch===e?`true`:`false`}var C9=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),w9=globalThis;w9[C9]===void 0&&(w9[C9]=Er());var T9=w9[C9],E9=R({version:N().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(T9,{description:`Recorded skill version for this target.`}),recordedAt:Xi().register(T9,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:z([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(T9,{description:`Install-source surface that recorded this entry.`}).optional()}),ade=R({enabled:F().register(T9,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Xi().register(T9,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});R({schema:B(1).register(T9,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:R({"claude-cowork":E9.optional(),"cli-hosts":E9.optional()}).register(T9,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:co(N(),ade).register(T9,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:I(N()).register(T9,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});var D9=`bottom`,O9=e=>e*8+4,k9=O9(92),A9=O9(40);function ode(e){return e===`right`||e===`bottom`?e:D9}function sde(e){return typeof e!=`number`||!Number.isFinite(e)?k9:Math.max(A9,Math.round(e))}var cde=new Set([`(connected)`,`(agent thread)`]);function lde(e){return e!=null&&cde.has(e)}var j9=class extends Error{chunksCompleted;totalChunks;bytesWritten;bytesRemaining;cause;constructor(e,t){let n=e instanceof Error?e.message:typeof e==`string`?e:`unknown error`;super(`chunked insert failed after ${t.chunksCompleted}/${t.totalChunks} chunks (${t.bytesWritten} bytes written, ${t.bytesRemaining} bytes lost): ${n}`),this.name=`ChunkedInsertError`,this.chunksCompleted=t.chunksCompleted,this.totalChunks=t.totalChunks,this.bytesWritten=t.bytesWritten,this.bytesRemaining=t.bytesRemaining,this.cause=e}};async function ude(e,t,n,r,i={}){let a=i.thresholdBytes??512e3,o=i.chunkSizeBytes??51200,s=i.origin,c=i.yieldFn??dde,l=i.resolveOffset??(e=>e);if(r.length<=a){e.transact(()=>{t.insert(n,r)},s);return}let u=Math.ceil(r.length/o),d=0,f=n,p=0,m=0;for(;d<r.length;){let n=Math.min(d+o,r.length),i=r.slice(d,n);try{let n=l(f);e.transact(()=>{t.insert(n,i)},s)}catch(e){throw new j9(e,{chunksCompleted:p,totalChunks:u,bytesWritten:m,bytesRemaining:r.length-d})}p++,m+=i.length,f+=i.length,d=n,d<r.length&&await c()}}function dde(){return new Promise(e=>{let t=globalThis;t.document?.hidden!==!0&&typeof t.requestAnimationFrame==`function`?t.requestAnimationFrame(()=>e()):setTimeout(()=>e(),0)})}var fde=/^(#{1,6})\s+(.+)$/;function pde(e,t){let n=(e.endsWith(`\r`)?e.slice(0,-1):e).match(fde);if(!n)return null;let r=n[2].trim(),i=q5(r,t);return i?{level:n[1].length,text:r,slug:i}:null}var mde=Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));function M9(){let e=globalThis.crypto;if(e&&typeof e.randomUUID==`function`)return e.randomUUID();let t=new Uint8Array(16);if(e&&typeof e.getRandomValues==`function`)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=mde;return`${n[t[0]]}${n[t[1]]}${n[t[2]]}${n[t[3]]}-${n[t[4]]}${n[t[5]]}-${n[t[6]]}${n[t[7]]}-${n[t[8]]}${n[t[9]]}-${n[t[10]]}${n[t[11]]}${n[t[12]]}${n[t[13]]}${n[t[14]]}${n[t[15]]}`}var hde={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`},gde=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],_de={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`},vde={cursor:`#FFFFFF`,windsurf:`#FFFFFF`},N9=[`#f0ece3`,`#fff5e1`,`#f9e1db`,`#f5def7`,`#ece2fb`,`#dce8fa`,`#DBF3FB`];function yde(e,t=gde){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}function bde(e){let t=e.trim();if(!t)return`?`;let n=t.split(/[-\s]+/).filter(Boolean);if(!n.length)return`?`;if(n.length>=2)return n.slice(0,2).map(e=>e[0]??``).join(``).toUpperCase();let r=n[0],i=[r[0]];for(let e=1;e<r.length&&i.length<2;e++){let t=r[e-1],n=r[e];t===t.toLowerCase()&&n===n.toUpperCase()&&n!==n.toLowerCase()&&i.push(n)}return i.length>=2?i.join(``).toUpperCase():r.slice(0,2).toUpperCase()}function xde(e){let t=e.trim();if(!t)return e;if(t.includes(` `)||!/[-_]/.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);return n.length?n.map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):t}var Sde={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`,"claude-acp":`claude`,"codex-acp":`openai`,"github-copilot-cli":`github`};function Cde(e){return e?Sde[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}function wde(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2;if(i===a)return[0,0,o*100];let s=i-a,c=o>.5?s/(2-i-a):s/(i+a),l;return l=i===t?((n-r)/s+(n<r?6:0))/6:i===n?((r-t)/s+2)/6:((t-n)/s+4)/6,[l*360,c*100,o*100]}function Tde(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function Ede(e){let[t]=wde(e);return Tde(t,45,32)}var Dde=[`Curious`,`Brave`,`Clever`,`Swift`,`Gentle`,`Bright`,`Wise`,`Bold`,`Calm`,`Keen`],Ode=[`Bird`,`Cat`,`Dog`,`Fish`,`Mouse`,`Rabbit`,`Shrimp`,`Snail`,`Squirrel`,`Turtle`],P9=`ok-user-name-v3`,F9=`ok-user-color-v3`;function I9(e){return e[Math.floor(Math.random()*e.length)]}function kde(){return`${I9(Dde)} ${I9(Ode)}`}function Ade(){return I9(N9)}function L9(e){try{return localStorage.getItem(e)}catch{return null}}function R9(e,t){try{localStorage.setItem(e,t)}catch{}}function jde(){let e=new URLSearchParams(window.location.search).get(`coeditor`)||`standalone`,t=M9(),n=L9(P9),r=L9(F9);return n||(n=kde(),R9(P9,n)),r||(r=Ade(),R9(F9,r)),{name:n,color:r,coeditor:e,tabId:t}}function Mde(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}function Nde(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}var z9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function B9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function V9(e){return e.split(`/`).filter(Boolean)}function H9(e){let t=e.trim();return z9.test(t)||t.startsWith(`//`)}function Pde(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(H9(n))return{kind:`external`,url:n};let r=n.indexOf(`#`),i=r<0?n:n.slice(0,r),a=Ap(i,t);if(a)return{kind:`doc`,docName:a,anchor:r<0?null:n.slice(r+1)};let o=kp(i,t);if(o)return{kind:`doc`,docName:o,anchor:r<0?null:n.slice(r+1)};let s=Mde(n,t);if(s)return{kind:`doc`,docName:s.docName,anchor:s.anchor};let c=B9(n);return c&&c!==`md`&&c!==`mdx`?{kind:`asset`,url:n,ext:c}:null}function Fde(e,t){let n=e.trim();if(!n)return null;if(H9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=B9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function Ide(e,t){let n=e.trim();if(!n||z9.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function Lde(e,t,n=null,r=`.md`){let i=V9(e);i.pop();let a=V9(t),o=0;for(;o<i.length&&o<a.length&&i[o]===a[o];)o+=1;let s=i.slice(o).map(()=>`..`),c=a.slice(o),l=[...s,...c].join(`/`);return l||=a.at(-1)??t,!l.startsWith(`./`)&&!l.startsWith(`../`)&&(l=`./${l}`),`${l}${r}${n?`#${n}`:``}`}function Rde(e){return e.replace(/[/\\:*?"<>|\0]/g,`-`).replace(/\s+/g,` `).replace(/-+/g,`-`).trim().replace(/^[-.\s]+|[-.\s]+$/g,``)}function U9(e){return`pagesBySlug`in e}function W9(e){return U9(e)?e.pages:e}function G9(e,t){return U9(e)?e.assetPaths??new Set:t??new Set}function K9(e,t){return U9(e)?e.filePaths??new Set:t??new Set}function q9(e,t){return e<t?-1:+(e>t)}function zde(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function Bde(e,t){let n=new Map,r=[...e].sort(q9);for(let e of r){let r=e.lastIndexOf(`/`),i=t(r===-1?e:e.slice(r+1));i&&!n.has(i)&&n.set(i,e)}return n}function J9(e,t){let n=K5(e);if(n){if(U9(t))return t.pagesBySlug.get(n);for(let e of t)if(K5(e)===n)return e}}function Y9(e,t){if(e.includes(`/`))return;let n=K5(e);if(!n)return;if(U9(t))return t.pagesByBasename?.get(n);let r;for(let e of t){let t=e.lastIndexOf(`/`);K5(t===-1?e:e.slice(t+1))===n&&(r===void 0||q9(e,r)<0)&&(r=e)}return r}function X9(e){let t=e.trim();if(!t)return[];let n=K5(t);return n.length>0&&n!==t?[n]:[]}function Z9(e,t){let n=e.trim();if(!n)return;let r=W9(t);if(r.has(n))return n;let i=J9(n,t);if(i)return i;for(let e of X9(n))if(r.has(e))return e;return Q9(n,r)||Y9(n,t)}function Q9(e,t){let n=`${e}/index`;if(t.has(n))return n;let r=e.lastIndexOf(`/`),i=r===-1?e:e.slice(r+1),a=i?`${e}/${i}`:null;if(a&&t.has(a))return a}function Vde(e){let t=((e.trim().split(`#`)[0]??``).trim().split(`?`)[0]??``).trim();return t.startsWith(`/`)?t.slice(1):t}function $9(e,t,n){let r=Vde(e);if(!r)return null;let i=r.toLowerCase(),a=n?[t,n]:[t];for(let e of a){if(e.has(r))return r;for(let t of e)if(t.toLowerCase()===i)return t}if(r.includes(`/`))return null;let o=[];for(let e of a)for(let t of e){let e=t.lastIndexOf(`/`);(e===-1?t:t.slice(e+1)).toLowerCase()===i&&o.push(t)}return o.length===0?null:o.sort(q9)[0]??null}function Hde(e,t,n,r){let i=e.trim();if(!i)return!1;if($9(i,G9(t,n),K9(t,r)))return!0;let a=W9(t);return a.has(i)||X9(i).some(e=>a.has(e))||J9(i,t)!==void 0||Q9(i,a)?!0:Y9(i,t)!==void 0}function Ude(e,t,n){let r=Fde(e,t);return r===null||r.kind!==`asset`||$9(r.url,G9(n),K9(n))!==null||Z9(e,n)===void 0?r:{kind:`doc`,docName:e.trim(),anchor:t?.trim()||null}}export{Joe as $,W as $a,KA as $i,d8 as $n,Qu as $o,ale as $r,YZ as $t,U7 as A,Zw as Aa,$Y as Ai,eY as An,Hp as Ao,Y2 as Ar,Nf as As,aZ as At,N9 as B,v_ as Ba,mQ as Bi,LQ as Bn,Tp as Bo,EX as Br,z as Bs,$$ as Bt,Fce as C,Ow as Ca,h7 as Ci,zde as Cn,_m as Co,X9 as Cr,md as Cs,Lse as Ct,TX as D,PC as Da,$9 as Di,ude as Dn,im as Do,Cde as Dr,_d as Ds,SZ as Dt,D9 as E,dE as Ea,s1 as Ei,rde as En,bp as Eo,b0 as Er,Ou as Es,ase as Et,_X as F,Wx as Fa,ede as Fi,vY as Fn,Qp as Fo,Z2 as Fr,ff as Fs,qce as Ft,eZ as G,pg as Ga,Koe as Gi,RQ as Gn,Ju as Go,Boe as Gr,B as Gs,H7 as Gt,oce as H,Xg as Ha,lQ as Hi,zQ as Hn,lm as Ho,nse as Hr,I as Hs,W$ as Ht,yue as I,wS as Ia,_5 as Ii,m5 as In,Ip as Io,J2 as Ir,Bf as Is,D7 as It,wX as J,Sg as Ja,l1 as Ji,Kle as Jn,Ed as Jo,lde as Jr,kt as Js,vle as Jt,tZ as K,yg as Ka,K5 as Ki,IQ as Kn,xd as Ko,w5 as Kr,L as Ks,A7 as Kt,c9 as L,t_ as La,c1 as Li,f$ as Ln,Fp as Lo,$2 as Lr,Nu as Ls,Jce as Lt,Use as M,aE as Ma,Rde as Mi,KX as Mn,Mp as Mo,n4 as Mr,lf as Ms,hde as Mt,Hse as N,LS as Na,pde as Ni,yde as Nn,Vp as No,Q2 as Nr,Vd as Ns,Xce as Nt,Hce as O,dC as Oa,Ude as Oi,ide as On,wp as Oo,r4 as Or,Bd as Os,Vce as Ot,Ice as P,Vx as Pa,aY as Pi,_Y as Pn,Dp as Po,t4 as Pr,mf as Ps,Kce as Pt,ice as Q,hh as Qa,ej as Qi,cse as Qn,Ef as Qo,oZ as Qr,DX as Qt,Yse as R,q as Ra,E5 as Ri,VQ as Rn,Hm as Ro,e4 as Rr,pf as Rs,Yce as Rt,Bse as S,Ew as Sa,i1 as Si,Bde as Sn,Sm as So,jde as Sr,ip as Ss,n1 as St,Roe as T,Yw as Ta,Ide as Ti,EQ as Tn,xm as To,yX as Tr,Tu as Ts,oY as Tt,tie as U,K as Ua,Pae as Ui,w$ as Un,Vu as Uo,A$ as Ur,F as Us,U$ as Ut,f0 as V,G as Va,TQ as Vi,T$ as Vn,Bp as Vo,H9 as Vr,zo as Vs,z$ as Vt,QX as W,vg as Wa,$X as Wi,u$ as Wn,Xu as Wo,o2 as Wr,Ca as Ws,q$ as Wt,dZ as X,$h as Xa,MQ as Xi,QY as Xn,$u as Xo,sZ as Xr,wt as Xs,SQ as Xt,M5 as Y,Jg as Ya,J5 as Yi,bde as Yn,Ff as Yo,k$ as Yr,jt as Ys,hle as Yt,Qse as Z,U as Za,d9 as Zi,ZY as Zn,Tf as Zo,Hde as Zr,CQ as Zt,fY as _,rw as _a,lY as _i,dX as _n,nm as _o,jae as _r,ku as _s,IX as _t,nY as a,Tk as aa,kse as ai,$oe as an,mp as ao,wce as ar,yd as as,xZ as at,zX as b,Fw as ba,nde as bi,dQ as bn,Sp as bo,zle as br,Bu as bs,zse as bt,jle as c,nE as ca,GX as ci,sQ as cn,Gp as co,dY as cr,Ku as cs,NQ as ct,Mle as d,Jw as da,tQ as di,C$ as dn,om as do,B9 as dr,Ld as ds,PX as dt,YA as ea,vue as ei,ple as en,Wm as eo,U2 as er,Cd as es,ese as et,Nle as f,TE as fa,n8 as fi,Nde as fn,yp as fo,Sue as fr,Mf as fs,NX as ft,QJ as g,uE as ga,Ble as gi,tue as gn,Jp as go,ise as gr,_f as gs,FX as gt,bX as h,tw as ha,a2 as hi,aX as hn,um as ho,qX as hr,Au as hs,k9 as ht,kce as i,wk as ia,Mse as ii,r1 as in,hp as io,kX as ir,Gu as is,wae as it,u7 as j,SE as ja,Lle as ji,tY as jn,Rp as jo,X2 as jr,Rd as js,mle as jt,Rse as k,gw as ka,Z9 as ki,Pde as kn,Pp as ko,i4 as kr,Mu as ks,rZ as kt,Fle as l,VT as la,gue as li,nce as ln,Yp as lo,vX as lr,ed as ls,PQ as lt,xX as m,CE as ma,sde as mi,roe as mn,em as mo,GY as mr,sf as ms,ace as mt,vde as n,bk as na,lse as ni,RX as nn,gp as no,Mue as nr,zu as ns,W5 as nt,Kse as o,fk as oa,x0 as oi,Qoe as on,Wp as oo,sse as or,vd as os,noe as ot,Ale as p,EE as pa,ode as pi,ioe as pn,tm as po,Ule as pr,Iu as ps,AX as pt,nZ as q,Cg as qa,uY as qi,FQ as qn,Td as qo,jX as qr,N as qs,yle as qt,Oce as r,lk as ra,Jre as ri,LX as rn,pp as ro,Ede as rr,Yu as rs,A9 as rt,Gse as s,fne as sa,fX as si,iQ as sn,Xp as so,dle as sr,Zd as ss,toe as st,_de as t,JA as ta,c2 as ti,Uce as tn,$p as to,Pue as tr,Af as ts,uce as tt,Ple as u,wT as ua,K8 as ui,_ue as un,Kp as uo,aQ as ur,jd as us,cle as ut,SX as v,iw as va,nQ as vi,uQ as vn,fp as vo,a5 as vr,sp as vs,zce as vt,Pce as w,kw as wa,m7 as wi,Lde as wn,Cp as wo,rQ as wr,Eu as ws,sY as wt,o7 as x,_w as xa,M9 as xi,pQ as xn,xp as xo,q5 as xr,gd as xs,e1 as xt,j9 as y,Pw as ya,p2 as yi,wQ as yn,Rm as yo,xde as yr,Ad as ys,Lce as yt,Xoe as z,h_ as za,cQ as zi,BQ as zn,sm as zo,uZ as zr,df as zs,Zce as zt};
583
+ `).replace(/\n+$/,``)}function s9(e){return[...e.replace(/^\n+/,``).replace(/\n+$/,``).matchAll(/\n{2,}/g)].map(e=>e[0].length)}function _ue(e,t){let n=t9(e),r=t9(t);if(r.leading>n.leading||r.trailing>n.trailing)return!0;let i=s9(sm(e).body),a=s9(sm(t).body);return i.length===a.length?a.some((e,t)=>e>(i[t]??0)):!1}var c9=/^[a-zA-Z0-9][\w/-]*$/;function vue(e){if(typeof e!=`string`)return!1;let t=e.startsWith(`#`)?e.slice(1):e;return c9.test(t)}var yue=`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`;function bue(e){return e.startsWith(`#`)?e.slice(1):e}function xue(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Sue(e){if(!e||e.trim()===``)return[];let{map:t}=wm(e);if(!t)return[];let n=xue(t.tags),r=[];for(let e of n){let t=bue(e);c9.test(t)&&r.push(t)}return r}var Cue=z(yp),wue=R({hosts:I(N()),scope:Cue,scripts:F(),installedAt:Zi(),projection:z([`symlink`,`copy`]).optional(),contentHash:N().optional()});R({schema:B(1),skills:lo(N(),wue).default({})});var Tue=100,Eue=500,Due=450,Oue={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},l9=new WeakMap;function kue(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function u9(e){return e.trim().toLowerCase()}var Aue=/\.(?:md|mdx)$/;function jue(e,t){if(t!==`page`)return e;let n=e.replace(Aue,``);return n.length>0?n:e}function d9(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function Mue(e){let t=d9(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}var f9=/[^\P{L}a-zàèéìòóù]|[^\P{Nd}0-9]|\p{Nl}/iu,p9=(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();function Nue(){let e=Gq({language:`english`}),t=e.tokenize.bind(e);return e.tokenize=(e,n,r,i)=>{let a=t(e,n,r,i);if(!p9||typeof e!=`string`||!f9.test(e))return a;let o=new Set(a);for(let{segment:t,isWordLike:n}of p9.segment(e)){if(!n||!f9.test(t))continue;let e=t.toLowerCase();o.has(e)||(o.add(e),a.push(e))}return a},e}function m9(e){let t=aJ({schema:Oue,components:{tokenizer:Nue()}});return e.length>0&&gJ(t,e),t}function Pue(e){let t={documents:e};return l9.set(t,m9(e)),t}function Fue(e){let t=l9.get(e);if(t)return t;let n=m9(e.documents);return l9.set(e,n),n}function Iue(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function h9(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function Lue(e,t){let n=u9(t);if(!n)return 0;let r=jue(n,e.kind),i=u9(e.title),a=u9(e.name),o=u9(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}var Rue=.5;function g9(e,t){let n=Lue(e,t);return n<=0?n:A$(e.path)?n*Rue:n}var zue=60;function Bue(e){return e===`file`?-zue:0}var Vue=1e3,_9=50,Hue=1,Uue=1,Wue=.001;function Gue(e,t,n,r,i){let a=i>0?t/i:0,o=_9>0?n/_9:0,s=r===`file`?-Wue:0,c=Hue*a+Uue*o+s;return e*Vue+c}function v9(e,t,n,r){return e+t*20+n+Bue(r)}function y9(e,t,n,r,i,a){return e===`relevance`?v9(t,n,r,i):Gue(t,n,r,i,a)}function Kue(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function b9(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function que(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function Jue(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function Yue(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}var Xue=/[฀-๿ក-៿ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿\uf900-﫿＀-￯\u1100-\u11ff\u3130-\u318f\ua960-\ua97f\uac00-\ud7ff]/;function Zue(e,t){let n=u9(t);return n.length<4||Xue.test(n)?0:+(e===`full_text`)}function Que(e){let{lexical:t,fullText:n}=e.signals;return t>=Eue?`lexical`:t===Due&&n<=0?`pathOnly`:`body`}function $ue(e){let t=[],n=[],r=[];for(let i of e){let e=Que(i);e===`lexical`?t.length<Tue&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function x9(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=$ue(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function ede(e,t,n={}){let r=n.intent??`omnibar`,i=Kue(r,n.ranking),a=kue(n.limit),o=new Set(n.scopes??Iue(r)),s=e.documents.filter(e=>h9(e,o)),c=u9(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=KJ(Fue(e),{term:c,properties:Jue(r),boost:Yue(r),tolerance:Zue(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>h9(e.document,o)).map(e=>[e.document.id,e.score])),d=que(s),f=new Map;for(let e of s)g9(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)h9(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=b9(f.values(),u);return x9([...f.values()].map(t=>{let n=Math.max(0,g9(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:y9(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return x9(tde({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function S9(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function tde(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=b9(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,g9(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?y9(o,t,n,s,e.kind,m):v9(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=S9(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=S9(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=+(e.lexical>0),r=+(t.lexical>0);if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function nde(e){return e.created.length>0||e.packSkills?.some(e=>e.pending)===!0||e.requiredPlugins?.some(e=>e.pending)===!0}function rde(e){return`https://${e.host}/${e.owner}/${e.repo}.git`}function ide(e,t){return!e||e.length===0?`true`:t.detached?`detached`:t.currentBranch===null||t.currentBranch===e?`true`:`false`}var C9=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),w9=globalThis;w9[C9]===void 0&&(w9[C9]=Tr());var T9=w9[C9],E9=R({version:N().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(T9,{description:`Recorded skill version for this target.`}),recordedAt:Zi().register(T9,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:z([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(T9,{description:`Install-source surface that recorded this entry.`}).optional()}),ade=R({enabled:F().register(T9,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Zi().register(T9,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});R({schema:B(1).register(T9,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:R({"claude-cowork":E9.optional(),"cli-hosts":E9.optional()}).register(T9,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:lo(N(),ade).register(T9,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:I(N()).register(T9,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});var D9=`bottom`,O9=e=>e*8+4,k9=O9(92),A9=O9(40);function ode(e){return e===`right`||e===`bottom`?e:D9}function sde(e){return typeof e!=`number`||!Number.isFinite(e)?k9:Math.max(A9,Math.round(e))}var cde=new Set([`(connected)`,`(agent thread)`]);function lde(e){return e!=null&&cde.has(e)}var j9=class extends Error{chunksCompleted;totalChunks;bytesWritten;bytesRemaining;cause;constructor(e,t){let n=e instanceof Error?e.message:typeof e==`string`?e:`unknown error`;super(`chunked insert failed after ${t.chunksCompleted}/${t.totalChunks} chunks (${t.bytesWritten} bytes written, ${t.bytesRemaining} bytes lost): ${n}`),this.name=`ChunkedInsertError`,this.chunksCompleted=t.chunksCompleted,this.totalChunks=t.totalChunks,this.bytesWritten=t.bytesWritten,this.bytesRemaining=t.bytesRemaining,this.cause=e}};async function ude(e,t,n,r,i={}){let a=i.thresholdBytes??512e3,o=i.chunkSizeBytes??51200,s=i.origin,c=i.yieldFn??dde,l=i.resolveOffset??(e=>e);if(r.length<=a){e.transact(()=>{t.insert(n,r)},s);return}let u=Math.ceil(r.length/o),d=0,f=n,p=0,m=0;for(;d<r.length;){let n=Math.min(d+o,r.length),i=r.slice(d,n);try{let n=l(f);e.transact(()=>{t.insert(n,i)},s)}catch(e){throw new j9(e,{chunksCompleted:p,totalChunks:u,bytesWritten:m,bytesRemaining:r.length-d})}p++,m+=i.length,f+=i.length,d=n,d<r.length&&await c()}}function dde(){return new Promise(e=>{let t=globalThis;t.document?.hidden!==!0&&typeof t.requestAnimationFrame==`function`?t.requestAnimationFrame(()=>e()):setTimeout(()=>e(),0)})}var fde=/^(#{1,6})\s+(.+)$/;function pde(e,t){let n=(e.endsWith(`\r`)?e.slice(0,-1):e).match(fde);if(!n)return null;let r=n[2].trim(),i=q5(r,t);return i?{level:n[1].length,text:r,slug:i}:null}var mde=Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));function M9(){let e=globalThis.crypto;if(e&&typeof e.randomUUID==`function`)return e.randomUUID();let t=new Uint8Array(16);if(e&&typeof e.getRandomValues==`function`)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=mde;return`${n[t[0]]}${n[t[1]]}${n[t[2]]}${n[t[3]]}-${n[t[4]]}${n[t[5]]}-${n[t[6]]}${n[t[7]]}-${n[t[8]]}${n[t[9]]}-${n[t[10]]}${n[t[11]]}${n[t[12]]}${n[t[13]]}${n[t[14]]}${n[t[15]]}`}var hde={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`},gde=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],_de={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`},vde={cursor:`#FFFFFF`,windsurf:`#FFFFFF`},N9=[`#f0ece3`,`#fff5e1`,`#f9e1db`,`#f5def7`,`#ece2fb`,`#dce8fa`,`#DBF3FB`];function yde(e,t=gde){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}function bde(e){let t=e.trim();if(!t)return`?`;let n=t.split(/[-\s]+/).filter(Boolean);if(!n.length)return`?`;if(n.length>=2)return n.slice(0,2).map(e=>e[0]??``).join(``).toUpperCase();let r=n[0],i=[r[0]];for(let e=1;e<r.length&&i.length<2;e++){let t=r[e-1],n=r[e];t===t.toLowerCase()&&n===n.toUpperCase()&&n!==n.toLowerCase()&&i.push(n)}return i.length>=2?i.join(``).toUpperCase():r.slice(0,2).toUpperCase()}function xde(e){let t=e.trim();if(!t)return e;if(t.includes(` `)||!/[-_]/.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);return n.length?n.map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):t}var Sde={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`,"claude-acp":`claude`,"codex-acp":`openai`,"github-copilot-cli":`github`};function Cde(e){return e?Sde[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}function wde(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2;if(i===a)return[0,0,o*100];let s=i-a,c=o>.5?s/(2-i-a):s/(i+a),l;return l=i===t?((n-r)/s+(n<r?6:0))/6:i===n?((r-t)/s+2)/6:((t-n)/s+4)/6,[l*360,c*100,o*100]}function Tde(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function Ede(e){let[t]=wde(e);return Tde(t,45,32)}var Dde=[`Curious`,`Brave`,`Clever`,`Swift`,`Gentle`,`Bright`,`Wise`,`Bold`,`Calm`,`Keen`],Ode=[`Bird`,`Cat`,`Dog`,`Fish`,`Mouse`,`Rabbit`,`Shrimp`,`Snail`,`Squirrel`,`Turtle`],P9=`ok-user-name-v3`,F9=`ok-user-color-v3`;function I9(e){return e[Math.floor(Math.random()*e.length)]}function kde(){return`${I9(Dde)} ${I9(Ode)}`}function Ade(){return I9(N9)}function L9(e){try{return localStorage.getItem(e)}catch{return null}}function R9(e,t){try{localStorage.setItem(e,t)}catch{}}function jde(){let e=new URLSearchParams(window.location.search).get(`coeditor`)||`standalone`,t=M9(),n=L9(P9),r=L9(F9);return n||(n=kde(),R9(P9,n)),r||(r=Ade(),R9(F9,r)),{name:n,color:r,coeditor:e,tabId:t}}function Mde(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}function Nde(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}var z9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function B9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function V9(e){return e.split(`/`).filter(Boolean)}function H9(e){let t=e.trim();return z9.test(t)||t.startsWith(`//`)}function Pde(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(H9(n))return{kind:`external`,url:n};let r=n.indexOf(`#`),i=r<0?n:n.slice(0,r),a=Ap(i,t);if(a)return{kind:`doc`,docName:a,anchor:r<0?null:n.slice(r+1)};let o=kp(i,t);if(o)return{kind:`doc`,docName:o,anchor:r<0?null:n.slice(r+1)};let s=Mde(n,t);if(s)return{kind:`doc`,docName:s.docName,anchor:s.anchor};let c=B9(n);return c&&c!==`md`&&c!==`mdx`?{kind:`asset`,url:n,ext:c}:null}function Fde(e,t){let n=e.trim();if(!n)return null;if(H9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=B9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function Ide(e,t){let n=e.trim();if(!n||z9.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function Lde(e,t,n=null,r=`.md`){let i=V9(e);i.pop();let a=V9(t),o=0;for(;o<i.length&&o<a.length&&i[o]===a[o];)o+=1;let s=i.slice(o).map(()=>`..`),c=a.slice(o),l=[...s,...c].join(`/`);return l||=a.at(-1)??t,!l.startsWith(`./`)&&!l.startsWith(`../`)&&(l=`./${l}`),`${l}${r}${n?`#${n}`:``}`}function Rde(e){return e.replace(/[/\\:*?"<>|\0]/g,`-`).replace(/\s+/g,` `).replace(/-+/g,`-`).trim().replace(/^[-.\s]+|[-.\s]+$/g,``)}function U9(e){return`pagesBySlug`in e}function W9(e){return U9(e)?e.pages:e}function G9(e,t){return U9(e)?e.assetPaths??new Set:t??new Set}function K9(e,t){return U9(e)?e.filePaths??new Set:t??new Set}function q9(e,t){return e<t?-1:+(e>t)}function zde(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function Bde(e,t){let n=new Map,r=[...e].sort(q9);for(let e of r){let r=e.lastIndexOf(`/`),i=t(r===-1?e:e.slice(r+1));i&&!n.has(i)&&n.set(i,e)}return n}function J9(e,t){let n=K5(e);if(n){if(U9(t))return t.pagesBySlug.get(n);for(let e of t)if(K5(e)===n)return e}}function Y9(e,t){if(e.includes(`/`))return;let n=K5(e);if(!n)return;if(U9(t))return t.pagesByBasename?.get(n);let r;for(let e of t){let t=e.lastIndexOf(`/`);K5(t===-1?e:e.slice(t+1))===n&&(r===void 0||q9(e,r)<0)&&(r=e)}return r}function X9(e){let t=e.trim();if(!t)return[];let n=K5(t);return n.length>0&&n!==t?[n]:[]}function Z9(e,t){let n=e.trim();if(!n)return;let r=W9(t);if(r.has(n))return n;let i=J9(n,t);if(i)return i;for(let e of X9(n))if(r.has(e))return e;return Q9(n,r)||Y9(n,t)}function Q9(e,t){let n=`${e}/index`;if(t.has(n))return n;let r=e.lastIndexOf(`/`),i=r===-1?e:e.slice(r+1),a=i?`${e}/${i}`:null;if(a&&t.has(a))return a}function Vde(e){let t=((e.trim().split(`#`)[0]??``).trim().split(`?`)[0]??``).trim();return t.startsWith(`/`)?t.slice(1):t}function $9(e,t,n){let r=Vde(e);if(!r)return null;let i=r.toLowerCase(),a=n?[t,n]:[t];for(let e of a){if(e.has(r))return r;for(let t of e)if(t.toLowerCase()===i)return t}if(r.includes(`/`))return null;let o=[];for(let e of a)for(let t of e){let e=t.lastIndexOf(`/`);(e===-1?t:t.slice(e+1)).toLowerCase()===i&&o.push(t)}return o.length===0?null:o.sort(q9)[0]??null}function Hde(e,t,n,r){let i=e.trim();if(!i)return!1;if($9(i,G9(t,n),K9(t,r)))return!0;let a=W9(t);return a.has(i)||X9(i).some(e=>a.has(e))||J9(i,t)!==void 0||Q9(i,a)?!0:Y9(i,t)!==void 0}function Ude(e,t,n){let r=Fde(e,t);return r===null||r.kind!==`asset`||$9(r.url,G9(n),K9(n))!==null||Z9(e,n)===void 0?r:{kind:`doc`,docName:e.trim(),anchor:t?.trim()||null}}export{Joe as $,W as $a,KA as $i,d8 as $n,Qu as $o,ale as $r,YZ as $t,U7 as A,Zw as Aa,$Y as Ai,eY as An,Hp as Ao,Y2 as Ar,Nf as As,aZ as At,N9 as B,v_ as Ba,mQ as Bi,LQ as Bn,Tp as Bo,EX as Br,z as Bs,$$ as Bt,Fce as C,Ow as Ca,h7 as Ci,zde as Cn,_m as Co,X9 as Cr,md as Cs,Lse as Ct,TX as D,PC as Da,$9 as Di,ude as Dn,im as Do,Cde as Dr,_d as Ds,SZ as Dt,D9 as E,dE as Ea,s1 as Ei,rde as En,bp as Eo,b0 as Er,Ou as Es,ase as Et,_X as F,Wx as Fa,ede as Fi,vY as Fn,Qp as Fo,Z2 as Fr,ff as Fs,qce as Ft,eZ as G,pg as Ga,Koe as Gi,RQ as Gn,Ju as Go,Boe as Gr,B as Gs,H7 as Gt,oce as H,Xg as Ha,lQ as Hi,zQ as Hn,lm as Ho,nse as Hr,I as Hs,W$ as Ht,yue as I,wS as Ia,_5 as Ii,m5 as In,Ip as Io,J2 as Ir,Bf as Is,D7 as It,wX as J,Sg as Ja,l1 as Ji,Kle as Jn,Ed as Jo,lde as Jr,kt as Js,vle as Jt,tZ as K,yg as Ka,K5 as Ki,IQ as Kn,xd as Ko,w5 as Kr,L as Ks,A7 as Kt,c9 as L,t_ as La,c1 as Li,f$ as Ln,Fp as Lo,$2 as Lr,Nu as Ls,Jce as Lt,Use as M,aE as Ma,Rde as Mi,KX as Mn,Mp as Mo,n4 as Mr,lf as Ms,hde as Mt,Hse as N,LS as Na,pde as Ni,yde as Nn,Vp as No,Q2 as Nr,Vd as Ns,Xce as Nt,Hce as O,dC as Oa,Ude as Oi,ide as On,wp as Oo,r4 as Or,Bd as Os,Vce as Ot,Ice as P,Vx as Pa,aY as Pi,_Y as Pn,Dp as Po,t4 as Pr,mf as Ps,Kce as Pt,ice as Q,hh as Qa,ej as Qi,cse as Qn,Ef as Qo,oZ as Qr,DX as Qt,Yse as R,q as Ra,E5 as Ri,VQ as Rn,Hm as Ro,e4 as Rr,pf as Rs,Yce as Rt,Bse as S,Ew as Sa,i1 as Si,Bde as Sn,Sm as So,jde as Sr,ip as Ss,n1 as St,Roe as T,Yw as Ta,Ide as Ti,EQ as Tn,xm as To,yX as Tr,Tu as Ts,oY as Tt,tie as U,K as Ua,Pae as Ui,w$ as Un,Vu as Uo,A$ as Ur,F as Us,U$ as Ut,f0 as V,G as Va,TQ as Vi,T$ as Vn,Bp as Vo,H9 as Vr,Bo as Vs,z$ as Vt,QX as W,vg as Wa,$X as Wi,u$ as Wn,Xu as Wo,o2 as Wr,wa as Ws,q$ as Wt,dZ as X,$h as Xa,MQ as Xi,QY as Xn,$u as Xo,sZ as Xr,wt as Xs,SQ as Xt,M5 as Y,Jg as Ya,J5 as Yi,bde as Yn,Ff as Yo,k$ as Yr,jt as Ys,hle as Yt,Qse as Z,U as Za,d9 as Zi,ZY as Zn,Tf as Zo,Hde as Zr,CQ as Zt,fY as _,rw as _a,lY as _i,dX as _n,nm as _o,jae as _r,ku as _s,IX as _t,nY as a,wk as aa,kse as ai,$oe as an,mp as ao,wce as ar,yd as as,xZ as at,zX as b,Fw as ba,nde as bi,dQ as bn,Sp as bo,zle as br,Bu as bs,zse as bt,jle as c,nE as ca,GX as ci,sQ as cn,Gp as co,dY as cr,Ku as cs,NQ as ct,Mle as d,Jw as da,tQ as di,C$ as dn,om as do,B9 as dr,Ld as ds,PX as dt,YA as ea,vue as ei,ple as en,Wm as eo,U2 as er,Cd as es,ese as et,Nle as f,TE as fa,n8 as fi,Nde as fn,yp as fo,Sue as fr,Mf as fs,NX as ft,QJ as g,uE as ga,Ble as gi,tue as gn,Jp as go,ise as gr,_f as gs,FX as gt,bX as h,tw as ha,a2 as hi,aX as hn,um as ho,qX as hr,Au as hs,k9 as ht,kce as i,Ck as ia,Mse as ii,r1 as in,hp as io,kX as ir,Gu as is,wae as it,u7 as j,SE as ja,Lle as ji,tY as jn,Rp as jo,X2 as jr,Rd as js,mle as jt,Rse as k,gw as ka,Z9 as ki,Pde as kn,Pp as ko,i4 as kr,Mu as ks,rZ as kt,Fle as l,VT as la,gue as li,nce as ln,Yp as lo,vX as lr,ed as ls,PQ as lt,xX as m,CE as ma,sde as mi,roe as mn,em as mo,GY as mr,sf as ms,ace as mt,vde as n,yk as na,lse as ni,RX as nn,gp as no,Mue as nr,zu as ns,W5 as nt,Kse as o,dk as oa,x0 as oi,Qoe as on,Wp as oo,sse as or,vd as os,noe as ot,Ale as p,EE as pa,ode as pi,ioe as pn,tm as po,Ule as pr,Iu as ps,AX as pt,nZ as q,Cg as qa,uY as qi,FQ as qn,Td as qo,jX as qr,N as qs,yle as qt,Oce as r,ck as ra,a1 as ri,LX as rn,pp as ro,Ede as rr,Yu as rs,A9 as rt,Gse as s,pne as sa,fX as si,iQ as sn,Xp as so,dle as sr,Zd as ss,toe as st,_de as t,JA as ta,c2 as ti,Uce as tn,$p as to,Pue as tr,Af as ts,uce as tt,Ple as u,wT as ua,K8 as ui,_ue as un,Kp as uo,aQ as ur,jd as us,cle as ut,SX as v,iw as va,nQ as vi,uQ as vn,fp as vo,a5 as vr,sp as vs,zce as vt,Pce as w,kw as wa,m7 as wi,Lde as wn,Cp as wo,rQ as wr,Eu as ws,sY as wt,o7 as x,_w as xa,M9 as xi,pQ as xn,xp as xo,q5 as xr,gd as xs,e1 as xt,j9 as y,Pw as ya,p2 as yi,wQ as yn,Rm as yo,xde as yr,Ad as ys,Lce as yt,Xoe as z,h_ as za,cQ as zi,BQ as zn,sm as zo,uZ as zr,df as zs,Zce as zt};