@inkeep/open-knowledge 0.30.0-beta.2 → 0.30.0-beta.4

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 (80) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +11 -11
  4. package/dist/config-schema.json +24 -0
  5. package/dist/config.project-local.schema.json +24 -0
  6. package/dist/constants-UBjBavXu.mjs +2 -0
  7. package/dist/{dist-DJ0wJimx.mjs → dist-B5JbDwWb.mjs} +1 -1
  8. package/dist/{dist-DAVo_TRx.mjs → dist-DXIG2Jyg.mjs} +7 -7
  9. package/dist/{gh-detect-BxDh8M_E.mjs → gh-detect-BMbpd_Yj.mjs} +2 -2
  10. package/dist/index.mjs +1 -1
  11. package/dist/{init-E8FDYW-D.mjs → init-CkBE_apM.mjs} +3 -3
  12. package/dist/init-CoL8N4la.mjs +1 -0
  13. package/dist/{launch-json-removal-ByWYRF7W.mjs → launch-json-removal-YtOryh7V.mjs} +2 -2
  14. package/dist/{loader-Bi7zAoyk.mjs → loader-BOmEZv00.mjs} +2 -2
  15. package/dist/loader-eceKqMkc.mjs +1 -0
  16. package/dist/{open-browser-6ztGUs93.mjs → open-browser-gwoFcjXN.mjs} +2 -2
  17. package/dist/{preview-hq0cdoZw.mjs → preview-CJm1A1UQ.mjs} +2 -2
  18. package/dist/preview-DHkr2cX1.mjs +1 -0
  19. package/dist/public/assets/{ActivityModeContent-D1snXuNs.js → ActivityModeContent-C0_GSBuC.js} +1 -1
  20. package/dist/public/assets/{CodeMirrorPropInput-C3FZ7AWB.js → CodeMirrorPropInput-C2VECyjO.js} +2 -2
  21. package/dist/public/assets/{DocumentContext-CPgyt-fa.js → DocumentContext-f6XQqg_y.js} +7 -7
  22. package/dist/public/assets/{EnableSyncConfirmDialog-a1BAa003.js → EnableSyncConfirmDialog-BhwhYBFL.js} +1 -1
  23. package/dist/public/assets/{GraphPanel-Dqn1R3FA.js → GraphPanel-ByzLo6-b.js} +1 -1
  24. package/dist/public/assets/{ManagedArtifactProperties-D9gtQzwY.js → ManagedArtifactProperties-DAzdDsOt.js} +1 -1
  25. package/dist/public/assets/{McpConsentDialogBody-B3eYpOil.js → McpConsentDialogBody-BwDo5LSJ.js} +1 -1
  26. package/dist/public/assets/{MermaidDocEditor-CZKy1wMI.js → MermaidDocEditor-BpnOw4CA.js} +1 -1
  27. package/dist/public/assets/{PropertyPanel-k3LSAy4u.js → PropertyPanel-B3wmhQBT.js} +1 -1
  28. package/dist/public/assets/SettingsDialogBody-DVvKGL9J.js +7 -0
  29. package/dist/public/assets/{ShareBranchSwitchDialog-OJA4wjqQ.js → ShareBranchSwitchDialog-i35Gg8js.js} +1 -1
  30. package/dist/public/assets/{ShareReceiveDialog-7EizE4VA.js → ShareReceiveDialog-LrK6Us6O.js} +1 -1
  31. package/dist/public/assets/{ShareReceiveMissDialog-D8Up16fz.js → ShareReceiveMissDialog-CEV0ExUm.js} +1 -1
  32. package/dist/public/assets/{SkillEditorActions-B25PfvD1.js → SkillEditorActions-BoEoI6NN.js} +1 -1
  33. package/dist/public/assets/{SourceEditor-D_fZ07fz.js → SourceEditor-DuPpY_T6.js} +1 -1
  34. package/dist/public/assets/{TerminalPanel-Dw3H1oil.js → TerminalPanel-Di7sR9_K.js} +1 -1
  35. package/dist/public/assets/{agent-presence-c_qxeP7e.js → agent-presence-DOgDiPgh.js} +1 -1
  36. package/dist/public/assets/{auth-state-cache-D4z3eiMF.js → auth-state-cache-CZRVpVW6.js} +3 -3
  37. package/dist/public/assets/{config-provider-BONo47Qc.js → config-provider-BnOnKhga.js} +1 -1
  38. package/dist/public/assets/{dist-CJfVM-iJ.js → dist-D7PDymSy.js} +3 -3
  39. package/dist/public/assets/{dist-BDGd7UYM.js → dist-xdRBzARh.js} +1 -1
  40. package/dist/public/assets/{doc-hash-BLS3MEoj.js → doc-hash-i5oNLfum.js} +1 -1
  41. package/dist/public/assets/{documents-events-H4-z8Qjp.js → documents-events-D26lhbOZ.js} +1 -1
  42. package/dist/public/assets/file-tree-adapter-N1FVhfKw.js +1 -0
  43. package/dist/public/assets/index-KSKNKDpJ.js +2003 -0
  44. package/dist/public/assets/{keyboard-shortcuts-DnJWzgZ1.js → keyboard-shortcuts-Bgozgsx2.js} +1 -1
  45. package/dist/public/assets/navigation-targets-D_wZddL9.js +1 -0
  46. package/dist/public/assets/{open-managed-artifact-tab-NBmHUyDy.js → open-managed-artifact-tab-kOn8WHrp.js} +1 -1
  47. package/dist/public/assets/{pending-receive-nav-store-D7JjzV1n.js → pending-receive-nav-store-CDyGvnwD.js} +1 -1
  48. package/dist/public/assets/{prop-types-Cl1SYZho.js → prop-types-BK5m4zFC.js} +1 -1
  49. package/dist/public/assets/{receive-store-DWC9dc5j.js → receive-store-Jc3PEGIh.js} +1 -1
  50. package/dist/public/assets/{selection-context-DALYXIVY.js → selection-context-72mLve4s.js} +1 -1
  51. package/dist/public/assets/{skill-actions-BV30AE89.js → skill-actions-CeU8Dbpm.js} +1 -1
  52. package/dist/public/assets/{skills-api-B0z9Mw2W.js → skills-api-k47WvkqQ.js} +1 -1
  53. package/dist/public/assets/{src-DZ97WDxX.js → src-B6vksAtW.js} +1 -1
  54. package/dist/public/assets/{target-navigation-intent-CpKCAQDV.js → target-navigation-intent-DEwTup1R.js} +1 -1
  55. package/dist/public/assets/{typing-burst-detector-ko_Nb-fG.js → typing-burst-detector-BC1YUpwK.js} +1 -1
  56. package/dist/public/assets/{workspace-paths-CMbeqczX.js → workspace-paths-D4weWrbA.js} +1 -1
  57. package/dist/public/index.html +25 -25
  58. package/dist/{repair-launch-json-BdfDMobg.mjs → repair-launch-json-DO2QDHDR.mjs} +2 -2
  59. package/dist/{repair-mcp-configs-DZMxi-7M.mjs → repair-mcp-configs-RYSmTXdj.mjs} +2 -2
  60. package/dist/{repair-skills-zutt1is6.mjs → repair-skills-BrAdfxB-.mjs} +2 -2
  61. package/dist/repair-skills-NtsjF26d.mjs +1 -0
  62. package/dist/schemas/v0/config.project-local.schema.json +24 -0
  63. package/dist/server-lock-GuuouVft-CXM0Fdz7.mjs +1 -0
  64. package/dist/{server-lock-iLcBw_q0-RDMfTH6b.mjs → server-lock-iLcBw_q0-DB1Ahu2b.mjs} +3 -3
  65. package/dist/{src-Bi9Si6vM.mjs → src-2ZRymDy2.mjs} +2 -2
  66. package/dist/{start-DqcZAaBv.mjs → start-CR2-ryWz.mjs} +2 -2
  67. package/dist/start-D2aYJnFK.mjs +1 -0
  68. package/dist/{write-project-skill-BzVHToYO.mjs → write-project-skill-XZCJ5TEZ.mjs} +2 -2
  69. package/package.json +1 -1
  70. package/dist/constants-BGBZW_Qv.mjs +0 -2
  71. package/dist/init-B02GcqsQ.mjs +0 -1
  72. package/dist/loader-CT3CzsPt.mjs +0 -1
  73. package/dist/preview-DtuXRRGi.mjs +0 -1
  74. package/dist/public/assets/SettingsDialogBody-do88Fri6.js +0 -7
  75. package/dist/public/assets/file-tree-adapter-B8tTfm_Y.js +0 -1
  76. package/dist/public/assets/index-Ci4eWUi8.js +0 -2003
  77. package/dist/public/assets/navigation-targets-DM3L8UZy.js +0 -1
  78. package/dist/repair-skills-B0TdudPZ.mjs +0 -1
  79. package/dist/server-lock-GuuouVft-CCnjEa8y.mjs +0 -1
  80. package/dist/start-CDJKwObu.mjs +0 -1
@@ -142,13 +142,13 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
142
142
 
143
143
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Fr,s=!br.jitless,c=s&&Ir.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?ro([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function oo(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=>!Zr(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=>ei(e,r,xr())))}),t)}var so=D(`$ZodUnion`,(e,t)=>{va.init(e,t),kr(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),kr(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),kr(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),kr(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=>Er(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>oo(t,i,e,a)):oo(s,i,e,a)}}),co=D(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,so.init(e,t);let n=e._zod.parse;kr(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=wr(()=>{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(!Fr(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?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),lo=D(`$ZodIntersection`,(e,t)=>{va.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])=>fo(e,t,n)):fo(e,i,a)}});function uo(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Lr(e)&&Lr(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=uo(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=uo(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 fo(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}),Zr(e))return e;let o=uo(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var po=D(`$ZodRecord`,(e,t)=>{va.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Lr(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 e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...Qr(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Qr(e,o.issues)),n.value[e]=o.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__`)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`&&Ji.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=>ei(e,r,xr())),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(...Qr(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Qr(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),mo=D(`$ZodEnum`,(e,t)=>{va.init(e,t);let n=Sr(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>zr.has(typeof e)).map(e=>typeof e==`string`?Br(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}}),ho=D(`$ZodLiteral`,(e,t)=>{if(va.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`?Br(e):e?Br(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}}),go=D(`$ZodTransform`,(e,t)=>{va.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new yr(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));if(i instanceof Promise)throw new vr;return n.value=i,n}});function _o(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var vo=D(`$ZodOptional`,(e,t)=>{va.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,kr(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),kr(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Er(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>_o(t,e.value)):_o(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),yo=D(`$ZodExactOptional`,(e,t)=>{vo.init(e,t),kr(e._zod,`values`,()=>t.innerType._zod.values),kr(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),bo=D(`$ZodNullable`,(e,t)=>{va.init(e,t),kr(e._zod,`optin`,()=>t.innerType._zod.optin),kr(e._zod,`optout`,()=>t.innerType._zod.optout),kr(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Er(e.source)}|null)$`):void 0}),kr(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)}),xo=D(`$ZodDefault`,(e,t)=>{va.init(e,t),e._zod.optin=`optional`,kr(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=>So(e,t)):So(r,t)}});function So(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Co=D(`$ZodPrefault`,(e,t)=>{va.init(e,t),e._zod.optin=`optional`,kr(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))}),wo=D(`$ZodNonOptional`,(e,t)=>{va.init(e,t),kr(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=>To(t,e)):To(i,e)}});function To(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 Eo=D(`$ZodCatch`,(e,t)=>{va.init(e,t),kr(e._zod,`optin`,()=>t.innerType._zod.optin),kr(e._zod,`optout`,()=>t.innerType._zod.optout),kr(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=>ei(e,n,xr()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ei(e,n,xr()))},input:e.value}),e.issues=[]),e)}}),Do=D(`$ZodPipe`,(e,t)=>{va.init(e,t),kr(e._zod,`values`,()=>t.in._zod.values),kr(e._zod,`optin`,()=>t.in._zod.optin),kr(e._zod,`optout`,()=>t.out._zod.optout),kr(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=>Oo(e,t.in,n)):Oo(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Oo(e,t.out,n)):Oo(r,t.out,n)}});function Oo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ko=D(`$ZodReadonly`,(e,t)=>{va.init(e,t),kr(e._zod,`propValues`,()=>t.innerType._zod.propValues),kr(e._zod,`values`,()=>t.innerType._zod.values),kr(e._zod,`optin`,()=>t.innerType?._zod?.optin),kr(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(Ao):Ao(r)}});function Ao(e){return e.value=Object.freeze(e.value),e}var jo=D(`$ZodLazy`,(e,t)=>{va.init(e,t),kr(e._zod,`innerType`,()=>t.getter()),kr(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),kr(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),kr(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),kr(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Mo=D(`$ZodCustom`,(e,t)=>{$i.init(e,t),va.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=>No(t,n,r,e));No(i,n,r,e)}});function No(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(ni(e))}}var Po,Fo=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 Io(){return new Fo}(Po=globalThis).__zod_globalRegistry??(Po.__zod_globalRegistry=Io());var Lo=globalThis.__zod_globalRegistry;function Ro(e,t){return new e({type:`string`,...O(t)})}function zo(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...O(t)})}function Bo(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...O(t)})}function Vo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...O(t)})}function Ho(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...O(t)})}function Uo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...O(t)})}function Wo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...O(t)})}function Go(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...O(t)})}function Ko(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...O(t)})}function qo(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...O(t)})}function Jo(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...O(t)})}function Yo(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...O(t)})}function Xo(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...O(t)})}function Zo(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...O(t)})}function Qo(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...O(t)})}function $o(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...O(t)})}function es(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...O(t)})}function ts(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...O(t)})}function ns(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...O(t)})}function rs(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...O(t)})}function is(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...O(t)})}function as(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...O(t)})}function ss(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...O(t)})}function cs(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...O(t)})}function ls(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...O(t)})}function us(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...O(t)})}function ds(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...O(t)})}function fs(e,t){return new e({type:`number`,checks:[],...O(t)})}function ps(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...O(t)})}function ms(e,t){return new e({type:`boolean`,...O(t)})}function hs(e,t){return new e({type:`null`,...O(t)})}function gs(e){return new e({type:`unknown`})}function _s(e,t){return new e({type:`never`,...O(t)})}function vs(e,t){return new ta({check:`less_than`,...O(t),value:e,inclusive:!1})}function ys(e,t){return new ta({check:`less_than`,...O(t),value:e,inclusive:!0})}function bs(e,t){return new na({check:`greater_than`,...O(t),value:e,inclusive:!1})}function xs(e,t){return new na({check:`greater_than`,...O(t),value:e,inclusive:!0})}function Ss(e,t){return new ra({check:`multiple_of`,...O(t),value:e})}function Cs(e,t){return new aa({check:`max_length`,...O(t),maximum:e})}function ws(e,t){return new oa({check:`min_length`,...O(t),minimum:e})}function Ts(e,t){return new sa({check:`length_equals`,...O(t),length:e})}function Es(e,t){return new la({check:`string_format`,format:`regex`,...O(t),pattern:e})}function Ds(e){return new ua({check:`string_format`,format:`lowercase`,...O(e)})}function Os(e){return new da({check:`string_format`,format:`uppercase`,...O(e)})}function ks(e,t){return new fa({check:`string_format`,format:`includes`,...O(t),includes:e})}function As(e,t){return new pa({check:`string_format`,format:`starts_with`,...O(t),prefix:e})}function js(e,t){return new ma({check:`string_format`,format:`ends_with`,...O(t),suffix:e})}function Ms(e){return new ha({check:`overwrite`,tx:e})}function Ns(e){return Ms(t=>t.normalize(e))}function Ps(){return Ms(e=>e.trim())}function Fs(){return Ms(e=>e.toLowerCase())}function Is(){return Ms(e=>e.toUpperCase())}function Ls(){return Ms(e=>Nr(e))}function Rs(e,t,n){return new e({type:`array`,element:t,...O(n)})}function zs(e,t,n){let r=O(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Bs(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...O(n)})}function Vs(e){let t=Hs(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(ni(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(ni(r))}},e(n.value,n)));return t}function Hs(e,t){let n=new $i({check:`custom`,...O(t)});return n._zod.check=e,n}function Us(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??Lo,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 Ws(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,Ws(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`&&qs(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Gs(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>
144
144
 
145
- 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 Ks(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.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Ys(t,`input`,e.processors),output:Ys(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function qs(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 qs(r.element,n);if(r.type===`set`)return qs(r.valueType,n);if(r.type===`lazy`)return qs(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 qs(r.innerType,n);if(r.type===`intersection`)return qs(r.left,n)||qs(r.right,n);if(r.type===`record`||r.type===`map`)return qs(r.keyType,n)||qs(r.valueType,n);if(r.type===`pipe`)return qs(r.in,n)||qs(r.out,n);if(r.type===`object`){for(let e in r.shape)if(qs(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(qs(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(qs(e,n))return!0;return!!(r.rest&&qs(r.rest,n))}return!1}var Js=(e,t={})=>n=>{let r=Us({...n,processors:t});return Ws(e,r),Gs(r,e),Ks(r,e)},Ys=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Us({...i??{},target:a,io:t,processors:n});return Ws(e,o),Gs(o,e),Ks(o,e)},Xs={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Zs=(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=Xs[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}))])}},Qs=(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`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},$s=(e,t,n,r)=>{n.type=`boolean`},ec=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},tc=(e,t,n,r)=>{n.not={}},nc=(e,t,n,r)=>{let i=e._zod.def,a=Sr(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},rc=(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},ic=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ac=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},oc=(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=Ws(a.element,t,{...r,path:[...r.path,`items`]})},sc=(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]=Ws(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=Ws(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},cc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ws(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},lc=(e,t,n,r)=>{let i=e._zod.def,a=Ws(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ws(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]]},uc=(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=Ws(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=Ws(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ws(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)}},dc=(e,t,n,r)=>{let i=e._zod.def,a=Ws(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`}]},fc=(e,t,n,r)=>{let i=e._zod.def;Ws(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},pc=(e,t,n,r)=>{let i=e._zod.def;Ws(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},mc=(e,t,n,r)=>{let i=e._zod.def;Ws(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)))},hc=(e,t,n,r)=>{let i=e._zod.def;Ws(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},gc=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Ws(a,t,r);let o=t.seen.get(e);o.ref=a},_c=(e,t,n,r)=>{let i=e._zod.def;Ws(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},vc=(e,t,n,r)=>{let i=e._zod.def;Ws(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},yc=(e,t,n,r)=>{let i=e._zod.innerType;Ws(i,t,r);let a=t.seen.get(e);a.ref=i},bc=D(`ZodISODateTime`,(e,t)=>{Ma.init(e,t),Oc.init(e,t)});function xc(e){return cs(bc,e)}var Sc=D(`ZodISODate`,(e,t)=>{Na.init(e,t),Oc.init(e,t)});function Cc(e){return ls(Sc,e)}var dee=D(`ZodISOTime`,(e,t)=>{Pa.init(e,t),Oc.init(e,t)});function fee(e){return us(dee,e)}var pee=D(`ZodISODuration`,(e,t)=>{Fa.init(e,t),Oc.init(e,t)});function mee(e){return ds(pee,e)}var wc=(e,t)=>{ii.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>uee(e,t)},flatten:{value:t=>lee(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Cr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Cr,2)}},isEmpty:{get(){return e.issues.length===0}}})};D(`ZodError`,wc);var Tc=D(`ZodError`,wc,{Parent:Error}),hee=oi(Tc),gee=ci(Tc),_ee=ui(Tc),vee=fi(Tc),yee=mi(Tc),bee=hi(Tc),xee=gi(Tc),See=_i(Tc),Cee=vi(Tc),wee=yi(Tc),Tee=bi(Tc),Eee=xi(Tc),Ec=D(`ZodType`,(e,t)=>(va.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ys(e,`input`),output:Ys(e,`output`)}}),e.toJSONSchema=Js(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(jr(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Vr(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>hee(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>_ee(e,t,n),e.parseAsync=async(t,n)=>gee(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>vee(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>yee(e,t,n),e.decode=(t,n)=>bee(e,t,n),e.encodeAsync=async(t,n)=>xee(e,t,n),e.decodeAsync=async(t,n)=>See(e,t,n),e.safeEncode=(t,n)=>Cee(e,t,n),e.safeDecode=(t,n)=>wee(e,t,n),e.safeEncodeAsync=async(t,n)=>Tee(e,t,n),e.safeDecodeAsync=async(t,n)=>Eee(e,t,n),e.refine=(t,n)=>e.check(El(t,n)),e.superRefine=t=>e.check(Dl(t)),e.overwrite=t=>e.check(Ms(t)),e.optional=()=>al(e),e.exactOptional=()=>sl(e),e.nullable=()=>ll(e),e.nullish=()=>al(ll(e)),e.nonoptional=t=>hl(e,t),e.array=()=>M(e),e.or=t=>qc([e,t]),e.and=t=>Zc(e,t),e.transform=t=>yl(e,rl(t)),e.default=t=>dl(e,t),e.prefault=t=>pl(e,t),e.catch=t=>_l(e,t),e.pipe=t=>yl(e,t),e.readonly=()=>xl(e),e.describe=t=>{let n=e.clone();return Lo.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Lo.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Lo.get(e);let n=e.clone();return Lo.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Dc=D(`_ZodString`,(e,t)=>{ya.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zs(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Es(...t)),e.includes=(...t)=>e.check(ks(...t)),e.startsWith=(...t)=>e.check(As(...t)),e.endsWith=(...t)=>e.check(js(...t)),e.min=(...t)=>e.check(ws(...t)),e.max=(...t)=>e.check(Cs(...t)),e.length=(...t)=>e.check(Ts(...t)),e.nonempty=(...t)=>e.check(ws(1,...t)),e.lowercase=t=>e.check(Ds(t)),e.uppercase=t=>e.check(Os(t)),e.trim=()=>e.check(Ps()),e.normalize=(...t)=>e.check(Ns(...t)),e.toLowerCase=()=>e.check(Fs()),e.toUpperCase=()=>e.check(Is()),e.slugify=()=>e.check(Ls())}),Dee=D(`ZodString`,(e,t)=>{ya.init(e,t),Dc.init(e,t),e.email=t=>e.check(zo(kc,t)),e.url=t=>e.check(Go(Mc,t)),e.jwt=t=>e.check(ss(Wee,t)),e.emoji=t=>e.check(Ko(Aee,t)),e.guid=t=>e.check(Bo(Ac,t)),e.uuid=t=>e.check(Vo(jc,t)),e.uuidv4=t=>e.check(Ho(jc,t)),e.uuidv6=t=>e.check(Uo(jc,t)),e.uuidv7=t=>e.check(Wo(jc,t)),e.nanoid=t=>e.check(qo(jee,t)),e.guid=t=>e.check(Bo(Ac,t)),e.cuid=t=>e.check(Jo(Mee,t)),e.cuid2=t=>e.check(Yo(Nee,t)),e.ulid=t=>e.check(Xo(Pee,t)),e.base64=t=>e.check(rs(Vee,t)),e.base64url=t=>e.check(is(Hee,t)),e.xid=t=>e.check(Zo(Fee,t)),e.ksuid=t=>e.check(Qo(Iee,t)),e.ipv4=t=>e.check($o(Lee,t)),e.ipv6=t=>e.check(es(Ree,t)),e.cidrv4=t=>e.check(ts(zee,t)),e.cidrv6=t=>e.check(ns(Bee,t)),e.e164=t=>e.check(as(Uee,t)),e.datetime=t=>e.check(xc(t)),e.date=t=>e.check(Cc(t)),e.time=t=>e.check(fee(t)),e.duration=t=>e.check(mee(t))});function k(e){return Ro(Dee,e)}var Oc=D(`ZodStringFormat`,(e,t)=>{ba.init(e,t),Dc.init(e,t)}),kc=D(`ZodEmail`,(e,t)=>{Ca.init(e,t),Oc.init(e,t)});function Oee(e){return zo(kc,e)}var Ac=D(`ZodGUID`,(e,t)=>{xa.init(e,t),Oc.init(e,t)}),jc=D(`ZodUUID`,(e,t)=>{Sa.init(e,t),Oc.init(e,t)}),Mc=D(`ZodURL`,(e,t)=>{wa.init(e,t),Oc.init(e,t)});function kee(e){return Go(Mc,e)}var Aee=D(`ZodEmoji`,(e,t)=>{Ta.init(e,t),Oc.init(e,t)}),jee=D(`ZodNanoID`,(e,t)=>{Ea.init(e,t),Oc.init(e,t)}),Mee=D(`ZodCUID`,(e,t)=>{Da.init(e,t),Oc.init(e,t)}),Nee=D(`ZodCUID2`,(e,t)=>{Oa.init(e,t),Oc.init(e,t)}),Pee=D(`ZodULID`,(e,t)=>{ka.init(e,t),Oc.init(e,t)}),Fee=D(`ZodXID`,(e,t)=>{Aa.init(e,t),Oc.init(e,t)}),Iee=D(`ZodKSUID`,(e,t)=>{ja.init(e,t),Oc.init(e,t)}),Lee=D(`ZodIPv4`,(e,t)=>{Ia.init(e,t),Oc.init(e,t)}),Ree=D(`ZodIPv6`,(e,t)=>{La.init(e,t),Oc.init(e,t)}),zee=D(`ZodCIDRv4`,(e,t)=>{Ra.init(e,t),Oc.init(e,t)}),Bee=D(`ZodCIDRv6`,(e,t)=>{za.init(e,t),Oc.init(e,t)}),Vee=D(`ZodBase64`,(e,t)=>{Va.init(e,t),Oc.init(e,t)}),Hee=D(`ZodBase64URL`,(e,t)=>{Ua.init(e,t),Oc.init(e,t)}),Uee=D(`ZodE164`,(e,t)=>{Wa.init(e,t),Oc.init(e,t)}),Wee=D(`ZodJWT`,(e,t)=>{Ka.init(e,t),Oc.init(e,t)}),Nc=D(`ZodNumber`,(e,t)=>{qa.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qs(e,t,n,r),e.gt=(t,n)=>e.check(bs(t,n)),e.gte=(t,n)=>e.check(xs(t,n)),e.min=(t,n)=>e.check(xs(t,n)),e.lt=(t,n)=>e.check(vs(t,n)),e.lte=(t,n)=>e.check(ys(t,n)),e.max=(t,n)=>e.check(ys(t,n)),e.int=t=>e.check(Fc(t)),e.safe=t=>e.check(Fc(t)),e.positive=t=>e.check(bs(0,t)),e.nonnegative=t=>e.check(xs(0,t)),e.negative=t=>e.check(vs(0,t)),e.nonpositive=t=>e.check(ys(0,t)),e.multipleOf=(t,n)=>e.check(Ss(t,n)),e.step=(t,n)=>e.check(Ss(t,n)),e.finite=()=>e;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 A(e){return fs(Nc,e)}var Pc=D(`ZodNumberFormat`,(e,t)=>{Ja.init(e,t),Nc.init(e,t)});function Fc(e){return ps(Pc,e)}var Ic=D(`ZodBoolean`,(e,t)=>{Ya.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$s(e,t,n,r)});function j(e){return ms(Ic,e)}var Lc=D(`ZodNull`,(e,t)=>{Xa.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ec(e,t,n,r)});function Rc(e){return hs(Lc,e)}var zc=D(`ZodUnknown`,(e,t)=>{Za.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Bc(){return gs(zc)}var Vc=D(`ZodNever`,(e,t)=>{Qa.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tc(e,t,n,r)});function Hc(e){return _s(Vc,e)}var Uc=D(`ZodArray`,(e,t)=>{eo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oc(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(ws(t,n)),e.nonempty=t=>e.check(ws(1,t)),e.max=(t,n)=>e.check(Cs(t,n)),e.length=(t,n)=>e.check(Ts(t,n)),e.unwrap=()=>e.element});function M(e,t){return Rs(Uc,e,t)}var Wc=D(`ZodObject`,(e,t)=>{ao.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sc(e,t,n,r),kr(e,`shape`,()=>t.shape),e.keyof=()=>P(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bc()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bc()}),e.strict=()=>e.clone({...e._zod.def,catchall:Hc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Kr(e,t),e.safeExtend=t=>qr(e,t),e.merge=t=>Jr(e,t),e.pick=t=>Wr(e,t),e.omit=t=>Gr(e,t),e.partial=(...t)=>Yr(il,e,t[0]),e.required=(...t)=>Xr(ml,e,t[0])});function N(e,t){return new Wc({type:`object`,shape:e??{},...O(t)})}function Gc(e,t){return new Wc({type:`object`,shape:e,catchall:Bc(),...O(t)})}var Kc=D(`ZodUnion`,(e,t)=>{so.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cc(e,t,n,r),e.options=t.options});function qc(e,t){return new Kc({type:`union`,options:e,...O(t)})}var Jc=D(`ZodDiscriminatedUnion`,(e,t)=>{Kc.init(e,t),co.init(e,t)});function Yc(e,t,n){return new Jc({type:`union`,options:t,discriminator:e,...O(n)})}var Xc=D(`ZodIntersection`,(e,t)=>{lo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lc(e,t,n,r)});function Zc(e,t){return new Xc({type:`intersection`,left:e,right:t})}var Qc=D(`ZodRecord`,(e,t)=>{po.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function $c(e,t,n){return new Qc({type:`record`,keyType:e,valueType:t,...O(n)})}var el=D(`ZodEnum`,(e,t)=>{mo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nc(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 el({...t,checks:[],...O(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 el({...t,checks:[],...O(r),entries:i})}});function P(e,t){return new el({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...O(t)})}var tl=D(`ZodLiteral`,(e,t)=>{ho.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rc(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 F(e,t){return new tl({type:`literal`,values:Array.isArray(e)?e:[e],...O(t)})}var nl=D(`ZodTransform`,(e,t)=>{go.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ac(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new yr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ni(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(ni(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function rl(e){return new nl({type:`transform`,transform:e})}var il=D(`ZodOptional`,(e,t)=>{vo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function al(e){return new il({type:`optional`,innerType:e})}var ol=D(`ZodExactOptional`,(e,t)=>{yo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sl(e){return new ol({type:`optional`,innerType:e})}var cl=D(`ZodNullable`,(e,t)=>{bo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ll(e){return new cl({type:`nullable`,innerType:e})}var ul=D(`ZodDefault`,(e,t)=>{xo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dl(e,t){return new ul({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rr(t)}})}var fl=D(`ZodPrefault`,(e,t)=>{Co.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pl(e,t){return new fl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rr(t)}})}var ml=D(`ZodNonOptional`,(e,t)=>{wo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hl(e,t){return new ml({type:`nonoptional`,innerType:e,...O(t)})}var gl=D(`ZodCatch`,(e,t)=>{Eo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _l(e,t){return new gl({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var vl=D(`ZodPipe`,(e,t)=>{Do.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gc(e,t,n,r),e.in=t.in,e.out=t.out});function yl(e,t){return new vl({type:`pipe`,in:e,out:t})}var bl=D(`ZodReadonly`,(e,t)=>{ko.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_c(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xl(e){return new bl({type:`readonly`,innerType:e})}var Sl=D(`ZodLazy`,(e,t)=>{jo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yc(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Cl(e){return new Sl({type:`lazy`,getter:e})}var wl=D(`ZodCustom`,(e,t)=>{Mo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ic(e,t,n,r)});function Tl(e,t){return zs(wl,e??(()=>!0),t)}function El(e,t={}){return Bs(wl,e,t)}function Dl(e){return Vs(e)}function Ol(e,t){return yl(rl(e),t)}var kl={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`,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`},Al=new Set(Object.keys(kl));function jl(e){return kl[e.toLowerCase().replace(/^\./,``)]??null}var Ml=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Nl=[`video/mp4`,`video/webm`,`video/ogg`],Pl=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Fl=[`application/pdf`],Il=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Ll=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Rl=new Set([`pdf`]),zl=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Bl=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(`.`)),Vl=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(`.`)),Hl=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(`.`)),Ul=`wikiembed`,Wl=`toast`,Gl=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(`.`)),Kl=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],ql=[`mp4`,`webm`,`mov`,`m4v`],Jl=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],Yl=[`pdf`],Xl=[`json`,`toml`,`lock`];function Zl(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}Zl(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,Kl,Il),Zl(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,ql,Ll),Zl(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Jl,zl),Zl(`SIDEBAR_PDF_ASSET_EXTENSIONS`,Yl,Rl),Zl(`FILE_ATTACHMENT_EXTENSIONS`,[...Bl],Gl),Zl(`WIKI_EMBED_EXTENSIONS`,[...Gl],Vl);var Ql=new Set(Kl),$l=new Set(ql),eu=new Set(Jl),tu=new Set(Yl),nu=new Set(Xl);Zl(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...Kl,...ql,...Jl,...Yl,...Xl])],Hl);var ru=new Set([`base`,`canvas`]),iu=new Set([`mmd`,`mermaid`]);function au(e){let t=e.lastIndexOf(`.`);return t<0?!1:iu.has(e.slice(t+1).toLowerCase())}new Set([...Vl,...ru,...iu]);function ou(e){let t=e.toLowerCase().replace(/^\./,``);return Ql.has(t)?`image`:$l.has(t)?`video`:eu.has(t)?`audio`:tu.has(t)?`pdf`:nu.has(t)||ru.has(t)?`text`:iu.has(t)?`mermaid`:Al.has(t)?`text`:null}var su=Symbol.for(`@inkeep/open-knowledge/field-registry`),cu=globalThis;cu[su]===void 0&&(cu[su]=Io());var lu=cu[su];function uu(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=du(t)?lu.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function du(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}var fu=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),pu=52428800,mu=26214400,hu=`https://api.openai.com/v1`,gu=`text-embedding-3-small`;function _u(e){let t=e.trim();return t===``?`./`:t}function vu(e){let t=_u(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}var yu=Gc({content:Gc({dir:k().register(lu,{scope:`project`,agentSettable:!1,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.`}).default(`.`),attachmentFolderPath:k().register(lu,{scope:`project`,agentSettable:!1,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(vu,{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:Gc({theme:P([`light`,`dark`,`system`]).register(lu,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),preview:Gc({autoOpen:j().register(lu,{scope:`user`,agentSettable:!1,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:Gc({showHiddenFiles:j().register(lu,{scope:`project-local`,agentSettable:!1,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)}).optional()}).default({preview:{autoOpen:!0}}),editor:Gc({wordWrap:j().register(lu,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0}),agents:Gc({autoApproveOkTools:j().register(lu,{scope:`user`,agentSettable:!1,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:Gc({enabled:j().register(lu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Whether this machine auto-pulls and auto-pushes git commits for this project. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared.`}).nullable().default(null),default:j().register(lu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's autoSync.enabled on first open: true = auto-sync on, false = off, null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.enabled choice overrides it.`}).nullable().default(null)}).default({enabled:null,default:null}),terminal:Gc({enabled:j().register(lu,{scope:`project-local`,agentSettable:!1,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}),telemetry:Gc({localSink:Gc({enabled:j().register(lu,{scope:`project`,agentSettable:!1,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:Gc({maxBytes:A().register(lu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(pu)}).default({maxBytes:pu}),logs:Gc({maxBytes:A().register(lu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(mu)}).default({maxBytes:mu}),attributeDenylist:M(k()).register(lu,{scope:`project`,agentSettable:!1,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([...fu])}).default({enabled:!0,spans:{maxBytes:pu},logs:{maxBytes:mu},attributeDenylist:[...fu]})}).default({localSink:{enabled:!0,spans:{maxBytes:pu},logs:{maxBytes:mu},attributeDenylist:[...fu]}}),search:Gc({semantic:Gc({enabled:j().register(lu,{scope:`project-local`,agentSettable:!1,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:k().register(lu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override for Azure / self-hosted / other providers. The API key is NOT stored here — set it with `ok embeddings set-key` (OS keyring)."}).default(hu),model:k().register(lu,{scope:`project-local`,agentSettable:!1,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(gu),dimensions:A().int().positive().register(lu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit to use the model's native size (1536 for text-embedding-3-small). Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality. Changing it re-embeds the corpus.`}).optional(),similarityFloor:A().min(0).max(1).register(lu,{scope:`project-local`,agentSettable:!1,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:hu,model:gu})}).default({semantic:{enabled:!1,baseUrl:hu,model:gu}})}),bu=`open-knowledge-config`;function xu(e,t,n){let a=i.getTracer(bu),o=t?{attributes:t}:{};return a.startActiveSpan(e,o,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:r.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Su(e,t){let n=i.getActiveSpan();n&&n.addEvent(e,t)}function Cu(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 wu(e,t){let n=e;for(let e of t){n=Cu(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Tu(e,t){let n=wu(e,t);if(n!==void 0)return uu(n)}function Eu(e,t){return e===`either`?!0:e===t}function Du(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=Tu(yu,i);a?.scope!==void 0&&(Eu(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 Ou(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(b(e.getIn(r,!0))||e.deleteIn(r))}}function ku(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)){Ou(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}Ou(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Au(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var ju=N({file:k(),line:A().int().min(1),column:A().int().min(1),snippet:k().optional()}),Mu=N({path:M(qc([k(),A()])),message:k(),issueCode:k(),params:$c(k(),Bc()).optional(),source:ju.optional()}),Nu=P([`user`,`project`,`project-local`,`either`]),Pu=P([`user`,`project`,`project-local`]),Fu=Yc(`code`,[N({code:F(`YAML_PARSE`),detail:k()}),N({code:F(`SCHEMA_INVALID`),issues:M(Mu)}),N({code:F(`SCOPE_VIOLATION`),path:M(k()),expectedScope:Nu,actualScope:Pu}),N({code:F(`NOT_AGENT_SETTABLE`),path:M(k())}),N({code:F(`MIXED_SCOPE`),paths:M(N({path:M(k()),scope:Pu}))}),N({code:F(`REMOVED_KEY`),path:M(k()),redirect:k(),source:ju.optional()}),N({code:F(`WRITE_ERROR`),detail:k()}),N({code:F(`OKIGNORE_INVALID`),detail:k(),lineNumber:A().int().min(1).optional()}),N({code:F(`UNKNOWN`),message:k().optional()})]),Iu=new Set(Fu.options.map(e=>e.shape.code.value)),Lu=qc([Fu,Gc({code:k(),message:k().optional()})]);function Ru(e){return Iu.has(e.code)}function zu(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 Bu(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 Vu(e){if(!Ru(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${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(`
145
+ 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 Ks(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.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Ys(t,`input`,e.processors),output:Ys(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function qs(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 qs(r.element,n);if(r.type===`set`)return qs(r.valueType,n);if(r.type===`lazy`)return qs(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 qs(r.innerType,n);if(r.type===`intersection`)return qs(r.left,n)||qs(r.right,n);if(r.type===`record`||r.type===`map`)return qs(r.keyType,n)||qs(r.valueType,n);if(r.type===`pipe`)return qs(r.in,n)||qs(r.out,n);if(r.type===`object`){for(let e in r.shape)if(qs(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(qs(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(qs(e,n))return!0;return!!(r.rest&&qs(r.rest,n))}return!1}var Js=(e,t={})=>n=>{let r=Us({...n,processors:t});return Ws(e,r),Gs(r,e),Ks(r,e)},Ys=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Us({...i??{},target:a,io:t,processors:n});return Ws(e,o),Gs(o,e),Ks(o,e)},Xs={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Zs=(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=Xs[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}))])}},Qs=(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`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},$s=(e,t,n,r)=>{n.type=`boolean`},ec=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},tc=(e,t,n,r)=>{n.not={}},nc=(e,t,n,r)=>{let i=e._zod.def,a=Sr(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},rc=(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},ic=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ac=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},oc=(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=Ws(a.element,t,{...r,path:[...r.path,`items`]})},sc=(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]=Ws(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=Ws(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},cc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ws(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},lc=(e,t,n,r)=>{let i=e._zod.def,a=Ws(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ws(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]]},uc=(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=Ws(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=Ws(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ws(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)}},dc=(e,t,n,r)=>{let i=e._zod.def,a=Ws(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`}]},fc=(e,t,n,r)=>{let i=e._zod.def;Ws(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},pc=(e,t,n,r)=>{let i=e._zod.def;Ws(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},mc=(e,t,n,r)=>{let i=e._zod.def;Ws(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)))},hc=(e,t,n,r)=>{let i=e._zod.def;Ws(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},gc=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Ws(a,t,r);let o=t.seen.get(e);o.ref=a},_c=(e,t,n,r)=>{let i=e._zod.def;Ws(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},vc=(e,t,n,r)=>{let i=e._zod.def;Ws(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},yc=(e,t,n,r)=>{let i=e._zod.innerType;Ws(i,t,r);let a=t.seen.get(e);a.ref=i},bc=D(`ZodISODateTime`,(e,t)=>{Ma.init(e,t),Oc.init(e,t)});function xc(e){return cs(bc,e)}var Sc=D(`ZodISODate`,(e,t)=>{Na.init(e,t),Oc.init(e,t)});function Cc(e){return ls(Sc,e)}var dee=D(`ZodISOTime`,(e,t)=>{Pa.init(e,t),Oc.init(e,t)});function fee(e){return us(dee,e)}var pee=D(`ZodISODuration`,(e,t)=>{Fa.init(e,t),Oc.init(e,t)});function mee(e){return ds(pee,e)}var wc=(e,t)=>{ii.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>uee(e,t)},flatten:{value:t=>lee(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Cr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Cr,2)}},isEmpty:{get(){return e.issues.length===0}}})};D(`ZodError`,wc);var Tc=D(`ZodError`,wc,{Parent:Error}),hee=oi(Tc),gee=ci(Tc),_ee=ui(Tc),vee=fi(Tc),yee=mi(Tc),bee=hi(Tc),xee=gi(Tc),See=_i(Tc),Cee=vi(Tc),wee=yi(Tc),Tee=bi(Tc),Eee=xi(Tc),Ec=D(`ZodType`,(e,t)=>(va.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ys(e,`input`),output:Ys(e,`output`)}}),e.toJSONSchema=Js(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(jr(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Vr(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>hee(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>_ee(e,t,n),e.parseAsync=async(t,n)=>gee(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>vee(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>yee(e,t,n),e.decode=(t,n)=>bee(e,t,n),e.encodeAsync=async(t,n)=>xee(e,t,n),e.decodeAsync=async(t,n)=>See(e,t,n),e.safeEncode=(t,n)=>Cee(e,t,n),e.safeDecode=(t,n)=>wee(e,t,n),e.safeEncodeAsync=async(t,n)=>Tee(e,t,n),e.safeDecodeAsync=async(t,n)=>Eee(e,t,n),e.refine=(t,n)=>e.check(El(t,n)),e.superRefine=t=>e.check(Dl(t)),e.overwrite=t=>e.check(Ms(t)),e.optional=()=>al(e),e.exactOptional=()=>sl(e),e.nullable=()=>ll(e),e.nullish=()=>al(ll(e)),e.nonoptional=t=>hl(e,t),e.array=()=>M(e),e.or=t=>qc([e,t]),e.and=t=>Zc(e,t),e.transform=t=>yl(e,rl(t)),e.default=t=>dl(e,t),e.prefault=t=>pl(e,t),e.catch=t=>_l(e,t),e.pipe=t=>yl(e,t),e.readonly=()=>xl(e),e.describe=t=>{let n=e.clone();return Lo.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Lo.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Lo.get(e);let n=e.clone();return Lo.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Dc=D(`_ZodString`,(e,t)=>{ya.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zs(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Es(...t)),e.includes=(...t)=>e.check(ks(...t)),e.startsWith=(...t)=>e.check(As(...t)),e.endsWith=(...t)=>e.check(js(...t)),e.min=(...t)=>e.check(ws(...t)),e.max=(...t)=>e.check(Cs(...t)),e.length=(...t)=>e.check(Ts(...t)),e.nonempty=(...t)=>e.check(ws(1,...t)),e.lowercase=t=>e.check(Ds(t)),e.uppercase=t=>e.check(Os(t)),e.trim=()=>e.check(Ps()),e.normalize=(...t)=>e.check(Ns(...t)),e.toLowerCase=()=>e.check(Fs()),e.toUpperCase=()=>e.check(Is()),e.slugify=()=>e.check(Ls())}),Dee=D(`ZodString`,(e,t)=>{ya.init(e,t),Dc.init(e,t),e.email=t=>e.check(zo(kc,t)),e.url=t=>e.check(Go(Mc,t)),e.jwt=t=>e.check(ss(Wee,t)),e.emoji=t=>e.check(Ko(Aee,t)),e.guid=t=>e.check(Bo(Ac,t)),e.uuid=t=>e.check(Vo(jc,t)),e.uuidv4=t=>e.check(Ho(jc,t)),e.uuidv6=t=>e.check(Uo(jc,t)),e.uuidv7=t=>e.check(Wo(jc,t)),e.nanoid=t=>e.check(qo(jee,t)),e.guid=t=>e.check(Bo(Ac,t)),e.cuid=t=>e.check(Jo(Mee,t)),e.cuid2=t=>e.check(Yo(Nee,t)),e.ulid=t=>e.check(Xo(Pee,t)),e.base64=t=>e.check(rs(Vee,t)),e.base64url=t=>e.check(is(Hee,t)),e.xid=t=>e.check(Zo(Fee,t)),e.ksuid=t=>e.check(Qo(Iee,t)),e.ipv4=t=>e.check($o(Lee,t)),e.ipv6=t=>e.check(es(Ree,t)),e.cidrv4=t=>e.check(ts(zee,t)),e.cidrv6=t=>e.check(ns(Bee,t)),e.e164=t=>e.check(as(Uee,t)),e.datetime=t=>e.check(xc(t)),e.date=t=>e.check(Cc(t)),e.time=t=>e.check(fee(t)),e.duration=t=>e.check(mee(t))});function k(e){return Ro(Dee,e)}var Oc=D(`ZodStringFormat`,(e,t)=>{ba.init(e,t),Dc.init(e,t)}),kc=D(`ZodEmail`,(e,t)=>{Ca.init(e,t),Oc.init(e,t)});function Oee(e){return zo(kc,e)}var Ac=D(`ZodGUID`,(e,t)=>{xa.init(e,t),Oc.init(e,t)}),jc=D(`ZodUUID`,(e,t)=>{Sa.init(e,t),Oc.init(e,t)}),Mc=D(`ZodURL`,(e,t)=>{wa.init(e,t),Oc.init(e,t)});function kee(e){return Go(Mc,e)}var Aee=D(`ZodEmoji`,(e,t)=>{Ta.init(e,t),Oc.init(e,t)}),jee=D(`ZodNanoID`,(e,t)=>{Ea.init(e,t),Oc.init(e,t)}),Mee=D(`ZodCUID`,(e,t)=>{Da.init(e,t),Oc.init(e,t)}),Nee=D(`ZodCUID2`,(e,t)=>{Oa.init(e,t),Oc.init(e,t)}),Pee=D(`ZodULID`,(e,t)=>{ka.init(e,t),Oc.init(e,t)}),Fee=D(`ZodXID`,(e,t)=>{Aa.init(e,t),Oc.init(e,t)}),Iee=D(`ZodKSUID`,(e,t)=>{ja.init(e,t),Oc.init(e,t)}),Lee=D(`ZodIPv4`,(e,t)=>{Ia.init(e,t),Oc.init(e,t)}),Ree=D(`ZodIPv6`,(e,t)=>{La.init(e,t),Oc.init(e,t)}),zee=D(`ZodCIDRv4`,(e,t)=>{Ra.init(e,t),Oc.init(e,t)}),Bee=D(`ZodCIDRv6`,(e,t)=>{za.init(e,t),Oc.init(e,t)}),Vee=D(`ZodBase64`,(e,t)=>{Va.init(e,t),Oc.init(e,t)}),Hee=D(`ZodBase64URL`,(e,t)=>{Ua.init(e,t),Oc.init(e,t)}),Uee=D(`ZodE164`,(e,t)=>{Wa.init(e,t),Oc.init(e,t)}),Wee=D(`ZodJWT`,(e,t)=>{Ka.init(e,t),Oc.init(e,t)}),Nc=D(`ZodNumber`,(e,t)=>{qa.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qs(e,t,n,r),e.gt=(t,n)=>e.check(bs(t,n)),e.gte=(t,n)=>e.check(xs(t,n)),e.min=(t,n)=>e.check(xs(t,n)),e.lt=(t,n)=>e.check(vs(t,n)),e.lte=(t,n)=>e.check(ys(t,n)),e.max=(t,n)=>e.check(ys(t,n)),e.int=t=>e.check(Fc(t)),e.safe=t=>e.check(Fc(t)),e.positive=t=>e.check(bs(0,t)),e.nonnegative=t=>e.check(xs(0,t)),e.negative=t=>e.check(vs(0,t)),e.nonpositive=t=>e.check(ys(0,t)),e.multipleOf=(t,n)=>e.check(Ss(t,n)),e.step=(t,n)=>e.check(Ss(t,n)),e.finite=()=>e;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 A(e){return fs(Nc,e)}var Pc=D(`ZodNumberFormat`,(e,t)=>{Ja.init(e,t),Nc.init(e,t)});function Fc(e){return ps(Pc,e)}var Ic=D(`ZodBoolean`,(e,t)=>{Ya.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$s(e,t,n,r)});function j(e){return ms(Ic,e)}var Lc=D(`ZodNull`,(e,t)=>{Xa.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ec(e,t,n,r)});function Rc(e){return hs(Lc,e)}var zc=D(`ZodUnknown`,(e,t)=>{Za.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Bc(){return gs(zc)}var Vc=D(`ZodNever`,(e,t)=>{Qa.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tc(e,t,n,r)});function Hc(e){return _s(Vc,e)}var Uc=D(`ZodArray`,(e,t)=>{eo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oc(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(ws(t,n)),e.nonempty=t=>e.check(ws(1,t)),e.max=(t,n)=>e.check(Cs(t,n)),e.length=(t,n)=>e.check(Ts(t,n)),e.unwrap=()=>e.element});function M(e,t){return Rs(Uc,e,t)}var Wc=D(`ZodObject`,(e,t)=>{ao.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sc(e,t,n,r),kr(e,`shape`,()=>t.shape),e.keyof=()=>P(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bc()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bc()}),e.strict=()=>e.clone({...e._zod.def,catchall:Hc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Kr(e,t),e.safeExtend=t=>qr(e,t),e.merge=t=>Jr(e,t),e.pick=t=>Wr(e,t),e.omit=t=>Gr(e,t),e.partial=(...t)=>Yr(il,e,t[0]),e.required=(...t)=>Xr(ml,e,t[0])});function N(e,t){return new Wc({type:`object`,shape:e??{},...O(t)})}function Gc(e,t){return new Wc({type:`object`,shape:e,catchall:Bc(),...O(t)})}var Kc=D(`ZodUnion`,(e,t)=>{so.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cc(e,t,n,r),e.options=t.options});function qc(e,t){return new Kc({type:`union`,options:e,...O(t)})}var Jc=D(`ZodDiscriminatedUnion`,(e,t)=>{Kc.init(e,t),co.init(e,t)});function Yc(e,t,n){return new Jc({type:`union`,options:t,discriminator:e,...O(n)})}var Xc=D(`ZodIntersection`,(e,t)=>{lo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lc(e,t,n,r)});function Zc(e,t){return new Xc({type:`intersection`,left:e,right:t})}var Qc=D(`ZodRecord`,(e,t)=>{po.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function $c(e,t,n){return new Qc({type:`record`,keyType:e,valueType:t,...O(n)})}var el=D(`ZodEnum`,(e,t)=>{mo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nc(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 el({...t,checks:[],...O(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 el({...t,checks:[],...O(r),entries:i})}});function P(e,t){return new el({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...O(t)})}var tl=D(`ZodLiteral`,(e,t)=>{ho.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rc(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 F(e,t){return new tl({type:`literal`,values:Array.isArray(e)?e:[e],...O(t)})}var nl=D(`ZodTransform`,(e,t)=>{go.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ac(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new yr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ni(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(ni(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function rl(e){return new nl({type:`transform`,transform:e})}var il=D(`ZodOptional`,(e,t)=>{vo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function al(e){return new il({type:`optional`,innerType:e})}var ol=D(`ZodExactOptional`,(e,t)=>{yo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sl(e){return new ol({type:`optional`,innerType:e})}var cl=D(`ZodNullable`,(e,t)=>{bo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ll(e){return new cl({type:`nullable`,innerType:e})}var ul=D(`ZodDefault`,(e,t)=>{xo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dl(e,t){return new ul({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rr(t)}})}var fl=D(`ZodPrefault`,(e,t)=>{Co.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pl(e,t){return new fl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rr(t)}})}var ml=D(`ZodNonOptional`,(e,t)=>{wo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hl(e,t){return new ml({type:`nonoptional`,innerType:e,...O(t)})}var gl=D(`ZodCatch`,(e,t)=>{Eo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _l(e,t){return new gl({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var vl=D(`ZodPipe`,(e,t)=>{Do.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gc(e,t,n,r),e.in=t.in,e.out=t.out});function yl(e,t){return new vl({type:`pipe`,in:e,out:t})}var bl=D(`ZodReadonly`,(e,t)=>{ko.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_c(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xl(e){return new bl({type:`readonly`,innerType:e})}var Sl=D(`ZodLazy`,(e,t)=>{jo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yc(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Cl(e){return new Sl({type:`lazy`,getter:e})}var wl=D(`ZodCustom`,(e,t)=>{Mo.init(e,t),Ec.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ic(e,t,n,r)});function Tl(e,t){return zs(wl,e??(()=>!0),t)}function El(e,t={}){return Bs(wl,e,t)}function Dl(e){return Vs(e)}function Ol(e,t){return yl(rl(e),t)}var kl={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`,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`},Al=new Set(Object.keys(kl));function jl(e){return kl[e.toLowerCase().replace(/^\./,``)]??null}var Ml=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Nl=[`video/mp4`,`video/webm`,`video/ogg`],Pl=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Fl=[`application/pdf`],Il=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Ll=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Rl=new Set([`pdf`]),zl=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Bl=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(`.`)),Vl=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(`.`)),Hl=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(`.`)),Ul=`wikiembed`,Wl=`toast`,Gl=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(`.`)),Kl=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],ql=[`mp4`,`webm`,`mov`,`m4v`],Jl=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],Yl=[`pdf`],Xl=[`json`,`toml`,`lock`];function Zl(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}Zl(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,Kl,Il),Zl(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,ql,Ll),Zl(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Jl,zl),Zl(`SIDEBAR_PDF_ASSET_EXTENSIONS`,Yl,Rl),Zl(`FILE_ATTACHMENT_EXTENSIONS`,[...Bl],Gl),Zl(`WIKI_EMBED_EXTENSIONS`,[...Gl],Vl);var Ql=new Set(Kl),$l=new Set(ql),eu=new Set(Jl),tu=new Set(Yl),nu=new Set(Xl);Zl(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...Kl,...ql,...Jl,...Yl,...Xl])],Hl);var ru=new Set([`base`,`canvas`]),iu=new Set([`mmd`,`mermaid`]);function au(e){let t=e.lastIndexOf(`.`);return t<0?!1:iu.has(e.slice(t+1).toLowerCase())}new Set([...Vl,...ru,...iu]);function ou(e){let t=e.toLowerCase().replace(/^\./,``);return Ql.has(t)?`image`:$l.has(t)?`video`:eu.has(t)?`audio`:tu.has(t)?`pdf`:nu.has(t)||ru.has(t)?`text`:iu.has(t)?`mermaid`:Al.has(t)?`text`:null}var su=Symbol.for(`@inkeep/open-knowledge/field-registry`),cu=globalThis;cu[su]===void 0&&(cu[su]=Io());var lu=cu[su];function uu(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=du(t)?lu.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function du(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}var fu=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),pu=52428800,mu=26214400,hu=`https://api.openai.com/v1`,gu=`text-embedding-3-small`;function _u(e){let t=e.trim();return t===``?`./`:t}function vu(e){let t=_u(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}var yu=Gc({content:Gc({dir:k().register(lu,{scope:`project`,agentSettable:!1,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.`}).default(`.`),attachmentFolderPath:k().register(lu,{scope:`project`,agentSettable:!1,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(vu,{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:Gc({theme:P([`light`,`dark`,`system`]).register(lu,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),preview:Gc({autoOpen:j().register(lu,{scope:`user`,agentSettable:!1,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:Gc({showHiddenFiles:j().register(lu,{scope:`project-local`,agentSettable:!1,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:j().register(lu,{scope:`project-local`,agentSettable:!1,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:j().register(lu,{scope:`project-local`,agentSettable:!1,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:j().register(lu,{scope:`project-local`,agentSettable:!1,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:Gc({wordWrap:j().register(lu,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0}),agents:Gc({autoApproveOkTools:j().register(lu,{scope:`user`,agentSettable:!1,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:Gc({enabled:j().register(lu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Whether this machine auto-pulls and auto-pushes git commits for this project. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared.`}).nullable().default(null),default:j().register(lu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's autoSync.enabled on first open: true = auto-sync on, false = off, null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.enabled choice overrides it.`}).nullable().default(null)}).default({enabled:null,default:null}),terminal:Gc({enabled:j().register(lu,{scope:`project-local`,agentSettable:!1,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}),telemetry:Gc({localSink:Gc({enabled:j().register(lu,{scope:`project`,agentSettable:!1,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:Gc({maxBytes:A().register(lu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(pu)}).default({maxBytes:pu}),logs:Gc({maxBytes:A().register(lu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(mu)}).default({maxBytes:mu}),attributeDenylist:M(k()).register(lu,{scope:`project`,agentSettable:!1,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([...fu])}).default({enabled:!0,spans:{maxBytes:pu},logs:{maxBytes:mu},attributeDenylist:[...fu]})}).default({localSink:{enabled:!0,spans:{maxBytes:pu},logs:{maxBytes:mu},attributeDenylist:[...fu]}}),search:Gc({semantic:Gc({enabled:j().register(lu,{scope:`project-local`,agentSettable:!1,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:k().register(lu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override for Azure / self-hosted / other providers. The API key is NOT stored here — set it with `ok embeddings set-key` (OS keyring)."}).default(hu),model:k().register(lu,{scope:`project-local`,agentSettable:!1,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(gu),dimensions:A().int().positive().register(lu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit to use the model's native size (1536 for text-embedding-3-small). Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality. Changing it re-embeds the corpus.`}).optional(),similarityFloor:A().min(0).max(1).register(lu,{scope:`project-local`,agentSettable:!1,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:hu,model:gu})}).default({semantic:{enabled:!1,baseUrl:hu,model:gu}})}),bu=`open-knowledge-config`;function xu(e,t,n){let a=i.getTracer(bu),o=t?{attributes:t}:{};return a.startActiveSpan(e,o,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:r.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Su(e,t){let n=i.getActiveSpan();n&&n.addEvent(e,t)}function Cu(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 wu(e,t){let n=e;for(let e of t){n=Cu(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Tu(e,t){let n=wu(e,t);if(n!==void 0)return uu(n)}function Eu(e,t){return e===`either`?!0:e===t}function Du(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=Tu(yu,i);a?.scope!==void 0&&(Eu(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 Ou(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(b(e.getIn(r,!0))||e.deleteIn(r))}}function ku(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)){Ou(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}Ou(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Au(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var ju=N({file:k(),line:A().int().min(1),column:A().int().min(1),snippet:k().optional()}),Mu=N({path:M(qc([k(),A()])),message:k(),issueCode:k(),params:$c(k(),Bc()).optional(),source:ju.optional()}),Nu=P([`user`,`project`,`project-local`,`either`]),Pu=P([`user`,`project`,`project-local`]),Fu=Yc(`code`,[N({code:F(`YAML_PARSE`),detail:k()}),N({code:F(`SCHEMA_INVALID`),issues:M(Mu)}),N({code:F(`SCOPE_VIOLATION`),path:M(k()),expectedScope:Nu,actualScope:Pu}),N({code:F(`NOT_AGENT_SETTABLE`),path:M(k())}),N({code:F(`MIXED_SCOPE`),paths:M(N({path:M(k()),scope:Pu}))}),N({code:F(`REMOVED_KEY`),path:M(k()),redirect:k(),source:ju.optional()}),N({code:F(`WRITE_ERROR`),detail:k()}),N({code:F(`OKIGNORE_INVALID`),detail:k(),lineNumber:A().int().min(1).optional()}),N({code:F(`UNKNOWN`),message:k().optional()})]),Iu=new Set(Fu.options.map(e=>e.shape.code.value)),Lu=qc([Fu,Gc({code:k(),message:k().optional()})]);function Ru(e){return Iu.has(e.code)}function zu(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 Bu(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 Vu(e){if(!Ru(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${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(`
146
146
  `))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
147
147
  `)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${zu(e.expectedScope)} — ${Bu(e.expectedScope)}),`,`but it was set in the ${e.actualScope} config (${zu(e.actualScope)}).`,`Move it to ${zu(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(`.`)} → ${zu(t)} (${t})`).join(`
148
148
  `)].join(`
149
149
  `);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(`
150
150
  `))n.push(` ${t}`);return n.join(`
151
- `)}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 Hu="Run `ok config migrate` to strip the obsolete key from config.yml 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).`,Hu].join(` `),[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,Hu].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.",Hu].join(` `),[`appearance.editorModeDefault was removed and is never read — new docs always open in WYSIWYG; toggle mode via the editor mode button.`,Hu].join(` `),[`streaming uploads have no user-facing cap; the value is hardcoded in @inkeep/open-knowledge-core.`,Hu].join(` `),[`Use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID environment variable instead.`,Hu].join(` `),[`Use the --host CLI flag or the HOST environment variable instead.`,Hu].join(` `),[`This behavior was removed; the value is hardcoded.`,Hu].join(` `),[`To disable MCP auto-start, set OK_MCP_AUTOSTART=0.`,Hu].join(` `),[`This value is hardcoded in @inkeep/open-knowledge-core.`,Hu].join(` `),[`This value is hardcoded in @inkeep/open-knowledge-core.`,Hu].join(` `),[`The search result cap is hardcoded in @inkeep/open-knowledge-core; this config key was removed.`,Hu].join(` `),["preview URLs now resolve only to the running UI process — start one with `ok ui`.",Hu].join(` `),[`preview.scriptSrc has been removed.`,`The code-block preview iframe now runs a fixed open network policy (it is no longer configurable).`,Hu].join(` `),[`appearance.sidebar.showAllFiles has been removed.`,`The sidebar now always lists every file on disk; dot-prefixed entries are still gated by appearance.sidebar.showHiddenFiles. There is no longer a way to scope the tree to indexed/linked content.`,Hu].join(` `);function Uu(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Gu(e.position):`start`in e||`end`in e?Gu(e):`line`in e||`column`in e?Wu(e):``}function Wu(e){return Ku(e&&e.line)+`:`+Ku(e&&e.column)}function Gu(e){return Wu(e&&e.start)+`-`+Wu(e&&e.end)}function Ku(e){return e&&typeof e==`number`?e:1}var qu=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Uu(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};qu.prototype.file=``,qu.prototype.name=``,qu.prototype.reason=``,qu.prototype.message=``,qu.prototype.stack=``,qu.prototype.column=void 0,qu.prototype.line=void 0,qu.prototype.ancestors=void 0,qu.prototype.cause=void 0,qu.prototype.fatal=void 0,qu.prototype.place=void 0,qu.prototype.ruleId=void 0,qu.prototype.source=void 0;function Ju(e){this.content=e}Ju.prototype={constructor:Ju,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 Ju(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 Ju(n)},addToStart:function(e,t){return new Ju([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Ju(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 Ju(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=Ju.from(e),e.size?new Ju(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Ju.from(e),e.size?new Ju(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Ju.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}},Ju.from=function(e){if(e instanceof Ju)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Ju(t)};function Yu(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=Yu(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Xu(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=Xu(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var I=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 Yu(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Xu(this,e,t,n)}findIndex(e){if(e==0)return Qu(0,e);if(e==this.size)return Qu(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?Qu(t+1,i):Qu(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)`:``))}};I.empty=new I([],0);var Zu={index:0,offset:0};function Qu(e,t){return Zu.index=e,Zu.offset=t,Zu}function $u(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(!$u(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!$u(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var ed=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&&$u(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}};ed.none=[];var td=class extends Error{},L=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=rd(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(nd(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(I.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)}};L.empty=new L(I.empty,0,0);function nd(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(nd(a.content,t-i-1,n-i-1)))}function rd(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=rd(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function id(e,t,n){if(n.openStart>e.depth)throw new td(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new td(`Inconsistent open depths`);return ad(e,t,n,0)}function ad(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=ad(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ud(a,fd(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ud(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=pd(n,e);return ud(a,dd(e,i,o,t,r))}}function od(e,t){if(!t.type.compatibleContent(e.type))throw new td(`Cannot join `+t.type.name+` onto `+e.type.name)}function sd(e,t,n){let r=e.node(n);return od(r,t.node(n)),r}function cd(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 ld(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&&(cd(e.nodeAfter,r),a++));for(let e=a;e<o;e++)cd(i.child(e),r);t&&t.depth==n&&t.textOffset&&cd(t.nodeBefore,r)}function ud(e,t){return e.type.checkContent(t),e.copy(t)}function dd(e,t,n,r,i){let a=e.depth>i&&sd(e,t,i+1),o=r.depth>i&&sd(n,r,i+1),s=[];return ld(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(od(a,o),cd(ud(a,dd(e,t,n,r,i+1)),s)):(a&&cd(ud(a,fd(e,t,i+1)),s),ld(t,n,i,s),o&&cd(ud(o,fd(n,r,i+1)),s)),ld(r,null,i,s),new I(s)}function fd(e,t,n){let r=[];return ld(null,e,n,r),e.depth>n&&cd(ud(sd(e,t,n+1),fd(e,t,n+1)),r),ld(t,null,n,r),new I(r)}function pd(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(I.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var md=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 ed.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 vd(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=_d.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 _d.set(t,r=new hd);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%gd,i}},hd=class{constructor(){this.elts=[],this.i=0}},gd=12,_d=new WeakMap,vd=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)}},yd=Object.create(null),bd=class e{constructor(e,t,n,r=ed.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||I.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&&$u(this.attrs,t||e.defaultAttrs||yd)&&ed.sameSet(this.marks,n||ed.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 L.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new L(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return id(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 md.resolveCached(this,e)}resolveNoCache(e){return md.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()+`)`),Sd(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=I.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=ed.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(!ed.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=I.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};bd.prototype.text=void 0;var xd=class e extends bd{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):Sd(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 Sd(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Cd=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new wd(t,n);if(r.next==null)return e.empty;let i=Td(r);r.next&&r.err(`Unexpected trailing text`);let a=Fd(Md(i));return Id(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 I.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(`
151
+ `)}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 Hu="Run `ok config migrate` to strip the obsolete key from config.yml 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).`,Hu].join(` `),[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,Hu].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.",Hu].join(` `),[`appearance.editorModeDefault was removed and is never read — new docs always open in WYSIWYG; toggle mode via the editor mode button.`,Hu].join(` `),[`streaming uploads have no user-facing cap; the value is hardcoded in @inkeep/open-knowledge-core.`,Hu].join(` `),[`Use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID environment variable instead.`,Hu].join(` `),[`Use the --host CLI flag or the HOST environment variable instead.`,Hu].join(` `),[`This behavior was removed; the value is hardcoded.`,Hu].join(` `),[`To disable MCP auto-start, set OK_MCP_AUTOSTART=0.`,Hu].join(` `),[`This value is hardcoded in @inkeep/open-knowledge-core.`,Hu].join(` `),[`This value is hardcoded in @inkeep/open-knowledge-core.`,Hu].join(` `),[`The search result cap is hardcoded in @inkeep/open-knowledge-core; this config key was removed.`,Hu].join(` `),["preview URLs now resolve only to the running UI process — start one with `ok ui`.",Hu].join(` `),[`preview.scriptSrc has been removed.`,`The code-block preview iframe now runs a fixed open network policy (it is no longer configurable).`,Hu].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.`,Hu].join(` `);function Uu(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Gu(e.position):`start`in e||`end`in e?Gu(e):`line`in e||`column`in e?Wu(e):``}function Wu(e){return Ku(e&&e.line)+`:`+Ku(e&&e.column)}function Gu(e){return Wu(e&&e.start)+`-`+Wu(e&&e.end)}function Ku(e){return e&&typeof e==`number`?e:1}var qu=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Uu(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};qu.prototype.file=``,qu.prototype.name=``,qu.prototype.reason=``,qu.prototype.message=``,qu.prototype.stack=``,qu.prototype.column=void 0,qu.prototype.line=void 0,qu.prototype.ancestors=void 0,qu.prototype.cause=void 0,qu.prototype.fatal=void 0,qu.prototype.place=void 0,qu.prototype.ruleId=void 0,qu.prototype.source=void 0;function Ju(e){this.content=e}Ju.prototype={constructor:Ju,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 Ju(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 Ju(n)},addToStart:function(e,t){return new Ju([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Ju(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 Ju(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=Ju.from(e),e.size?new Ju(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Ju.from(e),e.size?new Ju(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Ju.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}},Ju.from=function(e){if(e instanceof Ju)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Ju(t)};function Yu(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=Yu(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Xu(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=Xu(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var I=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 Yu(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Xu(this,e,t,n)}findIndex(e){if(e==0)return Qu(0,e);if(e==this.size)return Qu(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?Qu(t+1,i):Qu(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)`:``))}};I.empty=new I([],0);var Zu={index:0,offset:0};function Qu(e,t){return Zu.index=e,Zu.offset=t,Zu}function $u(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(!$u(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!$u(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var ed=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&&$u(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}};ed.none=[];var td=class extends Error{},L=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=rd(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(nd(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(I.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)}};L.empty=new L(I.empty,0,0);function nd(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(nd(a.content,t-i-1,n-i-1)))}function rd(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=rd(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function id(e,t,n){if(n.openStart>e.depth)throw new td(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new td(`Inconsistent open depths`);return ad(e,t,n,0)}function ad(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=ad(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ud(a,fd(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ud(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=pd(n,e);return ud(a,dd(e,i,o,t,r))}}function od(e,t){if(!t.type.compatibleContent(e.type))throw new td(`Cannot join `+t.type.name+` onto `+e.type.name)}function sd(e,t,n){let r=e.node(n);return od(r,t.node(n)),r}function cd(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 ld(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&&(cd(e.nodeAfter,r),a++));for(let e=a;e<o;e++)cd(i.child(e),r);t&&t.depth==n&&t.textOffset&&cd(t.nodeBefore,r)}function ud(e,t){return e.type.checkContent(t),e.copy(t)}function dd(e,t,n,r,i){let a=e.depth>i&&sd(e,t,i+1),o=r.depth>i&&sd(n,r,i+1),s=[];return ld(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(od(a,o),cd(ud(a,dd(e,t,n,r,i+1)),s)):(a&&cd(ud(a,fd(e,t,i+1)),s),ld(t,n,i,s),o&&cd(ud(o,fd(n,r,i+1)),s)),ld(r,null,i,s),new I(s)}function fd(e,t,n){let r=[];return ld(null,e,n,r),e.depth>n&&cd(ud(sd(e,t,n+1),fd(e,t,n+1)),r),ld(t,null,n,r),new I(r)}function pd(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(I.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var md=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 ed.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 vd(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=_d.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 _d.set(t,r=new hd);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%gd,i}},hd=class{constructor(){this.elts=[],this.i=0}},gd=12,_d=new WeakMap,vd=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)}},yd=Object.create(null),bd=class e{constructor(e,t,n,r=ed.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||I.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&&$u(this.attrs,t||e.defaultAttrs||yd)&&ed.sameSet(this.marks,n||ed.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 L.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new L(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return id(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 md.resolveCached(this,e)}resolveNoCache(e){return md.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()+`)`),Sd(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=I.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=ed.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(!ed.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=I.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};bd.prototype.text=void 0;var xd=class e extends bd{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):Sd(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 Sd(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Cd=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new wd(t,n);if(r.next==null)return e.empty;let i=Td(r);r.next&&r.err(`Unexpected trailing text`);let a=Fd(Md(i));return Id(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 I.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(`
152
152
  `)}};Cd.empty=new Cd(!0);var wd=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 Td(e){let t=[];do t.push(Ed(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Ed(e){let t=[];do t.push(Dd(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Dd(e){let t=jd(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=kd(e,t);else break;return t}function Od(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function kd(e,t){let n=Od(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Od(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Ad(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 jd(e){if(e.eat(`(`)){let t=Td(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=Ad(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 Md(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 Nd(e,t){return t-e}function Pd(e,t){let n=[];return r(t),n.sort(Nd);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 Fd(e){let t=Object.create(null);return n(Pd(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]);Pd(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Cd(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Nd);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Id(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 Ld(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 Rd(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 zd(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 Bd(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Ud(e,r,t[r]);return n}var Vd=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=Bd(e,n.attrs),this.defaultAttrs=Ld(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==Cd.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:Rd(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new bd(this,this.computeAttrs(e),I.from(t),ed.setFrom(n))}createChecked(e=null,t,n){return t=I.from(t),this.checkContent(t),new bd(this,this.computeAttrs(e),t,ed.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=I.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(I.empty,!0);return i?new bd(this,e,t.append(i),ed.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){zd(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:ed.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 Hd(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 Ud=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Hd(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Wd=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Bd(e,r.attrs),this.excluded=null;let i=Ld(this.attrs);this.instance=i?new ed(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ed(this,Rd(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){zd(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Gd=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=Ju.from(e.nodes),t.marks=Ju.from(e.marks||{}),this.nodes=Vd.compile(this.spec.nodes,this),this.marks=Wd.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]=Cd.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?Kd(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==``?[]:Kd(this,n.split(` `))}this.nodeFromJSON=e=>bd.fromJSON(this,e),this.markFromJSON=e=>ed.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 Vd))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 xd(n,n.defaultAttrs,e,ed.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 Kd(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 qd(e){return e.tag!=null}function Jd(e){return e.style!=null}var Yd=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(qd(e))this.tags.push(e);else if(Jd(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 af(this,t,!1);return n.addAll(e,ed.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new af(this,t,!0);return n.addAll(e,ed.none,t.from,t.to),L.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(sf(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=cf(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=cf(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)))}},Xd={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},Zd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Qd={ol:!0,ul:!0},$d=1,ef=2,tf=4;function nf(e,t,n){return t==null?e&&e.whitespace==`pre`?$d|ef:n&~tf:(t?$d:0)|(t===`full`?ef:0)}var rf=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=ed.none,this.match=i||(a&tf?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(I.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&$d)){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=I.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(I.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&&!Xd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},af=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=nf(null,t.preserveWhitespace,0)|(n?tf:0);i=r?new rf(r.type,r.attrs,ed.none,!0,t.topMatch||r.type.contentMatch,a):n?new rf(null,null,ed.none,!0,null,a):new rf(e.schema.topNodeType,null,ed.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&ef?`full`:this.localPreserveWS||(r.options&$d)>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,`
153
153
  `);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;Qd.hasOwnProperty(a)&&this.parser.normalizeLists&&of(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Zd.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(Xd.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(`
154
154
  `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=ed.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):lf(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=nf(e,i,a.options);a.options&tf&&a.content.length==0&&(o|=tf);let s=ed.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):lf(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new rf(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=$d);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function of(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Qd.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function sf(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function cf(e){let t={};for(let n in e)t[n]=e[n];return t}function lf(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var uf=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=ff(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=gf(ff(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&gf(ff(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return gf(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=df(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return df(e.marks)}};function df(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function ff(e){return e.document||window.document}var pf=new WeakMap;function mf(e){let t=pf.get(e);return t===void 0&&pf.set(e,t=hf(e)),t}function hf(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function gf(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=mf(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else{let{dom:t,contentDOM:i}=gf(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var _f=65535,vf=2**16;function yf(e,t){return e+t*vf}function bf(e){return e&_f}function xf(e){return(e-(e&_f))/vf}var Sf=1,Cf=2,wf=4,Tf=8,Ef=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Tf)>0}get deletedBefore(){return(this.delInfo&(Sf|wf))>0}get deletedAfter(){return(this.delInfo&(Cf|wf))>0}get deletedAcross(){return(this.delInfo&wf)>0}},Df=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=bf(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+xf(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:yf(o/3,e-s),f=e==s?Cf:e==u?Sf:wf;return(t<0?e!=s:e!=u)&&(f|=Tf),new Ef(a,f,d)}r+=l-c}return n?e+r:new Ef(e+r,0,null)}touches(e,t){let n=0,r=bf(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Df.empty=new Df([]);var Of=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new Ef(e,r,null)}},kf=Object.create(null),Af=class{getMap(){return Df.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=kf[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in kf)throw RangeError(`Duplicate use of step JSON ID `+e);return kf[e]=t,t.prototype.jsonID=e,t}},jf=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof td)return e.fail(t.message);throw t}}};function Mf(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Mf(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return I.fromArray(r)}var Nf=class e extends Af{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new L(Mf(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return jf.fromReplace(e,this.from,this.to,i)}invert(){return new Pf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Af.jsonID(`addMark`,Nf);var Pf=class e extends Af{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new L(Mf(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return jf.fromReplace(e,this.from,this.to,n)}invert(){return new Nf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Af.jsonID(`removeMark`,Pf);var Ff=class e extends Af{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return jf.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return jf.fromReplace(e,this.pos,this.pos+1,new L(I.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new If(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Af.jsonID(`addNodeMark`,Ff);var If=class e extends Af{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return jf.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return jf.fromReplace(e,this.pos,this.pos+1,new L(I.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ff(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Af.jsonID(`removeNodeMark`,If);var Lf=class e extends Af{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&zf(e,this.from,this.to)?jf.fail(`Structure replace would overwrite content`):jf.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Df([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?L.empty:new L(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?L.empty:new L(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,L.fromJSON(t,n.slice),!!n.structure)}};Lf.MAP_BIAS=1,Af.jsonID(`replace`,Lf);var Rf=class e extends Af{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(zf(e,this.from,this.gapFrom)||zf(e,this.gapTo,this.to)))return jf.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return jf.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?jf.fromReplace(e,this.from,this.to,n):jf.fail(`Content does not fit in gap`)}getMap(){return new Df([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,L.fromJSON(t,n.slice),n.insert,!!n.structure)}};Af.jsonID(`replaceAround`,Rf);function zf(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Bf(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new Pf(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Nf(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Vf(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Wd){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new Pf(t.from,t.to,t.style)))}function Hf(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Lf(s,l,L.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Pf(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new L(I.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Lf(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(I.empty,!0);e.replace(s,s,new L(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function Uf(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Wf(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!Uf(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Gf(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=I.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=I.from(r.node(e).copy(u)),d++):c--;let f=I.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=I.from(i.node(e).copy(f)),p++):l++;e.step(new Rf(c,l,o,s,new L(u.append(f),d,p),u.size-d,!0))}function Kf(e,t,n=null,r=e){let i=Jf(e,t),a=i&&Yf(r,t);return a?i.map(qf).concat({type:t,attrs:n}).concat(a.map(qf)):null}function qf(e){return{type:e,attrs:null}}function Jf(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function Yf(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function Xf(e,t,n){let r=I.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=I.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new Rf(i,a,i,a,new L(r,0,0),n.length,!0))}function Zf(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&ep(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&$f(e,t,n,a),Hf(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new Rf(c,l,c+1,l-1,new L(I.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Qf(e,t,n,a),!1}})}function Qf(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function $f(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
@@ -525,4 +525,4 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
525
525
  `;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(`
526
526
  `)},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=f7(i.attributes??[]);return!i.children||i.children.length===0?s?c?`<${s} ${c} />`:`<${s} />`:``:qne({...i,attributes:(i.attributes??[]).map(Yne)},t,n,r)},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=y7(n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),r,`==`),o+=i.move(`==`),a(),o},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=f7(e.attributes??[]);return 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=s?.[c++];return r===`none`||r===0?`>${e}`:typeof r==`number`&&r>=2&&!e.startsWith(` `)?`>${` `.repeat(r)}${e}`:`> ${e}`})}};function f7(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}={${p7(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function p7(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function Yne(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:p7(e.value)}}:e}function m7(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function h7(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 Xne(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>Zne(t)?e:`\\${e}`)}function Zne(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}function g7(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.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]`));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return Xne(tre(i,n))}var _7=1,Qne=2;function v7(e){if(Number.isNaN(e))return`ws`;let t=UR(e);return t===_7?`ws`:t===Qne?`punct`:`other`}function $ne(e,t,n){let r=v7(t),i=v7(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 ere(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
527
527
  `||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function tre(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)&&ere(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+=$ne(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function y7(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);b7(i.charCodeAt(i.length-1),s,r)&&(o=x7(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return b7(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+x7(c)),o}function b7(e,t,n){return!(UR(t)!==_7||n===`_`&&UR(e)===void 0)}function x7(e){return`&#x${e.toString(16).toUpperCase()};`}function nre(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!ire(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 rre(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=y7(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function ire(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 S7(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 are=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=Hb(e.extensions),this.handlers=dre(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?t3({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=fre(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=Ine({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=Lne({toMarkdownHandlers:Jne})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return zne(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?Bne(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?g6(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 Vne(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}},C7=q3();function ore(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 sre(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function cre(e,t){return e.attrs.sourceDirty||sre(e)?!0:t?t.isDiverged(e.toJSON()):!1}function lre(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 w7(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 T7(e,t){if(e.length===0)return w7({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return w7({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:[T7(n.children,t)]}}return w7({type:`inlineCode`,value:E7(e)},t)}function E7(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=E7(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}var ure=Il;function dre(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=MU(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=MU(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=d7(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){let t=n.replaceAll(`\xA0`,` `);return r.sourceLiteral?e.text(t,[r.sourceLiteral.create({sourceRaw:i})]):e.text(t)}let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n.replaceAll(`\xA0`,` `));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&&E1(t.raw)!==null&&C1(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).replaceAll(`\xA0`,` `);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=E1(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).replaceAll(`\xA0`,` `);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=NU(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=NU(r.highlight)),r.comment&&(i.comment=NU(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=MU(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=NU(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=NU(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=MU(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,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=MU(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=MU(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:``,title: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=C7.getOrWildcard(o),c=ore(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=d7(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})}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=U1(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&&ure.has(l)&&n.jsxComponent&&C7.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&&Ll.has(l)&&n.jsxComponent&&C7.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&&zl.has(l)&&n.jsxComponent&&C7.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&&Bl.has(l)&&n.jsxComponent&&C7.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:S7(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=MU(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 fre(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=RU(`paragraph`)),i.blockquote&&(n.blockquote=RU(`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=RU(`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,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=RU(`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&&lre(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=RU(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:S4(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!cre(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:C7.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:C7,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.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),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=zU(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=zU(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return T7(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]=zU(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=zU(`mark`)),a.comment&&(r.comment=zU(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=RU(`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=RU(`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 O1(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 pre=/\p{M}+/gu,mre=/[^\p{L}\p{N}]+/gu,hre=/^-+|-+$/g;function D7(e){return e.trim().normalize(`NFKD`).replace(pre,``).toLowerCase().replace(mre,`-`).replace(hre,``)}function gre(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function _re(e,t){let n=D7(e);return n?gre(n,t):``}function O7(e,t){let n=D7(e);return t?`#${n}-${D7(t)}`:`#${n}`}var k7=new Set([`img`,`video`,`audio`,`mark`]),vre=new Map(G3.flatMap(e=>e.surface===`compat`&&k7.has(e.rendersAs)?[[e.name,e]]:[]));function A7(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 j7(e){let t=e.name;if(!t||!k7.has(t))return null;let n=A7(e);return n===null?null:{type:`element`,tagName:t,properties:n,children:[]}}function M7(e){let t=e.name;if(!t)return null;let n=vre.get(t);if(!n)return null;let r=A7(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 yre=(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:O7(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},bre=(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:O7(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},xre=(e,t)=>{let n=t,r=j7(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=M7(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)},Sre=(e,t)=>{let n=t,r=j7(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=M7(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)},Cre=(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)]},wre=(e,t)=>{let n={type:`element`,tagName:`mark`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)};function N7(e){if(typeof e!=`object`||!e)return``;let t=e;return typeof t.value==`string`?t.value:Array.isArray(t.children)?t.children.map(N7).join(``):``}var P7={wikiLink:yre,wikiLinkEmbed:bre,mdxJsxFlowElement:xre,mdxJsxTextElement:Sre,rawMdxFallback:Cre,mark:wre,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:N7(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},commentBlock:(e,t)=>{let n={type:`comment`,value:N7(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)}},Tre=/url\s*\(\s*['"]?\s*(?:javascript|vbscript|data)\s*:/i,Ere=/\bexpression\s*\(/i,Dre=1e4;function Ore(e){return!(e.length>Dre||Tre.test(e)||Ere.test(e))}function F7(e){for(let t of e.split(`,`)){let e=t.trim();if(e!==``&&!Q$(e.split(/\s+/)[0]??``))return!1}return!0}var kre={a:[`href`,`title`],img:[`src`,`alt`,`title`],video:[`src`,`title`],audio:[`src`,`title`],code:[`className`]},Are=new Set([`href`,`src`]),jre=WB(`<>`),I7=()=>e=>{vF(e,`element`,e=>{let t=kre[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`?l8(e):e);r.some((e,n)=>e!==t[n])&&(n[e]=r);continue}if(typeof t!=`string`)continue;let r;if(Are.has(e))if(t===`<>`||t===jre)r=``;else{let e=l8(t);r=e===t?t:WB(e)}else r=l8(t);r!==t&&(n[e]=r)}})},L7=()=>e=>{vF(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`&&!Q$(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`&&!Q$(e)&&delete n.src}if(t===`form`){let e=n.action;typeof e==`string`&&!Q$(e)&&delete n.action}if(t===`img`||t===`source`){let e=n.srcSet;typeof e==`string`&&!F7(e)&&delete n.srcSet;let t=n.srcset;typeof t==`string`&&!F7(t)&&delete n.srcset}if(t===`video`){let e=n.poster;typeof e==`string`&&!Q$(e)&&delete n.poster}let r=n.style;typeof r==`string`&&!Ore(r)&&delete n.style})};function Mre(e){let t=lU().use(NJ,{handlers:P7}).use(I7).use(L7).use(Kq),n=t.runSync(e);return String(t.stringify(n))}function Nre(e){let t=/\r?\n|\r/g,n=[],r=0,i=t.exec(e);for(;i!==null;)n.push(R7(e.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=t.exec(e);return n.push(R7(e.slice(r),r>0,!1)),n.join(``)}function R7(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 z7=/\r?\n|\r/,Pre=(e,t)=>{let n=Nre(String(t.value));if(!z7.test(n)){let r={type:`text`,value:n};return e.patch(t,r),e.applyData(t,r)}let r=n.split(z7),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 Fre(e){let t=lU().use(sG).use(oW,[`yaml`]).use(U5).use(eU).use(a7).use(n8).use(q5).use(_8).use(NJ,{handlers:{...P7,text:Pre}}).use(I7).use(L7).use(Kq);return String(t.processSync(e8(g8(e))))}JK(),sK(),cK();var B7=`frontmatter`,V7=[`text`,`number`,`boolean`,`date`,`list`,`object`];P(V7);var Ire=qc([k(),A(),j()]),H7=Cl(()=>qc([Ire.transform(e=>String(e)),$c(k(),U7),M(H7)])),U7=Cl(()=>qc([k(),A(),j(),M(H7),$c(k(),U7)])),Lre=/^\d{4}-\d{2}-\d{2}$/;function Rre(e){return typeof e==`string`&&Lre.test(e)}function zre(e){return Array.isArray(e)?`list`:typeof e==`object`&&e?`object`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:Rre(e)?`date`:`text`}function W7(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(W7(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:W7(r);return t}return e}var Bre=Ol(W7,$c(k(),U7)),Vre=$c(k(),qc([U7,Rc()]));function Hre(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}function G7(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(!G7(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)||!G7(e[r],t[r]))return!1;return!0}return!1}N({docName:t2,summary:r2,content:k().optional(),...n2}).loose(),N({docName:t2,summary:r2,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P(p$).optional(),...n2}).loose(),N({docName:t2,summary:r2,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...n2}).loose(),N({docName:t2,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...n2}).loose();var K7=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),Ure=Yc(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),q7=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:Ure.optional(),hint:k().optional()}).loose(),Wre=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),J7=N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),mergeOutcome:k().optional(),hint:k().optional()}).loose(),Y7=Yc(`kind`,[q7,J7]),X7=M(Yc(`kind`,[q7,J7,N({kind:F(`mermaid-parse-error`),fenceIndex:A().int().positive(),fenceFirstLine:k(),message:k(),line:A().int().positive().optional()}).loose()])).min(1),Z7=M(N({href:k(),resolvedTo:k().nullable(),reason:P([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose());N({timestamp:k().min(1),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional()}).loose(),N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(Wre).optional(),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional(),brokenLinks:Z7}).loose(),N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional(),brokenLinks:Z7}).loose(),N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),N({docName:t2,patch:$c(k(),qc([U7,Rc()])),types:$c(k(),P(V7)).optional(),summary:r2,...n2}).loose(),N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional(),brokenLinks:Z7}).loose(),N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(wQ),event:k().optional(),fields:$c(k(),Bc()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),N({accepted:A().int().min(0)}).loose();var Gre=N({status:k().min(1),reason:k()}).loose();N({docName:k().min(1),content:k(),lifecycle:Gre.nullable()}).loose();var Q7=N({kind:P([`document`,`asset`,`folder`,`file`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:j().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:P([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:M(k().min(1)).optional(),hasChildren:j().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)`}),Kre=N({documents:M(Q7),truncated:j().optional()}).loose(),qre=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),Jre=N({docName:k().min(1),backlinks:M(qre)}).loose();N({counts:$c(k().min(1),A().int().nonnegative())}).loose();var Yre=Yc(`kind`,[N({kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),N({kind:F(`external`),url:k().min(1),title:k(),snippet:k().nullable()}).loose()]),Xre=N({docName:k().min(1),forwardLinks:M(Yre)}).loose(),Zre=Yc(`kind`,[N({id:k().min(1),kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),label:k(),cluster:k().nullable(),category:k().nullable(),tags:M(k()).nullable()}).loose(),N({id:k().min(1),kind:F(`external`),url:k().min(1),label:k()}).loose()]),Qre=N({source:k().min(1),target:k().min(1)}).loose(),$re=N({nodes:M(Zre),links:M(Qre)}).loose(),eie=N({ts:A().int().min(0),url:k(),method:k(),ua:k().optional(),origin:k().optional(),referer:k().optional(),host:k().optional(),remote:k().optional(),secChUa:k().optional(),secChUaMobile:k().optional(),secChUaPlatform:k().optional(),secFetchSite:k().optional(),secFetchDest:k().optional(),secFetchMode:k().optional(),secFetchUser:k().optional()}).loose(),tie=N({app:qc([F(`cursor`),F(`codex`),F(`claude`),Rc()]),signals_fired:M(k())}).loose();N({entries:M(eie),count:A().int().min(0),detection:tie}).loose(),N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:r2,...n2}).loose(),N({checkpointRef:k().min(1)}).loose();var nie=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose();N({entries:M(N({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:P([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:M(nie),checkpoint:Bc().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional(),hasMore:j().optional()}).loose(),N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose();var rie=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose();M(Yc(`source`,[N({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:F(`flat`)}).loose(),N({docName:k().min(1),timestamp:k().min(1),source:F(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});var iie=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),aie=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),oie=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose();N({deadLinks:M(N({target:k().min(1),sources:M(oie)}).loose())}).loose(),N({target:N({docName:k().min(1),title:k(),aliases:M(k())}).loose(),mentions:M(N({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:j()}).loose(),N({projectPath:k().min(1)}).loose();var sie=P([`not-a-git-worktree`,`init-failed`]);Yc(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:sie,message:k().min(1)}).loose()]),N({host:k().min(1).optional()}).loose(),N({key:k().min(1)}).loose(),N({keyPresent:j()}).loose(),N({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),N({authenticated:j()}).loose(),N({}).loose();var cie=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),lie=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(cie)}).loose(),uie=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),die=N({sessionAlive:j(),agent:uie.nullable(),files:M(lie)}).loose(),fie=N({diff:k(),generatedAt:A().int().min(0)}).loose();N({}).loose(),N({}).loose(),N({}).loose(),N({}).loose(),N({}).loose(),N({}).loose();var pie=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose();N({presence:$c(k().min(1),pie)}).loose(),$c(k().min(1),j()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),N({path:k().min(1,`path must be non-empty`)}).loose(),N({}).loose();var mie=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),hie=N({fromPath:k().min(1),toPath:k().min(1)}).loose();N({}).loose(),N({path:k().min(1),...n2,summary:r2}).loose();var gie=N({docName:k().min(1)}).loose();N({path:k().min(1),...n2,summary:r2}).loose();var _ie=N({path:k().min(1)}).loose();N({kind:P([`file`,`folder`]),path:k().min(1),...n2,summary:r2}).loose();var vie=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),yie=N({pages:M(N({docName:k().min(1),title:k(),docExt:k().min(1),size:A().int().nonnegative(),modified:k().min(1),icon:k().min(1).max(2048).optional()}).loose())}).loose(),bie=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),xie=N({docName:k().min(1),headings:M(bie)}).loose(),Sie=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose();N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...n2,summary:r2}).loose();var Cie=N({renamed:M(mie),renamedAssets:M(hie),rewrittenDocs:M(Sie).optional(),summary:K7.optional()}).loose();N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...n2}).loose();var wie=N({deletedDocNames:M(k().min(1))}).loose();N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...n2,summary:r2}).loose();var Tie=N({deletedDocNames:M(k().min(1))}).loose();N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:r2,...n2}).loose(),N({restoredFrom:k().min(1),timestamp:k().min(1),summary:K7.optional(),warning:q7.optional(),warnings:X7.optional()}).loose();var Eie=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),Die=N({label:k().min(1),webUrl:kee().nullable()}).loose(),Oie=Yc(`checkStatus`,[N({checkStatus:F(`allowed`)}).loose(),N({checkStatus:F(`denied`),deniedReason:P([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),N({checkStatus:F(`unknown`),unknownError:P([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),$7=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]);N({state:Eie,lastSyncUtc:k().nullable(),lastFetchUtc:k().nullable(),lastPushedSha:k().nullable(),ahead:A().int().min(0),behind:A().int().min(0),consecutiveFailures:A().int().min(0),conflictCount:A().int().min(0),hasRemote:j(),syncEnabled:j(),identityUnresolved:j(),remote:Die.nullable().optional(),pushError:k().optional(),pushErrorCode:$7.optional(),pullError:k().optional(),pullErrorCode:$7.optional(),pausedReason:k().optional(),pushPermission:Oie.optional()}).loose(),N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),N({op:P([`sync`,`push`,`pull`])}).loose(),N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),N({file:k().min(1),strategy:P([`mine`,`theirs`,`content`,`delete`]),content:k().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`]}),N({}).loose(),N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),N({plan:Tl(e=>e!==void 0,{message:`plan is required`})}).loose(),N({plan:Tl(e=>e!==void 0,{message:`plan is required`})}).loose(),N({result:Tl(e=>e!==void 0,{message:`result is required`})}).loose();var kie=N({path:k().min(1),summary:k().min(1)}).loose(),Aie=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose();N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(kie),entryCounts:Aie}).loose())}).loose(),N({noOpen:j().optional(),out:k().min(1).optional()}).loose();var jie=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose();Yc(`status`,[N({status:F(`installed`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k()}).loose(),N({status:F(`built`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k(),handoffError:jie.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]);var e9=P(b$);Gc({schema:F(1),targets:M(e9).default([])}),N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose();var Mie=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose();N({name:k().min(1),docs:M(Mie)}).loose(),N({folder:Bc(),frontmatter_local:$c(k(),Bc()).nullable()}).loose(),N({path:k(),frontmatter:$c(k(),Bc()).optional()}).loose(),N({applied:Bc()}).loose();var t9=$c(k(),Bc()).meta({description:`Free-form frontmatter map embedded in template payloads.`});N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:t9,body:k()}).strict()}).strict();var Nie=N({templates:M(N({name:k().min(1),title:k().optional(),description:k().optional(),path:k().min(1),source_folder:k()}).strict()),truncated:j()}).strict();N({folder:k(),name:k(),body:k().optional(),frontmatter:t9.optional(),...n2,summary:r2}).strict(),N({path:k().min(1),created:j(),warnings:M(k())}).strict(),N({existed:j(),path:k().min(1)}).strict(),N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:t9.optional(),...n2,summary:r2}).strict(),N({from:k().min(1),to:k().min(1),committed:j()}).strict();var n9=P(t$),Pie=/^[a-z0-9-]+$/,Fie=/^[A-Za-z0-9_-]+$/,r9=N({name:k(),description:k()}).strict();N({skill:N({name:k().min(1),scope:n9,path:k().min(1),frontmatter:r9,body:k(),files:M(N({path:k().min(1),text:k().nullable()})).optional()}).strict()}).strict();var Iie=N({skills:M(N({name:k().min(1),description:k().optional(),scope:n9,path:k().min(1),absolutePath:k().min(1).optional(),installed:j(),hosts:M(k()),installedVersion:k().optional(),bundledVersion:k().optional(),updateAvailable:j().optional()}).strict()),truncated:j()}).strict();N({scope:n9.default(`project`),name:k(),body:k().optional(),frontmatter:r9,...n2,summary:r2}).strict(),N({path:k().min(1),created:j(),warnings:M(k())}).strict(),N({scope:n9.default(`project`),name:k(),...n2,summary:r2}).strict(),N({name:k().min(1),version:k().min(1),previousVersion:k().optional(),checkpointRef:k().optional()}).strict(),N({existed:j(),path:k().min(1)}).strict(),N({scope:n9.default(`project`),fromName:k(),toName:k(),body:k().optional(),frontmatter:r9.optional(),...n2,summary:r2}).strict(),N({from:k().min(1),to:k().min(1),committed:j()}).strict();var i9=P([`reference`,`script`]);N({scope:n9.default(`project`),name:k(),path:k().min(1),content:k(),...n2,summary:r2}).strict(),N({path:k().min(1),created:j(),kind:i9,content:j()}).strict(),N({path:k().min(1),kind:i9,text:k()}).strict(),N({path:k().min(1),existed:j(),kind:i9}).strict(),N({scope:n9.default(`project`),name:k(),targets:M(e9).optional().meta({description:`Explicit editor ids to install into; omit to use project-configured editors.`}),...n2,summary:r2}).strict(),N({name:k().min(1),hosts:M(k()),scripts:j(),warnings:M(k()),warningCodes:M(P([`no-targets`,`scripts-present`]))}).strict(),N({scope:n9.default(`project`),name:k()}).strict(),N({name:k().min(1),uninstalled:j()}).strict();var Lie=N({targets:M(e9),configured:j()}).strict();N({targets:M(e9)}).strict(),N({targets:M(e9),reprojected:M(N({name:k(),hosts:M(k())}).strict()),bundleHosts:M(k()),removedFrom:M(k())}).strict(),N({scope:n9.default(`project`),name:k(),version:k().regex(/^[0-9a-f]{40}$/i),...n2,summary:r2}).strict(),N({name:k().min(1),version:k(),restoredFiles:M(k()),warnings:M(k())}).strict(),N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:P([`navigation`,`relevance`]).optional(),scopes:M(P([`page`,`folder`,`content`,`file`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional(),source:P([`omnibar`,`mcp`,`http`]).optional()}).loose();var Rie=N({kind:P([`page`,`folder`,`content`,`file`]),path:k().min(1),title:k(),score:A(),signals:$c(k(),Bc()),snippet:k().optional()}).loose(),zie=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose();N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),keyHint:k().nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(Rie),elapsedMs:A().nonnegative(),semantic:zie.optional(),truncated:j().optional(),ready:j().optional()}).loose();var Bie=N({version:k().min(1),recordedAt:k().min(1)}).loose();N({currentVersion:k().min(1),targets:$c(k(),Bie.nullable())}).loose();var Vie=`server-info`,Hie=`branch-switched`,Uie=`disk-ack`,Wie=`config-validation-rejected`,Gie=`config-ignore-nested-error`,a9=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),Kie=N({v:F(1),ch:F(Vie),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),qie=N({v:F(1),ch:F(Hie),seq:A(),branch:k().min(1)}).loose(),Jie=N({v:F(1),ch:a9,seq:A()}).loose(),Yie=N({v:F(1),ch:F(Uie),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),Xie=N({v:F(1),ch:F(Wie),seq:A(),docName:k().min(1),error:Lu}).loose(),Zie=N({v:F(1),ch:F(Gie),seq:A(),path:k().min(1),error:k().min(1)}).loose();function Qie(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 $ie(e){if(typeof e!=`string`||e.length===0)return e;let t=v3(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(p3(e)){let t=Qie(e);return t?`https://player.vimeo.com/video/${t}`:e}let n=u3(e);if(n){let e=n.startRaw===null?``:`?t=${n.startRaw}`;return`https://www.loom.com/embed/${n.id}${e}`}return e}var eae=`https://api.github.com/repos/inkeep/open-knowledge`;async function tae(e){let{signal:t,...n}=e??{},r=t?AbortSignal.any([AbortSignal.timeout(5e3),t]):AbortSignal.timeout(5e3);try{let e=await fetch(eae,{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 nae(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 yQ.default;var rae=new yQ.default;rae.Diff_Timeout=.25;var iae=N({path:M(qc([k(),A()])),message:k(),issueCode:k()});Yc(`code`,[N({code:F(`SCHEMA_INVALID`),issues:M(iae)}),N({code:F(`WRITE_ERROR`),detail:k()})]);function aae(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function oae(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 sae={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function cae(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function o9(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=y(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(cae(n)){let r=e.createNode(n),i=g(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function lae(e){return e===``?``:`---\n${e.endsWith(`
528
- `)?e.slice(0,-1):e}\n---\n`}var s9=65536;function c9(e){let t=e.match(R$);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function uae(e){if(e.trim()===``)return{doc:new un({}),map:{}};let t;try{t=_r(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new un({}),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=Bre.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 l9(e){return e===``?{doc:new un({}),map:{}}:uae(V$(e))}function u9(e){let{fenced:t}=c9(e),{map:n,parseError:r}=l9(t);return{map:n??{},parseError:r}}function d9(e){let{fenced:t}=c9(e);if(t===``)return[];let{doc:n,map:r}=l9(t);return r===null?[]:h9(n)}function f9(e){return typeof e==`object`&&!!e&&`key`in e}function p9(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 m9(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 h9(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!f9(e))continue;let t=p9(e);t!==null&&n.push(t)}return n}function g9(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function dae(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:lae(e.toString(sae))}function fae(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:s9}:null}function _9(e){let t=dae(e),n=fae(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function pae(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:B7}};let{doc:n,map:r}=l9(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{g9(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=U7.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,o9(n,n.get(e,!0),t.data))}return _9(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function mae(e,t,n,r={}){if(t===`frontmatter`||n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:B7}};let{doc:i,map:a}=l9(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=>f9(e)&&p9(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>f9(e)&&e!==s&&p9(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return m9(s,n),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function v9(e,t){let{doc:n,map:r}=l9(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=h9(n);if(a.length!==t.length||!y9(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(f9),r=[];for(let n of t){let i=e.findIndex(e=>p9(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,_9(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function y9(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 b9(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:B7}:null}function hae(e,t,n){let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=U7.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 g9(i),i.setIn(t,o9(i,i.getIn(t,!0),o.data)),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function gae(e,t){let n=b9(t);if(n)return{ok:!1,error:n};let{doc:r,map:i}=l9(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),_9(r))}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function _ae(e,t){if(t.length===0){let t=e.contents;return g(t)?t:null}let n=e.getIn(t,!0);return g(n)?n:null}function vae(e,t,n,r={}){let i=b9(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:B7}};let{doc:o,map:s}=l9(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=_ae(o,t.slice(0,-1));if(!c)return{ok:!1,error:{kind:`unknown_key`,key:a}};let l=c.items.find(e=>f9(e)&&p9(e)===a);if(!l)return{ok:!1,error:{kind:`unknown_key`,key:a}};if(!r.allowDuplicate&&c.items.some(e=>f9(e)&&e!==l&&p9(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return m9(l,n),_9(o)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function yae(e,t,n){if(t.length===0)return v9(e,n);let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!g(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(!f9(e))continue;let t=p9(e);t!==null&&s.push(t)}if(s.length!==n.length||!y9(s,n))return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};try{let e=o.items.filter(f9),t=[];for(let r of n){let i=e.findIndex(e=>p9(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,_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function bae(e,t,n){let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!y(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(!xae(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]),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function xae(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 Sae=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function x9(e){return{ok:!1,error:e}}function Cae(e){return{ok:!0,...e}}function wae(e){return{ok:!0,...e}}function Tae(e){return{ok:!0,...e}}function S9(e){return{ok:!0,...e}}function C9(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 ${s9}-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 Eae(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(!G7(e.map[n],t.map[n]))return!1;return!0}var Dae=5;function w9(e){let t=e.toString();return{snapshot:Oae(t),raw:t}}function Oae(e){let{map:t,parseError:n}=u9(e);return{map:t,keys:d9(e),parseError:n}}function T9(e){return e.startsWith(`---`)}function kae(e){let t=e.document,n=t.getText(`source`),r=new Set,i=w9(n),a=i.snapshot,o=c9(i.raw).fenced,s=T9(i.raw),c=!1;function l(e=!1){if(c)return;let t,i;try{let e=w9(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!e&&Eae(a,t)){s=T9(i);return}a=t,o=c9(i).fenced,s=T9(i);for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}let u=e=>{c||Aae(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{fenced:t}=c9(n.toString());r=e(t),r.ok&&r.nextFenced!==t&&(n.delete(0,t.length),r.nextFenced!==``&&n.insert(0,r.nextFenced))},Sae),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function p(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,`frontmatter`))return x9({code:`SCHEMA_INVALID`,issues:[{path:[B7],message:`'${B7}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=Vre.safeParse(e);if(!t.success)return x9({code:`SCHEMA_INVALID`,issues:t.error.issues.map(aae)});let n=t.data,r=Object.keys(n),i=f(e=>pae(e,n));return i.ok?Cae({appliedKeys:r}):x9(C9(i.error))}function m(e,t,n={}){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>mae(r,e,t,n));return r.ok?wae({oldKey:e,newKey:t}):x9(C9(r.error))}function h(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>v9(t,e));return t.ok?Tae({orderedKeys:[...e]}):x9(C9(t.error))}function g(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>hae(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}function _(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>gae(t,e));return t.ok?S9({path:[...e]}):x9(C9(t.error))}function v(e,t,n={}){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>vae(r,e,t,n));return r.ok?S9({path:[...e]}):x9(C9(r.error))}function y(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>yae(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}function b(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>bae(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}return{current(){return w9(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 Aae(e,t,n){if(t===0&&n)return!0;let r=t>0?t:Dae,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}var jae=new yQ.default;jae.Match_Threshold=.5;var E9=/^[a-zA-Z0-9][\w/-]*$/;function Mae(e){if(typeof e!=`string`)return!1;let t=e.startsWith(`#`)?e.slice(1):e;return E9.test(t)}var Nae=`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`,Pae=P(t$),Fae=Gc({hosts:M(k()),scope:Pae,scripts:j(),installedAt:xc()});Gc({schema:F(1),skills:$c(k(),Fae).default({})});var Iae=100,Lae=500,Rae=450,zae={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},D9=new WeakMap;function Bae(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function O9(e){return e.trim().toLowerCase()}var Vae=/\.(?:md|mdx)$/;function Hae(e,t){if(t!==`page`)return e;let n=e.replace(Vae,``);return n.length>0?n:e}function k9(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function Uae(e){let t=k9(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}}function A9(e){let t=AZ({schema:zae});return e.length>0&&BZ(t,e),t}function Wae(e){let t={documents:e};return D9.set(t,A9(e)),t}function Gae(e){let t=D9.get(e);if(t)return t;let n=A9(e.documents);return D9.set(e,n),n}function Kae(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function j9(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function qae(e,t){let n=O9(t);if(!n)return 0;let r=Hae(n,e.kind),i=O9(e.title),a=O9(e.name),o=O9(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 Jae=.5;function M9(e,t){let n=qae(e,t);return n<=0?n:$0(e.path)?n*Jae:n}var Yae=60;function Xae(e){return e===`file`?-Yae:0}var Zae=1e3,N9=50,Qae=1,$ae=1,eoe=.001;function toe(e,t,n,r,i){let a=i>0?t/i:0,o=N9>0?n/N9:0,s=r===`file`?-eoe:0,c=Qae*a+$ae*o+s;return e*Zae+c}function P9(e,t,n,r){return e+t*20+n+Xae(r)}function F9(e,t,n,r,i,a){return e===`relevance`?P9(t,n,r,i):toe(t,n,r,i,a)}function noe(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function I9(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function roe(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 ioe(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function aoe(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}}function ooe(e,t){return O9(t).length<4?0:+(e===`full_text`)}function soe(e){let{lexical:t,fullText:n}=e.signals;return t>=Lae?`lexical`:t===Rae&&n<=0?`pathOnly`:`body`}function coe(e){let t=[],n=[],r=[];for(let i of e){let e=soe(i);e===`lexical`?t.length<Iae&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function L9(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=coe(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 loe(e,t,n={}){let r=n.intent??`omnibar`,i=noe(r,n.ranking),a=Bae(n.limit),o=new Set(n.scopes??Kae(r)),s=e.documents.filter(e=>j9(e,o)),c=O9(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=gQ(Gae(e),{term:c,properties:ioe(r),boost:aoe(r),tolerance:ooe(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>j9(e.document,o)).map(e=>[e.document.id,e.score])),d=roe(s),f=new Map;for(let e of s)M9(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)j9(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=I9(f.values(),u);return L9([...f.values()].map(t=>{let n=Math.max(0,M9(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:F9(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 L9(uoe({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function R9(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function uoe(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=I9(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,M9(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?F9(o,t,n,s,e.kind,m):P9(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=R9(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)),_=R9(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 doe(e){return`https://github.com/${e.owner}/${e.repo}.git`}function foe(e,t){return!e||e.length===0?`true`:t.detached?`detached`:t.currentBranch===null||t.currentBranch===e?`true`:`false`}var z9=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),B9=globalThis;B9[z9]===void 0&&(B9[z9]=Io());var V9=B9[z9],H9=Gc({version:k().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(V9,{description:`Recorded skill version for this target.`}),recordedAt:xc().register(V9,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(V9,{description:`Install-source surface that recorded this entry.`}).optional()}),poe=Gc({enabled:j().register(V9,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:xc().register(V9,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});Gc({schema:F(1).register(V9,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Gc({"claude-cowork":H9.optional(),"cli-hosts":H9.optional()}).register(V9,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:$c(k(),poe).register(V9,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional()});var U9=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 moe(e,t,n,r,i={}){let a=i.thresholdBytes??512e3,o=i.chunkSizeBytes??51200,s=i.origin,c=i.yieldFn??hoe,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 U9(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 hoe(){return new Promise(e=>{let t=globalThis;t.document?.hidden!==!0&&typeof t.requestAnimationFrame==`function`?t.requestAnimationFrame(()=>e()):setTimeout(()=>e(),0)})}function goe(){let e=!1,t=``,n=0;return r=>{let i=_oe(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function _oe(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}var voe=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],yoe={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`},boe={cursor:`#FFFFFF`,windsurf:`#FFFFFF`},W9=[`#f0ece3`,`#fff5e1`,`#f9e1db`,`#f5def7`,`#ece2fb`,`#dce8fa`,`#DBF3FB`];function xoe(e,t=voe){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}function Soe(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 Coe(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 woe={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function Toe(e){return e?woe[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}function Eoe(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 Doe(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 Ooe(e){let[t]=Eoe(e);return Doe(t,45,32)}var koe=[`Curious`,`Brave`,`Clever`,`Swift`,`Gentle`,`Bright`,`Wise`,`Bold`,`Calm`,`Keen`],Aoe=[`Bird`,`Cat`,`Dog`,`Fish`,`Mouse`,`Rabbit`,`Shrimp`,`Snail`,`Squirrel`,`Turtle`],G9=`ok-user-name-v3`,K9=`ok-user-color-v3`;function q9(e){return e[Math.floor(Math.random()*e.length)]}function joe(){return`${q9(koe)} ${q9(Aoe)}`}function Moe(){return q9(W9)}function J9(e){try{return localStorage.getItem(e)}catch{return null}}function Y9(e,t){try{localStorage.setItem(e,t)}catch{}}function Noe(){let e=new URLSearchParams(window.location.search).get(`coeditor`)||`standalone`,t=crypto.randomUUID(),n=J9(G9),r=J9(K9);return n||(n=joe(),Y9(G9,n)),r||(r=Moe(),Y9(K9,r)),{name:n,color:r,coeditor:e,tabId:t}}function Poe(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 Foe(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}var X9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Z9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function Q9(e){return e.split(`/`).filter(Boolean)}function $9(e){let t=e.trim();return X9.test(t)||t.startsWith(`//`)}function Ioe(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($9(n))return{kind:`external`,url:n};let r=Poe(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=Z9(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function Loe(e,t){let n=e.trim();if(!n)return null;if($9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=Z9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function Roe(e,t){let n=e.trim();if(!n||X9.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 zoe(e,t,n=null,r=`.md`){let i=Q9(e);i.pop();let a=Q9(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 Boe(e){return e.replace(/[/\\:*?"<>|\0]/g,`-`).replace(/\s+/g,` `).replace(/-+/g,`-`).trim().replace(/^[-.\s]+|[-.\s]+$/g,``)}export{O$ as $,Fre as $n,Xb as $r,u0 as $t,x$ as A,zl as Ai,$3 as An,r0 as Ar,H1 as At,K$ as B,Vu as Bi,n1 as Bn,yE as Br,Y1 as Bt,h$ as C,z as Ci,Noe as Cn,B$ as Cr,Fie as Ct,Kre as D,vd as Di,Toe as Dn,OQ as Dr,Nie as Dt,Q7 as E,I as Ei,E4 as En,D7 as Er,P1 as Et,Xre as F,Il as Fi,t6 as Fn,WO as Fr,PQ as Ft,e$ as G,wu as Gi,d3 as Gn,ux as Gr,foe as Gt,m$ as H,au as Hi,$9 as Hn,vS as Hr,zoe as Ht,W9 as I,Ll as Ii,Q3 as In,UO as Ir,kae as It,p1 as J,N as Ji,$$ as Jn,zS as Jr,SQ as Jt,t$ as K,Oee as Ki,n$ as Kn,VS as Kr,Ioe as Kt,C4 as L,Gl as Li,r6 as Ln,eE as Lr,BQ as Lt,z$ as M,Wl as Mi,o6 as Mn,Wte as Mr,rie as Mt,Nae as N,Ul as Ni,n6 as Nn,Bte as Nr,H0 as Nt,vie as O,L as Oi,s6 as On,V$ as Or,Tie as Ot,E9 as P,Bl as Pi,a6 as Pn,VO as Pr,Foe as Pt,D$ as Q,ii as Qi,d$ as Qn,bb as Qr,j0 as Qt,aie as R,jl as Ri,i6 as Rn,FT as Rr,J1 as Rt,gie as S,jp as Si,_re as Sn,s$ as Sr,Iie as St,a9 as T,uf as Ti,qQ as Tn,G$ as Tr,Y0 as Tt,r1 as U,ou as Ui,Hre as Un,rS as Ur,doe as Ut,q$ as V,Ru as Vi,g$ as Vn,uE as Vr,Z1 as Vt,$re as W,_u as Wi,$0 as Wn,Bx as Wr,moe as Wt,w$ as X,si as Xi,Mae as Xn,ES as Xr,F$ as Xt,i0 as Y,k as Yi,Q$ as Yn,_b as Yr,CQ as Yt,iie as Z,li as Zi,p3 as Zn,yb as Zr,xoe as Zt,XQ as _,Ip as _i,I$ as _n,$ie as _r,f2 as _t,fie as a,dx as ai,a0 as an,z1 as ar,TQ as at,k$ as b,$p as bi,G7 as bn,K1 as br,e9 as bt,Zie as c,Dy as ci,q3 as cn,l$ as cr,m1 as ct,Yie as d,RS as di,Ooe as dn,B1 as dr,Z$ as dt,Zb as ei,l0 as en,Mre as er,b$ as et,Kie as f,xS as fi,C$ as fn,v3 as fr,r$ as ft,ZQ as g,Bv as gi,oae as gn,Roe as gr,s2 as gt,YQ as h,ov as hi,Z9 as hn,u9 as hr,x2 as ht,die as i,Gb as ii,s0 as in,d7 as ir,C2 as it,GQ as j,yu as ji,e6 as jn,k9 as jr,G1 as jt,v$ as k,Ml as ki,c6 as kn,O7 as kr,w2 as kt,Xie as l,Mb as li,Wae as ln,nae as lr,Cie as lt,QQ as m,rv as mi,U1 as mn,d9 as mr,JQ as mt,boe as n,Hb as ni,c0 as nn,VQ as nr,yie as nt,Jre as o,DS as oi,Soe as on,o$ as or,wQ as ot,bQ as p,$v as pi,KQ as pn,i$ as pr,Pie as pt,are as q,F as qi,T$ as qn,HS as qr,Loe as qt,_$ as r,Wb as ri,k0 as rn,P$ as rr,S2 as rt,qie as s,Xy as si,goe as sn,u3 as sr,B7 as st,yoe as t,Nb as ti,o0 as tn,D4 as tr,xie as tt,Jie as u,px as ui,Uae as un,DQ as ur,Y$ as ut,f$ as v,B as vi,S7 as vn,Boe as vr,d2 as vt,wie as w,Of as wi,V1 as wn,q1 as wr,J0 as wt,_ie as x,R as xi,tae as xn,U0 as xr,Lie as xt,U9 as y,Xp as yi,Coe as yn,loe as yr,h2 as yt,N5 as z,uu as zi,zre as zn,pE as zr,X0 as zt};
528
+ `)?e.slice(0,-1):e}\n---\n`}var s9=65536;function c9(e){let t=e.match(R$);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function uae(e){if(e.trim()===``)return{doc:new un({}),map:{}};let t;try{t=_r(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new un({}),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=Bre.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 l9(e){return e===``?{doc:new un({}),map:{}}:uae(V$(e))}function u9(e){let{fenced:t}=c9(e),{map:n,parseError:r}=l9(t);return{map:n??{},parseError:r}}function d9(e){let{fenced:t}=c9(e);if(t===``)return[];let{doc:n,map:r}=l9(t);return r===null?[]:h9(n)}function f9(e){return typeof e==`object`&&!!e&&`key`in e}function p9(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 m9(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 h9(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!f9(e))continue;let t=p9(e);t!==null&&n.push(t)}return n}function g9(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function dae(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:lae(e.toString(sae))}function fae(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:s9}:null}function _9(e){let t=dae(e),n=fae(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function pae(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:B7}};let{doc:n,map:r}=l9(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{g9(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=U7.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,o9(n,n.get(e,!0),t.data))}return _9(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function mae(e,t,n,r={}){if(t===`frontmatter`||n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:B7}};let{doc:i,map:a}=l9(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=>f9(e)&&p9(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>f9(e)&&e!==s&&p9(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return m9(s,n),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function v9(e,t){let{doc:n,map:r}=l9(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=h9(n);if(a.length!==t.length||!y9(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(f9),r=[];for(let n of t){let i=e.findIndex(e=>p9(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,_9(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function y9(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 b9(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:B7}:null}function hae(e,t,n){let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=U7.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 g9(i),i.setIn(t,o9(i,i.getIn(t,!0),o.data)),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function gae(e,t){let n=b9(t);if(n)return{ok:!1,error:n};let{doc:r,map:i}=l9(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),_9(r))}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function _ae(e,t){if(t.length===0){let t=e.contents;return g(t)?t:null}let n=e.getIn(t,!0);return g(n)?n:null}function vae(e,t,n,r={}){let i=b9(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:B7}};let{doc:o,map:s}=l9(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=_ae(o,t.slice(0,-1));if(!c)return{ok:!1,error:{kind:`unknown_key`,key:a}};let l=c.items.find(e=>f9(e)&&p9(e)===a);if(!l)return{ok:!1,error:{kind:`unknown_key`,key:a}};if(!r.allowDuplicate&&c.items.some(e=>f9(e)&&e!==l&&p9(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return m9(l,n),_9(o)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function yae(e,t,n){if(t.length===0)return v9(e,n);let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!g(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(!f9(e))continue;let t=p9(e);t!==null&&s.push(t)}if(s.length!==n.length||!y9(s,n))return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};try{let e=o.items.filter(f9),t=[];for(let r of n){let i=e.findIndex(e=>p9(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,_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function bae(e,t,n){let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!y(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(!xae(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]),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function xae(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 Sae=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function x9(e){return{ok:!1,error:e}}function Cae(e){return{ok:!0,...e}}function wae(e){return{ok:!0,...e}}function Tae(e){return{ok:!0,...e}}function S9(e){return{ok:!0,...e}}function C9(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 ${s9}-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 Eae(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(!G7(e.map[n],t.map[n]))return!1;return!0}var Dae=5;function w9(e){let t=e.toString();return{snapshot:Oae(t),raw:t}}function Oae(e){let{map:t,parseError:n}=u9(e);return{map:t,keys:d9(e),parseError:n}}function T9(e){return e.startsWith(`---`)}function kae(e){let t=e.document,n=t.getText(`source`),r=new Set,i=w9(n),a=i.snapshot,o=c9(i.raw).fenced,s=T9(i.raw),c=!1;function l(e=!1){if(c)return;let t,i;try{let e=w9(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!e&&Eae(a,t)){s=T9(i);return}a=t,o=c9(i).fenced,s=T9(i);for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}let u=e=>{c||Aae(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{fenced:t}=c9(n.toString());r=e(t),r.ok&&r.nextFenced!==t&&(n.delete(0,t.length),r.nextFenced!==``&&n.insert(0,r.nextFenced))},Sae),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function p(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,`frontmatter`))return x9({code:`SCHEMA_INVALID`,issues:[{path:[B7],message:`'${B7}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=Vre.safeParse(e);if(!t.success)return x9({code:`SCHEMA_INVALID`,issues:t.error.issues.map(aae)});let n=t.data,r=Object.keys(n),i=f(e=>pae(e,n));return i.ok?Cae({appliedKeys:r}):x9(C9(i.error))}function m(e,t,n={}){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>mae(r,e,t,n));return r.ok?wae({oldKey:e,newKey:t}):x9(C9(r.error))}function h(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>v9(t,e));return t.ok?Tae({orderedKeys:[...e]}):x9(C9(t.error))}function g(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>hae(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}function _(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>gae(t,e));return t.ok?S9({path:[...e]}):x9(C9(t.error))}function v(e,t,n={}){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>vae(r,e,t,n));return r.ok?S9({path:[...e]}):x9(C9(r.error))}function y(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>yae(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}function b(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>bae(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}return{current(){return w9(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 Aae(e,t,n){if(t===0&&n)return!0;let r=t>0?t:Dae,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}var jae=new yQ.default;jae.Match_Threshold=.5;var E9=/^[a-zA-Z0-9][\w/-]*$/;function Mae(e){if(typeof e!=`string`)return!1;let t=e.startsWith(`#`)?e.slice(1):e;return E9.test(t)}var Nae=`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`,Pae=P(t$),Fae=Gc({hosts:M(k()),scope:Pae,scripts:j(),installedAt:xc()});Gc({schema:F(1),skills:$c(k(),Fae).default({})});var Iae=100,Lae=500,Rae=450,zae={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},D9=new WeakMap;function Bae(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function O9(e){return e.trim().toLowerCase()}var Vae=/\.(?:md|mdx)$/;function Hae(e,t){if(t!==`page`)return e;let n=e.replace(Vae,``);return n.length>0?n:e}function k9(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function Uae(e){let t=k9(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}}function A9(e){let t=AZ({schema:zae});return e.length>0&&BZ(t,e),t}function Wae(e){let t={documents:e};return D9.set(t,A9(e)),t}function Gae(e){let t=D9.get(e);if(t)return t;let n=A9(e.documents);return D9.set(e,n),n}function Kae(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function j9(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function qae(e,t){let n=O9(t);if(!n)return 0;let r=Hae(n,e.kind),i=O9(e.title),a=O9(e.name),o=O9(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 Jae=.5;function M9(e,t){let n=qae(e,t);return n<=0?n:$0(e.path)?n*Jae:n}var Yae=60;function Xae(e){return e===`file`?-Yae:0}var Zae=1e3,N9=50,Qae=1,$ae=1,eoe=.001;function toe(e,t,n,r,i){let a=i>0?t/i:0,o=N9>0?n/N9:0,s=r===`file`?-eoe:0,c=Qae*a+$ae*o+s;return e*Zae+c}function P9(e,t,n,r){return e+t*20+n+Xae(r)}function F9(e,t,n,r,i,a){return e===`relevance`?P9(t,n,r,i):toe(t,n,r,i,a)}function noe(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function I9(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function roe(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 ioe(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function aoe(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}}function ooe(e,t){return O9(t).length<4?0:+(e===`full_text`)}function soe(e){let{lexical:t,fullText:n}=e.signals;return t>=Lae?`lexical`:t===Rae&&n<=0?`pathOnly`:`body`}function coe(e){let t=[],n=[],r=[];for(let i of e){let e=soe(i);e===`lexical`?t.length<Iae&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function L9(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=coe(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 loe(e,t,n={}){let r=n.intent??`omnibar`,i=noe(r,n.ranking),a=Bae(n.limit),o=new Set(n.scopes??Kae(r)),s=e.documents.filter(e=>j9(e,o)),c=O9(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=gQ(Gae(e),{term:c,properties:ioe(r),boost:aoe(r),tolerance:ooe(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>j9(e.document,o)).map(e=>[e.document.id,e.score])),d=roe(s),f=new Map;for(let e of s)M9(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)j9(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=I9(f.values(),u);return L9([...f.values()].map(t=>{let n=Math.max(0,M9(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:F9(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 L9(uoe({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function R9(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function uoe(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=I9(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,M9(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?F9(o,t,n,s,e.kind,m):P9(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=R9(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)),_=R9(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 doe(e){return`https://github.com/${e.owner}/${e.repo}.git`}function foe(e,t){return!e||e.length===0?`true`:t.detached?`detached`:t.currentBranch===null||t.currentBranch===e?`true`:`false`}var z9=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),B9=globalThis;B9[z9]===void 0&&(B9[z9]=Io());var V9=B9[z9],H9=Gc({version:k().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(V9,{description:`Recorded skill version for this target.`}),recordedAt:xc().register(V9,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(V9,{description:`Install-source surface that recorded this entry.`}).optional()}),poe=Gc({enabled:j().register(V9,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:xc().register(V9,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});Gc({schema:F(1).register(V9,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Gc({"claude-cowork":H9.optional(),"cli-hosts":H9.optional()}).register(V9,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:$c(k(),poe).register(V9,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional()});var U9=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 moe(e,t,n,r,i={}){let a=i.thresholdBytes??512e3,o=i.chunkSizeBytes??51200,s=i.origin,c=i.yieldFn??hoe,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 U9(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 hoe(){return new Promise(e=>{let t=globalThis;t.document?.hidden!==!0&&typeof t.requestAnimationFrame==`function`?t.requestAnimationFrame(()=>e()):setTimeout(()=>e(),0)})}function goe(){let e=!1,t=``,n=0;return r=>{let i=_oe(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function _oe(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}var voe=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],yoe={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`},boe={cursor:`#FFFFFF`,windsurf:`#FFFFFF`},W9=[`#f0ece3`,`#fff5e1`,`#f9e1db`,`#f5def7`,`#ece2fb`,`#dce8fa`,`#DBF3FB`];function xoe(e,t=voe){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}function Soe(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 Coe(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 woe={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function Toe(e){return e?woe[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}function Eoe(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 Doe(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 Ooe(e){let[t]=Eoe(e);return Doe(t,45,32)}var koe=[`Curious`,`Brave`,`Clever`,`Swift`,`Gentle`,`Bright`,`Wise`,`Bold`,`Calm`,`Keen`],Aoe=[`Bird`,`Cat`,`Dog`,`Fish`,`Mouse`,`Rabbit`,`Shrimp`,`Snail`,`Squirrel`,`Turtle`],G9=`ok-user-name-v3`,K9=`ok-user-color-v3`;function q9(e){return e[Math.floor(Math.random()*e.length)]}function joe(){return`${q9(koe)} ${q9(Aoe)}`}function Moe(){return q9(W9)}function J9(e){try{return localStorage.getItem(e)}catch{return null}}function Y9(e,t){try{localStorage.setItem(e,t)}catch{}}function Noe(){let e=new URLSearchParams(window.location.search).get(`coeditor`)||`standalone`,t=crypto.randomUUID(),n=J9(G9),r=J9(K9);return n||(n=joe(),Y9(G9,n)),r||(r=Moe(),Y9(K9,r)),{name:n,color:r,coeditor:e,tabId:t}}function Poe(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 Foe(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}var X9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Z9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function Q9(e){return e.split(`/`).filter(Boolean)}function $9(e){let t=e.trim();return X9.test(t)||t.startsWith(`//`)}function Ioe(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($9(n))return{kind:`external`,url:n};let r=Poe(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=Z9(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function Loe(e,t){let n=e.trim();if(!n)return null;if($9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=Z9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function Roe(e,t){let n=e.trim();if(!n||X9.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 zoe(e,t,n=null,r=`.md`){let i=Q9(e);i.pop();let a=Q9(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 Boe(e){return e.replace(/[/\\:*?"<>|\0]/g,`-`).replace(/\s+/g,` `).replace(/-+/g,`-`).trim().replace(/^[-.\s]+|[-.\s]+$/g,``)}export{O$ as $,ii as $i,Fre as $n,Xb as $r,u0 as $t,x$ as A,zl as Ai,$3 as An,r0 as Ar,H1 as At,K$ as B,uu as Bi,n1 as Bn,yE as Br,Y1 as Bt,h$ as C,z as Ci,Noe as Cn,B$ as Cr,Fie as Ct,Kre as D,vd as Di,Toe as Dn,OQ as Dr,Nie as Dt,Q7 as E,I as Ei,E4 as En,D7 as Er,P1 as Et,Xre as F,Bl as Fi,t6 as Fn,WO as Fr,PQ as Ft,e$ as G,_u as Gi,d3 as Gn,ux as Gr,foe as Gt,m$ as H,Ru as Hi,$9 as Hn,vS as Hr,zoe as Ht,W9 as I,Il as Ii,Q3 as In,UO as Ir,kae as It,p1 as J,F as Ji,$$ as Jn,zS as Jr,SQ as Jt,t$ as K,wu as Ki,n$ as Kn,VS as Kr,Ioe as Kt,C4 as L,Ll as Li,r6 as Ln,eE as Lr,BQ as Lt,z$ as M,Wl as Mi,o6 as Mn,Wte as Mr,rie as Mt,Nae as N,hu as Ni,n6 as Nn,Bte as Nr,H0 as Nt,vie as O,L as Oi,s6 as On,V$ as Or,Tie as Ot,E9 as P,Ul as Pi,a6 as Pn,VO as Pr,Foe as Pt,D$ as Q,li as Qi,d$ as Qn,bb as Qr,j0 as Qt,aie as R,Gl as Ri,i6 as Rn,FT as Rr,J1 as Rt,gie as S,jp as Si,_re as Sn,s$ as Sr,Iie as St,a9 as T,uf as Ti,qQ as Tn,G$ as Tr,Y0 as Tt,r1 as U,au as Ui,Hre as Un,rS as Ur,doe as Ut,q$ as V,Vu as Vi,g$ as Vn,uE as Vr,Z1 as Vt,$re as W,ou as Wi,$0 as Wn,Bx as Wr,moe as Wt,w$ as X,k as Xi,Mae as Xn,ES as Xr,F$ as Xt,i0 as Y,N as Yi,Q$ as Yn,_b as Yr,CQ as Yt,iie as Z,si as Zi,p3 as Zn,yb as Zr,xoe as Zt,XQ as _,Ip as _i,I$ as _n,$ie as _r,f2 as _t,fie as a,dx as ai,a0 as an,z1 as ar,TQ as at,k$ as b,$p as bi,G7 as bn,K1 as br,e9 as bt,Zie as c,Dy as ci,q3 as cn,l$ as cr,m1 as ct,Yie as d,RS as di,Ooe as dn,B1 as dr,Z$ as dt,Zb as ei,l0 as en,Mre as er,b$ as et,Kie as f,xS as fi,C$ as fn,v3 as fr,r$ as ft,ZQ as g,Bv as gi,oae as gn,Roe as gr,s2 as gt,YQ as h,ov as hi,Z9 as hn,u9 as hr,x2 as ht,die as i,Gb as ii,s0 as in,d7 as ir,C2 as it,GQ as j,yu as ji,e6 as jn,k9 as jr,G1 as jt,v$ as k,Ml as ki,c6 as kn,O7 as kr,w2 as kt,Xie as l,Mb as li,Wae as ln,nae as lr,Cie as lt,QQ as m,rv as mi,U1 as mn,d9 as mr,JQ as mt,boe as n,Hb as ni,c0 as nn,VQ as nr,yie as nt,Jre as o,DS as oi,Soe as on,o$ as or,wQ as ot,bQ as p,$v as pi,KQ as pn,i$ as pr,Pie as pt,are as q,Oee as qi,T$ as qn,HS as qr,Loe as qt,_$ as r,Wb as ri,k0 as rn,P$ as rr,S2 as rt,qie as s,Xy as si,goe as sn,u3 as sr,B7 as st,yoe as t,Nb as ti,o0 as tn,D4 as tr,xie as tt,Jie as u,px as ui,Uae as un,DQ as ur,Y$ as ut,f$ as v,B as vi,S7 as vn,Boe as vr,d2 as vt,wie as w,Of as wi,V1 as wn,q1 as wr,J0 as wt,_ie as x,R as xi,tae as xn,U0 as xr,Lie as xt,U9 as y,Xp as yi,Coe as yn,loe as yr,h2 as yt,N5 as z,jl as zi,zre as zn,pE as zr,X0 as zt};