@inkeep/open-knowledge 0.11.0 → 0.11.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +5 -0
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +1 -1
  4. package/dist/cli.mjs +8 -8
  5. package/dist/config-schema.json +9 -0
  6. package/dist/config.project-local.schema.json +9 -0
  7. package/dist/constants-B6bj5v8h.mjs +2 -0
  8. package/dist/{dist-PzyBKLCf.mjs → dist-DZtwVhee.mjs} +1 -1
  9. package/dist/{dist-9gkYdouR.mjs → dist-Dn42HqcN.mjs} +14 -14
  10. package/dist/{gh-detect-BiKqq3fe.mjs → gh-detect-BhsIZu4A.mjs} +2 -2
  11. package/dist/index.mjs +1 -1
  12. package/dist/{init-DTN3nfbv.mjs → init-BdFitPHK.mjs} +4 -4
  13. package/dist/init-COkCxwuC.mjs +1 -0
  14. package/dist/loader-Cw0O2VV4.mjs +1 -0
  15. package/dist/{loader-C0hzrFB3.mjs → loader-D7k3AFDV.mjs} +2 -2
  16. package/dist/{preview-8OV1Kc4m.mjs → preview-CH_zQHDg.mjs} +2 -2
  17. package/dist/preview-DIHjJw66.mjs +1 -0
  18. package/dist/public/assets/{ActivityModeContent-BsurnqDs.js → ActivityModeContent-8aHZ0PDi.js} +1 -1
  19. package/dist/public/assets/{ConsentDialogBody-CM1Lm4n9.js → ConsentDialogBody-Bd3NDbzN.js} +1 -1
  20. package/dist/public/assets/{DocumentContext-ywaSbgZy.js → DocumentContext-BR1_ll2e.js} +2 -2
  21. package/dist/public/assets/{GraphPanel-DACQCEp9.js → GraphPanel-wcP3_uRY.js} +1 -1
  22. package/dist/public/assets/{McpConsentDialogBody-sOEyFULC.js → McpConsentDialogBody-pUjQ4lzI.js} +1 -1
  23. package/dist/public/assets/SettingsDialogBody-DIx86gK0.js +7 -0
  24. package/dist/public/assets/{SourceEditor-CPUnHIDu.js → SourceEditor-DLmRzDd7.js} +1 -1
  25. package/dist/public/assets/{agent-presence-DxGcS3q2.js → agent-presence-B_GJzt87.js} +1 -1
  26. package/dist/public/assets/button-B_6r-4tt.js +1 -0
  27. package/dist/public/assets/{checkbox-Co7Tjlri.js → checkbox-qnHi6HI6.js} +1 -1
  28. package/dist/public/assets/{collapsible-BhpeB6tu.js → collapsible-DC_eQWsn.js} +1 -1
  29. package/dist/public/assets/{config-validation-events-Dtuvx7eU.js → config-validation-events-Ci1USZRz.js} +6 -6
  30. package/dist/public/assets/{dialog-B1es0EvU.js → dialog-uNuZn7gJ.js} +1 -1
  31. package/dist/public/assets/{dist-P7DYrfOB.js → dist-D6g7y0kn.js} +1 -1
  32. package/dist/public/assets/{dist-DicqJavT.js → dist-q8_YTqei.js} +1 -1
  33. package/dist/public/assets/{index-D3rLIkvo.js → index-DZGBILtp.js} +84 -84
  34. package/dist/public/assets/{keyboard-shortcuts-BtfhTJ-K.js → keyboard-shortcuts-54kMWhVx.js} +1 -1
  35. package/dist/public/assets/{label-DwEePOBC.js → label-DLO_wxY0.js} +1 -1
  36. package/dist/public/assets/{panel-BNBODYwB.js → panel-DDVLqW48.js} +1 -1
  37. package/dist/public/assets/{prop-types-BLvAnH2n.js → prop-types-fLbn-Ruk.js} +3 -3
  38. package/dist/public/assets/{target-navigation-intent-BUfApF6Q.js → target-navigation-intent-Cm8CEQkf.js} +1 -1
  39. package/dist/public/assets/{telemetry-impl-aspahMYR.js → telemetry-impl-l-VsaBiG.js} +1 -1
  40. package/dist/public/assets/{textarea-luaT-nOK.js → textarea-CaVb3JmO.js} +1 -1
  41. package/dist/public/assets/{toggle-group-Cs-1L92l.js → toggle-group-sKkFFfhD.js} +1 -1
  42. package/dist/public/assets/{typing-burst-detector-BjfA2X2R.js → typing-burst-detector-Nq1G7KqK.js} +1 -1
  43. package/dist/public/index.html +18 -18
  44. package/dist/{repair-launch-json-FQjShJhA.mjs → repair-launch-json-BXKGCwKI.mjs} +2 -2
  45. package/dist/{repair-mcp-configs-DnsD7NrD.mjs → repair-mcp-configs-C4d4u5O9.mjs} +2 -2
  46. package/dist/repair-skills-C33ZtGgy.mjs +1 -0
  47. package/dist/{repair-skills--P4hyOt3.mjs → repair-skills-Cx4jzEej.mjs} +2 -2
  48. package/dist/schemas/v0/config.project-local.schema.json +9 -0
  49. package/dist/{server-lock-BpjJj3OD-CGDmzK2V.mjs → server-lock-BpjJj3OD-Cp5gb64m.mjs} +28 -26
  50. package/dist/server-lock-CyhBidkz-C90pwHSO.mjs +1 -0
  51. package/dist/{src-DvKnRm2f.mjs → src-BPvsBgJK.mjs} +2 -2
  52. package/dist/{start-DEFyhc0J.mjs → start-CksMelxp.mjs} +2 -2
  53. package/dist/start-DiJ5ZA1x.mjs +1 -0
  54. package/dist/{write-project-skill-DozAMZpM.mjs → write-project-skill-JQmQecFt.mjs} +2 -2
  55. package/package.json +1 -1
  56. package/dist/constants-CaDA1CnW.mjs +0 -2
  57. package/dist/init-Brz9U_8C.mjs +0 -1
  58. package/dist/loader-p0Oq4pHG.mjs +0 -1
  59. package/dist/preview-DZTHkwzi.mjs +0 -1
  60. package/dist/public/assets/SettingsDialogBody-m4zzZa4Q.js +0 -7
  61. package/dist/public/assets/button-DenIdY-r.js +0 -1
  62. package/dist/repair-skills-BQA-lmTE.mjs +0 -1
  63. package/dist/server-lock-CyhBidkz-CrazWnBM.mjs +0 -1
  64. package/dist/start-B1nVQCdb.mjs +0 -1
@@ -151,7 +151,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
151
151
 
152
152
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=jt,s=!gt.jitless,c=s&&Mt.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?ii([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function si(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=>!qt(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=>Xt(e,r,_t())))}),t)}const ci=D(`$ZodUnion`,(e,t)=>{vr.init(e,t),Tt(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Tt(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Tt(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Tt(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=>St(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=>si(t,i,e,a)):si(s,i,e,a)}}),li=D(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,ci.init(e,t);let n=e._zod.parse;Tt(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=bt(()=>{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(!jt(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)}}),ui=D(`$ZodIntersection`,(e,t)=>{vr.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])=>fi(e,t,n)):fi(e,i,a)}});function di(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Nt(e)&&Nt(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=di(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=di(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 fi(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}),qt(e))return e;let o=di(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const pi=D(`$ZodRecord`,(e,t)=>{vr.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Nt(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(...Jt(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Jt(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`&&Jn.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=>Xt(e,r,_t())),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(...Jt(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Jt(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),mi=D(`$ZodEnum`,(e,t)=>{vr.init(e,t);let n=vt(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ft.has(typeof e)).map(e=>typeof e==`string`?It(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}}),hi=D(`$ZodLiteral`,(e,t)=>{if(vr.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`?It(e):e?It(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}}),gi=D(`$ZodTransform`,(e,t)=>{vr.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ht(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 mt;return n.value=i,n}});function _i(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const vi=D(`$ZodOptional`,(e,t)=>{vr.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Tt(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Tt(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${St(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=>_i(t,e.value)):_i(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),yi=D(`$ZodExactOptional`,(e,t)=>{vi.init(e,t),Tt(e._zod,`values`,()=>t.innerType._zod.values),Tt(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),bi=D(`$ZodNullable`,(e,t)=>{vr.init(e,t),Tt(e._zod,`optin`,()=>t.innerType._zod.optin),Tt(e._zod,`optout`,()=>t.innerType._zod.optout),Tt(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${St(e.source)}|null)$`):void 0}),Tt(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)}),xi=D(`$ZodDefault`,(e,t)=>{vr.init(e,t),e._zod.optin=`optional`,Tt(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=>Si(e,t)):Si(r,t)}});function Si(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ci=D(`$ZodPrefault`,(e,t)=>{vr.init(e,t),e._zod.optin=`optional`,Tt(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))}),wi=D(`$ZodNonOptional`,(e,t)=>{vr.init(e,t),Tt(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=>Ti(t,e)):Ti(i,e)}});function Ti(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Ei=D(`$ZodCatch`,(e,t)=>{vr.init(e,t),Tt(e._zod,`optin`,()=>t.innerType._zod.optin),Tt(e._zod,`optout`,()=>t.innerType._zod.optout),Tt(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=>Xt(e,n,_t()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Xt(e,n,_t()))},input:e.value}),e.issues=[]),e)}}),Di=D(`$ZodPipe`,(e,t)=>{vr.init(e,t),Tt(e._zod,`values`,()=>t.in._zod.values),Tt(e._zod,`optin`,()=>t.in._zod.optin),Tt(e._zod,`optout`,()=>t.out._zod.optout),Tt(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=>Oi(e,t.in,n)):Oi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Oi(e,t.out,n)):Oi(r,t.out,n)}});function Oi(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const ki=D(`$ZodReadonly`,(e,t)=>{vr.init(e,t),Tt(e._zod,`propValues`,()=>t.innerType._zod.propValues),Tt(e._zod,`values`,()=>t.innerType._zod.values),Tt(e._zod,`optin`,()=>t.innerType?._zod?.optin),Tt(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(Ai):Ai(r)}});function Ai(e){return e.value=Object.freeze(e.value),e}const ji=D(`$ZodCustom`,(e,t)=>{$n.init(e,t),vr.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=>Mi(t,n,r,e));Mi(i,n,r,e)}});function Mi(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(Qt(e))}}var Ni,Pi=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 Fi(){return new Pi}(Ni=globalThis).__zod_globalRegistry??(Ni.__zod_globalRegistry=Fi());const Ii=globalThis.__zod_globalRegistry;function Li(e,t){return new e({type:`string`,...O(t)})}function Ri(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...O(t)})}function zi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...O(t)})}function Bi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...O(t)})}function Vi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...O(t)})}function Hi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...O(t)})}function Ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...O(t)})}function Wi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...O(t)})}function Gi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...O(t)})}function Ki(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...O(t)})}function qi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...O(t)})}function Ji(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...O(t)})}function Yi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...O(t)})}function Xi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...O(t)})}function Zi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...O(t)})}function Qi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...O(t)})}function $i(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...O(t)})}function ea(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...O(t)})}function ta(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...O(t)})}function na(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...O(t)})}function ra(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...O(t)})}function ia(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...O(t)})}function aa(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...O(t)})}function oa(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...O(t)})}function sa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...O(t)})}function ca(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...O(t)})}function la(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...O(t)})}function ua(e,t){return new e({type:`number`,checks:[],...O(t)})}function da(e,t){return new e({type:`number`,coerce:!0,checks:[],...O(t)})}function fa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...O(t)})}function pa(e,t){return new e({type:`boolean`,...O(t)})}function ma(e,t){return new e({type:`null`,...O(t)})}function ha(e){return new e({type:`any`})}function ga(e){return new e({type:`unknown`})}function _a(e,t){return new e({type:`never`,...O(t)})}function va(e,t){return new tr({check:`less_than`,...O(t),value:e,inclusive:!1})}function ya(e,t){return new tr({check:`less_than`,...O(t),value:e,inclusive:!0})}function ba(e,t){return new nr({check:`greater_than`,...O(t),value:e,inclusive:!1})}function xa(e,t){return new nr({check:`greater_than`,...O(t),value:e,inclusive:!0})}function Sa(e,t){return new rr({check:`multiple_of`,...O(t),value:e})}function Ca(e,t){return new ar({check:`max_length`,...O(t),maximum:e})}function wa(e,t){return new or({check:`min_length`,...O(t),minimum:e})}function Ta(e,t){return new sr({check:`length_equals`,...O(t),length:e})}function Ea(e,t){return new lr({check:`string_format`,format:`regex`,...O(t),pattern:e})}function Da(e){return new ur({check:`string_format`,format:`lowercase`,...O(e)})}function Oa(e){return new dr({check:`string_format`,format:`uppercase`,...O(e)})}function ka(e,t){return new fr({check:`string_format`,format:`includes`,...O(t),includes:e})}function Aa(e,t){return new pr({check:`string_format`,format:`starts_with`,...O(t),prefix:e})}function ja(e,t){return new mr({check:`string_format`,format:`ends_with`,...O(t),suffix:e})}function Ma(e){return new hr({check:`overwrite`,tx:e})}function Na(e){return Ma(t=>t.normalize(e))}function Pa(){return Ma(e=>e.trim())}function Fa(){return Ma(e=>e.toLowerCase())}function Ia(){return Ma(e=>e.toUpperCase())}function La(){return Ma(e=>kt(e))}function Ra(e,t,n){return new e({type:`array`,element:t,...O(n)})}function za(e,t,n){let r=O(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Ba(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...O(n)})}function Va(e){let t=Ha(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Qt(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(Qt(r))}},e(n.value,n)));return t}function Ha(e,t){let n=new $n({check:`custom`,...O(t)});return n._zod.check=e,n}function Ua(e){let t=new $n({check:`describe`});return t._zod.onattach=[t=>{let n=Ii.get(t)??{};Ii.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function Wa(e){let t=new $n({check:`meta`});return t._zod.onattach=[t=>{let n=Ii.get(t)??{};Ii.add(t,{...n,...e})}],t._zod.check=()=>{},t}function Ga(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??Ii,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 Ka(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,Ka(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`&&Ya(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 qa(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>
153
153
 
154
- 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 Ja(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:Za(t,`input`,e.processors),output:Za(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ya(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 Ya(r.element,n);if(r.type===`set`)return Ya(r.valueType,n);if(r.type===`lazy`)return Ya(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 Ya(r.innerType,n);if(r.type===`intersection`)return Ya(r.left,n)||Ya(r.right,n);if(r.type===`record`||r.type===`map`)return Ya(r.keyType,n)||Ya(r.valueType,n);if(r.type===`pipe`)return Ya(r.in,n)||Ya(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ya(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ya(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ya(e,n))return!0;return!!(r.rest&&Ya(r.rest,n))}return!1}const Xa=(e,t={})=>n=>{let r=Ga({...n,processors:t});return Ka(e,r),qa(r,e),Ja(r,e)},Za=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ga({...i??{},target:a,io:t,processors:n});return Ka(e,o),qa(o,e),Ja(o,e)},Qa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},$a=(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=Qa[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}))])}},eo=(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)},to=(e,t,n,r)=>{n.type=`boolean`},no=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},ro=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},io=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ao=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},oo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},so=(e,t,n,r)=>{n.not={}},co=(e,t,n,r)=>{},lo=(e,t,n,r)=>{},uo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},fo=(e,t,n,r)=>{let i=e._zod.def,a=vt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},po=(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},mo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},ho=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},go=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},_o=(e,t,n,r)=>{n.type=`boolean`},vo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},yo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},bo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},xo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},So=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Co=(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=Ka(a.element,t,{...r,path:[...r.path,`items`]})},wo=(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]=Ka(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=Ka(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},To=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ka(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Eo=(e,t,n,r)=>{let i=e._zod.def,a=Ka(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ka(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]]},Do=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ka(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ka(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Oo=(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=Ka(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=Ka(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ka(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)}},ko=(e,t,n,r)=>{let i=e._zod.def,a=Ka(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`}]},Ao=(e,t,n,r)=>{let i=e._zod.def;Ka(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},jo=(e,t,n,r)=>{let i=e._zod.def;Ka(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Mo=(e,t,n,r)=>{let i=e._zod.def;Ka(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)))},No=(e,t,n,r)=>{let i=e._zod.def;Ka(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},Po=(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;Ka(a,t,r);let o=t.seen.get(e);o.ref=a},Fo=(e,t,n,r)=>{let i=e._zod.def;Ka(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Io=(e,t,n,r)=>{let i=e._zod.def;Ka(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Lo=(e,t,n,r)=>{let i=e._zod.def;Ka(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ro={string:$a,number:eo,boolean:to,bigint:no,symbol:ro,null:io,undefined:ao,void:oo,never:so,any:co,unknown:lo,date:uo,enum:fo,literal:po,nan:mo,template_literal:ho,file:go,success:_o,custom:vo,function:yo,transform:bo,map:xo,set:So,array:Co,object:wo,union:To,intersection:Eo,tuple:Do,record:Oo,nullable:ko,nonoptional:Ao,default:jo,prefault:Mo,catch:No,pipe:Po,readonly:Fo,promise:Io,optional:Lo,lazy:(e,t,n,r)=>{let i=e._zod.innerType;Ka(i,t,r);let a=t.seen.get(e);a.ref=i}};function zo(e,t){if(`_idmap`in e){let n=e,r=Ga({...t,processors:Ro}),i={};for(let e of n._idmap.entries()){let[t,n]=e;Ka(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;qa(r,n),a[t]=Ja(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ga({...t,processors:Ro});return Ka(e,n),qa(n,e),Ja(n,e)}const Bo=D(`ZodISODateTime`,(e,t)=>{Mr.init(e,t),fs.init(e,t)});function Vo(e){return oa(Bo,e)}const Ho=D(`ZodISODate`,(e,t)=>{Nr.init(e,t),fs.init(e,t)});function Uo(e){return sa(Ho,e)}const Wo=D(`ZodISOTime`,(e,t)=>{Pr.init(e,t),fs.init(e,t)});function Go(e){return ca(Wo,e)}const Ko=D(`ZodISODuration`,(e,t)=>{Fr.init(e,t),fs.init(e,t)});function qo(e){return la(Ko,e)}const Jo=(e,t)=>{en.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>rn(e,t)},flatten:{value:t=>nn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,yt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,yt,2)}},isEmpty:{get(){return e.issues.length===0}}})};D(`ZodError`,Jo);const Yo=D(`ZodError`,Jo,{Parent:Error}),Xo=sn(Yo),Zo=ln(Yo),Qo=dn(Yo),$o=pn(Yo),es=hn(Yo),ts=gn(Yo),ns=_n(Yo),rs=vn(Yo),is=yn(Yo),as=bn(Yo),ss=xn(Yo),cs=Sn(Yo),ls=D(`ZodType`,(e,t)=>(vr.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Za(e,`input`),output:Za(e,`output`)}}),e.toJSONSchema=Xa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(Dt(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)=>Lt(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Xo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Qo(e,t,n),e.parseAsync=async(t,n)=>Zo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>$o(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>es(e,t,n),e.decode=(t,n)=>ts(e,t,n),e.encodeAsync=async(t,n)=>ns(e,t,n),e.decodeAsync=async(t,n)=>rs(e,t,n),e.safeEncode=(t,n)=>is(e,t,n),e.safeDecode=(t,n)=>as(e,t,n),e.safeEncodeAsync=async(t,n)=>ss(e,t,n),e.safeDecodeAsync=async(t,n)=>cs(e,t,n),e.refine=(t,n)=>e.check(Ec(t,n)),e.superRefine=t=>e.check(Dc(t)),e.overwrite=t=>e.check(Ma(t)),e.optional=()=>sc(e),e.exactOptional=()=>lc(e),e.nullable=()=>dc(e),e.nullish=()=>sc(dc(e)),e.nonoptional=t=>_c(e,t),e.array=()=>M(e),e.or=t=>Ys([e,t]),e.and=t=>$s(e,t),e.transform=t=>xc(e,ac(t)),e.default=t=>pc(e,t),e.prefault=t=>hc(e,t),e.catch=t=>yc(e,t),e.pipe=t=>xc(e,t),e.readonly=()=>Cc(e),e.describe=t=>{let n=e.clone();return Ii.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Ii.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Ii.get(e);let n=e.clone();return Ii.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),us=D(`_ZodString`,(e,t)=>{yr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(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(Ea(...t)),e.includes=(...t)=>e.check(ka(...t)),e.startsWith=(...t)=>e.check(Aa(...t)),e.endsWith=(...t)=>e.check(ja(...t)),e.min=(...t)=>e.check(wa(...t)),e.max=(...t)=>e.check(Ca(...t)),e.length=(...t)=>e.check(Ta(...t)),e.nonempty=(...t)=>e.check(wa(1,...t)),e.lowercase=t=>e.check(Da(t)),e.uppercase=t=>e.check(Oa(t)),e.trim=()=>e.check(Pa()),e.normalize=(...t)=>e.check(Na(...t)),e.toLowerCase=()=>e.check(Fa()),e.toUpperCase=()=>e.check(Ia()),e.slugify=()=>e.check(La())}),ds=D(`ZodString`,(e,t)=>{yr.init(e,t),us.init(e,t),e.email=t=>e.check(Ri(ps,t)),e.url=t=>e.check(Wi(gs,t)),e.jwt=t=>e.check(aa(Ms,t)),e.emoji=t=>e.check(Gi(vs,t)),e.guid=t=>e.check(zi(ms,t)),e.uuid=t=>e.check(Bi(hs,t)),e.uuidv4=t=>e.check(Vi(hs,t)),e.uuidv6=t=>e.check(Hi(hs,t)),e.uuidv7=t=>e.check(Ui(hs,t)),e.nanoid=t=>e.check(Ki(ys,t)),e.guid=t=>e.check(zi(ms,t)),e.cuid=t=>e.check(qi(bs,t)),e.cuid2=t=>e.check(Ji(xs,t)),e.ulid=t=>e.check(Yi(Ss,t)),e.base64=t=>e.check(na(ks,t)),e.base64url=t=>e.check(ra(As,t)),e.xid=t=>e.check(Xi(Cs,t)),e.ksuid=t=>e.check(Zi(ws,t)),e.ipv4=t=>e.check(Qi(Ts,t)),e.ipv6=t=>e.check($i(Es,t)),e.cidrv4=t=>e.check(ea(Ds,t)),e.cidrv6=t=>e.check(ta(Os,t)),e.e164=t=>e.check(ia(js,t)),e.datetime=t=>e.check(Vo(t)),e.date=t=>e.check(Uo(t)),e.time=t=>e.check(Go(t)),e.duration=t=>e.check(qo(t))});function k(e){return Li(ds,e)}const fs=D(`ZodStringFormat`,(e,t)=>{br.init(e,t),us.init(e,t)}),ps=D(`ZodEmail`,(e,t)=>{Cr.init(e,t),fs.init(e,t)}),ms=D(`ZodGUID`,(e,t)=>{xr.init(e,t),fs.init(e,t)}),hs=D(`ZodUUID`,(e,t)=>{Sr.init(e,t),fs.init(e,t)}),gs=D(`ZodURL`,(e,t)=>{wr.init(e,t),fs.init(e,t)});function _s(e){return Wi(gs,e)}const vs=D(`ZodEmoji`,(e,t)=>{Tr.init(e,t),fs.init(e,t)}),ys=D(`ZodNanoID`,(e,t)=>{Er.init(e,t),fs.init(e,t)}),bs=D(`ZodCUID`,(e,t)=>{Dr.init(e,t),fs.init(e,t)}),xs=D(`ZodCUID2`,(e,t)=>{Or.init(e,t),fs.init(e,t)}),Ss=D(`ZodULID`,(e,t)=>{kr.init(e,t),fs.init(e,t)}),Cs=D(`ZodXID`,(e,t)=>{Ar.init(e,t),fs.init(e,t)}),ws=D(`ZodKSUID`,(e,t)=>{jr.init(e,t),fs.init(e,t)}),Ts=D(`ZodIPv4`,(e,t)=>{Ir.init(e,t),fs.init(e,t)}),Es=D(`ZodIPv6`,(e,t)=>{Lr.init(e,t),fs.init(e,t)}),Ds=D(`ZodCIDRv4`,(e,t)=>{Rr.init(e,t),fs.init(e,t)}),Os=D(`ZodCIDRv6`,(e,t)=>{zr.init(e,t),fs.init(e,t)}),ks=D(`ZodBase64`,(e,t)=>{Vr.init(e,t),fs.init(e,t)}),As=D(`ZodBase64URL`,(e,t)=>{Ur.init(e,t),fs.init(e,t)}),js=D(`ZodE164`,(e,t)=>{Wr.init(e,t),fs.init(e,t)}),Ms=D(`ZodJWT`,(e,t)=>{Kr.init(e,t),fs.init(e,t)}),Ns=D(`ZodNumber`,(e,t)=>{qr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),e.gt=(t,n)=>e.check(ba(t,n)),e.gte=(t,n)=>e.check(xa(t,n)),e.min=(t,n)=>e.check(xa(t,n)),e.lt=(t,n)=>e.check(va(t,n)),e.lte=(t,n)=>e.check(ya(t,n)),e.max=(t,n)=>e.check(ya(t,n)),e.int=t=>e.check(Fs(t)),e.safe=t=>e.check(Fs(t)),e.positive=t=>e.check(ba(0,t)),e.nonnegative=t=>e.check(xa(0,t)),e.negative=t=>e.check(va(0,t)),e.nonpositive=t=>e.check(ya(0,t)),e.multipleOf=(t,n)=>e.check(Sa(t,n)),e.step=(t,n)=>e.check(Sa(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 ua(Ns,e)}const Ps=D(`ZodNumberFormat`,(e,t)=>{Jr.init(e,t),Ns.init(e,t)});function Fs(e){return fa(Ps,e)}const Is=D(`ZodBoolean`,(e,t)=>{Yr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r)});function j(e){return pa(Is,e)}const Ls=D(`ZodNull`,(e,t)=>{Xr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r)});function Rs(e){return ma(Ls,e)}const zs=D(`ZodAny`,(e,t)=>{Zr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Bs(){return ha(zs)}const Vs=D(`ZodUnknown`,(e,t)=>{Qr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Hs(){return ga(Vs)}const Us=D(`ZodNever`,(e,t)=>{$r.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r)});function Ws(e){return _a(Us,e)}const Gs=D(`ZodArray`,(e,t)=>{ti.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(wa(t,n)),e.nonempty=t=>e.check(wa(1,t)),e.max=(t,n)=>e.check(Ca(t,n)),e.length=(t,n)=>e.check(Ta(t,n)),e.unwrap=()=>e.element});function M(e,t){return Ra(Gs,e,t)}const Ks=D(`ZodObject`,(e,t)=>{oi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),Tt(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:Hs()}),e.loose=()=>e.clone({...e._zod.def,catchall:Hs()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ws()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Ht(e,t),e.safeExtend=t=>Ut(e,t),e.merge=t=>Wt(e,t),e.pick=t=>Bt(e,t),e.omit=t=>Vt(e,t),e.partial=(...t)=>Gt(oc,e,t[0]),e.required=(...t)=>Kt(gc,e,t[0])});function N(e,t){return new Ks({type:`object`,shape:e??{},...O(t)})}function qs(e,t){return new Ks({type:`object`,shape:e,catchall:Hs(),...O(t)})}const Js=D(`ZodUnion`,(e,t)=>{ci.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.options=t.options});function Ys(e,t){return new Js({type:`union`,options:e,...O(t)})}const Xs=D(`ZodDiscriminatedUnion`,(e,t)=>{Js.init(e,t),li.init(e,t)});function Zs(e,t,n){return new Xs({type:`union`,options:t,discriminator:e,...O(n)})}const Qs=D(`ZodIntersection`,(e,t)=>{ui.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function $s(e,t){return new Qs({type:`intersection`,left:e,right:t})}const ec=D(`ZodRecord`,(e,t)=>{pi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function tc(e,t,n){return new ec({type:`record`,keyType:e,valueType:t,...O(n)})}const nc=D(`ZodEnum`,(e,t)=>{mi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(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 nc({...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 nc({...t,checks:[],...O(r),entries:i})}});function P(e,t){return new nc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...O(t)})}const rc=D(`ZodLiteral`,(e,t)=>{hi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(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 rc({type:`literal`,values:Array.isArray(e)?e:[e],...O(t)})}const ic=D(`ZodTransform`,(e,t)=>{gi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ht(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Qt(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(Qt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ac(e){return new ic({type:`transform`,transform:e})}const oc=D(`ZodOptional`,(e,t)=>{vi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sc(e){return new oc({type:`optional`,innerType:e})}const cc=D(`ZodExactOptional`,(e,t)=>{yi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lc(e){return new cc({type:`optional`,innerType:e})}const uc=D(`ZodNullable`,(e,t)=>{bi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new uc({type:`nullable`,innerType:e})}const fc=D(`ZodDefault`,(e,t)=>{xi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pc(e,t){return new fc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pt(t)}})}const mc=D(`ZodPrefault`,(e,t)=>{Ci.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e,t){return new mc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pt(t)}})}const gc=D(`ZodNonOptional`,(e,t)=>{wi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _c(e,t){return new gc({type:`nonoptional`,innerType:e,...O(t)})}const vc=D(`ZodCatch`,(e,t)=>{Ei.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yc(e,t){return new vc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const bc=D(`ZodPipe`,(e,t)=>{Di.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.in=t.in,e.out=t.out});function xc(e,t){return new bc({type:`pipe`,in:e,out:t})}const Sc=D(`ZodReadonly`,(e,t)=>{ki.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cc(e){return new Sc({type:`readonly`,innerType:e})}const wc=D(`ZodCustom`,(e,t)=>{ji.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r)});function Tc(e,t){return za(wc,e??(()=>!0),t)}function Ec(e,t={}){return Ba(wc,e,t)}function Dc(e){return Va(e)}function Oc(e,t){return xc(ac(e),t)}var kc=ft();a();const Ac=Symbol.for(`@inkeep/open-knowledge/field-registry`),jc=globalThis;jc[Ac]===void 0&&(jc[Ac]=Fi());const Mc=jc[Ac];function Nc(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=Pc(t)?Mc.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function Pc(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}const Fc=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Ic=52428800,Lc=26214400,Rc=`https://api.openai.com/v1`,zc=`text-embedding-3-small`,Bc=qs({content:qs({dir:k().register(Mc,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder Open Knowledge 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(`.`)}).default({dir:`.`}),appearance:qs({theme:P([`light`,`dark`,`system`]).register(Mc,{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:qs({autoOpen:j().register(Mc,{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:qs({showHiddenFiles:j().register(Mc,{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),showAllFiles:j().register(Mc,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show every file, including those excluded by .gitignore / .okignore. Per-machine (project-local) — not shared.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:qs({wordWrap:j().register(Mc,{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}),autoSync:qs({enabled:j().register(Mc,{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({enabled:null}),telemetry:qs({localSink:qs({enabled:j().register(Mc,{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:qs({maxBytes:A().register(Mc,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Ic)}).default({maxBytes:Ic}),logs:qs({maxBytes:A().register(Mc,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Lc)}).default({maxBytes:Lc}),attributeDenylist:M(k()).register(Mc,{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([...Fc])}).default({enabled:!0,spans:{maxBytes:Ic},logs:{maxBytes:Lc},attributeDenylist:[...Fc]})}).default({localSink:{enabled:!0,spans:{maxBytes:Ic},logs:{maxBytes:Lc},attributeDenylist:[...Fc]}}),search:qs({semantic:qs({enabled:j().register(Mc,{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(Mc,{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(Rc),model:k().register(Mc,{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(zc),dimensions:A().int().positive().register(Mc,{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()}).default({enabled:!1,baseUrl:Rc,model:zc})}).default({semantic:{enabled:!1,baseUrl:Rc,model:zc}})}),Vc=`open-knowledge-config`;async function Hc(e,t,n){let r=o.getTracer(Vc),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,async e=>{try{return await n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Uc(e,t,n){let r=o.getTracer(Vc),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Wc(e,t){let n=o.getActiveSpan();n&&n.addEvent(e,t)}function Gc(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 Kc(e,t){let n=e;for(let e of t){n=Gc(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function qc(e,t){let n=Kc(e,t);if(n!==void 0)return Nc(n)}function Jc(e,t){return e===`either`?!0:e===t}function Yc(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=qc(Bc,i);a?.scope!==void 0&&(Jc(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 Xc(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&((0,kc.isCollection)(e.getIn(r,!0))||e.deleteIn(r))}}function Zc(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)){Xc(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}Xc(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Qc(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}const $c=N({file:k(),line:A().int().min(1),column:A().int().min(1),snippet:k().optional()}),el=N({path:M(Ys([k(),A()])),message:k(),issueCode:k(),params:tc(k(),Hs()).optional(),source:$c.optional()}),tl=P([`user`,`project`,`project-local`,`either`]),nl=P([`user`,`project`,`project-local`]),rl=Zs(`code`,[N({code:F(`YAML_PARSE`),detail:k()}),N({code:F(`SCHEMA_INVALID`),issues:M(el)}),N({code:F(`SCOPE_VIOLATION`),path:M(k()),expectedScope:tl,actualScope:nl}),N({code:F(`NOT_AGENT_SETTABLE`),path:M(k())}),N({code:F(`MIXED_SCOPE`),paths:M(N({path:M(k()),scope:nl}))}),N({code:F(`REMOVED_KEY`),path:M(k()),redirect:k(),source:$c.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()})]),il=new Set(rl.options.map(e=>e.shape.code.value)),al=Ys([rl,qs({code:k(),message:k().optional()})]);function ol(e){return il.has(e.code)}function sl(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 cl(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 ll(e){if(!ol(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(`
154
+ 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 Ja(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:Za(t,`input`,e.processors),output:Za(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ya(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 Ya(r.element,n);if(r.type===`set`)return Ya(r.valueType,n);if(r.type===`lazy`)return Ya(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 Ya(r.innerType,n);if(r.type===`intersection`)return Ya(r.left,n)||Ya(r.right,n);if(r.type===`record`||r.type===`map`)return Ya(r.keyType,n)||Ya(r.valueType,n);if(r.type===`pipe`)return Ya(r.in,n)||Ya(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ya(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ya(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ya(e,n))return!0;return!!(r.rest&&Ya(r.rest,n))}return!1}const Xa=(e,t={})=>n=>{let r=Ga({...n,processors:t});return Ka(e,r),qa(r,e),Ja(r,e)},Za=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ga({...i??{},target:a,io:t,processors:n});return Ka(e,o),qa(o,e),Ja(o,e)},Qa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},$a=(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=Qa[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}))])}},eo=(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)},to=(e,t,n,r)=>{n.type=`boolean`},no=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},ro=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},io=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ao=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},oo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},so=(e,t,n,r)=>{n.not={}},co=(e,t,n,r)=>{},lo=(e,t,n,r)=>{},uo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},fo=(e,t,n,r)=>{let i=e._zod.def,a=vt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},po=(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},mo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},ho=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},go=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},_o=(e,t,n,r)=>{n.type=`boolean`},vo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},yo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},bo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},xo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},So=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Co=(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=Ka(a.element,t,{...r,path:[...r.path,`items`]})},wo=(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]=Ka(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=Ka(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},To=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ka(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Eo=(e,t,n,r)=>{let i=e._zod.def,a=Ka(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ka(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]]},Do=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ka(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ka(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Oo=(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=Ka(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=Ka(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ka(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)}},ko=(e,t,n,r)=>{let i=e._zod.def,a=Ka(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`}]},Ao=(e,t,n,r)=>{let i=e._zod.def;Ka(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},jo=(e,t,n,r)=>{let i=e._zod.def;Ka(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Mo=(e,t,n,r)=>{let i=e._zod.def;Ka(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)))},No=(e,t,n,r)=>{let i=e._zod.def;Ka(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},Po=(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;Ka(a,t,r);let o=t.seen.get(e);o.ref=a},Fo=(e,t,n,r)=>{let i=e._zod.def;Ka(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Io=(e,t,n,r)=>{let i=e._zod.def;Ka(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Lo=(e,t,n,r)=>{let i=e._zod.def;Ka(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ro={string:$a,number:eo,boolean:to,bigint:no,symbol:ro,null:io,undefined:ao,void:oo,never:so,any:co,unknown:lo,date:uo,enum:fo,literal:po,nan:mo,template_literal:ho,file:go,success:_o,custom:vo,function:yo,transform:bo,map:xo,set:So,array:Co,object:wo,union:To,intersection:Eo,tuple:Do,record:Oo,nullable:ko,nonoptional:Ao,default:jo,prefault:Mo,catch:No,pipe:Po,readonly:Fo,promise:Io,optional:Lo,lazy:(e,t,n,r)=>{let i=e._zod.innerType;Ka(i,t,r);let a=t.seen.get(e);a.ref=i}};function zo(e,t){if(`_idmap`in e){let n=e,r=Ga({...t,processors:Ro}),i={};for(let e of n._idmap.entries()){let[t,n]=e;Ka(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;qa(r,n),a[t]=Ja(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ga({...t,processors:Ro});return Ka(e,n),qa(n,e),Ja(n,e)}const Bo=D(`ZodISODateTime`,(e,t)=>{Mr.init(e,t),fs.init(e,t)});function Vo(e){return oa(Bo,e)}const Ho=D(`ZodISODate`,(e,t)=>{Nr.init(e,t),fs.init(e,t)});function Uo(e){return sa(Ho,e)}const Wo=D(`ZodISOTime`,(e,t)=>{Pr.init(e,t),fs.init(e,t)});function Go(e){return ca(Wo,e)}const Ko=D(`ZodISODuration`,(e,t)=>{Fr.init(e,t),fs.init(e,t)});function qo(e){return la(Ko,e)}const Jo=(e,t)=>{en.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>rn(e,t)},flatten:{value:t=>nn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,yt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,yt,2)}},isEmpty:{get(){return e.issues.length===0}}})};D(`ZodError`,Jo);const Yo=D(`ZodError`,Jo,{Parent:Error}),Xo=sn(Yo),Zo=ln(Yo),Qo=dn(Yo),$o=pn(Yo),es=hn(Yo),ts=gn(Yo),ns=_n(Yo),rs=vn(Yo),is=yn(Yo),as=bn(Yo),ss=xn(Yo),cs=Sn(Yo),ls=D(`ZodType`,(e,t)=>(vr.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Za(e,`input`),output:Za(e,`output`)}}),e.toJSONSchema=Xa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(Dt(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)=>Lt(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Xo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Qo(e,t,n),e.parseAsync=async(t,n)=>Zo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>$o(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>es(e,t,n),e.decode=(t,n)=>ts(e,t,n),e.encodeAsync=async(t,n)=>ns(e,t,n),e.decodeAsync=async(t,n)=>rs(e,t,n),e.safeEncode=(t,n)=>is(e,t,n),e.safeDecode=(t,n)=>as(e,t,n),e.safeEncodeAsync=async(t,n)=>ss(e,t,n),e.safeDecodeAsync=async(t,n)=>cs(e,t,n),e.refine=(t,n)=>e.check(Ec(t,n)),e.superRefine=t=>e.check(Dc(t)),e.overwrite=t=>e.check(Ma(t)),e.optional=()=>sc(e),e.exactOptional=()=>lc(e),e.nullable=()=>dc(e),e.nullish=()=>sc(dc(e)),e.nonoptional=t=>_c(e,t),e.array=()=>M(e),e.or=t=>Ys([e,t]),e.and=t=>$s(e,t),e.transform=t=>xc(e,ac(t)),e.default=t=>pc(e,t),e.prefault=t=>hc(e,t),e.catch=t=>yc(e,t),e.pipe=t=>xc(e,t),e.readonly=()=>Cc(e),e.describe=t=>{let n=e.clone();return Ii.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Ii.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Ii.get(e);let n=e.clone();return Ii.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),us=D(`_ZodString`,(e,t)=>{yr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(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(Ea(...t)),e.includes=(...t)=>e.check(ka(...t)),e.startsWith=(...t)=>e.check(Aa(...t)),e.endsWith=(...t)=>e.check(ja(...t)),e.min=(...t)=>e.check(wa(...t)),e.max=(...t)=>e.check(Ca(...t)),e.length=(...t)=>e.check(Ta(...t)),e.nonempty=(...t)=>e.check(wa(1,...t)),e.lowercase=t=>e.check(Da(t)),e.uppercase=t=>e.check(Oa(t)),e.trim=()=>e.check(Pa()),e.normalize=(...t)=>e.check(Na(...t)),e.toLowerCase=()=>e.check(Fa()),e.toUpperCase=()=>e.check(Ia()),e.slugify=()=>e.check(La())}),ds=D(`ZodString`,(e,t)=>{yr.init(e,t),us.init(e,t),e.email=t=>e.check(Ri(ps,t)),e.url=t=>e.check(Wi(gs,t)),e.jwt=t=>e.check(aa(Ms,t)),e.emoji=t=>e.check(Gi(vs,t)),e.guid=t=>e.check(zi(ms,t)),e.uuid=t=>e.check(Bi(hs,t)),e.uuidv4=t=>e.check(Vi(hs,t)),e.uuidv6=t=>e.check(Hi(hs,t)),e.uuidv7=t=>e.check(Ui(hs,t)),e.nanoid=t=>e.check(Ki(ys,t)),e.guid=t=>e.check(zi(ms,t)),e.cuid=t=>e.check(qi(bs,t)),e.cuid2=t=>e.check(Ji(xs,t)),e.ulid=t=>e.check(Yi(Ss,t)),e.base64=t=>e.check(na(ks,t)),e.base64url=t=>e.check(ra(As,t)),e.xid=t=>e.check(Xi(Cs,t)),e.ksuid=t=>e.check(Zi(ws,t)),e.ipv4=t=>e.check(Qi(Ts,t)),e.ipv6=t=>e.check($i(Es,t)),e.cidrv4=t=>e.check(ea(Ds,t)),e.cidrv6=t=>e.check(ta(Os,t)),e.e164=t=>e.check(ia(js,t)),e.datetime=t=>e.check(Vo(t)),e.date=t=>e.check(Uo(t)),e.time=t=>e.check(Go(t)),e.duration=t=>e.check(qo(t))});function k(e){return Li(ds,e)}const fs=D(`ZodStringFormat`,(e,t)=>{br.init(e,t),us.init(e,t)}),ps=D(`ZodEmail`,(e,t)=>{Cr.init(e,t),fs.init(e,t)}),ms=D(`ZodGUID`,(e,t)=>{xr.init(e,t),fs.init(e,t)}),hs=D(`ZodUUID`,(e,t)=>{Sr.init(e,t),fs.init(e,t)}),gs=D(`ZodURL`,(e,t)=>{wr.init(e,t),fs.init(e,t)});function _s(e){return Wi(gs,e)}const vs=D(`ZodEmoji`,(e,t)=>{Tr.init(e,t),fs.init(e,t)}),ys=D(`ZodNanoID`,(e,t)=>{Er.init(e,t),fs.init(e,t)}),bs=D(`ZodCUID`,(e,t)=>{Dr.init(e,t),fs.init(e,t)}),xs=D(`ZodCUID2`,(e,t)=>{Or.init(e,t),fs.init(e,t)}),Ss=D(`ZodULID`,(e,t)=>{kr.init(e,t),fs.init(e,t)}),Cs=D(`ZodXID`,(e,t)=>{Ar.init(e,t),fs.init(e,t)}),ws=D(`ZodKSUID`,(e,t)=>{jr.init(e,t),fs.init(e,t)}),Ts=D(`ZodIPv4`,(e,t)=>{Ir.init(e,t),fs.init(e,t)}),Es=D(`ZodIPv6`,(e,t)=>{Lr.init(e,t),fs.init(e,t)}),Ds=D(`ZodCIDRv4`,(e,t)=>{Rr.init(e,t),fs.init(e,t)}),Os=D(`ZodCIDRv6`,(e,t)=>{zr.init(e,t),fs.init(e,t)}),ks=D(`ZodBase64`,(e,t)=>{Vr.init(e,t),fs.init(e,t)}),As=D(`ZodBase64URL`,(e,t)=>{Ur.init(e,t),fs.init(e,t)}),js=D(`ZodE164`,(e,t)=>{Wr.init(e,t),fs.init(e,t)}),Ms=D(`ZodJWT`,(e,t)=>{Kr.init(e,t),fs.init(e,t)}),Ns=D(`ZodNumber`,(e,t)=>{qr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),e.gt=(t,n)=>e.check(ba(t,n)),e.gte=(t,n)=>e.check(xa(t,n)),e.min=(t,n)=>e.check(xa(t,n)),e.lt=(t,n)=>e.check(va(t,n)),e.lte=(t,n)=>e.check(ya(t,n)),e.max=(t,n)=>e.check(ya(t,n)),e.int=t=>e.check(Fs(t)),e.safe=t=>e.check(Fs(t)),e.positive=t=>e.check(ba(0,t)),e.nonnegative=t=>e.check(xa(0,t)),e.negative=t=>e.check(va(0,t)),e.nonpositive=t=>e.check(ya(0,t)),e.multipleOf=(t,n)=>e.check(Sa(t,n)),e.step=(t,n)=>e.check(Sa(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 ua(Ns,e)}const Ps=D(`ZodNumberFormat`,(e,t)=>{Jr.init(e,t),Ns.init(e,t)});function Fs(e){return fa(Ps,e)}const Is=D(`ZodBoolean`,(e,t)=>{Yr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r)});function j(e){return pa(Is,e)}const Ls=D(`ZodNull`,(e,t)=>{Xr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r)});function Rs(e){return ma(Ls,e)}const zs=D(`ZodAny`,(e,t)=>{Zr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Bs(){return ha(zs)}const Vs=D(`ZodUnknown`,(e,t)=>{Qr.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Hs(){return ga(Vs)}const Us=D(`ZodNever`,(e,t)=>{$r.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r)});function Ws(e){return _a(Us,e)}const Gs=D(`ZodArray`,(e,t)=>{ti.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(wa(t,n)),e.nonempty=t=>e.check(wa(1,t)),e.max=(t,n)=>e.check(Ca(t,n)),e.length=(t,n)=>e.check(Ta(t,n)),e.unwrap=()=>e.element});function M(e,t){return Ra(Gs,e,t)}const Ks=D(`ZodObject`,(e,t)=>{oi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),Tt(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:Hs()}),e.loose=()=>e.clone({...e._zod.def,catchall:Hs()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ws()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Ht(e,t),e.safeExtend=t=>Ut(e,t),e.merge=t=>Wt(e,t),e.pick=t=>Bt(e,t),e.omit=t=>Vt(e,t),e.partial=(...t)=>Gt(oc,e,t[0]),e.required=(...t)=>Kt(gc,e,t[0])});function N(e,t){return new Ks({type:`object`,shape:e??{},...O(t)})}function qs(e,t){return new Ks({type:`object`,shape:e,catchall:Hs(),...O(t)})}const Js=D(`ZodUnion`,(e,t)=>{ci.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.options=t.options});function Ys(e,t){return new Js({type:`union`,options:e,...O(t)})}const Xs=D(`ZodDiscriminatedUnion`,(e,t)=>{Js.init(e,t),li.init(e,t)});function Zs(e,t,n){return new Xs({type:`union`,options:t,discriminator:e,...O(n)})}const Qs=D(`ZodIntersection`,(e,t)=>{ui.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function $s(e,t){return new Qs({type:`intersection`,left:e,right:t})}const ec=D(`ZodRecord`,(e,t)=>{pi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function tc(e,t,n){return new ec({type:`record`,keyType:e,valueType:t,...O(n)})}const nc=D(`ZodEnum`,(e,t)=>{mi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(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 nc({...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 nc({...t,checks:[],...O(r),entries:i})}});function P(e,t){return new nc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...O(t)})}const rc=D(`ZodLiteral`,(e,t)=>{hi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(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 rc({type:`literal`,values:Array.isArray(e)?e:[e],...O(t)})}const ic=D(`ZodTransform`,(e,t)=>{gi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ht(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Qt(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(Qt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ac(e){return new ic({type:`transform`,transform:e})}const oc=D(`ZodOptional`,(e,t)=>{vi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sc(e){return new oc({type:`optional`,innerType:e})}const cc=D(`ZodExactOptional`,(e,t)=>{yi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lc(e){return new cc({type:`optional`,innerType:e})}const uc=D(`ZodNullable`,(e,t)=>{bi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new uc({type:`nullable`,innerType:e})}const fc=D(`ZodDefault`,(e,t)=>{xi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pc(e,t){return new fc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pt(t)}})}const mc=D(`ZodPrefault`,(e,t)=>{Ci.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e,t){return new mc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pt(t)}})}const gc=D(`ZodNonOptional`,(e,t)=>{wi.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _c(e,t){return new gc({type:`nonoptional`,innerType:e,...O(t)})}const vc=D(`ZodCatch`,(e,t)=>{Ei.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yc(e,t){return new vc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const bc=D(`ZodPipe`,(e,t)=>{Di.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.in=t.in,e.out=t.out});function xc(e,t){return new bc({type:`pipe`,in:e,out:t})}const Sc=D(`ZodReadonly`,(e,t)=>{ki.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cc(e){return new Sc({type:`readonly`,innerType:e})}const wc=D(`ZodCustom`,(e,t)=>{ji.init(e,t),ls.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r)});function Tc(e,t){return za(wc,e??(()=>!0),t)}function Ec(e,t={}){return Ba(wc,e,t)}function Dc(e){return Va(e)}function Oc(e,t){return xc(ac(e),t)}var kc=ft();a();const Ac=Symbol.for(`@inkeep/open-knowledge/field-registry`),jc=globalThis;jc[Ac]===void 0&&(jc[Ac]=Fi());const Mc=jc[Ac];function Nc(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=Pc(t)?Mc.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function Pc(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}const Fc=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Ic=52428800,Lc=26214400,Rc=`https://api.openai.com/v1`,zc=`text-embedding-3-small`,Bc=qs({content:qs({dir:k().register(Mc,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder Open Knowledge 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(`.`)}).default({dir:`.`}),appearance:qs({theme:P([`light`,`dark`,`system`]).register(Mc,{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:qs({autoOpen:j().register(Mc,{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:qs({showHiddenFiles:j().register(Mc,{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),showAllFiles:j().register(Mc,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show every file, including those excluded by .gitignore / .okignore. Per-machine (project-local) — not shared.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:qs({wordWrap:j().register(Mc,{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}),autoSync:qs({enabled:j().register(Mc,{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({enabled:null}),telemetry:qs({localSink:qs({enabled:j().register(Mc,{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:qs({maxBytes:A().register(Mc,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Ic)}).default({maxBytes:Ic}),logs:qs({maxBytes:A().register(Mc,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Lc)}).default({maxBytes:Lc}),attributeDenylist:M(k()).register(Mc,{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([...Fc])}).default({enabled:!0,spans:{maxBytes:Ic},logs:{maxBytes:Lc},attributeDenylist:[...Fc]})}).default({localSink:{enabled:!0,spans:{maxBytes:Ic},logs:{maxBytes:Lc},attributeDenylist:[...Fc]}}),search:qs({semantic:qs({enabled:j().register(Mc,{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(Mc,{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(Rc),model:k().register(Mc,{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(zc),dimensions:A().int().positive().register(Mc,{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(Mc,{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:Rc,model:zc})}).default({semantic:{enabled:!1,baseUrl:Rc,model:zc}})}),Vc=`open-knowledge-config`;async function Hc(e,t,n){let r=o.getTracer(Vc),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,async e=>{try{return await n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Uc(e,t,n){let r=o.getTracer(Vc),a=t?{attributes:t}:{};return r.startActiveSpan(e,a,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Wc(e,t){let n=o.getActiveSpan();n&&n.addEvent(e,t)}function Gc(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 Kc(e,t){let n=e;for(let e of t){n=Gc(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function qc(e,t){let n=Kc(e,t);if(n!==void 0)return Nc(n)}function Jc(e,t){return e===`either`?!0:e===t}function Yc(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=qc(Bc,i);a?.scope!==void 0&&(Jc(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 Xc(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&((0,kc.isCollection)(e.getIn(r,!0))||e.deleteIn(r))}}function Zc(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)){Xc(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}Xc(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Qc(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}const $c=N({file:k(),line:A().int().min(1),column:A().int().min(1),snippet:k().optional()}),el=N({path:M(Ys([k(),A()])),message:k(),issueCode:k(),params:tc(k(),Hs()).optional(),source:$c.optional()}),tl=P([`user`,`project`,`project-local`,`either`]),nl=P([`user`,`project`,`project-local`]),rl=Zs(`code`,[N({code:F(`YAML_PARSE`),detail:k()}),N({code:F(`SCHEMA_INVALID`),issues:M(el)}),N({code:F(`SCOPE_VIOLATION`),path:M(k()),expectedScope:tl,actualScope:nl}),N({code:F(`NOT_AGENT_SETTABLE`),path:M(k())}),N({code:F(`MIXED_SCOPE`),paths:M(N({path:M(k()),scope:nl}))}),N({code:F(`REMOVED_KEY`),path:M(k()),redirect:k(),source:$c.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()})]),il=new Set(rl.options.map(e=>e.shape.code.value)),al=Ys([rl,qs({code:k(),message:k().optional()})]);function ol(e){return il.has(e.code)}function sl(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 cl(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 ll(e){if(!ol(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(`
155
155
  `))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
156
156
  `)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${sl(e.expectedScope)} — ${cl(e.expectedScope)}),`,`but it was set in the ${e.actualScope} config (${sl(e.actualScope)}).`,`Move it to ${sl(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(`.`)} → ${sl(t)} (${t})`).join(`
157
157
  `)].join(`
@@ -311,19 +311,21 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
311
311
  `),r=t.conflict.b.join(`
312
312
  `);i.push(sG(e,n,r))}}return i.join(`
313
313
  `)}function nG(e){return e.map(e=>({len:e.length,digest:XW(e)}))}var rG=class extends Error{info;constructor(e){let t=e.lostSubstrings.map(e=>JSON.stringify(e.length>80?`${e.slice(0,77)}...`:e)).join(`, `);super(`Bridge merge content loss (which=${e.which}, side=${e.side}): ${t}`),this.name=`BridgeMergeContentLossError`,this.info=e}toLog(e){let t=e?.verbose===!0;return{event:`bridge-merge-content-loss`,which:this.info.which,side:this.info.side,baselineLen:this.info.baseline.length,userTextLen:this.info.userText.length,agentTextLen:this.info.agentText.length,resultLen:this.info.result.length,lostSubstrings:t?this.info.lostSubstrings:nG(this.info.lostSubstrings),redacted:!t}}};function iG(e,t){if(e===t)return[];let n=$W.diff_main(e,t);$W.diff_cleanupSemantic(n);let r=[];for(let[e,t]of n)if(e===1)for(let e of t.split(`
314
- `)){let t=e.trim();t.length!==0&&r.push(t)}return r}function aG(e,t){let n=0;for(let r of t){let t=e.indexOf(r,n);if(t<0){if(e.indexOf(r)<0)continue;return r}n=t+r.length}return null}function oG(e,t,n,r){let i=iG(e,t),a=iG(e,n),o=i.filter(e=>!r.includes(e));if(o.length>0)throw new rG({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:o,which:`substring`,side:`user`});let s=a.filter(e=>!r.includes(e));if(s.length>0)throw new rG({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:s,which:`substring`,side:`agent`});let c=aG(r,i);if(c!==null)throw new rG({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:[c],which:`order`,side:`user`});let l=aG(r,a);if(l!==null)throw new rG({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:[l],which:`order`,side:`agent`})}function sG(e,t,n){if(t===``)return n;if(n===``)return t;let r=$W.patch_make(e,t),[i,a]=$W.patch_apply(r,n);return a.some(e=>!e)&&console.warn(JSON.stringify({event:`bridge-merge-patch-drop`,applied:a.filter(Boolean).length,total:a.length,regionSize:n.length})),i}const cG=/\\([!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~])/g,lG=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/,uG=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/,dG=/\*\*\s*(`[^`]+`)\s*\*\*/g;function fG(e){return e.replace(/^/,``).replace(/\r/g,``).replace(cG,`$1`).replace(dG,`$1`).replace(/^\n+/,``).replace(/^[*-]{3,}(?=\n|$)/,`---`).replace(/(\n)([#>+-]|\d+[.)]|`{3,}|~{3,})/g,`
314
+ `)){let t=e.trim();t.length!==0&&r.push(t)}return r}function aG(e,t){let n=0;for(let r of t){let t=e.indexOf(r,n);if(t<0){if(e.indexOf(r)<0)continue;return r}n=t+r.length}return null}function oG(e,t,n,r){let i=iG(e,t),a=iG(e,n),o=i.filter(e=>!r.includes(e));if(o.length>0)throw new rG({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:o,which:`substring`,side:`user`});let s=a.filter(e=>!r.includes(e));if(s.length>0)throw new rG({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:s,which:`substring`,side:`agent`});let c=aG(r,i);if(c!==null)throw new rG({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:[c],which:`order`,side:`user`});let l=aG(r,a);if(l!==null)throw new rG({baseline:e,userText:t,agentText:n,result:r,lostSubstrings:[l],which:`order`,side:`agent`})}function sG(e,t,n){if(t===``)return n;if(n===``)return t;let r=$W.patch_make(e,t),[i,a]=$W.patch_apply(r,n);return a.some(e=>!e)&&console.warn(JSON.stringify({event:`bridge-merge-patch-drop`,applied:a.filter(Boolean).length,total:a.length,regionSize:n.length})),i}const cG=/\\([!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~])/g,lG=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/,uG=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/,dG=/^\d+([.)])(?=\s)/,fG=/\*\*\s*(`[^`]+`)\s*\*\*/g;function pG(e){return e.replace(/^/,``).replace(/\r/g,``).replace(cG,`$1`).replace(fG,`$1`).replace(/^\n+/,``).replace(/^[*-]{3,}(?=\n|$)/,`---`).replace(/(\n)([#>+-]|\d+[.)]|`{3,}|~{3,})/g,`
315
315
 
316
316
  $2`).replace(/^([#>+-].*|\d+[.)].*|`{3,}.*|~{3,}.*)\n([^\n])/gm,`$1
317
317
 
318
318
  $2`).split(`
319
- `).map(e=>{let t=e.trimEnd();return lG.test(t)?t.replace(/\s+/g,``):uG.test(t)?t.replace(/^[ \t]+/,``):t}).join(`
319
+ `).map(e=>{let t=e.trimEnd();return lG.test(t)?t.replace(/\s+/g,``):(uG.test(t)?t.replace(/^[ \t]+/,``):t).replace(dG,`1$1`)}).join(`
320
320
  `).replace(/\n{3,}/g,`
321
321
 
322
- `).replace(/\n+$/,``)}function pG(e,t){let n=[];(e.charCodeAt(0)===65279||t.charCodeAt(0)===65279)&&n.push(`bom`),(e.includes(`\r`)||t.includes(`\r`))&&n.push(`crlf`),(/\\[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/.test(e)||/\\[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/.test(t))&&n.push(`commonmark-escape`),(/\*\*\s*`[^`]+`\s*\*\*/.test(e)||/\*\*\s*`[^`]+`\s*\*\*/.test(t))&&n.push(`emphasis-around-code`);let r=e.replace(/^/,``),i=t.replace(/^/,``);r.startsWith(`
322
+ `).replace(/\n+$/,``)}function mG(e,t){let n=[];(e.charCodeAt(0)===65279||t.charCodeAt(0)===65279)&&n.push(`bom`),(e.includes(`\r`)||t.includes(`\r`))&&n.push(`crlf`),(/\\[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/.test(e)||/\\[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/.test(t))&&n.push(`commonmark-escape`),(/\*\*\s*`[^`]+`\s*\*\*/.test(e)||/\*\*\s*`[^`]+`\s*\*\*/.test(t))&&n.push(`emphasis-around-code`);let r=e.replace(/^/,``),i=t.replace(/^/,``);r.startsWith(`
323
323
  `)!==i.startsWith(`
324
- `)&&n.push(`leading-newline`);let a=r.replace(/^\n+/,``),o=i.replace(/^\n+/,``),s=/^\*{3,}(?=\n|$)/.test(a),c=/^-{3,}(?=\n|$)/.test(a),l=/^\*{3,}(?=\n|$)/.test(o),u=/^-{3,}(?=\n|$)/.test(o);(s&&u||c&&l)&&n.push(`doc-start-thematic`);let d=/\n\n([#>+-]|\d+[.)]|`{3,}|~{3,})/,f=/^([#>+-].*|\d+[.)].*|`{3,}.*|~{3,}.*)\n\n[^\n]/m,p=d.test(r),m=d.test(i),h=f.test(r),g=f.test(i);(p!==m||h!==g)&&n.push(`block-separator-collapse`);let _=r.replace(/\r/g,``),v=i.replace(/\r/g,``),y=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/m;(y.test(_)||y.test(v))&&n.push(`table-align-row-spacing`);let b=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/m;return(b.test(_)||b.test(v))&&n.push(`list-indent-canonical`),(/[ \t]\n/.test(_)||/[ \t]\n/.test(v))&&n.push(`trailing-whitespace`),(/[ \t]$/.test(_)||/[ \t]$/.test(v))&&(n.includes(`trailing-whitespace`)||n.push(`trailing-whitespace`)),(/\n{3,}/.test(_)||/\n{3,}/.test(v))&&n.push(`blank-line-collapse`),_.endsWith(`
324
+ `)&&n.push(`leading-newline`);let a=r.replace(/^\n+/,``),o=i.replace(/^\n+/,``),s=/^\*{3,}(?=\n|$)/.test(a),c=/^-{3,}(?=\n|$)/.test(a),l=/^\*{3,}(?=\n|$)/.test(o),u=/^-{3,}(?=\n|$)/.test(o);(s&&u||c&&l)&&n.push(`doc-start-thematic`);let d=/\n\n([#>+-]|\d+[.)]|`{3,}|~{3,})/,f=/^([#>+-].*|\d+[.)].*|`{3,}.*|~{3,}.*)\n\n[^\n]/m,p=d.test(r),m=d.test(i),h=f.test(r),g=f.test(i);(p!==m||h!==g)&&n.push(`block-separator-collapse`);let _=r.replace(/\r/g,``),v=i.replace(/\r/g,``),y=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/m;(y.test(_)||y.test(v))&&n.push(`table-align-row-spacing`);let b=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/m;(b.test(_)||b.test(v))&&n.push(`list-indent-canonical`);let x=e=>e.replace(/^[ \t]+/,``).replace(dG,`1$1`),S=_.split(`
325
+ `),C=v.split(`
326
+ `),w=Math.min(S.length,C.length);for(let e=0;e<w;e++){let t=S[e]??``,r=C[e]??``;if(t!==r&&x(t)===x(r)&&/^[ \t]*\d+[.)]\s/.test(t)){n.push(`ordered-list-marker-number`);break}}return(/[ \t]\n/.test(_)||/[ \t]\n/.test(v))&&n.push(`trailing-whitespace`),(/[ \t]$/.test(_)||/[ \t]$/.test(v))&&(n.includes(`trailing-whitespace`)||n.push(`trailing-whitespace`)),(/\n{3,}/.test(_)||/\n{3,}/.test(v))&&n.push(`blank-line-collapse`),_.endsWith(`
325
327
  `)!==v.endsWith(`
326
- `)&&n.push(`trailing-newline`),n}const mG={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e),now:()=>Date.now()},hG=1,gG={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function _G({kind:e,runtimeVersion:t}){return{[gG.protocol]:`1`,[gG.runtime]:t,[gG.kind]:e}}const vG=`__system__`,yG=1,bG=`__config__/project`,xG=`__user__/config.yml`,SG=`__local__/project`,CG=`__config__/okignore`,wG=Object.freeze([bG,SG,xG,CG]),TG=`epoch`,EG=512*1024,DG=[`claude`,`claude-desktop`,`cursor`,`codex`],OG={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`},kG={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/},AG=`Ov23liqlSd0V1MwR6rhI`,jG=[`incoming`,`outgoing`,`both`];function MG(e){return jG.includes(e)}const NG=1e4,PG=`last-spawn-error.log`,FG=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
328
+ `)&&n.push(`trailing-newline`),n}const hG={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e),now:()=>Date.now()},gG=1,_G={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function vG({kind:e,runtimeVersion:t}){return{[_G.protocol]:`1`,[_G.runtime]:t,[_G.kind]:e}}const yG=`__system__`,bG=1,xG=`__config__/project`,SG=`__user__/config.yml`,CG=`__local__/project`,wG=`__config__/okignore`,TG=Object.freeze([xG,CG,SG,wG]),EG=`epoch`,DG=512*1024,OG=[`claude`,`claude-desktop`,`cursor`,`codex`],kG={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`},AG={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/},jG=`Ov23liqlSd0V1MwR6rhI`,MG=[`incoming`,`outgoing`,`both`];function NG(e){return MG.includes(e)}const PG=1e4,FG=`last-spawn-error.log`,IG=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
327
329
  <h3 style="margin:0 0 14px;font-size:15px;font-weight:600">Revenue by region</h3>
328
330
  <div id="bars" style="display:flex;align-items:flex-end;gap:14px;height:170px"></div>
329
331
  <script>
@@ -385,33 +387,33 @@ $2`).split(`
385
387
  out.textContent = '$' + Number(amt.value).toLocaleString();
386
388
  });
387
389
  <\/script>
388
- </div>`}];function IG(e){return["```html preview",e.html,"```"].join(`
389
- `)}const LG=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.6321 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],RG=`localhost`,zG=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],BG=[`video/mp4`,`video/webm`,`video/ogg`],VG=[`audio/mpeg`,`audio/wav`,`audio/ogg`],HG=[`application/pdf`],UG=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),WG=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),GG=new Set([`pdf`]),KG=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),qG=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(`.`)),JG=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),YG=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(`.`)),XG=new Set([`html`,`htm`]),ZG=`sandbox allow-scripts; connect-src 'none'`,QG=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(`.`)),$G=`same-dir`,eK=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(`.`)),tK=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],nK=[`mp4`,`webm`,`mov`,`m4v`],rK=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],iK=[`pdf`],aK=[`json`,`toml`,`lock`];function oK(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}oK(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,tK,UG),oK(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,nK,WG),oK(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,rK,KG),oK(`SIDEBAR_PDF_ASSET_EXTENSIONS`,iK,GG),oK(`FILE_ATTACHMENT_EXTENSIONS`,[...qG],eK),oK(`WIKI_EMBED_EXTENSIONS`,[...eK],YG);const sK=new Set(tK),cK=new Set(nK),lK=new Set(rK),uK=new Set(iK),dK=new Set(aK);oK(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...tK,...nK,...rK,...iK,...aK])],QG);const fK=new Set([`base`,`canvas`]),pK=new Set([...YG,...fK]);function mK(e){let t=e.toLowerCase().replace(/^\./,``);return sK.has(t)?`image`:cK.has(t)?`video`:lK.has(t)?`audio`:uK.has(t)?`pdf`:dK.has(t)||fK.has(t)?`text`:null}const hK=Sx.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`}}}}),gK=Fx.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[$b({find:Ax,type:this.type,getAttributes:{sourceDelimiter:`*`}}),$b({find:Mx,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),_K=kx.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[$b({find:wx,type:this.type,getAttributes:{sourceDelimiter:`**`}}),$b({find:Ex,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),vK=Mb.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),yK=gx.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}}),bK=gx.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),xK=Lx.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),SK=zx.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1}}}}),CK=gx.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}});function wK(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const TK=Vx.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Cy(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=wK(t.src)),[`img`,t]}}),EK=gx.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),DK=gx.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),OK=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],kK=OK.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${kK}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function AK(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}const jK=new Set(OK.map(e=>`${e}:`));function MK(e){try{let t=new URL(e,`https://placeholder.invalid`);return jK.has(t.protocol.toLowerCase())}catch{return!1}}const NK=$x.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:MK,validate:MK,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),PK=gx.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs,i=r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},i]}});function FK(e){return e.type.name===`list`&&!e.attrs.ordered}function IK(e){return e.type.name===`list`&&!!e.attrs.ordered}function LK(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function RK(e,t,n,r,i,a,o){let s=py(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?up(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o})}}),t(n),!0}return sp(n,a)(e,void 0)?t?sp(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}const zK=gx.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,Cy(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:RK(e,t,n,r,e=>FK(e)&&!LK(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:RK(e,t,n,r,e=>IK(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:RK(e,t,n,r,e=>FK(e)&&LK(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[nx({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),nx({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new wb({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Sd(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),BK=gx.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,Cy(t),0]:[`li`,Cy(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(Cy(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`);return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,n.isEditable||(o.disabled=!0),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),VK=zK,HK=BK,UK=gx.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),WK=gx.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),GK=uw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),KK=mw.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1}}}}),qK=gx.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,style:`display: none;`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),JK=Mb.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,style:`display: none;`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),YK=gx.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs,i=t||n;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:i}]}}),XK=Mb.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function ZK(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r?!0:QK(n)===r}function QK(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const $K=sw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null}}}}),eq=KC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),tq=qC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),nq=gx.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),rq=/^(?:---|—-|___\s|\*\*\*\s)$/;function iq(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const aq=_w.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[ex({find:rq,type:this.type,getAttributes:e=>({sourceRaw:iq(e)})})]}});function oq(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function sq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const cq=gx.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:oq(e.getAttribute(`data-alias`)),anchor:oq(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:oq(e.getAttribute(`data-alias`)),anchor:oq(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=oq(e.attrs.alias),i=oq(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},sq({target:n,alias:r,anchor:i})]}});function lq(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function uq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const dq=[EK,WK,DK,UK,cq,gx.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:oq(e.getAttribute(`data-alias`)),anchor:oq(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=oq(e.attrs.alias),i=oq(e.attrs.anchor),a=oq(e.attrs.resolvedSrc),o=lq(n);if(UG.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},uq({target:n,alias:r,anchor:i})]}}),nq,VK,HK,gK,_K,KK,hK,GK,SK,aq,NK,CK,PK,xK,vK,XK,GT.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),$K.configure({resizable:!0}),JC,tq,eq,TK.configure({inline:!0}),YK,nS,JK,qK,bK,yK],fq=/^[a-zA-Z0-9][\w/-]*$/;function pq(e){return e.startsWith(`#`)?e.slice(1):e}function mq(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function hq(e){if(!e||e.trim()===``)return[];let{map:t}=zW(e);if(!t)return[];let n=mq(t.tags),r=[];for(let e of n){let t=pq(e);fq.test(t)&&r.push(t)}return r}function gq(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}function _q(e){return e.split(`/`).some(e=>e.startsWith(`.`))}function vq(e,t){let n=gq(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const yq=k().superRefine(vq).optional(),bq={agentId:k().optional(),agentName:k().optional(),colorSeed:k().optional(),clientName:k().optional(),clientVersion:k().optional(),label:k().optional()},xq=k().optional(),Sq=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Cq=Zs(`kind`,[N({kind:F(`doc`),docPath:k().min(1)}).loose(),N({kind:F(`folder`),folderPath:k()}).loose()]),wq=P([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),Tq=Zs(`ok`,[N({ok:F(!0),shareUrl:k().min(1),sharedUrl:k().min(1),branch:k().min(1)}).loose(),N({ok:F(!1),error:wq,branch:k().min(1).optional()}).loose()]),Eq=P([`user`,`org`]),Dq=N({login:k().min(1),kind:Eq,avatarUrl:k().optional()}).loose(),Oq=P([`auth-required`,`network`]),kq=Zs(`ok`,[N({ok:F(!0),owners:M(Dq)}).loose(),N({ok:F(!1),error:Oq}).loose()]),Aq=Zs(`ok`,[N({ok:F(!0),available:j()}).loose(),N({ok:F(!1),error:Oq}).loose()]),jq=P([`public`,`private`]),Mq=N({owner:k().min(1),name:k().min(1),visibility:jq,description:k().optional()}).loose(),Nq=P([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),Pq=Zs(`ok`,[N({ok:F(!0),ownerLogin:k().min(1),repoName:k().min(1),cloneUrl:k().min(1),defaultBranch:k().min(1)}).loose(),N({ok:F(!1),error:Nq}).loose()]);function Fq(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const Iq=e=>e.refine(Fq,`invalid branch name`);function Lq(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const Rq={shareTargetExists:j(),dirtyConflicts:N({conflicts:j(),files:M(k().min(1))}).loose(),branchIsLocal:j()},zq=Zs(`detached`,[N({detached:F(!1),currentBranch:k().min(1).nullable(),currentHeadSha:Rs(),...Rq}).loose(),N({detached:F(!0),currentBranch:Rs(),currentHeadSha:k().min(1),...Rq}).loose()]),Bq=N({branch:Iq(k().min(1)),principalId:k().optional()}).loose(),Vq=P([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`]),Hq=Zs(`ok`,[N({ok:F(!0)}).loose(),N({ok:F(!1),reason:Vq,files:M(k().min(1)).optional(),otherWorktreePath:k().min(1).optional()}).loose()]),Uq=N({serverInstanceId:k().min(1),currentBranch:k().min(1).optional(),currentDiskAckSVs:tc(k().min(1),k().min(1)).optional()}).loose(),Wq=N({id:k().min(1),display_name:k().min(1),display_email:k(),source:P([`git-config`,`synthesized`]),created_at:k().min(1)}).loose(),Gq=N({collabUrl:k().nullable(),previewUrl:k().nullable(),port:A(),paneTarget:k().nullable(),singleFile:j().default(!1)}).loose(),Kq=P(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`));function qq(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const Jq=N({type:Kq,title:k().min(1),status:A().int().min(400).max(599),instance:k().regex(Sq,`instance must be urn:uuid:<uuid>`).optional(),detail:k().optional()}).loose(),Yq=N({parentDocName:k().min(1),agentId:k().min(1).optional(),agentName:k().min(1).optional()}).loose(),Xq=N({src:k().min(1),path:k().min(1).optional(),deduped:j().optional()}).loose(),Zq=N({url:k().min(1),dir:k().min(1),branch:k().min(1).refine(Fq,`invalid branch name`).optional()}).loose(),Qq=N({type:F(`error`),problem:Jq}).loose();function $q(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}let o=eJ(e,t);r>=0?n[r]=o:n.push(o)}return n}function eJ(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function tJ(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:$q(t,r),children:n.all(t),data:{}}}const nJ=/^[A-Za-z0-9]{20,}$/,rJ=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function iJ(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function aJ(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return nJ.test(n)?n:null}function oJ(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!iJ(t.hostname))return null;let n=aJ(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&rJ.test(r)?r:null}}function sJ(e){return oJ(e)!==null}function cJ(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function lJ(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:cJ(t.hostname)}const uJ=/^[A-Za-z0-9_-]{11}$/;function dJ(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function fJ(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function pJ(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return uJ.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return uJ.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function mJ(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!dJ(t.hostname))return null;let n=pJ(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?fJ(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}const hJ=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)",iconPicker:!0},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)",colorPicker:!0},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`,hideWhen:e=>e.collapsible!==!0},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],gJ=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:zG,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],_J=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`,cssLengthInput:!0},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`,cssLengthInput:!0},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],vJ=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:BG,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(lJ(e.src)||sJ(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:zG,hideWhen:e=>typeof e.src==`string`&&(lJ(e.src)||sJ(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&sJ(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(lJ(e.src)||sJ(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(mJ(e.src)!==null||lJ(e.src)||sJ(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],yJ=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:VG,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],bJ=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)",iconPicker:!0},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],xJ=[hJ[0],hJ[1],hJ[4],hJ[5],hJ[6]],SJ=[gJ[0],gJ[1],gJ[7]],CJ=[bJ[0],bJ[1],bJ[4],bJ[5]],wJ=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],TJ=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],EJ=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],DJ=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],OJ=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],kJ=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],AJ=[kJ[0]],jJ=[kJ[0]],MJ=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],NJ=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],PJ=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],FJ=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:HG,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],IJ=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],LJ=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function RJ(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function zJ(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function BJ(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}const VJ=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:hJ,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>tJ(`Callout`,e,t,hJ)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:gJ,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>tJ(`img`,e,t,gJ)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:vJ,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>tJ(`video`,e,t,vJ)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:yJ,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>tJ(`audio`,e,t,yJ)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:FJ,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>tJ(`Pdf`,e,t,FJ)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:PJ,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>tJ(`File`,e,t,PJ)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:_J,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:`Inline web embed (iframe) — drop a URL, get a resizable preview pane`,searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>tJ(`Embed`,e,t,_J)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:bJ,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>tJ(`Accordion`,e,t,bJ)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:DJ,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
390
- <Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>tJ(`Tabs`,e,t,DJ)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:OJ,icon:`PanelTop`,category:`content`,displayName:`Tab`,description:"A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.",searchTerms:[`tab`,`panel`],exampleBody:"Panel content — must be nested inside a `<Tabs>` parent.",serialize:(e,t)=>tJ(`Tab`,e,t,OJ)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:kJ,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>tJ(`Math`,e,t,kJ)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:MJ,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:"Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code.",searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})},{name:`Mirror`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:IJ,icon:`CopyPlus`,category:`content`,displayName:`Mirror`,description:"Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change.",searchTerms:[`mirror`,`sync`,`synced`,`transclude`,`embed`,`reference`,`shared block`],serialize:(e,t)=>tJ(`Mirror`,e,t,IJ)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:LJ,icon:`GitBranch`,category:`content`,displayName:`Mirror Source`,description:'Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.',searchTerms:[`mirror source`,`sync source`,`source block`,`master block`,`shared`],exampleBody:"Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.",serialize:(e,t)=>tJ(`MirrorSource`,e,t,LJ)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:xJ,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:SJ,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (`![alt](src "title")`) — read-only compat. Preserves `![alt](src)` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:wJ,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:BJ},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:TJ,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:BJ},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:EJ,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:BJ},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:NJ,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:BJ},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:CJ,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${RJ(n.name)}"`:``,a=n?.id?` id="${RJ(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${zJ(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:AJ,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:jJ,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})}],HJ={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>tJ(e.attrs.componentName||`*`,e,t)};function UJ(){let e=new Map;e.set(`*`,HJ);for(let t of VJ)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}function WJ(){let e=globalThis;return e.__okYpsCounters||={block:0,inline:0},e.__okYpsCounters}const GJ={parseFallback:{blockLevel:0,wholeDoc:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{},jsxPopoverCloseRestoreFailed:{},jsxKeyboardDeleteFailed:{},blockGripClickSelectFailed:{},jsxArrowNodeSelectFailed:{}};function KJ(){GJ.parseFallback.blockLevel++}function qJ(){GJ.parseFallback.wholeDoc++}function JJ(){let e=WJ();return{parseFallback:{...GJ.parseFallback},ypsMismatch:{block:e.block,inline:e.inline},jsxRenderFailure:{...GJ.jsxRenderFailure},jsxAutoConvertFailed:{...GJ.jsxAutoConvertFailed},jsxAutoConvertSucceeded:{...GJ.jsxAutoConvertSucceeded},jsxPropDropped:{...GJ.jsxPropDropped},jsxMoveFailed:{...GJ.jsxMoveFailed},jsxStuckCopyFailed:{...GJ.jsxStuckCopyFailed},jsxStuckDeleteFailed:{...GJ.jsxStuckDeleteFailed},jsxPopoverCloseRestoreFailed:{...GJ.jsxPopoverCloseRestoreFailed},jsxKeyboardDeleteFailed:{...GJ.jsxKeyboardDeleteFailed},blockGripClickSelectFailed:{...GJ.blockGripClickSelectFailed},jsxArrowNodeSelectFailed:{...GJ.jsxArrowNodeSelectFailed}}}const YJ=/^(`{3,}|~{3,})/gm;function XJ(e){let t=[],n=null;for(let r of e.matchAll(YJ)){let e=r[1],i=r.index;n?e[0]===n.marker[0]&&e.length>=n.marker.length&&(t.push([n.offset,i+r[0].length]),n=null):n={marker:e,offset:i}}return n&&t.push([n.offset,e.length]),t}function ZJ(e,t){return t.some(([t,n])=>e>=t&&e<n)}const QJ=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function $J(e){let t=XJ(e),n=[];for(let r of e.matchAll(QJ))ZJ(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
391
- `)}\n\n`:``}function eY(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return rY(e,t.parse,0,n)}function tY(e){return e.calls>=1e3?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=500}function nY(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,500),stack:e.stack?.split(`
390
+ </div>`}];function LG(e){return["```html preview",e.html,"```"].join(`
391
+ `)}const RG=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.6321 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],zG=`localhost`,BG=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],VG=[`video/mp4`,`video/webm`,`video/ogg`],HG=[`audio/mpeg`,`audio/wav`,`audio/ogg`],UG=[`application/pdf`],WG=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),GG=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),KG=new Set([`pdf`]),qG=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),JG=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(`.`)),YG=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),XG=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(`.`)),ZG=new Set([`html`,`htm`]),QG=`sandbox allow-scripts; connect-src 'none'`,$G=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(`.`)),eK=`same-dir`,tK=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(`.`)),nK=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],rK=[`mp4`,`webm`,`mov`,`m4v`],iK=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],aK=[`pdf`],oK=[`json`,`toml`,`lock`];function sK(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}sK(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,nK,WG),sK(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,rK,GG),sK(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,iK,qG),sK(`SIDEBAR_PDF_ASSET_EXTENSIONS`,aK,KG),sK(`FILE_ATTACHMENT_EXTENSIONS`,[...JG],tK),sK(`WIKI_EMBED_EXTENSIONS`,[...tK],XG);const cK=new Set(nK),lK=new Set(rK),uK=new Set(iK),dK=new Set(aK),fK=new Set(oK);sK(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...nK,...rK,...iK,...aK,...oK])],$G);const pK=new Set([`base`,`canvas`]),mK=new Set([...XG,...pK]);function hK(e){let t=e.toLowerCase().replace(/^\./,``);return cK.has(t)?`image`:lK.has(t)?`video`:uK.has(t)?`audio`:dK.has(t)?`pdf`:fK.has(t)||pK.has(t)?`text`:null}const gK=Sx.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`}}}}),_K=Fx.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[$b({find:Ax,type:this.type,getAttributes:{sourceDelimiter:`*`}}),$b({find:Mx,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),vK=kx.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[$b({find:wx,type:this.type,getAttributes:{sourceDelimiter:`**`}}),$b({find:Ex,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),yK=Mb.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),bK=gx.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}}),xK=gx.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),SK=Lx.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),CK=zx.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1}}}}),wK=gx.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}});function TK(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const EK=Vx.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Cy(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=TK(t.src)),[`img`,t]}}),DK=gx.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),OK=gx.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),kK=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],AK=kK.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${AK}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function jK(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}const MK=new Set(kK.map(e=>`${e}:`));function NK(e){try{let t=new URL(e,`https://placeholder.invalid`);return MK.has(t.protocol.toLowerCase())}catch{return!1}}const PK=$x.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:NK,validate:NK,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),FK=gx.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs,i=r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},i]}});function IK(e){return e.type.name===`list`&&!e.attrs.ordered}function LK(e){return e.type.name===`list`&&!!e.attrs.ordered}function RK(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function zK(e,t,n,r,i,a,o){let s=py(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?up(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o})}}),t(n),!0}return sp(n,a)(e,void 0)?t?sp(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}const BK=gx.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,Cy(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:zK(e,t,n,r,e=>IK(e)&&!RK(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:zK(e,t,n,r,e=>LK(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:zK(e,t,n,r,e=>IK(e)&&RK(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[nx({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),nx({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new wb({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Sd(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),VK=gx.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,Cy(t),0]:[`li`,Cy(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(Cy(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`);return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,n.isEditable||(o.disabled=!0),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),HK=BK,UK=VK,WK=gx.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),GK=gx.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),KK=uw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),qK=mw.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1}}}}),JK=gx.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,style:`display: none;`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),YK=Mb.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,style:`display: none;`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),XK=gx.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs,i=t||n;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:i}]}}),ZK=Mb.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function QK(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r?!0:$K(n)===r}function $K(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const eq=sw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null}}}}),tq=KC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),nq=qC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),rq=gx.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),iq=/^(?:---|—-|___\s|\*\*\*\s)$/;function aq(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const oq=_w.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[ex({find:iq,type:this.type,getAttributes:e=>({sourceRaw:aq(e)})})]}});function sq(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function cq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const lq=gx.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:sq(e.getAttribute(`data-alias`)),anchor:sq(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:sq(e.getAttribute(`data-alias`)),anchor:sq(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=sq(e.attrs.alias),i=sq(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},cq({target:n,alias:r,anchor:i})]}});function uq(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function dq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const fq=[DK,GK,OK,WK,lq,gx.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:sq(e.getAttribute(`data-alias`)),anchor:sq(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=sq(e.attrs.alias),i=sq(e.attrs.anchor),a=sq(e.attrs.resolvedSrc),o=uq(n);if(WG.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},dq({target:n,alias:r,anchor:i})]}}),rq,HK,UK,_K,vK,qK,gK,KK,CK,oq,PK,wK,FK,SK,yK,ZK,GT.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),eq.configure({resizable:!0}),JC,nq,tq,EK.configure({inline:!0}),XK,nS,YK,JK,xK,bK],pq=/^[a-zA-Z0-9][\w/-]*$/;function mq(e){return e.startsWith(`#`)?e.slice(1):e}function hq(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function gq(e){if(!e||e.trim()===``)return[];let{map:t}=zW(e);if(!t)return[];let n=hq(t.tags),r=[];for(let e of n){let t=mq(e);pq.test(t)&&r.push(t)}return r}function _q(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}function vq(e){return e.split(`/`).some(e=>e.startsWith(`.`))}function yq(e,t){let n=_q(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const bq=k().superRefine(yq).optional(),xq={agentId:k().optional(),agentName:k().optional(),colorSeed:k().optional(),clientName:k().optional(),clientVersion:k().optional(),label:k().optional()},Sq=k().optional(),Cq=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,wq=Zs(`kind`,[N({kind:F(`doc`),docPath:k().min(1)}).loose(),N({kind:F(`folder`),folderPath:k()}).loose()]),Tq=P([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),Eq=Zs(`ok`,[N({ok:F(!0),shareUrl:k().min(1),sharedUrl:k().min(1),branch:k().min(1)}).loose(),N({ok:F(!1),error:Tq,branch:k().min(1).optional()}).loose()]),Dq=P([`user`,`org`]),Oq=N({login:k().min(1),kind:Dq,avatarUrl:k().optional()}).loose(),kq=P([`auth-required`,`network`]),Aq=Zs(`ok`,[N({ok:F(!0),owners:M(Oq)}).loose(),N({ok:F(!1),error:kq}).loose()]),jq=Zs(`ok`,[N({ok:F(!0),available:j()}).loose(),N({ok:F(!1),error:kq}).loose()]),Mq=P([`public`,`private`]),Nq=N({owner:k().min(1),name:k().min(1),visibility:Mq,description:k().optional()}).loose(),Pq=P([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),Fq=Zs(`ok`,[N({ok:F(!0),ownerLogin:k().min(1),repoName:k().min(1),cloneUrl:k().min(1),defaultBranch:k().min(1)}).loose(),N({ok:F(!1),error:Pq}).loose()]);function Iq(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const Lq=e=>e.refine(Iq,`invalid branch name`);function Rq(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const zq={shareTargetExists:j(),dirtyConflicts:N({conflicts:j(),files:M(k().min(1))}).loose(),branchIsLocal:j()},Bq=Zs(`detached`,[N({detached:F(!1),currentBranch:k().min(1).nullable(),currentHeadSha:Rs(),...zq}).loose(),N({detached:F(!0),currentBranch:Rs(),currentHeadSha:k().min(1),...zq}).loose()]),Vq=N({branch:Lq(k().min(1)),principalId:k().optional()}).loose(),Hq=P([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`]),Uq=Zs(`ok`,[N({ok:F(!0)}).loose(),N({ok:F(!1),reason:Hq,files:M(k().min(1)).optional(),otherWorktreePath:k().min(1).optional()}).loose()]),Wq=N({serverInstanceId:k().min(1),currentBranch:k().min(1).optional(),currentDiskAckSVs:tc(k().min(1),k().min(1)).optional()}).loose(),Gq=N({id:k().min(1),display_name:k().min(1),display_email:k(),source:P([`git-config`,`synthesized`]),created_at:k().min(1)}).loose(),Kq=N({collabUrl:k().nullable(),previewUrl:k().nullable(),port:A(),paneTarget:k().nullable(),singleFile:j().default(!1)}).loose(),qq=P(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`));function Jq(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const Yq=N({type:qq,title:k().min(1),status:A().int().min(400).max(599),instance:k().regex(Cq,`instance must be urn:uuid:<uuid>`).optional(),detail:k().optional()}).loose(),Xq=N({parentDocName:k().min(1),agentId:k().min(1).optional(),agentName:k().min(1).optional()}).loose(),Zq=N({src:k().min(1),path:k().min(1).optional(),deduped:j().optional()}).loose(),Qq=N({url:k().min(1),dir:k().min(1),branch:k().min(1).refine(Iq,`invalid branch name`).optional()}).loose(),$q=N({type:F(`error`),problem:Yq}).loose();function eJ(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}let o=tJ(e,t);r>=0?n[r]=o:n.push(o)}return n}function tJ(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function nJ(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:eJ(t,r),children:n.all(t),data:{}}}const rJ=/^[A-Za-z0-9]{20,}$/,iJ=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function aJ(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function oJ(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return rJ.test(n)?n:null}function sJ(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!aJ(t.hostname))return null;let n=oJ(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&iJ.test(r)?r:null}}function cJ(e){return sJ(e)!==null}function lJ(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function uJ(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:lJ(t.hostname)}const dJ=/^[A-Za-z0-9_-]{11}$/;function fJ(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function pJ(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function mJ(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return dJ.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return dJ.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function hJ(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!fJ(t.hostname))return null;let n=mJ(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?pJ(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}const gJ=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)",iconPicker:!0},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)",colorPicker:!0},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`,hideWhen:e=>e.collapsible!==!0},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],_J=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:BG,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],vJ=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`,cssLengthInput:!0},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`,cssLengthInput:!0},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],yJ=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:VG,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(uJ(e.src)||cJ(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:BG,hideWhen:e=>typeof e.src==`string`&&(uJ(e.src)||cJ(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&cJ(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(uJ(e.src)||cJ(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(hJ(e.src)!==null||uJ(e.src)||cJ(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],bJ=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:HG,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],xJ=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)",iconPicker:!0},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],SJ=[gJ[0],gJ[1],gJ[4],gJ[5],gJ[6]],CJ=[_J[0],_J[1],_J[7]],wJ=[xJ[0],xJ[1],xJ[4],xJ[5]],TJ=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],EJ=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],DJ=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],OJ=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],kJ=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],AJ=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],jJ=[AJ[0]],MJ=[AJ[0]],NJ=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],PJ=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],FJ=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],IJ=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:UG,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],LJ=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],RJ=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function zJ(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function BJ(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function VJ(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}const HJ=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:gJ,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>nJ(`Callout`,e,t,gJ)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:_J,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>nJ(`img`,e,t,_J)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:yJ,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>nJ(`video`,e,t,yJ)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:bJ,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>nJ(`audio`,e,t,bJ)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:IJ,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>nJ(`Pdf`,e,t,IJ)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:FJ,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>nJ(`File`,e,t,FJ)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:vJ,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:`Inline web embed (iframe) — drop a URL, get a resizable preview pane`,searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>nJ(`Embed`,e,t,vJ)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:xJ,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>nJ(`Accordion`,e,t,xJ)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:OJ,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
392
+ <Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>nJ(`Tabs`,e,t,OJ)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:kJ,icon:`PanelTop`,category:`content`,displayName:`Tab`,description:"A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.",searchTerms:[`tab`,`panel`],exampleBody:"Panel content — must be nested inside a `<Tabs>` parent.",serialize:(e,t)=>nJ(`Tab`,e,t,kJ)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:AJ,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>nJ(`Math`,e,t,AJ)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:NJ,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:"Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code.",searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})},{name:`Mirror`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:LJ,icon:`CopyPlus`,category:`content`,displayName:`Mirror`,description:"Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change.",searchTerms:[`mirror`,`sync`,`synced`,`transclude`,`embed`,`reference`,`shared block`],serialize:(e,t)=>nJ(`Mirror`,e,t,LJ)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:RJ,icon:`GitBranch`,category:`content`,displayName:`Mirror Source`,description:'Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.',searchTerms:[`mirror source`,`sync source`,`source block`,`master block`,`shared`],exampleBody:"Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.",serialize:(e,t)=>nJ(`MirrorSource`,e,t,RJ)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:SJ,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:CJ,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (`![alt](src "title")`) — read-only compat. Preserves `![alt](src)` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:TJ,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:VJ},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:EJ,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:VJ},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:DJ,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:VJ},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:PJ,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:VJ},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:wJ,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${zJ(n.name)}"`:``,a=n?.id?` id="${zJ(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${BJ(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:jJ,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:MJ,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})}],UJ={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>nJ(e.attrs.componentName||`*`,e,t)};function WJ(){let e=new Map;e.set(`*`,UJ);for(let t of HJ)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}function GJ(){let e=globalThis;return e.__okYpsCounters||={block:0,inline:0},e.__okYpsCounters}const KJ={parseFallback:{blockLevel:0,wholeDoc:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{},jsxPopoverCloseRestoreFailed:{},jsxKeyboardDeleteFailed:{},blockGripClickSelectFailed:{},jsxArrowNodeSelectFailed:{}};function qJ(){KJ.parseFallback.blockLevel++}function JJ(){KJ.parseFallback.wholeDoc++}function YJ(){let e=GJ();return{parseFallback:{...KJ.parseFallback},ypsMismatch:{block:e.block,inline:e.inline},jsxRenderFailure:{...KJ.jsxRenderFailure},jsxAutoConvertFailed:{...KJ.jsxAutoConvertFailed},jsxAutoConvertSucceeded:{...KJ.jsxAutoConvertSucceeded},jsxPropDropped:{...KJ.jsxPropDropped},jsxMoveFailed:{...KJ.jsxMoveFailed},jsxStuckCopyFailed:{...KJ.jsxStuckCopyFailed},jsxStuckDeleteFailed:{...KJ.jsxStuckDeleteFailed},jsxPopoverCloseRestoreFailed:{...KJ.jsxPopoverCloseRestoreFailed},jsxKeyboardDeleteFailed:{...KJ.jsxKeyboardDeleteFailed},blockGripClickSelectFailed:{...KJ.blockGripClickSelectFailed},jsxArrowNodeSelectFailed:{...KJ.jsxArrowNodeSelectFailed}}}const XJ=/^(`{3,}|~{3,})/gm;function ZJ(e){let t=[],n=null;for(let r of e.matchAll(XJ)){let e=r[1],i=r.index;n?e[0]===n.marker[0]&&e.length>=n.marker.length&&(t.push([n.offset,i+r[0].length]),n=null):n={marker:e,offset:i}}return n&&t.push([n.offset,e.length]),t}function QJ(e,t){return t.some(([t,n])=>e>=t&&e<n)}const $J=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function eY(e){let t=ZJ(e),n=[];for(let r of e.matchAll($J))QJ(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
393
+ `)}\n\n`:``}function tY(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return iY(e,t.parse,0,n)}function nY(e){return e.calls>=1e3?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=500}function rY(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,500),stack:e.stack?.split(`
392
394
  `).slice(0,4).join(`
393
- `)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function rY(e,t,n,r){if(n>20)return qJ(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),fY(e);if(r){if(tY(r))return qJ(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),fY(e);r.calls+=1}try{return t(e)}catch(i){let a=iY(i),o=nY(i);if(a===void 0){if(n===0){let n=dY(e,t,i,r);if(n)return n}return qJ(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),fY(e)}KJ(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=lY(e,a),s=e.slice(0,i.start),c=e.slice(i.start,i.end),l=e.slice(i.end),u=s.trim()?rY(s,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?rY($J(s)+l,t,n+1,r):{type:`doc`,content:[]},f={type:`rawMdxFallback`,attrs:{reason:o.message,originalSpan:{start:i.start,end:i.end}},content:c?[{type:`text`,text:c}]:[]},p=[...u.content??[],f,...d.content??[]];return{type:`doc`,content:p.length>0?p:[{type:`paragraph`,content:[]}]}}catch(t){qJ();let n=nY(t);return console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`Recovery failed: ${n.message}`,recoveryPath:`block-split-then-rejoin`,error:n,originalError:o})),fY(e)}}}function iY(e){if(!e||typeof e!=`object`)return;let t=e;if(t.place&&typeof t.place.offset==`number`)return t.place.offset;if(t.place?.start&&typeof t.place.start.offset==`number`)return t.place.start.offset;if(t.position&&typeof t.position.offset==`number`)return t.position.offset;if(t.position?.start&&typeof t.position.start.offset==`number`)return t.position.start.offset}function aY(e,t){let n=/\n\s*\n/g,r=null;for(let i of e.matchAll(n)){if(i.index>=t)break;r=i.index+i[0].length}return r}function oY(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}function sY(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(ZJ(i,t))continue;let a=r[1]===`/`,o=r[2],s=i+r[0].length,c=Math.min(e.length,s+32768),l=!1,u=0,d=-1,f=!1;for(let t=s;t<c;t++){let n=e[t];if(l){n===`"`&&(l=!1),n===`\\`&&t+1<c&&t++;continue}if(n===`"`){l=!0;continue}if(n===`{`){u++;continue}if(n===`}`&&u>0){u--;continue}if(!(u>0)&&n===`>`){d=t,t>0&&e[t-1]===`/`&&(f=!0);break}}if(d===-1)continue;let p=d+1;a?n.push({kind:`close`,name:o,start:i,end:p}):f?n.push({kind:`self-close`,name:o,start:i,end:p}):n.push({kind:`open`,name:o,start:i,end:p})}return n}function cY(e){let t=sY(e,XJ(e)),n=[],r=[];for(let i of t){if(i.kind===`self-close`)continue;if(i.kind===`open`){n.push(i);continue}let t=-1;for(let e=n.length-1;e>=0;e--)if(n[e].name===i.name){t=e;break}if(t!==-1){for(let a=n.length-1;a>t;a--){let t=n[a],o=oY(e,t.start)??e.length;r.push({start:t.start,end:Math.min(i.start,o),source:`unmatched`})}r.push({start:n[t].start,end:i.end,source:`pair`}),n.length=t}}for(let t of n){let n=oY(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function lY(e,t){let n=cY(e),r=null;for(let e of n)e.start<=t&&t<=e.end&&(!r||e.end-e.start<r.end-r.start)&&(r=e);return r?{start:r.start,end:r.end}:{start:aY(e,t)??0,end:oY(e,t)??e.length}}function uY(e){let t=XJ(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;ZJ(e,t)||r.push(e+i[0].length)}r.push(e.length);let i=[];for(let t=0;t<r.length-1;t++){let n=r[t],a=r[t+1];if(a<=n)continue;let o=e.slice(n,a);o.trim()&&i.push({src:o,start:n,end:a})}return i}function dY(e,t,n,r){let i=uY(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&tY(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=$J(e.src);let r=n.filter(e=>e.type!==`paragraph`||Array.isArray(e.content)&&e.content.length>0);if(r.length===0&&n.length>0){o=!0;continue}a.push(...r),o=!0}catch(t){KJ();let r=t?.message?.slice(0,200)??`unknown block error`,i=n?.message?.slice(0,160)??`unknown`;console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:e.start,reason:`Per-block recovery after position-less error: ${i}`,blockError:r,blockErrorName:t?.name})),a.push({type:`rawMdxFallback`,attrs:{reason:r,originalSpan:{start:e.start,end:e.end}},content:[{type:`text`,text:e.src}]})}}return o?{type:`doc`,content:a.length>0?a:[{type:`paragraph`,content:[]}]}:null}function fY(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}const pY=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,mY=/<!--[\s\S]*?-->/g,hY=/<\/([a-z][a-z0-9]*)\s*>/g,gY=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,_Y=new Set([`img`,`video`,`audio`]),vY=new Set([`mark`]),yY=/<\/([A-Z][A-Za-z0-9.]*)>/g;function bY(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function xY(e){let t=new Map,n=new RegExp(yY.source,`g`),r=n.exec(e);for(;r!==null;){let i=t.get(r[1]);i?i.push(r.index):t.set(r[1],[r.index]),r=n.exec(e)}return t}function SY(e){let t=[],n=/\n\s*\n/g,r=n.exec(e);for(;r!==null;)t.push(r.index),r=n.exec(e);return t}function CY(e){let t=[],n=e.indexOf(`/>`);for(;n!==-1;)t.push(n),n=e.indexOf(`/>`,n+2);return t}function wY(e){let t=[],n=e.indexOf(`>`);for(;n!==-1;)t.push(n),n=e.indexOf(`>`,n+1);return t}function TY(e,t,n,r){let i=bY(n,e);if(i>=n.length)return!1;let a=n[i],o=bY(r,e);return a>=(o<r.length?r[o]:t.length)?!1:t[a-1]===`/`}function EY(e){let t=e;t=t.replace(mY,e=>e.replace(/</g,``).replace(/>/g,``)),t=t.replace(pY,(e,t)=>`${t.replaceAll(`:`,``).replaceAll(`@`,``)}`),t=t.replace(hY,(e,t)=>vY.has(t)?e:e.replace(/</g,``).replace(/>/g,``)),t=t.replace(gY,(e,t)=>_Y.has(t)&&e.endsWith(`/>`)||vY.has(t)?e:t[0]===t[0].toLowerCase()&&t[0]!==t[0].toUpperCase()?e.replace(/</g,``).replace(/>/g,``):e),t=t.replace(/<>/g,``);let n=xY(t),r=SY(t),i=CY(t),a=wY(t);t=t.replace(/</g,(e,o)=>{let s=t.slice(o,o+256);if(s[1]===`/`)return/^<\/[a-zA-Z][a-zA-Z0-9.]*[ \t]*>/.test(s)?e:``;let c=/^<([a-z][a-z0-9]*)/.exec(s);if(c&&_Y.has(c[1])&&TY(o,t,a,r))return e;let l=/^<([a-z][a-z0-9]*)([\s/>])/.exec(s);if(l&&vY.has(l[1])){let n=l[1];return s.startsWith(`<${n}/>`)||t.indexOf(`</${n}>`,o)!==-1?e:``}let u=/^<([A-Z][a-zA-Z0-9.]*)[\s/>]/.exec(s);if(!u)return``;let d=u[1],f=bY(r,o),p=bY(i,f<r.length?r[f]:t.length);if(p>0){let n=i[p-1];if(n>o){let r=o+u[0].length-1;if(!t.slice(r,n).replace(/"[^"]*"|'[^']*'/g,``).includes(`/`))return e}}let m=n.get(d);return m&&bY(m,o)<m.length?e:``});{let e=[],n=[];for(let r=0;r<t.length;r++){if(t[r]===`
395
+ `)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function iY(e,t,n,r){if(n>20)return JJ(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),pY(e);if(r){if(nY(r))return JJ(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),pY(e);r.calls+=1}try{return t(e)}catch(i){let a=aY(i),o=rY(i);if(a===void 0){if(n===0){let n=fY(e,t,i,r);if(n)return n}return JJ(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),pY(e)}qJ(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=uY(e,a),s=e.slice(0,i.start),c=e.slice(i.start,i.end),l=e.slice(i.end),u=s.trim()?iY(s,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?iY(eY(s)+l,t,n+1,r):{type:`doc`,content:[]},f={type:`rawMdxFallback`,attrs:{reason:o.message,originalSpan:{start:i.start,end:i.end}},content:c?[{type:`text`,text:c}]:[]},p=[...u.content??[],f,...d.content??[]];return{type:`doc`,content:p.length>0?p:[{type:`paragraph`,content:[]}]}}catch(t){JJ();let n=rY(t);return console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`Recovery failed: ${n.message}`,recoveryPath:`block-split-then-rejoin`,error:n,originalError:o})),pY(e)}}}function aY(e){if(!e||typeof e!=`object`)return;let t=e;if(t.place&&typeof t.place.offset==`number`)return t.place.offset;if(t.place?.start&&typeof t.place.start.offset==`number`)return t.place.start.offset;if(t.position&&typeof t.position.offset==`number`)return t.position.offset;if(t.position?.start&&typeof t.position.start.offset==`number`)return t.position.start.offset}function oY(e,t){let n=/\n\s*\n/g,r=null;for(let i of e.matchAll(n)){if(i.index>=t)break;r=i.index+i[0].length}return r}function sY(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}function cY(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(QJ(i,t))continue;let a=r[1]===`/`,o=r[2],s=i+r[0].length,c=Math.min(e.length,s+32768),l=!1,u=0,d=-1,f=!1;for(let t=s;t<c;t++){let n=e[t];if(l){n===`"`&&(l=!1),n===`\\`&&t+1<c&&t++;continue}if(n===`"`){l=!0;continue}if(n===`{`){u++;continue}if(n===`}`&&u>0){u--;continue}if(!(u>0)&&n===`>`){d=t,t>0&&e[t-1]===`/`&&(f=!0);break}}if(d===-1)continue;let p=d+1;a?n.push({kind:`close`,name:o,start:i,end:p}):f?n.push({kind:`self-close`,name:o,start:i,end:p}):n.push({kind:`open`,name:o,start:i,end:p})}return n}function lY(e){let t=cY(e,ZJ(e)),n=[],r=[];for(let i of t){if(i.kind===`self-close`)continue;if(i.kind===`open`){n.push(i);continue}let t=-1;for(let e=n.length-1;e>=0;e--)if(n[e].name===i.name){t=e;break}if(t!==-1){for(let a=n.length-1;a>t;a--){let t=n[a],o=sY(e,t.start)??e.length;r.push({start:t.start,end:Math.min(i.start,o),source:`unmatched`})}r.push({start:n[t].start,end:i.end,source:`pair`}),n.length=t}}for(let t of n){let n=sY(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function uY(e,t){let n=lY(e),r=null;for(let e of n)e.start<=t&&t<=e.end&&(!r||e.end-e.start<r.end-r.start)&&(r=e);return r?{start:r.start,end:r.end}:{start:oY(e,t)??0,end:sY(e,t)??e.length}}function dY(e){let t=ZJ(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;QJ(e,t)||r.push(e+i[0].length)}r.push(e.length);let i=[];for(let t=0;t<r.length-1;t++){let n=r[t],a=r[t+1];if(a<=n)continue;let o=e.slice(n,a);o.trim()&&i.push({src:o,start:n,end:a})}return i}function fY(e,t,n,r){let i=dY(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&nY(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=eY(e.src);let r=n.filter(e=>e.type!==`paragraph`||Array.isArray(e.content)&&e.content.length>0);if(r.length===0&&n.length>0){o=!0;continue}a.push(...r),o=!0}catch(t){qJ();let r=t?.message?.slice(0,200)??`unknown block error`,i=n?.message?.slice(0,160)??`unknown`;console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:e.start,reason:`Per-block recovery after position-less error: ${i}`,blockError:r,blockErrorName:t?.name})),a.push({type:`rawMdxFallback`,attrs:{reason:r,originalSpan:{start:e.start,end:e.end}},content:[{type:`text`,text:e.src}]})}}return o?{type:`doc`,content:a.length>0?a:[{type:`paragraph`,content:[]}]}:null}function pY(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}const mY=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,hY=/<!--[\s\S]*?-->/g,gY=/<\/([a-z][a-z0-9]*)\s*>/g,_Y=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,vY=new Set([`img`,`video`,`audio`]),yY=new Set([`mark`]),bY=/<\/([A-Z][A-Za-z0-9.]*)>/g;function xY(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function SY(e){let t=new Map,n=new RegExp(bY.source,`g`),r=n.exec(e);for(;r!==null;){let i=t.get(r[1]);i?i.push(r.index):t.set(r[1],[r.index]),r=n.exec(e)}return t}function CY(e){let t=[],n=/\n\s*\n/g,r=n.exec(e);for(;r!==null;)t.push(r.index),r=n.exec(e);return t}function wY(e){let t=[],n=e.indexOf(`/>`);for(;n!==-1;)t.push(n),n=e.indexOf(`/>`,n+2);return t}function TY(e){let t=[],n=e.indexOf(`>`);for(;n!==-1;)t.push(n),n=e.indexOf(`>`,n+1);return t}function EY(e,t,n,r){let i=xY(n,e);if(i>=n.length)return!1;let a=n[i],o=xY(r,e);return a>=(o<r.length?r[o]:t.length)?!1:t[a-1]===`/`}function DY(e){let t=e;t=t.replace(hY,e=>e.replace(/</g,``).replace(/>/g,``)),t=t.replace(mY,(e,t)=>`${t.replaceAll(`:`,``).replaceAll(`@`,``)}`),t=t.replace(gY,(e,t)=>yY.has(t)?e:e.replace(/</g,``).replace(/>/g,``)),t=t.replace(_Y,(e,t)=>vY.has(t)&&e.endsWith(`/>`)||yY.has(t)?e:t[0]===t[0].toLowerCase()&&t[0]!==t[0].toUpperCase()?e.replace(/</g,``).replace(/>/g,``):e),t=t.replace(/<>/g,``);let n=SY(t),r=CY(t),i=wY(t),a=TY(t);t=t.replace(/</g,(e,o)=>{let s=t.slice(o,o+256);if(s[1]===`/`)return/^<\/[a-zA-Z][a-zA-Z0-9.]*[ \t]*>/.test(s)?e:``;let c=/^<([a-z][a-z0-9]*)/.exec(s);if(c&&vY.has(c[1])&&EY(o,t,a,r))return e;let l=/^<([a-z][a-z0-9]*)([\s/>])/.exec(s);if(l&&yY.has(l[1])){let n=l[1];return s.startsWith(`<${n}/>`)||t.indexOf(`</${n}>`,o)!==-1?e:``}let u=/^<([A-Z][a-zA-Z0-9.]*)[\s/>]/.exec(s);if(!u)return``;let d=u[1],f=xY(r,o),p=xY(i,f<r.length?r[f]:t.length);if(p>0){let n=i[p-1];if(n>o){let r=o+u[0].length-1;if(!t.slice(r,n).replace(/"[^"]*"|'[^']*'/g,``).includes(`/`))return e}}let m=n.get(d);return m&&xY(m,o)<m.length?e:``});{let e=[],n=[];for(let r=0;r<t.length;r++){if(t[r]===`
394
396
  `){let i=t[r+1];if(i===`
395
397
  `||i===`>`){if(e.push(...n),n.length=0,i===`
396
398
  `)for(;t[r+1]===`
397
- `;)r++;continue}}if(t[r]===`{`||t[r]===`}`){let e=0;for(let n=r-1;n>=0&&t[n]===`\\`;n--)e++;if(e%2==1)continue;t[r]===`{`?n.push(r):n.length>0&&n.pop()}}if(e.push(...n),e.length>0){let n=[...t];for(let t of e)n[t]=``;t=n.join(``)}}return t}function DY(e){return e.includes(``)||e.includes(``)||e.includes(``)||e.includes(``)||e.includes(``)}function OY(){return e=>{Tj(e,e=>{let t=e;typeof t.value==`string`&&DY(t.value)&&(t.value=kY(t.value)),typeof t.url==`string`&&DY(t.url)&&(t.url=kY(t.url)),typeof t.title==`string`&&DY(t.title)&&(t.title=kY(t.title)),typeof t.alt==`string`&&DY(t.alt)&&(t.alt=kY(t.alt))})}}function kY(e){return e.replaceAll(``,`<`).replaceAll(``,`>`).replaceAll(``,`:`).replaceAll(``,`@`).replaceAll(``,`{`)}const AY=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function jY(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n}function MY(e,t,n){return t.lastIndex=0,e.replace(t,(t,r)=>typeof r!=`number`||jY(e,r)%2==1?t:n(t))}function NY(e){return MY(e,AY,e=>`${e.slice(1,-1)}`)}const PY=RegExp(`([^]+)`,`g`);function FY(e){if(!e.includes(``))return{value:e,spans:[]};let t=[],n=``,r=0;PY.lastIndex=0;let i=PY.exec(e);for(;i!==null;){i.index>r&&(n+=e.slice(r,i.index));let a=`&${i[1]??``};`;t.push({offset:n.length,length:a.length,raw:a}),n+=a,r=i.index+i[0].length,i=PY.exec(e)}return r<e.length&&(n+=e.slice(r)),{value:n,spans:t}}function IY(){return e=>{Tj(e,e=>{let t=e;if(typeof t.value==`string`&&t.value.includes(``)){let{value:n,spans:r}=FY(t.value);if(t.value=n,e.type===`text`&&r.length>0){let t=e;t.data??={},t.data.entityRefSpans=r}}for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=FY(n).value)}})}}const LY=/\\</g;function RY(e){return MY(e,LY,e=>`${e.slice(1)}`)}function zY(){return e=>{Tj(e,e=>{let t=e;typeof t.value==`string`&&t.value.includes(``)&&(t.value=t.value.split(``).join(``));for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=n.split(``).join(``))}})}}const BY=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),VY={note:`note`,tip:`tip`,important:`important`,warning:`warning`,caution:`caution`,abstract:`abstract`,info:`info`,todo:`todo`,success:`success`,question:`question`,failure:`failure`,danger:`danger`,bug:`bug`,example:`example`,quote:`quote`,summary:`abstract`,tldr:`abstract`,check:`success`,done:`success`,help:`question`,faq:`question`,fail:`failure`,missing:`failure`,error:`danger`,cite:`quote`,idea:`tip`,hint:`tip`,warn:`warning`,attention:`warning`},HY=`ok-alert`,UY=RegExp(`(?:^|\\s)${HY}-(\\w+)(?:\\s|$)`),WY=/^>\s*\[!(\w+)\]([+-])?(?:\s+(.*?))?\s*$/i;function GY(e,t){if(t<0||t>=e.length)return null;let n=e.indexOf(`
398
- `,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(WY);return r?{rawType:r[1],foldableMarker:r[2]===`+`||r[2]===`-`?r[2]:null,title:r[3]?.trim()||null}:null}function KY(e){if(e.data?.hName!==`div`)return null;let t=e.data?.hProperties?.class;if(typeof t!=`string`)return null;let n=t.match(UY);return n?n[1].toLowerCase():null}function qY(e){return VY[e.toLowerCase()]??null}function JY(e,t,n,r,i=null){let a=[{type:`mdxJsxAttribute`,name:`type`,value:t}];n&&a.push({type:`mdxJsxAttribute`,name:`title`,value:n}),i&&a.push({type:`mdxJsxAttribute`,name:`data-authored-as`,value:i}),r!==null&&(a.push({type:`mdxJsxAttribute`,name:`collapsible`,value:null}),r===`+`?a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}):a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}}));let o=e.children.slice(1),s=e.position?.start.line;return{type:`mdxJsxFlowElement`,name:`GFMCallout`,attributes:a,children:n&&o.length>0&&s!==void 0&&YY(o[0],s)?o.slice(1):o,position:e.position}}function YY(e,t){if(!e||typeof e!=`object`)return!1;let n=e;if(n.type!==`paragraph`)return!1;let r=n.position?.start?.line,i=n.position?.end?.line;return r===t&&i===t}function XY(e){if(!e||typeof e!=`object`||e.type!==`paragraph`)return!1;let t=e.data?.hProperties?.class;return typeof t==`string`&&t.includes(`${HY}-title`)}function ZY(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;Tj(e,`blockquote`,(e,t,r)=>{if(r===void 0||typeof t!=`number`)return;let i=KY(e);if(!i)return;let a=qY(i),o=null,s=null;e.position?.start?.offset!==void 0&&(s=GY(n,e.position.start.offset),s&&(o=s.title,a||=qY(s.rawType)));let c=a??`note`,l=s&&BY.has(c)?s.foldableMarker:null,u=(()=>{if(e.position?.start?.offset!==void 0){let t=GY(n,e.position.start.offset);if(t?.rawType)return t.rawType}return i})(),d=u.toLowerCase()===c?null:u;if(!XY(e.children[0]))return;let f=JY(e,c,o,l,d);r.children[t]=f})}}const QY={markers:`*`,classPrefix:HY,matchCaseSensitive:!1,icons:new Proxy({},{get:()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"></svg>`})},$Y=/(?<!%)%%([^\n]*?[^\n%])%%(?!%)/g,eX=/<!--([\s\S]*?)-->/g;function tX(){return e=>{rX(e),Tj(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`%%`)===-1&&r.indexOf(`<!--`)===-1)return;let i=nX(r);if(i.length===0)return;let a=[],o=0;for(let e of i){e.start>o&&a.push({type:`text`,value:r.slice(o,e.start)});let t={type:`comment`,children:[{type:`text`,value:e.body}],data:{sourceForm:e.sourceForm}};a.push(t),o=e.end}return o<r.length&&a.push({type:`text`,value:r.slice(o)}),n.children.splice(t,1,...a),[Sj,t+a.length]})}}function nX(e){let t=[];$Y.lastIndex=0;let n;for(;(n=$Y.exec(e))!==null;)n[1].trim().length!==0&&t.push({start:n.index,end:n.index+n[0].length,body:n[1],sourceForm:`percent`});eX.lastIndex=0;let r;for(;(r=eX.exec(e))!==null;){let e=r[1].trim();e!==``&&t.push({start:r.index,end:r.index+r[0].length,body:e,sourceForm:`html`})}t.sort((e,t)=>e.start-t.start);let i=[],a=-1;for(let e of t)e.start<a||(i.push(e),a=e.end);return i}function rX(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type===`paragraph`){let r=iX(e);if(r!==null){let e=aX(r);if(e!==null){let r={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:e}]}],data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,1,r),n+=1;continue}let i=oX(r);if(i!==null){let e={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:i}]}],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}let i=sX(e);if(i!==null){let e={type:`commentBlock`,children:[i],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}let a=cX(e);if(a!==null){let e={type:`commentBlock`,children:[a],data:{sourceForm:`percent`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}if(e.type===`paragraph`&&uX(e)){let e=n+1;for(;e<t.length;){let n=t[e];if(n.type===`paragraph`&&uX(n))break;e+=1}if(e<t.length&&e>n+1){let r={type:`commentBlock`,children:t.slice(n+1,e),data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,e-n+1,r),n+=1;continue}}n+=1}}function iX(e){if(e.children.length!==1)return null;let t=e.children[0];return t.type===`text`?t.value:null}function aX(e){let t=e.match(/^%%\n((?:.|\n(?!\n))+?)\n%%$/);return t===null?null:t[1]}function oX(e){let t=e.trim();if(!t.startsWith(`<!--`)||!t.endsWith(`-->`))return null;let n=t.slice(4,-3);if(n.includes(`-->`)||n.includes(`<!--`))return null;let r=n.trim();return r===``?null:r}function sX(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`<!--`))return null;let i=n.value.trimEnd();if(!i.endsWith(`-->`))return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`text`)continue;let r=n.value;if(t===0){if(lX(r,`<!--`)>1||lX(r,`-->`)>0)return null}else if(t===e.children.length-1){if(lX(r,`<!--`)>0||lX(r,`-->`)>1)return null}else if(r.includes(`<!--`)||r.includes(`-->`))return null}let a=r.slice(4);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-3);o.endsWith(` `)&&(o=o.slice(0,-1));let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function cX(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`%%`)||r.startsWith(`%%%`))return null;let i=n.value.trimEnd();if(!i.endsWith(`%%`)||i.endsWith(`%%%`))return null;let a=r.slice(2);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-2);if(o.endsWith(` `)&&(o=o.slice(0,-1)),a.indexOf(`%%`)!==-1||o.indexOf(`%%`)!==-1)return null;for(let t=1;t<e.children.length-1;t++){let n=e.children[t];if(n.type===`text`&&n.value.indexOf(`%%`)!==-1)return null}if(!(e.children.slice(1,-1).some(e=>e.type===`text`?e.value.trim().length>0:!0)||a.trim().length>0||o.trim().length>0))return null;let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function lX(e,t){if(!t)return 0;let n=0,r=0;for(;;){let i=e.indexOf(t,r);if(i===-1)break;n+=1,r=i+t.length}return n}function uX(e){let t=iX(e);return t===null?!1:t.trim()===`%%`}const dX=/^<details(\s[^>]*)?>\s*<summary>([\s\S]*?)<\/summary>([\s\S]*?)<\/details>\s*$/,fX=/^<details(\s[^>]*)?>(?:\s*<summary>([\s\S]*?)<\/summary>)?[\s\S]*$/,pX=/^\s*<\/details>\s*$/;function mX(e){let t=!1,n=null,r=null;if(!e)return{defaultOpen:t,name:n,id:r};let i=/(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,a=i.exec(e);for(;a!==null;){let o=a[1].toLowerCase(),s=a[2]??a[3]??a[4]??null;o===`open`?t=!0:o===`name`?n=s:o===`id`&&(r=s),a=i.exec(e)}return{defaultOpen:t,name:n,id:r}}function hX(e){let t=[];return e.title!==null&&t.push({type:`mdxJsxAttribute`,name:`title`,value:e.title}),e.defaultOpen&&t.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}),e.name!==null&&t.push({type:`mdxJsxAttribute`,name:`name`,value:e.name}),e.id!==null&&t.push({type:`mdxJsxAttribute`,name:`id`,value:e.id}),t}function gX(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function _X(e){return e.children[0].value??``}function vX(e){if(!gX(e))return null;let t=_X(e).match(dX);if(!t)return null;let{defaultOpen:n,name:r,id:i}=mX(t[1]),a=t[2].trim()||null,o=t[3].trim(),s=o?[{type:`paragraph`,children:[{type:`text`,value:o}]}]:[];return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:hX({title:a,defaultOpen:n,name:r,id:i}),children:s,position:e.position}}function yX(e,t){let n=e[t];if(!gX(n))return null;let r=_X(n);if(!r.startsWith(`<details`)||r.includes(`</details>`))return null;let i=r.match(fX);if(!i)return null;let{defaultOpen:a,name:o,id:s}=mX(i[1]),c=i[2]?.trim()||null;for(let n=t+1;n<e.length;n++){let t=e[n];if(!gX(t))continue;let r=_X(t);if(pX.test(r))return{closerIdx:n,title:c,defaultOpen:a,name:o,id:s};if(r.includes(`</details>`))return null}return null}function bX(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(gX(e)){let r=vX(e);if(r){t[n]=r,n++;continue}let i=yX(t,n);if(i){let r=e,a=t[i.closerIdx],o=n+1,s=i.closerIdx,c=t.slice(o,s),l=r.position,u=a.position,d={type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:hX(i),children:c,position:l&&u?{start:l.start,end:u.end}:void 0},f=i.closerIdx-n+1;t.splice(n,f,d),n++;continue}}n++}}function xX(){return e=>{Tj(e,e=>{`children`in e&&Array.isArray(e.children)&&bX(e)})}}const SX=/(?<!=)==(?=\S)([^\n]*?[^\s=])==(?!=)/g;function CX(e){return e.type===`strong`||e.type===`emphasis`||e.type===`delete`||e.type===`inlineCode`}function wX(e){return e.type===`text`||e.type===`inlineCode`?e.value.length>0?e.value.charAt(0):null:`children`in e&&Array.isArray(e.children)&&e.children.length>0?wX(e.children[0]):null}function TX(e){if(e.type===`text`||e.type===`inlineCode`)return e.value.length>0?e.value.slice(-1):null;if(`children`in e&&Array.isArray(e.children)&&e.children.length>0){let t=e.children;return TX(t[t.length-1])}return null}function EX(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type!==`text`){n++;continue}let r=e.value,i=-1;for(let e=0;e<=r.length-2;e++){if(r.charCodeAt(e)!==61||r.charCodeAt(e+1)!==61||e>0&&r.charCodeAt(e-1)===61)continue;let a;if(e+2<r.length)a=r.charAt(e+2);else{let e=t[n+1];if(!e)continue;a=wX(e)}if(!(a===null||/\s/.test(a))){i=e;break}}if(i===-1){n++;continue}let a=-1,o=-1,s=!1;for(let e=i+3;e<=r.length-2;e++){if(r.charCodeAt(e)!==61||r.charCodeAt(e+1)!==61)continue;let i=r.charAt(e-1);if(/[\s=]/.test(i))continue;let o;if(e+2<r.length)o=r.charAt(e+2);else{let e=t[n+1];o=e?e.type===`text`?e.value[0]??null:wX(e):null}if(o!==`=`){a=-2;break}}if(a===-2){n++;continue}for(let e=n+1;e<t.length;e++){let n=t[e];if(n.type===`text`){for(let r=0;r<=n.value.length-2;r++){if(n.value.charCodeAt(r)!==61||n.value.charCodeAt(r+1)!==61)continue;let i;if(r>0)i=n.value.charAt(r-1);else{let n=t[e-1];i=TX(n)}if(i===null||/[\s=]/.test(i))continue;let c;if(r+2<n.value.length)c=n.value.charAt(r+2);else{let n=t[e+1];c=n?n.type===`text`?n.value[0]??null:wX(n):null}if(c!==`=`){a=e,o=r,s=!0;break}}if(a>=0)break}else if(!CX(n))break}if(a<0){n++;continue}let c=t[a],l=r.slice(0,i),u=r.slice(i+2),d=c.value.slice(0,o),f=c.value.slice(o+2),p=[];u.length>0&&p.push({type:`text`,value:u});for(let e=n+1;e<a;e++)p.push(t[e]);if(d.length>0&&p.push({type:`text`,value:d}),!s){n++;continue}let m={type:`mark`,children:p},h=[];l.length>0&&h.push({type:`text`,value:l}),h.push(m),f.length>0&&h.push({type:`text`,value:f}),t.splice(n,a-n+1,...h),n+=(l.length>0?1:0)+1}}function DX(e){if(`children`in e&&Array.isArray(e.children)){EX(e);for(let t of e.children)DX(t)}}function OX(){return e=>{Tj(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`==`)===-1)return;SX.lastIndex=0;let i=[],a;for(;(a=SX.exec(r))!==null;)i.push(a);if(i.length===0)return;let o=[],s=0;for(let e of i){let t=e.index,n=t+e[0].length;if(t>s){let e={type:`text`,value:r.slice(s,t)};o.push(e)}let i={type:`mark`,children:[{type:`text`,value:e[1]}]};o.push(i),s=n}if(s<r.length){let e={type:`text`,value:r.slice(s)};o.push(e)}return n.children.splice(t,1,...o),[Sj,t+o.length]}),DX(e),Tj(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name!==`mark`)return;let r={type:`mark`,children:e.children??[]};return n.children.splice(t,1,r),t+1})}}function kX(){return e=>{Tj(e,`paragraph`,(e,t,n)=>{if(!n||t==null||e.children.length!==1)return;let r=e.children[0];if(!r||r.type!==`image`)return;let i=AX(r,e);n.children[t]=i})}}function AX(e,t){let n=[{type:`mdxJsxAttribute`,name:`src`,value:e.url}];typeof e.alt==`string`&&n.push({type:`mdxJsxAttribute`,name:`alt`,value:e.alt}),e.title&&n.push({type:`mdxJsxAttribute`,name:`title`,value:e.title});let r={type:`mdxJsxFlowElement`,name:`CommonMarkImage`,attributes:n,children:[]};return t.position&&(r.position=t.position),r}const jX=/^( {4}|\t)/;function MX(e){let t=e.split(`
399
- `),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!jX.test(e)))return!1;return n}function NX(e){return e.split(`
399
+ `;)r++;continue}}if(t[r]===`{`||t[r]===`}`){let e=0;for(let n=r-1;n>=0&&t[n]===`\\`;n--)e++;if(e%2==1)continue;t[r]===`{`?n.push(r):n.length>0&&n.pop()}}if(e.push(...n),e.length>0){let n=[...t];for(let t of e)n[t]=``;t=n.join(``)}}return t}function OY(e){return e.includes(``)||e.includes(``)||e.includes(``)||e.includes(``)||e.includes(``)}function kY(){return e=>{Tj(e,e=>{let t=e;typeof t.value==`string`&&OY(t.value)&&(t.value=AY(t.value)),typeof t.url==`string`&&OY(t.url)&&(t.url=AY(t.url)),typeof t.title==`string`&&OY(t.title)&&(t.title=AY(t.title)),typeof t.alt==`string`&&OY(t.alt)&&(t.alt=AY(t.alt))})}}function AY(e){return e.replaceAll(``,`<`).replaceAll(``,`>`).replaceAll(``,`:`).replaceAll(``,`@`).replaceAll(``,`{`)}const jY=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function MY(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n}function NY(e,t,n){return t.lastIndex=0,e.replace(t,(t,r)=>typeof r!=`number`||MY(e,r)%2==1?t:n(t))}function PY(e){return NY(e,jY,e=>`${e.slice(1,-1)}`)}const FY=RegExp(`([^]+)`,`g`);function IY(e){if(!e.includes(``))return{value:e,spans:[]};let t=[],n=``,r=0;FY.lastIndex=0;let i=FY.exec(e);for(;i!==null;){i.index>r&&(n+=e.slice(r,i.index));let a=`&${i[1]??``};`;t.push({offset:n.length,length:a.length,raw:a}),n+=a,r=i.index+i[0].length,i=FY.exec(e)}return r<e.length&&(n+=e.slice(r)),{value:n,spans:t}}function LY(){return e=>{Tj(e,e=>{let t=e;if(typeof t.value==`string`&&t.value.includes(``)){let{value:n,spans:r}=IY(t.value);if(t.value=n,e.type===`text`&&r.length>0){let t=e;t.data??={},t.data.entityRefSpans=r}}for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=IY(n).value)}})}}const RY=/\\</g;function zY(e){return NY(e,RY,e=>`${e.slice(1)}`)}function BY(){return e=>{Tj(e,e=>{let t=e;typeof t.value==`string`&&t.value.includes(``)&&(t.value=t.value.split(``).join(``));for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=n.split(``).join(``))}})}}const VY=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),HY={note:`note`,tip:`tip`,important:`important`,warning:`warning`,caution:`caution`,abstract:`abstract`,info:`info`,todo:`todo`,success:`success`,question:`question`,failure:`failure`,danger:`danger`,bug:`bug`,example:`example`,quote:`quote`,summary:`abstract`,tldr:`abstract`,check:`success`,done:`success`,help:`question`,faq:`question`,fail:`failure`,missing:`failure`,error:`danger`,cite:`quote`,idea:`tip`,hint:`tip`,warn:`warning`,attention:`warning`},UY=`ok-alert`,WY=RegExp(`(?:^|\\s)${UY}-(\\w+)(?:\\s|$)`),GY=/^>\s*\[!(\w+)\]([+-])?(?:\s+(.*?))?\s*$/i;function KY(e,t){if(t<0||t>=e.length)return null;let n=e.indexOf(`
400
+ `,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(GY);return r?{rawType:r[1],foldableMarker:r[2]===`+`||r[2]===`-`?r[2]:null,title:r[3]?.trim()||null}:null}function qY(e){if(e.data?.hName!==`div`)return null;let t=e.data?.hProperties?.class;if(typeof t!=`string`)return null;let n=t.match(WY);return n?n[1].toLowerCase():null}function JY(e){return HY[e.toLowerCase()]??null}function YY(e,t,n,r,i=null){let a=[{type:`mdxJsxAttribute`,name:`type`,value:t}];n&&a.push({type:`mdxJsxAttribute`,name:`title`,value:n}),i&&a.push({type:`mdxJsxAttribute`,name:`data-authored-as`,value:i}),r!==null&&(a.push({type:`mdxJsxAttribute`,name:`collapsible`,value:null}),r===`+`?a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}):a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}}));let o=e.children.slice(1),s=e.position?.start.line;return{type:`mdxJsxFlowElement`,name:`GFMCallout`,attributes:a,children:n&&o.length>0&&s!==void 0&&XY(o[0],s)?o.slice(1):o,position:e.position}}function XY(e,t){if(!e||typeof e!=`object`)return!1;let n=e;if(n.type!==`paragraph`)return!1;let r=n.position?.start?.line,i=n.position?.end?.line;return r===t&&i===t}function ZY(e){if(!e||typeof e!=`object`||e.type!==`paragraph`)return!1;let t=e.data?.hProperties?.class;return typeof t==`string`&&t.includes(`${UY}-title`)}function QY(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;Tj(e,`blockquote`,(e,t,r)=>{if(r===void 0||typeof t!=`number`)return;let i=qY(e);if(!i)return;let a=JY(i),o=null,s=null;e.position?.start?.offset!==void 0&&(s=KY(n,e.position.start.offset),s&&(o=s.title,a||=JY(s.rawType)));let c=a??`note`,l=s&&VY.has(c)?s.foldableMarker:null,u=(()=>{if(e.position?.start?.offset!==void 0){let t=KY(n,e.position.start.offset);if(t?.rawType)return t.rawType}return i})(),d=u.toLowerCase()===c?null:u;if(!ZY(e.children[0]))return;let f=YY(e,c,o,l,d);r.children[t]=f})}}const $Y={markers:`*`,classPrefix:UY,matchCaseSensitive:!1,icons:new Proxy({},{get:()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"></svg>`})},eX=/(?<!%)%%([^\n]*?[^\n%])%%(?!%)/g,tX=/<!--([\s\S]*?)-->/g;function nX(){return e=>{iX(e),Tj(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`%%`)===-1&&r.indexOf(`<!--`)===-1)return;let i=rX(r);if(i.length===0)return;let a=[],o=0;for(let e of i){e.start>o&&a.push({type:`text`,value:r.slice(o,e.start)});let t={type:`comment`,children:[{type:`text`,value:e.body}],data:{sourceForm:e.sourceForm}};a.push(t),o=e.end}return o<r.length&&a.push({type:`text`,value:r.slice(o)}),n.children.splice(t,1,...a),[Sj,t+a.length]})}}function rX(e){let t=[];eX.lastIndex=0;let n;for(;(n=eX.exec(e))!==null;)n[1].trim().length!==0&&t.push({start:n.index,end:n.index+n[0].length,body:n[1],sourceForm:`percent`});tX.lastIndex=0;let r;for(;(r=tX.exec(e))!==null;){let e=r[1].trim();e!==``&&t.push({start:r.index,end:r.index+r[0].length,body:e,sourceForm:`html`})}t.sort((e,t)=>e.start-t.start);let i=[],a=-1;for(let e of t)e.start<a||(i.push(e),a=e.end);return i}function iX(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type===`paragraph`){let r=aX(e);if(r!==null){let e=oX(r);if(e!==null){let r={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:e}]}],data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,1,r),n+=1;continue}let i=sX(r);if(i!==null){let e={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:i}]}],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}let i=cX(e);if(i!==null){let e={type:`commentBlock`,children:[i],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}let a=lX(e);if(a!==null){let e={type:`commentBlock`,children:[a],data:{sourceForm:`percent`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}if(e.type===`paragraph`&&dX(e)){let e=n+1;for(;e<t.length;){let n=t[e];if(n.type===`paragraph`&&dX(n))break;e+=1}if(e<t.length&&e>n+1){let r={type:`commentBlock`,children:t.slice(n+1,e),data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,e-n+1,r),n+=1;continue}}n+=1}}function aX(e){if(e.children.length!==1)return null;let t=e.children[0];return t.type===`text`?t.value:null}function oX(e){let t=e.match(/^%%\n((?:.|\n(?!\n))+?)\n%%$/);return t===null?null:t[1]}function sX(e){let t=e.trim();if(!t.startsWith(`<!--`)||!t.endsWith(`-->`))return null;let n=t.slice(4,-3);if(n.includes(`-->`)||n.includes(`<!--`))return null;let r=n.trim();return r===``?null:r}function cX(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`<!--`))return null;let i=n.value.trimEnd();if(!i.endsWith(`-->`))return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`text`)continue;let r=n.value;if(t===0){if(uX(r,`<!--`)>1||uX(r,`-->`)>0)return null}else if(t===e.children.length-1){if(uX(r,`<!--`)>0||uX(r,`-->`)>1)return null}else if(r.includes(`<!--`)||r.includes(`-->`))return null}let a=r.slice(4);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-3);o.endsWith(` `)&&(o=o.slice(0,-1));let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function lX(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`%%`)||r.startsWith(`%%%`))return null;let i=n.value.trimEnd();if(!i.endsWith(`%%`)||i.endsWith(`%%%`))return null;let a=r.slice(2);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-2);if(o.endsWith(` `)&&(o=o.slice(0,-1)),a.indexOf(`%%`)!==-1||o.indexOf(`%%`)!==-1)return null;for(let t=1;t<e.children.length-1;t++){let n=e.children[t];if(n.type===`text`&&n.value.indexOf(`%%`)!==-1)return null}if(!(e.children.slice(1,-1).some(e=>e.type===`text`?e.value.trim().length>0:!0)||a.trim().length>0||o.trim().length>0))return null;let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function uX(e,t){if(!t)return 0;let n=0,r=0;for(;;){let i=e.indexOf(t,r);if(i===-1)break;n+=1,r=i+t.length}return n}function dX(e){let t=aX(e);return t===null?!1:t.trim()===`%%`}const fX=/^<details(\s[^>]*)?>\s*<summary>([\s\S]*?)<\/summary>([\s\S]*?)<\/details>\s*$/,pX=/^<details(\s[^>]*)?>(?:\s*<summary>([\s\S]*?)<\/summary>)?[\s\S]*$/,mX=/^\s*<\/details>\s*$/;function hX(e){let t=!1,n=null,r=null;if(!e)return{defaultOpen:t,name:n,id:r};let i=/(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,a=i.exec(e);for(;a!==null;){let o=a[1].toLowerCase(),s=a[2]??a[3]??a[4]??null;o===`open`?t=!0:o===`name`?n=s:o===`id`&&(r=s),a=i.exec(e)}return{defaultOpen:t,name:n,id:r}}function gX(e){let t=[];return e.title!==null&&t.push({type:`mdxJsxAttribute`,name:`title`,value:e.title}),e.defaultOpen&&t.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}),e.name!==null&&t.push({type:`mdxJsxAttribute`,name:`name`,value:e.name}),e.id!==null&&t.push({type:`mdxJsxAttribute`,name:`id`,value:e.id}),t}function _X(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function vX(e){return e.children[0].value??``}function yX(e){if(!_X(e))return null;let t=vX(e).match(fX);if(!t)return null;let{defaultOpen:n,name:r,id:i}=hX(t[1]),a=t[2].trim()||null,o=t[3].trim(),s=o?[{type:`paragraph`,children:[{type:`text`,value:o}]}]:[];return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:gX({title:a,defaultOpen:n,name:r,id:i}),children:s,position:e.position}}function bX(e,t){let n=e[t];if(!_X(n))return null;let r=vX(n);if(!r.startsWith(`<details`)||r.includes(`</details>`))return null;let i=r.match(pX);if(!i)return null;let{defaultOpen:a,name:o,id:s}=hX(i[1]),c=i[2]?.trim()||null;for(let n=t+1;n<e.length;n++){let t=e[n];if(!_X(t))continue;let r=vX(t);if(mX.test(r))return{closerIdx:n,title:c,defaultOpen:a,name:o,id:s};if(r.includes(`</details>`))return null}return null}function xX(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(_X(e)){let r=yX(e);if(r){t[n]=r,n++;continue}let i=bX(t,n);if(i){let r=e,a=t[i.closerIdx],o=n+1,s=i.closerIdx,c=t.slice(o,s),l=r.position,u=a.position,d={type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:gX(i),children:c,position:l&&u?{start:l.start,end:u.end}:void 0},f=i.closerIdx-n+1;t.splice(n,f,d),n++;continue}}n++}}function SX(){return e=>{Tj(e,e=>{`children`in e&&Array.isArray(e.children)&&xX(e)})}}const CX=/(?<!=)==(?=\S)([^\n]*?[^\s=])==(?!=)/g;function wX(e){return e.type===`strong`||e.type===`emphasis`||e.type===`delete`||e.type===`inlineCode`}function TX(e){return e.type===`text`||e.type===`inlineCode`?e.value.length>0?e.value.charAt(0):null:`children`in e&&Array.isArray(e.children)&&e.children.length>0?TX(e.children[0]):null}function EX(e){if(e.type===`text`||e.type===`inlineCode`)return e.value.length>0?e.value.slice(-1):null;if(`children`in e&&Array.isArray(e.children)&&e.children.length>0){let t=e.children;return EX(t[t.length-1])}return null}function DX(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type!==`text`){n++;continue}let r=e.value,i=-1;for(let e=0;e<=r.length-2;e++){if(r.charCodeAt(e)!==61||r.charCodeAt(e+1)!==61||e>0&&r.charCodeAt(e-1)===61)continue;let a;if(e+2<r.length)a=r.charAt(e+2);else{let e=t[n+1];if(!e)continue;a=TX(e)}if(!(a===null||/\s/.test(a))){i=e;break}}if(i===-1){n++;continue}let a=-1,o=-1,s=!1;for(let e=i+3;e<=r.length-2;e++){if(r.charCodeAt(e)!==61||r.charCodeAt(e+1)!==61)continue;let i=r.charAt(e-1);if(/[\s=]/.test(i))continue;let o;if(e+2<r.length)o=r.charAt(e+2);else{let e=t[n+1];o=e?e.type===`text`?e.value[0]??null:TX(e):null}if(o!==`=`){a=-2;break}}if(a===-2){n++;continue}for(let e=n+1;e<t.length;e++){let n=t[e];if(n.type===`text`){for(let r=0;r<=n.value.length-2;r++){if(n.value.charCodeAt(r)!==61||n.value.charCodeAt(r+1)!==61)continue;let i;if(r>0)i=n.value.charAt(r-1);else{let n=t[e-1];i=EX(n)}if(i===null||/[\s=]/.test(i))continue;let c;if(r+2<n.value.length)c=n.value.charAt(r+2);else{let n=t[e+1];c=n?n.type===`text`?n.value[0]??null:TX(n):null}if(c!==`=`){a=e,o=r,s=!0;break}}if(a>=0)break}else if(!wX(n))break}if(a<0){n++;continue}let c=t[a],l=r.slice(0,i),u=r.slice(i+2),d=c.value.slice(0,o),f=c.value.slice(o+2),p=[];u.length>0&&p.push({type:`text`,value:u});for(let e=n+1;e<a;e++)p.push(t[e]);if(d.length>0&&p.push({type:`text`,value:d}),!s){n++;continue}let m={type:`mark`,children:p},h=[];l.length>0&&h.push({type:`text`,value:l}),h.push(m),f.length>0&&h.push({type:`text`,value:f}),t.splice(n,a-n+1,...h),n+=(l.length>0?1:0)+1}}function OX(e){if(`children`in e&&Array.isArray(e.children)){DX(e);for(let t of e.children)OX(t)}}function kX(){return e=>{Tj(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`==`)===-1)return;CX.lastIndex=0;let i=[],a;for(;(a=CX.exec(r))!==null;)i.push(a);if(i.length===0)return;let o=[],s=0;for(let e of i){let t=e.index,n=t+e[0].length;if(t>s){let e={type:`text`,value:r.slice(s,t)};o.push(e)}let i={type:`mark`,children:[{type:`text`,value:e[1]}]};o.push(i),s=n}if(s<r.length){let e={type:`text`,value:r.slice(s)};o.push(e)}return n.children.splice(t,1,...o),[Sj,t+o.length]}),OX(e),Tj(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name!==`mark`)return;let r={type:`mark`,children:e.children??[]};return n.children.splice(t,1,r),t+1})}}function AX(){return e=>{Tj(e,`paragraph`,(e,t,n)=>{if(!n||t==null||e.children.length!==1)return;let r=e.children[0];if(!r||r.type!==`image`)return;let i=jX(r,e);n.children[t]=i})}}function jX(e,t){let n=[{type:`mdxJsxAttribute`,name:`src`,value:e.url}];typeof e.alt==`string`&&n.push({type:`mdxJsxAttribute`,name:`alt`,value:e.alt}),e.title&&n.push({type:`mdxJsxAttribute`,name:`title`,value:e.title});let r={type:`mdxJsxFlowElement`,name:`CommonMarkImage`,attributes:n,children:[]};return t.position&&(r.position=t.position),r}const MX=/^( {4}|\t)/;function NX(e){let t=e.split(`
401
+ `),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!MX.test(e)))return!1;return n}function PX(e){return e.split(`
400
402
  `).map(e=>e.length===0?e:e.startsWith(` `)?e.slice(4):e.startsWith(` `)?e.slice(1):e).join(`
401
- `)}function PX(e,t){let n=e.position;if(!n||typeof n.start.offset!=`number`||typeof n.end.offset!=`number`)return null;let r=n.start.offset,i=n.end.offset;if(r<0||i>t.length||r>=i)return null;let a=r;for(;a>0&&t[a-1]!==`
402
- `;)a--;if(a===r)return null;let o=t.slice(a,r);if(!jX.test(o))return null;let s=t.slice(a,i);if(!MX(s))return null;let c={start:{line:n.start.line,column:1,offset:a},end:n.end};return{type:`code`,lang:null,meta:null,value:NX(s).replace(/\n+$/,``),position:c,data:{sourceStyle:`indented`}}}const FX=function(){return(e,t)=>{let n=String(t.value??``);n&&Tj(e,`paragraph`,(e,t,r)=>{if(!r||r.type!==`root`||t==null)return;let i=r.children[t-1];if(i&&i.type===`list`)return;let a=PX(e,n);a&&(r.children[t]=a)})}};function IX(e,t,n){let r={type:`mdxJsxFlowElement`,name:e,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t}],children:[]};return n&&(r.position=n),r}function LX(){return e=>{Tj(e,`math`,(e,t,n)=>{if(!n||t==null)return;let r=IX(`DollarMath`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r}),Tj(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`math`)return;let r=IX(`MathFence`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}const RX=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g;function zX(e){let t=[],n=!1;for(let r of e.children){if(r.type!==`text`){t.push(r);continue}let e=r.value;RX.lastIndex=0;let i=[],a=0;for(;;){let t=RX.exec(e);if(t===null)break;let r=t[0],o=t[1],s=t.index;s>a&&i.push({type:`text`,value:e.slice(a,s)});let c={type:`link`,url:o,title:null,children:[{type:`text`,value:o}],data:{sourceStyle:`autolink`}};i.push(c),a=s+r.length,n=!0}i.length===0?t.push(r):(a<e.length&&i.push({type:`text`,value:e.slice(a)}),t.push(...i))}n&&(e.children=t)}function BX(e,t){if(e.children.length===0)return;let n=e.children[0];if(n.type!==`yaml`||(n.value??``).trim()!==``)return;let r=n.position?.start?.offset;if(r!==0)return;let i=n.position?.end?.offset;if(typeof i!=`number`)return;let a=typeof t.value==`string`?t.value:``;if(!a)return;let o=a.slice(r,i).split(`
403
- `),s=/^-{3,}\s*$/,c=o.filter(e=>s.test(e));if(c.length===0)return;let l=c.map(e=>({type:`thematicBreak`,data:{sourceRaw:e.replace(/\s+$/,``)}}));if(l.length>0){let e=c[0].length;l[0].position={start:{line:1,column:1,offset:0},end:{line:1,column:e+1,offset:e}}}e.children.splice(0,1,...l)}const VX=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`.split(``));function HX(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`&&r+1<e.length&&e[r+1]===`|`){n+=`${i}|`,r++;continue}if(i===`|`){t.push(n),n=``;continue}n+=i}return t.push(n),t}function UX(e,t,n=!1){if(!t)return;let r=e.position;if(!r||typeof r.start?.offset!=`number`){n&&console.warn(`[position-slice] node type=${e.type} has no position — fidelity defaults apply`);return}let i=r.start.offset,a=r.end?.offset??i;if(i<0||a>t.length){n&&console.warn(`[position-slice] node type=${e.type} position out of bounds: start=${i} end=${a} sourceLen=${t.length}`);return}switch(e.data??={},e.type){case`text`:{let n=t.slice(i,a),r=e.value??``;if(n.length>r.length&&n.includes(`\\`)){let t=[],i=0,a=0;for(;i<n.length&&a<r.length;)n[i]===`\\`&&i+1<n.length&&VX.has(n[i+1])&&r[a]===n[i+1]?(t.push({offset:a,char:n[i+1]}),i+=2,a+=1):(i++,a++);t.length>0&&(e.data.escapedChars=t)}n.endsWith(`\\`)&&r.endsWith(`\\`)&&(e.data.sourceRaw=n);break}case`emphasis`:{let n=t[i];(n===`*`||n===`_`)&&(e.data.sourceDelimiter=n);break}case`strong`:{let n=t.slice(i,i+2);(n===`**`||n===`__`)&&(e.data.sourceDelimiter=n);break}case`heading`:{let n=t[i],r=t.slice(i,a);if(n===`#`){e.data.sourceStyle=`atx`;let t=/^.*?[ \t](#+)[ \t]*$/.exec(r);t&&(e.data.sourceTrailingHashes=t[1].length)}else{let t=/\n(=+)[ \t]*$/.exec(r),n=/\n(-+)[ \t]*$/.exec(r),i=t??n;i?(e.data.sourceStyle=`setext`,e.data.sourceUnderlineLength=i[1].length):e.data.sourceStyle=`atx`}break}case`blockquote`:{let n=i;for(;n>0&&t[n-1]!==`
403
+ `)}function FX(e,t){let n=e.position;if(!n||typeof n.start.offset!=`number`||typeof n.end.offset!=`number`)return null;let r=n.start.offset,i=n.end.offset;if(r<0||i>t.length||r>=i)return null;let a=r;for(;a>0&&t[a-1]!==`
404
+ `;)a--;if(a===r)return null;let o=t.slice(a,r);if(!MX.test(o))return null;let s=t.slice(a,i);if(!NX(s))return null;let c={start:{line:n.start.line,column:1,offset:a},end:n.end};return{type:`code`,lang:null,meta:null,value:PX(s).replace(/\n+$/,``),position:c,data:{sourceStyle:`indented`}}}const IX=function(){return(e,t)=>{let n=String(t.value??``);n&&Tj(e,`paragraph`,(e,t,r)=>{if(!r||r.type!==`root`||t==null)return;let i=r.children[t-1];if(i&&i.type===`list`)return;let a=FX(e,n);a&&(r.children[t]=a)})}};function LX(e,t,n){let r={type:`mdxJsxFlowElement`,name:e,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t}],children:[]};return n&&(r.position=n),r}function RX(){return e=>{Tj(e,`math`,(e,t,n)=>{if(!n||t==null)return;let r=LX(`DollarMath`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r}),Tj(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`math`)return;let r=LX(`MathFence`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}const zX=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g;function BX(e){let t=[],n=!1;for(let r of e.children){if(r.type!==`text`){t.push(r);continue}let e=r.value;zX.lastIndex=0;let i=[],a=0;for(;;){let t=zX.exec(e);if(t===null)break;let r=t[0],o=t[1],s=t.index;s>a&&i.push({type:`text`,value:e.slice(a,s)});let c={type:`link`,url:o,title:null,children:[{type:`text`,value:o}],data:{sourceStyle:`autolink`}};i.push(c),a=s+r.length,n=!0}i.length===0?t.push(r):(a<e.length&&i.push({type:`text`,value:e.slice(a)}),t.push(...i))}n&&(e.children=t)}function VX(e,t){if(e.children.length===0)return;let n=e.children[0];if(n.type!==`yaml`||(n.value??``).trim()!==``)return;let r=n.position?.start?.offset;if(r!==0)return;let i=n.position?.end?.offset;if(typeof i!=`number`)return;let a=typeof t.value==`string`?t.value:``;if(!a)return;let o=a.slice(r,i).split(`
405
+ `),s=/^-{3,}\s*$/,c=o.filter(e=>s.test(e));if(c.length===0)return;let l=c.map(e=>({type:`thematicBreak`,data:{sourceRaw:e.replace(/\s+$/,``)}}));if(l.length>0){let e=c[0].length;l[0].position={start:{line:1,column:1,offset:0},end:{line:1,column:e+1,offset:e}}}e.children.splice(0,1,...l)}const HX=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`.split(``));function UX(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`&&r+1<e.length&&e[r+1]===`|`){n+=`${i}|`,r++;continue}if(i===`|`){t.push(n),n=``;continue}n+=i}return t.push(n),t}function WX(e,t,n=!1){if(!t)return;let r=e.position;if(!r||typeof r.start?.offset!=`number`){n&&console.warn(`[position-slice] node type=${e.type} has no position — fidelity defaults apply`);return}let i=r.start.offset,a=r.end?.offset??i;if(i<0||a>t.length){n&&console.warn(`[position-slice] node type=${e.type} position out of bounds: start=${i} end=${a} sourceLen=${t.length}`);return}switch(e.data??={},e.type){case`text`:{let n=t.slice(i,a),r=e.value??``;if(n.length>r.length&&n.includes(`\\`)){let t=[],i=0,a=0;for(;i<n.length&&a<r.length;)n[i]===`\\`&&i+1<n.length&&HX.has(n[i+1])&&r[a]===n[i+1]?(t.push({offset:a,char:n[i+1]}),i+=2,a+=1):(i++,a++);t.length>0&&(e.data.escapedChars=t)}n.endsWith(`\\`)&&r.endsWith(`\\`)&&(e.data.sourceRaw=n);break}case`emphasis`:{let n=t[i];(n===`*`||n===`_`)&&(e.data.sourceDelimiter=n);break}case`strong`:{let n=t.slice(i,i+2);(n===`**`||n===`__`)&&(e.data.sourceDelimiter=n);break}case`heading`:{let n=t[i],r=t.slice(i,a);if(n===`#`){e.data.sourceStyle=`atx`;let t=/^.*?[ \t](#+)[ \t]*$/.exec(r);t&&(e.data.sourceTrailingHashes=t[1].length)}else{let t=/\n(=+)[ \t]*$/.exec(r),n=/\n(-+)[ \t]*$/.exec(r),i=t??n;i?(e.data.sourceStyle=`setext`,e.data.sourceUnderlineLength=i[1].length):e.data.sourceStyle=`atx`}break}case`blockquote`:{let n=i;for(;n>0&&t[n-1]!==`
404
406
  `;)n--;let r=!1;for(let e=n;e<i;e++)if(t[e]===`>`){r=!0;break}let o=t.slice(i,a).split(`
405
407
  `),s=[];for(let e=0;e<o.length;e++){let t=o[e];if(t.length===0)continue;if(r&&e>0)break;let n=t.replace(/^ {1,3}/,``);if(n[0]!==`>`||n.slice(1).trimEnd()===``)continue;let i=n[1];i===` `||i===` `?s.push(`single`):s.push(`none`)}s.length>0&&(e.data.sourceMarkerSpacings=s);break}case`list`:{let n=e.children?.[0];if(n?.position?.start?.offset!=null){let r=n.position.start.offset;if(r>=0&&r<t.length){let n=t[r];if(!e.ordered&&(n===`-`||n===`*`||n===`+`))e.data.bulletMarker=n;else if(e.ordered){let n=t.slice(r,Math.min(r+10,t.length)).match(/^\d+([.)])/);n&&(e.data.listMarkerDelimiter=n[1])}}}break}case`code`:{let n=t[i];if(n==="`"||n===`~`){e.data.sourceStyle=`fenced`,e.data.sourceFenceChar=n;let r=0;for(;i+r<t.length&&t[i+r]===n;)r++;r>=3&&(e.data.sourceFenceLength=r)}else e.data.sourceStyle=`indented`;break}case`inlineCode`:{let n=t[i];if(n==="`"||n===`~`){e.data.sourceFenceChar=n;let r=0;for(;i+r<t.length&&t[i+r]===n;)r++;r>=1&&(e.data.sourceFenceLength=r)}break}case`thematicBreak`:e.data.sourceRaw=t.slice(i,a);break;case`table`:{let n=t.slice(i,a),r=n.indexOf(`
406
408
  `);if(r===-1)break;let o=n.slice(r+1),s=o.indexOf(`
407
409
  `),c=(s===-1?o:o.slice(0,s)).trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`),l=[];for(let e of c){let t=e.match(/-/g);l.push(t?t.length:0)}l.some(e=>e>0)&&(e.data.sourceDashCounts=l);for(let n of e.children??[]){if(n.type!==`tableRow`||!n.position)continue;let e=n.position.start.offset,r=n.position.end.offset;if(typeof e!=`number`||typeof r!=`number`)continue;let i=t.slice(e,r),a=i.indexOf(`
408
- `);a!==-1&&(i=i.slice(0,a));let o=HX(i);o.length>0&&o[0]===``&&i.startsWith(`|`)&&o.shift(),o.length>0&&o[o.length-1]===``&&i.endsWith(`|`)&&o.pop();let s=n.children??[],c=Math.min(s.length,o.length);for(let e=0;e<c;e++){let t=s[e];if(t.type!==`tableCell`)continue;let n=o[e],r=0;for(;r<n.length&&n[r]===` `;)r++;let i=0;for(;i<n.length-r&&n[n.length-1-i]===` `;)i++;t.data||={},t.data.sourcePadding={left:r,right:i}}}break}case`link`:case`linkReference`:if(`children`in e&&e.children.length===0&&(e.data.sourceRaw=t.slice(i,a)),e.type===`link`){let n=t[i];if(n!==`[`&&n!==`<`&&!e.title)e.data.sourceStyle=`gfm-autolink`;else if(n===`[`){let n=t.slice(i,a),r=n.lastIndexOf(`](`);if(r!==-1){let t=r+2;for(;t<n.length&&(n[t]===` `||n[t]===` `);)t++;if(n[t]===`<`&&(e.data.sourceUrlForm=`angle-bracketed`),e.title!==void 0&&e.title!==null&&n[n.length-1]===`)`){let t=n.length-2;for(;t>r+1&&(n[t]===` `||n[t]===` `||n[t]===`
410
+ `);a!==-1&&(i=i.slice(0,a));let o=UX(i);o.length>0&&o[0]===``&&i.startsWith(`|`)&&o.shift(),o.length>0&&o[o.length-1]===``&&i.endsWith(`|`)&&o.pop();let s=n.children??[],c=Math.min(s.length,o.length);for(let e=0;e<c;e++){let t=s[e];if(t.type!==`tableCell`)continue;let n=o[e],r=0;for(;r<n.length&&n[r]===` `;)r++;let i=0;for(;i<n.length-r&&n[n.length-1-i]===` `;)i++;t.data||={},t.data.sourcePadding={left:r,right:i}}}break}case`link`:case`linkReference`:if(`children`in e&&e.children.length===0&&(e.data.sourceRaw=t.slice(i,a)),e.type===`link`){let n=t[i];if(n!==`[`&&n!==`<`&&!e.title)e.data.sourceStyle=`gfm-autolink`;else if(n===`[`){let n=t.slice(i,a),r=n.lastIndexOf(`](`);if(r!==-1){let t=r+2;for(;t<n.length&&(n[t]===` `||n[t]===` `);)t++;if(n[t]===`<`&&(e.data.sourceUrlForm=`angle-bracketed`),e.title!==void 0&&e.title!==null&&n[n.length-1]===`)`){let t=n.length-2;for(;t>r+1&&(n[t]===` `||n[t]===` `||n[t]===`
409
411
  `);)t--;n[t]===`"`?e.data.sourceTitleMarker=`double`:n[t]===`'`?e.data.sourceTitleMarker=`single`:n[t]===`)`&&(e.data.sourceTitleMarker=`paren`)}}}}break;case`definition`:{let n=t.slice(i,a);if(e.data.sourceLayout=n.includes(`
410
- `)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(i,a);break;case`break`:t.slice(i,a).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}function WX(){return RegExp(`(^|\\s)#([a-zA-Z][\\w/-]*)`,`g`)}const GX=WX();function KX(e,t){if(t<=0||e[t-1]!==`\\`)return!1;let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function qX(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=typeof i.position?.start?.offset==`number`?i.position?.start?.offset??0:0;GX.lastIndex=0;let o=[],s=0;for(;;){let n=GX.exec(e);if(n===null)break;let i=n[1]??``,c=n[2]??``,l=n.index+i.length;if(t&&a>=0){let n=a,r=0,i=-1;for(;r<=l&&n<t.length;){let a=t[n]===`\\`&&n+1<t.length&&e[r]===t[n+1],o=a?n+1:n;if(r===l){i=o;break}n=a?n+2:n+1,r+=1}if(i>=0&&KX(t,i))continue}l>s&&o.push({type:`text`,value:e.slice(s,l)});let u={type:`tag`,value:c};o.push(u),s=l+1+c.length,r=!0}o.length===0?n.push(i):(s<e.length&&o.push({type:`text`,value:e.slice(s)}),n.push(...o))}r&&(e.children=n)}const JX=new Set(`root.paragraph.heading.text.emphasis.strong.blockquote.list.listItem.code.inlineCode.link.image.linkReference.imageReference.definition.html.thematicBreak.break.yaml.toml.table.tableRow.tableCell.delete.footnoteDefinition.footnoteReference.mdxFlowExpression.mdxJsxFlowElement.mdxJsxTextElement.mdxTextExpression.wikiLink.wikiLinkEmbed.tag.math.inlineMath.mark.comment.commentBlock.rawMdxFallbackMdast`.split(`.`));function YX(e,t){if(!e||typeof e!=`object`)return null;if(typeof e.offset==`number`)return e.offset>=0&&e.offset<=t.length?e.offset:null;let{line:n,column:r}=e;if(typeof n!=`number`||typeof r!=`number`||n<1||r<1)return null;let i=0;for(let e=1;e<n;e++){let e=t.indexOf(`
412
+ `)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(i,a);break;case`break`:t.slice(i,a).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}function GX(){return RegExp(`(^|\\s)#([a-zA-Z][\\w/-]*)`,`g`)}const KX=GX();function qX(e,t){if(t<=0||e[t-1]!==`\\`)return!1;let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function JX(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=typeof i.position?.start?.offset==`number`?i.position?.start?.offset??0:0;KX.lastIndex=0;let o=[],s=0;for(;;){let n=KX.exec(e);if(n===null)break;let i=n[1]??``,c=n[2]??``,l=n.index+i.length;if(t&&a>=0){let n=a,r=0,i=-1;for(;r<=l&&n<t.length;){let a=t[n]===`\\`&&n+1<t.length&&e[r]===t[n+1],o=a?n+1:n;if(r===l){i=o;break}n=a?n+2:n+1,r+=1}if(i>=0&&qX(t,i))continue}l>s&&o.push({type:`text`,value:e.slice(s,l)});let u={type:`tag`,value:c};o.push(u),s=l+1+c.length,r=!0}o.length===0?n.push(i):(s<e.length&&o.push({type:`text`,value:e.slice(s)}),n.push(...o))}r&&(e.children=n)}const YX=new Set(`root.paragraph.heading.text.emphasis.strong.blockquote.list.listItem.code.inlineCode.link.image.linkReference.imageReference.definition.html.thematicBreak.break.yaml.toml.table.tableRow.tableCell.delete.footnoteDefinition.footnoteReference.mdxFlowExpression.mdxJsxFlowElement.mdxJsxTextElement.mdxTextExpression.wikiLink.wikiLinkEmbed.tag.math.inlineMath.mark.comment.commentBlock.rawMdxFallbackMdast`.split(`.`));function XX(e,t){if(!e||typeof e!=`object`)return null;if(typeof e.offset==`number`)return e.offset>=0&&e.offset<=t.length?e.offset:null;let{line:n,column:r}=e;if(typeof n!=`number`||typeof r!=`number`||n<1||r<1)return null;let i=0;for(let e=1;e<n;e++){let e=t.indexOf(`
411
413
  `,i);if(e===-1)return null;i=e+1}let a=t.indexOf(`
412
- `,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function XX(e,t){if(!e)return null;let n=YX(e.start,t),r=YX(e.end,t);return n===null||r===null||r<n?null:t.slice(n,r)}function ZX(e,t){let n=XX(e.position,t);return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:n??``,unresolvedPosition:n===null,position:e.position}}function QX(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;BX(e,t);let r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;Tj(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!JX.has(e.type)){let r=ZX(e,n);return i.children[t]=r,Sj}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(zX(t),qX(t,n))}if(UX(e,n,r),e.type===`heading`&&i!==void 0&&typeof t==`number`&&e.data?.sourceStyle===`setext`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function $X(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function eZ(){return e=>{Tj(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=$X(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function tZ(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const nZ=(e,t)=>{if(tZ(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},rZ=VB(),iZ=aB(),aZ=oB();function oZ(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===rZ)||t.push(rZ);let n=e.fromMarkdownExtensions;n.some(e=>e===iZ)||n.push(iZ);let r=e.toMarkdownExtensions;r.some(e=>e===aZ)||r.push(aZ)}const sZ=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function cZ(){return e=>{Tj(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`$`)===-1)return;sZ.lastIndex=0;let i=[],a;for(;(a=sZ.exec(r))!==null;)i.push(a);if(i.length===0)return;let o=[],s=0;for(let e of i){let t=e.index,n=t+e[0].length;if(t>s){let e={type:`text`,value:r.slice(s,t)};o.push(e)}let i={type:`inlineMath`,value:e[1]};o.push(i),s=n}if(s<r.length){let e={type:`text`,value:r.slice(s)};o.push(e)}return n.children.splice(t,1,...o),[Sj,t+o.length]})}}const lZ={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function uZ(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===lZ)||e.toMarkdownExtensions.push(lZ)}const dZ={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),i++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},fZ={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),i++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function pZ(){return{text:{91:dZ,33:fZ}}}function mZ(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function hZ(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function gZ(e){return e.stack[e.stack.length-1]}function _Z(e){let t=gZ(this);t.data.target=this.sliceSerialize(e).trim()}function vZ(e){let t=gZ(this),n=this.sliceSerialize(e).trim();t.data.anchor=n.length?n:null}function yZ(e){let t=gZ(this),n=this.sliceSerialize(e).trim();t.data.alias=n.length?n:null}function bZ(e){let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function xZ(e){bZ(gZ(this)),this.exit(e)}function SZ(e){bZ(gZ(this)),this.exit(e)}const CZ={enter:{wikiLink:mZ,wikiLinkEmbed:hZ},exit:{wikiLinkTarget:_Z,wikiLinkAnchor:vZ,wikiLinkAlias:yZ,wikiLink:xZ,wikiLinkEmbed:SZ}},wZ={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`},wikiLinkEmbed:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`![[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`}},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},TZ=pZ();function EZ(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===TZ)||e.micromarkExtensions.push(TZ),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===CZ)||e.fromMarkdownExtensions.push(CZ),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===wZ)||e.toMarkdownExtensions.push(wZ)}function DZ(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const OZ=[{name:`remark-parse`,plugin:yz},{name:`remark-frontmatter`,plugin:vR,options:[`yaml`]},{name:`remark-mdx-agnostic`,plugin:oZ},{name:`remark-gfm`,plugin:mL},{name:`remark-math`,plugin:PR,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:EZ},{name:`remark-github-alerts`,plugin:SR,options:QY},{name:`callout-transformer`,plugin:ZY},{name:`restore-from-mdx`,plugin:OY},{name:`restore-entity-refs`,plugin:IY},{name:`restore-backslash-escapes`,plugin:zY},{name:`details-accordion-promoter`,plugin:xX},{name:`image-promoter`,plugin:kX},{name:`indented-code-promoter`,plugin:FX},{name:`math-promoter`,plugin:LX},{name:`single-dollar-math-promoter`,plugin:cZ},{name:`highlight-promoter`,plugin:OX},{name:`mermaid-promoter`,plugin:eZ},{name:`comment-promoter`,plugin:tX},{name:`merged-post-parse-walker`,plugin:QX},{name:`ensure-non-empty-doc`,plugin:()=>DZ}];function kZ(e){let t=wL();for(let e of OZ)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(JL,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function AZ(e){let t=wL().use(vR,[`yaml`]).use(mL,{tablePipeAlign:!1}).use(PR,{singleDollarTextMath:!1}).use(oZ).use(EZ).use(uZ).use(hL,{bullet:`-`,fences:!0,rule:`-`,join:[nZ],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function jZ(e,t){let n=new XA(NY(EY(RY(e)))),r=t.parse(n);n.value=e;let i=t.runSync(r,n);return t.stringify(i)}function MZ(e,t){let n=new XA(NY(EY(RY(e)))),r=t.parse(n);return n.value=e,t.runSync(r,n)}function NZ(e,t,n){let r=XL(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});return String(t.stringify(r))}function PZ(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function FZ(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function IZ(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(!(e===``||e===`.`)){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function LZ(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!AK(e))return e;let n=IZ(FZ(t),e);return n===``||n===`..`||n.startsWith(`../`)?(PZ()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}const RZ={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&ZK(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;if(e.data?.escapedChars?.length){let t=e.value??``,i=e.data.escapedChars,a=``,o=0;for(let{offset:e,char:s}of i)e>o&&(a+=WZ(n,t.slice(o,e),r)),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=WZ(n,t.slice(o),r)),a}return WZ(n,(e.value??``).replaceAll(`\xA0`,` `),r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:VZ(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(BZ(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`![`);s+=i.move(n.safe(e.alt??``,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(VZ(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
413
- `:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(VZ(d)),e()}if(e.title){let t=i===`multiline`?`
414
- `:` `;l+=s.move(BZ(e.title,a,t))}return o(),l},thematicBreak(e,t,n){let r=e.data?.sourceRaw;return Array.isArray(n?.indexStack)&&n.indexStack.length===1&&n.indexStack[0]===0&&(!r||/^-[-\s]*-\s*$/.test(r))?`***`:r??`---`},break(e){return e.data?.sourceStyle===`backslash`?`\\
414
+ `,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function ZX(e,t){if(!e)return null;let n=XX(e.start,t),r=XX(e.end,t);return n===null||r===null||r<n?null:t.slice(n,r)}function QX(e,t){let n=ZX(e.position,t);return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:n??``,unresolvedPosition:n===null,position:e.position}}function $X(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;VX(e,t);let r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;Tj(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!YX.has(e.type)){let r=QX(e,n);return i.children[t]=r,Sj}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(BX(t),JX(t,n))}if(WX(e,n,r),e.type===`heading`&&i!==void 0&&typeof t==`number`&&e.data?.sourceStyle===`setext`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function eZ(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function tZ(){return e=>{Tj(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=eZ(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function nZ(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const rZ=(e,t)=>{if(nZ(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},iZ=VB(),aZ=aB(),oZ=oB();function sZ(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===iZ)||t.push(iZ);let n=e.fromMarkdownExtensions;n.some(e=>e===aZ)||n.push(aZ);let r=e.toMarkdownExtensions;r.some(e=>e===oZ)||r.push(oZ)}const cZ=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function lZ(){return e=>{Tj(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`$`)===-1)return;cZ.lastIndex=0;let i=[],a;for(;(a=cZ.exec(r))!==null;)i.push(a);if(i.length===0)return;let o=[],s=0;for(let e of i){let t=e.index,n=t+e[0].length;if(t>s){let e={type:`text`,value:r.slice(s,t)};o.push(e)}let i={type:`inlineMath`,value:e[1]};o.push(i),s=n}if(s<r.length){let e={type:`text`,value:r.slice(s)};o.push(e)}return n.children.splice(t,1,...o),[Sj,t+o.length]})}}const uZ={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function dZ(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===uZ)||e.toMarkdownExtensions.push(uZ)}const fZ={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),i++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},pZ={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),i++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function mZ(){return{text:{91:fZ,33:pZ}}}function hZ(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function gZ(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function _Z(e){return e.stack[e.stack.length-1]}function vZ(e){let t=_Z(this);t.data.target=this.sliceSerialize(e).trim()}function yZ(e){let t=_Z(this),n=this.sliceSerialize(e).trim();t.data.anchor=n.length?n:null}function bZ(e){let t=_Z(this),n=this.sliceSerialize(e).trim();t.data.alias=n.length?n:null}function xZ(e){let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function SZ(e){xZ(_Z(this)),this.exit(e)}function CZ(e){xZ(_Z(this)),this.exit(e)}const wZ={enter:{wikiLink:hZ,wikiLinkEmbed:gZ},exit:{wikiLinkTarget:vZ,wikiLinkAnchor:yZ,wikiLinkAlias:bZ,wikiLink:SZ,wikiLinkEmbed:CZ}},TZ={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`},wikiLinkEmbed:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`![[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`}},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},EZ=mZ();function DZ(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===EZ)||e.micromarkExtensions.push(EZ),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===wZ)||e.fromMarkdownExtensions.push(wZ),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===TZ)||e.toMarkdownExtensions.push(TZ)}function OZ(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const kZ=[{name:`remark-parse`,plugin:yz},{name:`remark-frontmatter`,plugin:vR,options:[`yaml`]},{name:`remark-mdx-agnostic`,plugin:sZ},{name:`remark-gfm`,plugin:mL},{name:`remark-math`,plugin:PR,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:DZ},{name:`remark-github-alerts`,plugin:SR,options:$Y},{name:`callout-transformer`,plugin:QY},{name:`restore-from-mdx`,plugin:kY},{name:`restore-entity-refs`,plugin:LY},{name:`restore-backslash-escapes`,plugin:BY},{name:`details-accordion-promoter`,plugin:SX},{name:`image-promoter`,plugin:AX},{name:`indented-code-promoter`,plugin:IX},{name:`math-promoter`,plugin:RX},{name:`single-dollar-math-promoter`,plugin:lZ},{name:`highlight-promoter`,plugin:kX},{name:`mermaid-promoter`,plugin:tZ},{name:`comment-promoter`,plugin:nX},{name:`merged-post-parse-walker`,plugin:$X},{name:`ensure-non-empty-doc`,plugin:()=>OZ}];function AZ(e){let t=wL();for(let e of kZ)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(JL,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function jZ(e){let t=wL().use(vR,[`yaml`]).use(mL,{tablePipeAlign:!1}).use(PR,{singleDollarTextMath:!1}).use(sZ).use(DZ).use(dZ).use(hL,{bullet:`-`,fences:!0,rule:`-`,join:[rZ],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function MZ(e,t){let n=new XA(PY(DY(zY(e)))),r=t.parse(n);n.value=e;let i=t.runSync(r,n);return t.stringify(i)}function NZ(e,t){let n=new XA(PY(DY(zY(e)))),r=t.parse(n);return n.value=e,t.runSync(r,n)}function PZ(e,t,n){let r=XL(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});return String(t.stringify(r))}function FZ(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function IZ(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function LZ(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(!(e===``||e===`.`)){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function RZ(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!jK(e))return e;let n=LZ(IZ(t),e);return n===``||n===`..`||n.startsWith(`../`)?(FZ()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}const zZ={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&QK(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;if(e.data?.escapedChars?.length){let t=e.value??``,i=e.data.escapedChars,a=``,o=0;for(let{offset:e,char:s}of i)e>o&&(a+=GZ(n,t.slice(o,e),r)),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=GZ(n,t.slice(o),r)),a}return GZ(n,(e.value??``).replaceAll(`\xA0`,` `),r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:HZ(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(VZ(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`![`);s+=i.move(n.safe(e.alt??``,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(HZ(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
415
+ `:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(HZ(d)),e()}if(e.title){let t=i===`multiline`?`
416
+ `:` `;l+=s.move(VZ(e.title,a,t))}return o(),l},thematicBreak(e,t,n){let r=e.data?.sourceRaw;return Array.isArray(n?.indexStack)&&n.indexStack.length===1&&n.indexStack[0]===0&&(!r||/^-[-\s]*-\s*$/.test(r))?`***`:r??`---`},break(e){return e.data?.sourceStyle===`backslash`?`\\
415
417
  `:`
416
418
  `},code(e){let t=e.value??``;if(e.data?.sourceStyle===`indented`)return t.split(`
417
419
  `).map(e=>e.length>0?` ${e}`:e).join(`
@@ -424,7 +426,7 @@ $2`).split(`
424
426
 
425
427
  `:`
426
428
  `;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),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))}return`|${n.join(`|`)}|`},h=Array.from({length:f},()=>null);if(a.length===0)return m(p,h);let g=[];g.push(m(a[0],o[0]??[])),g.push(m(p,h));for(let e=1;e<a.length;e++)g.push(m(a[e],o[e]??[]));return g.join(`
427
- `)},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=zZ(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l=c?`<${s} ${c}>`:`<${s}>`,u=`</${s}>`;return`${l}\n\n${n.containerFlow({type:`root`,children:i.children},r)}\n\n${u}`},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),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=zZ(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)=>n?`>`:s?.[c++]===`none`?`>${e}`:`> ${e}`)}};function zZ(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`){if(n.value.includes(`"`)){let r=n.value.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t.push(`${e}={"${r}"}`)}else t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function BZ(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function VZ(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 HZ(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>UZ(t)?e:`\\${e}`)}function UZ(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 WZ(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==="`"));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return HZ(i)}function GZ(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 KZ=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=Ny(e.extensions),this.handlers=nQ(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=rQ(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=kZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=AZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:RZ})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return jZ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?MZ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?eY(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e){let t;try{t=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})}return NZ(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const qZ=UJ();function JZ(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 YZ(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 XZ(e){return e.attrs.sourceDirty||YZ(e)}function ZZ(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 QZ(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),Object.keys(n).length===0?e:{...e,data:n}}function $Z(e,t){if(e.length===0)return QZ({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return QZ({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:[$Z(n.children,t)]}}return QZ({type:`inlineCode`,value:eQ(e)},t)}function eQ(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=eQ(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const tQ=UG;function nQ(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=GL(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=GL(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;return n.table.createAndFill({sourceDashCounts:s},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=LZ(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=[],l=0;for(let t of s){if(t.offset>l){let r=n.slice(l,t.offset).replaceAll(`\xA0`,` `);r&&c.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);i&&(t.kind===`escape`?c.push(e.text(i,[r.escapeMark.create()])):r.sourceLiteral?c.push(e.text(i,[r.sourceLiteral.create({sourceRaw:t.raw})])):c.push(e.text(i))),l=t.offset+t.length}}if(l<n.length){let t=n.slice(l).replaceAll(`\xA0`,` `);t&&c.push(e.text(t))}return c.length===1?c[0]:c}),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})]));let a=r.strike??r.delete;if(a&&(i.delete=KL(a)),r.highlight&&(i.mark=KL(r.highlight)),r.comment&&(i.comment=KL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=GL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=KL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=KL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=GL(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}))),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`},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`})),n.list&&(i.list=GL(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=GL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread}))),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=qZ.getOrWildcard(o),c=JZ(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=LZ(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})),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=lq(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&&tQ.has(l)&&n.jsxComponent&&qZ.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&&WG.has(l)&&n.jsxComponent&&qZ.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&&KG.has(l)&&n.jsxComponent&&qZ.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&&qG.has(l)&&n.jsxComponent&&qZ.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:GZ(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(eK.has(l)&&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])}if(r.link){let t=r.link.create({href:o,title:null,linkStyle:`inline`,refLabel:null});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??``})),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=GL(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 rQ(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=ZL(`paragraph`)),r.blockquote&&(t.blockquote=ZL(`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}:{}})),r.heading&&(t.heading=ZL(`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}}))),r.codeBlock&&(t.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}}}),r.thematicBreak&&(t.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),r.hardBreak&&(t.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle}})),r.list&&(t.list=ZL(`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}}))),r.listItem&&(t.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&ZZ(r[0])?r.slice(1):r;return{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,children:i}}),r.table&&(t.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?{sourceDashCounts:s}:void 0,l={type:`table`,align:i,children:o};return c&&(l.data=c),l}),r.tableRow&&(t.tableRow=ZL(`tableRow`));let a=e=>{let t=e.attrs.sourcePadding,n={};return typeof t==`object`&&t&&typeof t.left==`number`&&typeof t.right==`number`&&(n.sourcePadding=t),Object.keys(n).length>0?{data:n}:{}};if(r.tableCell&&(t.tableCell=ZL(`tableCell`,a)),r.tableHeader&&(t.tableHeader=ZL(`tableCell`,a)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.imageReference&&(t.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`}}),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[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(r.jsxComponent&&(t.jsxComponent=(e,t,n)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let r=e.attrs.componentName||null,i=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!XZ(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:qZ.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:qZ,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.`)}})}),r.rawMdxFallback&&(t.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}}}}),r.jsxInline&&(t.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),r.mathInline&&(t.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;return typeof n==`string`&&n.length>0?{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]}:{type:`inlineMath`,value:t}}),r.wikiLink&&(t.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},children:[{type:`text`,value:i}]}}),r.tag&&(t.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),r.wikiLinkEmbed&&(t.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}]}}),i.emphasis&&(n.emphasis=QL(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=QL(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return $Z(n,{sourceFenceChar:r,sourceFenceLength:i})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=QL(`delete`)}return i.highlight&&(n.highlight=QL(`mark`)),i.comment&&(n.comment=QL(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=ZL(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),r.footnoteReference&&(t.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),r.footnoteDefinition&&(t.footnoteDefinition=ZL(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),i.link&&(n.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??``,n=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,r=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?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}]}}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}}),i.escapeMark&&(n.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data=t.data??{},t.data.escapedChars=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}),i.sourceLiteral&&(n.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 ZK(t,e.value)&&(e.data=e.data??{},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:t,markHandlers:n}}const iQ=/\p{M}+/gu,aQ=/[^\p{L}\p{N}]+/gu,oQ=/^-+|-+$/g;function sQ(e){return e.trim().normalize(`NFKD`).replace(iQ,``).toLowerCase().replace(aQ,`-`).replace(oQ,``)}function cQ(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function lQ(e,t){let n=sQ(e);return n?cQ(n,t):``}const uQ=VB(),dQ=aB(),fQ=oB();function pQ(){return VJ.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function mQ(){return pQ().filter(e=>hQ(e)!==`fence`)}function hQ(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function gQ(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:hQ(e)}}function _Q(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function vQ(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function yQ(e){let t=[];for(let n of e.props){let e=_Q(n);e!==void 0&&vQ(n,e)&&t.push(eJ(n.name,e))}return t}function bQ(e){return pz(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[uQ],mdastExtensions:[dQ]}).children}function xQ(e){let t=hQ(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
428
- A --> B`};else{let r=yQ(e),i=t===`jsx-block`?bQ(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return oP({type:`root`,children:[n]},{extensions:[fQ]}).trimEnd()}function SQ(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function CQ(e){return{...gQ(e),example:xQ(e),params:SQ(e)}}function wQ(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below — use whichever is semantically useful in any part of the doc. For full source syntax + parameter schemas, call `palette({ components: [ids] })` with the ids you want to use. Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...mQ().map(gQ).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
429
- `)}const TQ=N({docName:yq,summary:xq,content:k().optional(),...bq}).loose(),EQ=N({docName:yq,summary:xq,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P([`.md`,`.mdx`]).optional(),...bq}).loose(),DQ=N({docName:yq,summary:xq,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...bq}).loose(),OQ=N({docName:yq,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...bq}).loose(),kQ=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),AQ=Zs(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),jQ=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:AQ.optional(),hint:k().optional()}).loose(),MQ=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),NQ=Zs(`kind`,[jQ,N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),hint:k().optional()}).loose()]),PQ=N({timestamp:k().min(1),summary:kQ.optional(),warning:NQ.optional()}).loose(),FQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(MQ).optional(),summary:kQ.optional(),warning:NQ.optional()}).loose(),IQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:kQ.optional(),warning:NQ.optional()}).loose(),LQ=N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),RQ=N({docName:yq,patch:tc(k(),Ys([jW,Rs()])),types:tc(k(),P(AW)).optional(),summary:xq,...bq}).loose(),zQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:kQ.optional(),warning:NQ.optional()}).loose(),BQ=N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:tc(k(),Hs()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),VQ=N({accepted:A().int().min(0)}).loose(),HQ=N({status:k().min(1),reason:k()}).loose(),UQ=N({docName:k().min(1),content:k(),lifecycle:HQ.nullable()}).loose(),WQ=N({documents:M(N({kind:P([`document`,`asset`,`folder`]).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`]).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.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName)`})),truncated:j().optional()}).loose(),GQ=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),KQ=N({docName:k().min(1),backlinks:M(GQ)}).loose(),qQ=N({counts:tc(k().min(1),A().int().nonnegative())}).loose(),JQ=Zs(`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()]),YQ=N({docName:k().min(1),forwardLinks:M(JQ)}).loose(),XQ=Zs(`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()]),ZQ=N({source:k().min(1),target:k().min(1)}).loose(),QQ=N({nodes:M(XQ),links:M(ZQ)}).loose(),$Q=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(),e$=N({app:Ys([F(`cursor`),F(`codex`),F(`claude`),Rs()]),signals_fired:M(k())}).loose(),t$=N({entries:M($Q),count:A().int().min(0),detection:e$}).loose(),n$=N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:xq,...bq}).loose(),r$=N({checkpointRef:k().min(1)}).loose(),i$=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose(),a$=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(i$),checkpoint:Hs().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional()}).loose(),o$=N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),s$=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose(),c$=M(Zs(`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`."}),l$=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),u$=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),d$=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),f$=N({deadLinks:M(N({target:k().min(1),sources:M(d$)}).loose())}).loose(),p$=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(),m$=N({projectPath:k().min(1)}).loose(),h$=P([`not-a-git-worktree`,`init-failed`]),g$=Zs(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:h$,message:k().min(1)}).loose()]),_$=N({host:k().min(1).optional()}).loose(),v$=N({key:k().min(1)}).loose(),y$=N({keyPresent:j()}).loose(),b$=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(),x$=N({authenticated:j()}).loose(),S$=N({}).loose(),C$=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),w$=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(C$)}).loose(),T$=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),E$=N({sessionAlive:j(),agent:T$.nullable(),files:M(w$)}).loose(),D$=N({diff:k(),generatedAt:A().int().min(0)}).loose(),O$=N({}).loose(),k$=N({}).loose(),A$=N({}).loose(),j$=N({}).loose(),M$=N({}).loose(),N$=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose(),P$=N({presence:tc(k().min(1),N$)}).loose(),F$=tc(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();const I$=N({}).loose(),L$=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),R$=N({fromPath:k().min(1),toPath:k().min(1)}).loose(),z$=N({}).loose(),B$=N({path:k().min(1),...bq,summary:xq}).loose(),V$=N({docName:k().min(1)}).loose(),H$=N({path:k().min(1),...bq,summary:xq}).loose(),U$=N({path:k().min(1)}).loose(),W$=N({kind:P([`file`,`folder`]),path:k().min(1),...bq,summary:xq}).loose(),G$=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),K$=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(),q$=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),J$=N({docName:k().min(1),headings:M(q$)}).loose(),Y$=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose(),X$=N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...bq,summary:xq}).loose(),Z$=N({renamed:M(L$),renamedAssets:M(R$),rewrittenDocs:M(Y$).optional(),summary:kQ.optional()}).loose(),Q$=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...bq}).loose(),$$=N({deletedDocNames:M(k().min(1))}).loose(),e1=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...bq,summary:xq}).loose(),t1=N({deletedDocNames:M(k().min(1))}).loose(),n1=N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:xq,...bq}).loose(),r1=N({restoredFrom:k().min(1),timestamp:k().min(1),summary:kQ.optional(),warning:jQ.optional()}).loose(),i1=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),a1=N({label:k().min(1),webUrl:_s().nullable()}).loose(),o1=Zs(`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()]),s1=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),c1=N({state:i1,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:a1.nullable().optional(),pushError:k().optional(),pushErrorCode:s1.optional(),pullError:k().optional(),pullErrorCode:s1.optional(),pausedReason:k().optional(),pushPermission:o1.optional()}).loose(),l1=N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),u1=N({op:P([`sync`,`push`,`pull`])}).loose(),d1=N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),f1=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`]}),p1=N({}).loose(),m1=N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),h1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),g1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),_1=N({result:Tc(e=>e!==void 0,{message:`result is required`})}).loose(),v1=N({path:k().min(1),summary:k().min(1)}).loose(),y1=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),b1=N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(v1),entryCounts:y1}).loose())}).loose(),x1=N({noOpen:j().optional(),out:k().min(1).optional()}).loose(),S1=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),C1=Zs(`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:S1.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),w1=N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose(),T1=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose(),E1=N({name:k().min(1),docs:M(T1)}).loose(),D1=N({folder:Hs(),frontmatter_local:tc(k(),Hs()).nullable()}).loose(),O1=N({path:k(),frontmatter:tc(k(),Hs()).optional()}).loose(),k1=N({applied:Hs()}).loose(),A1=tc(k(),Hs()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),j1=N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:A1,body:k()}).strict()}).strict(),M1=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(),N1=N({folder:k(),name:k(),body:k().optional(),frontmatter:A1.optional(),...bq,summary:xq}).strict(),P1=N({path:k().min(1),created:j(),warnings:M(k())}).strict(),F1=N({existed:j(),path:k().min(1)}).strict(),I1=N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:A1.optional(),...bq,summary:xq}).strict(),L1=N({from:k().min(1),to:k().min(1),committed:j()}).strict(),R1=N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:M(P([`page`,`folder`,`content`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional()}).loose(),z1=N({kind:P([`page`,`folder`,`content`]),path:k().min(1),title:k(),score:A(),signals:tc(k(),Hs()),snippet:k().optional()}).loose(),B1=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose(),V1=N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),H1=N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(z1),elapsedMs:A().nonnegative(),semantic:B1.optional()}).loose(),U1=N({version:k().min(1),recordedAt:k().min(1)}).loose(),W1=N({currentVersion:k().min(1),targets:tc(k(),U1.nullable())}).loose(),G1=`server-info`,K1=`branch-switched`,q1=`disk-ack`,J1=`config-validation-rejected`,Y1=`config-ignore-nested-error`,X1=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),Z1=N({v:F(1),ch:F(G1),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),Q1=N({v:F(1),ch:F(K1),seq:A(),branch:k().min(1)}).loose(),$1=N({v:F(1),ch:X1,seq:A()}).loose(),e0=N({v:F(1),ch:F(q1),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),t0=N({v:F(1),ch:F(J1),seq:A(),docName:k().min(1),error:al}).loose(),n0=N({v:F(1),ch:F(Y1),seq:A(),path:k().min(1),error:k().min(1)}).loose(),r0={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},i0=new WeakMap;function a0(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function o0(e){return e.trim().toLowerCase()}function s0(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function c0(e){return e.split(`/`).filter(Boolean).join(` `)}function l0(e){let t=s0(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:c0(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function u0(e){let t=jU({schema:r0});return e.length>0&&HU(t,e),t}function d0(e){let t={documents:e};return i0.set(t,u0(e)),t}function f0(e){let t=i0.get(e);if(t)return t;let n=u0(e.documents);return i0.set(e,n),n}function p0(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function m0(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function h0(e,t){let n=o0(t);if(!n)return 0;let r=o0(e.title),i=o0(e.name),a=o0(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function g0(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 _0(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function v0(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 y0(e,t){return o0(t).length<4?0:e===`full_text`?1:0}function b0(e,t,n={}){let r=n.intent??`omnibar`,i=a0(n.limit),a=new Set(n.scopes??p0(r)),o=e.documents.filter(e=>m0(e,a)),s=o0(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=vW(f0(e),{term:s,properties:_0(r),boost:v0(r),tolerance:y0(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>m0(e.document,a)).map(e=>[e.document.id,e.score])),u=g0(o),d=new Map;for(let e of o)h0(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)m0(e.document,a)&&d.set(e.document.id,e.document);return n.semantic?S0({scopedDocuments:o,candidates:d,fullTextScores:l,recency:u,normalizedQuery:s,semantic:n.semantic,limit:i}):[...d.values()].map(e=>{let t=Math.max(0,h0(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}function x0(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function S0(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,semantic:o,limit:s}=e,c=o.rrfK??60,l=o.candidateLimit??64,u=o.similarityFloor??.35,d=o.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=[...n.values()].map(e=>{let t=Math.max(0,h0(e,a)),n=r.get(e.id)??0,o=i.get(e.id)??0,s=d.get(e.id),c=s!==void 0&&s>=u;return{document:e,score:t+n*20+o,signals:c?{lexical:t,fullText:n,recency:o,vector:s}:{lexical:t,fullText:n,recency:o},lexical:t,fullText:n,recency:o,cosine:s}}),h=x0(m.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),g=x0(m.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)),_=e=>{let t=0,n=h.get(e);n!==void 0&&(t+=1/(c+n));let r=g.get(e);return r!==void 0&&(t+=1/(c+r)),t};return m.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1: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=_(e.document.id),a=_(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})).slice(0,s)}function C0(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),w0(n)}function w0(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const T0=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),E0=globalThis;E0[T0]===void 0&&(E0[T0]=Fi());const D0=E0[T0],O0=[`.ok`,`skill-state.yml`],k0=[`claude-cowork`,`cli-hosts`],A0=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],j0=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,M0=qs({version:k().regex(j0,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(D0,{description:`Recorded skill version for this target.`}),recordedAt:Vo().register(D0,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P(A0).register(D0,{description:`Install-source surface that recorded this entry.`}).optional()}),N0=qs({schema:F(1).register(D0,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:qs({"claude-cowork":M0.optional(),"cli-hosts":M0.optional()}).register(D0,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function P0(){return{schema:1,targets:{}}}function F0(){let e=!1,t=``,n=0;return r=>{let i=I0(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 I0(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}const L0=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],R0={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function z0(e,t=L0){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const B0={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function V0(e){return e?B0[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const H0={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function U0(e){let t=e?.trim();return t?H0[V0(t)]??t:`Agent`}function W0(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}}const G0=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function K0(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function q0(e){let t=e.trim();return G0.test(t)||t.startsWith(`//`)}function J0(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(q0(n))return{kind:`external`,url:n};let r=W0(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=K0(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function Y0(e,t){let n=e.trim();if(!n)return null;if(q0(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=K0(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function X0(e,t){let n=e.trim();if(!n||G0.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 Z0(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function Q0(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function $0(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function e2(e){return e.split(`/`).filter(e=>e!==``)}function t2(e,t){let n=$0(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function n2(e,t){let n=$0(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:e2(r).length}function r2(e,t){let n=e2(e),r=e2(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function i2(){let e=new Map;function t(t){let n=Z0(t);if(n===``)return;let r=Q0(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=Z0(t),r=Q0(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=$0(Z0(n)),o=[],s=[];for(let e of i)t2(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=n2(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=n2(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=r2(a,$0(t));for(let r=1;r<e.length;r++){let i=e[r],o=r2(a,$0(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function a2(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function o2(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function s2(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function c2(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function l2(){try{let e=_(g(b(import.meta.url)),`..`,`package.json`),t=JSON.parse(d(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const u2=l2(),d2=1;var f2=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function p2(e,t){return _(e,`${t}.lock`)}const m2=new Map;function h2(e){m2.set(e,(m2.get(e)??0)+1)}function g2(e){let t=m2.get(e);return t===void 0||t<=1?(m2.delete(e),!0):(m2.set(e,t-1),!1)}function _2(e,t){try{let n=JSON.parse(d(e,`utf-8`));return n&&typeof n==`object`&&c2(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function v2(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;l(n,{recursive:!0});let a=p2(n,t),o={pid:process.pid,hostname:y(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??u2},d=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!c(a))try{let e=u(a,`wx`,384);try{m(e,d)}finally{s(e)}return h2(a),y2({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=_2(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return p(a,d,{encoding:`utf-8`,mode:384}),h2(a),y2({lockName:t,lockDir:n,lockPath:a});if(r&&s2(e.pid))throw new f2(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{f(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function y2(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>C2({lockName:t,lockDir:n}),updatePort:e=>b2({lockName:t,lockDir:n,port:e})}}function b2(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=p2(n,t);if(!c(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(d(a,`utf-8`));if(!e||typeof e!=`object`||!c2(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&!(typeof o.hostname==`string`&&o.hostname!==y())){o.port=r;try{p(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function x2(e){let{lockName:t,lockDir:n}=e,r=p2(n,t);if(!c(r))return null;let i;try{let e=JSON.parse(d(r,`utf-8`));if(!e||typeof e!=`object`||!c2(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!s2(i.pid)){try{f(r)}catch{}return null}return i}function S2(e){let{lockName:t,lockDir:n}=e,r=p2(n,t);if(!c(r))return{status:`absent`};let i;try{i=JSON.parse(d(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!c2(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(o.hostname!==y())return{status:`stale`,lock:o};if(!s2(o.pid)){try{f(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}function C2(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=p2(n,t);if(g2(i)&&c(i))try{let e=JSON.parse(d(i,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==y())return;f(i)}catch(e){console.warn(`${r} Failed to release ${i}: ${e instanceof Error?e.message:String(e)}`)}}var w2=class extends f2{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function T2(e,t){try{return v2({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof f2&&e.lockName===`server`?new w2(e.existing,e.lockPath):e}}function E2(e,t){b2({lockName:`server`,lockDir:e,port:t})}function D2(e){return x2({lockName:`server`,lockDir:e})}function O2(e){C2({lockName:`server`,lockDir:e})}export{xG as $,Ys as $i,I1 as $n,CQ as $r,j$ as $t,Gq as A,pl as Ai,Uq as An,U0 as Ar,jW as At,e0 as B,M as Bi,Qq as Bn,sq as Br,QQ as Bt,IQ as C,bl as Ci,R1 as Cn,F0 as Cr,z$ as Ct,FQ as D,vl as Di,b1 as Dn,mG as Dr,YQ as Dt,EQ as E,Zc as Ei,_1 as En,l0 as Er,k1 as Et,rG as F,Ns as Fi,Mq as Fn,XW as Fr,x1 as Ft,q1 as G,F as Gi,p1 as Gn,MG as Gr,Zq as Gt,K1 as H,Tc as Hi,m1 as Hn,Lq as Hr,_$ as Ht,Q1 as I,oc as Ii,Pq as In,GZ as Ir,C1 as It,gG as J,N as Ji,u1 as Jn,eG as Jr,m$ as Jt,G1 as K,qs as Ki,c1 as Kn,Fq as Kr,y$ as Kt,n0 as L,P as Li,W1 as Ln,mQ as Lr,F$ as Lt,KQ as M,Yc as Mi,Tq as Mn,C0 as Mr,o$ as Mt,zq as N,Hc as Ni,Aq as Nn,a2 as Nr,u$ as Nt,TQ as O,ll as Oi,h1 as On,pG as Or,RQ as Ot,QW as P,Uc as Pi,kq as Pn,hq as Pr,QG as Pt,SG as Q,k as Qi,j1 as Qn,IG as Qr,M$ as Qt,t0 as R,Rs as Ri,N0 as Rn,lQ as Rr,TG as Rt,DQ as S,xl as Si,r$ as Sn,i2 as Sr,t$ as St,LQ as T,Wc as Ti,g1 as Tn,d0 as Tr,O1 as Tt,Y1 as U,Zs as Ui,d1 as Un,NW as Ur,b$ as Ut,Z1 as V,j as Vi,p$ as Vn,V0 as Vr,S$ as Vt,J1 as W,$s as Wi,f1 as Wn,_q as Wr,x$ as Wt,CG as X,Oc as Xi,w1 as Xn,zW as Xr,KZ as Xt,wG as Y,sc as Yi,E1 as Yn,fG as Yr,g$ as Yt,bG as Z,tc as Zi,F1 as Zn,IW as Zr,P$ as Zt,R0 as _,D as _a,Rc as _i,k0 as _n,qq as _r,UQ as _t,v2 as a,Ua as aa,dq as ai,J$ as an,A$ as ar,U$ as at,E$ as b,Ic as bi,vG as bn,_G as br,OG as bt,c2 as c,vr as ca,ZW as ci,Jq as cn,t1 as cr,$G as ct,S2 as d,fn as da,gq as di,c$ as dn,Yq as dr,NG as dt,Hs as ea,WW as ei,jG as en,L1 as er,Bq as et,D2 as f,mn as fa,Ny as fi,n1 as fn,s$ as fr,EG as ft,E2 as g,O as ga,Bc as gi,O0 as gn,YW as gr,WQ as gt,b2 as h,Tt as ha,yl as hi,XG as hn,EW as hr,$$ as ht,w2 as i,da as ia,b0 as ii,hG as in,k$ as ir,H$ as it,qQ as j,Qc as ji,Cq as jn,P0 as jr,a$ as jt,PQ as k,ol as ki,V1 as kn,VW as kr,zQ as kt,p2 as l,cn as la,sQ as li,X$ as ln,kG as lr,AG as lt,O2 as m,Lt as ma,I as mi,ZG as mn,DW as mr,Q$ as mt,u2 as n,Vo as na,X0 as ni,FG as nn,P1 as nr,BQ as nt,T2 as o,Wa as oa,FW as oi,K$ as on,O$ as or,B$ as ot,C2 as p,on as pa,Cf as pi,r1 as pn,NQ as pr,f$ as pt,yG as q,A as qi,l1 as qn,mK as qr,v$ as qt,d2 as r,zo as ra,W0 as ri,LG as rn,M1 as rr,VQ as rt,s2 as s,ai as sa,o2 as si,Wq as sn,e1 as sr,V$ as st,f2 as t,_s as ta,wQ as ti,l$ as tn,N1 as tr,Hq as tt,x2 as u,un as ua,LW as ui,Z$ as un,Xq as ur,RG as ut,DG as v,pt as va,zc as vi,j0 as vn,J0 as vr,W$ as vt,OQ as w,hl as wi,H1 as wn,WX as wr,D1 as wt,D$ as x,Fc as xi,n$ as xn,z0 as xr,JG as xt,YG as y,ft as ya,Lc as yi,PG as yn,Y0 as yr,G$ as yt,$1 as z,Bs as zi,I$ as zn,JJ as zr,pK as zt};
430
- //# sourceMappingURL=server-lock-BpjJj3OD-CGDmzK2V.mjs.map
429
+ `)},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=BZ(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l=c?`<${s} ${c}>`:`<${s}>`,u=`</${s}>`;return`${l}\n\n${n.containerFlow({type:`root`,children:i.children},r)}\n\n${u}`},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),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=BZ(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)=>n?`>`:s?.[c++]===`none`?`>${e}`:`> ${e}`)}};function BZ(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`){if(n.value.includes(`"`)){let r=n.value.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t.push(`${e}={"${r}"}`)}else t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function VZ(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function HZ(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 UZ(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>WZ(t)?e:`\\${e}`)}function WZ(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 GZ(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==="`"));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return UZ(i)}function KZ(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 qZ=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=Ny(e.extensions),this.handlers=rQ(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=iQ(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=AZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=jZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:zZ})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return MZ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?NZ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?tY(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e){let t;try{t=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})}return PZ(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const JZ=WJ();function YZ(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 XZ(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 ZZ(e){return e.attrs.sourceDirty||XZ(e)}function QZ(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 $Z(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),Object.keys(n).length===0?e:{...e,data:n}}function eQ(e,t){if(e.length===0)return $Z({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return $Z({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:[eQ(n.children,t)]}}return $Z({type:`inlineCode`,value:tQ(e)},t)}function tQ(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=tQ(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const nQ=WG;function rQ(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=GL(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=GL(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;return n.table.createAndFill({sourceDashCounts:s},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=RZ(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=[],l=0;for(let t of s){if(t.offset>l){let r=n.slice(l,t.offset).replaceAll(`\xA0`,` `);r&&c.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);i&&(t.kind===`escape`?c.push(e.text(i,[r.escapeMark.create()])):r.sourceLiteral?c.push(e.text(i,[r.sourceLiteral.create({sourceRaw:t.raw})])):c.push(e.text(i))),l=t.offset+t.length}}if(l<n.length){let t=n.slice(l).replaceAll(`\xA0`,` `);t&&c.push(e.text(t))}return c.length===1?c[0]:c}),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})]));let a=r.strike??r.delete;if(a&&(i.delete=KL(a)),r.highlight&&(i.mark=KL(r.highlight)),r.comment&&(i.comment=KL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=GL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=KL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=KL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=GL(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}))),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`},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`})),n.list&&(i.list=GL(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=GL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread}))),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=JZ.getOrWildcard(o),c=YZ(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=RZ(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})),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=uq(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&&nQ.has(l)&&n.jsxComponent&&JZ.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&&GG.has(l)&&n.jsxComponent&&JZ.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&&qG.has(l)&&n.jsxComponent&&JZ.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&&JG.has(l)&&n.jsxComponent&&JZ.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:KZ(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(tK.has(l)&&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])}if(r.link){let t=r.link.create({href:o,title:null,linkStyle:`inline`,refLabel:null});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??``})),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=GL(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 iQ(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=ZL(`paragraph`)),r.blockquote&&(t.blockquote=ZL(`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}:{}})),r.heading&&(t.heading=ZL(`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}}))),r.codeBlock&&(t.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}}}),r.thematicBreak&&(t.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),r.hardBreak&&(t.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle}})),r.list&&(t.list=ZL(`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}}))),r.listItem&&(t.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&QZ(r[0])?r.slice(1):r;return{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,children:i}}),r.table&&(t.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?{sourceDashCounts:s}:void 0,l={type:`table`,align:i,children:o};return c&&(l.data=c),l}),r.tableRow&&(t.tableRow=ZL(`tableRow`));let a=e=>{let t=e.attrs.sourcePadding,n={};return typeof t==`object`&&t&&typeof t.left==`number`&&typeof t.right==`number`&&(n.sourcePadding=t),Object.keys(n).length>0?{data:n}:{}};if(r.tableCell&&(t.tableCell=ZL(`tableCell`,a)),r.tableHeader&&(t.tableHeader=ZL(`tableCell`,a)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.imageReference&&(t.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`}}),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[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(r.jsxComponent&&(t.jsxComponent=(e,t,n)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let r=e.attrs.componentName||null,i=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!ZZ(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:JZ.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:JZ,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.`)}})}),r.rawMdxFallback&&(t.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}}}}),r.jsxInline&&(t.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),r.mathInline&&(t.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;return typeof n==`string`&&n.length>0?{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]}:{type:`inlineMath`,value:t}}),r.wikiLink&&(t.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},children:[{type:`text`,value:i}]}}),r.tag&&(t.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),r.wikiLinkEmbed&&(t.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}]}}),i.emphasis&&(n.emphasis=QL(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=QL(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return eQ(n,{sourceFenceChar:r,sourceFenceLength:i})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=QL(`delete`)}return i.highlight&&(n.highlight=QL(`mark`)),i.comment&&(n.comment=QL(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=ZL(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),r.footnoteReference&&(t.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),r.footnoteDefinition&&(t.footnoteDefinition=ZL(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),i.link&&(n.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??``,n=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,r=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?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}]}}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}}),i.escapeMark&&(n.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data=t.data??{},t.data.escapedChars=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}),i.sourceLiteral&&(n.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 QK(t,e.value)&&(e.data=e.data??{},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:t,markHandlers:n}}const aQ=/\p{M}+/gu,oQ=/[^\p{L}\p{N}]+/gu,sQ=/^-+|-+$/g;function cQ(e){return e.trim().normalize(`NFKD`).replace(aQ,``).toLowerCase().replace(oQ,`-`).replace(sQ,``)}function lQ(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function uQ(e,t){let n=cQ(e);return n?lQ(n,t):``}const dQ=VB(),fQ=aB(),pQ=oB();function mQ(){return HJ.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function hQ(){return mQ().filter(e=>gQ(e)!==`fence`)}function gQ(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function _Q(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:gQ(e)}}function vQ(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function yQ(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function bQ(e){let t=[];for(let n of e.props){let e=vQ(n);e!==void 0&&yQ(n,e)&&t.push(tJ(n.name,e))}return t}function xQ(e){return pz(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[dQ],mdastExtensions:[fQ]}).children}function SQ(e){let t=gQ(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
430
+ A --> B`};else{let r=bQ(e),i=t===`jsx-block`?xQ(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return oP({type:`root`,children:[n]},{extensions:[pQ]}).trimEnd()}function CQ(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function wQ(e){return{..._Q(e),example:SQ(e),params:CQ(e)}}function TQ(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below — use whichever is semantically useful in any part of the doc. For full source syntax + parameter schemas, call `palette({ components: [ids] })` with the ids you want to use. Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...hQ().map(_Q).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
431
+ `)}const EQ=N({docName:bq,summary:Sq,content:k().optional(),...xq}).loose(),DQ=N({docName:bq,summary:Sq,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P([`.md`,`.mdx`]).optional(),...xq}).loose(),OQ=N({docName:bq,summary:Sq,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...xq}).loose(),kQ=N({docName:bq,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...xq}).loose(),AQ=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),jQ=Zs(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),MQ=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:jQ.optional(),hint:k().optional()}).loose(),NQ=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),PQ=Zs(`kind`,[MQ,N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),hint:k().optional()}).loose()]),FQ=N({timestamp:k().min(1),summary:AQ.optional(),warning:PQ.optional()}).loose(),IQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(NQ).optional(),summary:AQ.optional(),warning:PQ.optional()}).loose(),LQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:AQ.optional(),warning:PQ.optional()}).loose(),RQ=N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),zQ=N({docName:bq,patch:tc(k(),Ys([jW,Rs()])),types:tc(k(),P(AW)).optional(),summary:Sq,...xq}).loose(),BQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:AQ.optional(),warning:PQ.optional()}).loose(),VQ=N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:tc(k(),Hs()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),HQ=N({accepted:A().int().min(0)}).loose(),UQ=N({status:k().min(1),reason:k()}).loose(),WQ=N({docName:k().min(1),content:k(),lifecycle:UQ.nullable()}).loose(),GQ=N({documents:M(N({kind:P([`document`,`asset`,`folder`]).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`]).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.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName)`})),truncated:j().optional()}).loose(),KQ=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),qQ=N({docName:k().min(1),backlinks:M(KQ)}).loose(),JQ=N({counts:tc(k().min(1),A().int().nonnegative())}).loose(),YQ=Zs(`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()]),XQ=N({docName:k().min(1),forwardLinks:M(YQ)}).loose(),ZQ=Zs(`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()]),QQ=N({source:k().min(1),target:k().min(1)}).loose(),$Q=N({nodes:M(ZQ),links:M(QQ)}).loose(),e$=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(),t$=N({app:Ys([F(`cursor`),F(`codex`),F(`claude`),Rs()]),signals_fired:M(k())}).loose(),n$=N({entries:M(e$),count:A().int().min(0),detection:t$}).loose(),r$=N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:Sq,...xq}).loose(),i$=N({checkpointRef:k().min(1)}).loose(),a$=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose(),o$=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(a$),checkpoint:Hs().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional()}).loose(),s$=N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),c$=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose(),l$=M(Zs(`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`."}),u$=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),d$=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),f$=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),p$=N({deadLinks:M(N({target:k().min(1),sources:M(f$)}).loose())}).loose(),m$=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(),h$=N({projectPath:k().min(1)}).loose(),g$=P([`not-a-git-worktree`,`init-failed`]),_$=Zs(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:g$,message:k().min(1)}).loose()]),v$=N({host:k().min(1).optional()}).loose(),y$=N({key:k().min(1)}).loose(),b$=N({keyPresent:j()}).loose(),x$=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(),S$=N({authenticated:j()}).loose(),C$=N({}).loose(),w$=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),T$=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(w$)}).loose(),E$=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),D$=N({sessionAlive:j(),agent:E$.nullable(),files:M(T$)}).loose(),O$=N({diff:k(),generatedAt:A().int().min(0)}).loose(),k$=N({}).loose(),A$=N({}).loose(),j$=N({}).loose(),M$=N({}).loose(),N$=N({}).loose(),P$=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose(),F$=N({presence:tc(k().min(1),P$)}).loose(),I$=tc(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();const L$=N({}).loose(),R$=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),z$=N({fromPath:k().min(1),toPath:k().min(1)}).loose(),B$=N({}).loose(),V$=N({path:k().min(1),...xq,summary:Sq}).loose(),H$=N({docName:k().min(1)}).loose(),U$=N({path:k().min(1),...xq,summary:Sq}).loose(),W$=N({path:k().min(1)}).loose(),G$=N({kind:P([`file`,`folder`]),path:k().min(1),...xq,summary:Sq}).loose(),K$=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),q$=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(),J$=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),Y$=N({docName:k().min(1),headings:M(J$)}).loose(),X$=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose(),Z$=N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...xq,summary:Sq}).loose(),Q$=N({renamed:M(R$),renamedAssets:M(z$),rewrittenDocs:M(X$).optional(),summary:AQ.optional()}).loose(),$$=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...xq}).loose(),e1=N({deletedDocNames:M(k().min(1))}).loose(),t1=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...xq,summary:Sq}).loose(),n1=N({deletedDocNames:M(k().min(1))}).loose(),r1=N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:Sq,...xq}).loose(),i1=N({restoredFrom:k().min(1),timestamp:k().min(1),summary:AQ.optional(),warning:MQ.optional()}).loose(),a1=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),o1=N({label:k().min(1),webUrl:_s().nullable()}).loose(),s1=Zs(`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()]),c1=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),l1=N({state:a1,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:o1.nullable().optional(),pushError:k().optional(),pushErrorCode:c1.optional(),pullError:k().optional(),pullErrorCode:c1.optional(),pausedReason:k().optional(),pushPermission:s1.optional()}).loose(),u1=N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),d1=N({op:P([`sync`,`push`,`pull`])}).loose(),f1=N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),p1=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`]}),m1=N({}).loose(),h1=N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),g1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),_1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),v1=N({result:Tc(e=>e!==void 0,{message:`result is required`})}).loose(),y1=N({path:k().min(1),summary:k().min(1)}).loose(),b1=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),x1=N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(y1),entryCounts:b1}).loose())}).loose(),S1=N({noOpen:j().optional(),out:k().min(1).optional()}).loose(),C1=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),w1=Zs(`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:C1.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),T1=N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose(),E1=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose(),D1=N({name:k().min(1),docs:M(E1)}).loose(),O1=N({folder:Hs(),frontmatter_local:tc(k(),Hs()).nullable()}).loose(),k1=N({path:k(),frontmatter:tc(k(),Hs()).optional()}).loose(),A1=N({applied:Hs()}).loose(),j1=tc(k(),Hs()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),M1=N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:j1,body:k()}).strict()}).strict(),N1=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(),P1=N({folder:k(),name:k(),body:k().optional(),frontmatter:j1.optional(),...xq,summary:Sq}).strict(),F1=N({path:k().min(1),created:j(),warnings:M(k())}).strict(),I1=N({existed:j(),path:k().min(1)}).strict(),L1=N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:j1.optional(),...xq,summary:Sq}).strict(),R1=N({from:k().min(1),to:k().min(1),committed:j()}).strict(),z1=N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:M(P([`page`,`folder`,`content`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional(),source:P([`omnibar`,`mcp`,`http`]).optional()}).loose(),B1=N({kind:P([`page`,`folder`,`content`]),path:k().min(1),title:k(),score:A(),signals:tc(k(),Hs()),snippet:k().optional()}).loose(),V1=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose(),H1=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(),U1=N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(B1),elapsedMs:A().nonnegative(),semantic:V1.optional()}).loose(),W1=N({version:k().min(1),recordedAt:k().min(1)}).loose(),G1=N({currentVersion:k().min(1),targets:tc(k(),W1.nullable())}).loose(),K1=`server-info`,q1=`branch-switched`,J1=`disk-ack`,Y1=`config-validation-rejected`,X1=`config-ignore-nested-error`,Z1=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),Q1=N({v:F(1),ch:F(K1),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),$1=N({v:F(1),ch:F(q1),seq:A(),branch:k().min(1)}).loose(),e0=N({v:F(1),ch:Z1,seq:A()}).loose(),t0=N({v:F(1),ch:F(J1),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),n0=N({v:F(1),ch:F(Y1),seq:A(),docName:k().min(1),error:al}).loose(),r0=N({v:F(1),ch:F(X1),seq:A(),path:k().min(1),error:k().min(1)}).loose(),i0={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},a0=new WeakMap;function o0(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function s0(e){return e.trim().toLowerCase()}function c0(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function l0(e){return e.split(`/`).filter(Boolean).join(` `)}function u0(e){let t=c0(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:l0(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function d0(e){let t=jU({schema:i0});return e.length>0&&HU(t,e),t}function f0(e){let t={documents:e};return a0.set(t,d0(e)),t}function p0(e){let t=a0.get(e);if(t)return t;let n=d0(e.documents);return a0.set(e,n),n}function m0(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function h0(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function g0(e,t){let n=s0(t);if(!n)return 0;let r=s0(e.title),i=s0(e.name),a=s0(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function _0(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 v0(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function y0(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 b0(e,t){return s0(t).length<4?0:e===`full_text`?1:0}function x0(e,t,n={}){let r=n.intent??`omnibar`,i=o0(n.limit),a=new Set(n.scopes??m0(r)),o=e.documents.filter(e=>h0(e,a)),s=s0(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=vW(p0(e),{term:s,properties:v0(r),boost:y0(r),tolerance:b0(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>h0(e.document,a)).map(e=>[e.document.id,e.score])),u=_0(o),d=new Map;for(let e of o)g0(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)h0(e.document,a)&&d.set(e.document.id,e.document);return n.semantic?C0({scopedDocuments:o,candidates:d,fullTextScores:l,recency:u,normalizedQuery:s,semantic:n.semantic,limit:i}):[...d.values()].map(e=>{let t=Math.max(0,g0(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}function S0(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function C0(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,semantic:o,limit:s}=e,c=o.rrfK??60,l=o.candidateLimit??64,u=o.similarityFloor??0,d=o.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=[...n.values()].map(e=>{let t=Math.max(0,g0(e,a)),n=r.get(e.id)??0,o=i.get(e.id)??0,s=d.get(e.id),c=s!==void 0&&s>=u;return{document:e,score:t+n*20+o,signals:c?{lexical:t,fullText:n,recency:o,vector:s}:{lexical:t,fullText:n,recency:o},lexical:t,fullText:n,recency:o,cosine:s}}),h=S0(m.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),g=S0(m.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)),_=e=>{let t=0,n=h.get(e);n!==void 0&&(t+=1/(c+n));let r=g.get(e);return r!==void 0&&(t+=1/(c+r)),t};return m.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1: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=_(e.document.id),a=_(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})).slice(0,s)}function w0(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),T0(n)}function T0(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const E0=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),D0=globalThis;D0[E0]===void 0&&(D0[E0]=Fi());const O0=D0[E0],k0=[`.ok`,`skill-state.yml`],A0=[`claude-cowork`,`cli-hosts`],j0=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],M0=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,N0=qs({version:k().regex(M0,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(O0,{description:`Recorded skill version for this target.`}),recordedAt:Vo().register(O0,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P(j0).register(O0,{description:`Install-source surface that recorded this entry.`}).optional()}),P0=qs({schema:F(1).register(O0,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:qs({"claude-cowork":N0.optional(),"cli-hosts":N0.optional()}).register(O0,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function F0(){return{schema:1,targets:{}}}function I0(){let e=!1,t=``,n=0;return r=>{let i=L0(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 L0(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}const R0=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],z0={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function B0(e,t=R0){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const V0={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function H0(e){return e?V0[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const U0={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function W0(e){let t=e?.trim();return t?U0[H0(t)]??t:`Agent`}function G0(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}}const K0=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function q0(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function J0(e){let t=e.trim();return K0.test(t)||t.startsWith(`//`)}function Y0(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(J0(n))return{kind:`external`,url:n};let r=G0(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=q0(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function X0(e,t){let n=e.trim();if(!n)return null;if(J0(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=q0(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function Z0(e,t){let n=e.trim();if(!n||K0.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 Q0(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function $0(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function e2(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function t2(e){return e.split(`/`).filter(e=>e!==``)}function n2(e,t){let n=e2(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function r2(e,t){let n=e2(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:t2(r).length}function i2(e,t){let n=t2(e),r=t2(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function a2(){let e=new Map;function t(t){let n=Q0(t);if(n===``)return;let r=$0(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=Q0(t),r=$0(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=e2(Q0(n)),o=[],s=[];for(let e of i)n2(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=r2(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=r2(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=i2(a,e2(t));for(let r=1;r<e.length;r++){let i=e[r],o=i2(a,e2(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function o2(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function s2(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function c2(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function l2(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function u2(){try{let e=_(g(b(import.meta.url)),`..`,`package.json`),t=JSON.parse(d(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const d2=u2(),f2=1;var p2=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function m2(e,t){return _(e,`${t}.lock`)}const h2=new Map;function g2(e){h2.set(e,(h2.get(e)??0)+1)}function _2(e){let t=h2.get(e);return t===void 0||t<=1?(h2.delete(e),!0):(h2.set(e,t-1),!1)}function v2(e,t){try{let n=JSON.parse(d(e,`utf-8`));return n&&typeof n==`object`&&l2(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function y2(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;l(n,{recursive:!0});let a=m2(n,t),o={pid:process.pid,hostname:y(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??d2},d=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!c(a))try{let e=u(a,`wx`,384);try{m(e,d)}finally{s(e)}return g2(a),b2({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=v2(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return p(a,d,{encoding:`utf-8`,mode:384}),g2(a),b2({lockName:t,lockDir:n,lockPath:a});if(r&&c2(e.pid))throw new p2(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{f(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function b2(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>w2({lockName:t,lockDir:n}),updatePort:e=>x2({lockName:t,lockDir:n,port:e})}}function x2(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=m2(n,t);if(!c(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(d(a,`utf-8`));if(!e||typeof e!=`object`||!l2(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&!(typeof o.hostname==`string`&&o.hostname!==y())){o.port=r;try{p(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function S2(e){let{lockName:t,lockDir:n}=e,r=m2(n,t);if(!c(r))return null;let i;try{let e=JSON.parse(d(r,`utf-8`));if(!e||typeof e!=`object`||!l2(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!c2(i.pid)){try{f(r)}catch{}return null}return i}function C2(e){let{lockName:t,lockDir:n}=e,r=m2(n,t);if(!c(r))return{status:`absent`};let i;try{i=JSON.parse(d(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!l2(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(o.hostname!==y())return{status:`stale`,lock:o};if(!c2(o.pid)){try{f(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}function w2(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=m2(n,t);if(_2(i)&&c(i))try{let e=JSON.parse(d(i,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==y())return;f(i)}catch(e){console.warn(`${r} Failed to release ${i}: ${e instanceof Error?e.message:String(e)}`)}}var T2=class extends p2{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function E2(e,t){try{return y2({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof p2&&e.lockName===`server`?new T2(e.existing,e.lockPath):e}}function D2(e,t){x2({lockName:`server`,lockDir:e,port:t})}function O2(e){return S2({lockName:`server`,lockDir:e})}function k2(e){w2({lockName:`server`,lockDir:e})}export{SG as $,Ys as $i,L1 as $n,wQ as $r,M$ as $t,Kq as A,pl as Ai,Wq as An,W0 as Ar,jW as At,t0 as B,M as Bi,$q as Bn,cq as Br,$Q as Bt,LQ as C,bl as Ci,z1 as Cn,I0 as Cr,B$ as Ct,IQ as D,vl as Di,x1 as Dn,hG as Dr,XQ as Dt,DQ as E,Zc as Ei,v1 as En,u0 as Er,A1 as Et,rG as F,Ns as Fi,Nq as Fn,XW as Fr,S1 as Ft,J1 as G,F as Gi,m1 as Gn,NG as Gr,Qq as Gt,q1 as H,Tc as Hi,h1 as Hn,Rq as Hr,v$ as Ht,$1 as I,oc as Ii,Fq as In,KZ as Ir,w1 as It,_G as J,N as Ji,d1 as Jn,eG as Jr,h$ as Jt,K1 as K,qs as Ki,l1 as Kn,Iq as Kr,b$ as Kt,r0 as L,P as Li,G1 as Ln,hQ as Lr,I$ as Lt,qQ as M,Yc as Mi,Eq as Mn,w0 as Mr,s$ as Mt,Bq as N,Hc as Ni,jq as Nn,o2 as Nr,d$ as Nt,EQ as O,ll as Oi,g1 as On,mG as Or,zQ as Ot,QW as P,Uc as Pi,Aq as Pn,gq as Pr,$G as Pt,CG as Q,k as Qi,M1 as Qn,LG as Qr,N$ as Qt,n0 as R,Rs as Ri,P0 as Rn,uQ as Rr,EG as Rt,OQ as S,xl as Si,i$ as Sn,a2 as Sr,n$ as St,RQ as T,Wc as Ti,_1 as Tn,f0 as Tr,k1 as Tt,X1 as U,Zs as Ui,f1 as Un,NW as Ur,x$ as Ut,Q1 as V,j as Vi,m$ as Vn,H0 as Vr,C$ as Vt,Y1 as W,$s as Wi,p1 as Wn,vq as Wr,S$ as Wt,wG as X,Oc as Xi,T1 as Xn,zW as Xr,qZ as Xt,TG as Y,sc as Yi,D1 as Yn,pG as Yr,_$ as Yt,xG as Z,tc as Zi,I1 as Zn,IW as Zr,F$ as Zt,z0 as _,D as _a,Rc as _i,A0 as _n,Jq as _r,WQ as _t,y2 as a,Ua as aa,fq as ai,Y$ as an,j$ as ar,W$ as at,D$ as b,Ic as bi,yG as bn,vG as br,kG as bt,l2 as c,vr as ca,ZW as ci,Yq as cn,n1 as cr,eK as ct,C2 as d,fn as da,_q as di,l$ as dn,Xq as dr,PG as dt,Hs as ea,WW as ei,MG as en,R1 as er,Vq as et,O2 as f,mn as fa,Ny as fi,r1 as fn,c$ as fr,DG as ft,D2 as g,O as ga,Bc as gi,k0 as gn,YW as gr,GQ as gt,x2 as h,Tt as ha,yl as hi,ZG as hn,EW as hr,e1 as ht,T2 as i,da as ia,x0 as ii,gG as in,A$ as ir,U$ as it,JQ as j,Qc as ji,wq as jn,F0 as jr,o$ as jt,FQ as k,ol as ki,H1 as kn,VW as kr,BQ as kt,m2 as l,cn as la,cQ as li,Z$ as ln,AG as lr,jG as lt,k2 as m,Lt as ma,I as mi,QG as mn,DW as mr,$$ as mt,d2 as n,Vo as na,Z0 as ni,IG as nn,F1 as nr,VQ as nt,E2 as o,Wa as oa,FW as oi,q$ as on,k$ as or,V$ as ot,w2 as p,on as pa,Cf as pi,i1 as pn,PQ as pr,p$ as pt,bG as q,A as qi,u1 as qn,hK as qr,y$ as qt,f2 as r,zo as ra,G0 as ri,RG as rn,N1 as rr,HQ as rt,c2 as s,ai as sa,s2 as si,Gq as sn,t1 as sr,H$ as st,p2 as t,_s as ta,TQ as ti,u$ as tn,P1 as tr,Uq as tt,S2 as u,un as ua,LW as ui,Q$ as un,Zq as ur,zG as ut,OG as v,pt as va,zc as vi,M0 as vn,Y0 as vr,G$ as vt,kQ as w,hl as wi,U1 as wn,GX as wr,O1 as wt,O$ as x,Fc as xi,r$ as xn,B0 as xr,YG as xt,XG as y,ft as ya,Lc as yi,FG as yn,X0 as yr,K$ as yt,e0 as z,Bs as zi,L$ as zn,YJ as zr,mK as zt};
432
+ //# sourceMappingURL=server-lock-BpjJj3OD-Cp5gb64m.mjs.map