@inkeep/open-knowledge 0.32.0 → 0.33.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/assets/skills/write-skill/SKILL.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-CLnYEWN_.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-B95G78xI.mjs +1 -0
- package/dist/{init-C2r4HoHs.mjs → init-Cv8r5418.mjs} +3 -3
- package/dist/{launch-json-removal-BfoeuI7f.mjs → launch-json-removal-kq5Dt0Gk.mjs} +2 -2
- package/dist/loader-DmyBlNAH.mjs +1 -0
- package/dist/{loader-CxNDKc93.mjs → loader-LweoGzIS.mjs} +2 -2
- package/dist/{preview-Bvbpyv--.mjs → preview-CGoJaoXU.mjs} +2 -2
- package/dist/preview-DxyaYzYn.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-Ba-bfAiX.js → ActivityModeContent-BhjZd4ih.js} +1 -1
- package/dist/public/assets/CodeMirrorPropInput-BTKAJRoj.js +3 -0
- package/dist/public/assets/{DocumentContext-BJbSJRci.js → DocumentContext-GpXOb1VS.js} +10 -10
- package/dist/public/assets/{EnableSyncConfirmDialog-CuaSvKB1.js → EnableSyncConfirmDialog-WW7JP--8.js} +1 -1
- package/dist/public/assets/{GraphPanel-DtZU7MKb.js → GraphPanel-ykpjTMSi.js} +2 -2
- package/dist/public/assets/{ManagedArtifactProperties-JMV0IEuF.js → ManagedArtifactProperties-B2BQrtZM.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-DVy6MCjX.js → McpConsentDialogBody-onnJGUtF.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-BMbyBiug.js → MermaidDocEditor-BqGd0qfH.js} +1 -1
- package/dist/public/assets/PropertyPanel-DttU8Udw.js +2 -0
- package/dist/public/assets/ReportBugDialogBody-Doy_5VwI.js +2 -0
- package/dist/public/assets/{SettingsDialogBody-BvAZmxYL.js → SettingsDialogBody-CTxuhPRl.js} +2 -2
- package/dist/public/assets/{ShareBranchSwitchDialog-DWVhrFVz.js → ShareBranchSwitchDialog-BFGW5yvV.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-Dcdgu5Am.js → ShareReceiveDialog-DZDGHPPI.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DNtLs0wb.js → ShareReceiveMissDialog-Xhuw-myx.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-Dt5d8SXa.js → SkillEditorActions-Bwdh1Cf-.js} +1 -1
- package/dist/public/assets/{SourceEditor-UX6BqbX7.js → SourceEditor-BxbaznDP.js} +1 -1
- package/dist/public/assets/{TerminalPanel-BFafphd6.js → TerminalPanel-DQ0dcqkQ.js} +3 -3
- package/dist/public/assets/{agent-presence-DqLAvigl.js → agent-presence-CqgjG_1n.js} +1 -1
- package/dist/public/assets/{auth-state-cache-QUPpmdqH.js → auth-state-cache-ClzBZ7Ym.js} +4 -4
- package/dist/public/assets/config-provider-BAZc28q7.js +4 -0
- package/dist/public/assets/{dist-BEKDTMMu.js → dist-6XgTb6IH.js} +38 -38
- package/dist/public/assets/{dist-CIT-prsb.js → dist-Dol8Q1cO.js} +1 -1
- package/dist/public/assets/{doc-hash-D0I6XgPI.js → doc-hash-BiliQUlA.js} +1 -1
- package/dist/public/assets/{documents-events-BQSqJQJB.js → documents-events-u9inGgjg.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-DaXA0KPI.js → file-tree-adapter-DqUi4Yv0.js} +1 -1
- package/dist/public/assets/{index-m-YYl3DI.js → index-C3-m6mEi.js} +101 -101
- package/dist/public/assets/index-Cs4DTKOK.css +1 -0
- package/dist/public/assets/{lint-config-client-C87QT4oR.js → lint-config-client-D8iMCwfL.js} +1 -1
- package/dist/public/assets/{navigation-targets-DimlRQoH.js → navigation-targets-CKcxoAuN.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-DdrveA_U.js → open-managed-artifact-tab-CHfy6RsF.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-r0qqDw8y.js → pending-receive-nav-store-jeeaEovU.js} +1 -1
- package/dist/public/assets/{prop-types-Btuscftq.js → prop-types-sQ-6_M35.js} +1 -1
- package/dist/public/assets/{receive-store-jYYq7nsV.js → receive-store-BGw3Wb65.js} +1 -1
- package/dist/public/assets/{selection-context-CmMnIxWO.js → selection-context-W2zA2_u8.js} +1 -1
- package/dist/public/assets/skill-actions-1nHLmqUS.js +1 -0
- package/dist/public/assets/{skills-api-XKVNnqvM.js → skills-api-B9bExOgu.js} +1 -1
- package/dist/public/assets/{src-JH0-HirD.js → src-DcaAGY7P.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-QXpwqbIe.js → target-navigation-intent-B1GFMD9p.js} +1 -1
- package/dist/public/assets/{telemetry-impl-CT_yT2nG.js → telemetry-impl-CeO1833o.js} +1 -1
- package/dist/public/assets/{telemetry-startup-Dku7aWfY.js → telemetry-startup-DCPtDyw3.js} +1 -1
- package/dist/public/assets/typing-burst-detector-BBVTllDg.js +6 -0
- package/dist/public/assets/{use-apply-config-color-theme-PTVndRD5.js → use-apply-config-color-theme-DJmOs4Mx.js} +2 -2
- package/dist/public/assets/{workspace-paths-CLF-iWdG.js → workspace-paths-4LdXG6d2.js} +1 -1
- package/dist/public/index.html +27 -27
- package/dist/{repair-launch-json-Bw4ygbCe.mjs → repair-launch-json-F3MZs-IY.mjs} +2 -2
- package/dist/{repair-mcp-configs-CbNAbonO.mjs → repair-mcp-configs-DeF097He.mjs} +2 -2
- package/dist/{src-P1FPnfSV.mjs → src-ClCLBBac.mjs} +2 -2
- package/dist/start-Bip4i7l5.mjs +1 -0
- package/dist/{start-DY6xnqxj.mjs → start-Oqkv042N.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-C2I3YwtS.mjs +0 -2
- package/dist/init-BqH_ZeQ0.mjs +0 -1
- package/dist/loader-Vfl986qk.mjs +0 -1
- package/dist/preview-BIgdQMUr.mjs +0 -1
- package/dist/public/assets/CodeMirrorPropInput-CALfAE-h.js +0 -3
- package/dist/public/assets/PropertyPanel-D2gRrYh6.js +0 -2
- package/dist/public/assets/ReportBugDialogBody-DovXzpjB.js +0 -2
- package/dist/public/assets/config-provider-C40v-5G5.js +0 -4
- package/dist/public/assets/index-qYHC7Z3g.css +0 -1
- package/dist/public/assets/skill-actions-ChX86s2O.js +0 -1
- package/dist/public/assets/typing-burst-detector-c4L7GJUT.js +0 -6
- package/dist/start-Br0Z6-BN.mjs +0 -1
|
@@ -394,7 +394,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
394
394
|
`,PLUGIN_SECURE_PROXY_MISSING_CHAT_MODEL:`Could not find a chat model defined in the secure proxy plugin configuration.
|
|
395
395
|
Please provide a chat model before proceeding with creating an answer session.
|
|
396
396
|
Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#plugin-secure-proxy
|
|
397
|
-
`,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:`The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.`,PLUGIN_COMPONENT_CONFLICT:`The component "%s" is already defined. The plugin "%s" is trying to redefine it.`};function wZ(e,...t){let n=Error(tZ(CZ[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,`captureStackTrace`in Error.prototype&&Error.captureStackTrace(n),n}function TZ(e){return{raw:Number(e),formatted:aZ(e)}}function EZ(e){if(e.id){if(typeof e.id!=`string`)throw wZ(`DOCUMENT_ID_MUST_BE_STRING`,typeof e.id);return e.id}return sZ()}function DZ(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];if(t!==void 0&&!(r===`geopoint`&&typeof t==`object`&&typeof t.lon==`number`&&typeof t.lat==`number`)&&!(r===`enum`&&(typeof t==`string`||typeof t==`number`))){if(r===`enum[]`&&Array.isArray(t)){let e=t.length;for(let r=0;r<e;r++)if(typeof t[r]!=`string`&&typeof t[r]!=`number`)return n+`.`+r;continue}if(jZ(r)){let e=PZ(r);if(!Array.isArray(t)||t.length!==e)throw wZ(`INVALID_INPUT_VECTOR`,n,e,t.length);continue}if(MZ(r)){if(!Array.isArray(t))return n;let e=NZ(r),i=t.length;for(let r=0;r<i;r++)if(typeof t[r]!==e)return n+`.`+r;continue}if(typeof r==`object`){if(!t||typeof t!=`object`)return n;let e=DZ(t,r);if(e)return n+`.`+e;continue}if(typeof t!==r)return n}}}var OZ={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},kZ={"string[]":`string`,"number[]":`number`,"boolean[]":`boolean`,"enum[]":`enum`};function AZ(e){return e===`geopoint`}function jZ(e){return typeof e==`string`&&/^vector\[\d+\]$/.test(e)}function MZ(e){return typeof e==`string`&&OZ[e]}function NZ(e){return kZ[e]}function PZ(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw wZ(`INVALID_VECTOR_VALUE`,e);case t<=0:throw wZ(`INVALID_VECTOR_SIZE`,e);default:return t}}function FZ(){return{idToInternalId:new Map,internalIdToId:[],save:IZ,load:LZ}}function IZ(e){return{internalIdToId:e.internalIdToId}}function LZ(e,t){let{internalIdToId:n}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let r=n.length;for(let t=0;t<r;t++){let r=n[t];e.internalDocumentIDStore.idToInternalId.set(r,t+1),e.internalDocumentIDStore.internalIdToId.push(r)}}function RZ(e,t){if(typeof t==`string`){let n=e.idToInternalId.get(t);if(n)return n;let r=e.idToInternalId.size+1;return e.idToInternalId.set(t,r),e.internalIdToId.push(t),r}return t>e.internalIdToId.length?RZ(e,t.toString()):t}function zZ(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function BZ(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function VZ(e,t){let n=RZ(e.sharedInternalDocumentStore,t);return e.docs[n]}function HZ(e,t){let n=t.length,r=Array.from({length:n});for(let i=0;i<n;i++){let n=RZ(e.sharedInternalDocumentStore,t[i]);r[i]=e.docs[n]}return r}function UZ(e){return e.docs}function WZ(e,t,n,r){return e.docs[n]===void 0?(e.docs[n]=r,e.count++,!0):!1}function GZ(e,t){let n=RZ(e.sharedInternalDocumentStore,t);return e.docs[n]===void 0?!1:(delete e.docs[n],e.count--,!0)}function KZ(e){return e.count}function qZ(e,t){let n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function JZ(e){return{docs:e.docs,count:e.count}}function YZ(){return{create:BZ,get:VZ,getMultiple:HZ,getAll:UZ,store:WZ,remove:GZ,count:KZ,load:qZ,save:JZ}}var XZ=[`beforeInsert`,`afterInsert`,`beforeRemove`,`afterRemove`,`beforeUpdate`,`afterUpdate`,`beforeUpsert`,`afterUpsert`,`beforeSearch`,`afterSearch`,`beforeInsertMultiple`,`afterInsertMultiple`,`beforeRemoveMultiple`,`afterRemoveMultiple`,`beforeUpdateMultiple`,`afterUpdateMultiple`,`beforeUpsertMultiple`,`afterUpsertMultiple`,`beforeLoad`,`afterLoad`,`afterCreate`];function ZZ(e,t){let n=[],r=e.plugins?.length;if(!r)return n;for(let i=0;i<r;i++)try{let r=e.plugins[i];typeof r[t]==`function`&&n.push(r[t])}catch(e){throw console.error(`Caught error in getAllPluginsByHook:`,e),wZ(`PLUGIN_CRASHED`)}return n}var QZ=[`tokenizer`,`index`,`documentsStore`,`sorter`,`pinning`],$Z=[`validateSchema`,`getDocumentIndexId`,`getDocumentProperties`,`formatElapsedTime`];function eQ(e,t,n,r){if(e.some(gZ))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function tQ(e,t,n){if(e.some(gZ))return(async()=>{for(let r of e)await r(t,n)})();for(let r of e)r(t,n)}function nQ(e,t,n,r,i){if(e.some(gZ))return(async()=>{for(let a of e)await a(t,n,r,i)})();for(let a of e)a(t,n,r,i)}function rQ(e,t,n,r){if(e.some(gZ))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function iQ(e,t){if(e.some(gZ))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}var aQ=class e{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(e.getHeight(this.l),e.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return e.getHeight(this.l)-e.getHeight(this.r)}rotateLeft(){let e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(t){let n=new e(t.k,t.v);return n.l=t.l?e.fromJSON(t.l):null,n.r=t.r?e.fromJSON(t.r):null,n.h=t.h,n}},oQ=class e{root=null;insertCount=0;constructor(e,t){e!==void 0&&t!==void 0&&(this.root=new aQ(e,t))}insert(e,t,n=1e3){this.root=this.insertNode(this.root,e,t,n)}insertMultiple(e,t,n=1e3){for(let r of t)this.insert(e,r,n)}rebalance(){this.root&&=this.rebalanceNode(this.root)}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(t){let n=new e;return n.root=t.root?aQ.fromJSON(t.root):null,n.insertCount=t.insertCount||0,n}insertNode(e,t,n,r){if(e===null)return new aQ(t,[n]);let i=[],a=e,o=null;for(;a!==null;)if(i.push({parent:o,node:a}),t<a.k)if(a.l===null){a.l=new aQ(t,[n]),i.push({parent:a,node:a.l});break}else o=a,a=a.l;else if(t>a.k)if(a.r===null){a.r=new aQ(t,[n]),i.push({parent:a,node:a.r});break}else o=a,a=a.r;else return a.v.add(n),e;let s=!1;this.insertCount++%r===0&&(s=!0);for(let t=i.length-1;t>=0;t--){let{parent:n,node:r}=i[t];if(r.updateHeight(),s){let t=this.rebalanceNode(r);n?n.l===r?n.l=t:n.r===r&&(n.r=t):e=t}}return e}rebalanceNode(e){let t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&e.r.getBalanceFactor()<=0)return e.rotateLeft();if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){let t=this.findNodeByKey(e);return t?t.v:null}contains(e){return this.find(e)!==null}getSize(){let e=0,t=[],n=this.root;for(;n||t.length>0;){for(;n;)t.push(n),n=n.l;n=t.pop(),e++,n=n.r}return e}isBalanced(){if(!this.root)return!0;let e=[this.root];for(;e.length>0;){let t=e.pop(),n=t.getBalanceFactor();if(Math.abs(n)>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){let n=this.findNodeByKey(e);n&&(n.v.size===1?this.root=this.removeNode(this.root,e):n.v=new Set([...n.v.values()].filter(e=>e!==t)))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else if(e>t.k)t=t.r;else return t;return null}removeNode(e,t){if(e===null)return null;let n=[],r=e;for(;r!==null&&r.k!==t;)n.push(r),r=t<r.k?r.l:r.r;if(r===null)return e;if(r.l===null||r.r===null){let t=r.l?r.l:r.r;if(n.length===0)e=t;else{let e=n[n.length-1];e.l===r?e.l=t:e.r=t}}else{let e=r,t=r.r;for(;t.l!==null;)e=t,t=t.l;r.k=t.k,r.v=t.v,e.l===t?e.l=t.r:e.r=t.r,r=e}n.push(r);for(let t=n.length-1;t>=0;t--){let r=n[t];r.updateHeight();let i=this.rebalanceNode(r);if(t>0){let e=n[t-1];e.l===r?e.l=i:e.r===r&&(e.r=i)}else e=i}return e}rangeSearch(e,t){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),i.k>=e&&i.k<=t)for(let e of i.v)n.add(e);if(i.k>t)break;i=i.r}return n}greaterThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.r;if(i=r.pop(),t&&i.k>=e||!t&&i.k>e)for(let e of i.v)n.add(e);else if(i.k<=e)break;i=i.l}return n}lessThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),t&&i.k<=e||!t&&i.k<e)for(let e of i.v)n.add(e);else if(i.k>e)break;i=i.r}return n}},sQ=class e{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){let t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){let n=this.numberToDocumentId.get(t);n&&(n.delete(e),n.size===0&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(let t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`eq`:{let t=e[n],r=this.numberToDocumentId.get(t);return r?Array.from(r):[]}case`in`:{let t=e[n],r=new Set;for(let e of t){let t=this.numberToDocumentId.get(e);if(t)for(let e of t)r.add(e)}return Array.from(r)}case`nin`:{let t=new Set(e[n]),r=new Set;for(let[e,n]of this.numberToDocumentId.entries())if(!t.has(e))for(let e of n)r.add(e);return Array.from(r)}default:throw Error(`Invalid operation`)}}filterArr(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`containsAll`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e].filter(e=>t.has(e))));return Array.from(r)}case`containsAny`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e,...t]));return Array.from(r)}default:throw Error(`Invalid operation`)}}static fromJSON(t){if(!t.numberToDocumentId)throw Error(`Invalid Flat Tree JSON`);let n=new e;for(let[e,r]of t.numberToDocumentId)n.numberToDocumentId.set(e,new Set(r));return n}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map(([e,t])=>[e,Array.from(t)])}}};function cQ(e,t,n){if(n<0)return-1;if(e===t)return 0;let r=e.length,i=t.length;if(r===0)return i<=n?i:-1;if(i===0)return r<=n?r:-1;let a=Math.abs(r-i);if(e.startsWith(t))return a<=n?a:-1;if(t.startsWith(e))return 0;if(a>n)return-1;let o=[];for(let e=0;e<=r;e++){o[e]=[e];for(let t=1;t<=i;t++)o[e][t]=e===0?t:0}for(let a=1;a<=r;a++){let r=1/0;for(let n=1;n<=i;n++)e[a-1]===t[n-1]?o[a][n]=o[a-1][n-1]:o[a][n]=Math.min(o[a-1][n]+1,o[a][n-1]+1,o[a-1][n-1]+1),r=Math.min(r,o[a][n]);if(r>n)return-1}return o[r][i]<=n?o[r][i]:-1}function lQ(e,t,n){let r=cQ(e,t,n);return{distance:r,isBounded:r>=0}}var uQ=class e{k;s;c=new Map;d=new Set;e;w=``;constructor(e,t,n){this.k=e,this.s=t,this.e=n}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,n,r){let i=[this];for(;i.length>0;){let a=i.pop();if(a.e){let{w:i,d:o}=a;if(n&&i!==t)continue;if(cZ(e,i)!==null)if(r)if(Math.abs(t.length-i.length)<=r&&lQ(t,i,r).isBounded)e[i]=[];else continue;else e[i]=[];if(cZ(e,i)!=null&&o.size>0){let t=e[i];for(let e of o)t.includes(e)||t.push(e)}}a.c.size>0&&i.push(...a.c.values())}return e}insert(t,n){let r=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=r.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c){if(r=s,i+=l,i===a){s.e||=!0,s.addDocument(n);return}continue}let u=o.slice(0,l),d=o.slice(l),f=t.slice(i+l),p=new e(u[0],u,!1);if(r.c.set(u[0],p),p.updateParent(r),s.s=d,s.k=d[0],p.c.set(d[0],s),s.updateParent(p),f){let t=new e(f[0],f,!0);t.addDocument(n),p.c.set(f[0],t),t.updateParent(p)}else p.e=!0,p.addDocument(n);return}else{let a=new e(o,t.slice(i),!0);a.addDocument(n),r.c.set(o,a),a.updateParent(r);return}}r.e||=!0,r.addDocument(n)}_findLevenshtein(e,t,n,r,i){let a=[{node:this,index:t,tolerance:n}];for(;a.length>0;){let{node:t,index:n,tolerance:o}=a.pop();if(t.w.startsWith(e)){t.findAllWords(i,e,!1,0);continue}if(o<0)continue;if(t.e){let{w:n,d:a}=t;if(n&&(lQ(e,n,r).isBounded&&(i[n]=[]),cZ(i,n)!==void 0&&a.size>0)){let e=new Set(i[n]);for(let t of a)e.add(t);i[n]=Array.from(e)}}if(n>=e.length)continue;let s=e[n];if(t.c.has(s)){let e=t.c.get(s);a.push({node:e,index:n+1,tolerance:o})}a.push({node:t,index:n+1,tolerance:o-1});for(let[e,r]of t.c)a.push({node:r,index:n,tolerance:o-1}),e!==s&&a.push({node:r,index:n+1,tolerance:o-1})}}find(e){let{term:t,exact:n,tolerance:r}=e;if(r&&!n){let e={};return this._findLevenshtein(t,0,r,r,e),e}else{let e=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=e.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c)e=s,i+=l;else if(i+l===a)if(l===a-i){if(n)return{};{let e={};return s.findAllWords(e,t,n,r),e}}else return{};else return{}}else return{}}let o={};return e.findAllWords(o,t,n,r),o}}contains(e){let t=this,n=0,r=e.length;for(;n<r;){let i=e[n],a=t.c.get(i);if(a){let i=a.s,o=i.length,s=0;for(;s<o&&n+s<r&&i[s]===e[n+s];)s++;if(s<o)return!1;n+=o,t=a}else return!1}return!0}removeWord(e){if(!e)return!1;let t=this,n=e.length,r=[];for(let i=0;i<n;i++){let n=e[i];if(t.c.has(n)){let e=t.c.get(n);r.push({parent:t,character:n}),i+=e.s.length-1,t=e}else return!1}for(t.d.clear(),t.e=!1;r.length>0&&t.c.size===0&&!t.e&&t.d.size===0;){let{parent:e,character:n}=r.pop();e.c.delete(n),t=e}return!0}removeDocumentByWord(e,t,n=!0){if(!e)return!0;let r=this,i=e.length;for(let a=0;a<i;a++){let i=e[a];if(r.c.has(i)){let o=r.c.get(i);a+=o.s.length-1,r=o,n&&r.w!==e||r.removeDocument(t)}else return!1}return!0}static getCommonPrefix(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return e.slice(0,r)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map(([e,t])=>[e,t.toJSON()])}}static fromJSON(t){let n=new e(t.k,t.s,t.e);return n.w=t.w,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([t,n])=>[t,e.fromJSON(n)])||[]),n}},dQ=class e extends uQ{constructor(){super(``,``,!1)}static fromJSON(t){let n=new e;return n.w=t.w,n.s=t.s,n.e=t.e,n.k=t.k,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([e,t])=>[e,uQ.fromJSON(t)])||[]),n}toJSON(){return super.toJSON()}},fQ=2,pQ=6371e3,mQ=class e{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(t,n=null){let r=new e(t.point,t.docIDs);return r.parent=n,t.left&&(r.left=e.fromJSON(t.left,r)),t.right&&(r.right=e.fromJSON(t.right,r)),r}},hQ=class e{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);if(r){t.forEach(e=>r.docIDs.add(e));return}let i=new mQ(e,t);if(this.nodeMap.set(n,i),this.root==null){this.root=i;return}let a=this.root,o=0;for(;;){if(o%fQ===0)if(e.lon<a.point.lon){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}else if(e.lat<a.point.lat){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}o++}}contains(e){let t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){let t=this.getPointKey(e),n=this.nodeMap.get(t);return n?Array.from(n.docIDs):null}removeDocByID(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);r&&(r.docIDs.delete(t),r.docIDs.size===0&&(this.nodeMap.delete(n),this.deleteNode(r)))}deleteNode(e){let t=e.parent,n=e.left?e.left:e.right;n&&(n.parent=t),t?t.left===e?t.left=n:t.right===e&&(t.right=n):(this.root=n,this.root&&(this.root.parent=null))}searchByRadius(t,n,r=!0,i=`asc`,a=!1){let o=a?e.vincentyDistance:e.haversineDistance,s=[{node:this.root,depth:0}],c=[];for(;s.length>0;){let{node:e,depth:i}=s.pop();if(e==null)continue;let a=o(t,e.point);(r?a<=n:a>n)&&c.push({point:e.point,docIDs:Array.from(e.docIDs)}),e.left!=null&&s.push({node:e.left,depth:i+1}),e.right!=null&&s.push({node:e.right,depth:i+1})}return i&&c.sort((e,n)=>{let r=o(t,e.point),a=o(t,n.point);return i.toLowerCase()===`asc`?r-a:a-r}),c}searchByPolygon(t,n=!0,r=null,i=!1){let a=[{node:this.root,depth:0}],o=[];for(;a.length>0;){let{node:r,depth:i}=a.pop();if(r==null)continue;r.left!=null&&a.push({node:r.left,depth:i+1}),r.right!=null&&a.push({node:r.right,depth:i+1});let s=e.isPointInPolygon(t,r.point);(s&&n||!s&&!n)&&o.push({point:r.point,docIDs:Array.from(r.docIDs)})}let s=e.calculatePolygonCentroid(t);if(r){let t=i?e.vincentyDistance:e.haversineDistance;o.sort((e,n)=>{let i=t(s,e.point),a=t(s,n.point);return r.toLowerCase()===`asc`?i-a:a-i})}return o}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(t){let n=new e;return t.root&&(n.root=mQ.fromJSON(t.root),n.buildNodeMap(n.root)),n}buildNodeMap(e){if(e==null)return;let t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,n=0,r=0,i=e.length;for(let a=0,o=i-1;a<i;o=a++){let i=e[a].lon,s=e[a].lat,c=e[o].lon,l=e[o].lat,u=i*l-c*s;t+=u,n+=(i+c)*u,r+=(s+l)*u}t/=2;let a=6*t;return n/=a,r/=a,{lon:n,lat:r}}static isPointInPolygon(e,t){let n=!1,r=t.lon,i=t.lat,a=e.length;for(let t=0,o=a-1;t<a;o=t++){let a=e[t].lon,s=e[t].lat,c=e[o].lon,l=e[o].lat;s>i!=l>i&&r<(c-a)*(i-s)/(l-s)+a&&(n=!n)}return n}static haversineDistance(e,t){let n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=(t.lat-e.lat)*n,o=(t.lon-e.lon)*n,s=Math.sin(a/2)*Math.sin(a/2)+Math.cos(r)*Math.cos(i)*Math.sin(o/2)*Math.sin(o/2);return pQ*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}static vincentyDistance(e,t){let n=6378137,r=1/298.257223563,i=(1-r)*n,a=Math.PI/180,o=e.lat*a,s=t.lat*a,c=(t.lon-e.lon)*a,l=Math.atan((1-r)*Math.tan(o)),u=Math.atan((1-r)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(u),m=Math.cos(u),h=c,g,_=1e3,v,y,b,x,S,C;do{let e=Math.sin(h),t=Math.cos(h);if(v=Math.sqrt(m*e*(m*e)+(f*p-d*m*t)*(f*p-d*m*t)),v===0)return 0;y=d*p+f*m*t,b=Math.atan2(v,y),x=f*m*e/v,S=1-x*x,C=y-2*d*p/S,isNaN(C)&&(C=0);let n=r/16*S*(4+r*(4-3*S));g=h,h=c+(1-n)*r*x*(b+n*v*(C+n*y*(-1+2*C*C)))}while(Math.abs(h-g)>1e-12&&--_>0);if(_===0)return NaN;let w=S*(n*n-i*i)/(i*i),T=1+w/16384*(4096+w*(-768+w*(320-175*w))),E=w/1024*(256+w*(-128+w*(74-47*w))),ee=E*v*(C+E/4*(y*(-1+2*C*C)-E/6*C*(-3+4*v*v)*(-3+4*C*C)));return i*T*(b-ee)}},gQ=class e{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(t){let n=new e;return n.true=new Set(t.true),n.false=new Set(t.false),n}};function _Q(e,t,n,r,i,{k:a,b:o,d:s}){return Math.log(1+(n-t+.5)/(t+.5))*(s+e*(a+1))/(e+a*(1-o+o*r/i))}var vQ=class e{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let n=yQ(t,this.size);this.vectors.set(e,[n,t])}remove(e){this.vectors.delete(e)}find(e,t,n){return e instanceof Float32Array||(e=new Float32Array(e)),bQ(e,n,this.vectors,this.size,t)}toJSON(){let e=[];for(let[t,[n,r]]of this.vectors)e.push([t,[n,Array.from(r)]]);return{size:this.size,vectors:e}}static fromJSON(t){let n=t,r=new e(n.size);for(let[e,[t,i]]of n.vectors)r.vectors.set(e,[t,new Float32Array(i)]);return r}};function yQ(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function bQ(e,t,n,r,i){let a=yQ(e,r),o=[],s=t||n.keys();for(let t of s){let s=n.get(t);if(!s)continue;let c=s[0],l=s[1],u=0;for(let t=0;t<r;t++)u+=e[t]*l[t];let d=u/(a*c);d>=i&&o.push([t,d])}return o}function xQ(e,t,n,r,i){let a=RZ(e.sharedInternalDocumentStore,n);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(i-1)+r.length)/i,e.fieldLengths[t][a]=r.length,e.frequencies[t][a]={}}function SQ(e,t,n,r,i){let a=0;for(let e of r)e===i&&a++;let o=RZ(e.sharedInternalDocumentStore,n),s=a/r.length;e.frequencies[t][o][i]=s,i in e.tokenOccurrences[t]||(e.tokenOccurrences[t][i]=0),e.tokenOccurrences[t][i]=(e.tokenOccurrences[t][i]??0)+1}function CQ(e,t,n,r){let i=RZ(e.sharedInternalDocumentStore,n);r>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*r-e.fieldLengths[t][i])/(r-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][i]=void 0,e.frequencies[t][i]=void 0}function wQ(e,t,n){e.tokenOccurrences[t][n]--}function TQ(e,t,n,r,i=``){r||={sharedInternalDocumentStore:t,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}};for(let[a,o]of Object.entries(n)){let n=`${i}${i?`.`:``}${a}`;if(typeof o==`object`&&!Array.isArray(o)){TQ(e,t,o,r,n);continue}if(jZ(o))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o,r.vectorIndexes[n]={type:`Vector`,node:new vQ(PZ(o)),isArray:!1};else{let e=/\[/.test(o);switch(o){case`boolean`:case`boolean[]`:r.indexes[n]={type:`Bool`,node:new gQ,isArray:e};break;case`number`:case`number[]`:r.indexes[n]={type:`AVL`,node:new oQ(0,[]),isArray:e};break;case`string`:case`string[]`:r.indexes[n]={type:`Radix`,node:new dQ,isArray:e},r.avgFieldLength[n]=0,r.frequencies[n]={},r.tokenOccurrences[n]={},r.fieldLengths[n]={};break;case`enum`:case`enum[]`:r.indexes[n]={type:`Flat`,node:new sQ,isArray:e};break;case`geopoint`:r.indexes[n]={type:`BKD`,node:new hQ,isArray:e};break;default:throw wZ(`INVALID_SCHEMA_TYPE`,Array.isArray(o)?`array`:o,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o}}return r}function EQ(e,t,n,r,i,a,o,s){return c=>{let{type:l,node:u}=t.indexes[n];switch(l){case`Bool`:u[c?`true`:`false`].add(r);break;case`AVL`:{let e=s?.avlRebalanceThreshold??1;u.insert(c,r,e);break}case`Radix`:{let s=a.tokenize(c,i,n,!1);e.insertDocumentScoreParameters(t,n,r,s,o);for(let i of s)e.insertTokenScoreParameters(t,n,r,s,i),u.insert(i,r);break}case`Flat`:u.insert(c,r);break;case`BKD`:u.insert(c,[r]);break}}}function DQ(e,t,n,r,i,a,o,s,c,l,u){if(jZ(o))return OQ(t,n,a,r,i);let d=EQ(e,t,n,i,s,c,l,u);if(!MZ(o))return d(a);let f=a,p=f.length;for(let e=0;e<p;e++)d(f[e])}function OQ(e,t,n,r,i){e.vectorIndexes[t].node.add(i,n)}function kQ(e,t,n,r,i,a,o,s,c,l){if(jZ(o))return t.vectorIndexes[n].node.remove(i),!0;let{type:u,node:d}=t.indexes[n];switch(u){case`AVL`:return d.removeDocument(a,i),!0;case`Bool`:return d[a?`true`:`false`].delete(i),!0;case`Radix`:{let o=c.tokenize(a,s,n);e.removeDocumentScoreParameters(t,n,r,l);for(let r of o)e.removeTokenScoreParameters(t,n,r),d.removeDocumentByWord(r,i);return!0}case`Flat`:return d.removeDocument(i,a),!0;case`BKD`:return d.removeDocByID(a,i),!1}}function AQ(e,t,n,r,i,a,o,s,c,l){if(!MZ(o))return kQ(e,t,n,r,i,a,o,s,c,l);let u=NZ(o),d=a,f=d.length;for(let a=0;a<f;a++)kQ(e,t,n,r,i,d[a],u,s,c,l);return!0}function jQ(e,t,n,r,i,a,o,s,c,l){let u=Array.from(r),d=e.avgFieldLength[t],f=e.fieldLengths[t],p=e.tokenOccurrences[t],m=e.frequencies[t],h=typeof p[n]==`number`?p[n]??0:0,g=u.length;for(let e=0;e<g;e++){let r=u[e];if(c&&!c.has(r))continue;l.has(r)||l.set(r,new Map);let p=l.get(r);p.set(t,(p.get(t)||0)+1);let g=_Q(m?.[r]?.[n]??0,h,i,f[r],d,a);o.has(r)?o.set(r,o.get(r)+g*s):o.set(r,g*s)}}function MQ(e,t,n,r,i,a,o,s,c,l,u,d=0){let f=n.tokenize(t,r),p=f.length||1,m=new Map,h=new Map,g=new Map;for(let n of i){if(!(n in e.indexes))continue;let r=e.indexes[n],{type:i}=r;if(i!==`Radix`)throw wZ(`WRONG_SEARCH_PROPERTY_TYPE`,n);let d=s[n]??1;if(d<=0)throw wZ(`INVALID_BOOST_VALUE`,d);f.length===0&&!t&&f.push(``);let p=f.length;for(let t=0;t<p;t++){let i=f[t],s=r.node.find({term:i,exact:a,tolerance:o}),p=Object.keys(s);p.length>0&&h.set(i,!0);let _=p.length;for(let t=0;t<_;t++){let r=p[t],i=s[r];jQ(e,n,r,i,l,c,g,d,u,m)}}}let _=Array.from(g.entries()).map(([e,t])=>[e,t]).sort((e,t)=>t[1]-e[1]);if(_.length===0)return[];if(d===1)return _;if(d===0){if(p===1)return _;for(let e of f)if(!h.get(e))return[];return _.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1})}let v=_.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1});if(v.length>0){let e=_.filter(([e])=>!v.some(([t])=>t===e)),t=Math.ceil(e.length*d);return[...v,...e.slice(0,t)]}return _}function NQ(e,t,n,r){if(`and`in n&&n.and&&Array.isArray(n.and)){let i=n.and;return i.length===0?new Set:vZ(...i.map(n=>NQ(e,t,n,r)))}if(`or`in n&&n.or&&Array.isArray(n.or)){let i=n.or;return i.length===0?new Set:i.map(n=>NQ(e,t,n,r)).reduce((e,t)=>bZ(e,t),new Set)}if(`not`in n&&n.not){let i=n.not,a=new Set,o=e.sharedInternalDocumentStore;for(let e=1;e<=o.internalIdToId.length;e++)a.add(e);return xZ(a,NQ(e,t,i,r))}let i=Object.keys(n),a=i.reduce((e,t)=>({[t]:new Set,...e}),{});for(let o of i){let i=n[o];if(e.indexes[o]===void 0)throw wZ(`UNKNOWN_FILTER_PROPERTY`,o);let{node:s,type:c,isArray:l}=e.indexes[o];if(c===`Bool`){let e=s,t=i?e.true:e.false;a[o]=bZ(a[o],t);continue}if(c===`BKD`){let e;if(`radius`in i)e=`radius`;else if(`polygon`in i)e=`polygon`;else throw Error(`Invalid operation ${i}`);if(e===`radius`){let{value:t,coordinates:n,unit:r=`m`,inside:c=!0,highPrecision:l=!1}=i[e],u=mZ(t,r),d=s.searchByRadius(n,u,c,void 0,l);a[o]=zQ(a[o],d)}else{let{coordinates:t,inside:n=!0,highPrecision:r=!1}=i[e],c=s.searchByPolygon(t,n,void 0,r);a[o]=zQ(a[o],c)}continue}if(c===`Radix`&&(typeof i==`string`||Array.isArray(i))){for(let e of[i].flat()){let n=t.tokenize(e,r,o);for(let e of n){let t=s.find({term:e,exact:!0});a[o]=UQ(a[o],t)}}continue}let u=Object.keys(i);if(u.length>1)throw wZ(`INVALID_FILTER_OPERATION`,u.length);if(c===`Flat`){let e=new Set(l?s.filterArr(i):s.filter(i));a[o]=bZ(a[o],e);continue}if(c===`AVL`){let e=u[0],t=i[e],n;switch(e){case`gt`:n=s.greaterThan(t,!1);break;case`gte`:n=s.greaterThan(t,!0);break;case`lt`:n=s.lessThan(t,!1);break;case`lte`:n=s.lessThan(t,!0);break;case`eq`:n=s.find(t)??new Set;break;case`between`:{let[e,r]=t;n=s.rangeSearch(e,r);break}default:throw wZ(`INVALID_FILTER_OPERATION`,e)}a[o]=bZ(a[o],n)}}return vZ(...Object.values(a))}function PQ(e){return e.searchableProperties}function FQ(e){return e.searchablePropertiesWithTypes}function IQ(e,t){let{indexes:n,vectorIndexes:r,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}=t,u={},d={};for(let e of Object.keys(n)){let{node:t,type:r,isArray:i}=n[e];switch(r){case`Radix`:u[e]={type:`Radix`,node:dQ.fromJSON(t),isArray:i};break;case`Flat`:u[e]={type:`Flat`,node:sQ.fromJSON(t),isArray:i};break;case`AVL`:u[e]={type:`AVL`,node:oQ.fromJSON(t),isArray:i};break;case`BKD`:u[e]={type:`BKD`,node:hQ.fromJSON(t),isArray:i};break;case`Bool`:u[e]={type:`Bool`,node:gQ.fromJSON(t),isArray:i};break;default:u[e]=n[e]}}for(let e of Object.keys(r))d[e]={type:`Vector`,isArray:!1,node:vQ.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}}function LQ(e){let{indexes:t,vectorIndexes:n,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}=e,l={};for(let e of Object.keys(n))l[e]=n[e].node.toJSON();let u={};for(let e of Object.keys(t)){let{type:n,node:r,isArray:i}=t[e];n===`Flat`||n===`Radix`||n===`AVL`||n===`BKD`||n===`Bool`?u[e]={type:n,node:r.toJSON(),isArray:i}:(u[e]=t[e],u[e].node=u[e].node.toJSON())}return{indexes:u,vectorIndexes:l,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}}function RQ(){return{create:TQ,insert:DQ,remove:AQ,insertDocumentScoreParameters:xQ,insertTokenScoreParameters:SQ,removeDocumentScoreParameters:CQ,removeTokenScoreParameters:wQ,calculateResultScores:jQ,search:MQ,searchByWhereClause:NQ,getSearchableProperties:PQ,getSearchablePropertiesWithTypes:FQ,load:IQ,save:LQ}}function zQ(e,t){e||=new Set;let n=t.length;for(let r=0;r<n;r++){let n=t[r].docIDs,i=n.length;for(let t=0;t<i;t++)e.add(n[t])}return e}function BQ(e,t,n=!1){let r=n?hQ.vincentyDistance:hQ.haversineDistance,i=[],a=[];for(let{point:n}of e)a.push(r(t,n));let o=Math.max(...a),s=0;for(let{docIDs:t}of e){let e=o-a[s]+1;for(let n of t)i.push([n,e]);s++}return i.sort((e,t)=>t[1]-e[1]),i}function VQ(e,t){let n=Object.keys(e);if(n.length!==1)return{isGeoOnly:!1};let r=n[0],i=e[r];if(t.indexes[r]===void 0)return{isGeoOnly:!1};let{type:a}=t.indexes[r];return a===`BKD`&&i&&(`radius`in i||`polygon`in i)?{isGeoOnly:!0,geoProperty:r,geoOperation:i}:{isGeoOnly:!1}}function HQ(e,t){let n=e,r=VQ(t,n);if(!r.isGeoOnly||!r.geoProperty||!r.geoOperation)return null;let{node:i}=n.indexes[r.geoProperty],a=r.geoOperation,o=i,s;if(`radius`in a){let{value:e,coordinates:t,unit:n=`m`,inside:r=!0,highPrecision:i=!1}=a.radius,c=t,l=mZ(e,n);return s=o.searchByRadius(c,l,r,`asc`,i),BQ(s,c,i)}else if(`polygon`in a){let{coordinates:e,inside:t=!0,highPrecision:n=!1}=a.polygon;s=o.searchByPolygon(e,t,`asc`,n);let r=hQ.calculatePolygonCentroid(e);return BQ(s,r,n)}return null}function UQ(e,t){e||=new Set;let n=Object.keys(t),r=n.length;for(let i=0;i<r;i++){let r=t[n[i]],a=r.length;for(let t=0;t<a;t++)e.add(r[t])}return e}function WQ(e,t,n,r,i){let a={language:e.tokenizer.language,sharedInternalDocumentStore:t,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[o,s]of Object.entries(n)){let n=`${i}${i?`.`:``}${o}`;if(!r.includes(n)){if(typeof s==`object`&&!Array.isArray(s)){let i=WQ(e,t,s,r,n);eZ(a.sortableProperties,i.sortableProperties),a.sorts={...a.sorts,...i.sorts},a.sortablePropertiesWithTypes={...a.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!jZ(s))switch(s){case`boolean`:case`number`:case`string`:a.sortableProperties.push(n),a.sortablePropertiesWithTypes[n]=s,a.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:s};break;case`geopoint`:case`enum`:continue;case`enum[]`:case`boolean[]`:case`number[]`:case`string[]`:continue;default:throw wZ(`INVALID_SORT_SCHEMA_TYPE`,Array.isArray(s)?`array`:s,n)}}}return a}function GQ(e,t,n,r){return r?.enabled===!1?{disabled:!0}:WQ(e,t,n,(r||{}).unsortableProperties||[],``)}function KQ(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;let i=RZ(e.sharedInternalDocumentStore,n),a=e.sorts[t];a.orderedDocsToRemove.has(i)&&$Q(e,t),a.docs.set(i,a.orderedDocs.length),a.orderedDocs.push([i,r])}function qQ(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let n of t)ZQ(e,n);e.isSorted=!0}function JQ(e,t,n){return t[1].localeCompare(n[1],qX(e))}function YQ(e,t){return e[1]-t[1]}function XQ(e,t){return t[1]?-1:1}function ZQ(e,t){let n=e.sorts[t],r;switch(n.type){case`string`:r=JQ.bind(null,e.language);break;case`number`:r=YQ.bind(null);break;case`boolean`:r=XQ.bind(null);break}n.orderedDocs.sort(r);let i=n.orderedDocs.length;for(let e=0;e<i;e++){let t=n.orderedDocs[e][0];n.docs.set(t,e)}}function QQ(e){let t=Object.keys(e.sorts);for(let n of t)$Q(e,n)}function $Q(e,t){let n=e.sorts[t];n.orderedDocsToRemove.size&&(n.orderedDocs=n.orderedDocs.filter(e=>!n.orderedDocsToRemove.has(e[0])),n.orderedDocsToRemove.clear())}function e$(e,t,n){if(!e.enabled)return;let r=e.sorts[t],i=RZ(e.sharedInternalDocumentStore,n);r.docs.get(i)&&(r.docs.delete(i),r.orderedDocsToRemove.set(i,!0))}function t$(e,t,n){if(!e.enabled)throw wZ(`SORT_DISABLED`);let r=n.property,i=n.order===`DESC`,a=e.sorts[r];if(!a)throw wZ(`UNABLE_TO_SORT_ON_UNKNOWN_FIELD`,r,e.sortableProperties.join(`, `));return $Q(e,r),qQ(e),t.sort((t,n)=>{let r=a.docs.get(RZ(e.sharedInternalDocumentStore,t[0])),o=a.docs.get(RZ(e.sharedInternalDocumentStore,n[0])),s=r!==void 0,c=o!==void 0;return!s&&!c?0:s?c?i?o-r:r-o:-1:1}),t}function n$(e){return e.enabled?e.sortableProperties:[]}function kie(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function r$(e,t){let n=t;if(!n.enabled)return{enabled:!1};let r=Object.keys(n.sorts).reduce((e,t)=>{let{docs:r,orderedDocs:i,type:a}=n.sorts[t];return e[t]={docs:new Map(Object.entries(r).map(([e,t])=>[+e,t])),orderedDocsToRemove:new Map,orderedDocs:i,type:a},e},{});return{sharedInternalDocumentStore:e,language:n.language,sortableProperties:n.sortableProperties,sortablePropertiesWithTypes:n.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:n.isSorted}}function i$(e){if(!e.enabled)return{enabled:!1};QQ(e),qQ(e);let t=Object.keys(e.sorts).reduce((t,n)=>{let{docs:r,orderedDocs:i,type:a}=e.sorts[n];return t[n]={docs:Object.fromEntries(r.entries()),orderedDocs:i,type:a},t},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}function a$(){return{create:GQ,insert:KQ,remove:e$,save:i$,load:r$,sortBy:t$,getSortableProperties:n$,getSortablePropertiesWithTypes:kie}}var o$=192,s$=383,c$=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115];function l$(e){return e<o$||e>s$?e:c$[e-o$]||e}function u$(e){let t=[];for(let n=0;n<e.length;n++)t[n]=l$(e.charCodeAt(n));return String.fromCharCode(...t)}var d$={ational:`ate`,tional:`tion`,enci:`ence`,anci:`ance`,izer:`ize`,bli:`ble`,alli:`al`,entli:`ent`,eli:`e`,ousli:`ous`,ization:`ize`,ation:`ate`,ator:`ate`,alism:`al`,iveness:`ive`,fulness:`ful`,ousness:`ous`,aliti:`al`,iviti:`ive`,biliti:`ble`,logi:`log`},f$={icate:`ic`,ative:``,alize:`al`,iciti:`ic`,ical:`ic`,ful:``,ness:``},p$=`[^aeiou]`,m$=`[aeiouy]`,h$=p$+`[^aeiouy]*`;m$+``;var g$=`^(`+h$+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,_$=`^(`+h$+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$`,v$=`^(`+h$+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,y$=`^(`+h$+`)?[aeiouy]`;function b$(e){let t,n,r,i,a,o;if(e.length<3)return e;let s=e.substring(0,1);if(s==`y`&&(e=s.toUpperCase()+e.substring(1)),r=/^(.+?)(ss|i)es$/,i=/^(.+?)([^s])s$/,r.test(e)?e=e.replace(r,`$1$2`):i.test(e)&&(e=e.replace(i,`$1$2`)),r=/^(.+?)eed$/,i=/^(.+?)(ed|ing)$/,r.test(e)){let t=r.exec(e);r=new RegExp(g$),r.test(t[1])&&(r=/.$/,e=e.replace(r,``))}else i.test(e)&&(t=i.exec(e)[1],i=new RegExp(y$),i.test(t)&&(e=t,i=/(at|bl|iz)$/,a=RegExp(`([^aeiouylsz])\\1$`),o=RegExp(`^`+h$+m$+`[^aeiouwxy]$`),i.test(e)?e+=`e`:a.test(e)?(r=/.$/,e=e.replace(r,``)):o.test(e)&&(e+=`e`)));if(r=/^(.+?)y$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(y$),t&&r.test(t)&&(e=t+`i`)),r=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(g$),t&&r.test(t)&&(e=t+d$[n])}if(r=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(g$),t&&r.test(t)&&(e=t+f$[n])}if(r=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,i=/^(.+?)(s|t)(ion)$/,r.test(e))t=r.exec(e)?.[1],r=new RegExp(v$),t&&r.test(t)&&(e=t);else if(i.test(e)){let n=i.exec(e);t=n?.[1]??``+n?.[2]??``,i=new RegExp(v$),i.test(t)&&(e=t)}return r=/^(.+?)e$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(v$),i=new RegExp(_$),a=RegExp(`^`+h$+m$+`[^aeiouwxy]$`),t&&(r.test(t)||i.test(t)&&!a.test(t))&&(e=t)),r=/ll$/,i=new RegExp(v$),r.test(e)&&i.test(e)&&(r=/.$/,e=e.replace(r,``)),s==`y`&&(e=s.toLowerCase()+e.substring(1)),e}function x$(e,t,n=!0){let r=`${this.language}:${e}:${t}`;return n&&this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(t)?(n&&this.normalizationCache.set(r,``),``):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=u$(t),n&&this.normalizationCache.set(r,t),t)}function S$(e){for(;e[e.length-1]===``;)e.pop();for(;e[0]===``;)e.shift();return e}function C$(e,t,n,r=!0){if(t&&t!==this.language)throw wZ(`LANGUAGE_NOT_SUPPORTED`,t);if(typeof e!=`string`)return[e];let i=this.normalizeToken.bind(this,n??``),a;if(n&&this.tokenizeSkipProperties.has(n))a=[i(e,r)];else{let t=GX[this.language];a=e.toLowerCase().split(t).map(e=>i(e,r)).filter(Boolean)}let o=S$(a);return this.allowDuplicates?o:Array.from(new Set(o))}function w$(e={}){if(!e.language)e.language=`english`;else if(!KX.includes(e.language))throw wZ(`LANGUAGE_NOT_SUPPORTED`,e.language);let t;if(e.stemming||e.stemmer&&!(`stemming`in e))if(e.stemmer){if(typeof e.stemmer!=`function`)throw wZ(`INVALID_STEMMER_FUNCTION_TYPE`);t=e.stemmer}else if(e.language===`english`)t=b$;else throw wZ(`MISSING_STEMMER`,e.language);let n;if(e.stopWords!==!1){if(n=[],Array.isArray(e.stopWords))n=e.stopWords;else if(typeof e.stopWords==`function`)n=e.stopWords(n);else if(e.stopWords)throw wZ(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);if(!Array.isArray(n))throw wZ(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);for(let e of n)if(typeof e!=`string`)throw wZ(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`)}let r={tokenize:C$,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:n,allowDuplicates:!!e.allowDuplicates,normalizeToken:x$,normalizationCache:new Map};return r.tokenize=C$.bind(r),r.normalizeToken=x$,r}function T$(e){return{sharedInternalDocumentStore:e,rules:new Map}}function E$(e,t){if(e.rules.has(t.id))throw Error(`PINNING_RULE_ALREADY_EXISTS: A pinning rule with id "${t.id}" already exists. Use updateRule to modify it.`);e.rules.set(t.id,t)}function D$(e,t){if(!e.rules.has(t.id))throw Error(`PINNING_RULE_NOT_FOUND: Cannot update pinning rule with id "${t.id}" because it does not exist. Use addRule to create it.`);e.rules.set(t.id,t)}function O$(e,t){return e.rules.delete(t)}function k$(e,t){return e.rules.get(t)}function A$(e){return Array.from(e.rules.values())}function j$(e,t){let n=e.toLowerCase().trim(),r=t.pattern.toLowerCase().trim();switch(t.anchoring){case`is`:return n===r;case`starts_with`:return n.startsWith(r);case`contains`:return n.includes(r);default:return!1}}function M$(e,t){return e?t.conditions.every(t=>j$(e,t)):!1}function N$(e,t){if(!t)return[];let n=[];for(let r of e.rules.values())M$(t,r)&&n.push(r);return n}function P$(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function F$(e){return{rules:Array.from(e.rules.entries())}}function I$(){return{create:T$,addRule:E$,updateRule:D$,removeRule:O$,getRule:k$,getAllRules:A$,getMatchingRules:N$,load:P$,save:F$}}function L$(e){let t={formatElapsedTime:TZ,getDocumentIndexId:EZ,getDocumentProperties:dZ,validateSchema:DZ};for(let n of $Z){let r=n;if(e[r]){if(typeof e[r]!=`function`)throw wZ(`COMPONENT_MUST_BE_FUNCTION`,r)}else e[r]=t[r]}for(let t of Object.keys(e))if(!QZ.includes(t)&&!$Z.includes(t))throw wZ(`UNSUPPORTED_COMPONENT`,t)}function R$({schema:e,sort:t,language:n,components:r,id:i,plugins:a}){r||={};for(let t of a??[]){if(!(`getComponents`in t)||typeof t.getComponents!=`function`)continue;let n=t.getComponents(e),i=Object.keys(n);for(let e of i)if(r[e])throw wZ(`PLUGIN_COMPONENT_CONFLICT`,e,t.name);r={...r,...n}}i||=sZ();let o=r.tokenizer,s=r.index,c=r.documentsStore,l=r.sorter,u=r.pinning;if(o=o?o.tokenize?o:w$(o):w$({language:n??`english`}),r.tokenizer&&n)throw wZ(`NO_LANGUAGE_WITH_CUSTOM_TOKENIZER`);let d=FZ();s||=RQ(),l||=a$(),c||=YZ(),u||=I$(),L$(r);let{getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,formatElapsedTime:h}=r,g={data:{},caches:{},schema:e,tokenizer:o,index:s,sorter:l,documentsStore:c,pinning:u,internalDocumentIDStore:d,getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeUpsert:[],afterUpsert:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],beforeUpdateMultiple:[],afterUpdateMultiple:[],beforeUpsertMultiple:[],afterUpsertMultiple:[],afterCreate:[],formatElapsedTime:h,id:i,plugins:a,version:z$()};g.data={index:g.index.create(g,d,e),docs:g.documentsStore.create(g,d),sorting:g.sorter.create(g,d,e,t),pinning:g.pinning.create(d)};for(let e of XZ)g[e]=(g[e]??[]).concat(ZZ(g,e));let _=g.afterCreate;return _&&iQ(_,g),g}function z$(){return`{{VERSION}}`}function B$(e){return e.documentsStore.count(e.data.docs)}function V$(e,t,n,r,i){let a=e.validateSchema(t,e.schema);if(a)throw wZ(`SCHEMA_VALIDATION_FAILURE`,a);return gZ(e.beforeInsert)||gZ(e.afterInsert)||gZ(e.index.beforeInsert)||gZ(e.index.insert)||gZ(e.index.afterInsert)?W$(e,t,n,r,i):G$(e,t,n,r,i)}var H$=new Set([`enum`,`enum[]`]),U$=new Set([`string`,`number`]);async function W$(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw wZ(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=RZ(e.internalDocumentIDStore,s);if(r||await eQ(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw wZ(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];K$(n,r,e,t)}return await q$(e,s,u,f,l,n,t,i),r||await eQ(e.afterInsert,e,s,t),s}function G$(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw wZ(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=RZ(e.internalDocumentIDStore,s);if(r||eQ(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw wZ(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];K$(n,r,e,t)}return J$(e,s,u,f,l,n,t,i),r||eQ(e.afterInsert,e,s,t),s}function K$(e,t,n,r){if(!(AZ(t)&&typeof r==`object`&&typeof r.lon==`number`&&typeof r.lat==`number`)&&!(jZ(t)&&Array.isArray(r))&&!(MZ(t)&&Array.isArray(r))&&!(H$.has(t)&&U$.has(e))&&e!==t)throw wZ(`INVALID_DOCUMENT_PROPERTY`,n,t,e)}async function q$(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o];await e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i);let l=e.internalDocumentIDStore.idToInternalId.get(t);await e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),await e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function J$(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o],l=RZ(e.internalDocumentIDStore,t);e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i),e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function Y$(e,t,n,r,i,a){return gZ(e.afterInsertMultiple)||gZ(e.beforeInsertMultiple)||gZ(e.index.beforeInsert)||gZ(e.index.insert)||gZ(e.index.afterInsert)?X$(e,t,n,r,i,a):Z$(e,t,n,r,i,a)}async function X$(e,t,n=1e3,r,i,a=0){let o=[],s=async a=>{let s=Math.min(a+n,t.length),c=t.slice(a,s);for(let t of c){let n=await V$(e,t,r,i,{avlRebalanceThreshold:c.length});o.push(n)}return s};return await(async()=>{let e=0;for(;e<t.length;){let t=Date.now();if(e=await s(e),a>0){let e=a-(Date.now()-t);e>0&&SZ(e)}}})(),i||await tQ(e.afterInsertMultiple,e,t),o}function Z$(e,t,n=1e3,r,i,a=0){let o=[],s=0;function c(){let a=t.slice(s*n,(s+1)*n);if(a.length===0)return!1;for(let t of a){let n=V$(e,t,r,i,{avlRebalanceThreshold:a.length});o.push(n)}return s++,!0}function l(){let e=Date.now();for(;c();)if(a>0){let t=Date.now()-e;if(t>=a){let e=a-t%a;e>0&&SZ(e)}}}return l(),i||tQ(e.afterInsertMultiple,e,t),o}function Q$(e,t){return e[1]-t[1]}function $$(e,t){return t[1]-e[1]}function e1(e=`desc`){return e.toLowerCase()===`asc`?Q$:$$}function t1(e,t,n){let r={},i=t.map(([e])=>e),a=e.documentsStore.getMultiple(e.data.docs,i),o=Object.keys(n),s=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e of o){let t;if(s[e]===`number`){let{ranges:r}=n[e],i=r.length,a=Array.from({length:i});for(let e=0;e<i;e++){let t=r[e];a[e]=[`${t.from}-${t.to}`,0]}t=Object.fromEntries(a)}r[e]={count:0,values:t??{}}}let c=a.length;for(let e=0;e<c;e++){let t=a[e];for(let e of o){let i=e.includes(`.`)?fZ(t,e):t[e],a=s[e],o=r[e].values;switch(a){case`number`:{let t=n[e].ranges;n1(t,o)(i);break}case`number[]`:{let t=new Set,r=n[e].ranges,a=n1(r,o,t);for(let e of i)a(e);break}case`boolean`:case`enum`:case`string`:r1(o,a)(i);break;case`boolean[]`:case`enum[]`:case`string[]`:{let e=r1(o,a===`boolean[]`?`boolean`:`string`,new Set);for(let t of i)e(t);break}default:throw wZ(`FACET_NOT_SUPPORTED`,a)}}}for(let e of o){let t=r[e];if(t.count=Object.keys(t.values).length,s[e]===`string`){let r=n[e],i=e1(r.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(r.offset??0,r.limit??10))}}return r}function n1(e,t,n){return r=>{for(let i of e){let e=`${i.from}-${i.to}`;n?.has(e)||r>=i.from&&r<=i.to&&(t[e]===void 0?t[e]=1:(t[e]++,n?.add(e)))}}}function r1(e,t,n){let r=t===`boolean`?`false`:``;return t=>{let i=t?.toString()??r;n?.has(i)||(e[i]=(e[i]??0)+1,n?.add(i))}}var i1={reducer:(e,t,n,r)=>(t[r]=n,t),getInitialValue:e=>Array.from({length:e})},a1=[`string`,`number`,`boolean`];function o1(e,t,n){let r=n.properties,i=r.length,a=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e=0;e<i;e++){let t=r[e];if(a[t]===void 0)throw wZ(`UNKNOWN_GROUP_BY_PROPERTY`,t);if(!a1.includes(a[t]))throw wZ(`INVALID_GROUP_BY_PROPERTY`,t,a1.join(`, `),a[t])}let o=t.map(([t])=>zZ(e.internalDocumentIDStore,t)),s=e.documentsStore.getMultiple(e.data.docs,o),c=s.length,l=n.maxResult||2**53-1,u=[],d={};for(let e=0;e<i;e++){let t=r[e],n={property:t,perValue:{}},i=new Set;for(let e=0;e<c;e++){let r=s[e],a=fZ(r,t);if(a===void 0)continue;let o=typeof a==`boolean`?``+a:a,c=n.perValue[o]??{indexes:[],count:0};c.count>=l||(c.indexes.push(e),c.count++,n.perValue[o]=c,i.add(a))}u.push(Array.from(i)),d[t]=n}let f=s1(u),p=f.length,m=[];for(let e=0;e<p;e++){let t=f[e],n=t.length,i={values:[],indexes:[]},a=[];for(let e=0;e<n;e++){let n=t[e],o=r[e];a.push(d[o].perValue[typeof n==`boolean`?``+n:n].indexes),i.values.push(n)}i.indexes=uZ(a).sort((e,t)=>e-t),i.indexes.length!==0&&m.push(i)}let h=m.length,g=Array.from({length:h});for(let e=0;e<h;e++){let r=m[e],i=n.reduce||i1,a=r.indexes.map(e=>({id:o[e],score:t[e][1],document:s[e]})),c=i.reducer.bind(null,r.values),l=i.getInitialValue(r.indexes.length),u=a.reduce(c,l);g[e]={values:r.values,result:u}}return g}function s1(e,t=0){if(t+1===e.length)return e[t].map(e=>[e]);let n=e[t],r=s1(e,t+1),i=[];for(let e of n)for(let t of r){let n=[e];eZ(n,t),i.push(n)}return i}function c1(e,t,n,r){let i=N$(t,r);if(i.length===0)return n;let a=i.flatMap(e=>e.consequence.promote);a.sort((e,t)=>e.position-t.position);let o=new Set,s=new Map,c=new Set;for(let t of a){let n=RZ(e.internalDocumentIDStore,t.doc_id);if(n!==void 0){if(s.has(n)){let e=s.get(n);t.position<e&&s.set(n,t.position);continue}c.has(t.position)||(o.add(n),s.set(n,t.position),c.add(t.position))}}if(s.size===0)return n;let l=n.filter(([e])=>!o.has(e)),u=[];for(let[t,r]of s.entries())n.find(([e])=>e===t)?u.push([t,1e6-r]):e.documentsStore.get(e.data.docs,t)&&u.push([t,0]);u.sort((e,t)=>(s.get(e[0])??1/0)-(s.get(t[0])??1/0));let d=[],f=new Map;for(let e of u){let t=s.get(e[0]);f.set(t,e)}let p=0,m=0;for(;m<l.length+u.length;)if(f.has(m))d.push(f.get(m)),m++;else if(p<l.length)d.push(l[p]),p++,m++;else break;for(let[e,t]of f.entries())e>=d.length&&d.push(t);return d}function l1(e,t,n){let{term:r,properties:i}=t,a=e.data.index,o=e.caches.propertiesToSearch;if(!o){let t=e.index.getSearchablePropertiesWithTypes(a);o=e.index.getSearchableProperties(a),o=o.filter(e=>t[e].startsWith(`string`)),e.caches.propertiesToSearch=o}if(i&&i!==`*`){for(let e of i)if(!o.includes(e))throw wZ(`UNKNOWN_INDEX`,e,o.join(`, `));o=o.filter(e=>i.includes(e))}let s=Object.keys(t.where??{}).length>0,c;s&&(c=e.index.searchByWhereClause(a,e.tokenizer,t.where,n));let l,u=t.threshold!==void 0&&t.threshold!==null?t.threshold:1;if(r||i){let i=B$(e);if(l=e.index.search(a,r||``,e.tokenizer,n,o,t.exact||!1,t.tolerance||0,t.boost||{},m1(t.relevance),i,c,u),t.exact&&r){let t=r.trim().split(/\s+/);l=l.filter(([n])=>{let r=e.documentsStore.get(e.data.docs,n);if(!r)return!1;for(let e of o){let n=d1(r,e);if(typeof n==`string`&&t.every(e=>RegExp(`\\b${u1(e)}\\b`).test(n)))return!0}return!1})}}else l=s?HQ(a,t.where)||(c?Array.from(c):[]).map(e=>[+e,0]):Object.keys(e.documentsStore.getAll(e.data.docs)).map(e=>[+e,0]);return l}function u1(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function d1(e,t){let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function f1(e,t,n){let r=oZ();function i(){let i=Object.keys(e.data.index.vectorIndexes),a=t.facets&&Object.keys(t.facets).length>0,{limit:o=10,offset:s=0,distinctOn:c,includeVectors:l=!1}=t,u=t.preflight===!0,d=l1(e,t,n);if(t.sortBy)if(typeof t.sortBy==`function`){let n=d.map(([e])=>e),r=e.documentsStore.getMultiple(e.data.docs,n).map((e,t)=>[d[t][0],d[t][1],e]);r.sort(t.sortBy),d=r.map(([e,t])=>[e,t])}else d=e.sorter.sortBy(e.data.sorting,d,t.sortBy).map(([t,n])=>[RZ(e.internalDocumentIDStore,t),n]);else d=d.sort(lZ);d=c1(e,e.data.pinning,d,t.term);let f;u||(f=c?E1(e,d,s,o,c):D1(e,d,s,o));let p={elapsed:{formatted:``,raw:0},hits:[],count:d.length};return f!==void 0&&(p.hits=f.filter(Boolean),l||hZ(p,i)),a&&(p.facets=t1(e,d,t.facets)),t.groupBy&&(p.groups=o1(e,d,t.groupBy)),p.elapsed=e.formatElapsedTime(oZ()-r),p}async function a(){e.beforeSearch&&await rQ(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await nQ(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}var p1={k:1.2,b:.75,d:.5};function m1(e){let t=e??{};return t.k=t.k??p1.k,t.b=t.b??p1.b,t.d=t.d??p1.d,t}function h1(e,t,n){let r=t.vector;if(r&&(!(`value`in r)||!(`property`in r)))throw wZ(`INVALID_VECTOR_INPUT`,Object.keys(r).join(`, `));let i=e.data.index.vectorIndexes[r.property];if(!i)throw wZ(`UNKNOWN_VECTOR_PROPERTY`,r.property);let a=i.node.size;if(r?.value.length!==a)throw r?.property===void 0||r?.value.length===void 0?wZ(`INVALID_INPUT_VECTOR`,`undefined`,a,`undefined`):wZ(`INVALID_INPUT_VECTOR`,r.property,a,r.value.length);let o=e.data.index,s;return Object.keys(t.where??{}).length>0&&(s=e.index.searchByWhereClause(o,e.tokenizer,t.where,n)),i.node.find(r.value,t.similarity??.8,s)}function g1(e,t,n=`english`){let r=oZ();function i(){let i=h1(e,t,n).sort(lZ);i=c1(e,e.data.pinning,i,void 0);let a=[];t.facets&&Object.keys(t.facets).length>0&&(a=t1(e,i,t.facets));let o=t.vector.property,s=t.includeVectors??!1,c=t.limit??10,l=t.offset??0,u=Array.from({length:c});for(let t=0;t<c;t++){let n=i[t+l];if(!n)break;let r=e.data.docs.docs[n[0]];r&&(s||(r[o]=null),u[t]={id:zZ(e.internalDocumentIDStore,n[0]),score:n[1],document:r})}let d=[];t.groupBy&&(d=o1(e,i,t.groupBy));let f=oZ()-r;return{count:i.length,hits:u.filter(Boolean),elapsed:{raw:Number(f),formatted:aZ(f)},...a?{facets:a}:{},...d?{groups:d}:{}}}async function a(){e.beforeSearch&&await rQ(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await nQ(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function _1(e,t,n){let r=b1(l1(e,t,n)),i=h1(e,t,n),a=t.hybridWeights;return C1(r,i,t.term??``,a)}function v1(e,t,n){let r=oZ();function i(){let i=_1(e,t,n);i=c1(e,e.data.pinning,i,t.term);let a;t.facets&&Object.keys(t.facets).length>0&&(a=t1(e,i,t.facets));let o;t.groupBy&&(o=o1(e,i,t.groupBy));let s=t.offset??0,c=t.limit??10,l=D1(e,i,s,c).filter(Boolean),u=oZ(),d={count:i.length,elapsed:{raw:Number(u-r),formatted:aZ(u-r)},hits:l,...a?{facets:a}:{},...o?{groups:o}:{}};return(t.includeVectors??!1)||hZ(d,Object.keys(e.data.index.vectorIndexes)),d}async function a(){e.beforeSearch&&await rQ(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await nQ(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function y1(e){return e[1]}function b1(e){let t=Math.max.apply(Math,e.map(y1));return e.map(([e,n])=>[e,n/t])}function x1(e,t){return e/t}function S1(e,t){return(n,r)=>n*e+r*t}function C1(e,t,n,r){let i=Math.max.apply(Math,e.map(y1)),a=Math.max.apply(Math,t.map(y1)),{text:o,vector:s}=r&&r.text&&r.vector?r:w1(n),c=new Map,l=e.length,u=S1(o,s);for(let t=0;t<l;t++){let[n,r]=e[t],a=u(x1(r,i),0);c.set(n,a)}let d=t.length;for(let e=0;e<d;e++){let[n,r]=t[e],i=x1(r,a),o=c.get(n)??0;c.set(n,o+u(0,i))}return[...c].sort((e,t)=>t[1]-e[1])}function w1(e){return{text:.5,vector:.5}}function T1(e,t,n){let r=t.mode??`fulltext`;if(r===`fulltext`)return f1(e,t,n);if(r===`vector`)return g1(e,t);if(r===`hybrid`)return v1(e,t);throw wZ(`INVALID_SEARCH_MODE`,r)}function E1(e,t,n,r,i){let a=e.data.docs,o=new Map,s=[],c=new Set,l=t.length,u=0;for(let d=0;d<l;d++){let l=t[d];if(l===void 0)continue;let[f,p]=l;if(c.has(f))continue;let m=e.documentsStore.get(a,f),h=fZ(m,i);if(!(h===void 0||o.has(h))&&(o.set(h,!0),u++,!(u<=n)&&(s.push({id:zZ(e.internalDocumentIDStore,f),score:p,document:m}),c.add(f),u>=n+r)))break}return s}function D1(e,t,n,r){let i=e.data.docs,a=Array.from({length:r}),o=new Set;for(let s=n;s<r+n;s++){let n=t[s];if(n===void 0)break;let[r,c]=n;if(!o.has(r)){let t=e.documentsStore.get(i,r);a[s]={id:zZ(e.internalDocumentIDStore,r),score:c,document:t},o.add(r)}}return a}var O1=n(UX(),1),k1=`0.0.0-unknown`,A1={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function j1({kind:e,runtimeVersion:t}){return{[A1.protocol]:`1`,[A1.runtime]:t,[A1.kind]:e}}function M1({kind:e,runtimeVersion:t}){return{clientProtocolVersion:1,clientRuntimeVersion:t,clientKind:e}}var N1=8192,P1=32768,F1=`…[truncated]`;function I1(e){let t=e.trim();if(t.length===0||t[0]!==`{`)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!=`object`||!n||Array.isArray(n))return null;let r=n;return{event:typeof r.event==`string`?r.event:void 0,fields:r}}function L1(e){return e.length<=8192?e:`${e.slice(0,N1-12)}${F1}`}var R1=`source`;function z1(e){return{ok:!1,error:e}}function B1(e){return{ok:!0,...e}}function V1(){return Kl.parse({})}function H1(e,t){let n=e.toString();if(n.length===0)return V1();let r=_r(n);if(r.errors.length>0)return console.warn(`[bindConfigDoc:${t}] Y.Text contains invalid YAML; returning schema defaults. Errors: ${r.errors.map(e=>e.message).join(`; `)}`),V1();let i=r.toJSON()??{},a=Kl.safeParse(i);return a.success?a.data:(console.warn(`[bindConfigDoc:${t}] Y.Text content fails schema validation; returning schema defaults. First issue: ${a.error.issues[0]?.message??`(unknown)`}`),V1())}function U1(e,t,n={}){return Jl(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>W1(e,t,n))}function W1(e,t,n){let{ytextKey:r=R1}=n,i=e.document,a=i.getText(r),o=new Set,s=new Set,c=!1,l=!1;function u(){if(c)return;let e=H1(a,t);for(let n of o)try{n(e)}catch(e){console.warn(`[bindConfigDoc:${t}] listener threw:`,e)}}function d(){if(c||(u(),l))return;l=!0;let e=[...s];s.clear();for(let n of e)try{n()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}a.observe(u),e.on(`synced`,d);function f(e){if(c)return z1({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=eu(e,t);if(n!==null)return z1(n);let r=_r(a.toString()),o=r.contents!==null&&!b(r.contents);if(r.errors.length>0||o){Yl(`config.corrupt-ytext-reset`,{"config.scope":t,"config.parse.errorCount":r.errors.length,"config.parse.topLevelNonMap":o});let e=r.errors.length>0?r.errors.map(e=>e.message).join(`; `):`top-level YAML is not a mapping`;console.warn(`[bindConfigDoc:${t}] dropping corrupt Y.Text and re-applying patch onto empty doc. Reason: ${e}`),r=_r(``)}r.contents===null&&(r.contents=r.createNode({}));let s=nu(r,e),l=r.toJSON()??{},u=Jl(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=Kl.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)Yl(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return z1({code:`SCHEMA_INVALID`,issues:u.error.issues.map(ru)});let d=r.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,d)}),B1({effective:u.data,appliedPaths:s})}return{current(){return H1(a,t)},patch(e){return Jl(`config.patch`,{"config.scope":t,"config.transport":`ytext`},t=>{let n=f(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})},subscribe(e){return o.add(e),()=>{o.delete(e)}},hasSynced(){return l},subscribeSynced(e){if(c)return()=>{};if(l){let n=!1;return queueMicrotask(()=>{if(!(n||c))try{e()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}),()=>{n=!0}}return s.add(e),()=>{s.delete(e)}},dispose(){c||(c=!0,a.unobserve(u),e.off(`synced`,d),o.clear(),s.clear())}}}var G1=`source`,K1=800;function q1(e){return{ok:!1,error:e}}function J1(e){return{ok:!0,...e}}function Y1(e,t={}){let{ytextKey:n=G1,acceptanceDelayMs:r=K1}=t,i=e.document,a=i.getText(n),o=new Set,s=new Set,c=new Set,l=!1,u=`idle`,d=null;function f(){d!==null&&(clearTimeout(d),d=null)}function p(e){if(!l&&u!==e){u=e;for(let t of c)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] status listener threw:`,e)}}}function m(){if(l)return;let e=a.toString();for(let t of o)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] text listener threw:`,e)}}function h(e){if(!l)for(let t of s)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] rejection listener threw:`,e)}}return a.observe(m),e.on(`synced`,m),{current(){return a.toString()},patch(e){return l?q1({code:`WRITE_ERROR`,detail:`OkignoreBinding has been disposed`}):(i.transact(()=>{a.length>0&&a.delete(0,a.length),e.length>0&&a.insert(0,e)}),f(),p(`pending`),d=setTimeout(()=>{d=null,!l&&u===`pending`&&p(`accepted`)},r),J1({text:e}))},subscribe(e){return o.add(e),()=>{o.delete(e)}},subscribeRejection(e){return s.add(e),()=>{s.delete(e)}},subscribeStatus(e){return c.add(e),()=>{c.delete(e)}},status(){return u},notifyRejection(e){l||(f(),p(`rejected`),h({error:e,text:a.toString()}))},dispose(){l||(l=!0,f(),a.unobserve(m),e.off(`synced`,m),o.clear(),s.clear(),c.clear())}}}function X1(e,t,n){return Z1([e,t,n],[])}function Z1(e,t){if(t.length>0){let n=Ql(Kl,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[1]??e[0]}let n=Q1(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>$1(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=Z1(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function Q1(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function $1(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var e0=2e3;function t0(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function n0(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var r0=`__system__`,i0=`__config__/project`,a0=`__user__/config.yml`,o0=`__local__/project`,s0=`__config__/okignore`;Object.freeze([i0,o0,a0,s0]);var c0=`__skill__/`,l0=`__template__/`,u0=[`project`,`global`];function d0(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)}var f0=`.ok/skills`;function p0(e){return`${f0}/${e}/SKILL`}var m0=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function h0(e){let t=m0.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===void 0?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}function g0(e,t){return e===`project`?p0(t):`${c0}${e}/${t}`}function _0(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function v0(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);return i?{kind:`skill`,scope:r,name:_0(i)}:null}if(e.startsWith(`__template__/`)){let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{kind:`template`,folder:_0(n<0?``:t.slice(0,n)),name:_0(r)}:null}return null}var y0=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.mdx?)?$/;function b0(e){let t=y0.exec(e);if(t){let e=(t[1]??``).replace(/^\/+|\/+$/g,``);return`${l0}${e?`${e}/`:``}${t[2]}`}return null}var x0=[`invalid-args`,`nested-project`,`target-not-empty`,`mkdir-failed`,`git-init-failed`,`init-failed`,`discovery-failed`],S0=[`.mdx`,`.md`],C0=`epoch`,w0=512*1024;function T0(e,t=w0){return typeof e==`number`&&Number.isFinite(e)&&e>t}var E0=[`claude`,`claude-desktop`,`cursor`,`codex`,`copilot`,`opencode`,`openclaw`,`pi`,`antigravity`,`lm-studio`,`hermes`],D0={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,copilot:`GitHub Copilot`,opencode:`OpenCode`,openclaw:`OpenClaw`,pi:`Pi`,antigravity:`Antigravity`,"lm-studio":`LM Studio`,hermes:`Hermes`},O0={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.github/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/skills`,antigravity:null,"lm-studio":null,hermes:null},k0=E0.filter(e=>O0[e]!==null);k0.filter(e=>e!==`pi`&&e!==`copilot`).map(e=>({hostDir:(O0[e]??``).split(`/`)[0],editorId:e}));var A0={claude:`claude-code`,"claude-desktop":`claude-code`,cursor:`cursor`,codex:`codex`,copilot:`github-copilot-cli`,opencode:`opencode`,openclaw:`openclaw`,pi:`pi`,antigravity:`antigravity`,"lm-studio":`lm-studio`,hermes:`hermes`},j0={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function M0(){if(typeof navigator>`u`)return null;let e=navigator.userAgent;for(let[t,n]of Object.entries(j0))if(n.test(e))return t;return null}var N0=[`incoming`,`outgoing`,`both`];function P0(e){return N0.includes(e)}var F0=`open-knowledge`,I0=[{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)">
|
|
397
|
+
`,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:`The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.`,PLUGIN_COMPONENT_CONFLICT:`The component "%s" is already defined. The plugin "%s" is trying to redefine it.`};function wZ(e,...t){let n=Error(tZ(CZ[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,`captureStackTrace`in Error.prototype&&Error.captureStackTrace(n),n}function TZ(e){return{raw:Number(e),formatted:aZ(e)}}function EZ(e){if(e.id){if(typeof e.id!=`string`)throw wZ(`DOCUMENT_ID_MUST_BE_STRING`,typeof e.id);return e.id}return sZ()}function DZ(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];if(t!==void 0&&!(r===`geopoint`&&typeof t==`object`&&typeof t.lon==`number`&&typeof t.lat==`number`)&&!(r===`enum`&&(typeof t==`string`||typeof t==`number`))){if(r===`enum[]`&&Array.isArray(t)){let e=t.length;for(let r=0;r<e;r++)if(typeof t[r]!=`string`&&typeof t[r]!=`number`)return n+`.`+r;continue}if(jZ(r)){let e=PZ(r);if(!Array.isArray(t)||t.length!==e)throw wZ(`INVALID_INPUT_VECTOR`,n,e,t.length);continue}if(MZ(r)){if(!Array.isArray(t))return n;let e=NZ(r),i=t.length;for(let r=0;r<i;r++)if(typeof t[r]!==e)return n+`.`+r;continue}if(typeof r==`object`){if(!t||typeof t!=`object`)return n;let e=DZ(t,r);if(e)return n+`.`+e;continue}if(typeof t!==r)return n}}}var OZ={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},kZ={"string[]":`string`,"number[]":`number`,"boolean[]":`boolean`,"enum[]":`enum`};function AZ(e){return e===`geopoint`}function jZ(e){return typeof e==`string`&&/^vector\[\d+\]$/.test(e)}function MZ(e){return typeof e==`string`&&OZ[e]}function NZ(e){return kZ[e]}function PZ(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw wZ(`INVALID_VECTOR_VALUE`,e);case t<=0:throw wZ(`INVALID_VECTOR_SIZE`,e);default:return t}}function FZ(){return{idToInternalId:new Map,internalIdToId:[],save:IZ,load:LZ}}function IZ(e){return{internalIdToId:e.internalIdToId}}function LZ(e,t){let{internalIdToId:n}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let r=n.length;for(let t=0;t<r;t++){let r=n[t];e.internalDocumentIDStore.idToInternalId.set(r,t+1),e.internalDocumentIDStore.internalIdToId.push(r)}}function RZ(e,t){if(typeof t==`string`){let n=e.idToInternalId.get(t);if(n)return n;let r=e.idToInternalId.size+1;return e.idToInternalId.set(t,r),e.internalIdToId.push(t),r}return t>e.internalIdToId.length?RZ(e,t.toString()):t}function zZ(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function BZ(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function VZ(e,t){let n=RZ(e.sharedInternalDocumentStore,t);return e.docs[n]}function HZ(e,t){let n=t.length,r=Array.from({length:n});for(let i=0;i<n;i++){let n=RZ(e.sharedInternalDocumentStore,t[i]);r[i]=e.docs[n]}return r}function UZ(e){return e.docs}function WZ(e,t,n,r){return e.docs[n]===void 0?(e.docs[n]=r,e.count++,!0):!1}function GZ(e,t){let n=RZ(e.sharedInternalDocumentStore,t);return e.docs[n]===void 0?!1:(delete e.docs[n],e.count--,!0)}function KZ(e){return e.count}function qZ(e,t){let n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function JZ(e){return{docs:e.docs,count:e.count}}function YZ(){return{create:BZ,get:VZ,getMultiple:HZ,getAll:UZ,store:WZ,remove:GZ,count:KZ,load:qZ,save:JZ}}var XZ=[`beforeInsert`,`afterInsert`,`beforeRemove`,`afterRemove`,`beforeUpdate`,`afterUpdate`,`beforeUpsert`,`afterUpsert`,`beforeSearch`,`afterSearch`,`beforeInsertMultiple`,`afterInsertMultiple`,`beforeRemoveMultiple`,`afterRemoveMultiple`,`beforeUpdateMultiple`,`afterUpdateMultiple`,`beforeUpsertMultiple`,`afterUpsertMultiple`,`beforeLoad`,`afterLoad`,`afterCreate`];function ZZ(e,t){let n=[],r=e.plugins?.length;if(!r)return n;for(let i=0;i<r;i++)try{let r=e.plugins[i];typeof r[t]==`function`&&n.push(r[t])}catch(e){throw console.error(`Caught error in getAllPluginsByHook:`,e),wZ(`PLUGIN_CRASHED`)}return n}var QZ=[`tokenizer`,`index`,`documentsStore`,`sorter`,`pinning`],$Z=[`validateSchema`,`getDocumentIndexId`,`getDocumentProperties`,`formatElapsedTime`];function eQ(e,t,n,r){if(e.some(gZ))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function tQ(e,t,n){if(e.some(gZ))return(async()=>{for(let r of e)await r(t,n)})();for(let r of e)r(t,n)}function nQ(e,t,n,r,i){if(e.some(gZ))return(async()=>{for(let a of e)await a(t,n,r,i)})();for(let a of e)a(t,n,r,i)}function rQ(e,t,n,r){if(e.some(gZ))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function iQ(e,t){if(e.some(gZ))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}var aQ=class e{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(e.getHeight(this.l),e.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return e.getHeight(this.l)-e.getHeight(this.r)}rotateLeft(){let e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(t){let n=new e(t.k,t.v);return n.l=t.l?e.fromJSON(t.l):null,n.r=t.r?e.fromJSON(t.r):null,n.h=t.h,n}},oQ=class e{root=null;insertCount=0;constructor(e,t){e!==void 0&&t!==void 0&&(this.root=new aQ(e,t))}insert(e,t,n=1e3){this.root=this.insertNode(this.root,e,t,n)}insertMultiple(e,t,n=1e3){for(let r of t)this.insert(e,r,n)}rebalance(){this.root&&=this.rebalanceNode(this.root)}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(t){let n=new e;return n.root=t.root?aQ.fromJSON(t.root):null,n.insertCount=t.insertCount||0,n}insertNode(e,t,n,r){if(e===null)return new aQ(t,[n]);let i=[],a=e,o=null;for(;a!==null;)if(i.push({parent:o,node:a}),t<a.k)if(a.l===null){a.l=new aQ(t,[n]),i.push({parent:a,node:a.l});break}else o=a,a=a.l;else if(t>a.k)if(a.r===null){a.r=new aQ(t,[n]),i.push({parent:a,node:a.r});break}else o=a,a=a.r;else return a.v.add(n),e;let s=!1;this.insertCount++%r===0&&(s=!0);for(let t=i.length-1;t>=0;t--){let{parent:n,node:r}=i[t];if(r.updateHeight(),s){let t=this.rebalanceNode(r);n?n.l===r?n.l=t:n.r===r&&(n.r=t):e=t}}return e}rebalanceNode(e){let t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&e.r.getBalanceFactor()<=0)return e.rotateLeft();if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){let t=this.findNodeByKey(e);return t?t.v:null}contains(e){return this.find(e)!==null}getSize(){let e=0,t=[],n=this.root;for(;n||t.length>0;){for(;n;)t.push(n),n=n.l;n=t.pop(),e++,n=n.r}return e}isBalanced(){if(!this.root)return!0;let e=[this.root];for(;e.length>0;){let t=e.pop(),n=t.getBalanceFactor();if(Math.abs(n)>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){let n=this.findNodeByKey(e);n&&(n.v.size===1?this.root=this.removeNode(this.root,e):n.v=new Set([...n.v.values()].filter(e=>e!==t)))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else if(e>t.k)t=t.r;else return t;return null}removeNode(e,t){if(e===null)return null;let n=[],r=e;for(;r!==null&&r.k!==t;)n.push(r),r=t<r.k?r.l:r.r;if(r===null)return e;if(r.l===null||r.r===null){let t=r.l?r.l:r.r;if(n.length===0)e=t;else{let e=n[n.length-1];e.l===r?e.l=t:e.r=t}}else{let e=r,t=r.r;for(;t.l!==null;)e=t,t=t.l;r.k=t.k,r.v=t.v,e.l===t?e.l=t.r:e.r=t.r,r=e}n.push(r);for(let t=n.length-1;t>=0;t--){let r=n[t];r.updateHeight();let i=this.rebalanceNode(r);if(t>0){let e=n[t-1];e.l===r?e.l=i:e.r===r&&(e.r=i)}else e=i}return e}rangeSearch(e,t){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),i.k>=e&&i.k<=t)for(let e of i.v)n.add(e);if(i.k>t)break;i=i.r}return n}greaterThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.r;if(i=r.pop(),t&&i.k>=e||!t&&i.k>e)for(let e of i.v)n.add(e);else if(i.k<=e)break;i=i.l}return n}lessThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),t&&i.k<=e||!t&&i.k<e)for(let e of i.v)n.add(e);else if(i.k>e)break;i=i.r}return n}},sQ=class e{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){let t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){let n=this.numberToDocumentId.get(t);n&&(n.delete(e),n.size===0&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(let t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`eq`:{let t=e[n],r=this.numberToDocumentId.get(t);return r?Array.from(r):[]}case`in`:{let t=e[n],r=new Set;for(let e of t){let t=this.numberToDocumentId.get(e);if(t)for(let e of t)r.add(e)}return Array.from(r)}case`nin`:{let t=new Set(e[n]),r=new Set;for(let[e,n]of this.numberToDocumentId.entries())if(!t.has(e))for(let e of n)r.add(e);return Array.from(r)}default:throw Error(`Invalid operation`)}}filterArr(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`containsAll`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e].filter(e=>t.has(e))));return Array.from(r)}case`containsAny`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e,...t]));return Array.from(r)}default:throw Error(`Invalid operation`)}}static fromJSON(t){if(!t.numberToDocumentId)throw Error(`Invalid Flat Tree JSON`);let n=new e;for(let[e,r]of t.numberToDocumentId)n.numberToDocumentId.set(e,new Set(r));return n}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map(([e,t])=>[e,Array.from(t)])}}};function cQ(e,t,n){if(n<0)return-1;if(e===t)return 0;let r=e.length,i=t.length;if(r===0)return i<=n?i:-1;if(i===0)return r<=n?r:-1;let a=Math.abs(r-i);if(e.startsWith(t))return a<=n?a:-1;if(t.startsWith(e))return 0;if(a>n)return-1;let o=[];for(let e=0;e<=r;e++){o[e]=[e];for(let t=1;t<=i;t++)o[e][t]=e===0?t:0}for(let a=1;a<=r;a++){let r=1/0;for(let n=1;n<=i;n++)e[a-1]===t[n-1]?o[a][n]=o[a-1][n-1]:o[a][n]=Math.min(o[a-1][n]+1,o[a][n-1]+1,o[a-1][n-1]+1),r=Math.min(r,o[a][n]);if(r>n)return-1}return o[r][i]<=n?o[r][i]:-1}function lQ(e,t,n){let r=cQ(e,t,n);return{distance:r,isBounded:r>=0}}var uQ=class e{k;s;c=new Map;d=new Set;e;w=``;constructor(e,t,n){this.k=e,this.s=t,this.e=n}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,n,r){let i=[this];for(;i.length>0;){let a=i.pop();if(a.e){let{w:i,d:o}=a;if(n&&i!==t)continue;if(cZ(e,i)!==null)if(r)if(Math.abs(t.length-i.length)<=r&&lQ(t,i,r).isBounded)e[i]=[];else continue;else e[i]=[];if(cZ(e,i)!=null&&o.size>0){let t=e[i];for(let e of o)t.includes(e)||t.push(e)}}a.c.size>0&&i.push(...a.c.values())}return e}insert(t,n){let r=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=r.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c){if(r=s,i+=l,i===a){s.e||=!0,s.addDocument(n);return}continue}let u=o.slice(0,l),d=o.slice(l),f=t.slice(i+l),p=new e(u[0],u,!1);if(r.c.set(u[0],p),p.updateParent(r),s.s=d,s.k=d[0],p.c.set(d[0],s),s.updateParent(p),f){let t=new e(f[0],f,!0);t.addDocument(n),p.c.set(f[0],t),t.updateParent(p)}else p.e=!0,p.addDocument(n);return}else{let a=new e(o,t.slice(i),!0);a.addDocument(n),r.c.set(o,a),a.updateParent(r);return}}r.e||=!0,r.addDocument(n)}_findLevenshtein(e,t,n,r,i){let a=[{node:this,index:t,tolerance:n}];for(;a.length>0;){let{node:t,index:n,tolerance:o}=a.pop();if(t.w.startsWith(e)){t.findAllWords(i,e,!1,0);continue}if(o<0)continue;if(t.e){let{w:n,d:a}=t;if(n&&(lQ(e,n,r).isBounded&&(i[n]=[]),cZ(i,n)!==void 0&&a.size>0)){let e=new Set(i[n]);for(let t of a)e.add(t);i[n]=Array.from(e)}}if(n>=e.length)continue;let s=e[n];if(t.c.has(s)){let e=t.c.get(s);a.push({node:e,index:n+1,tolerance:o})}a.push({node:t,index:n+1,tolerance:o-1});for(let[e,r]of t.c)a.push({node:r,index:n,tolerance:o-1}),e!==s&&a.push({node:r,index:n+1,tolerance:o-1})}}find(e){let{term:t,exact:n,tolerance:r}=e;if(r&&!n){let e={};return this._findLevenshtein(t,0,r,r,e),e}else{let e=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=e.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c)e=s,i+=l;else if(i+l===a)if(l===a-i){if(n)return{};{let e={};return s.findAllWords(e,t,n,r),e}}else return{};else return{}}else return{}}let o={};return e.findAllWords(o,t,n,r),o}}contains(e){let t=this,n=0,r=e.length;for(;n<r;){let i=e[n],a=t.c.get(i);if(a){let i=a.s,o=i.length,s=0;for(;s<o&&n+s<r&&i[s]===e[n+s];)s++;if(s<o)return!1;n+=o,t=a}else return!1}return!0}removeWord(e){if(!e)return!1;let t=this,n=e.length,r=[];for(let i=0;i<n;i++){let n=e[i];if(t.c.has(n)){let e=t.c.get(n);r.push({parent:t,character:n}),i+=e.s.length-1,t=e}else return!1}for(t.d.clear(),t.e=!1;r.length>0&&t.c.size===0&&!t.e&&t.d.size===0;){let{parent:e,character:n}=r.pop();e.c.delete(n),t=e}return!0}removeDocumentByWord(e,t,n=!0){if(!e)return!0;let r=this,i=e.length;for(let a=0;a<i;a++){let i=e[a];if(r.c.has(i)){let o=r.c.get(i);a+=o.s.length-1,r=o,n&&r.w!==e||r.removeDocument(t)}else return!1}return!0}static getCommonPrefix(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return e.slice(0,r)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map(([e,t])=>[e,t.toJSON()])}}static fromJSON(t){let n=new e(t.k,t.s,t.e);return n.w=t.w,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([t,n])=>[t,e.fromJSON(n)])||[]),n}},dQ=class e extends uQ{constructor(){super(``,``,!1)}static fromJSON(t){let n=new e;return n.w=t.w,n.s=t.s,n.e=t.e,n.k=t.k,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([e,t])=>[e,uQ.fromJSON(t)])||[]),n}toJSON(){return super.toJSON()}},fQ=2,pQ=6371e3,mQ=class e{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(t,n=null){let r=new e(t.point,t.docIDs);return r.parent=n,t.left&&(r.left=e.fromJSON(t.left,r)),t.right&&(r.right=e.fromJSON(t.right,r)),r}},hQ=class e{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);if(r){t.forEach(e=>r.docIDs.add(e));return}let i=new mQ(e,t);if(this.nodeMap.set(n,i),this.root==null){this.root=i;return}let a=this.root,o=0;for(;;){if(o%fQ===0)if(e.lon<a.point.lon){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}else if(e.lat<a.point.lat){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}o++}}contains(e){let t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){let t=this.getPointKey(e),n=this.nodeMap.get(t);return n?Array.from(n.docIDs):null}removeDocByID(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);r&&(r.docIDs.delete(t),r.docIDs.size===0&&(this.nodeMap.delete(n),this.deleteNode(r)))}deleteNode(e){let t=e.parent,n=e.left?e.left:e.right;n&&(n.parent=t),t?t.left===e?t.left=n:t.right===e&&(t.right=n):(this.root=n,this.root&&(this.root.parent=null))}searchByRadius(t,n,r=!0,i=`asc`,a=!1){let o=a?e.vincentyDistance:e.haversineDistance,s=[{node:this.root,depth:0}],c=[];for(;s.length>0;){let{node:e,depth:i}=s.pop();if(e==null)continue;let a=o(t,e.point);(r?a<=n:a>n)&&c.push({point:e.point,docIDs:Array.from(e.docIDs)}),e.left!=null&&s.push({node:e.left,depth:i+1}),e.right!=null&&s.push({node:e.right,depth:i+1})}return i&&c.sort((e,n)=>{let r=o(t,e.point),a=o(t,n.point);return i.toLowerCase()===`asc`?r-a:a-r}),c}searchByPolygon(t,n=!0,r=null,i=!1){let a=[{node:this.root,depth:0}],o=[];for(;a.length>0;){let{node:r,depth:i}=a.pop();if(r==null)continue;r.left!=null&&a.push({node:r.left,depth:i+1}),r.right!=null&&a.push({node:r.right,depth:i+1});let s=e.isPointInPolygon(t,r.point);(s&&n||!s&&!n)&&o.push({point:r.point,docIDs:Array.from(r.docIDs)})}let s=e.calculatePolygonCentroid(t);if(r){let t=i?e.vincentyDistance:e.haversineDistance;o.sort((e,n)=>{let i=t(s,e.point),a=t(s,n.point);return r.toLowerCase()===`asc`?i-a:a-i})}return o}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(t){let n=new e;return t.root&&(n.root=mQ.fromJSON(t.root),n.buildNodeMap(n.root)),n}buildNodeMap(e){if(e==null)return;let t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,n=0,r=0,i=e.length;for(let a=0,o=i-1;a<i;o=a++){let i=e[a].lon,s=e[a].lat,c=e[o].lon,l=e[o].lat,u=i*l-c*s;t+=u,n+=(i+c)*u,r+=(s+l)*u}t/=2;let a=6*t;return n/=a,r/=a,{lon:n,lat:r}}static isPointInPolygon(e,t){let n=!1,r=t.lon,i=t.lat,a=e.length;for(let t=0,o=a-1;t<a;o=t++){let a=e[t].lon,s=e[t].lat,c=e[o].lon,l=e[o].lat;s>i!=l>i&&r<(c-a)*(i-s)/(l-s)+a&&(n=!n)}return n}static haversineDistance(e,t){let n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=(t.lat-e.lat)*n,o=(t.lon-e.lon)*n,s=Math.sin(a/2)*Math.sin(a/2)+Math.cos(r)*Math.cos(i)*Math.sin(o/2)*Math.sin(o/2);return pQ*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}static vincentyDistance(e,t){let n=6378137,r=1/298.257223563,i=(1-r)*n,a=Math.PI/180,o=e.lat*a,s=t.lat*a,c=(t.lon-e.lon)*a,l=Math.atan((1-r)*Math.tan(o)),u=Math.atan((1-r)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(u),m=Math.cos(u),h=c,g,_=1e3,v,y,b,x,S,C;do{let e=Math.sin(h),t=Math.cos(h);if(v=Math.sqrt(m*e*(m*e)+(f*p-d*m*t)*(f*p-d*m*t)),v===0)return 0;y=d*p+f*m*t,b=Math.atan2(v,y),x=f*m*e/v,S=1-x*x,C=y-2*d*p/S,isNaN(C)&&(C=0);let n=r/16*S*(4+r*(4-3*S));g=h,h=c+(1-n)*r*x*(b+n*v*(C+n*y*(-1+2*C*C)))}while(Math.abs(h-g)>1e-12&&--_>0);if(_===0)return NaN;let w=S*(n*n-i*i)/(i*i),T=1+w/16384*(4096+w*(-768+w*(320-175*w))),E=w/1024*(256+w*(-128+w*(74-47*w))),ee=E*v*(C+E/4*(y*(-1+2*C*C)-E/6*C*(-3+4*v*v)*(-3+4*C*C)));return i*T*(b-ee)}},gQ=class e{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(t){let n=new e;return n.true=new Set(t.true),n.false=new Set(t.false),n}};function _Q(e,t,n,r,i,{k:a,b:o,d:s}){return Math.log(1+(n-t+.5)/(t+.5))*(s+e*(a+1))/(e+a*(1-o+o*r/i))}var vQ=class e{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let n=yQ(t,this.size);this.vectors.set(e,[n,t])}remove(e){this.vectors.delete(e)}find(e,t,n){return e instanceof Float32Array||(e=new Float32Array(e)),bQ(e,n,this.vectors,this.size,t)}toJSON(){let e=[];for(let[t,[n,r]]of this.vectors)e.push([t,[n,Array.from(r)]]);return{size:this.size,vectors:e}}static fromJSON(t){let n=t,r=new e(n.size);for(let[e,[t,i]]of n.vectors)r.vectors.set(e,[t,new Float32Array(i)]);return r}};function yQ(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function bQ(e,t,n,r,i){let a=yQ(e,r),o=[],s=t||n.keys();for(let t of s){let s=n.get(t);if(!s)continue;let c=s[0],l=s[1],u=0;for(let t=0;t<r;t++)u+=e[t]*l[t];let d=u/(a*c);d>=i&&o.push([t,d])}return o}function xQ(e,t,n,r,i){let a=RZ(e.sharedInternalDocumentStore,n);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(i-1)+r.length)/i,e.fieldLengths[t][a]=r.length,e.frequencies[t][a]={}}function SQ(e,t,n,r,i){let a=0;for(let e of r)e===i&&a++;let o=RZ(e.sharedInternalDocumentStore,n),s=a/r.length;e.frequencies[t][o][i]=s,i in e.tokenOccurrences[t]||(e.tokenOccurrences[t][i]=0),e.tokenOccurrences[t][i]=(e.tokenOccurrences[t][i]??0)+1}function CQ(e,t,n,r){let i=RZ(e.sharedInternalDocumentStore,n);r>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*r-e.fieldLengths[t][i])/(r-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][i]=void 0,e.frequencies[t][i]=void 0}function wQ(e,t,n){e.tokenOccurrences[t][n]--}function TQ(e,t,n,r,i=``){r||={sharedInternalDocumentStore:t,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}};for(let[a,o]of Object.entries(n)){let n=`${i}${i?`.`:``}${a}`;if(typeof o==`object`&&!Array.isArray(o)){TQ(e,t,o,r,n);continue}if(jZ(o))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o,r.vectorIndexes[n]={type:`Vector`,node:new vQ(PZ(o)),isArray:!1};else{let e=/\[/.test(o);switch(o){case`boolean`:case`boolean[]`:r.indexes[n]={type:`Bool`,node:new gQ,isArray:e};break;case`number`:case`number[]`:r.indexes[n]={type:`AVL`,node:new oQ(0,[]),isArray:e};break;case`string`:case`string[]`:r.indexes[n]={type:`Radix`,node:new dQ,isArray:e},r.avgFieldLength[n]=0,r.frequencies[n]={},r.tokenOccurrences[n]={},r.fieldLengths[n]={};break;case`enum`:case`enum[]`:r.indexes[n]={type:`Flat`,node:new sQ,isArray:e};break;case`geopoint`:r.indexes[n]={type:`BKD`,node:new hQ,isArray:e};break;default:throw wZ(`INVALID_SCHEMA_TYPE`,Array.isArray(o)?`array`:o,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o}}return r}function EQ(e,t,n,r,i,a,o,s){return c=>{let{type:l,node:u}=t.indexes[n];switch(l){case`Bool`:u[c?`true`:`false`].add(r);break;case`AVL`:{let e=s?.avlRebalanceThreshold??1;u.insert(c,r,e);break}case`Radix`:{let s=a.tokenize(c,i,n,!1);e.insertDocumentScoreParameters(t,n,r,s,o);for(let i of s)e.insertTokenScoreParameters(t,n,r,s,i),u.insert(i,r);break}case`Flat`:u.insert(c,r);break;case`BKD`:u.insert(c,[r]);break}}}function DQ(e,t,n,r,i,a,o,s,c,l,u){if(jZ(o))return OQ(t,n,a,r,i);let d=EQ(e,t,n,i,s,c,l,u);if(!MZ(o))return d(a);let f=a,p=f.length;for(let e=0;e<p;e++)d(f[e])}function OQ(e,t,n,r,i){e.vectorIndexes[t].node.add(i,n)}function kQ(e,t,n,r,i,a,o,s,c,l){if(jZ(o))return t.vectorIndexes[n].node.remove(i),!0;let{type:u,node:d}=t.indexes[n];switch(u){case`AVL`:return d.removeDocument(a,i),!0;case`Bool`:return d[a?`true`:`false`].delete(i),!0;case`Radix`:{let o=c.tokenize(a,s,n);e.removeDocumentScoreParameters(t,n,r,l);for(let r of o)e.removeTokenScoreParameters(t,n,r),d.removeDocumentByWord(r,i);return!0}case`Flat`:return d.removeDocument(i,a),!0;case`BKD`:return d.removeDocByID(a,i),!1}}function AQ(e,t,n,r,i,a,o,s,c,l){if(!MZ(o))return kQ(e,t,n,r,i,a,o,s,c,l);let u=NZ(o),d=a,f=d.length;for(let a=0;a<f;a++)kQ(e,t,n,r,i,d[a],u,s,c,l);return!0}function jQ(e,t,n,r,i,a,o,s,c,l){let u=Array.from(r),d=e.avgFieldLength[t],f=e.fieldLengths[t],p=e.tokenOccurrences[t],m=e.frequencies[t],h=typeof p[n]==`number`?p[n]??0:0,g=u.length;for(let e=0;e<g;e++){let r=u[e];if(c&&!c.has(r))continue;l.has(r)||l.set(r,new Map);let p=l.get(r);p.set(t,(p.get(t)||0)+1);let g=_Q(m?.[r]?.[n]??0,h,i,f[r],d,a);o.has(r)?o.set(r,o.get(r)+g*s):o.set(r,g*s)}}function MQ(e,t,n,r,i,a,o,s,c,l,u,d=0){let f=n.tokenize(t,r),p=f.length||1,m=new Map,h=new Map,g=new Map;for(let n of i){if(!(n in e.indexes))continue;let r=e.indexes[n],{type:i}=r;if(i!==`Radix`)throw wZ(`WRONG_SEARCH_PROPERTY_TYPE`,n);let d=s[n]??1;if(d<=0)throw wZ(`INVALID_BOOST_VALUE`,d);f.length===0&&!t&&f.push(``);let p=f.length;for(let t=0;t<p;t++){let i=f[t],s=r.node.find({term:i,exact:a,tolerance:o}),p=Object.keys(s);p.length>0&&h.set(i,!0);let _=p.length;for(let t=0;t<_;t++){let r=p[t],i=s[r];jQ(e,n,r,i,l,c,g,d,u,m)}}}let _=Array.from(g.entries()).map(([e,t])=>[e,t]).sort((e,t)=>t[1]-e[1]);if(_.length===0)return[];if(d===1)return _;if(d===0){if(p===1)return _;for(let e of f)if(!h.get(e))return[];return _.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1})}let v=_.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1});if(v.length>0){let e=_.filter(([e])=>!v.some(([t])=>t===e)),t=Math.ceil(e.length*d);return[...v,...e.slice(0,t)]}return _}function NQ(e,t,n,r){if(`and`in n&&n.and&&Array.isArray(n.and)){let i=n.and;return i.length===0?new Set:vZ(...i.map(n=>NQ(e,t,n,r)))}if(`or`in n&&n.or&&Array.isArray(n.or)){let i=n.or;return i.length===0?new Set:i.map(n=>NQ(e,t,n,r)).reduce((e,t)=>bZ(e,t),new Set)}if(`not`in n&&n.not){let i=n.not,a=new Set,o=e.sharedInternalDocumentStore;for(let e=1;e<=o.internalIdToId.length;e++)a.add(e);return xZ(a,NQ(e,t,i,r))}let i=Object.keys(n),a=i.reduce((e,t)=>({[t]:new Set,...e}),{});for(let o of i){let i=n[o];if(e.indexes[o]===void 0)throw wZ(`UNKNOWN_FILTER_PROPERTY`,o);let{node:s,type:c,isArray:l}=e.indexes[o];if(c===`Bool`){let e=s,t=i?e.true:e.false;a[o]=bZ(a[o],t);continue}if(c===`BKD`){let e;if(`radius`in i)e=`radius`;else if(`polygon`in i)e=`polygon`;else throw Error(`Invalid operation ${i}`);if(e===`radius`){let{value:t,coordinates:n,unit:r=`m`,inside:c=!0,highPrecision:l=!1}=i[e],u=mZ(t,r),d=s.searchByRadius(n,u,c,void 0,l);a[o]=zQ(a[o],d)}else{let{coordinates:t,inside:n=!0,highPrecision:r=!1}=i[e],c=s.searchByPolygon(t,n,void 0,r);a[o]=zQ(a[o],c)}continue}if(c===`Radix`&&(typeof i==`string`||Array.isArray(i))){for(let e of[i].flat()){let n=t.tokenize(e,r,o);for(let e of n){let t=s.find({term:e,exact:!0});a[o]=UQ(a[o],t)}}continue}let u=Object.keys(i);if(u.length>1)throw wZ(`INVALID_FILTER_OPERATION`,u.length);if(c===`Flat`){let e=new Set(l?s.filterArr(i):s.filter(i));a[o]=bZ(a[o],e);continue}if(c===`AVL`){let e=u[0],t=i[e],n;switch(e){case`gt`:n=s.greaterThan(t,!1);break;case`gte`:n=s.greaterThan(t,!0);break;case`lt`:n=s.lessThan(t,!1);break;case`lte`:n=s.lessThan(t,!0);break;case`eq`:n=s.find(t)??new Set;break;case`between`:{let[e,r]=t;n=s.rangeSearch(e,r);break}default:throw wZ(`INVALID_FILTER_OPERATION`,e)}a[o]=bZ(a[o],n)}}return vZ(...Object.values(a))}function PQ(e){return e.searchableProperties}function FQ(e){return e.searchablePropertiesWithTypes}function IQ(e,t){let{indexes:n,vectorIndexes:r,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}=t,u={},d={};for(let e of Object.keys(n)){let{node:t,type:r,isArray:i}=n[e];switch(r){case`Radix`:u[e]={type:`Radix`,node:dQ.fromJSON(t),isArray:i};break;case`Flat`:u[e]={type:`Flat`,node:sQ.fromJSON(t),isArray:i};break;case`AVL`:u[e]={type:`AVL`,node:oQ.fromJSON(t),isArray:i};break;case`BKD`:u[e]={type:`BKD`,node:hQ.fromJSON(t),isArray:i};break;case`Bool`:u[e]={type:`Bool`,node:gQ.fromJSON(t),isArray:i};break;default:u[e]=n[e]}}for(let e of Object.keys(r))d[e]={type:`Vector`,isArray:!1,node:vQ.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}}function LQ(e){let{indexes:t,vectorIndexes:n,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}=e,l={};for(let e of Object.keys(n))l[e]=n[e].node.toJSON();let u={};for(let e of Object.keys(t)){let{type:n,node:r,isArray:i}=t[e];n===`Flat`||n===`Radix`||n===`AVL`||n===`BKD`||n===`Bool`?u[e]={type:n,node:r.toJSON(),isArray:i}:(u[e]=t[e],u[e].node=u[e].node.toJSON())}return{indexes:u,vectorIndexes:l,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}}function RQ(){return{create:TQ,insert:DQ,remove:AQ,insertDocumentScoreParameters:xQ,insertTokenScoreParameters:SQ,removeDocumentScoreParameters:CQ,removeTokenScoreParameters:wQ,calculateResultScores:jQ,search:MQ,searchByWhereClause:NQ,getSearchableProperties:PQ,getSearchablePropertiesWithTypes:FQ,load:IQ,save:LQ}}function zQ(e,t){e||=new Set;let n=t.length;for(let r=0;r<n;r++){let n=t[r].docIDs,i=n.length;for(let t=0;t<i;t++)e.add(n[t])}return e}function BQ(e,t,n=!1){let r=n?hQ.vincentyDistance:hQ.haversineDistance,i=[],a=[];for(let{point:n}of e)a.push(r(t,n));let o=Math.max(...a),s=0;for(let{docIDs:t}of e){let e=o-a[s]+1;for(let n of t)i.push([n,e]);s++}return i.sort((e,t)=>t[1]-e[1]),i}function VQ(e,t){let n=Object.keys(e);if(n.length!==1)return{isGeoOnly:!1};let r=n[0],i=e[r];if(t.indexes[r]===void 0)return{isGeoOnly:!1};let{type:a}=t.indexes[r];return a===`BKD`&&i&&(`radius`in i||`polygon`in i)?{isGeoOnly:!0,geoProperty:r,geoOperation:i}:{isGeoOnly:!1}}function HQ(e,t){let n=e,r=VQ(t,n);if(!r.isGeoOnly||!r.geoProperty||!r.geoOperation)return null;let{node:i}=n.indexes[r.geoProperty],a=r.geoOperation,o=i,s;if(`radius`in a){let{value:e,coordinates:t,unit:n=`m`,inside:r=!0,highPrecision:i=!1}=a.radius,c=t,l=mZ(e,n);return s=o.searchByRadius(c,l,r,`asc`,i),BQ(s,c,i)}else if(`polygon`in a){let{coordinates:e,inside:t=!0,highPrecision:n=!1}=a.polygon;s=o.searchByPolygon(e,t,`asc`,n);let r=hQ.calculatePolygonCentroid(e);return BQ(s,r,n)}return null}function UQ(e,t){e||=new Set;let n=Object.keys(t),r=n.length;for(let i=0;i<r;i++){let r=t[n[i]],a=r.length;for(let t=0;t<a;t++)e.add(r[t])}return e}function WQ(e,t,n,r,i){let a={language:e.tokenizer.language,sharedInternalDocumentStore:t,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[o,s]of Object.entries(n)){let n=`${i}${i?`.`:``}${o}`;if(!r.includes(n)){if(typeof s==`object`&&!Array.isArray(s)){let i=WQ(e,t,s,r,n);eZ(a.sortableProperties,i.sortableProperties),a.sorts={...a.sorts,...i.sorts},a.sortablePropertiesWithTypes={...a.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!jZ(s))switch(s){case`boolean`:case`number`:case`string`:a.sortableProperties.push(n),a.sortablePropertiesWithTypes[n]=s,a.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:s};break;case`geopoint`:case`enum`:continue;case`enum[]`:case`boolean[]`:case`number[]`:case`string[]`:continue;default:throw wZ(`INVALID_SORT_SCHEMA_TYPE`,Array.isArray(s)?`array`:s,n)}}}return a}function GQ(e,t,n,r){return r?.enabled===!1?{disabled:!0}:WQ(e,t,n,(r||{}).unsortableProperties||[],``)}function KQ(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;let i=RZ(e.sharedInternalDocumentStore,n),a=e.sorts[t];a.orderedDocsToRemove.has(i)&&$Q(e,t),a.docs.set(i,a.orderedDocs.length),a.orderedDocs.push([i,r])}function qQ(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let n of t)ZQ(e,n);e.isSorted=!0}function JQ(e,t,n){return t[1].localeCompare(n[1],qX(e))}function YQ(e,t){return e[1]-t[1]}function XQ(e,t){return t[1]?-1:1}function ZQ(e,t){let n=e.sorts[t],r;switch(n.type){case`string`:r=JQ.bind(null,e.language);break;case`number`:r=YQ.bind(null);break;case`boolean`:r=XQ.bind(null);break}n.orderedDocs.sort(r);let i=n.orderedDocs.length;for(let e=0;e<i;e++){let t=n.orderedDocs[e][0];n.docs.set(t,e)}}function QQ(e){let t=Object.keys(e.sorts);for(let n of t)$Q(e,n)}function $Q(e,t){let n=e.sorts[t];n.orderedDocsToRemove.size&&(n.orderedDocs=n.orderedDocs.filter(e=>!n.orderedDocsToRemove.has(e[0])),n.orderedDocsToRemove.clear())}function e$(e,t,n){if(!e.enabled)return;let r=e.sorts[t],i=RZ(e.sharedInternalDocumentStore,n);r.docs.get(i)&&(r.docs.delete(i),r.orderedDocsToRemove.set(i,!0))}function t$(e,t,n){if(!e.enabled)throw wZ(`SORT_DISABLED`);let r=n.property,i=n.order===`DESC`,a=e.sorts[r];if(!a)throw wZ(`UNABLE_TO_SORT_ON_UNKNOWN_FIELD`,r,e.sortableProperties.join(`, `));return $Q(e,r),qQ(e),t.sort((t,n)=>{let r=a.docs.get(RZ(e.sharedInternalDocumentStore,t[0])),o=a.docs.get(RZ(e.sharedInternalDocumentStore,n[0])),s=r!==void 0,c=o!==void 0;return!s&&!c?0:s?c?i?o-r:r-o:-1:1}),t}function n$(e){return e.enabled?e.sortableProperties:[]}function kie(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function r$(e,t){let n=t;if(!n.enabled)return{enabled:!1};let r=Object.keys(n.sorts).reduce((e,t)=>{let{docs:r,orderedDocs:i,type:a}=n.sorts[t];return e[t]={docs:new Map(Object.entries(r).map(([e,t])=>[+e,t])),orderedDocsToRemove:new Map,orderedDocs:i,type:a},e},{});return{sharedInternalDocumentStore:e,language:n.language,sortableProperties:n.sortableProperties,sortablePropertiesWithTypes:n.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:n.isSorted}}function i$(e){if(!e.enabled)return{enabled:!1};QQ(e),qQ(e);let t=Object.keys(e.sorts).reduce((t,n)=>{let{docs:r,orderedDocs:i,type:a}=e.sorts[n];return t[n]={docs:Object.fromEntries(r.entries()),orderedDocs:i,type:a},t},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}function a$(){return{create:GQ,insert:KQ,remove:e$,save:i$,load:r$,sortBy:t$,getSortableProperties:n$,getSortablePropertiesWithTypes:kie}}var o$=192,s$=383,c$=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115];function l$(e){return e<o$||e>s$?e:c$[e-o$]||e}function u$(e){let t=[];for(let n=0;n<e.length;n++)t[n]=l$(e.charCodeAt(n));return String.fromCharCode(...t)}var d$={ational:`ate`,tional:`tion`,enci:`ence`,anci:`ance`,izer:`ize`,bli:`ble`,alli:`al`,entli:`ent`,eli:`e`,ousli:`ous`,ization:`ize`,ation:`ate`,ator:`ate`,alism:`al`,iveness:`ive`,fulness:`ful`,ousness:`ous`,aliti:`al`,iviti:`ive`,biliti:`ble`,logi:`log`},f$={icate:`ic`,ative:``,alize:`al`,iciti:`ic`,ical:`ic`,ful:``,ness:``},p$=`[^aeiou]`,m$=`[aeiouy]`,h$=p$+`[^aeiouy]*`;m$+``;var g$=`^(`+h$+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,_$=`^(`+h$+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$`,v$=`^(`+h$+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,y$=`^(`+h$+`)?[aeiouy]`;function b$(e){let t,n,r,i,a,o;if(e.length<3)return e;let s=e.substring(0,1);if(s==`y`&&(e=s.toUpperCase()+e.substring(1)),r=/^(.+?)(ss|i)es$/,i=/^(.+?)([^s])s$/,r.test(e)?e=e.replace(r,`$1$2`):i.test(e)&&(e=e.replace(i,`$1$2`)),r=/^(.+?)eed$/,i=/^(.+?)(ed|ing)$/,r.test(e)){let t=r.exec(e);r=new RegExp(g$),r.test(t[1])&&(r=/.$/,e=e.replace(r,``))}else i.test(e)&&(t=i.exec(e)[1],i=new RegExp(y$),i.test(t)&&(e=t,i=/(at|bl|iz)$/,a=RegExp(`([^aeiouylsz])\\1$`),o=RegExp(`^`+h$+m$+`[^aeiouwxy]$`),i.test(e)?e+=`e`:a.test(e)?(r=/.$/,e=e.replace(r,``)):o.test(e)&&(e+=`e`)));if(r=/^(.+?)y$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(y$),t&&r.test(t)&&(e=t+`i`)),r=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(g$),t&&r.test(t)&&(e=t+d$[n])}if(r=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(g$),t&&r.test(t)&&(e=t+f$[n])}if(r=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,i=/^(.+?)(s|t)(ion)$/,r.test(e))t=r.exec(e)?.[1],r=new RegExp(v$),t&&r.test(t)&&(e=t);else if(i.test(e)){let n=i.exec(e);t=n?.[1]??``+n?.[2]??``,i=new RegExp(v$),i.test(t)&&(e=t)}return r=/^(.+?)e$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(v$),i=new RegExp(_$),a=RegExp(`^`+h$+m$+`[^aeiouwxy]$`),t&&(r.test(t)||i.test(t)&&!a.test(t))&&(e=t)),r=/ll$/,i=new RegExp(v$),r.test(e)&&i.test(e)&&(r=/.$/,e=e.replace(r,``)),s==`y`&&(e=s.toLowerCase()+e.substring(1)),e}function x$(e,t,n=!0){let r=`${this.language}:${e}:${t}`;return n&&this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(t)?(n&&this.normalizationCache.set(r,``),``):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=u$(t),n&&this.normalizationCache.set(r,t),t)}function S$(e){for(;e[e.length-1]===``;)e.pop();for(;e[0]===``;)e.shift();return e}function C$(e,t,n,r=!0){if(t&&t!==this.language)throw wZ(`LANGUAGE_NOT_SUPPORTED`,t);if(typeof e!=`string`)return[e];let i=this.normalizeToken.bind(this,n??``),a;if(n&&this.tokenizeSkipProperties.has(n))a=[i(e,r)];else{let t=GX[this.language];a=e.toLowerCase().split(t).map(e=>i(e,r)).filter(Boolean)}let o=S$(a);return this.allowDuplicates?o:Array.from(new Set(o))}function w$(e={}){if(!e.language)e.language=`english`;else if(!KX.includes(e.language))throw wZ(`LANGUAGE_NOT_SUPPORTED`,e.language);let t;if(e.stemming||e.stemmer&&!(`stemming`in e))if(e.stemmer){if(typeof e.stemmer!=`function`)throw wZ(`INVALID_STEMMER_FUNCTION_TYPE`);t=e.stemmer}else if(e.language===`english`)t=b$;else throw wZ(`MISSING_STEMMER`,e.language);let n;if(e.stopWords!==!1){if(n=[],Array.isArray(e.stopWords))n=e.stopWords;else if(typeof e.stopWords==`function`)n=e.stopWords(n);else if(e.stopWords)throw wZ(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);if(!Array.isArray(n))throw wZ(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);for(let e of n)if(typeof e!=`string`)throw wZ(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`)}let r={tokenize:C$,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:n,allowDuplicates:!!e.allowDuplicates,normalizeToken:x$,normalizationCache:new Map};return r.tokenize=C$.bind(r),r.normalizeToken=x$,r}function T$(e){return{sharedInternalDocumentStore:e,rules:new Map}}function E$(e,t){if(e.rules.has(t.id))throw Error(`PINNING_RULE_ALREADY_EXISTS: A pinning rule with id "${t.id}" already exists. Use updateRule to modify it.`);e.rules.set(t.id,t)}function D$(e,t){if(!e.rules.has(t.id))throw Error(`PINNING_RULE_NOT_FOUND: Cannot update pinning rule with id "${t.id}" because it does not exist. Use addRule to create it.`);e.rules.set(t.id,t)}function O$(e,t){return e.rules.delete(t)}function k$(e,t){return e.rules.get(t)}function A$(e){return Array.from(e.rules.values())}function j$(e,t){let n=e.toLowerCase().trim(),r=t.pattern.toLowerCase().trim();switch(t.anchoring){case`is`:return n===r;case`starts_with`:return n.startsWith(r);case`contains`:return n.includes(r);default:return!1}}function M$(e,t){return e?t.conditions.every(t=>j$(e,t)):!1}function N$(e,t){if(!t)return[];let n=[];for(let r of e.rules.values())M$(t,r)&&n.push(r);return n}function P$(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function F$(e){return{rules:Array.from(e.rules.entries())}}function I$(){return{create:T$,addRule:E$,updateRule:D$,removeRule:O$,getRule:k$,getAllRules:A$,getMatchingRules:N$,load:P$,save:F$}}function L$(e){let t={formatElapsedTime:TZ,getDocumentIndexId:EZ,getDocumentProperties:dZ,validateSchema:DZ};for(let n of $Z){let r=n;if(e[r]){if(typeof e[r]!=`function`)throw wZ(`COMPONENT_MUST_BE_FUNCTION`,r)}else e[r]=t[r]}for(let t of Object.keys(e))if(!QZ.includes(t)&&!$Z.includes(t))throw wZ(`UNSUPPORTED_COMPONENT`,t)}function R$({schema:e,sort:t,language:n,components:r,id:i,plugins:a}){r||={};for(let t of a??[]){if(!(`getComponents`in t)||typeof t.getComponents!=`function`)continue;let n=t.getComponents(e),i=Object.keys(n);for(let e of i)if(r[e])throw wZ(`PLUGIN_COMPONENT_CONFLICT`,e,t.name);r={...r,...n}}i||=sZ();let o=r.tokenizer,s=r.index,c=r.documentsStore,l=r.sorter,u=r.pinning;if(o=o?o.tokenize?o:w$(o):w$({language:n??`english`}),r.tokenizer&&n)throw wZ(`NO_LANGUAGE_WITH_CUSTOM_TOKENIZER`);let d=FZ();s||=RQ(),l||=a$(),c||=YZ(),u||=I$(),L$(r);let{getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,formatElapsedTime:h}=r,g={data:{},caches:{},schema:e,tokenizer:o,index:s,sorter:l,documentsStore:c,pinning:u,internalDocumentIDStore:d,getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeUpsert:[],afterUpsert:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],beforeUpdateMultiple:[],afterUpdateMultiple:[],beforeUpsertMultiple:[],afterUpsertMultiple:[],afterCreate:[],formatElapsedTime:h,id:i,plugins:a,version:z$()};g.data={index:g.index.create(g,d,e),docs:g.documentsStore.create(g,d),sorting:g.sorter.create(g,d,e,t),pinning:g.pinning.create(d)};for(let e of XZ)g[e]=(g[e]??[]).concat(ZZ(g,e));let _=g.afterCreate;return _&&iQ(_,g),g}function z$(){return`{{VERSION}}`}function B$(e){return e.documentsStore.count(e.data.docs)}function V$(e,t,n,r,i){let a=e.validateSchema(t,e.schema);if(a)throw wZ(`SCHEMA_VALIDATION_FAILURE`,a);return gZ(e.beforeInsert)||gZ(e.afterInsert)||gZ(e.index.beforeInsert)||gZ(e.index.insert)||gZ(e.index.afterInsert)?W$(e,t,n,r,i):G$(e,t,n,r,i)}var H$=new Set([`enum`,`enum[]`]),U$=new Set([`string`,`number`]);async function W$(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw wZ(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=RZ(e.internalDocumentIDStore,s);if(r||await eQ(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw wZ(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];K$(n,r,e,t)}return await q$(e,s,u,f,l,n,t,i),r||await eQ(e.afterInsert,e,s,t),s}function G$(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw wZ(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=RZ(e.internalDocumentIDStore,s);if(r||eQ(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw wZ(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];K$(n,r,e,t)}return J$(e,s,u,f,l,n,t,i),r||eQ(e.afterInsert,e,s,t),s}function K$(e,t,n,r){if(!(AZ(t)&&typeof r==`object`&&typeof r.lon==`number`&&typeof r.lat==`number`)&&!(jZ(t)&&Array.isArray(r))&&!(MZ(t)&&Array.isArray(r))&&!(H$.has(t)&&U$.has(e))&&e!==t)throw wZ(`INVALID_DOCUMENT_PROPERTY`,n,t,e)}async function q$(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o];await e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i);let l=e.internalDocumentIDStore.idToInternalId.get(t);await e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),await e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function J$(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o],l=RZ(e.internalDocumentIDStore,t);e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i),e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function Y$(e,t,n,r,i,a){return gZ(e.afterInsertMultiple)||gZ(e.beforeInsertMultiple)||gZ(e.index.beforeInsert)||gZ(e.index.insert)||gZ(e.index.afterInsert)?X$(e,t,n,r,i,a):Z$(e,t,n,r,i,a)}async function X$(e,t,n=1e3,r,i,a=0){let o=[],s=async a=>{let s=Math.min(a+n,t.length),c=t.slice(a,s);for(let t of c){let n=await V$(e,t,r,i,{avlRebalanceThreshold:c.length});o.push(n)}return s};return await(async()=>{let e=0;for(;e<t.length;){let t=Date.now();if(e=await s(e),a>0){let e=a-(Date.now()-t);e>0&&SZ(e)}}})(),i||await tQ(e.afterInsertMultiple,e,t),o}function Z$(e,t,n=1e3,r,i,a=0){let o=[],s=0;function c(){let a=t.slice(s*n,(s+1)*n);if(a.length===0)return!1;for(let t of a){let n=V$(e,t,r,i,{avlRebalanceThreshold:a.length});o.push(n)}return s++,!0}function l(){let e=Date.now();for(;c();)if(a>0){let t=Date.now()-e;if(t>=a){let e=a-t%a;e>0&&SZ(e)}}}return l(),i||tQ(e.afterInsertMultiple,e,t),o}function Q$(e,t){return e[1]-t[1]}function $$(e,t){return t[1]-e[1]}function e1(e=`desc`){return e.toLowerCase()===`asc`?Q$:$$}function t1(e,t,n){let r={},i=t.map(([e])=>e),a=e.documentsStore.getMultiple(e.data.docs,i),o=Object.keys(n),s=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e of o){let t;if(s[e]===`number`){let{ranges:r}=n[e],i=r.length,a=Array.from({length:i});for(let e=0;e<i;e++){let t=r[e];a[e]=[`${t.from}-${t.to}`,0]}t=Object.fromEntries(a)}r[e]={count:0,values:t??{}}}let c=a.length;for(let e=0;e<c;e++){let t=a[e];for(let e of o){let i=e.includes(`.`)?fZ(t,e):t[e],a=s[e],o=r[e].values;switch(a){case`number`:{let t=n[e].ranges;n1(t,o)(i);break}case`number[]`:{let t=new Set,r=n[e].ranges,a=n1(r,o,t);for(let e of i)a(e);break}case`boolean`:case`enum`:case`string`:r1(o,a)(i);break;case`boolean[]`:case`enum[]`:case`string[]`:{let e=r1(o,a===`boolean[]`?`boolean`:`string`,new Set);for(let t of i)e(t);break}default:throw wZ(`FACET_NOT_SUPPORTED`,a)}}}for(let e of o){let t=r[e];if(t.count=Object.keys(t.values).length,s[e]===`string`){let r=n[e],i=e1(r.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(r.offset??0,r.limit??10))}}return r}function n1(e,t,n){return r=>{for(let i of e){let e=`${i.from}-${i.to}`;n?.has(e)||r>=i.from&&r<=i.to&&(t[e]===void 0?t[e]=1:(t[e]++,n?.add(e)))}}}function r1(e,t,n){let r=t===`boolean`?`false`:``;return t=>{let i=t?.toString()??r;n?.has(i)||(e[i]=(e[i]??0)+1,n?.add(i))}}var i1={reducer:(e,t,n,r)=>(t[r]=n,t),getInitialValue:e=>Array.from({length:e})},a1=[`string`,`number`,`boolean`];function o1(e,t,n){let r=n.properties,i=r.length,a=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e=0;e<i;e++){let t=r[e];if(a[t]===void 0)throw wZ(`UNKNOWN_GROUP_BY_PROPERTY`,t);if(!a1.includes(a[t]))throw wZ(`INVALID_GROUP_BY_PROPERTY`,t,a1.join(`, `),a[t])}let o=t.map(([t])=>zZ(e.internalDocumentIDStore,t)),s=e.documentsStore.getMultiple(e.data.docs,o),c=s.length,l=n.maxResult||2**53-1,u=[],d={};for(let e=0;e<i;e++){let t=r[e],n={property:t,perValue:{}},i=new Set;for(let e=0;e<c;e++){let r=s[e],a=fZ(r,t);if(a===void 0)continue;let o=typeof a==`boolean`?``+a:a,c=n.perValue[o]??{indexes:[],count:0};c.count>=l||(c.indexes.push(e),c.count++,n.perValue[o]=c,i.add(a))}u.push(Array.from(i)),d[t]=n}let f=s1(u),p=f.length,m=[];for(let e=0;e<p;e++){let t=f[e],n=t.length,i={values:[],indexes:[]},a=[];for(let e=0;e<n;e++){let n=t[e],o=r[e];a.push(d[o].perValue[typeof n==`boolean`?``+n:n].indexes),i.values.push(n)}i.indexes=uZ(a).sort((e,t)=>e-t),i.indexes.length!==0&&m.push(i)}let h=m.length,g=Array.from({length:h});for(let e=0;e<h;e++){let r=m[e],i=n.reduce||i1,a=r.indexes.map(e=>({id:o[e],score:t[e][1],document:s[e]})),c=i.reducer.bind(null,r.values),l=i.getInitialValue(r.indexes.length),u=a.reduce(c,l);g[e]={values:r.values,result:u}}return g}function s1(e,t=0){if(t+1===e.length)return e[t].map(e=>[e]);let n=e[t],r=s1(e,t+1),i=[];for(let e of n)for(let t of r){let n=[e];eZ(n,t),i.push(n)}return i}function c1(e,t,n,r){let i=N$(t,r);if(i.length===0)return n;let a=i.flatMap(e=>e.consequence.promote);a.sort((e,t)=>e.position-t.position);let o=new Set,s=new Map,c=new Set;for(let t of a){let n=RZ(e.internalDocumentIDStore,t.doc_id);if(n!==void 0){if(s.has(n)){let e=s.get(n);t.position<e&&s.set(n,t.position);continue}c.has(t.position)||(o.add(n),s.set(n,t.position),c.add(t.position))}}if(s.size===0)return n;let l=n.filter(([e])=>!o.has(e)),u=[];for(let[t,r]of s.entries())n.find(([e])=>e===t)?u.push([t,1e6-r]):e.documentsStore.get(e.data.docs,t)&&u.push([t,0]);u.sort((e,t)=>(s.get(e[0])??1/0)-(s.get(t[0])??1/0));let d=[],f=new Map;for(let e of u){let t=s.get(e[0]);f.set(t,e)}let p=0,m=0;for(;m<l.length+u.length;)if(f.has(m))d.push(f.get(m)),m++;else if(p<l.length)d.push(l[p]),p++,m++;else break;for(let[e,t]of f.entries())e>=d.length&&d.push(t);return d}function l1(e,t,n){let{term:r,properties:i}=t,a=e.data.index,o=e.caches.propertiesToSearch;if(!o){let t=e.index.getSearchablePropertiesWithTypes(a);o=e.index.getSearchableProperties(a),o=o.filter(e=>t[e].startsWith(`string`)),e.caches.propertiesToSearch=o}if(i&&i!==`*`){for(let e of i)if(!o.includes(e))throw wZ(`UNKNOWN_INDEX`,e,o.join(`, `));o=o.filter(e=>i.includes(e))}let s=Object.keys(t.where??{}).length>0,c;s&&(c=e.index.searchByWhereClause(a,e.tokenizer,t.where,n));let l,u=t.threshold!==void 0&&t.threshold!==null?t.threshold:1;if(r||i){let i=B$(e);if(l=e.index.search(a,r||``,e.tokenizer,n,o,t.exact||!1,t.tolerance||0,t.boost||{},m1(t.relevance),i,c,u),t.exact&&r){let t=r.trim().split(/\s+/);l=l.filter(([n])=>{let r=e.documentsStore.get(e.data.docs,n);if(!r)return!1;for(let e of o){let n=d1(r,e);if(typeof n==`string`&&t.every(e=>RegExp(`\\b${u1(e)}\\b`).test(n)))return!0}return!1})}}else l=s?HQ(a,t.where)||(c?Array.from(c):[]).map(e=>[+e,0]):Object.keys(e.documentsStore.getAll(e.data.docs)).map(e=>[+e,0]);return l}function u1(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function d1(e,t){let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function f1(e,t,n){let r=oZ();function i(){let i=Object.keys(e.data.index.vectorIndexes),a=t.facets&&Object.keys(t.facets).length>0,{limit:o=10,offset:s=0,distinctOn:c,includeVectors:l=!1}=t,u=t.preflight===!0,d=l1(e,t,n);if(t.sortBy)if(typeof t.sortBy==`function`){let n=d.map(([e])=>e),r=e.documentsStore.getMultiple(e.data.docs,n).map((e,t)=>[d[t][0],d[t][1],e]);r.sort(t.sortBy),d=r.map(([e,t])=>[e,t])}else d=e.sorter.sortBy(e.data.sorting,d,t.sortBy).map(([t,n])=>[RZ(e.internalDocumentIDStore,t),n]);else d=d.sort(lZ);d=c1(e,e.data.pinning,d,t.term);let f;u||(f=c?E1(e,d,s,o,c):D1(e,d,s,o));let p={elapsed:{formatted:``,raw:0},hits:[],count:d.length};return f!==void 0&&(p.hits=f.filter(Boolean),l||hZ(p,i)),a&&(p.facets=t1(e,d,t.facets)),t.groupBy&&(p.groups=o1(e,d,t.groupBy)),p.elapsed=e.formatElapsedTime(oZ()-r),p}async function a(){e.beforeSearch&&await rQ(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await nQ(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}var p1={k:1.2,b:.75,d:.5};function m1(e){let t=e??{};return t.k=t.k??p1.k,t.b=t.b??p1.b,t.d=t.d??p1.d,t}function h1(e,t,n){let r=t.vector;if(r&&(!(`value`in r)||!(`property`in r)))throw wZ(`INVALID_VECTOR_INPUT`,Object.keys(r).join(`, `));let i=e.data.index.vectorIndexes[r.property];if(!i)throw wZ(`UNKNOWN_VECTOR_PROPERTY`,r.property);let a=i.node.size;if(r?.value.length!==a)throw r?.property===void 0||r?.value.length===void 0?wZ(`INVALID_INPUT_VECTOR`,`undefined`,a,`undefined`):wZ(`INVALID_INPUT_VECTOR`,r.property,a,r.value.length);let o=e.data.index,s;return Object.keys(t.where??{}).length>0&&(s=e.index.searchByWhereClause(o,e.tokenizer,t.where,n)),i.node.find(r.value,t.similarity??.8,s)}function g1(e,t,n=`english`){let r=oZ();function i(){let i=h1(e,t,n).sort(lZ);i=c1(e,e.data.pinning,i,void 0);let a=[];t.facets&&Object.keys(t.facets).length>0&&(a=t1(e,i,t.facets));let o=t.vector.property,s=t.includeVectors??!1,c=t.limit??10,l=t.offset??0,u=Array.from({length:c});for(let t=0;t<c;t++){let n=i[t+l];if(!n)break;let r=e.data.docs.docs[n[0]];r&&(s||(r[o]=null),u[t]={id:zZ(e.internalDocumentIDStore,n[0]),score:n[1],document:r})}let d=[];t.groupBy&&(d=o1(e,i,t.groupBy));let f=oZ()-r;return{count:i.length,hits:u.filter(Boolean),elapsed:{raw:Number(f),formatted:aZ(f)},...a?{facets:a}:{},...d?{groups:d}:{}}}async function a(){e.beforeSearch&&await rQ(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await nQ(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function _1(e,t,n){let r=b1(l1(e,t,n)),i=h1(e,t,n),a=t.hybridWeights;return C1(r,i,t.term??``,a)}function v1(e,t,n){let r=oZ();function i(){let i=_1(e,t,n);i=c1(e,e.data.pinning,i,t.term);let a;t.facets&&Object.keys(t.facets).length>0&&(a=t1(e,i,t.facets));let o;t.groupBy&&(o=o1(e,i,t.groupBy));let s=t.offset??0,c=t.limit??10,l=D1(e,i,s,c).filter(Boolean),u=oZ(),d={count:i.length,elapsed:{raw:Number(u-r),formatted:aZ(u-r)},hits:l,...a?{facets:a}:{},...o?{groups:o}:{}};return(t.includeVectors??!1)||hZ(d,Object.keys(e.data.index.vectorIndexes)),d}async function a(){e.beforeSearch&&await rQ(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await nQ(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function y1(e){return e[1]}function b1(e){let t=Math.max.apply(Math,e.map(y1));return e.map(([e,n])=>[e,n/t])}function x1(e,t){return e/t}function S1(e,t){return(n,r)=>n*e+r*t}function C1(e,t,n,r){let i=Math.max.apply(Math,e.map(y1)),a=Math.max.apply(Math,t.map(y1)),{text:o,vector:s}=r&&r.text&&r.vector?r:w1(n),c=new Map,l=e.length,u=S1(o,s);for(let t=0;t<l;t++){let[n,r]=e[t],a=u(x1(r,i),0);c.set(n,a)}let d=t.length;for(let e=0;e<d;e++){let[n,r]=t[e],i=x1(r,a),o=c.get(n)??0;c.set(n,o+u(0,i))}return[...c].sort((e,t)=>t[1]-e[1])}function w1(e){return{text:.5,vector:.5}}function T1(e,t,n){let r=t.mode??`fulltext`;if(r===`fulltext`)return f1(e,t,n);if(r===`vector`)return g1(e,t);if(r===`hybrid`)return v1(e,t);throw wZ(`INVALID_SEARCH_MODE`,r)}function E1(e,t,n,r,i){let a=e.data.docs,o=new Map,s=[],c=new Set,l=t.length,u=0;for(let d=0;d<l;d++){let l=t[d];if(l===void 0)continue;let[f,p]=l;if(c.has(f))continue;let m=e.documentsStore.get(a,f),h=fZ(m,i);if(!(h===void 0||o.has(h))&&(o.set(h,!0),u++,!(u<=n)&&(s.push({id:zZ(e.internalDocumentIDStore,f),score:p,document:m}),c.add(f),u>=n+r)))break}return s}function D1(e,t,n,r){let i=e.data.docs,a=Array.from({length:r}),o=new Set;for(let s=n;s<r+n;s++){let n=t[s];if(n===void 0)break;let[r,c]=n;if(!o.has(r)){let t=e.documentsStore.get(i,r);a[s]={id:zZ(e.internalDocumentIDStore,r),score:c,document:t},o.add(r)}}return a}var O1=n(UX(),1),k1=`0.0.0-unknown`,A1={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function j1({kind:e,runtimeVersion:t}){return{[A1.protocol]:`1`,[A1.runtime]:t,[A1.kind]:e}}function M1({kind:e,runtimeVersion:t}){return{clientProtocolVersion:1,clientRuntimeVersion:t,clientKind:e}}var N1=`extra/screenshot.png`,P1=8192,F1=32768,I1=`…[truncated]`;function L1(e){let t=e.trim();if(t.length===0||t[0]!==`{`)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!=`object`||!n||Array.isArray(n))return null;let r=n;return{event:typeof r.event==`string`?r.event:void 0,fields:r}}function R1(e){return e.length<=8192?e:`${e.slice(0,P1-12)}${I1}`}var z1=`source`;function B1(e){return{ok:!1,error:e}}function V1(e){return{ok:!0,...e}}function H1(){return Kl.parse({})}function U1(e,t){let n=e.toString();if(n.length===0)return H1();let r=_r(n);if(r.errors.length>0)return console.warn(`[bindConfigDoc:${t}] Y.Text contains invalid YAML; returning schema defaults. Errors: ${r.errors.map(e=>e.message).join(`; `)}`),H1();let i=r.toJSON()??{},a=Kl.safeParse(i);return a.success?a.data:(console.warn(`[bindConfigDoc:${t}] Y.Text content fails schema validation; returning schema defaults. First issue: ${a.error.issues[0]?.message??`(unknown)`}`),H1())}function W1(e,t,n={}){return Jl(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>G1(e,t,n))}function G1(e,t,n){let{ytextKey:r=z1}=n,i=e.document,a=i.getText(r),o=new Set,s=new Set,c=!1,l=!1;function u(){if(c)return;let e=U1(a,t);for(let n of o)try{n(e)}catch(e){console.warn(`[bindConfigDoc:${t}] listener threw:`,e)}}function d(){if(c||(u(),l))return;l=!0;let e=[...s];s.clear();for(let n of e)try{n()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}a.observe(u),e.on(`synced`,d);function f(e){if(c)return B1({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=eu(e,t);if(n!==null)return B1(n);let r=_r(a.toString()),o=r.contents!==null&&!b(r.contents);if(r.errors.length>0||o){Yl(`config.corrupt-ytext-reset`,{"config.scope":t,"config.parse.errorCount":r.errors.length,"config.parse.topLevelNonMap":o});let e=r.errors.length>0?r.errors.map(e=>e.message).join(`; `):`top-level YAML is not a mapping`;console.warn(`[bindConfigDoc:${t}] dropping corrupt Y.Text and re-applying patch onto empty doc. Reason: ${e}`),r=_r(``)}r.contents===null&&(r.contents=r.createNode({}));let s=nu(r,e),l=r.toJSON()??{},u=Jl(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=Kl.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)Yl(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return B1({code:`SCHEMA_INVALID`,issues:u.error.issues.map(ru)});let d=r.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,d)}),V1({effective:u.data,appliedPaths:s})}return{current(){return U1(a,t)},patch(e){return Jl(`config.patch`,{"config.scope":t,"config.transport":`ytext`},t=>{let n=f(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})},subscribe(e){return o.add(e),()=>{o.delete(e)}},hasSynced(){return l},subscribeSynced(e){if(c)return()=>{};if(l){let n=!1;return queueMicrotask(()=>{if(!(n||c))try{e()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}),()=>{n=!0}}return s.add(e),()=>{s.delete(e)}},dispose(){c||(c=!0,a.unobserve(u),e.off(`synced`,d),o.clear(),s.clear())}}}var K1=`source`,q1=800;function J1(e){return{ok:!1,error:e}}function Y1(e){return{ok:!0,...e}}function X1(e,t={}){let{ytextKey:n=K1,acceptanceDelayMs:r=q1}=t,i=e.document,a=i.getText(n),o=new Set,s=new Set,c=new Set,l=!1,u=`idle`,d=null;function f(){d!==null&&(clearTimeout(d),d=null)}function p(e){if(!l&&u!==e){u=e;for(let t of c)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] status listener threw:`,e)}}}function m(){if(l)return;let e=a.toString();for(let t of o)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] text listener threw:`,e)}}function h(e){if(!l)for(let t of s)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] rejection listener threw:`,e)}}return a.observe(m),e.on(`synced`,m),{current(){return a.toString()},patch(e){return l?J1({code:`WRITE_ERROR`,detail:`OkignoreBinding has been disposed`}):(i.transact(()=>{a.length>0&&a.delete(0,a.length),e.length>0&&a.insert(0,e)}),f(),p(`pending`),d=setTimeout(()=>{d=null,!l&&u===`pending`&&p(`accepted`)},r),Y1({text:e}))},subscribe(e){return o.add(e),()=>{o.delete(e)}},subscribeRejection(e){return s.add(e),()=>{s.delete(e)}},subscribeStatus(e){return c.add(e),()=>{c.delete(e)}},status(){return u},notifyRejection(e){l||(f(),p(`rejected`),h({error:e,text:a.toString()}))},dispose(){l||(l=!0,f(),a.unobserve(m),e.off(`synced`,m),o.clear(),s.clear(),c.clear())}}}function Z1(e,t,n){return Q1([e,t,n],[])}function Q1(e,t){if(t.length>0){let n=Ql(Kl,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[1]??e[0]}let n=$1(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>e0(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=Q1(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function $1(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function e0(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var t0=2e3;function n0(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function r0(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var i0=`__system__`,a0=`__config__/project`,o0=`__user__/config.yml`,s0=`__local__/project`,c0=`__config__/okignore`;Object.freeze([a0,s0,o0,c0]);var l0=`__skill__/`,u0=`__template__/`,d0=[`project`,`global`];function f0(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)}var p0=`.ok/skills`;function m0(e){return`${p0}/${e}/SKILL`}var h0=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function g0(e){let t=h0.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===void 0?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}function _0(e,t){return e===`project`?m0(t):`${l0}${e}/${t}`}function v0(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function y0(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);return i?{kind:`skill`,scope:r,name:v0(i)}:null}if(e.startsWith(`__template__/`)){let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{kind:`template`,folder:v0(n<0?``:t.slice(0,n)),name:v0(r)}:null}return null}var b0=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.mdx?)?$/;function x0(e){let t=b0.exec(e);if(t){let e=(t[1]??``).replace(/^\/+|\/+$/g,``);return`${u0}${e?`${e}/`:``}${t[2]}`}return null}var S0=[`invalid-args`,`nested-project`,`target-not-empty`,`mkdir-failed`,`git-init-failed`,`init-failed`,`discovery-failed`],C0=[`.mdx`,`.md`],w0=`epoch`,T0=512*1024;function E0(e,t=T0){return typeof e==`number`&&Number.isFinite(e)&&e>t}var D0=[`claude`,`claude-desktop`,`cursor`,`codex`,`copilot`,`opencode`,`openclaw`,`pi`,`antigravity`,`lm-studio`,`hermes`],O0={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,copilot:`GitHub Copilot`,opencode:`OpenCode`,openclaw:`OpenClaw`,pi:`Pi`,antigravity:`Antigravity`,"lm-studio":`LM Studio`,hermes:`Hermes`},k0={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.github/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/skills`,antigravity:null,"lm-studio":null,hermes:null},A0=D0.filter(e=>k0[e]!==null);A0.filter(e=>e!==`pi`&&e!==`copilot`).map(e=>({hostDir:(k0[e]??``).split(`/`)[0],editorId:e}));var j0={claude:`claude-code`,"claude-desktop":`claude-code`,cursor:`cursor`,codex:`codex`,copilot:`github-copilot-cli`,opencode:`opencode`,openclaw:`openclaw`,pi:`pi`,antigravity:`antigravity`,"lm-studio":`lm-studio`,hermes:`hermes`},M0={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function N0(){if(typeof navigator>`u`)return null;let e=navigator.userAgent;for(let[t,n]of Object.entries(M0))if(n.test(e))return t;return null}var P0=[`incoming`,`outgoing`,`both`];function F0(e){return P0.includes(e)}var I0=`open-knowledge`,L0=[{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)">
|
|
398
398
|
<h3 style="margin:0 0 14px;font-size:15px;font-weight:600">Revenue by region</h3>
|
|
399
399
|
<div id="bars" style="display:flex;align-items:flex-end;gap:14px;height:170px"></div>
|
|
400
400
|
<script>
|
|
@@ -456,53 +456,53 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
456
456
|
out.textContent = '$' + Number(amt.value).toLocaleString();
|
|
457
457
|
});
|
|
458
458
|
<\/script>
|
|
459
|
-
</div>`}],L0=[{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`}],R0=eS.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),z0=pS.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[Tx({find:cS,type:this.type,getAttributes:{sourceDelimiter:`*`}}),Tx({find:uS,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),B0=sS.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[Tx({find:nS,type:this.type,getAttributes:{sourceDelimiter:`**`}}),Tx({find:iS,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),V0=ex.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),H0=qx.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}});function U0(e){let t=0;for(let n of e){let e=Number.parseInt(n,10);!Number.isNaN(e)&&e>t&&(t=e)}return String(t+1)}function W0(e){let t=[];return e.descendants(e=>(e.type.name===`footnoteDefinition`&&t.push(String(e.attrs.identifier??``)),!0)),t}function G0(e){let t=null;return e.forEach((e,n)=>{e.type.name===`footnoteDefinition`&&(t=n+e.nodeSize)}),t??e.content.size}var K0=qx.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}})}}}),q0=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/,J0=/^---[ \t]*$/;function Y0(e){let t=e.match(q0);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function X0(e){if(e===``)return``;let t=e.match(q0);return t?(t[1]??``).replace(/\r?\n$/,``):e}var Z0=hS.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`},sourceRaw:{default:null}}}}),Q0=_S.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),$0=qx.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 e2(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}var t2=yS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Ry(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=e2(t.src)),[`img`,t]}}),n2=qx.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}})}}}),r2=qx.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]}}),i2=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],a2=i2.map(e=>`${e}:`).join(`|`),o2=RegExp(`^(?:${a2}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function s2(e){let t=e.trim();return t===``?!0:o2.test(t)}function c2(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}var l2=new Set(i2.map(e=>`${e}:`)),u2=`https://placeholder.invalid`;function d2(e){try{let t=new URL(e,u2);return l2.has(t.protocol.toLowerCase())}catch{return!1}}var f2=Fw.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:d2,validate:d2,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}}}}),p2=qx.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function m2(e){return e.type.name===`list`&&!e.attrs.ordered}function h2(e){return e.type.name===`list`&&!!e.attrs.ordered}function g2(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function _2(e,t,n,r,i,a,o){let s=Oy(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?dm(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 um(n,a)(e,void 0)?t?um(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}var v2=qx.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,Ry(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:_2(e,t,n,r,e=>m2(e)&&!g2(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:_2(e,t,n,r,e=>h2(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:_2(e,t,n,r,e=>m2(e)&&g2(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Ox({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),Ox({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]}),joinPredicate:(e,t)=>t.attrs.ordered===!0}),new Kb({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=yf(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()}}}),y2=qx.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,Ry(t),0]:[`li`,Ry(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(Ry(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`),c=()=>{o&&(o.disabled=!n.isEditable)};return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,c(),n.on(`update`,c),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,o.disabled=!n.isEditable,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)},destroy(){n.off(`update`,c)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),b2=v2,x2=y2,S2=qx.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),C2=qx.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}}}}),w2=Ine.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),T2=zne.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),E2=qx.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)}}}),D2=ex.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)}}}),O2=lx.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}}),k2=qx.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;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:t||n}]}});function A2(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function j2(e){let t=!1;return e.descendants(e=>t?!1:(e.type.name===`list`&&(t=!0),!t)),t}function M2(e){let{selection:t}=e;return t instanceof cp?t.$cursor:null}function N2(e){let t=M2(e);if(!t||t.parentOffset!==0)return!1;let n=A2(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r===0?!1:j2(t.node(n-1).child(r-1))}function P2(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function F2(e){let t=M2(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=A2(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=P2(t,n);return r!==null&&r<n}var I2=lx.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!N2(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return Mp(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!F2(e.state))return!1;let{state:t,view:n}=e;return Np(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),L2=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function R2(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function z2(e){let t=R2(e);return t!==null&&L2.has(t)}function B2(e){let t=R2(e);return t===null?null:L2.get(t)??null}var V2=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function H2(e){V2.lastIndex=0;let t=e.match(V2);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=B2(e);if(t===null)return null;n+=t}return n}var U2=ex.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 W2(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||G2(n)===r?!0:H2(e)===t}function G2(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}var K2=nre.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),q2=IE.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),J2=kE.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Y2=AE.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),X2=qx.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()}}}),Z2=/^(?:---|—-|___\s|\*\*\*\s)$/;function Q2(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}var $2=Vne.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[Ex({find:Z2,type:this.type,getAttributes:e=>({sourceRaw:Q2(e)})})]}}),e4=/^\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/;function t4(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function n4(e){let t=e.match(e4);if(!t)return null;let n=t[1]?.trim()??``;return n?{type:`wikilink`,raw:t[0],target:n,anchor:t4(t[2]),alias:t4(t[3])}:null}function r4(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var i4=qx.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:t4(e.getAttribute(`data-alias`)),anchor:t4(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:t4(e.getAttribute(`data-alias`)),anchor:t4(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=t4(e.attrs.alias),i=t4(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`},r4({target:n,alias:r,anchor:i})]}});function a4(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function o4(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var s4=qx.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:t4(e.getAttribute(`data-alias`)),anchor:t4(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=t4(e.attrs.alias),i=t4(e.attrs.anchor),a=t4(e.attrs.resolvedSrc),o=a4(n);if(qc.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`},o4({target:n,alias:r,anchor:i})]}}),c4=[n2,C2,r2,S2,i4,s4,X2,b2,x2,z0,B0,K2,T2,R0,w2,Q0,$2,f2,$0,p2,Z0,V0,O2,U2,kre.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!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}}),I2,q2.configure({resizable:!0}),jE,Y2,J2,t2.configure({inline:!0}),k2,Rw,D2,E2,K0,H0];function l4(e){let t=e.indexOf(`/`);return t===-1?e:e.slice(t+1)}function u4(e,t){let n=encodeURIComponent(t.projectDir);if(t.prompt===``)return`claude://${e.mode}/new?folder=${n}`;let r=encodeURIComponent(t.prompt);return`claude://${e.mode}/new?q=${r}&folder=${n}`}function d4(e){let t=encodeURIComponent(e.projectDir);return e.prompt===``?`codex://new?path=${t}`:`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${t}`}function f4(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function p4(e){let t=encodeURIComponent(f4(e.projectDir));return e.prompt===``?`cursor://anysphere.cursor-deeplink/prompt?workspace=${t}&mode=agent`:`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(encodeURIComponent(e.prompt))}&workspace=${t}&mode=agent`}var m4=RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`),h4=RegExp("[ \\u00a0\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`);function g4(e){return e.replace(m4,`_`)}function _4(e){return e.replace(h4,`_`)}var v4="This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`.";function y4(e){return`${v4} ${e}`}var b4=`You're running in the terminal of the OpenKnowledge desktop app.`;function x4(e){return`${b4} ${v4} ${e===null?`Then stop.`:`Read \`${g4(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function S4(e,t,n){let r=`Let's work on \`${g4(e)}\` using OpenKnowledge.`;return V4(t?`${r} Open the OK editor in web view.`:r,n)}function C4(e,t,n){let r=`Use your open-knowledge-write-skill skill to author the ${t} Open Knowledge skill \`${g4(e)}\`. Edit it with the Open Knowledge tools.`;return n?`${r} Open the OK editor in web view.`:r}function w4(e,t,n){let r=`Let's work on the \`${g4(e)}\` folder using OpenKnowledge.`;return V4(t?`${r} Open the OK editor in web view.`:r,n)}function T4(e,t){let n=`Let's work on this project using OpenKnowledge.`;return V4(e?`${n} Open the OK editor in web view.`:n,t)}function E4(e,t,n,r){let i=t?`Open the OK editor in web view.`:``,a=e=>i===``?e:e.includes(`
|
|
459
|
+
</div>`}],R0=[{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`}],z0=eS.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),B0=pS.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[Tx({find:cS,type:this.type,getAttributes:{sourceDelimiter:`*`}}),Tx({find:uS,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),V0=sS.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[Tx({find:nS,type:this.type,getAttributes:{sourceDelimiter:`**`}}),Tx({find:iS,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),H0=ex.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),U0=qx.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}});function W0(e){let t=0;for(let n of e){let e=Number.parseInt(n,10);!Number.isNaN(e)&&e>t&&(t=e)}return String(t+1)}function G0(e){let t=[];return e.descendants(e=>(e.type.name===`footnoteDefinition`&&t.push(String(e.attrs.identifier??``)),!0)),t}function K0(e){let t=null;return e.forEach((e,n)=>{e.type.name===`footnoteDefinition`&&(t=n+e.nodeSize)}),t??e.content.size}var q0=qx.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}})}}}),J0=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/,Y0=/^---[ \t]*$/;function X0(e){let t=e.match(J0);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function Z0(e){if(e===``)return``;let t=e.match(J0);return t?(t[1]??``).replace(/\r?\n$/,``):e}var Q0=hS.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`},sourceRaw:{default:null}}}}),$0=_S.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),e2=qx.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 t2(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}var n2=yS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Ry(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=t2(t.src)),[`img`,t]}}),r2=qx.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}})}}}),i2=qx.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]}}),a2=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],o2=a2.map(e=>`${e}:`).join(`|`),s2=RegExp(`^(?:${o2}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function c2(e){let t=e.trim();return t===``?!0:s2.test(t)}function l2(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}var u2=new Set(a2.map(e=>`${e}:`)),d2=`https://placeholder.invalid`;function f2(e){try{let t=new URL(e,d2);return u2.has(t.protocol.toLowerCase())}catch{return!1}}var p2=Fw.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:f2,validate:f2,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}}}}),m2=qx.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function h2(e){return e.type.name===`list`&&!e.attrs.ordered}function g2(e){return e.type.name===`list`&&!!e.attrs.ordered}function _2(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function v2(e,t,n,r,i,a,o){let s=Oy(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?dm(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 um(n,a)(e,void 0)?t?um(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}var y2=qx.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,Ry(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:v2(e,t,n,r,e=>h2(e)&&!_2(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:v2(e,t,n,r,e=>g2(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:v2(e,t,n,r,e=>h2(e)&&_2(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Ox({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),Ox({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]}),joinPredicate:(e,t)=>t.attrs.ordered===!0}),new Kb({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=yf(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()}}}),b2=qx.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,Ry(t),0]:[`li`,Ry(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(Ry(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`),c=()=>{o&&(o.disabled=!n.isEditable)};return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,c(),n.on(`update`,c),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,o.disabled=!n.isEditable,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)},destroy(){n.off(`update`,c)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),x2=y2,S2=b2,C2=qx.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),w2=qx.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}}}}),T2=Ine.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),E2=zne.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),D2=qx.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)}}}),O2=ex.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)}}}),k2=lx.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}}),A2=qx.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;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:t||n}]}});function j2(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function M2(e){let t=!1;return e.descendants(e=>t?!1:(e.type.name===`list`&&(t=!0),!t)),t}function N2(e){let{selection:t}=e;return t instanceof cp?t.$cursor:null}function P2(e){let t=N2(e);if(!t||t.parentOffset!==0)return!1;let n=j2(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r===0?!1:M2(t.node(n-1).child(r-1))}function F2(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function I2(e){let t=N2(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=j2(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=F2(t,n);return r!==null&&r<n}var L2=lx.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!P2(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return Mp(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!I2(e.state))return!1;let{state:t,view:n}=e;return Np(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),R2=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function z2(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function B2(e){let t=z2(e);return t!==null&&R2.has(t)}function V2(e){let t=z2(e);return t===null?null:R2.get(t)??null}var H2=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function U2(e){H2.lastIndex=0;let t=e.match(H2);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=V2(e);if(t===null)return null;n+=t}return n}var W2=ex.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 G2(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||K2(n)===r?!0:U2(e)===t}function K2(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}var q2=nre.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),J2=IE.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),Y2=kE.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),X2=AE.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Z2=qx.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()}}}),Q2=/^(?:---|—-|___\s|\*\*\*\s)$/;function $2(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}var e4=Vne.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[Ex({find:Q2,type:this.type,getAttributes:e=>({sourceRaw:$2(e)})})]}}),t4=/^\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/;function n4(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function r4(e){let t=e.match(t4);if(!t)return null;let n=t[1]?.trim()??``;return n?{type:`wikilink`,raw:t[0],target:n,anchor:n4(t[2]),alias:n4(t[3])}:null}function i4(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var a4=qx.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:n4(e.getAttribute(`data-alias`)),anchor:n4(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:n4(e.getAttribute(`data-alias`)),anchor:n4(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=n4(e.attrs.alias),i=n4(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`},i4({target:n,alias:r,anchor:i})]}});function o4(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function s4(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var c4=qx.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:n4(e.getAttribute(`data-alias`)),anchor:n4(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=n4(e.attrs.alias),i=n4(e.attrs.anchor),a=n4(e.attrs.resolvedSrc),o=o4(n);if(qc.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`},s4({target:n,alias:r,anchor:i})]}}),l4=[r2,w2,i2,C2,a4,c4,Z2,x2,S2,B0,V0,q2,E2,z0,T2,$0,e4,p2,e2,m2,Q0,H0,k2,W2,kre.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!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}}),L2,J2.configure({resizable:!0}),jE,X2,Y2,n2.configure({inline:!0}),A2,Rw,O2,D2,q0,U0];function u4(e){let t=e.indexOf(`/`);return t===-1?e:e.slice(t+1)}function d4(e,t){let n=encodeURIComponent(t.projectDir);if(t.prompt===``)return`claude://${e.mode}/new?folder=${n}`;let r=encodeURIComponent(t.prompt);return`claude://${e.mode}/new?q=${r}&folder=${n}`}function f4(e){let t=encodeURIComponent(e.projectDir);return e.prompt===``?`codex://new?path=${t}`:`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${t}`}function p4(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function m4(e){let t=encodeURIComponent(p4(e.projectDir));return e.prompt===``?`cursor://anysphere.cursor-deeplink/prompt?workspace=${t}&mode=agent`:`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(encodeURIComponent(e.prompt))}&workspace=${t}&mode=agent`}var h4=RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`),g4=RegExp("[ \\u00a0\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`);function _4(e){return e.replace(h4,`_`)}function v4(e){return e.replace(g4,`_`)}var y4="This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`.";function b4(e){return`${y4} ${e}`}var x4=`You're running in the terminal of the OpenKnowledge desktop app.`;function S4(e){return`${x4} ${y4} ${e===null?`Then stop.`:`Read \`${_4(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function C4(e,t,n){let r=`Let's work on \`${_4(e)}\` using OpenKnowledge.`;return H4(t?`${r} Open the OK editor in web view.`:r,n)}function w4(e,t,n){let r=`Use your open-knowledge-write-skill skill to author the ${t} Open Knowledge skill \`${_4(e)}\`. Edit it with the Open Knowledge tools.`;return n?`${r} Open the OK editor in web view.`:r}function T4(e,t,n){let r=`Let's work on the \`${_4(e)}\` folder using OpenKnowledge.`;return H4(t?`${r} Open the OK editor in web view.`:r,n)}function E4(e,t){let n=`Let's work on this project using OpenKnowledge.`;return H4(e?`${n} Open the OK editor in web view.`:n,t)}function D4(e,t,n,r){let i=t?`Open the OK editor in web view.`:``,a=e=>i===``?e:e.includes(`
|
|
460
460
|
`)?[e,``,i].join(`
|
|
461
461
|
`):`${e} ${i}`,o=e=>e.split(`
|
|
462
462
|
`).map(e=>`> ${e}`).join(`
|
|
463
|
-
`),s
|
|
463
|
+
`),s=e3(r),c=e=>{let t=e.trim();if(n===`existing-repo`){let e=t===``?`Let's work on this project using OpenKnowledge.`:[`Here's what I'd like to do in this OpenKnowledge project:`,``,o(t)].join(`
|
|
464
464
|
`);return a(s===``?e:[e,``,s].join(`
|
|
465
465
|
`))}let r=`Scaffold the folders, templates, and AI-readable rules to match, using OpenKnowledge.`;return a(t===``?s===``?`Let's set up a new OpenKnowledge project. ${r}`:[`Let's set up a new OpenKnowledge project. ${r}`,``,s].join(`
|
|
466
466
|
`):[`I'm setting up a new OpenKnowledge project. Here's what I want to create:`,``,o(t),...s===``?[]:[``,s],``,r].join(`
|
|
467
|
-
`))};return c(
|
|
468
|
-
`),r=n===-1?t:t.slice(0,n);return Array.from(r).slice(0,
|
|
467
|
+
`))};return c(B4(c,e.trim(),`cursor`,k4))}var O4=3072,k4=O4-I4(`${y4} `,`cursor`),A4=160,j4=3,M4=` …`;function N4(e){let t=0,n=0;for(let r of e)r==="`"?(n+=1,n>t&&(t=n)):n=0;return t}function P4(e){return"`".repeat(Math.max(N4(e)+1,j4))}function F4(e){let t=e.trimStart(),n=t.indexOf(`
|
|
468
|
+
`),r=n===-1?t:t.slice(0,n);return Array.from(r).slice(0,A4).join(``).trimEnd()}function I4(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function L4(e){return`Let's work on the selected passage in @${e} using OpenKnowledge.`}function R4(e){let t=e.trim();return t===``?[]:[`Instruction:`,``,t.split(`
|
|
469
469
|
`).map(e=>`> ${e}`).join(`
|
|
470
|
-
`),``]}function
|
|
471
|
-
`).trimEnd()}function
|
|
472
|
-
`)}function
|
|
473
|
-
`)}function
|
|
470
|
+
`),``]}function z4(e,t){let n=R4(t);return n.length===0?e:[e,``,...n].join(`
|
|
471
|
+
`).trimEnd()}function B4(e,t,n,r=O4){let i=t=>I4(e(t),n)<=r;if(i(t))return t;let a=Array.from(t),o=0,s=a.length;for(;o<s;){let e=Math.ceil((o+s)/2);i(a.slice(0,e).join(``).trimEnd()+M4)?o=e:s=e-1}let c=a.slice(0,o).join(``).trimEnd();return c===``?``:c+M4}function V4(e,t){return B4(t=>z4(e,t),t,`cursor`,k4)}function H4(e,t){return z4(e,V4(e,t??``))}function U4(e,t,n){let r=P4(n);return[L4(e),``,...R4(t),`Here is the passage:`,``,r,n,r].join(`
|
|
472
|
+
`)}function W4(e,t,n){let r=F4(n),i=P4(r);return[L4(e),``,...R4(t),`The passage begins:`,``,i,r,i,``,`Read the full passage from @${e} via the OpenKnowledge MCP server before editing.`].join(`
|
|
473
|
+
`)}function G4(e,t,n){return B4(n,e,t)}function K4(e){let t=v4(e.relativePath),n=U4(t,e.instruction,e.selectionMarkdown);return I4(n,e.target)<=O4?n:W4(t,G4(e.instruction,e.target,n=>W4(t,n,e.selectionMarkdown)),e.selectionMarkdown)}function q4(e,t,n){let r=`Let's work on @${e} using OpenKnowledge.`,i=n?`Open the OK editor in web view.`:``,a=t.trim();if(a===``)return i===``?r:`${r} ${i}`;let o=[r,``,a.split(`
|
|
474
474
|
`).map(e=>`> ${e}`).join(`
|
|
475
475
|
`)];return i!==``&&o.push(``,i),o.join(`
|
|
476
|
-
`)}function
|
|
476
|
+
`)}function J4(e,t,n,r){let i=v4(e);return q4(i,G4(t,r,e=>q4(i,e,n)),n)}var Y4=`Open the OK editor in web view.`;function X4(e){return e.split(`
|
|
477
477
|
`).map(e=>`> ${e}`).join(`
|
|
478
|
-
`)}function
|
|
479
|
-
`)}function
|
|
480
|
-
`)}function
|
|
481
|
-
`)}function
|
|
478
|
+
`)}function Z4(e){let t=P4(e);return[`Here is the passage:`,``,t,e,t].join(`
|
|
479
|
+
`)}function Q4(e,t){let n=F4(e),r=P4(n);return[`The passage begins:`,``,r,n,r,``,`Read the full passage from @${t} via the OpenKnowledge MCP server before editing.`].join(`
|
|
480
|
+
`)}function $4(e,t,n){return`The selected passage is ${e===t?`line ${e}`:`lines ${e}-${t}`} of @${n}. Read it from @${n} via the OpenKnowledge MCP server before editing.`}function e3(e){let t=e.map(e=>v4(e)).filter(e=>e!==``);return t.length===0?``:[`Also reference:`,``,...t.map(e=>`@${e}`)].join(`
|
|
481
|
+
`)}function t3(e){return e.scope===`doc`?`Let's work on @${v4(e.docRelativePath)} using OpenKnowledge.`:e.scope===`folder`?`Let's work on the @${v4(e.folderRelativePath)} folder using OpenKnowledge.`:`Let's work on this project using OpenKnowledge.`}function n3(e,t,n,r,i){let a=t.trim();if(!(a!==``||n!==``||r!==``))return i===``?e:`${e} ${i}`;let o=[e];return a!==``&&o.push(X4(a)),n!==``&&o.push(n),r!==``&&o.push(r),i!==``&&o.push(i),o.join(`
|
|
482
482
|
|
|
483
|
-
`)}function
|
|
483
|
+
`)}function r3(e,t,n,r,i,a){if(e.kind===`lines`)return $4(e.startLine,e.endLine,n);if(e.kind===`anchor`)return Q4(e.markdown,n);let o=Z4(e.markdown);return I4(n3(t,``,o,r,i),a)<=O4?o:Q4(e.markdown,n)}function i3(e,t,n,r){let{target:i}=e,a=v4(e.docRelativePath),o=`Let's work on @${a} using OpenKnowledge.`,s=r3(t,o,a,n,r,i);return n3(o,G4(e.instruction,i,e=>n3(o,e,s,n,r)),s,n,r)}function a3(e){let{target:t}=e,n=e.autoOpen?Y4:``,r=e3(e.mentions);if(e.scope===`doc`&&e.selection!==void 0)return i3(e,e.selection,r,n);let i=t3(e);return n3(i,G4(e.instruction,t,e=>n3(i,e,``,r,n)),``,r,n)}function o3(e){return`'${e.replace(/'/g,`'\\''`)}'`}var s3=[`mcp__${I0}`,`Bash(ok open:*)`],c3=[`delete`,`move`,`share_link`,`install`].map(e=>`mcp__${I0}__${e}`),l3=`-c ${o3(`mcp_servers.${I0}.default_tools_approval_mode="approve"`)}`;function u3(e){let t={};return e.mcpPreApprove===!0&&(t.enabledMcpjsonServers=[I0]),e.autoApproveOkTools===!0&&(t.permissions={allow:[...s3],deny:[...c3]}),t.enabledMcpjsonServers===void 0&&t.permissions===void 0?``:`--settings ${o3(JSON.stringify(t))}`}var d3={claude:{bin:`claude`,displayName:`Claude`,docsUrl:`https://docs.claude.com/en/docs/claude-code`,handoffTarget:`claude-code`},codex:{bin:`codex`,displayName:`Codex`,docsUrl:`https://developers.openai.com/codex/cli`,handoffTarget:`codex`,autoApproveArg:l3},copilot:{bin:`copilot`,displayName:`GitHub Copilot`,docsUrl:`https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-getting-started`,handoffTarget:`copilot`,promptFlag:`--interactive`},cursor:{bin:`cursor-agent`,displayName:`Cursor`,docsUrl:`https://cursor.com/docs/cli/overview`,handoffTarget:`cursor`},opencode:{bin:`opencode`,displayName:`OpenCode`,docsUrl:`https://opencode.ai/docs`,handoffTarget:`opencode`,promptFlag:`--prompt`},pi:{bin:`pi`,displayName:`Pi`,docsUrl:`https://pi.dev`,handoffTarget:`pi`},antigravity:{bin:`agy`,displayName:`Antigravity`,docsUrl:`https://antigravity.google/docs/cli-getting-started`,handoffTarget:`antigravity`,promptFlag:`--prompt-interactive`}},f3=[`claude`,`codex`,`opencode`,`cursor`,`copilot`,`pi`,`antigravity`];function p3(e,t,n={}){let r=d3[e],i=e===`claude`?u3(n):n.autoApproveOkTools===!0&&r.autoApproveArg?r.autoApproveArg:``,a=i?`${i} `:``;if(t==null||t.length===0)return`${r.bin} ${a}`.trimEnd();let o=r.promptFlag?`${r.promptFlag} `:``;return`${r.bin} ${a}${o}${o3(t)}`}function m3(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}var h3=new Set([`opencode.json`]);function g3(e){return e.split(`/`).some(e=>e.startsWith(`.`))?!0:h3.has(e.slice(e.lastIndexOf(`/`)+1))}function _3(e,t){let n=m3(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var v3=k().superRefine(_3).optional(),y3={agentId:k().optional(),agentName:k().optional(),colorSeed:k().optional(),clientName:k().optional(),clientVersion:k().optional(),label:k().optional()},b3=k().optional(),x3=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;uc(`kind`,[N({kind:F(`doc`),docPath:k().min(1)}).loose(),N({kind:F(`folder`),folderPath:k()}).loose()]);var S3=P([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),C3=P([`current`,`stale`,`absent`]),w3=uc(`ok`,[N({ok:F(!0),shareUrl:k().min(1),sharedUrl:k().min(1),branch:k().min(1),freshness:C3.optional().catch(void 0)}).loose(),N({ok:F(!1),error:S3,branch:k().min(1).optional()}).loose()]),T3=P([`user`,`org`]),E3=N({login:k().min(1),kind:T3,avatarUrl:k().optional()}).loose(),D3=P([`auth-required`,`network`]),O3=uc(`ok`,[N({ok:F(!0),owners:M(E3)}).loose(),N({ok:F(!1),error:D3}).loose()]),k3=uc(`ok`,[N({ok:F(!0),available:j()}).loose(),N({ok:F(!1),error:D3}).loose()]),A3=P([`public`,`private`]);N({owner:k().min(1),name:k().min(1),visibility:A3,description:k().optional()}).loose();var j3=P([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),M3=uc(`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:j3}).loose()]);function N3(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var P3=e=>e.refine(N3,`invalid branch name`),F3={shareTargetExists:j(),dirtyConflicts:N({conflicts:j(),files:M(k().min(1))}).loose(),branchIsLocal:j(),shareTargetOnOriginBranch:j().optional()};uc(`detached`,[N({detached:F(!1),currentBranch:k().min(1).nullable(),currentHeadSha:ic(),...F3}).loose(),N({detached:F(!0),currentBranch:ic(),currentHeadSha:k().min(1),...F3}).loose()]),N({branch:P3(k().min(1)),principalId:k().optional(),fastForward:j().optional()}).loose();var I3=P([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);uc(`ok`,[N({ok:F(!0)}).loose(),N({ok:F(!1),reason:I3,files:M(k().min(1)).optional(),otherWorktreePath:k().min(1).optional()}).loose()]),P([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),N({branch:P3(k().min(1)),path:k(),kind:P([`doc`,`folder`])}).loose(),uc(`verdict`,[N({verdict:F(`on-origin`)}).loose(),N({verdict:F(`renamed`),renamedTo:k().min(1)}).loose(),N({verdict:F(`deleted`)}).loose(),N({verdict:F(`never-on-branch`)}).loose(),N({verdict:F(`changed-locally`)}).loose(),N({verdict:F(`unknown`)}).loose()]).catch({verdict:`unknown`});var L3=N({startedAt:k().min(1),httpListenMs:A().nonnegative().optional(),seedWalkMs:A().nonnegative().optional(),indexesMs:A().nonnegative().optional(),readyMs:A().nonnegative().optional(),fileCount:A().nonnegative().optional()}),R3=N({serverInstanceId:k().min(1),currentBranch:k().min(1).optional(),currentDiskAckSVs:dc(k().min(1),k().min(1)).optional(),boot:L3.optional()}).loose(),z3=N({id:k().min(1),display_name:k().min(1),display_email:k(),source:P([`git-config`,`synthesized`]),created_at:k().min(1)}).loose();N({collabUrl:k().nullable(),previewUrl:k().nullable(),port:A(),singleFile:j().default(!1)}).loose();var B3=N({type: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.urn:ok:error:config-not-writable`.split(`.`)),title:k().min(1),status:A().int().min(400).max(599),instance:k().regex(x3,`instance must be urn:uuid:<uuid>`).optional(),detail:k().optional()}).loose();N({parentDocName:k().min(1),placement:P([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:k().min(1).optional(),agentName:k().min(1).optional()}).loose();var V3=N({src:k().min(1),path:k().min(1).optional(),deduped:j().optional()}).loose();N({url:k().min(1),dir:k().min(1),branch:k().min(1).refine(N3,`invalid branch name`).optional()}).loose(),N({type:F(`error`),problem:B3}).loose();var H3=/notionvc:/i,U3=()=>e=>{W3(e)&&(G3(e),K3(e))};function W3(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(H3.test(e))return!0}if(t.type===`element`&&W3(t))return!0}return!1}function G3(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&G3(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
|
|
484
484
|
`)){t.push(n);continue}let r=e.split(`
|
|
485
|
-
`);for(let e=0;e<r.length;e++)r[e]&&t.push({type:`text`,value:r[e]??``}),e<r.length-1&&t.push({type:`element`,tagName:`br`,properties:{},children:[]})}e.children=t}function
|
|
486
|
-
`)}]}]}}function O6(e){let t=``;for(let n of e.children)n.type===`text`?t+=n.value??``:n.type===`element`&&(t+=O6(n));return t}var
|
|
487
|
-
`)&&(e.value=e.value.replace(/[ \t]*\n[ \t]*/g,` `)),e.type===`html`&&e.value.includes(`|`)&&(e.value=e.value.replace(/\|/g,`\\|`))),A6(e)}function
|
|
488
|
-
`).forEach((e,t)=>{t>0&&r(),e.length>0&&i({type:`text`,value:e})})},o=e=>{let t=e.ordered===!0,n=typeof e.start==`number`?e.start:1,a=e.data,o=typeof a?.bulletMarker==`string`?a.bulletMarker:`-`,c=typeof a?.listMarkerDelimiter==`string`?a.listMarkerDelimiter:`.`;e.children.forEach((e,a)=>{a>0&&r(),i({type:`text`,value:t?`${n+a}${c} `:`${o} `}),e.children.forEach((e,t)=>{t>0&&r(),s(e)})})},s=e=>{switch(e.type){case`paragraph`:case`heading`:e.children.forEach(i);return;case`list`:o(e);return;case`code`:case`html`:a(e.value);return;case`thematicBreak`:i({type:`text`,value:e.data?.sourceRaw??`---`});return;default:{let t=e;if(Array.isArray(t.children)&&t.children.length>0){t.children.forEach((e,t)=>{t>0&&r(),s(e)});return}let n=e;if(typeof n.value==`string`){a(n.value);return}console.warn(JSON.stringify({event:`table-cell-flatten-dropped-block`,nodeType:e.type}))}}};return e.forEach((e,t)=>{t>0&&r(),s(e)}),t}var M6=class extends Error{htmlBytes;maxBytes;constructor(e,t){super(`HTML payload (${e} bytes) exceeds htmlToMdast ceiling (${t} bytes); falling through to plain text`),this.name=`HtmlPayloadTooLargeError`,this.htmlBytes=e,this.maxBytes=t}},Lie=[$3,y6,q3,c6,H3,Mie,p6,w6,i6];function Rie(e){TN(e,e=>{e.type===`strong`?(e.data??={},e.data.sourceDelimiter=`**`):e.type===`emphasis`?(e.data??={},e.data.sourceDelimiter=`*`):e.type===`inlineCode`?(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=1):e.type===`code`&&(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=3)})}function zie(e,t){let n=t?.maxBytes??5242880;if(e.length>n)throw new M6(e.length,n);let r=_V().use(CM,{fragment:!0});for(let e of Lie)r.use(e);for(let e of t?.additionalCleanupPlugins??[])r.use(e);r.use(wF);let i=r.parse(e),a=r.runSync(i);return Rie(a),a}function Bie(e){return Iie(e),String(_V().use(cV).use(lV).stringify(e))}function Vie(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r++)e[n]===t[r]&&n++;return n===e.length}var Hie=new Set([`sourceRaw`,`sourceDirty`,`position`]),Uie=new Set([`jsxComponent`,`table`,`tableRow`,`tableCell`,`tableHeader`,`list`,`listItem`,`blockquote`,`codeBlock`,`heading`]),N6={type:`__br__`},Wie=/^<br\s*\/?>$/i;function P6(e){let t=L6(e,P6);return(t.type===`tableCell`||t.type===`tableHeader`)&&t.content?{...t,content:F6(t.content)}:t}function F6(e){let t=[];for(let n of e){let e=Gie(n);e.length!==0&&(t.length>0&&t.push(N6),t.push(...e))}return t}function Gie(e){return e.text!==void 0||e.type===`hardBreak`||e.type===`jsxInline`?[e]:!e.content||e.content.length===0?[]:e.content.some(e=>e.text===void 0&&e.type!==`hardBreak`&&e.type!==`jsxInline`&&!!e.content)?F6(e.content):e.content}function I6(e){return e.type===`hardBreak`||e.type===N6.type||e.text!==void 0&&Wie.test(e.text.trim())?N6:L6(e,I6)}var Kie=[{label:`table-cell-block-flatten`,severity:`pm-model-caused`,rationale:`GFM table cells have no block spelling; a block placed in a cell is flattened to inline on serialize, so a cell-with-blocks and a cell-with-inline describe the same persisted document.`,proofPointer:`markdown/table-cell-flatten.ts flattenCellBlocks (table-cell-flatten-dropped-block event)`,canonicalize:P6},{label:`void-hardbreak-br`,severity:`serializer-caused`,rationale:`A void hardBreak inside a table cell or heading serializes to a literal <br /> that a fresh parse keeps as text; the node form and the literal form are the same break.`,proofPointer:`markdown/void-br-promoter.ts + markdown/to-markdown-handlers.ts break handler`,canonicalize:I6}];function L6(e,t){return e.content?{...e,content:e.content.map(t)}:e}function R6(e,t){let n={};e.type!==void 0&&(n.type=e.type),e.text!==void 0&&(n.text=e.text);let r=z6(e.attrs,t);return r&&(n.attrs=r),e.marks&&e.marks.length>0&&(n.marks=[...e.marks].map(e=>({type:e.type,attrs:z6(e.attrs,t)})).sort((e,t)=>V6(e).localeCompare(V6(t)))),e.content&&e.content.length>0&&(n.content=e.content.map(e=>R6(e,t))),n}function z6(e,t){if(!e)return null;let n={};for(let r of Object.keys(e).sort()){if(Hie.has(r)||t?.(r))continue;let i=e[r];i!=null&&(n[r]=t?B6(i,t):i)}return Object.keys(n).length>0?n:null}function B6(e,t){if(Array.isArray(e))return e.map(e=>B6(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))t(r)||(n[r]=B6(i,t));return n}return e}function V6(e){return JSON.stringify(e,(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}return t})}function H6(e){let t=``,n=e=>{if(e.text!==void 0&&(t+=e.text),e.content)for(let t of e.content)n(t)};return n(e),t.replace(/\s+/g,``)}function U6(e){let t=[],n=e=>{if(e.type&&Uie.has(e.type)){let n=e.type===`jsxComponent`?String(e.attrs?.componentName??``):``;t.push(n?`${e.type}:${n}`:e.type)}if(e.content)for(let t of e.content)n(t)};return n(e),t.sort()}function W6(e){let t=e,n=[];for(let e of Kie){let r=V6(t),i=e.canonicalize(t);V6(i)!==r&&n.push(e.label),t=i}return{normalized:t,fired:n}}function qie(e,t,n={}){let r=W6(e),i=W6(t),a=[...new Set([...r.fired,...i.fired])];if(!Vie(H6(r.normalized),H6(i.normalized)))return{equivalent:!1,level:`L1`,reason:`content-loss`,appliedDegrades:a,detail:`authored text did not survive the round-trip`};let o=U6(r.normalized),s=U6(i.normalized);if(V6(o)!==V6(s))return{equivalent:!1,level:`L1`,reason:`structural-shatter`,appliedDegrades:a,detail:`container multiset diverged: [${o.join(`, `)}] vs [${s.join(`, `)}]`};let c=R6(r.normalized,n.ignoreAttrs),l=R6(i.normalized,n.ignoreAttrs);return V6(c)===V6(l)?{equivalent:!0,level:a.length>0?`L2`:`L1`,appliedDegrades:a}:{equivalent:!1,level:`L2`,reason:`structural-divergence`,appliedDegrades:a,detail:G6(c,l)}}function G6(e,t,n=`doc`){let r=e,i=t;if(!r||!i)return`${n}: node presence differs`;if(r.type!==i.type)return`${n}: type ${String(r.type)} vs ${String(i.type)}`;let a=r.content??[],o=i.content??[];if(a.length!==o.length)return`${n}(${String(r.type)}): child count ${a.length} vs ${o.length}`;for(let e=0;e<a.length;e++)if(V6(a[e])!==V6(o[e]))return G6(a[e],o[e],`${n}>${String(r.type)}[${e}]`);return`${n}(${String(r.type)}): attrs or marks differ`}function Jie(e,t,n){return!qie(e,t,{ignoreAttrs:n}).equivalent}var Yie=new Set([`src`,`href`,`size`]),Xie=new Set([`WikiEmbedImage`,`WikiEmbedVideo`,`WikiEmbedAudio`,`WikiEmbedFile`]);function K6(e){if(Array.isArray(e))return e.map(e=>K6(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))Yie.has(n)||(t[n]=K6(r));return t}return e}function q6(e){return e.type===`jsxComponent`&&typeof e.attrs?.componentName==`string`&&Xie.has(e.attrs.componentName)?K6(e):e.content?{...e,content:e.content.map(q6)}:e}function J6(e){if(Array.isArray(e))return e.map(e=>J6(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n!==`position`&&(t[n]=J6(r));return t}return e}function Y6(e){if(e.type===`jsxComponent`)return e;if(e.content)for(let t of e.content){let e=Y6(t);if(e)return e}}function Zie(e){let t=e.cacheLimit??2048,n=new Map,r=r=>{let i=n.get(r);if(i!==void 0)return i;let a=Y6(e.parse(r)),o=a?q6(J6(a)):null;if(n.size>=t){let e=n.keys().next().value;e!==void 0&&n.delete(e)}return n.set(r,o),o};return{isDiverged(e){if(e.type!==`jsxComponent`||!e.attrs||e.attrs.kind===`expression`)return!1;let t=e.attrs.sourceRaw;if(typeof t!=`string`||t.length===0)return!1;let n=r(t);return n?Jie(n,q6(J6(e))):!1}}}function Qie(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}if(r>=0){let e=n[r];if(e.type===`mdxJsxAttribute`&&e.value!=null&&typeof e.value==`object`&&e.value.type===`mdxJsxAttributeValueExpression`&&$ie(e.value.value,t))continue}let o=eae(e,t);r>=0?n[r]=o:n.push(o)}return n}function $ie(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function eae(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 X6(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:Qie(t,r),children:n.all(t),data:{}}}var tae=/^[A-Za-z0-9]{20,}$/,nae=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function rae(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function iae(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return tae.test(n)?n:null}function Z6(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:`||!rae(t.hostname))return null;let n=iae(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&nae.test(r)?r:null}}function Q6(e){return Z6(e)!==null}function aae(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function $6(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:aae(t.hostname)}var e8=/^[A-Za-z0-9_-]{11}$/;function oae(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 sae(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 cae(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return e8.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return e8.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function t8(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:`||!oae(t.hostname))return null;let n=cae(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?sae(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}var n8=[{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`}],r8=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:Uc,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`,hidden:!0}],i8=[{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`,hidden:!0}],a8=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:Wc,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`&&($6(e.src)||Q6(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:Uc,hideWhen:e=>typeof e.src==`string`&&($6(e.src)||Q6(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`&&Q6(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`&&($6(e.src)||Q6(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`&&(t8(e.src)!==null||$6(e.src)||Q6(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],o8=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:Gc,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`}],s8=[{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`}],lae=[n8[0],n8[1],n8[4],n8[5],n8[6]],uae=[r8[0],r8[1],r8[7]],dae=[s8[0],s8[1],s8[4],s8[5]],fae=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],pae=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],mae=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],c8=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],l8=[{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`)"}],u8=[{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."}],hae=[u8[0]],gae=[u8[0]],_ae=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],vae=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],d8=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],f8=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:Kc,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`)"}],p8=[{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."}],m8=[{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 h8(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function yae(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function g8(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}]}}var _8=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:n8,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)=>X6(`Callout`,e,t,n8)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:r8,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)=>X6(`img`,e,t,r8)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:a8,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)=>X6(`video`,e,t,a8)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:o8,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)=>X6(`audio`,e,t,o8)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:f8,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)=>X6(`Pdf`,e,t,f8)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:d8,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)=>X6(`File`,e,t,d8)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:i8,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:'Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src="…">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback.',searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>X6(`Embed`,e,t,i8)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:s8,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)=>X6(`Accordion`,e,t,s8)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:c8,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>
|
|
489
|
-
<Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>X6(`Tabs`,e,t,c8)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:l8,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)=>X6(`Tab`,e,t,l8)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:u8,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)=>X6(`Math`,e,t,u8)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:
|
|
490
|
-
`)}\n\n`:``}var
|
|
485
|
+
`);for(let e=0;e<r.length;e++)r[e]&&t.push({type:`text`,value:r[e]??``}),e<r.length-1&&t.push({type:`element`,tagName:`br`,properties:{},children:[]})}e.children=t}function K3(e){if(!(!(`children`in e)||!Array.isArray(e.children))){e.children=e.children.filter(e=>e.type===`comment`?!H3.test(String(e.value??``)):!0);for(let t of e.children)t.type===`element`&&K3(t)}}var q3=new Set([`Apple-tab-span`,`Apple-converted-space`,`Apple-style-span`]),J3=()=>e=>{Y3(e)};function Y3(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&Y3(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return X3(t)?[]:Z3(t)?t.children:[t]})}}function X3(e){if(e.tagName!==`meta`)return!1;let t=e.properties?.name,n=e.properties?.content;return t===`Generator`&&typeof n==`string`&&/Cocoa/i.test(n)}function Z3(e){if(e.tagName!==`span`)return!1;let t=e.properties?.className;return Array.isArray(t)?t.length>0&&t.every(e=>q3.has(String(e))):!1}var Q3=`docs-internal-guid-`;function $3(e,t){let n=e.children[t];!n||n.type!==`element`||e.children.splice(t,1,...n.children)}var e6=()=>e=>{t6(e)};function t6(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&t6(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(!n||n.type!==`element`){t++;continue}let r=n;if(n6(r)||r6(r)){$3(e,t);continue}t++}}function n6(e){if(e.tagName!==`b`)return!1;let t=e.properties?.id;return typeof t==`string`&&t.startsWith(Q3)}function r6(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.children.filter(e=>e.type===`element`);return t.length===1?t[0]?.tagName===`table`:!1}var i6=new Set([`commit-link`,`user-mention`,`team-mention`,`issue-link`]),a6=()=>e=>{o6(e)};function o6(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&o6(t);for(let t of e.children)t.type===`element`&&s6(t)}}function s6(e){if(!e.properties)return;for(let t of Object.keys(e.properties))t.startsWith(`dataHovercard`)&&delete e.properties[t];let t=e.properties.className;if(Array.isArray(t)){let n=t.filter(e=>!i6.has(String(e)));n.length===0?delete e.properties.className:e.properties.className=n}}var c6=/^gmail_/,l6=()=>e=>{u6(e)};function u6(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&u6(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(n.type!==`element`){t++;continue}let r=n;if(r.tagName===`div`&&d6(r,`gmail_quote`)&&(r.tagName=`blockquote`),f6(r),p6(r)){e.children.splice(t,1,...r.children);continue}t++}}function d6(e,t){let n=e.properties?.className;return Array.isArray(n)?n.some(e=>String(e)===t):!1}function f6(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!c6.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}function p6(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.properties?.className;return t!=null&&!(Array.isArray(t)&&t.length===0)?!1:e.children.filter(e=>e.type===`element`).length<=1}var m6=()=>e=>{h6(e)};function h6(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&h6(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return t.tagName===`google-sheets-html-origin`?t.children:t.tagName===`style`?[]:(g6(t),[t])})}}function g6(e){if(e.properties)for(let t of Object.keys(e.properties))t.startsWith(`dataSheets`)&&delete e.properties[t]}var _6=[`o:`,`w:`,`m:`,`v:`,`u1:`],v6=/^Mso[A-Z]/,y6=/^\s*\[if\s+[^\]]*\]/,b6=()=>e=>{x6(e)};function x6(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&x6(t);e.children=e.children.flatMap(e=>{if(e.type===`comment`){let t=String(e.value??``);return y6.test(t)?[]:[e]}if(e.type!==`element`)return[e];let t=e;return S6(t)?[]:(C6(t),[t])})}}function S6(e){return _6.some(t=>e.tagName.startsWith(t))}function C6(e){let t=e.properties;if(!t)return;let n=t.className;if(Array.isArray(n)){let e=n.filter(e=>typeof e==`string`&&!v6.test(e));e.length===0?delete t.className:t.className=e}else typeof n==`string`&&v6.test(n)&&delete t.className;let r=t.style;typeof r==`string`&&/mso-/i.test(r)&&delete t.style;for(let e of Object.keys(t))if(e.startsWith(`xmlns:`)){let n=e.slice(6);_6.some(e=>e===`${n}:`)&&delete t[e]}}var w6=/^c-(message_kit__|message__|compose|timestamp)/,Aie=()=>e=>{T6(e)};function T6(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&T6(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return jie(t)?[]:(Mie(t),[t])})}}function jie(e){let t=e.properties?.className;return Array.isArray(t)?t.some(e=>String(e)===`c-timestamp`||String(e).startsWith(`c-timestamp`)):!1}function Mie(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!w6.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}var Nie=()=>e=>{E6(e)};function E6(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&E6(t);for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`element`)continue;let r=n;Pie(r)&&(e.children[t]=Fie(r))}}}function Pie(e){if(e.tagName!==`div`)return!1;let t=e.children.filter(e=>e.type===`element`&&e.tagName===`div`);return t.length<2?!1:t.some(e=>D6(e))}function D6(e){for(let t of e.children){if(t.type!==`element`)continue;let e=t,n=e.properties?.style;if(typeof n==`string`&&/color\s*:/i.test(n)||D6(e))return!0}return!1}function Fie(e){return{type:`element`,tagName:`pre`,properties:{},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:e.children.filter(e=>e.type===`element`&&e.tagName===`div`).map(e=>O6(e)).join(`
|
|
486
|
+
`)}]}]}}function O6(e){let t=``;for(let n of e.children)n.type===`text`?t+=n.value??``:n.type===`element`&&(t+=O6(n));return t}var Iie=new Set([`break`,`delete`,`emphasis`,`footnoteReference`,`html`,`image`,`imageReference`,`inlineCode`,`link`,`linkReference`,`strong`,`text`]);function k6(e){let t=e.children;Array.isArray(t)&&t.forEach((e,n)=>{if(e.type===`break`){t[n]={type:`html`,value:`<br />`};return}k6(e)})}function A6(e){let t=e.children;if(Array.isArray(t))for(let e of t)(e.type===`inlineCode`||e.type===`html`)&&(e.value.includes(`
|
|
487
|
+
`)&&(e.value=e.value.replace(/[ \t]*\n[ \t]*/g,` `)),e.type===`html`&&e.value.includes(`|`)&&(e.value=e.value.replace(/\|/g,`\\|`))),A6(e)}function Lie(e){TN(e,`tableCell`,e=>{e.children.some(e=>!Iie.has(e.type))&&(e.children=j6(e.children)),k6(e),A6(e)})}function j6(e){let t=[],n=0,r=()=>{t.length>0&&(n+=1)},i=e=>{for(;n>0;)t.push({type:`break`}),--n;t.push(e)},a=e=>{e.split(`
|
|
488
|
+
`).forEach((e,t)=>{t>0&&r(),e.length>0&&i({type:`text`,value:e})})},o=e=>{let t=e.ordered===!0,n=typeof e.start==`number`?e.start:1,a=e.data,o=typeof a?.bulletMarker==`string`?a.bulletMarker:`-`,c=typeof a?.listMarkerDelimiter==`string`?a.listMarkerDelimiter:`.`;e.children.forEach((e,a)=>{a>0&&r(),i({type:`text`,value:t?`${n+a}${c} `:`${o} `}),e.children.forEach((e,t)=>{t>0&&r(),s(e)})})},s=e=>{switch(e.type){case`paragraph`:case`heading`:e.children.forEach(i);return;case`list`:o(e);return;case`code`:case`html`:a(e.value);return;case`thematicBreak`:i({type:`text`,value:e.data?.sourceRaw??`---`});return;default:{let t=e;if(Array.isArray(t.children)&&t.children.length>0){t.children.forEach((e,t)=>{t>0&&r(),s(e)});return}let n=e;if(typeof n.value==`string`){a(n.value);return}console.warn(JSON.stringify({event:`table-cell-flatten-dropped-block`,nodeType:e.type}))}}};return e.forEach((e,t)=>{t>0&&r(),s(e)}),t}var M6=class extends Error{htmlBytes;maxBytes;constructor(e,t){super(`HTML payload (${e} bytes) exceeds htmlToMdast ceiling (${t} bytes); falling through to plain text`),this.name=`HtmlPayloadTooLargeError`,this.htmlBytes=e,this.maxBytes=t}},Rie=[e6,b6,J3,l6,U3,Nie,m6,Aie,a6];function zie(e){TN(e,e=>{e.type===`strong`?(e.data??={},e.data.sourceDelimiter=`**`):e.type===`emphasis`?(e.data??={},e.data.sourceDelimiter=`*`):e.type===`inlineCode`?(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=1):e.type===`code`&&(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=3)})}function Bie(e,t){let n=t?.maxBytes??5242880;if(e.length>n)throw new M6(e.length,n);let r=_V().use(CM,{fragment:!0});for(let e of Rie)r.use(e);for(let e of t?.additionalCleanupPlugins??[])r.use(e);r.use(wF);let i=r.parse(e),a=r.runSync(i);return zie(a),a}function Vie(e){return Lie(e),String(_V().use(cV).use(lV).stringify(e))}function Hie(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r++)e[n]===t[r]&&n++;return n===e.length}var Uie=new Set([`sourceRaw`,`sourceDirty`,`position`]),Wie=new Set([`jsxComponent`,`table`,`tableRow`,`tableCell`,`tableHeader`,`list`,`listItem`,`blockquote`,`codeBlock`,`heading`]),N6={type:`__br__`},Gie=/^<br\s*\/?>$/i;function P6(e){let t=L6(e,P6);return(t.type===`tableCell`||t.type===`tableHeader`)&&t.content?{...t,content:F6(t.content)}:t}function F6(e){let t=[];for(let n of e){let e=Kie(n);e.length!==0&&(t.length>0&&t.push(N6),t.push(...e))}return t}function Kie(e){return e.text!==void 0||e.type===`hardBreak`||e.type===`jsxInline`?[e]:!e.content||e.content.length===0?[]:e.content.some(e=>e.text===void 0&&e.type!==`hardBreak`&&e.type!==`jsxInline`&&!!e.content)?F6(e.content):e.content}function I6(e){return e.type===`hardBreak`||e.type===N6.type||e.text!==void 0&&Gie.test(e.text.trim())?N6:L6(e,I6)}var qie=[{label:`table-cell-block-flatten`,severity:`pm-model-caused`,rationale:`GFM table cells have no block spelling; a block placed in a cell is flattened to inline on serialize, so a cell-with-blocks and a cell-with-inline describe the same persisted document.`,proofPointer:`markdown/table-cell-flatten.ts flattenCellBlocks (table-cell-flatten-dropped-block event)`,canonicalize:P6},{label:`void-hardbreak-br`,severity:`serializer-caused`,rationale:`A void hardBreak inside a table cell or heading serializes to a literal <br /> that a fresh parse keeps as text; the node form and the literal form are the same break.`,proofPointer:`markdown/void-br-promoter.ts + markdown/to-markdown-handlers.ts break handler`,canonicalize:I6}];function L6(e,t){return e.content?{...e,content:e.content.map(t)}:e}function R6(e,t){let n={};e.type!==void 0&&(n.type=e.type),e.text!==void 0&&(n.text=e.text);let r=z6(e.attrs,t);return r&&(n.attrs=r),e.marks&&e.marks.length>0&&(n.marks=[...e.marks].map(e=>({type:e.type,attrs:z6(e.attrs,t)})).sort((e,t)=>V6(e).localeCompare(V6(t)))),e.content&&e.content.length>0&&(n.content=e.content.map(e=>R6(e,t))),n}function z6(e,t){if(!e)return null;let n={};for(let r of Object.keys(e).sort()){if(Uie.has(r)||t?.(r))continue;let i=e[r];i!=null&&(n[r]=t?B6(i,t):i)}return Object.keys(n).length>0?n:null}function B6(e,t){if(Array.isArray(e))return e.map(e=>B6(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))t(r)||(n[r]=B6(i,t));return n}return e}function V6(e){return JSON.stringify(e,(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}return t})}function H6(e){let t=``,n=e=>{if(e.text!==void 0&&(t+=e.text),e.content)for(let t of e.content)n(t)};return n(e),t.replace(/\s+/g,``)}function U6(e){let t=[],n=e=>{if(e.type&&Wie.has(e.type)){let n=e.type===`jsxComponent`?String(e.attrs?.componentName??``):``;t.push(n?`${e.type}:${n}`:e.type)}if(e.content)for(let t of e.content)n(t)};return n(e),t.sort()}function W6(e){let t=e,n=[];for(let e of qie){let r=V6(t),i=e.canonicalize(t);V6(i)!==r&&n.push(e.label),t=i}return{normalized:t,fired:n}}function Jie(e,t,n={}){let r=W6(e),i=W6(t),a=[...new Set([...r.fired,...i.fired])];if(!Hie(H6(r.normalized),H6(i.normalized)))return{equivalent:!1,level:`L1`,reason:`content-loss`,appliedDegrades:a,detail:`authored text did not survive the round-trip`};let o=U6(r.normalized),s=U6(i.normalized);if(V6(o)!==V6(s))return{equivalent:!1,level:`L1`,reason:`structural-shatter`,appliedDegrades:a,detail:`container multiset diverged: [${o.join(`, `)}] vs [${s.join(`, `)}]`};let c=R6(r.normalized,n.ignoreAttrs),l=R6(i.normalized,n.ignoreAttrs);return V6(c)===V6(l)?{equivalent:!0,level:a.length>0?`L2`:`L1`,appliedDegrades:a}:{equivalent:!1,level:`L2`,reason:`structural-divergence`,appliedDegrades:a,detail:G6(c,l)}}function G6(e,t,n=`doc`){let r=e,i=t;if(!r||!i)return`${n}: node presence differs`;if(r.type!==i.type)return`${n}: type ${String(r.type)} vs ${String(i.type)}`;let a=r.content??[],o=i.content??[];if(a.length!==o.length)return`${n}(${String(r.type)}): child count ${a.length} vs ${o.length}`;for(let e=0;e<a.length;e++)if(V6(a[e])!==V6(o[e]))return G6(a[e],o[e],`${n}>${String(r.type)}[${e}]`);return`${n}(${String(r.type)}): attrs or marks differ`}function Yie(e,t,n){return!Jie(e,t,{ignoreAttrs:n}).equivalent}var Xie=new Set([`src`,`href`,`size`]),Zie=new Set([`WikiEmbedImage`,`WikiEmbedVideo`,`WikiEmbedAudio`,`WikiEmbedFile`]);function K6(e){if(Array.isArray(e))return e.map(e=>K6(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))Xie.has(n)||(t[n]=K6(r));return t}return e}function q6(e){return e.type===`jsxComponent`&&typeof e.attrs?.componentName==`string`&&Zie.has(e.attrs.componentName)?K6(e):e.content?{...e,content:e.content.map(q6)}:e}function J6(e){if(Array.isArray(e))return e.map(e=>J6(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n!==`position`&&(t[n]=J6(r));return t}return e}function Y6(e){if(e.type===`jsxComponent`)return e;if(e.content)for(let t of e.content){let e=Y6(t);if(e)return e}}function Qie(e){let t=e.cacheLimit??2048,n=new Map,r=r=>{let i=n.get(r);if(i!==void 0)return i;let a=Y6(e.parse(r)),o=a?q6(J6(a)):null;if(n.size>=t){let e=n.keys().next().value;e!==void 0&&n.delete(e)}return n.set(r,o),o};return{isDiverged(e){if(e.type!==`jsxComponent`||!e.attrs||e.attrs.kind===`expression`)return!1;let t=e.attrs.sourceRaw;if(typeof t!=`string`||t.length===0)return!1;let n=r(t);return n?Yie(n,q6(J6(e))):!1}}}function $ie(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}if(r>=0){let e=n[r];if(e.type===`mdxJsxAttribute`&&e.value!=null&&typeof e.value==`object`&&e.value.type===`mdxJsxAttributeValueExpression`&&eae(e.value.value,t))continue}let o=tae(e,t);r>=0?n[r]=o:n.push(o)}return n}function eae(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function tae(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 X6(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:$ie(t,r),children:n.all(t),data:{}}}var nae=/^[A-Za-z0-9]{20,}$/,rae=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function iae(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function aae(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return nae.test(n)?n:null}function Z6(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:`||!iae(t.hostname))return null;let n=aae(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&rae.test(r)?r:null}}function Q6(e){return Z6(e)!==null}function oae(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function $6(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:oae(t.hostname)}var e8=/^[A-Za-z0-9_-]{11}$/;function sae(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 cae(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 lae(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return e8.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return e8.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function t8(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:`||!sae(t.hostname))return null;let n=lae(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?cae(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}var n8=[{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`}],r8=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:Uc,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`,hidden:!0}],i8=[{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`,hidden:!0}],a8=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:Wc,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`&&($6(e.src)||Q6(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:Uc,hideWhen:e=>typeof e.src==`string`&&($6(e.src)||Q6(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`&&Q6(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`&&($6(e.src)||Q6(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`&&(t8(e.src)!==null||$6(e.src)||Q6(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],o8=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:Gc,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`}],s8=[{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`}],uae=[n8[0],n8[1],n8[4],n8[5],n8[6]],dae=[r8[0],r8[1],r8[7]],fae=[s8[0],s8[1],s8[4],s8[5]],pae=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],mae=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],hae=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],c8=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],l8=[{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`)"}],u8=[{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."}],gae=[u8[0]],_ae=[u8[0]],vae=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],yae=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],d8=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],f8=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:Kc,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`)"}],p8=[{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."}],m8=[{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 h8(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function bae(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function g8(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}]}}var _8=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:n8,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)=>X6(`Callout`,e,t,n8)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:r8,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)=>X6(`img`,e,t,r8)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:a8,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)=>X6(`video`,e,t,a8)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:o8,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)=>X6(`audio`,e,t,o8)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:f8,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)=>X6(`Pdf`,e,t,f8)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:d8,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)=>X6(`File`,e,t,d8)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:i8,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:'Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src="…">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback.',searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>X6(`Embed`,e,t,i8)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:s8,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)=>X6(`Accordion`,e,t,s8)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:c8,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>
|
|
489
|
+
<Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>X6(`Tabs`,e,t,c8)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:l8,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)=>X6(`Tab`,e,t,l8)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:u8,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)=>X6(`Math`,e,t,u8)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:vae,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:p8,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)=>X6(`Mirror`,e,t,p8)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:m8,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)=>X6(`MirrorSource`,e,t,m8)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:uae,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:dae,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (``) — read-only compat. Preserves `` 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:pae,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:g8},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:mae,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:g8},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:hae,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:g8},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:yae,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:g8},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:fae,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="${h8(n.name)}"`:``,a=n?.id?` id="${h8(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${bae(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:gae,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:_ae,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??``})}],xae={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>X6(e.attrs.componentName||`*`,e,t)};function v8(){let e=new Map;e.set(`*`,xae);for(let t of _8)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()}}}var y8={parseFallback:{blockLevel:0,wholeDoc:0,wholeDocBudget:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{},jsxPopoverCloseRestoreFailed:{},jsxKeyboardDeleteFailed:{},blockGripClickSelectFailed:{},jsxArrowNodeSelectFailed:{}};function b8(){y8.parseFallback.blockLevel++}function x8(){y8.parseFallback.wholeDoc++}function Sae(){y8.parseFallback.wholeDocBudget++}function Cae(e){y8.jsxRenderFailure[e]=(y8.jsxRenderFailure[e]??0)+1}function wae(e){y8.jsxAutoConvertFailed[e]=(y8.jsxAutoConvertFailed[e]??0)+1}function Tae(e){y8.jsxAutoConvertSucceeded[e]=(y8.jsxAutoConvertSucceeded[e]??0)+1}function Eae(e){y8.jsxPropDropped[e]=(y8.jsxPropDropped[e]??0)+1}function Dae(e){y8.jsxMoveFailed[e]=(y8.jsxMoveFailed[e]??0)+1}function Oae(e){y8.jsxStuckCopyFailed[e]=(y8.jsxStuckCopyFailed[e]??0)+1}function kae(e){y8.jsxStuckDeleteFailed[e]=(y8.jsxStuckDeleteFailed[e]??0)+1}function Aae(e){y8.jsxPopoverCloseRestoreFailed[e]=(y8.jsxPopoverCloseRestoreFailed[e]??0)+1}function jae(e){y8.jsxKeyboardDeleteFailed[e]=(y8.jsxKeyboardDeleteFailed[e]??0)+1}function Mae(e){y8.blockGripClickSelectFailed[e]=(y8.blockGripClickSelectFailed[e]??0)+1}function Nae(e){y8.jsxArrowNodeSelectFailed[e]=(y8.jsxArrowNodeSelectFailed[e]??0)+1}var Pae=/^(`{3,}|~{3,})/gm;function S8(e){let t=[],n=null;for(let r of e.matchAll(Pae)){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 C8(e,t){return t.some(([t,n])=>e>=t&&e<n)}var Fae=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function w8(e){let t=S8(e),n=[];for(let r of e.matchAll(Fae))C8(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
|
|
490
|
+
`)}\n\n`:``}var Iae=500,Lae=1e3;function Rae(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return O8(e,t.parse,0,n)}function T8(e){return e.calls>=Lae?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=Iae}var E8=500;function D8(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,E8),stack:e.stack?.split(`
|
|
491
491
|
`).slice(0,4).join(`
|
|
492
|
-
`)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,E8)}}function O8(e,t,n,r){if(n>20)return x8(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),A8(e);if(r){if(T8(r))return
|
|
492
|
+
`)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,E8)}}function O8(e,t,n,r){if(n>20)return x8(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),A8(e);if(r){if(T8(r))return Sae(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),A8(e);r.calls+=1}try{return t(e)}catch(i){let a=zae(i),o=D8(i);if(a===void 0){if(n===0){let n=Kae(e,t,i,r);if(n)return n}return x8(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),A8(e)}b8(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=Wae(e,a),s=e.slice(0,i.start),c=e.slice(i.start,i.end),l=e.slice(i.end),u=s.trim()?O8(s,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?O8(w8(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){x8();let n=D8(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})),A8(e)}}}function zae(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 Bae(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 k8(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}var Vae=32*1024;function Hae(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(C8(i,t))continue;let a=r[1]===`/`,o=r[2],s=i+r[0].length,c=Math.min(e.length,s+Vae),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 Uae(e){let t=Hae(e,S8(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=k8(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=k8(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function Wae(e,t){let n=Uae(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:Bae(e,t)??0,end:k8(e,t)??e.length}}function Gae(e){let t=S8(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;C8(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 Kae(e,t,n,r){let i=Gae(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&T8(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=w8(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){b8();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 A8(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}var j8=``,M8=``,N8=``,P8=``,F8=``,I8=[[j8,``],[M8,``],[N8,``],[P8,``],[F8,``]],L8=/[\uE000-\uE004]/,R8=/[\uE005-\uE009]/;I8.map(([e,t])=>({from:e,to:t}));var qae=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,Jae=/<!--[\s\S]*?-->/g,Yae=/<\/([a-z][a-z0-9]*)\s*>/g,Xae=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,z8=new Set([`img`,`video`,`audio`]),B8=new Set([`mark`]),Zae=/<\/([A-Z][A-Za-z0-9.]*)>/g;function V8(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 Qae(e){let t=new Map,n=new RegExp(Zae.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 $ae(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 eoe(e){let t=[],n=e.indexOf(`/>`);for(;n!==-1;)t.push(n),n=e.indexOf(`/>`,n+2);return t}function toe(e){let t=[],n=e.indexOf(`>`);for(;n!==-1;)t.push(n),n=e.indexOf(`>`,n+1);return t}var H8=1024;function noe(e,t){if(t[e-1]!==`(`||t[e-2]!==`]`)return!1;let n=e-2,r=0;for(let e=n-1;e>=0&&t[e]===`\\`;e--)r++;if(r%2==1)return!1;let i=!1,a=Math.max(0,n-H8);for(let e=n-1;e>=a;e--){let n=t[e];if(n===`
|
|
493
493
|
`||n===`\r`||n==="`")return!1;if(n!==`[`&&n!==`]`)continue;let r=0;for(let n=e-1;n>=0&&t[n]===`\\`;n--)r++;if(r%2!=1){if(n===`]`||t[e+1]===`^`||t[e-1]===`]`)return!1;i=!0;break}}if(!i)return!1;let o=!1,s=-1,c=Math.min(t.length,e+1+H8);for(let n=e+1;n<c;n++){let e=t[n];if(e===`>`){s=n;break}if(e===`<`||e===`\\`||e===`
|
|
494
|
-
`||e===`\r`||e===j8||e===M8||e===N8||e===P8||e===F8)return!1;(e===` `||e===` `)&&(o=!0)}return s===-1||!o?!1:t[s+1]===`)`}function
|
|
494
|
+
`||e===`\r`||e===j8||e===M8||e===N8||e===P8||e===F8)return!1;(e===` `||e===` `)&&(o=!0)}return s===-1||!o?!1:t[s+1]===`)`}function roe(e,t,n,r){let i=V8(n,e);if(i>=n.length)return!1;let a=n[i],o=V8(r,e);return a>=(o<r.length?r[o]:t.length)?!1:t[a-1]===`/`}function U8(e){let t=e;if(L8.test(t))for(let[e,n]of I8)t=t.replaceAll(e,n);t=t.replace(Jae,e=>e.replace(/</g,j8).replace(/>/g,M8)),t=t.replace(qae,(e,t)=>`${j8}${t.replaceAll(`:`,N8).replaceAll(`@`,P8)}${M8}`),t=t.replace(Yae,(e,t)=>B8.has(t)?e:e.replace(/</g,j8).replace(/>/g,M8)),t=t.replace(Xae,(e,t)=>z8.has(t)&&e.endsWith(`/>`)||B8.has(t)?e:t[0]===t[0].toLowerCase()&&t[0]!==t[0].toUpperCase()?e.replace(/</g,j8).replace(/>/g,M8):e),t=t.replace(/<>/g,`${j8}${M8}`);let n=Qae(t),r=$ae(t),i=eoe(t),a=toe(t);t=t.replace(/</g,(e,o)=>{if(noe(o,t))return e;let s=t.slice(o,o+256);if(s[1]===`/`)return/^<\/[a-zA-Z][a-zA-Z0-9.]*[ \t]*>/.test(s)?e:j8;let c=/^<([a-z][a-z0-9]*)/.exec(s);if(c&&z8.has(c[1])&&roe(o,t,a,r))return e;let l=/^<([a-z][a-z0-9]*)([\s/>])/.exec(s);if(l&&B8.has(l[1])){let n=l[1];return s.startsWith(`<${n}/>`)||t.indexOf(`</${n}>`,o)!==-1?e:j8}let u=/^<([A-Z][a-zA-Z0-9.]*)[\s/>]/.exec(s);if(!u)return j8;let d=u[1],f=V8(r,o),p=V8(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&&V8(m,o)<m.length?e:j8});{let e=[],n=[];for(let r=0;r<t.length;r++){if(t[r]===`
|
|
495
495
|
`){let i=t[r+1];if(i===`
|
|
496
496
|
`||i===`>`){if(e.push(...n),n.length=0,i===`
|
|
497
497
|
`)for(;t[r+1]===`
|
|
498
|
-
`;)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.split(``);for(let t of e)n[t]=F8;t=n.join(``)}}return t}function W8(e){return L8.test(e)||R8.test(e)}function G8(){return e=>{TN(e,e=>{let t=e;typeof t.value==`string`&&W8(t.value)&&(t.value=K8(t.value)),typeof t.url==`string`&&W8(t.url)&&(t.url=K8(t.url)),typeof t.title==`string`&&W8(t.title)&&(t.title=K8(t.title)),typeof t.alt==`string`&&W8(t.alt)&&(t.alt=K8(t.alt)),typeof t.lang==`string`&&W8(t.lang)&&(t.lang=K8(t.lang)),typeof t.meta==`string`&&W8(t.meta)&&(t.meta=K8(t.meta))})}}function K8(e){let t=e.replaceAll(j8,`<`).replaceAll(M8,`>`).replaceAll(N8,`:`).replaceAll(P8,`@`).replaceAll(F8,`{`);if(R8.test(t))for(let[e,n]of I8)t=t.replaceAll(n,e);return t}var q8=``,J8=``,Y8=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function
|
|
499
|
-
`,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(
|
|
500
|
-
`?(n+=1,r=1):r+=1;return{line:n,column:r,offset:t}}function
|
|
501
|
-
`;)r--;let i=e.slice(r,n===t-1?n:n+1);if(i.trim().length===0){n=r-2;continue}return
|
|
502
|
-
`),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!w5.test(e)))return!1;return n}function
|
|
498
|
+
`;)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.split(``);for(let t of e)n[t]=F8;t=n.join(``)}}return t}function W8(e){return L8.test(e)||R8.test(e)}function G8(){return e=>{TN(e,e=>{let t=e;typeof t.value==`string`&&W8(t.value)&&(t.value=K8(t.value)),typeof t.url==`string`&&W8(t.url)&&(t.url=K8(t.url)),typeof t.title==`string`&&W8(t.title)&&(t.title=K8(t.title)),typeof t.alt==`string`&&W8(t.alt)&&(t.alt=K8(t.alt)),typeof t.lang==`string`&&W8(t.lang)&&(t.lang=K8(t.lang)),typeof t.meta==`string`&&W8(t.meta)&&(t.meta=K8(t.meta))})}}function K8(e){let t=e.replaceAll(j8,`<`).replaceAll(M8,`>`).replaceAll(N8,`:`).replaceAll(P8,`@`).replaceAll(F8,`{`);if(R8.test(t))for(let[e,n]of I8)t=t.replaceAll(n,e);return t}var q8=``,J8=``,Y8=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function ioe(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n}function X8(e,t,n){return t.lastIndex=0,e.replace(t,(t,r)=>typeof r!=`number`||ioe(e,r)%2==1?t:n(t))}function Z8(e){return Y8.lastIndex=0,e.replace(Y8,e=>{let t=e.slice(1,-1);if(t.startsWith(`#`)){let e=t[1]===`x`||t[1]===`X`;return RL(t.slice(e?2:1),e?16:10)}let n=LL(t);return n===!1?e:n})}function Q8(e){return X8(e,Y8,e=>`${q8}${e.slice(1,-1)}${J8}`)}var $8=RegExp(`${q8}([^${J8}]+)${J8}`,`g`);function e5(e){if(!e.includes(q8))return{value:e,spans:[]};let t=[],n=``,r=0;$8.lastIndex=0;let i=$8.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=$8.exec(e)}return r<e.length&&(n+=e.slice(r)),{value:n,spans:t}}function aoe(){return e=>{TN(e,e=>{let t=e;if(typeof t.value==`string`&&t.value.includes(q8)){let{value:n,spans:r}=e5(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`,`lang`,`meta`]){let n=t[e];typeof n==`string`&&n.includes(q8)&&(t[e]=e5(n).value)}})}}var t5=``,ooe=/\\</g;function n5(e){return X8(e,ooe,e=>`${t5}${e.slice(1)}`)}function r5(){return e=>{TN(e,e=>{let t=e;typeof t.value==`string`&&t.value.includes(t5)&&(t.value=t.value.split(t5).join(``));for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(t5)&&(t[e]=n.split(t5).join(``))}})}}var soe=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),coe={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`},i5=`ok-alert`,loe=RegExp(`(?:^|\\s)${i5}-(\\w+)(?:\\s|$)`),uoe=/^>\s*\[!(\w+)\]([+-])?(?:\s+(.*?))?\s*$/i;function a5(e,t){if(t<0||t>=e.length)return null;let n=e.indexOf(`
|
|
499
|
+
`,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(uoe);return r?{rawType:r[1],foldableMarker:r[2]===`+`||r[2]===`-`?r[2]:null,title:r[3]?.trim()||null}:null}function doe(e){if(e.data?.hName!==`div`)return null;let t=e.data?.hProperties?.class;if(typeof t!=`string`)return null;let n=t.match(loe);return n?n[1].toLowerCase():null}function o5(e){return coe[e.toLowerCase()]??null}function foe(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&&poe(o[0],s)?o.slice(1):o,position:e.position}}function poe(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 moe(e){if(!e||typeof e!=`object`||e.type!==`paragraph`)return!1;let t=e.data?.hProperties?.class;return typeof t==`string`&&t.includes(`${i5}-title`)}function hoe(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;TN(e,`blockquote`,(e,t,r)=>{if(r===void 0||typeof t!=`number`)return;let i=doe(e);if(!i)return;let a=o5(i),o=null,s=null;e.position?.start?.offset!==void 0&&(s=a5(n,e.position.start.offset),s&&(o=s.title,a||=o5(s.rawType)));let c=a??`note`,l=s&&soe.has(c)?s.foldableMarker:null,u=(()=>{if(e.position?.start?.offset!==void 0){let t=a5(n,e.position.start.offset);if(t?.rawType)return t.rawType}return i})(),d=u.toLowerCase()===c?null:u;if(!moe(e.children[0]))return;let f=foe(e,c,o,l,d);r.children[t]=f})}}var goe=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"></svg>`,_oe={markers:`*`,classPrefix:i5,matchCaseSensitive:!1,icons:new Proxy({},{get:()=>goe})};function s5(e,t,n,r){let i=t,a=0;for(;a<r&&i<e.length;)e[i]===`\\`&&i+1<e.length&&n[a]===e[i+1]?(i+=2,a+=1):(i+=1,a+=1);return i}function c5(e,t){let n=1,r=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
|
|
500
|
+
`?(n+=1,r=1):r+=1;return{line:n,column:r,offset:t}}function voe(e,t,n){return{start:c5(e,t),end:c5(e,n)}}function l5(e,t,n,r){if(!e||!t.position||typeof t.position.start?.offset!=`number`)return;let i=t.position.start.offset;return voe(e,s5(e,i,t.value,n),s5(e,i,t.value,r))}var u5=/(?<!%)%%([^\n]*?[^\n%])%%(?!%)/g,d5=/<!--([\s\S]*?)-->/g;function yoe(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;xoe(e),TN(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`%%`)===-1&&i.indexOf(`<!--`)===-1)return;let a=boe(i);if(a.length===0)return;let o=[],s=0;for(let t of a){if(t.start>s){let r={type:`text`,value:i.slice(s,t.start)},a=l5(n,e,s,t.start);a&&(r.position=a),o.push(r)}let r={type:`comment`,children:[{type:`text`,value:t.body}],data:{sourceForm:t.sourceForm}},a=l5(n,e,t.start,t.end);a&&(r.position=a),o.push(r),s=t.end}if(s<i.length){let t={type:`text`,value:i.slice(s)},r=l5(n,e,s,i.length);r&&(t.position=r),o.push(t)}return r.children.splice(t,1,...o),[SN,t+o.length]})}}function boe(e){let t=[];u5.lastIndex=0;let n;for(;(n=u5.exec(e))!==null;)n[1].trim().length!==0&&t.push({start:n.index,end:n.index+n[0].length,body:n[1],sourceForm:`percent`});d5.lastIndex=0;let r;for(;(r=d5.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 xoe(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type===`paragraph`){let r=f5(e);if(r!==null){let e=Soe(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=Coe(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=woe(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=Toe(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`&&m5(e)){let e=n+1;for(;e<t.length;){let n=t[e];if(n.type===`paragraph`&&m5(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 f5(e){if(e.children.length!==1)return null;let t=e.children[0];return t.type===`text`?t.value:null}function Soe(e){let t=e.match(/^%%\n((?:.|\n(?!\n))+?)\n%%$/);return t===null?null:t[1]}function Coe(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 woe(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(p5(r,`<!--`)>1||p5(r,`-->`)>0)return null}else if(t===e.children.length-1){if(p5(r,`<!--`)>0||p5(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 Toe(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 p5(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 m5(e){let t=f5(e);return t===null?!1:t.trim()===`%%`}var Eoe=/^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm,Doe=/^[ ]{0,3}([-*+]|\d{1,9}[.)])([ \t]|$)/;function Ooe(e,t){if(t===0)return!1;let n=t-1;for(;n>=0;){let r=n;for(;r>0&&e[r-1]!==`
|
|
501
|
+
`;)r--;let i=e.slice(r,n===t-1?n:n+1);if(i.trim().length===0){n=r-2;continue}return Doe.test(i)}return!1}function h5(e){if(!e.includes(`</`))return e;let t=S8(e),n=!1,r=e.replace(Eoe,(r,i,a,o,s)=>C8(s,t)||!Ooe(e,s)?r:(n=!0,`${a}${o}`));return n?r:e}var koe=/^<details(\s[^>]*)?>\s*<summary>([\s\S]*?)<\/summary>([\s\S]*?)<\/details>\s*$/,Aoe=/^<details(\s[^>]*)?>(?:\s*<summary>([\s\S]*?)<\/summary>)?[\s\S]*$/,joe=/^\s*<\/details>\s*$/;function g5(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 _5(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 v5(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function y5(e){return e.children[0].value??``}function Moe(e){if(!v5(e))return null;let t=y5(e).match(koe);if(!t)return null;let{defaultOpen:n,name:r,id:i}=g5(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:_5({title:a,defaultOpen:n,name:r,id:i}),children:s,position:e.position}}function Noe(e,t){let n=e[t];if(!v5(n))return null;let r=y5(n);if(!r.startsWith(`<details`)||r.includes(`</details>`))return null;let i=r.match(Aoe);if(!i)return null;let{defaultOpen:a,name:o,id:s}=g5(i[1]),c=i[2]?.trim()||null;for(let n=t+1;n<e.length;n++){let t=e[n];if(!v5(t))continue;let r=y5(t);if(joe.test(r))return{closerIdx:n,title:c,defaultOpen:a,name:o,id:s};if(r.includes(`</details>`))return null}return null}function Poe(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(v5(e)){let r=Moe(e);if(r){t[n]=r,n++;continue}let i=Noe(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:_5(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 Foe(){return e=>{TN(e,e=>{`children`in e&&Array.isArray(e.children)&&Poe(e)})}}var b5=/(?<!=)==(?=\S)([^\n]*?[^\s=])==(?!=)/g;function Ioe(e){return e.type===`strong`||e.type===`emphasis`||e.type===`delete`||e.type===`inlineCode`}function x5(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?x5(e.children[0]):null}function S5(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 S5(t[t.length-1])}return null}function Loe(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=x5(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:x5(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=S5(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:x5(n):null}if(c!==`=`){a=e,o=r,s=!0;break}}if(a>=0)break}else if(!Ioe(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}}function C5(e){if(`children`in e&&Array.isArray(e.children)){Loe(e);for(let t of e.children)C5(t)}}function Roe(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;TN(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`==`)===-1)return;b5.lastIndex=0;let a=[],o;for(;(o=b5.exec(i))!==null;)a.push(o);if(a.length===0)return;let s=[],c=0;for(let t of a){let r=t.index,a=r+t[0].length;if(r>c){let t={type:`text`,value:i.slice(c,r)},a=l5(n,e,c,r);a&&(t.position=a),s.push(t)}let o={type:`text`,value:t[1]},l=l5(n,e,r+2,a-2);l&&(o.position=l);let u={type:`mark`,children:[o]},d=l5(n,e,r,a);d&&(u.position=d),s.push(u),c=a}if(c<i.length){let t={type:`text`,value:i.slice(c)},r=l5(n,e,c,i.length);r&&(t.position=r),s.push(t)}return r.children.splice(t,1,...s),[SN,t+s.length]}),C5(e),TN(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 zoe(){return e=>{TN(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=Boe(r,e);n.children[t]=i})}}function Boe(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}var w5=/^( {4}|\t)/;function Voe(e){let t=e.split(`
|
|
502
|
+
`),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!w5.test(e)))return!1;return n}function Hoe(e){return e.split(`
|
|
503
503
|
`).map(e=>e.length===0?e:e.startsWith(` `)?e.slice(4):e.startsWith(` `)?e.slice(1):e).join(`
|
|
504
|
-
`)}function
|
|
505
|
-
`;)a--;if(a===r)return null;let o=t.slice(a,r);if(!w5.test(o))return null;let s=t.slice(a,i);if(!
|
|
504
|
+
`)}function Uoe(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]!==`
|
|
505
|
+
`;)a--;if(a===r)return null;let o=t.slice(a,r);if(!w5.test(o))return null;let s=t.slice(a,i);if(!Voe(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:Hoe(s).replace(/\n+$/,``),position:c,data:{sourceStyle:`indented`}}}var Woe=function(){return(e,t)=>{let n=String(t.value??``);n&&TN(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=Uoe(e,n);a&&(r.children[t]=a)})}};function T5(e,t,n){let r={type:`mdxJsxFlowElement`,name:e,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t}],children:[]};return n&&(r.position=n),r}function Goe(){return e=>{TN(e,`math`,(e,t,n)=>{if(!n||t==null)return;let r=T5(`DollarMath`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r}),TN(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`math`)return;let r=T5(`MathFence`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}var E5=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g;function Koe(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value;E5.lastIndex=0;let a=[],o=0;for(;;){let n=E5.exec(e);if(n===null)break;let s=n[0],c=n[1],l=n.index;if(l>o){let n={type:`text`,value:e.slice(o,l)},r=l5(t,i,o,l);r&&(n.position=r),a.push(n)}let u={type:`text`,value:c},d=l5(t,i,l+1,l+1+c.length);d&&(u.position=d);let f={type:`link`,url:c,title:null,children:[u],data:{sourceStyle:`autolink`}},p=l5(t,i,l,l+s.length);p&&(f.position=p),a.push(f),o=l+s.length,r=!0}if(a.length===0)n.push(i);else{if(o<e.length){let n={type:`text`,value:e.slice(o)},r=l5(t,i,o,e.length);r&&(n.position=r),a.push(n)}n.push(...a)}}r&&(e.children=n)}var qoe=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`.split(``));function D5(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 Joe(e,t,n=!1,r){if(!t)return;let i=e.position;if(!i||typeof i.start?.offset!=`number`){n&&console.warn(`[position-slice] node type=${e.type} has no position — fidelity defaults apply`);return}let a=i.start.offset,o=i.end?.offset??a;if(a<0||o>t.length){n&&console.warn(`[position-slice] node type=${e.type} position out of bounds: start=${a} end=${o} sourceLen=${t.length}`);return}switch(e.data??={},e.type){case`text`:{let n=t.slice(a,o),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&&qoe.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[a];(n===`*`||n===`_`)&&(e.data.sourceDelimiter=n);break}case`strong`:{let n=t.slice(a,a+2);(n===`**`||n===`__`)&&(e.data.sourceDelimiter=n);break}case`heading`:{let n=t[a],i=t.slice(a,o);if(n===`#`){if(e.data.sourceStyle=`atx`,r?.type===`root`){let n=a;for(;n>0&&t[n-1]!==`
|
|
506
506
|
`;)n--;let r=t.slice(n,a);r.length>=1&&r.length<=3&&/^ +$/.test(r)&&(e.data.sourceLeadingIndent=r.length)}let n=/^#+( {2,})[^ ]/.exec(i);n&&(e.data.sourceInteriorSpacing=n[1].length);let o=/^.*?[ \t](#+)[ \t]*$/.exec(i);o&&(e.data.sourceTrailingHashes=o[1].length)}else{let t=/\n(=+)[ \t]*$/.exec(i),n=/\n(-+)[ \t]*$/.exec(i),r=t??n;r?(e.data.sourceStyle=`setext`,e.data.sourceUnderlineLength=r[1].length):e.data.sourceStyle=`atx`}break}case`blockquote`:{let n=a;for(;n>0&&t[n-1]!==`
|
|
507
507
|
`;)n--;let r=!1;for(let e=n;e<a;e++)if(t[e]===`>`){r=!0;break}let i=t.slice(a,o).split(`
|
|
508
508
|
`),s=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.trim().length===0)continue;if(r&&e>0)break;let n=t.replace(/^ {1,3}/,``);if(n[0]!==`>`){e>0&&t.trimStart()[0]!==`>`&&s.push(`lazy`);continue}if(n.slice(1).trimEnd()!==``)if(n[1]===` `)s.push(1);else{let e=0;for(;n[1+e]===` `;)e++;s.push(e)}}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`listItem`:{let n=t.slice(a,o),r=/^(?:([-+*])|(\d{1,9})[.)])( *)/.exec(n);if(!r)break;let s=r[1]?1:(r[2]?.length??0)+1,c=r[3].length;c>=2&&c<=4&&(e.data.sourceMarkerSpacing=c),r[2]&&(e.data.sourceOrdinal=Number.parseInt(r[2],10)),e.checked!=null&&/^\[([xX])\] /.exec(n.slice(s+Math.max(c,1)))?.[1]===`X`&&(e.data.sourceCheckboxChar=`X`);let l=s+(c>=2&&c<=4?c:1),u=a;for(;u>0&&t[u-1]!==`
|
|
@@ -516,9 +516,9 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
516
516
|
`).filter(e=>e.trim().length>0);if(t.length>=2){let n=t.map(e=>e.trimStart().startsWith(`|`)),r=t.map(e=>/(^|[^\\])\|$/.test(e.trimEnd())),i=n.every(e=>e===n[0]),a=r.every(e=>e===r[0]);if(i&&a){let t=n[0],i=r[0];(!t||!i)&&(e.data.sourceOuterPipes={leading:t,trailing:i})}}}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(`
|
|
517
517
|
`);a!==-1&&(i=i.slice(0,a));let o=D5(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(a,o)),e.type===`link`){let n=t[a];if(n!==`[`&&n!==`<`&&!e.title)e.data.sourceStyle=`gfm-autolink`;else if(n===`[`){let n=t.slice(a,o),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]===`
|
|
518
518
|
`);)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(a,o);if(e.data.sourceLayout=n.includes(`
|
|
519
|
-
`)?`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(a,o);break;case`break`:if(e.data.sourceRaw)break;t.slice(a,o).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}var
|
|
519
|
+
`)?`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(a,o);break;case`break`:if(e.data.sourceRaw)break;t.slice(a,o).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}var Yoe=`(^|\\s)#([a-zA-Z][\\w/-]*)`;function Xoe(){return new RegExp(Yoe,`g`)}var O5=Xoe(),Zoe=/^[a-zA-Z][\w/-]*$/;function Qoe(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 $oe(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;O5.lastIndex=0;let o=[],s=0;for(;;){let n=O5.exec(e);if(n===null)break;let c=n[1]??``,l=n[2]??``,u=n.index+c.length;if(t&&a>=0){let n=a,r=0,i=-1;for(;r<=u&&n<t.length;){let a=t[n]===`\\`&&n+1<t.length&&e[r]===t[n+1],o=a?n+1:n;if(r===u){i=o;break}n=a?n+2:n+1,r+=1}if(i>=0&&Qoe(t,i))continue}if(u>s){let n={type:`text`,value:e.slice(s,u)},r=l5(t,i,s,u);r&&(n.position=r),o.push(n)}let d={type:`tag`,value:l},f=l5(t,i,u,u+1+l.length);f&&(d.position=f),o.push(d),s=u+1+l.length,r=!0}if(o.length===0)n.push(i);else{if(s<e.length){let n={type:`text`,value:e.slice(s)},r=l5(t,i,s,e.length);r&&(n.position=r),o.push(n)}n.push(...o)}}r&&(e.children=n)}var ese=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 k5(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(`
|
|
520
520
|
`,i);if(e===-1)return null;i=e+1}let a=t.indexOf(`
|
|
521
|
-
`,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function ese(e,t){if(!e)return null;let n=k5(e.start,t),r=k5(e.end,t);return n===null||r===null||r<n?null:t.slice(n,r)}function tse(e,t){let n=ese(e.position,t);return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:n??``,unresolvedPosition:n===null,position:e.position}}function nse(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``,r=typeof process<`u`&&{}?.OK_DEBUG_POSITION_SLICE===`1`;TN(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!$oe.has(e.type)){let r=tse(e,n);return i.children[t]=r,SN}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(Goe(t,n),Qoe(t,n))}if(qoe(e,n,r,i),e.type===`heading`&&i!==void 0&&typeof t==`number`){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 rse(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function ise(){return e=>{TN(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=rse(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function ase(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}var ose=(e,t)=>{if(ase(e,t))return 0;let n=t.data?.sourcePrecedingBlankLines;if(typeof n==`number`&&n>=2)return n;let r=e.position,i=t.position;if(!r||!i)return;let a=i.start.line-r.end.line-1;return a>=1?a:void 0},A5=nG(),j5=hW(),M5=gW();function N5(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===A5)||t.push(A5);let n=e.fromMarkdownExtensions;n.some(e=>e===j5)||n.push(j5);let r=e.toMarkdownExtensions;r.some(e=>e===M5)||r.push(M5)}var P5=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function sse(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;TN(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;P5.lastIndex=0;let a=[],o;for(;(o=P5.exec(i))!==null;)a.push(o);if(a.length===0)return;let s=[],c=0;for(let t of a){let r=t.index,a=r+t[0].length;if(r>c){let t={type:`text`,value:i.slice(c,r)},a=l5(n,e,c,r);a&&(t.position=a),s.push(t)}let o={type:`inlineMath`,value:t[1]},l=l5(n,e,r,a);l&&(o.position=l),s.push(o),c=a}if(c<i.length){let t={type:`text`,value:i.slice(c)},r=l5(n,e,c,i.length);r&&(t.position=r),s.push(t)}return r.children.splice(t,1,...s),[SN,t+s.length]})}}var F5={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function cse(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===F5)||e.toMarkdownExtensions.push(F5)}var I5=/(?<!\uE102)<br[ \t]*\/?>/g,lse=new Set([`mdxJsxTextElement`,`mdxJsxFlowElement`]);function use(e,t){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value;I5.lastIndex=0;let a=[],o=0;for(;;){let n=I5.exec(e);if(n===null)break;let s=n.index;if(s>o){let n={type:`text`,value:e.slice(o,s)},r=l5(t,i,o,s);r&&(n.position=r),a.push(n)}let c={type:`break`,data:{sourceStyle:`html`,sourceRaw:n[0]}},l=l5(t,i,s,s+n[0].length);l&&(c.position=l),a.push(c),o=s+n[0].length,r=!0}if(a.length===0)n.push(i);else{if(o<e.length){let n={type:`text`,value:e.slice(o)},r=l5(t,i,o,e.length);r&&(n.position=r),a.push(n)}n.push(...a)}}r&&(e.children=n)}function L5(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;TN(e,e=>{if(lse.has(e.type))return SN;let t=e;Array.isArray(t.children)&&use(e,n)})}}var R5=33,z5=91,B5=93,V5=124,H5=35,dse={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===z5?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===z5?(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===z5?n(t):t===B5?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===H5?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===V5?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===z5?n(t):t===B5?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===V5?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===z5?n(t):t===B5?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===B5?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===B5?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},fse={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===R5?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===z5?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===z5?(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===z5?n(t):t===B5?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===H5?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===V5?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===z5?n(t):t===B5?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===V5?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===z5?n(t):t===B5?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===B5?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===B5?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function pse(){return{text:{[z5]:dse,[R5]:fse}}}function mse(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function hse(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function U5(e){return e.stack[e.stack.length-1]}function gse(e){let t=U5(this),n=this.sliceSerialize(e);t.data.target=n.trim(),n!==t.data.target&&(t.data.sourceTarget=n)}function _se(e){let t=U5(this),n=this.sliceSerialize(e),r=n.trim();t.data.anchor=r.length?r:null,t.data.anchor!==null&&n!==r&&(t.data.sourceAnchor=n)}function vse(e){let t=U5(this),n=this.sliceSerialize(e),r=n.trim();t.data.alias=r.length?r:null,t.data.alias!==null&&n!==r&&(t.data.sourceAlias=n)}function W5(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 yse(e){W5(U5(this)),this.exit(e)}function bse(e){W5(U5(this)),this.exit(e)}var G5={enter:{wikiLink:mse,wikiLinkEmbed:hse},exit:{wikiLinkTarget:gse,wikiLinkAnchor:_se,wikiLinkAlias:vse,wikiLink:yse,wikiLinkEmbed:bse}};function K5(e,t){return typeof e==`string`&&e.trim()===t?e:t}var q5={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${K5(t.data?.sourceTarget,n)}`;return r&&(a+=`#${K5(t.data?.sourceAnchor,r)}`),i&&(a+=`|${K5(t.data?.sourceAlias,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`]}]},J5=pse();function Y5(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===J5)||e.micromarkExtensions.push(J5),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===G5)||e.fromMarkdownExtensions.push(G5),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===q5)||e.toMarkdownExtensions.push(q5)}function xse(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}var Sse=[{name:`remark-parse`,plugin:hU},{name:`remark-mdx-agnostic`,plugin:N5},{name:`remark-gfm`,plugin:cV},{name:`remark-math`,plugin:AH,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:Y5},{name:`remark-github-alerts`,plugin:vH,options:goe},{name:`callout-transformer`,plugin:moe},{name:`restore-from-mdx`,plugin:G8},{name:`void-br-promoter`,plugin:L5},{name:`restore-entity-refs`,plugin:ioe},{name:`restore-backslash-escapes`,plugin:r5},{name:`details-accordion-promoter`,plugin:Poe},{name:`image-promoter`,plugin:Roe},{name:`indented-code-promoter`,plugin:Uoe},{name:`math-promoter`,plugin:Woe},{name:`single-dollar-math-promoter`,plugin:sse},{name:`highlight-promoter`,plugin:Loe},{name:`mermaid-promoter`,plugin:ise},{name:`comment-promoter`,plugin:voe},{name:`merged-post-parse-walker`,plugin:nse},{name:`ensure-non-empty-doc`,plugin:()=>xse}];function Cse(e){let t=_V();for(let e of Sse)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(UV,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function wse(e){let t=_V().use(mH,[`yaml`]).use(cV,{tablePipeAlign:!1}).use(AH,{singleDollarTextMath:!1}).use(N5).use(Y5).use(cse).use(lV,{bullet:`-`,fences:!0,rule:`-`,join:[ose],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function X5(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}var Z5=3,Q5=/^\n+$/,$5=/^\n{2,}$/;function e7(e,t,n){let r,i,a,o=e.children;if(o.length>0){let e=o[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);Q5.test(n)&&(r=n)}let n=o[o.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);$5.test(e)&&(i=e)}let s=[],c=!1;for(let e=1;e<o.length;e++){let n=o[e-1]?.position?.end?.offset,r=o[e]?.position?.start?.offset,i=null;if(typeof n==`number`&&typeof r==`number`&&r>=n){let e=t.slice(n,r);RegExp(`^\\n{${Z5},}$`).test(e)&&(i=e.length-1,c=!0)}s.push(i)}c&&(a=s)}if(!n&&r===void 0&&i===void 0&&!a)return;let s={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i},...a?{gapBlankLines:a}:{}};return e.data??={},e.data.sourceDocBoundary=s,s}function Tse(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&Q5.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&$5.test(t.trailing)&&(n.trailing=t.trailing),Array.isArray(t.gapBlankLines)&&t.gapBlankLines.every(e=>e===null||typeof e==`number`&&Number.isInteger(e)&&e>=Z5-1)&&(n.gapBlankLines=t.gapBlankLines),n.bom||n.leading||n.trailing||n.gapBlankLines?n:void 0}function Ese(e,t){let{source:n,hadBom:r}=X5(e),i=h5(n),a=new oM(Q8(U8(n5(i)))),o=t.parse(a);a.value=i;let s=t.runSync(o,a),c=e7(s,i,r),l=t.stringify(s);return c?l.type.create({...l.attrs,sourceDocBoundary:c},l.content,l.marks):l}function Dse(e,t){let{source:n,hadBom:r}=X5(e),i=h5(n),a=new oM(Q8(U8(n5(i)))),o=t.parse(a);a.value=i;let s=t.runSync(o,a);return e7(s,i,r),s}function Ose(e,t,n){let r=GV(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers}),i=Tse(e.attrs?.sourceDocBoundary),a=i?.gapBlankLines;if(a&&a.length===r.children.length-1)for(let e=1;e<r.children.length;e++){let t=a[e-1];if(typeof t==`number`){let n=r.children[e];n.data??={},n.data.sourcePrecedingBlankLines=t}}let o=String(t.stringify(r));return i?.leading&&(o=i.leading+o),i?.trailing&&(o=o.replace(/\n+$/,``)+i.trailing),i?.bom&&(o=`\uFEFF${o}`),o}function kse(){return!1}function Ase(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function jse(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 t7(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!c2(e))return e;let n=jse(Ase(t),e);return n===``||n===`..`||n.startsWith(`../`)?(kse()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}var Mse=Object.assign(Wse,{peek:()=>`$`}),Nse=Object.assign(Gse,{peek:()=>`~`}),Pse=(()=>{for(let e of M5.extensions??[]){let t=e?.handlers?.mdxJsxFlowElement;if(typeof t==`function`)return t}throw Error(`mdast-util-mdx-jsx mdxJsxFlowElement to-markdown handler not found — the dirty MDX JSX serialize path cannot bind. Likely a breaking change in mdast-util-mdx-jsx (pinned in the root overrides); re-run the markdown-pipeline upgrade protocol (test:fidelity).`)})(),Fse=/^[ \t]*(?:$|#{1,6}(?:[ \t]|[ \t]*$)|>|(?:[-+*]|\d{1,9}[.)])[ \t]|`{3,}|~{3,}|=+[ \t]*$|-+[ \t]*$|(?:\*[ \t]*){3,}$|(?:_[ \t]*){3,}$)/,Ise={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&W2(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+=o7(n,t.slice(o,e),{...r,before:r.before+a,after:`\\`})),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=o7(n,t.slice(o),{...r,before:r.before+a})),a}return o7(n,e.value??``,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+=l7(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),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+=l7(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),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}>`:a7(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(i7(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(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(a7(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`?`
|
|
521
|
+
`,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function tse(e,t){if(!e)return null;let n=k5(e.start,t),r=k5(e.end,t);return n===null||r===null||r<n?null:t.slice(n,r)}function nse(e,t){let n=tse(e.position,t);return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:n??``,unresolvedPosition:n===null,position:e.position}}function rse(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``,r=typeof process<`u`&&{}?.OK_DEBUG_POSITION_SLICE===`1`;TN(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!ese.has(e.type)){let r=nse(e,n);return i.children[t]=r,SN}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(Koe(t,n),$oe(t,n))}if(Joe(e,n,r,i),e.type===`heading`&&i!==void 0&&typeof t==`number`){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 ise(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function ase(){return e=>{TN(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=ise(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function ose(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}var sse=(e,t)=>{if(ose(e,t))return 0;let n=t.data?.sourcePrecedingBlankLines;if(typeof n==`number`&&n>=2)return n;let r=e.position,i=t.position;if(!r||!i)return;let a=i.start.line-r.end.line-1;return a>=1?a:void 0},A5=nG(),j5=hW(),M5=gW();function N5(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===A5)||t.push(A5);let n=e.fromMarkdownExtensions;n.some(e=>e===j5)||n.push(j5);let r=e.toMarkdownExtensions;r.some(e=>e===M5)||r.push(M5)}var P5=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function cse(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;TN(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;P5.lastIndex=0;let a=[],o;for(;(o=P5.exec(i))!==null;)a.push(o);if(a.length===0)return;let s=[],c=0;for(let t of a){let r=t.index,a=r+t[0].length;if(r>c){let t={type:`text`,value:i.slice(c,r)},a=l5(n,e,c,r);a&&(t.position=a),s.push(t)}let o={type:`inlineMath`,value:t[1]},l=l5(n,e,r,a);l&&(o.position=l),s.push(o),c=a}if(c<i.length){let t={type:`text`,value:i.slice(c)},r=l5(n,e,c,i.length);r&&(t.position=r),s.push(t)}return r.children.splice(t,1,...s),[SN,t+s.length]})}}var F5={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function lse(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===F5)||e.toMarkdownExtensions.push(F5)}var I5=/(?<!\uE102)<br[ \t]*\/?>/g,use=new Set([`mdxJsxTextElement`,`mdxJsxFlowElement`]);function dse(e,t){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value;I5.lastIndex=0;let a=[],o=0;for(;;){let n=I5.exec(e);if(n===null)break;let s=n.index;if(s>o){let n={type:`text`,value:e.slice(o,s)},r=l5(t,i,o,s);r&&(n.position=r),a.push(n)}let c={type:`break`,data:{sourceStyle:`html`,sourceRaw:n[0]}},l=l5(t,i,s,s+n[0].length);l&&(c.position=l),a.push(c),o=s+n[0].length,r=!0}if(a.length===0)n.push(i);else{if(o<e.length){let n={type:`text`,value:e.slice(o)},r=l5(t,i,o,e.length);r&&(n.position=r),a.push(n)}n.push(...a)}}r&&(e.children=n)}function L5(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;TN(e,e=>{if(use.has(e.type))return SN;let t=e;Array.isArray(t.children)&&dse(e,n)})}}var R5=33,z5=91,B5=93,V5=124,H5=35,fse={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===z5?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===z5?(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===z5?n(t):t===B5?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===H5?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===V5?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===z5?n(t):t===B5?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===V5?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===z5?n(t):t===B5?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===B5?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===B5?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},pse={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===R5?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===z5?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===z5?(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===z5?n(t):t===B5?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===H5?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===V5?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===z5?n(t):t===B5?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===V5?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===z5?n(t):t===B5?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===B5?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===B5?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function mse(){return{text:{[z5]:fse,[R5]:pse}}}function hse(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function gse(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function U5(e){return e.stack[e.stack.length-1]}function _se(e){let t=U5(this),n=this.sliceSerialize(e);t.data.target=n.trim(),n!==t.data.target&&(t.data.sourceTarget=n)}function vse(e){let t=U5(this),n=this.sliceSerialize(e),r=n.trim();t.data.anchor=r.length?r:null,t.data.anchor!==null&&n!==r&&(t.data.sourceAnchor=n)}function yse(e){let t=U5(this),n=this.sliceSerialize(e),r=n.trim();t.data.alias=r.length?r:null,t.data.alias!==null&&n!==r&&(t.data.sourceAlias=n)}function W5(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 bse(e){W5(U5(this)),this.exit(e)}function xse(e){W5(U5(this)),this.exit(e)}var G5={enter:{wikiLink:hse,wikiLinkEmbed:gse},exit:{wikiLinkTarget:_se,wikiLinkAnchor:vse,wikiLinkAlias:yse,wikiLink:bse,wikiLinkEmbed:xse}};function K5(e,t){return typeof e==`string`&&e.trim()===t?e:t}var q5={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${K5(t.data?.sourceTarget,n)}`;return r&&(a+=`#${K5(t.data?.sourceAnchor,r)}`),i&&(a+=`|${K5(t.data?.sourceAlias,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`]}]},J5=mse();function Y5(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===J5)||e.micromarkExtensions.push(J5),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===G5)||e.fromMarkdownExtensions.push(G5),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===q5)||e.toMarkdownExtensions.push(q5)}function Sse(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}var Cse=[{name:`remark-parse`,plugin:hU},{name:`remark-mdx-agnostic`,plugin:N5},{name:`remark-gfm`,plugin:cV},{name:`remark-math`,plugin:AH,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:Y5},{name:`remark-github-alerts`,plugin:vH,options:_oe},{name:`callout-transformer`,plugin:hoe},{name:`restore-from-mdx`,plugin:G8},{name:`void-br-promoter`,plugin:L5},{name:`restore-entity-refs`,plugin:aoe},{name:`restore-backslash-escapes`,plugin:r5},{name:`details-accordion-promoter`,plugin:Foe},{name:`image-promoter`,plugin:zoe},{name:`indented-code-promoter`,plugin:Woe},{name:`math-promoter`,plugin:Goe},{name:`single-dollar-math-promoter`,plugin:cse},{name:`highlight-promoter`,plugin:Roe},{name:`mermaid-promoter`,plugin:ase},{name:`comment-promoter`,plugin:yoe},{name:`merged-post-parse-walker`,plugin:rse},{name:`ensure-non-empty-doc`,plugin:()=>Sse}];function wse(e){let t=_V();for(let e of Cse)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(UV,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function Tse(e){let t=_V().use(mH,[`yaml`]).use(cV,{tablePipeAlign:!1}).use(AH,{singleDollarTextMath:!1}).use(N5).use(Y5).use(lse).use(lV,{bullet:`-`,fences:!0,rule:`-`,join:[sse],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function X5(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}var Z5=3,Q5=/^\n+$/,$5=/^\n{2,}$/;function e7(e,t,n){let r,i,a,o=e.children;if(o.length>0){let e=o[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);Q5.test(n)&&(r=n)}let n=o[o.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);$5.test(e)&&(i=e)}let s=[],c=!1;for(let e=1;e<o.length;e++){let n=o[e-1]?.position?.end?.offset,r=o[e]?.position?.start?.offset,i=null;if(typeof n==`number`&&typeof r==`number`&&r>=n){let e=t.slice(n,r);RegExp(`^\\n{${Z5},}$`).test(e)&&(i=e.length-1,c=!0)}s.push(i)}c&&(a=s)}if(!n&&r===void 0&&i===void 0&&!a)return;let s={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i},...a?{gapBlankLines:a}:{}};return e.data??={},e.data.sourceDocBoundary=s,s}function Ese(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&Q5.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&$5.test(t.trailing)&&(n.trailing=t.trailing),Array.isArray(t.gapBlankLines)&&t.gapBlankLines.every(e=>e===null||typeof e==`number`&&Number.isInteger(e)&&e>=Z5-1)&&(n.gapBlankLines=t.gapBlankLines),n.bom||n.leading||n.trailing||n.gapBlankLines?n:void 0}function Dse(e,t){let{source:n,hadBom:r}=X5(e),i=h5(n),a=new oM(Q8(U8(n5(i)))),o=t.parse(a);a.value=i;let s=t.runSync(o,a),c=e7(s,i,r),l=t.stringify(s);return c?l.type.create({...l.attrs,sourceDocBoundary:c},l.content,l.marks):l}function Ose(e,t){let{source:n,hadBom:r}=X5(e),i=h5(n),a=new oM(Q8(U8(n5(i)))),o=t.parse(a);a.value=i;let s=t.runSync(o,a);return e7(s,i,r),s}function kse(e,t,n){let r=GV(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers}),i=Ese(e.attrs?.sourceDocBoundary),a=i?.gapBlankLines;if(a&&a.length===r.children.length-1)for(let e=1;e<r.children.length;e++){let t=a[e-1];if(typeof t==`number`){let n=r.children[e];n.data??={},n.data.sourcePrecedingBlankLines=t}}let o=String(t.stringify(r));return i?.leading&&(o=i.leading+o),i?.trailing&&(o=o.replace(/\n+$/,``)+i.trailing),i?.bom&&(o=`\uFEFF${o}`),o}function Ase(){return!1}function jse(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function Mse(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 t7(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!l2(e))return e;let n=Mse(jse(t),e);return n===``||n===`..`||n.startsWith(`../`)?(Ase()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}var Nse=Object.assign(Gse,{peek:()=>`$`}),Pse=Object.assign(Kse,{peek:()=>`~`}),Fse=(()=>{for(let e of M5.extensions??[]){let t=e?.handlers?.mdxJsxFlowElement;if(typeof t==`function`)return t}throw Error(`mdast-util-mdx-jsx mdxJsxFlowElement to-markdown handler not found — the dirty MDX JSX serialize path cannot bind. Likely a breaking change in mdast-util-mdx-jsx (pinned in the root overrides); re-run the markdown-pipeline upgrade protocol (test:fidelity).`)})(),Ise=/^[ \t]*(?:$|#{1,6}(?:[ \t]|[ \t]*$)|>|(?:[-+*]|\d{1,9}[.)])[ \t]|`{3,}|~{3,}|=+[ \t]*$|-+[ \t]*$|(?:\*[ \t]*){3,}$|(?:_[ \t]*){3,}$)/,Lse={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&G2(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+=o7(n,t.slice(o,e),{...r,before:r.before+a,after:`\\`})),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=o7(n,t.slice(o),{...r,before:r.before+a})),a}return o7(n,e.value??``,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+=l7(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),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+=l7(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),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}>`:a7(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(i7(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(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(a7(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`?`
|
|
522
522
|
`:` `;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(a7(d)),e()}if(e.title){let t=i===`multiline`?`
|
|
523
523
|
`:` `;l+=s.move(i7(e.title,a,t))}return o(),l},thematicBreak(e){return e.data?.sourceRaw??`---`},break(e,t,n){let r=e.data?.sourceRaw;return typeof r==`string`&&r.length>0?r:n.stack.includes(`tableCell`)||n.stack.includes(`okAtxHeading`)?`<br />`:e.data?.sourceStyle===`backslash`?`\\
|
|
524
524
|
`:`
|
|
@@ -528,7 +528,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
528
528
|
`)}let n=e.data?.sourceFenceChar===`~`?`~`:"`",r=Math.max(3,e.data?.sourceFenceLength??3),i=RegExp(`^ {0,3}(\\${n}+)[ \\t]*$`);for(let e of t.split(`
|
|
529
529
|
`)){let t=i.exec(e);t&&t[1].length>=r&&(r=t[1].length+1)}let a=e.data?.sourceClosingFenceLength,o=typeof a==`number`&&a>r?a:r,s=e.data?.sourceFenceIndent,c=typeof s==`number`&&s>=1&&s<=3?` `.repeat(s):``,l=e.data?.sourceInfoPadding,u=n.repeat(r),d=e.lang??``,f=`${u}${d&&typeof l==`number`&&l>=1?` `.repeat(l):``}${d}${e.meta?` ${e.meta}`:``}\n${t}\n${n.repeat(o)}`;return c?f.split(`
|
|
530
530
|
`).map(e=>e.length>0?`${c}${e}`:e).join(`
|
|
531
|
-
`):f},inlineCode(e,t,n){let r=e.value??``,i=e.data?.sourceFenceChar===`~`?`~`:"`",a=typeof e.data?.sourceFenceLength==`number`&&e.data.sourceFenceLength>0?e.data.sourceFenceLength:1,o=i==="`"?"`":`~`,s=a;for(;RegExp(`(^|[^${o}])${o.repeat(s)}([^${o}]|$)`).test(r);)s+=1;let c=i.repeat(s);/[^ \r\n]/.test(r)&&(e.data?.sourcePadded===!0||/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||r.startsWith(i)||r.endsWith(i))&&(r=` ${r} `);let l=`${c}${r}${c}`;return n.stack.includes(`tableCell`)?l.replace(/\|/g,`\\$&`):l},inlineMath:
|
|
531
|
+
`):f},inlineCode(e,t,n){let r=e.value??``,i=e.data?.sourceFenceChar===`~`?`~`:"`",a=typeof e.data?.sourceFenceLength==`number`&&e.data.sourceFenceLength>0?e.data.sourceFenceLength:1,o=i==="`"?"`":`~`,s=a;for(;RegExp(`(^|[^${o}])${o.repeat(s)}([^${o}]|$)`).test(r);)s+=1;let c=i.repeat(s);/[^ \r\n]/.test(r)&&(e.data?.sourcePadded===!0||/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||r.startsWith(i)||r.endsWith(i))&&(r=` ${r} `);let l=`${c}${r}${c}`;return n.stack.includes(`tableCell`)?l.replace(/\|/g,`\\$&`):l},inlineMath:Nse,delete:Pse,heading(e,t,n,r){let i=e.data?.sourceStyle??`atx`,a=e.depth;if(i===`setext`&&(a===1||a===2)){let t=n.containerPhrasing(e,{...r,before:`
|
|
532
532
|
`,after:`
|
|
533
533
|
`}),i=e.data?.sourceUnderlineLength,o=typeof i==`number`&&i>=1?i:Math.max(t.length,3);return`${t}\n${(a===1?`=`:`-`).repeat(o)}`}let o=e.data?.sourceLeadingIndent,s=typeof o==`number`&&o>=1&&o<=3?` `.repeat(o):``,c=e.data?.sourceInteriorSpacing,l=typeof c==`number`&&c>=2?` `.repeat(c):` `,u=`#`.repeat(a),d=n.enter(`okAtxHeading`),f=n.containerPhrasing(e,{...r,before:`${u} `,after:`
|
|
534
534
|
`});d();let p=e.data?.sourceTrailingHashes;if(typeof p==`number`&&p>0){let e=`#`.repeat(p);return f?`${s}${u}${l}${f} ${e}`:`${s}${u} ${e}`}return f?`${s}${u}${l}${f}`:`${s}${u}`},list(e,t,n,r){let i=n.options.bullet||`-`,a=!!e.ordered,o=n.bulletCurrent,s=n.bulletLastUsed;if(!a){let t=e.data?.bulletMarker;(t===`-`||t===`*`||t===`+`)&&(n.bulletCurrent=t)}let c=e.children||[],l=[],u=a?e.data?.listMarkerDelimiter??`.`:null,d=e.start??1;for(let t=0;t<c.length;t++){let o=c[t],s=o.data?.sourceOrdinal,f=typeof s==`number`&&s>=0?s:d+t,p=a?`${f}${u}`:e.data?.bulletMarker??i,m=o.data?.sourceMarkerSpacing,h=typeof m==`number`&&m>=2&&m<=4?m:1,g=` `.repeat(h),_=p;o.checked===!0?_+=`${g}[${o.data?.sourceCheckboxChar===`X`?`X`:`x`}]`:o.checked===!1&&(_+=`${g}[ ]`);let v=o.data?.sourceContinuationIndent,y=p.length+h,b=typeof v==`number`&&v>=y&&v<=y+3?v:y,x=` `.repeat(b),S=o.checked===null||o.checked===void 0?g:` `,C=o.children??[],w=C[0]?.type===`list`,T;if(w){let e=o.checked!==null&&o.checked!==void 0,t=n.containerFlow({...o,children:[C[0]]},r),i=C.slice(1),a=i.length?n.containerFlow({...o,children:i},r):``,s=t.split(`
|
|
@@ -542,8 +542,8 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
542
542
|
|
|
543
543
|
`:`
|
|
544
544
|
`;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=[],s=e.children??[];for(let e of s){let t=e.children??[],i=[],s=[];for(let e of t){let t=n.enter(`tableCell`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:` `,after:` `});a(),t(),i.push(o);let c=e.data?.sourcePadding;s.push(c&&typeof c.left==`number`&&typeof c.right==`number`?{left:c.left,right:c.right}:null)}a.push(i),o.push(s)}i();let c=e.align??[],l=e.data?.sourceDashCounts,u=a[0]?.length??0,d=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),f=Math.max(u,d,c.length);if(f===0)return console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:s.length})),``;let p=[];for(let e=0;e<f;e++){let t=c[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=l?.[e],a=typeof i==`number`&&i>=1?i:1;p.push(n+`-`.repeat(a)+r)}let m=(e,t)=>{let n=[];for(let r=0;r<f;r++){let i=e[r]??``,a=t[r]??{left:1,right:1};n.push(` `.repeat(a.left)+i+` `.repeat(a.right))}let r=v&&!v.leading?``:`|`,i=v&&!v.trailing?``:`|`;return`${r}${n.join(`|`)}${i}`},h=e.data?.sourceAlignmentPadding,g=Array.from({length:f},(e,t)=>{let n=h?.[t];return n&&typeof n.left==`number`&&typeof n.right==`number`?n:null}),_=e.data?.sourceOuterPipes,v=_&&f>=2&&a.every(e=>{let t=(e[0]??``).trim(),n=(e[f-1]??``).trim();return(_.leading||t.length>0)&&(_.trailing||n.length>0&&!n.endsWith(`\\`))})?_:null;if(a.length===0)return m(p,g);let y=[];y.push(m(a[0],o[0]??[])),y.push(m(p,g));for(let e=1;e<a.length;e++)y.push(m(a[e],o[e]??[]));return y.join(`
|
|
545
|
-
`)},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=n7(i.attributes??[]);return!i.children||i.children.length===0?s?c?`<${s} ${c} />`:`<${s} />`:``:
|
|
546
|
-
]|$)`};return delete t._compiled,t});let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return
|
|
547
|
-
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function Use(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&Hse(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=Vse(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function l7(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);u7(i.charCodeAt(i.length-1),s,r)&&(o=d7(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return u7(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+d7(c)),o}function u7(e,t,n){return!(ZI(t)!==s7||n===`_`&&ZI(e)===void 0)}function d7(e){return`&#x${e.toString(16).toUpperCase()};`}function Wse(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!Kse(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function Gse(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=l7(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function Kse(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function f7(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 qse=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=Jy(e.extensions),this.handlers=$se(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?Zie({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=ece(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=Cse({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=wse({toMarkdownHandlers:Ise})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return Ese(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?Dse(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?Lae(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return Ose(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}},p7=v8();function Jse(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 Yse(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 Xse(e,t){return e.attrs.sourceDirty||Yse(e)?!0:t?t.isDiverged(e.toJSON()):!1}function Zse(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 m7(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function h7(e,t){if(e.length===0)return m7({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return m7({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:[h7(n.children,t)]}}return m7({type:`inlineCode`,value:g7(e)},t)}function g7(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=g7(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}var Qse=qc;function $se(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=BV(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=BV(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=t7(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&H2(t.raw)!==null&&z2(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=H2(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=VV(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=VV(r.highlight)),r.comment&&(i.comment=VV(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=BV(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=VV(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=VV(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=BV(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=BV(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=BV(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=p7.getOrWildcard(o),c=Jse(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=t7(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=a4(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&&Qse.has(l)&&n.jsxComponent&&p7.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&&Jc.has(l)&&n.jsxComponent&&p7.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&&Xc.has(l)&&n.jsxComponent&&p7.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&&Zc.has(l)&&n.jsxComponent&&p7.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:f7(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=BV(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 ece(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=KV(`paragraph`)),i.blockquote&&(n.blockquote=KV(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=KV(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=KV(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&Zse(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=KV(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:j6(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!Xse(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:p7.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:p7,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=qV(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=qV(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return h7(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=qV(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=qV(`mark`)),a.comment&&(r.comment=qV(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=KV(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=KV(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return W2(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}var _7={default:!0,MD013:!1};function v7(e){return e??_7}var y7=`doc`;function tce(e,t){return rY(e,eY({strings:{[y7]:e},config:t})[y7]??[])}function nce(e,t){let n=eY({strings:{[y7]:e},config:t})[y7]??[],r=e.split(`
|
|
548
|
-
`),i=rce(t);return n.map(e=>ace(e,r,ice(e,i)))}function rce(e){let t=new Map;return Object.entries(e).forEach(([e,n],r)=>{let i=e.toUpperCase();if(i===`DEFAULT`)return;let a=null;if(n===`error`||n===`warning`)a=n;else if(typeof n==`object`&&n&&!Array.isArray(n)){let e=n.severity;(e===`error`||e===`warning`)&&(a=e)}a!==null&&t.set(i,{entryIndex:r,severity:a})}),t}function ice(e,t){let n;for(let r of e.ruleNames){let e=t.get(r.toUpperCase());e!==void 0&&(n===void 0||e.entryIndex>n.entryIndex)&&(n=e)}return n?.severity??`warning`}function ace(e,t,n){let[r,i]=e.errorRange??[1,null],a=e.lineNumber-1,o=(r??1)-1,s=t[a]?.length??0,c=i==null?s:Math.min(o+i,s),l=e.fixInfo?[oce(e.fixInfo,e.lineNumber,t)]:void 0;return{range:{start:{line:a,character:o},end:{line:a,character:Math.max(c,o)}},severity:n,source:`markdownlint`,code:e.ruleNames[0]??`MD000`,message:e.errorDetail?`${e.ruleDescription}: ${e.errorDetail}`:e.ruleDescription,...l?{fixes:l}:{}}}function oce(e,t,n){let r=e.lineNumber??t,i=r-1;if(e.deleteCount===-1){if(r<n.length)return{range:{start:{line:i,character:0},end:{line:i+1,character:0}},newText:``};if(i>0){let e=n[i-1]?.length??0;return{range:{start:{line:i-1,character:e},end:{line:i,character:n[i]?.length??0}},newText:``}}return{range:{start:{line:0,character:0},end:{line:0,character:n[0]?.length??0}},newText:``}}let a=(e.editColumn??1)-1;return{range:{start:{line:i,character:a},end:{line:i,character:a+Math.max(0,e.deleteCount??0)}},newText:e.insertText??``}}var sce=lc([j(),P([`error`,`warning`]),dc(k(),ac())]),b7=[{id:`markdownlint`,sliceSchema:N({enabled:j(),rules:dc(k(),sce)}),defaultSlice:{enabled:!1,rules:_7},async lint(e,t){return nce(e,v7(t.rules))},fix(e,t){return tce(e,v7(t.rules))}}],cce={enabled:!0,plugins:Object.fromEntries(b7.map(e=>[e.id,e.defaultSlice]))};function lce(e){return{enabled:e.enabled??!0,plugins:{markdownlint:{...e.markdownlint,rules:e.markdownlint.rules??_7}}}}var uce=Object.fromEntries(b7.map(e=>[e.id,e.sliceSchema])),dce=N({effective:N({enabled:j(),plugins:N(uce)}),configFile:k().nullable().optional(),configProblems:M(k()).optional()}),fce=lc([j(),dc(k(),ac())]);N({ruleId:k().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:lc([fce,ic()])});var x7=N({line:A(),character:A()}),S7=N({start:x7,end:x7}),C7=N({range:S7,severity:P([`error`,`warning`,`info`,`hint`]),source:k(),code:k(),message:k(),fixes:M(N({range:S7,newText:k()})).optional()}),pce=N({files:M(N({file:k(),diagnostics:M(C7)})),fileCount:A(),errorCount:A(),warningCount:A(),warnings:M(k())});N({docName:_3,summary:y3,...v3}).loose(),N({file:k(),fixedCount:A(),diagnostics:M(C7),errorCount:A(),warningCount:A(),warning:k().optional()});var w7=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}],mce=(()=>{let e=new Map;for(let t of w7){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();function T7(e){return mce.get(e.toUpperCase())??null}function hce(e,t){let n=T7(t);if(n===null)return;let r;for(let[t,i]of Object.entries(e))T7(t)===n&&(r={key:t,value:i});return r}var gce=[`Headings`,`Lists`,`Whitespace`,`Code`,`Links & images`,`Style`],_ce=[[`headings`,`Headings`],[`bullet`,`Lists`],[`ul`,`Lists`],[`ol`,`Lists`],[`links`,`Links & images`],[`images`,`Links & images`],[`accessibility`,`Links & images`],[`code`,`Code`],[`language`,`Code`],[`emphasis`,`Style`],[`html`,`Style`],[`line_length`,`Whitespace`],[`whitespace`,`Whitespace`],[`hard_tab`,`Whitespace`],[`blank_lines`,`Whitespace`],[`indentation`,`Whitespace`]];function vce(e){for(let[t,n]of _ce)if(e.tags.includes(t))return n;return`Style`}async function yce(e,t,n){if(!t.enabled)return[];let r=[];for(let i of b7){let a=t.plugins[i.id];a.enabled&&r.push(...await i.lint(e,a,{docName:n}))}return r}var bce=/\p{M}+/gu,xce=/[^\p{L}\p{N}]+/gu,Sce=/^-+|-+$/g;function E7(e){return e.trim().normalize(`NFKD`).replace(bce,``).toLowerCase().replace(xce,`-`).replace(Sce,``)}function Cce(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function wce(e,t){let n=E7(e);return n?Cce(n,t):``}function D7(e,t){let n=E7(e);return t?`#${n}-${E7(t)}`:`#${n}`}var O7=new Set([`img`,`video`,`audio`,`mark`]),Tce=new Map(_8.flatMap(e=>e.surface===`compat`&&O7.has(e.rendersAs)?[[e.name,e]]:[]));function k7(e){let t={};for(let n of e.attributes){if(n.type!==`mdxJsxAttribute`)return null;let e=n.name.toLowerCase();if(!(e.length>=3&&e.startsWith(`on`)))if(n.value===null)t[n.name]=!0;else if(typeof n.value==`string`)t[n.name]=n.value;else return null}return t}function A7(e){let t=e.name;if(!t||!O7.has(t))return null;let n=k7(e);return n===null?null:{type:`element`,tagName:t,properties:n,children:[]}}function j7(e){let t=e.name;if(!t)return null;let n=Tce.get(t);if(!n)return null;let r=k7(e);if(r===null)return null;let i=n.translateProps(r),a={};for(let[e,t]of Object.entries(i))(typeof t==`string`||typeof t==`boolean`)&&(a[e]=t);return{type:`element`,tagName:n.rendersAs,properties:a,children:[]}}var Ece=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-link`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:D7(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},Dce=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-embed`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:D7(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},Oce=(e,t)=>{let n=t,r=A7(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=j7(n);if(i){e.patch(t,i);let n=e.applyData(t,i);return n.tagName===`img`?{type:`element`,tagName:`p`,properties:{},children:[n]}:n}let a={type:`element`,tagName:`pre`,properties:{className:[`mdx-component`]},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]}]};return e.patch(t,a),e.applyData(t,a)},kce=(e,t)=>{let n=t,r=A7(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=j7(n);if(i)return e.patch(t,i),e.applyData(t,i);let a={type:`element`,tagName:`span`,properties:{className:[`mdx-inline`],dataJsxInline:``},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]};return e.patch(t,a),e.applyData(t,a)},Ace=(e,t)=>{let n=t,r=n.data.reason||`unknown`,i=n.value||``,a=r.replace(/--/g,`—`),o={type:`comment`,value:` Parse error: ${a} `},s={type:`element`,tagName:`pre`,properties:{className:[`mdx-fallback`],dataRawMdxFallback:``,dataReason:a},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:i}]}]};return e.patch(t,s),[o,e.applyData(t,s)]},jce=(e,t)=>{let n={type:`element`,tagName:`mark`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)};function M7(e){if(typeof e!=`object`||!e)return``;let t=e;return typeof t.value==`string`?t.value:Array.isArray(t.children)?t.children.map(M7).join(``):``}var N7={wikiLink:Ece,wikiLinkEmbed:Dce,mdxJsxFlowElement:Oce,mdxJsxTextElement:kce,rawMdxFallback:Ace,mark:jce,tag:(e,t)=>{let n=t.value,r={type:`element`,tagName:`a`,properties:{className:[`tag`],dataTag:n,href:`#tag/${n}`},children:[{type:`text`,value:`#${n}`}]};return e.patch(t,r),e.applyData(t,r)},comment:(e,t)=>{let n={type:`comment`,value:M7(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},commentBlock:(e,t)=>{let n={type:`comment`,value:M7(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`sup`,properties:{id:`fnref-${n}`,dataFootnoteRef:``,dataFootnoteId:n,className:[`footnote-ref`]},children:[{type:`element`,tagName:`a`,properties:{href:`#fn-${n}`,className:[`footnote-ref-link`]},children:[{type:`text`,value:`[${n}]`}]}]};return e.patch(t,r),e.applyData(t,r)},footnoteDefinition:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`aside`,properties:{id:`fn-${n}`,dataFootnoteDef:``,dataFootnoteId:n,className:[`footnote-def`]},children:[{type:`element`,tagName:`div`,properties:{className:[`footnote-body`]},children:e.all(t)},{type:`element`,tagName:`a`,properties:{href:`#fnref-${n}`,className:[`footnote-backref`],ariaLabel:`Back to reference`},children:[{type:`text`,value:`↩`}]}]};return e.patch(t,r),e.applyData(t,r)}},Mce=/url\s*\(\s*['"]?\s*(?:javascript|vbscript|data)\s*:/i,Nce=/\bexpression\s*\(/i,Pce=1e4;function Fce(e){return!(e.length>Pce||Mce.test(e)||Nce.test(e))}function P7(e){for(let t of e.split(`,`)){let e=t.trim();if(e!==``&&!s2(e.split(/\s+/)[0]??``))return!1}return!0}var Ice={a:[`href`,`title`],img:[`src`,`alt`,`title`],video:[`src`,`title`],audio:[`src`,`title`],code:[`className`]},Lce=new Set([`href`,`src`]),Rce=QR(`<>`),F7=()=>e=>{TN(e,`element`,e=>{let t=Ice[e.tagName.toLowerCase()],n=e.properties;if(!(!t||!n))for(let e of t){let t=n[e];if(Array.isArray(t)){let r=t.map(e=>typeof e==`string`?Z8(e):e);r.some((e,n)=>e!==t[n])&&(n[e]=r);continue}if(typeof t!=`string`)continue;let r;if(Lce.has(e))if(t===`<>`||t===Rce)r=``;else{let e=Z8(t);r=e===t?t:QR(e)}else r=Z8(t);r!==t&&(n[e]=r)}})},I7=()=>e=>{TN(e,`element`,e=>{let t=e.tagName.toLowerCase(),n=e.properties;if(!n)return;if(t===`a`||t===`area`||t===`link`||t===`base`){let e=n.href;typeof e==`string`&&!s2(e)&&delete n.href}if(t===`img`||t===`iframe`||t===`script`||t===`embed`||t===`source`||t===`audio`||t===`video`||t===`track`){let e=n.src;typeof e==`string`&&!s2(e)&&delete n.src}if(t===`form`){let e=n.action;typeof e==`string`&&!s2(e)&&delete n.action}if(t===`img`||t===`source`){let e=n.srcSet;typeof e==`string`&&!P7(e)&&delete n.srcSet;let t=n.srcset;typeof t==`string`&&!P7(t)&&delete n.srcset}if(t===`video`){let e=n.poster;typeof e==`string`&&!s2(e)&&delete n.poster}let r=n.style;typeof r==`string`&&!Fce(r)&&delete n.style})};function zce(e){let t=_V().use(HX,{handlers:N7}).use(F7).use(I7).use(tX),n=t.runSync(e);return String(t.stringify(n))}function Bce(e){let t=/\r?\n|\r/g,n=[],r=0,i=t.exec(e);for(;i!==null;)n.push(L7(e.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=t.exec(e);return n.push(L7(e.slice(r),r>0,!1)),n.join(``)}function L7(e,t,n){let r=0,i=e.length,a=e=>e===9||e===32;for(;t&&r<i&&a(e.charCodeAt(r));)r++;for(;n&&i>r&&a(e.charCodeAt(i-1));)i--;return i>r?e.slice(r,i):``}var R7=/\r?\n|\r/,Vce=(e,t)=>{let n=Bce(String(t.value));if(!R7.test(n)){let r={type:`text`,value:n};return e.patch(t,r),e.applyData(t,r)}let r=n.split(R7),i=[];for(let e=0;e<r.length;e++)e>0&&i.push({type:`element`,tagName:`br`,properties:{},children:[]}),r[e].length>0&&i.push({type:`text`,value:r[e]});return i};function Hce(e){let t=_V().use(hU).use(mH,[`yaml`]).use(N5).use(cV).use(Y5).use(G8).use(L5).use(r5).use(HX,{handlers:{...N7,text:Vce}}).use(F7).use(I7).use(tX);return String(t.processSync(U8(n5(e))))}nG(),hW(),gW();var z7=`frontmatter`,B7=[`text`,`number`,`boolean`,`date`,`list`,`object`];P(B7);var Uce=lc([k(),A(),j()]),V7=Pc(()=>lc([Uce.transform(e=>String(e)),dc(k(),H7),M(V7)])),H7=Pc(()=>lc([k(),A(),j(),M(V7),dc(k(),H7)])),Wce=/^\d{4}-\d{2}-\d{2}$/;function Gce(e){return typeof e==`string`&&Wce.test(e)}function Kce(e){return Array.isArray(e)?`list`:typeof e==`object`&&e?`object`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:Gce(e)?`date`:`text`}function U7(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(U7(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:U7(r);return t}return e}var W7=zc(U7,dc(k(),H7)),qce=dc(k(),lc([H7,ic()]));function Jce(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}function G7(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!G7(e[n],t[n]))return!1;return!0}if(e!==null&&t!==null&&typeof e==`object`&&typeof t==`object`&&!Array.isArray(e)&&!Array.isArray(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.hasOwn(t,r)||!G7(e[r],t[r]))return!1;return!0}return!1}N({docName:_3,summary:y3,content:k().optional(),...v3}).loose(),N({docName:_3,summary:y3,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P(S0).optional(),...v3}).loose(),N({docName:_3,summary:y3,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...v3}).loose(),N({docName:_3,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...v3}).loose();var K7=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),Yce=uc(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),q7=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:Yce.optional(),hint:k().optional()}).loose(),Xce=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),J7=N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),mergeOutcome:k().optional(),hint:k().optional()}).loose(),Y7=uc(`kind`,[q7,J7]),X7=M(uc(`kind`,[q7,J7,N({kind:F(`mermaid-parse-error`),fenceIndex:A().int().positive(),fenceFirstLine:k(),message:k(),line:A().int().positive().optional()}).loose(),N({kind:F(`lint-violation`),source:k(),code:k(),message:k(),severity:P([`error`,`warning`,`info`,`hint`]),line:A().int().positive(),column:A().int().positive()}).loose()])).min(1),Z7=M(N({href:k(),resolvedTo:k().nullable(),reason:P([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose());N({timestamp:k().min(1),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional()}).loose(),N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(Xce).optional(),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional(),brokenLinks:Z7}).loose(),N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional(),brokenLinks:Z7}).loose(),N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),N({docName:_3,patch:dc(k(),lc([H7,ic()])),types:dc(k(),P(B7)).optional(),summary:y3,...v3}).loose(),N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional(),brokenLinks:Z7}).loose(),N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(N1),event:k().optional(),fields:dc(k(),ac()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),N({accepted:A().int().min(0)}).loose();var Zce=N({status:k().min(1),reason:k()}).loose(),Qce=N({docName:k().min(1),content:k(),lifecycle:Zce.nullable()}).loose(),Q7=N({kind:P([`document`,`asset`,`folder`,`file`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:j().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:P([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:M(k().min(1)).optional(),hasChildren:j().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`}),$ce=N({documents:M(Q7),truncated:j().optional()}).loose(),ele=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),tle=N({docName:k().min(1),backlinks:M(ele)}).loose(),nle=N({counts:dc(k().min(1),A().int().nonnegative())}).loose(),rle=uc(`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()]),ile=N({docName:k().min(1),forwardLinks:M(rle)}).loose(),ale=uc(`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()]),ole=N({source:k().min(1),target:k().min(1)}).loose(),sle=N({nodes:M(ale),links:M(ole)}).loose(),cle=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(),lle=N({app:lc([F(`cursor`),F(`codex`),F(`claude`),ic()]),signals_fired:M(k())}).loose();N({entries:M(cle),count:A().int().min(0),detection:lle}).loose(),N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:y3,...v3}).loose(),N({checkpointRef:k().min(1)}).loose();var ule=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose();N({entries:M(N({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:P([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:M(ule),checkpoint:ac().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional(),hasMore:j().optional()}).loose(),N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose();var dle=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose();M(uc(`source`,[N({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:F(`flat`)}).loose(),N({docName:k().min(1),timestamp:k().min(1),source:F(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});var fle=N({domain:k().min(1),title:k().optional(),description:k().optional(),siteName:k().optional(),faviconDataUri:k().optional()}).loose();N({url:k()}).loose();var ple=uc(`ok`,[N({ok:F(!0),metadata:fle}).loose(),N({ok:F(!1),reason:k()}).loose()]),mle=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),hle=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),gle=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose();N({deadLinks:M(N({target:k().min(1),sources:M(gle)}).loose())}).loose(),N({target:N({docName:k().min(1),title:k(),aliases:M(k())}).loose(),mentions:M(N({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:j()}).loose(),N({projectPath:k().min(1)}).loose();var _le=P([`not-a-git-worktree`,`init-failed`]);uc(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:_le,message:k().min(1)}).loose()]),N({host:k().min(1).optional()}).loose(),N({key:k().min(1)}).loose(),N({keyPresent:j()}).loose(),N({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),N({authenticated:j()}).loose(),N({}).loose();var vle=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),yle=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(vle)}).loose(),ble=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),xle=N({sessionAlive:j(),agent:ble.nullable(),files:M(yle)}).loose(),Sle=N({diff:k(),generatedAt:A().int().min(0)}).loose();N({}).loose(),N({}).loose(),N({}).loose(),N({}).loose(),N({}).loose(),N({}).loose();var Cle=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose();N({presence:dc(k().min(1),Cle)}).loose(),dc(k().min(1),j()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),N({path:k().min(1,`path must be non-empty`)}).loose(),N({}).loose();var wle=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),Tle=N({fromPath:k().min(1),toPath:k().min(1)}).loose();N({}).loose(),N({path:k().min(1),...v3,summary:y3}).loose();var Ele=N({docName:k().min(1)}).loose();N({path:k().min(1),...v3,summary:y3}).loose();var Dle=N({path:k().min(1)}).loose();N({kind:P([`file`,`folder`]),path:k().min(1),...v3,summary:y3}).loose();var Ole=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),kle=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(),Ale=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),jle=N({docName:k().min(1),headings:M(Ale)}).loose(),Mle=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose();N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...v3,summary:y3}).loose();var Nle=N({renamed:M(wle),renamedAssets:M(Tle),rewrittenDocs:M(Mle).optional(),summary:K7.optional()}).loose();N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...v3}).loose();var Ple=N({deletedDocNames:M(k().min(1))}).loose();N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...v3,summary:y3}).loose();var Fle=N({deletedDocNames:M(k().min(1))}).loose();N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:y3,...v3}).loose(),N({restoredFrom:k().min(1),timestamp:k().min(1),summary:K7.optional(),warning:q7.optional(),warnings:X7.optional()}).loose();var Ile=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),Lle=N({label:k().min(1),webUrl:ute().nullable()}).loose(),Rle=uc(`checkStatus`,[N({checkStatus:F(`allowed`)}).loose(),N({checkStatus:F(`denied`),deniedReason:P([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),N({checkStatus:F(`unknown`),unknownError:P([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),$7=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]);N({state:Ile,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:Lle.nullable().optional(),pushError:k().optional(),pushErrorCode:$7.optional(),pullError:k().optional(),pullErrorCode:$7.optional(),pausedReason:k().optional(),pushPermission:Rle.optional()}).loose(),N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),N({op:P([`sync`,`push`,`pull`])}).loose(),N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),N({file:k().min(1),strategy:P([`mine`,`theirs`,`content`,`delete`]),content:k().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),N({}).loose(),N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),N({plan:Ic(e=>e!==void 0,{message:`plan is required`})}).loose(),N({plan:Ic(e=>e!==void 0,{message:`plan is required`})}).loose(),N({result:Ic(e=>e!==void 0,{message:`result is required`})}).loose();var zle=N({path:k().min(1),summary:k().min(1)}).loose(),Ble=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose();N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(zle),entryCounts:Ble}).loose())}).loose(),N({noOpen:j().optional(),out:k().min(1).optional()}).loose();var Vle=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose();uc(`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:Vle.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]);var e9=P(k0);sc({schema:F(1),targets:M(e9).default([])}),N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose();var Hle=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose();N({name:k().min(1),docs:M(Hle)}).loose(),N({folder:ac(),frontmatter_local:dc(k(),ac()).nullable()}).loose(),N({path:k(),frontmatter:dc(k(),ac()).optional()}).loose(),N({applied:ac()}).loose();var t9=dc(k(),ac()).meta({description:`Free-form frontmatter map embedded in template payloads.`});N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:t9,body:k()}).strict()}).strict();var Ule=N({templates:M(N({name:k().min(1),title:k().optional(),description:k().optional(),path:k().min(1),source_folder:k()}).strict()),truncated:j()}).strict();N({folder:k(),name:k(),body:k().optional(),frontmatter:t9.optional(),...v3,summary:y3}).strict(),N({path:k().min(1),created:j(),warnings:M(k())}).strict(),N({existed:j(),path:k().min(1)}).strict(),N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:t9.optional(),...v3,summary:y3}).strict(),N({from:k().min(1),to:k().min(1),committed:j()}).strict();var n9=P(u0),Wle=/^[a-z0-9-]+$/,Gle=/^[A-Za-z0-9_-]+$/,r9=N({name:k(),description:k()}).strict();N({skill:N({name:k().min(1),scope:n9,path:k().min(1),frontmatter:r9,body:k(),files:M(N({path:k().min(1),text:k().nullable()})).optional()}).strict()}).strict();var Kle=N({skills:M(N({name:k().min(1),description:k().optional(),scope:n9,path:k().min(1),absolutePath:k().min(1).optional(),installed:j(),hosts:M(k()),installedVersion:k().optional(),bundledVersion:k().optional(),updateAvailable:j().optional()}).strict()),truncated:j()}).strict();N({scope:n9.default(`project`),name:k(),body:k().optional(),frontmatter:r9,...v3,summary:y3}).strict(),N({path:k().min(1),created:j(),warnings:M(k())}).strict(),N({scope:n9.default(`project`),name:k(),...v3,summary:y3}).strict(),N({name:k().min(1),version:k().min(1),previousVersion:k().optional(),checkpointRef:k().optional()}).strict(),N({existed:j(),path:k().min(1)}).strict(),N({scope:n9.default(`project`),fromName:k(),toName:k(),body:k().optional(),frontmatter:r9.optional(),...v3,summary:y3}).strict(),N({from:k().min(1),to:k().min(1),committed:j()}).strict();var i9=P([`reference`,`script`]);N({scope:n9.default(`project`),name:k(),path:k().min(1),content:k(),...v3,summary:y3}).strict(),N({path:k().min(1),created:j(),kind:i9,content:j()}).strict(),N({path:k().min(1),kind:i9,text:k()}).strict(),N({path:k().min(1),existed:j(),kind:i9}).strict(),N({scope:n9.default(`project`),name:k(),targets:M(e9).optional().meta({description:`Explicit editor ids to install into; omit to use project-configured editors.`}),...v3,summary:y3}).strict(),N({name:k().min(1),hosts:M(k()),scripts:j(),warnings:M(k()),warningCodes:M(P([`no-targets`,`scripts-present`]))}).strict(),N({scope:n9.default(`project`),name:k()}).strict(),N({name:k().min(1),uninstalled:j()}).strict();var qle=N({targets:M(e9),configured:j()}).strict();N({targets:M(e9)}).strict(),N({targets:M(e9),reprojected:M(N({name:k(),hosts:M(k())}).strict()),bundleHosts:M(k()),removedFrom:M(k())}).strict(),N({scope:n9.default(`project`),name:k(),version:k().regex(/^[0-9a-f]{40}$/i),...v3,summary:y3}).strict(),N({name:k().min(1),version:k(),restoredFiles:M(k()),warnings:M(k())}).strict(),N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:P([`navigation`,`relevance`]).optional(),scopes:M(P([`page`,`folder`,`content`,`file`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional(),source:P([`omnibar`,`mcp`,`http`]).optional()}).loose();var Jle=N({kind:P([`page`,`folder`,`content`,`file`]),path:k().min(1),title:k(),score:A(),signals:dc(k(),ac()),snippet:k().optional()}).loose(),Yle=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose();N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),keyHint:k().nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(Jle),elapsedMs:A().nonnegative(),semantic:Yle.optional(),truncated:j().optional(),ready:j().optional()}).loose();var Xle=N({version:k().min(1),recordedAt:k().min(1)}).loose();N({currentVersion:k().min(1),targets:dc(k(),Xle.nullable())}).loose();var Zle=`server-info`,Qle=`branch-switched`,$le=`disk-ack`,eue=`config-validation-rejected`,tue=`config-ignore-nested-error`,a9=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),nue=N({v:F(1),ch:F(Zle),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),rue=N({v:F(1),ch:F(Qle),seq:A(),branch:k().min(1)}).loose(),iue=N({v:F(1),ch:a9,seq:A()}).loose(),aue=N({v:F(1),ch:F($le),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),oue=N({v:F(1),ch:F(eue),seq:A(),docName:k().min(1),error:uu}).loose(),sue=N({v:F(1),ch:F(tue),seq:A(),path:k().min(1),error:k().min(1)}).loose();function cue(e){let t;try{t=new URL(e)}catch{return null}let n=t.pathname.match(/^\/video\/(\d+)/);if(n)return n[1]??null;let r=t.pathname.match(/^\/(\d+)/);return r?r[1]??null:null}function lue(e){if(typeof e!=`string`||e.length===0)return e;let t=t8(e);if(t){let e=t.noCookie?`www.youtube-nocookie.com`:`www.youtube.com`,n=t.startSeconds===null?``:`?start=${t.startSeconds}`;return`https://${e}/embed/${t.id}${n}`}if($6(e)){let t=cue(e);return t?`https://player.vimeo.com/video/${t}`:e}let n=Z6(e);if(n){let e=n.startRaw===null?``:`?t=${n.startRaw}`;return`https://www.loom.com/embed/${n.id}${e}`}return e}var uue=`https://api.github.com/repos/inkeep/open-knowledge`;async function due(e){let{signal:t,...n}=e??{},r=t?AbortSignal.any([AbortSignal.timeout(5e3),t]):AbortSignal.timeout(5e3);try{let e=await fetch(uue,{headers:{accept:`application/vnd.github+json`,"user-agent":`openknowledge.ai`},...n,signal:r});if(!e.ok)return console.warn(`[github-stars] GitHub API responded ${e.status}`),null;let t=await e.json();return typeof t.stargazers_count==`number`?t.stargazers_count:null}catch(e){return console.warn(`[github-stars] fetch failed: ${e instanceof Error?e.message:String(e)}`),null}}function fue(e){if(!e)return{height:null,viewerFragment:``};let t=e.split(`&`).filter(e=>e.length>0),n=null,r=[];for(let e of t){let t=e.indexOf(`=`);if(t===-1){r.push(e);continue}let i=e.slice(0,t),a=e.slice(t+1);if(i===`height`){let e=Number.parseInt(a,10);!Number.isNaN(e)&&e>0&&(n=e);continue}r.push(e)}return{height:n,viewerFragment:r.join(`&`)}}new O1.default;var pue=new O1.default;pue.Diff_Timeout=.25;var mue=N({path:M(lc([k(),A()])),message:k(),issueCode:k()});uc(`code`,[N({code:F(`SCHEMA_INVALID`),issues:M(mue)}),N({code:F(`WRITE_ERROR`),detail:k()})]);function hue(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function gue(e){if(e.code!==`SCHEMA_INVALID`)return{};let t={};for(let n of e.issues){let e=n.path[0];typeof e==`string`&&(t[e]=t[e]?`${t[e]}; ${n.message}`:n.message)}return t}var _ue={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function vue(e){if(e.trim()===``)return{doc:new dn({}),map:{}};let t;try{t=_r(e)}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new dn({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=W7.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function yue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function o9(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=C(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(yue(n)){let r=e.createNode(n),i=b(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function bue(e){return e===``?``:`---\n${e.endsWith(`
|
|
549
|
-
`)?e.slice(0,-1):e}\n---\n`}var s9=65536;function c9(e){let t=e.match(q0);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function xue(e){if(e.trim()===``)return{doc:new dn({}),map:{}};let t;try{t=_r(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new dn({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=W7.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function l9(e){return e===``?{doc:new dn({}),map:{}}:xue(X0(e))}function u9(e){let{fenced:t}=c9(e),{map:n,parseError:r}=l9(t);return{map:n??{},parseError:r}}function d9(e){let{fenced:t}=c9(e);if(t===``)return[];let{doc:n,map:r}=l9(t);return r===null?[]:h9(n)}function f9(e){return typeof e==`object`&&!!e&&`key`in e}function p9(e){let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}function m9(e,t){let n=e.key;if(typeof n==`string`){e.key=t;return}if(n&&typeof n==`object`){n.value=t;return}e.key=t}function h9(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!f9(e))continue;let t=p9(e);t!==null&&n.push(t)}return n}function g9(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function Sue(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:bue(e.toString(_ue))}function Cue(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:s9}:null}function _9(e){let t=Sue(e),n=Cue(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function wue(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:z7}};let{doc:n,map:r}=l9(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{g9(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=H7.safeParse(r);if(!t.success)return{ok:!1,error:{kind:`invalid_value`,key:e,reason:t.error.issues[0]?.message??`invalid value`}};n.set(e,o9(n,n.get(e,!0),t.data))}return _9(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Tue(e,t,n,r={}){if(t===`frontmatter`||n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:z7}};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(t===n)return{ok:!0,nextFenced:e};let o=i.contents;if(!o||!(`items`in o)||!Array.isArray(o.items))return{ok:!1,error:{kind:`unknown_key`,key:t}};let s=o.items.find(e=>f9(e)&&p9(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>f9(e)&&e!==s&&p9(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return m9(s,n),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function v9(e,t){let{doc:n,map:r}=l9(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let i=n.contents;if(!i||!(`items`in i)||!Array.isArray(i.items))return{ok:!0,nextFenced:e};let a=h9(n);if(a.length!==t.length||!y9(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(f9),r=[];for(let n of t){let i=e.findIndex(e=>p9(e)===n);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};let[o]=e.splice(i,1);o&&r.push(o)}return i.items=r,_9(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function y9(e,t){let n=new Map;for(let t of e)n.set(t,(n.get(t)??0)+1);for(let e of t){let t=(n.get(e)??0)-1;if(t<0)return!1;n.set(e,t)}for(let e of n.values())if(e!==0)return!1;return!0}function b9(e){if(e.length===0)return{kind:`invalid_path`,path:[...e],reason:`path must have at least one segment`};for(let t=0;t<e.length;t++){let n=e[t];if(typeof n!=`string`&&typeof n!=`number`)return{kind:`invalid_path`,path:[...e],reason:`path segment at index ${t} must be string or number`};if(typeof n==`number`&&(!Number.isInteger(n)||n<0))return{kind:`invalid_path`,path:[...e],reason:`numeric path segment at index ${t} must be a non-negative integer`}}return e[0]===`frontmatter`?{kind:`reserved_key`,key:z7}:null}function Eue(e,t,n){let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=H7.safeParse(n);if(!o.success)return{ok:!1,error:{kind:`invalid_value`,key:String(t[t.length-1]),reason:o.error.issues[0]?.message??`invalid value`}};try{return g9(i),i.setIn(t,o9(i,i.getIn(t,!0),o.data)),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Due(e,t){let n=b9(t);if(n)return{ok:!1,error:n};let{doc:r,map:i}=l9(e);if(i===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{return r.getIn(t,!0)===void 0?{ok:!0,nextFenced:e}:(r.deleteIn(t),_9(r))}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Oue(e,t){if(t.length===0){let t=e.contents;return b(t)?t:null}let n=e.getIn(t,!0);return b(n)?n:null}function kue(e,t,n,r={}){let i=b9(t);if(i)return{ok:!1,error:i};let a=t[t.length-1];if(typeof a!=`string`)return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot rename: last path segment must be a string (map key)`}};if(t.length===1&&n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:z7}};let{doc:o,map:s}=l9(e);if(s===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(a===n)return{ok:!0,nextFenced:e};let c=Oue(o,t.slice(0,-1));if(!c)return{ok:!1,error:{kind:`unknown_key`,key:a}};let l=c.items.find(e=>f9(e)&&p9(e)===a);if(!l)return{ok:!1,error:{kind:`unknown_key`,key:a}};if(!r.allowDuplicate&&c.items.some(e=>f9(e)&&e!==l&&p9(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return m9(l,n),_9(o)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Aue(e,t,n){if(t.length===0)return v9(e,n);let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!b(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a map`}};let s=[];for(let e of o.items){if(!f9(e))continue;let t=p9(e);t!==null&&s.push(t)}if(s.length!==n.length||!y9(s,n))return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};try{let e=o.items.filter(f9),t=[];for(let r of n){let i=e.findIndex(e=>p9(e)===r);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};let[a]=e.splice(i,1);a&&t.push(a)}return o.items=t,_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function jue(e,t,n){let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!C(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a sequence`}};let s=o,c=s.items.length,l=Array.from({length:c},(e,t)=>t),u=[...n];if(!Mue(u,c))return{ok:!1,error:{kind:`reorder_mismatch`,expected:l.map(String),got:u.map(String)}};try{let e=s.items.slice();return s.items=u.map(t=>e[t]),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Mue(e,t){if(e.length!==t)return!1;let n=Array(t).fill(!1);for(let r of e){if(!Number.isInteger(r)||r<0||r>=t||n[r])return!1;n[r]=!0}return!0}var Nue=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function x9(e){return{ok:!1,error:e}}function Pue(e){return{ok:!0,...e}}function Fue(e){return{ok:!0,...e}}function Iue(e){return{ok:!0,...e}}function S9(e){return{ok:!0,...e}}function C9(e){switch(e.kind){case`unknown_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`unknown key '${e.key}'`,issueCode:`unknown_key`}]};case`duplicate_target`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`key '${e.key}' already exists`,issueCode:`duplicate_target`}]};case`invalid_value`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:e.reason,issueCode:`invalid_value`}]};case`reserved_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`'${e.key}' is a reserved frontmatter key`,issueCode:`reserved_key`}]};case`reorder_mismatch`:return{code:`WRITE_ERROR`,detail:`reorder list does not match current keys (state changed mid-drag)`};case`region_too_large`:return{code:`SCHEMA_INVALID`,issues:[{path:[],message:`Frontmatter region exceeds ${s9}-byte limit (would be ${e.bytes})`,issueCode:`region_too_large`}]};case`parse_failed`:return{code:`WRITE_ERROR`,detail:`Frontmatter YAML is malformed; fix in source mode to commit (${e.reason})`};case`invalid_path`:return{code:`SCHEMA_INVALID`,issues:[{path:[...e.path],message:e.reason,issueCode:`invalid_path`}]}}}function Lue(e,t){if(e.parseError!==t.parseError||e.keys.length!==t.keys.length)return!1;for(let n=0;n<e.keys.length;n++)if(e.keys[n]!==t.keys[n])return!1;for(let n of e.keys)if(!G7(e.map[n],t.map[n]))return!1;return!0}var Rue=5;function w9(e){let t=e.toString();return{snapshot:zue(t),raw:t}}function zue(e){let{map:t,parseError:n}=u9(e);return{map:t,keys:d9(e),parseError:n}}function T9(e){return e.startsWith(`---`)}function Bue(e){let t=e.document,n=t.getText(`source`),r=new Set,i=w9(n),a=i.snapshot,o=c9(i.raw).fenced,s=T9(i.raw),c=!1;function l(e=!1){if(c)return;let t,i;try{let e=w9(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!e&&Lue(a,t)){s=T9(i);return}a=t,o=c9(i).fenced,s=T9(i);for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}let u=e=>{c||Vue(e,o.length,s)&&l()};n.observe(u),e.on(`synced`,d);function d(){l(!0)}function f(e){let r;return t.transact(()=>{let{fenced:t}=c9(n.toString());r=e(t),r.ok&&r.nextFenced!==t&&(n.delete(0,t.length),r.nextFenced!==``&&n.insert(0,r.nextFenced))},Nue),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function p(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,`frontmatter`))return x9({code:`SCHEMA_INVALID`,issues:[{path:[z7],message:`'${z7}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=qce.safeParse(e);if(!t.success)return x9({code:`SCHEMA_INVALID`,issues:t.error.issues.map(hue)});let n=t.data,r=Object.keys(n),i=f(e=>wue(e,n));return i.ok?Pue({appliedKeys:r}):x9(C9(i.error))}function m(e,t,n={}){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>Tue(r,e,t,n));return r.ok?Fue({oldKey:e,newKey:t}):x9(C9(r.error))}function h(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>v9(t,e));return t.ok?Iue({orderedKeys:[...e]}):x9(C9(t.error))}function g(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>Eue(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}function _(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>Due(t,e));return t.ok?S9({path:[...e]}):x9(C9(t.error))}function v(e,t,n={}){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>kue(r,e,t,n));return r.ok?S9({path:[...e]}):x9(C9(r.error))}function y(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>Aue(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}function b(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>jue(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}return{current(){return w9(n).snapshot},patch(e){return p(e)},rename(e,t,n){return m(e,t,n)},reorder(e){return h(e)},patchPath(e,t){return g(e,t)},deletePath(e){return _(e)},renamePath(e,t,n){return v(e,t,n)},reorderPath(e,t){return y(e,t)},reorderSeqPath(e,t){return b(e,t)},subscribe(e){return r.add(e),()=>{r.delete(e)}},dispose(){c||(c=!0,n.unobserve(u),e.off(`synced`,d),r.clear())}}}function Vue(e,t,n){if(t===0&&n)return!0;let r=t>0?t:Rue,i=0;for(let t of e.delta){if(typeof t.retain==`number`){i+=t.retain;continue}if(typeof t.insert==`string`){if(i<r)return!0;i+=t.insert.length;continue}if(t.insert!==void 0){if(i<r)return!0;i+=1;continue}if(typeof t.delete==`number`&&i<r)return!0}return!1}var Hue=new O1.default;Hue.Match_Threshold=.5;var E9=/^[a-zA-Z0-9][\w/-]*$/;function Uue(e){if(typeof e!=`string`)return!1;let t=e.startsWith(`#`)?e.slice(1):e;return E9.test(t)}var Wue=`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`;function Gue(e){return e.startsWith(`#`)?e.slice(1):e}function Kue(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function que(e){if(!e||e.trim()===``)return[];let{map:t}=vue(e);if(!t)return[];let n=Kue(t.tags),r=[];for(let e of n){let t=Gue(e);E9.test(t)&&r.push(t)}return r}var Jue=P(u0),Yue=sc({hosts:M(k()),scope:Jue,scripts:j(),installedAt:Ks()});sc({schema:F(1),skills:dc(k(),Yue).default({})});var Xue=100,Zue=500,Que=450,$ue={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},D9=new WeakMap;function ede(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function O9(e){return e.trim().toLowerCase()}var tde=/\.(?:md|mdx)$/;function nde(e,t){if(t!==`page`)return e;let n=e.replace(tde,``);return n.length>0?n:e}function k9(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function rde(e){let t=k9(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function A9(e){let t=R$({schema:$ue});return e.length>0&&Y$(t,e),t}function ide(e){let t={documents:e};return D9.set(t,A9(e)),t}function ade(e){let t=D9.get(e);if(t)return t;let n=A9(e.documents);return D9.set(e,n),n}function ode(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function j9(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function sde(e,t){let n=O9(t);if(!n)return 0;let r=nde(n,e.kind),i=O9(e.title),a=O9(e.name),o=O9(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}var cde=.5;function M9(e,t){let n=sde(e,t);return n<=0?n:h3(e.path)?n*cde:n}var lde=60;function ude(e){return e===`file`?-lde:0}var dde=1e3,N9=50,fde=1,pde=1,mde=.001;function hde(e,t,n,r,i){let a=i>0?t/i:0,o=N9>0?n/N9:0,s=r===`file`?-mde:0,c=fde*a+pde*o+s;return e*dde+c}function P9(e,t,n,r){return e+t*20+n+ude(r)}function F9(e,t,n,r,i,a){return e===`relevance`?P9(t,n,r,i):hde(t,n,r,i,a)}function gde(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function I9(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function _de(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 vde(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function yde(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 bde(e,t){return O9(t).length<4?0:+(e===`full_text`)}function xde(e){let{lexical:t,fullText:n}=e.signals;return t>=Zue?`lexical`:t===Que&&n<=0?`pathOnly`:`body`}function Sde(e){let t=[],n=[],r=[];for(let i of e){let e=xde(i);e===`lexical`?t.length<Xue&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function L9(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=Sde(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function Cde(e,t,n={}){let r=n.intent??`omnibar`,i=gde(r,n.ranking),a=ede(n.limit),o=new Set(n.scopes??ode(r)),s=e.documents.filter(e=>j9(e,o)),c=O9(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=T1(ade(e),{term:c,properties:vde(r),boost:yde(r),tolerance:bde(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>j9(e.document,o)).map(e=>[e.document.id,e.score])),d=_de(s),f=new Map;for(let e of s)M9(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)j9(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=I9(f.values(),u);return L9([...f.values()].map(t=>{let n=Math.max(0,M9(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:F9(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return L9(wde({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function R9(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function wde(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=I9(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,M9(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?F9(o,t,n,s,e.kind,m):P9(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=R9(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=R9(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=+(e.lexical>0),r=+(t.lexical>0);if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function Tde(e){return`https://github.com/${e.owner}/${e.repo}.git`}function Ede(e,t){return!e||e.length===0?`true`:t.detached?`detached`:t.currentBranch===null||t.currentBranch===e?`true`:`false`}var z9=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),B9=globalThis;B9[z9]===void 0&&(B9[z9]=So());var V9=B9[z9],H9=sc({version:k().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(V9,{description:`Recorded skill version for this target.`}),recordedAt:Ks().register(V9,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(V9,{description:`Install-source surface that recorded this entry.`}).optional()}),Dde=sc({enabled:j().register(V9,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Ks().register(V9,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});sc({schema:F(1).register(V9,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:sc({"claude-cowork":H9.optional(),"cli-hosts":H9.optional()}).register(V9,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:dc(k(),Dde).register(V9,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional()});var U9=class extends Error{chunksCompleted;totalChunks;bytesWritten;bytesRemaining;cause;constructor(e,t){let n=e instanceof Error?e.message:typeof e==`string`?e:`unknown error`;super(`chunked insert failed after ${t.chunksCompleted}/${t.totalChunks} chunks (${t.bytesWritten} bytes written, ${t.bytesRemaining} bytes lost): ${n}`),this.name=`ChunkedInsertError`,this.chunksCompleted=t.chunksCompleted,this.totalChunks=t.totalChunks,this.bytesWritten=t.bytesWritten,this.bytesRemaining=t.bytesRemaining,this.cause=e}};async function Ode(e,t,n,r,i={}){let a=i.thresholdBytes??512e3,o=i.chunkSizeBytes??51200,s=i.origin,c=i.yieldFn??kde,l=i.resolveOffset??(e=>e);if(r.length<=a){e.transact(()=>{t.insert(n,r)},s);return}let u=Math.ceil(r.length/o),d=0,f=n,p=0,m=0;for(;d<r.length;){let n=Math.min(d+o,r.length),i=r.slice(d,n);try{let n=l(f);e.transact(()=>{t.insert(n,i)},s)}catch(e){throw new U9(e,{chunksCompleted:p,totalChunks:u,bytesWritten:m,bytesRemaining:r.length-d})}p++,m+=i.length,f+=i.length,d=n,d<r.length&&await c()}}function kde(){return new Promise(e=>{let t=globalThis;t.document?.hidden!==!0&&typeof t.requestAnimationFrame==`function`?t.requestAnimationFrame(()=>e()):setTimeout(()=>e(),0)})}function Ade(){let e=!1,t=``,n=0;return r=>{let i=jde(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 jde(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}var Mde=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],Nde={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`},Pde={cursor:`#FFFFFF`,windsurf:`#FFFFFF`},W9=[`#f0ece3`,`#fff5e1`,`#f9e1db`,`#f5def7`,`#ece2fb`,`#dce8fa`,`#DBF3FB`];function Fde(e,t=Mde){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}function Ide(e){let t=e.trim();if(!t)return`?`;let n=t.split(/[-\s]+/).filter(Boolean);if(!n.length)return`?`;if(n.length>=2)return n.slice(0,2).map(e=>e[0]??``).join(``).toUpperCase();let r=n[0],i=[r[0]];for(let e=1;e<r.length&&i.length<2;e++){let t=r[e-1],n=r[e];t===t.toLowerCase()&&n===n.toUpperCase()&&n!==n.toLowerCase()&&i.push(n)}return i.length>=2?i.join(``).toUpperCase():r.slice(0,2).toUpperCase()}function Lde(e){let t=e.trim();if(!t)return e;if(t.includes(` `)||!/[-_]/.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);return n.length?n.map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):t}var Rde={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function zde(e){return e?Rde[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}function Bde(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2;if(i===a)return[0,0,o*100];let s=i-a,c=o>.5?s/(2-i-a):s/(i+a),l;return l=i===t?((n-r)/s+(n<r?6:0))/6:i===n?((r-t)/s+2)/6:((t-n)/s+4)/6,[l*360,c*100,o*100]}function Vde(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function Hde(e){let[t]=Bde(e);return Vde(t,45,32)}var Ude=[`Curious`,`Brave`,`Clever`,`Swift`,`Gentle`,`Bright`,`Wise`,`Bold`,`Calm`,`Keen`],Wde=[`Bird`,`Cat`,`Dog`,`Fish`,`Mouse`,`Rabbit`,`Shrimp`,`Snail`,`Squirrel`,`Turtle`],G9=`ok-user-name-v3`,K9=`ok-user-color-v3`;function q9(e){return e[Math.floor(Math.random()*e.length)]}function Gde(){return`${q9(Ude)} ${q9(Wde)}`}function Kde(){return q9(W9)}function J9(e){try{return localStorage.getItem(e)}catch{return null}}function Y9(e,t){try{localStorage.setItem(e,t)}catch{}}function qde(){let e=new URLSearchParams(window.location.search).get(`coeditor`)||`standalone`,t=crypto.randomUUID(),n=J9(G9),r=J9(K9);return n||(n=Gde(),Y9(G9,n)),r||(r=Kde(),Y9(K9,r)),{name:n,color:r,coeditor:e,tabId:t}}function Jde(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}function Yde(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}var X9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Z9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function Q9(e){return e.split(`/`).filter(Boolean)}function $9(e){let t=e.trim();return X9.test(t)||t.startsWith(`//`)}function Xde(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if($9(n))return{kind:`external`,url:n};let r=Jde(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=Z9(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function Zde(e,t){let n=e.trim();if(!n)return null;if($9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=Z9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function Qde(e,t){let n=e.trim();if(!n||X9.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function $de(e,t,n=null,r=`.md`){let i=Q9(e);i.pop();let a=Q9(t),o=0;for(;o<i.length&&o<a.length&&i[o]===a[o];)o+=1;let s=i.slice(o).map(()=>`..`),c=a.slice(o),l=[...s,...c].join(`/`);return l||=a.at(-1)??t,!l.startsWith(`./`)&&!l.startsWith(`../`)&&(l=`./${l}`),`${l}${r}${n?`#${n}`:``}`}function efe(e){return e.replace(/[/\\:*?"<>|\0]/g,`-`).replace(/\s+/g,` `).replace(/-+/g,`-`).trim().replace(/^[-.\s]+|[-.\s]+$/g,``)}export{w7 as $,Jc as $i,$9 as $n,TT as $r,Ede as $t,Qce as A,dp as Ai,Lde as An,efe as Ar,Kle as At,M6 as B,Id as Bi,Mae as Bn,L1 as Br,dle as Bt,Ele as C,yb as Ci,a4 as Cn,n4 as Cr,L3 as Ct,a9 as D,l_ as Di,G0 as Dn,u9 as Dr,j3 as Dt,Ple as E,av as Ei,gue as En,d9 as Er,D3 as Et,J0 as F,ap as Fi,r4 as Fn,Y0 as Fr,Ule as Ft,C0 as G,Xc as Gi,kae as Gn,Are as Gr,Y1 as Gt,Xoe as H,Gu as Hi,wae as Hn,D7 as Hr,Yde as Ht,Wue as I,cp as Ii,n0 as In,l4 as Ir,Fle as It,ple as J,Vl as Ji,Dae as Jn,ED as Jr,d4 as Jt,f2 as K,Kl as Ki,Tae as Kn,Ere as Kr,u4 as Kt,E9 as L,ef as Li,zie as Ln,e2 as Lr,B3 as Lt,D0 as M,Tp as Mi,due as Mn,c4 as Mr,u3 as Mt,A0 as N,Op as Ni,wce as Nn,a3 as Nr,d3 as Nt,Q7 as O,f_ as Oi,hce as On,Qde as Or,e9 as Ot,e0 as P,ip as Pi,qde as Pn,g0 as Pr,X2 as Pt,u0 as Q,Ol as Qi,T0 as Qn,yT as Qr,Ode as Qt,ile as R,df as Ri,zde as Rn,lce as Rr,i4 as Rt,Dle as S,Ry as Si,t0 as Sn,I1 as Sr,r0 as St,w0 as T,Dx as Ti,que as Tn,p0 as Tr,O3 as Tt,t2 as U,L as Ui,Aae as Un,y4 as Ur,U1 as Ut,hle as V,I as Vi,Cae as Vn,X0 as Vr,i3 as Vt,n2 as W,Uc as Wi,Eae as Wn,k9 as Wr,Bue as Wt,dce as X,Zc as Xi,Kce as Xn,oT as Xr,$de as Xt,pce as Y,el as Yi,Oae as Yn,TD as Yr,p4 as Yt,l0 as Z,qc as Zi,d2 as Zn,Vw as Zr,Tde as Zt,o0 as _,vee as _a,Zy as _i,ide as _n,t4 as _r,Nle as _t,Sle as a,Il as aa,qx as ai,Fde as an,c2 as ar,I0 as at,U9 as b,ny as bi,M0 as bn,v0 as br,f0 as bt,rue as c,gl as ca,Cy as ci,T4 as cn,$6 as cr,jle as ct,iue as d,Zl as da,Ey as di,G4 as dn,Hce as dr,z3 as dt,nl as ea,gT as ei,Xde as en,Jce as er,qse as et,aue as f,jl as fa,nb as fi,C4 as fn,zce as fr,P1 as ft,i0 as g,k as ga,Xy as gi,v8 as gn,t7 as gr,C2 as gt,s0 as h,N as ha,Jy as hi,Ade as hn,U0 as hr,gce as ht,xle as i,wl as ia,gb as ii,W0 as in,P0 as ir,mle as it,Ole as j,R as ji,G7 as jn,Cde as jr,Gle as jt,$ce as k,K_ as ki,f7 as kn,lue as kr,qle as kt,sue as l,_l as la,Mx as li,S4 as ln,yce as lr,kle as lt,k1 as m,F as ma,zy as mi,Ide as mn,X1 as mr,z7 as mt,Pde as n,Hc as na,lx as ni,j1 as nn,Q6 as nr,b4 as nt,nle as o,mu as oa,Jx as oi,q4 as on,s2 as or,L0 as ot,nue as p,lte as pa,rb as pi,x4 as pn,Bie as pr,N1 as pt,sle as q,tl as qi,Sae as qn,CD as qr,f3 as qt,E0 as r,Ml as ra,Kb as ri,M1 as rn,d0 as rr,N0 as rt,tle as s,du as sa,Gx as si,E4 as sn,Uue as sr,k0 as st,Nde as t,Ul as ta,wx as ti,Zde as tn,h3 as tr,S2 as tt,oue as u,Wl as ua,Ty as ui,w4 as un,b0 as ur,R3 as ut,a0 as v,yee as va,_b as vi,rde as vn,h0 as vr,i2 as vt,cce as w,Wx as wi,Z9 as wn,t8 as wr,C3 as wt,R0 as x,Nv as xi,vce as xn,fue as xr,Wle as xt,x0 as y,ti as ya,Nx as yi,Hde as yn,Z6 as yr,o2 as yt,W9 as z,uf as zi,jae as zn,E7 as zr,s4 as zt};
|
|
545
|
+
`)},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=n7(i.attributes??[]);return!i.children||i.children.length===0?s?c?`<${s} ${c} />`:`<${s} />`:``:Fse({...i,attributes:(i.attributes??[]).map(Rse)},t,n,r)},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=l7(n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),r,`==`),o+=i.move(`==`),a(),o},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=n7(e.attributes??[]);return r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>{if(n)return`>`;let r=c++,i=s?.[r];return i===`lazy`&&r>0&&!Ise.test(e)?e:i===`none`||i===0?`>${e}`:typeof i==`number`&&i>=2&&!e.startsWith(` `)?`>${` `.repeat(i)}${e}`:`> ${e}`})}};function n7(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){n.value.includes(`"`)?t.push(`${e}={${r7(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function r7(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function Rse(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:r7(e.value)}}:e}function i7(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function a7(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 zse(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>Bse(t)?e:`\\${e}`)}function Bse(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32||t===160}function o7(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character===`!`&&e.after===`\\[`&&e.inConstruct===`phrasing`||e.character===`@`&&e.before===`[+\\-.\\w]`||e.character===`{`&&Array.isArray(e.inConstruct)&&e.inConstruct.includes(`phrasing`)||e.character==="`"||(e.character===`*`||e.character===`_`||e.character===`~`)&&e.inConstruct===`phrasing`||e.character===`=`&&e.atBreak===!0||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`)),e.unsafe=e.unsafe.map(e=>{if(e.character!==`)`||e.atBreak!==!0||e.before!==`\\d+`||e.after!==void 0)return e;let t={...e,after:`(?:[ \r
|
|
546
|
+
]|$)`};return delete t._compiled,t});let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return zse(Wse(i,n))}var s7=1,Vse=2;function c7(e){if(Number.isNaN(e))return`ws`;let t=ZI(e);return t===s7?`ws`:t===Vse?`punct`:`other`}function Hse(e,t,n){let r=c7(t),i=c7(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function Use(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
|
|
547
|
+
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function Wse(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&Use(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=Hse(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function l7(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);u7(i.charCodeAt(i.length-1),s,r)&&(o=d7(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return u7(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+d7(c)),o}function u7(e,t,n){return!(ZI(t)!==s7||n===`_`&&ZI(e)===void 0)}function d7(e){return`&#x${e.toString(16).toUpperCase()};`}function Gse(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!qse(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function Kse(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=l7(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function qse(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function f7(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 Jse=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=Jy(e.extensions),this.handlers=ece(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?Qie({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=tce(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=wse({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=Tse({toMarkdownHandlers:Lse})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return Dse(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?Ose(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?Rae(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return kse(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}},p7=v8();function Yse(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 Xse(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 Zse(e,t){return e.attrs.sourceDirty||Xse(e)?!0:t?t.isDiverged(e.toJSON()):!1}function Qse(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 m7(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function h7(e,t){if(e.length===0)return m7({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return m7({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:[h7(n.children,t)]}}return m7({type:`inlineCode`,value:g7(e)},t)}function g7(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=g7(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}var $se=qc;function ece(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=BV(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=BV(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=t7(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&U2(t.raw)!==null&&B2(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=U2(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=VV(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=VV(r.highlight)),r.comment&&(i.comment=VV(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=BV(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=VV(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=VV(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=BV(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=BV(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=BV(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=p7.getOrWildcard(o),c=Yse(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=t7(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=o4(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&&$se.has(l)&&n.jsxComponent&&p7.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&&Jc.has(l)&&n.jsxComponent&&p7.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&&Xc.has(l)&&n.jsxComponent&&p7.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&&Zc.has(l)&&n.jsxComponent&&p7.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:f7(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=BV(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 tce(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=KV(`paragraph`)),i.blockquote&&(n.blockquote=KV(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=KV(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=KV(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&Qse(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=KV(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:j6(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!Zse(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:p7.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:p7,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=qV(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=qV(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return h7(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=qV(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=qV(`mark`)),a.comment&&(r.comment=qV(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=KV(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=KV(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return G2(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}var _7={default:!0,MD013:!1};function v7(e){return e??_7}var y7=`doc`;function nce(e,t){return rY(e,eY({strings:{[y7]:e},config:t})[y7]??[])}function rce(e,t){let n=eY({strings:{[y7]:e},config:t})[y7]??[],r=e.split(`
|
|
548
|
+
`),i=ice(t);return n.map(e=>oce(e,r,ace(e,i)))}function ice(e){let t=new Map;return Object.entries(e).forEach(([e,n],r)=>{let i=e.toUpperCase();if(i===`DEFAULT`)return;let a=null;if(n===`error`||n===`warning`)a=n;else if(typeof n==`object`&&n&&!Array.isArray(n)){let e=n.severity;(e===`error`||e===`warning`)&&(a=e)}a!==null&&t.set(i,{entryIndex:r,severity:a})}),t}function ace(e,t){let n;for(let r of e.ruleNames){let e=t.get(r.toUpperCase());e!==void 0&&(n===void 0||e.entryIndex>n.entryIndex)&&(n=e)}return n?.severity??`warning`}function oce(e,t,n){let[r,i]=e.errorRange??[1,null],a=e.lineNumber-1,o=(r??1)-1,s=t[a]?.length??0,c=i==null?s:Math.min(o+i,s),l=e.fixInfo?[sce(e.fixInfo,e.lineNumber,t)]:void 0;return{range:{start:{line:a,character:o},end:{line:a,character:Math.max(c,o)}},severity:n,source:`markdownlint`,code:e.ruleNames[0]??`MD000`,message:e.errorDetail?`${e.ruleDescription}: ${e.errorDetail}`:e.ruleDescription,...l?{fixes:l}:{}}}function sce(e,t,n){let r=e.lineNumber??t,i=r-1;if(e.deleteCount===-1){if(r<n.length)return{range:{start:{line:i,character:0},end:{line:i+1,character:0}},newText:``};if(i>0){let e=n[i-1]?.length??0;return{range:{start:{line:i-1,character:e},end:{line:i,character:n[i]?.length??0}},newText:``}}return{range:{start:{line:0,character:0},end:{line:0,character:n[0]?.length??0}},newText:``}}let a=(e.editColumn??1)-1;return{range:{start:{line:i,character:a},end:{line:i,character:a+Math.max(0,e.deleteCount??0)}},newText:e.insertText??``}}var cce=lc([j(),P([`error`,`warning`]),dc(k(),ac())]),b7=[{id:`markdownlint`,sliceSchema:N({enabled:j(),rules:dc(k(),cce)}),defaultSlice:{enabled:!1,rules:_7},async lint(e,t){return rce(e,v7(t.rules))},fix(e,t){return nce(e,v7(t.rules))}}],lce={enabled:!0,plugins:Object.fromEntries(b7.map(e=>[e.id,e.defaultSlice]))};function uce(e){return{enabled:e.enabled??!0,plugins:{markdownlint:{...e.markdownlint,rules:e.markdownlint.rules??_7}}}}var dce=Object.fromEntries(b7.map(e=>[e.id,e.sliceSchema])),fce=N({effective:N({enabled:j(),plugins:N(dce)}),configFile:k().nullable().optional(),configProblems:M(k()).optional()}),pce=lc([j(),dc(k(),ac())]);N({ruleId:k().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:lc([pce,ic()])});var x7=N({line:A(),character:A()}),S7=N({start:x7,end:x7}),C7=N({range:S7,severity:P([`error`,`warning`,`info`,`hint`]),source:k(),code:k(),message:k(),fixes:M(N({range:S7,newText:k()})).optional()}),mce=N({files:M(N({file:k(),diagnostics:M(C7)})),fileCount:A(),errorCount:A(),warningCount:A(),warnings:M(k())});N({docName:v3,summary:b3,...y3}).loose(),N({file:k(),fixedCount:A(),diagnostics:M(C7),errorCount:A(),warningCount:A(),warning:k().optional()});var w7=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}],hce=(()=>{let e=new Map;for(let t of w7){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();function T7(e){return hce.get(e.toUpperCase())??null}function gce(e,t){let n=T7(t);if(n===null)return;let r;for(let[t,i]of Object.entries(e))T7(t)===n&&(r={key:t,value:i});return r}var _ce=[`Headings`,`Lists`,`Whitespace`,`Code`,`Links & images`,`Style`],vce=[[`headings`,`Headings`],[`bullet`,`Lists`],[`ul`,`Lists`],[`ol`,`Lists`],[`links`,`Links & images`],[`images`,`Links & images`],[`accessibility`,`Links & images`],[`code`,`Code`],[`language`,`Code`],[`emphasis`,`Style`],[`html`,`Style`],[`line_length`,`Whitespace`],[`whitespace`,`Whitespace`],[`hard_tab`,`Whitespace`],[`blank_lines`,`Whitespace`],[`indentation`,`Whitespace`]];function yce(e){for(let[t,n]of vce)if(e.tags.includes(t))return n;return`Style`}async function bce(e,t,n){if(!t.enabled)return[];let r=[];for(let i of b7){let a=t.plugins[i.id];a.enabled&&r.push(...await i.lint(e,a,{docName:n}))}return r}var xce=/\p{M}+/gu,Sce=/[^\p{L}\p{N}]+/gu,Cce=/^-+|-+$/g;function E7(e){return e.trim().normalize(`NFKD`).replace(xce,``).toLowerCase().replace(Sce,`-`).replace(Cce,``)}function wce(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function Tce(e,t){let n=E7(e);return n?wce(n,t):``}function D7(e,t){let n=E7(e);return t?`#${n}-${E7(t)}`:`#${n}`}var O7=new Set([`img`,`video`,`audio`,`mark`]),Ece=new Map(_8.flatMap(e=>e.surface===`compat`&&O7.has(e.rendersAs)?[[e.name,e]]:[]));function k7(e){let t={};for(let n of e.attributes){if(n.type!==`mdxJsxAttribute`)return null;let e=n.name.toLowerCase();if(!(e.length>=3&&e.startsWith(`on`)))if(n.value===null)t[n.name]=!0;else if(typeof n.value==`string`)t[n.name]=n.value;else return null}return t}function A7(e){let t=e.name;if(!t||!O7.has(t))return null;let n=k7(e);return n===null?null:{type:`element`,tagName:t,properties:n,children:[]}}function j7(e){let t=e.name;if(!t)return null;let n=Ece.get(t);if(!n)return null;let r=k7(e);if(r===null)return null;let i=n.translateProps(r),a={};for(let[e,t]of Object.entries(i))(typeof t==`string`||typeof t==`boolean`)&&(a[e]=t);return{type:`element`,tagName:n.rendersAs,properties:a,children:[]}}var Dce=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-link`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:D7(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},Oce=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-embed`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:D7(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},kce=(e,t)=>{let n=t,r=A7(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=j7(n);if(i){e.patch(t,i);let n=e.applyData(t,i);return n.tagName===`img`?{type:`element`,tagName:`p`,properties:{},children:[n]}:n}let a={type:`element`,tagName:`pre`,properties:{className:[`mdx-component`]},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]}]};return e.patch(t,a),e.applyData(t,a)},Ace=(e,t)=>{let n=t,r=A7(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=j7(n);if(i)return e.patch(t,i),e.applyData(t,i);let a={type:`element`,tagName:`span`,properties:{className:[`mdx-inline`],dataJsxInline:``},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]};return e.patch(t,a),e.applyData(t,a)},jce=(e,t)=>{let n=t,r=n.data.reason||`unknown`,i=n.value||``,a=r.replace(/--/g,`—`),o={type:`comment`,value:` Parse error: ${a} `},s={type:`element`,tagName:`pre`,properties:{className:[`mdx-fallback`],dataRawMdxFallback:``,dataReason:a},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:i}]}]};return e.patch(t,s),[o,e.applyData(t,s)]},Mce=(e,t)=>{let n={type:`element`,tagName:`mark`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)};function M7(e){if(typeof e!=`object`||!e)return``;let t=e;return typeof t.value==`string`?t.value:Array.isArray(t.children)?t.children.map(M7).join(``):``}var N7={wikiLink:Dce,wikiLinkEmbed:Oce,mdxJsxFlowElement:kce,mdxJsxTextElement:Ace,rawMdxFallback:jce,mark:Mce,tag:(e,t)=>{let n=t.value,r={type:`element`,tagName:`a`,properties:{className:[`tag`],dataTag:n,href:`#tag/${n}`},children:[{type:`text`,value:`#${n}`}]};return e.patch(t,r),e.applyData(t,r)},comment:(e,t)=>{let n={type:`comment`,value:M7(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},commentBlock:(e,t)=>{let n={type:`comment`,value:M7(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`sup`,properties:{id:`fnref-${n}`,dataFootnoteRef:``,dataFootnoteId:n,className:[`footnote-ref`]},children:[{type:`element`,tagName:`a`,properties:{href:`#fn-${n}`,className:[`footnote-ref-link`]},children:[{type:`text`,value:`[${n}]`}]}]};return e.patch(t,r),e.applyData(t,r)},footnoteDefinition:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`aside`,properties:{id:`fn-${n}`,dataFootnoteDef:``,dataFootnoteId:n,className:[`footnote-def`]},children:[{type:`element`,tagName:`div`,properties:{className:[`footnote-body`]},children:e.all(t)},{type:`element`,tagName:`a`,properties:{href:`#fnref-${n}`,className:[`footnote-backref`],ariaLabel:`Back to reference`},children:[{type:`text`,value:`↩`}]}]};return e.patch(t,r),e.applyData(t,r)}},Nce=/url\s*\(\s*['"]?\s*(?:javascript|vbscript|data)\s*:/i,Pce=/\bexpression\s*\(/i,Fce=1e4;function Ice(e){return!(e.length>Fce||Nce.test(e)||Pce.test(e))}function P7(e){for(let t of e.split(`,`)){let e=t.trim();if(e!==``&&!c2(e.split(/\s+/)[0]??``))return!1}return!0}var Lce={a:[`href`,`title`],img:[`src`,`alt`,`title`],video:[`src`,`title`],audio:[`src`,`title`],code:[`className`]},Rce=new Set([`href`,`src`]),zce=QR(`<>`),F7=()=>e=>{TN(e,`element`,e=>{let t=Lce[e.tagName.toLowerCase()],n=e.properties;if(!(!t||!n))for(let e of t){let t=n[e];if(Array.isArray(t)){let r=t.map(e=>typeof e==`string`?Z8(e):e);r.some((e,n)=>e!==t[n])&&(n[e]=r);continue}if(typeof t!=`string`)continue;let r;if(Rce.has(e))if(t===`<>`||t===zce)r=``;else{let e=Z8(t);r=e===t?t:QR(e)}else r=Z8(t);r!==t&&(n[e]=r)}})},I7=()=>e=>{TN(e,`element`,e=>{let t=e.tagName.toLowerCase(),n=e.properties;if(!n)return;if(t===`a`||t===`area`||t===`link`||t===`base`){let e=n.href;typeof e==`string`&&!c2(e)&&delete n.href}if(t===`img`||t===`iframe`||t===`script`||t===`embed`||t===`source`||t===`audio`||t===`video`||t===`track`){let e=n.src;typeof e==`string`&&!c2(e)&&delete n.src}if(t===`form`){let e=n.action;typeof e==`string`&&!c2(e)&&delete n.action}if(t===`img`||t===`source`){let e=n.srcSet;typeof e==`string`&&!P7(e)&&delete n.srcSet;let t=n.srcset;typeof t==`string`&&!P7(t)&&delete n.srcset}if(t===`video`){let e=n.poster;typeof e==`string`&&!c2(e)&&delete n.poster}let r=n.style;typeof r==`string`&&!Ice(r)&&delete n.style})};function Bce(e){let t=_V().use(HX,{handlers:N7}).use(F7).use(I7).use(tX),n=t.runSync(e);return String(t.stringify(n))}function Vce(e){let t=/\r?\n|\r/g,n=[],r=0,i=t.exec(e);for(;i!==null;)n.push(L7(e.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=t.exec(e);return n.push(L7(e.slice(r),r>0,!1)),n.join(``)}function L7(e,t,n){let r=0,i=e.length,a=e=>e===9||e===32;for(;t&&r<i&&a(e.charCodeAt(r));)r++;for(;n&&i>r&&a(e.charCodeAt(i-1));)i--;return i>r?e.slice(r,i):``}var R7=/\r?\n|\r/,Hce=(e,t)=>{let n=Vce(String(t.value));if(!R7.test(n)){let r={type:`text`,value:n};return e.patch(t,r),e.applyData(t,r)}let r=n.split(R7),i=[];for(let e=0;e<r.length;e++)e>0&&i.push({type:`element`,tagName:`br`,properties:{},children:[]}),r[e].length>0&&i.push({type:`text`,value:r[e]});return i};function Uce(e){let t=_V().use(hU).use(mH,[`yaml`]).use(N5).use(cV).use(Y5).use(G8).use(L5).use(r5).use(HX,{handlers:{...N7,text:Hce}}).use(F7).use(I7).use(tX);return String(t.processSync(U8(n5(e))))}nG(),hW(),gW();var z7=`frontmatter`,B7=[`text`,`number`,`boolean`,`date`,`list`,`object`];P(B7);var Wce=lc([k(),A(),j()]),V7=Pc(()=>lc([Wce.transform(e=>String(e)),dc(k(),H7),M(V7)])),H7=Pc(()=>lc([k(),A(),j(),M(V7),dc(k(),H7)])),Gce=/^\d{4}-\d{2}-\d{2}$/;function Kce(e){return typeof e==`string`&&Gce.test(e)}function qce(e){return Array.isArray(e)?`list`:typeof e==`object`&&e?`object`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:Kce(e)?`date`:`text`}function U7(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(U7(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:U7(r);return t}return e}var W7=zc(U7,dc(k(),H7)),Jce=dc(k(),lc([H7,ic()]));function Yce(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}function G7(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!G7(e[n],t[n]))return!1;return!0}if(e!==null&&t!==null&&typeof e==`object`&&typeof t==`object`&&!Array.isArray(e)&&!Array.isArray(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.hasOwn(t,r)||!G7(e[r],t[r]))return!1;return!0}return!1}N({docName:v3,summary:b3,content:k().optional(),...y3}).loose(),N({docName:v3,summary:b3,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P(C0).optional(),...y3}).loose(),N({docName:v3,summary:b3,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...y3}).loose(),N({docName:v3,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...y3}).loose();var K7=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),Xce=uc(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),q7=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:Xce.optional(),hint:k().optional()}).loose(),Zce=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),J7=N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),mergeOutcome:k().optional(),hint:k().optional()}).loose(),Y7=uc(`kind`,[q7,J7]),X7=M(uc(`kind`,[q7,J7,N({kind:F(`mermaid-parse-error`),fenceIndex:A().int().positive(),fenceFirstLine:k(),message:k(),line:A().int().positive().optional()}).loose(),N({kind:F(`lint-violation`),source:k(),code:k(),message:k(),severity:P([`error`,`warning`,`info`,`hint`]),line:A().int().positive(),column:A().int().positive()}).loose()])).min(1),Z7=M(N({href:k(),resolvedTo:k().nullable(),reason:P([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose());N({timestamp:k().min(1),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional()}).loose(),N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(Zce).optional(),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional(),brokenLinks:Z7}).loose(),N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional(),brokenLinks:Z7}).loose(),N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),N({docName:v3,patch:dc(k(),lc([H7,ic()])),types:dc(k(),P(B7)).optional(),summary:b3,...y3}).loose(),N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:K7.optional(),warning:Y7.optional(),warnings:X7.optional(),brokenLinks:Z7}).loose(),N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(P1),event:k().optional(),fields:dc(k(),ac()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),N({accepted:A().int().min(0)}).loose();var Qce=N({status:k().min(1),reason:k()}).loose(),$ce=N({docName:k().min(1),content:k(),lifecycle:Qce.nullable()}).loose(),Q7=N({kind:P([`document`,`asset`,`folder`,`file`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:j().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:P([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:M(k().min(1)).optional(),hasChildren:j().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`}),ele=N({documents:M(Q7),truncated:j().optional()}).loose(),tle=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),nle=N({docName:k().min(1),backlinks:M(tle)}).loose(),rle=N({counts:dc(k().min(1),A().int().nonnegative())}).loose(),ile=uc(`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()]),ale=N({docName:k().min(1),forwardLinks:M(ile)}).loose(),ole=uc(`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()]),sle=N({source:k().min(1),target:k().min(1)}).loose(),cle=N({nodes:M(ole),links:M(sle)}).loose(),lle=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(),ule=N({app:lc([F(`cursor`),F(`codex`),F(`claude`),ic()]),signals_fired:M(k())}).loose();N({entries:M(lle),count:A().int().min(0),detection:ule}).loose(),N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:b3,...y3}).loose(),N({checkpointRef:k().min(1)}).loose();var dle=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose();N({entries:M(N({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:P([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:M(dle),checkpoint:ac().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional(),hasMore:j().optional()}).loose(),N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose();var fle=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose();M(uc(`source`,[N({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:F(`flat`)}).loose(),N({docName:k().min(1),timestamp:k().min(1),source:F(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});var ple=N({domain:k().min(1),title:k().optional(),description:k().optional(),siteName:k().optional(),faviconDataUri:k().optional()}).loose();N({url:k()}).loose();var mle=uc(`ok`,[N({ok:F(!0),metadata:ple}).loose(),N({ok:F(!1),reason:k()}).loose()]),hle=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),gle=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),_le=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose();N({deadLinks:M(N({target:k().min(1),sources:M(_le)}).loose())}).loose(),N({target:N({docName:k().min(1),title:k(),aliases:M(k())}).loose(),mentions:M(N({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:j()}).loose(),N({projectPath:k().min(1)}).loose();var vle=P([`not-a-git-worktree`,`init-failed`]);uc(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:vle,message:k().min(1)}).loose()]),N({host:k().min(1).optional()}).loose(),N({key:k().min(1)}).loose(),N({keyPresent:j()}).loose(),N({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),N({authenticated:j()}).loose(),N({}).loose();var yle=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),ble=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(yle)}).loose(),xle=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),Sle=N({sessionAlive:j(),agent:xle.nullable(),files:M(ble)}).loose(),Cle=N({diff:k(),generatedAt:A().int().min(0)}).loose();N({}).loose(),N({}).loose(),N({}).loose(),N({}).loose(),N({}).loose(),N({}).loose();var wle=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose();N({presence:dc(k().min(1),wle)}).loose(),dc(k().min(1),j()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),N({path:k().min(1,`path must be non-empty`)}).loose(),N({}).loose();var Tle=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),Ele=N({fromPath:k().min(1),toPath:k().min(1)}).loose();N({}).loose(),N({path:k().min(1),...y3,summary:b3}).loose();var Dle=N({docName:k().min(1)}).loose();N({path:k().min(1),...y3,summary:b3}).loose();var Ole=N({path:k().min(1)}).loose();N({kind:P([`file`,`folder`]),path:k().min(1),...y3,summary:b3}).loose();var kle=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),Ale=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(),jle=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),Mle=N({docName:k().min(1),headings:M(jle)}).loose(),Nle=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose();N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...y3,summary:b3}).loose();var Ple=N({renamed:M(Tle),renamedAssets:M(Ele),rewrittenDocs:M(Nle).optional(),summary:K7.optional()}).loose();N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...y3}).loose();var Fle=N({deletedDocNames:M(k().min(1))}).loose();N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...y3,summary:b3}).loose();var Ile=N({deletedDocNames:M(k().min(1))}).loose();N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:b3,...y3}).loose(),N({restoredFrom:k().min(1),timestamp:k().min(1),summary:K7.optional(),warning:q7.optional(),warnings:X7.optional()}).loose();var Lle=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),Rle=N({label:k().min(1),webUrl:ute().nullable()}).loose(),zle=uc(`checkStatus`,[N({checkStatus:F(`allowed`)}).loose(),N({checkStatus:F(`denied`),deniedReason:P([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),N({checkStatus:F(`unknown`),unknownError:P([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),$7=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]);N({state:Lle,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:Rle.nullable().optional(),pushError:k().optional(),pushErrorCode:$7.optional(),pullError:k().optional(),pullErrorCode:$7.optional(),pausedReason:k().optional(),pushPermission:zle.optional()}).loose(),N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),N({op:P([`sync`,`push`,`pull`])}).loose(),N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),N({file:k().min(1),strategy:P([`mine`,`theirs`,`content`,`delete`]),content:k().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),N({}).loose(),N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),N({plan:Ic(e=>e!==void 0,{message:`plan is required`})}).loose(),N({plan:Ic(e=>e!==void 0,{message:`plan is required`})}).loose(),N({result:Ic(e=>e!==void 0,{message:`result is required`})}).loose();var Ble=N({path:k().min(1),summary:k().min(1)}).loose(),Vle=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose();N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(Ble),entryCounts:Vle}).loose())}).loose(),N({noOpen:j().optional(),out:k().min(1).optional()}).loose();var Hle=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose();uc(`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:Hle.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]);var e9=P(A0);sc({schema:F(1),targets:M(e9).default([])}),N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose();var Ule=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose();N({name:k().min(1),docs:M(Ule)}).loose(),N({folder:ac(),frontmatter_local:dc(k(),ac()).nullable()}).loose(),N({path:k(),frontmatter:dc(k(),ac()).optional()}).loose(),N({applied:ac()}).loose();var t9=dc(k(),ac()).meta({description:`Free-form frontmatter map embedded in template payloads.`});N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:t9,body:k()}).strict()}).strict();var Wle=N({templates:M(N({name:k().min(1),title:k().optional(),description:k().optional(),path:k().min(1),source_folder:k()}).strict()),truncated:j()}).strict();N({folder:k(),name:k(),body:k().optional(),frontmatter:t9.optional(),...y3,summary:b3}).strict(),N({path:k().min(1),created:j(),warnings:M(k())}).strict(),N({existed:j(),path:k().min(1)}).strict(),N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:t9.optional(),...y3,summary:b3}).strict(),N({from:k().min(1),to:k().min(1),committed:j()}).strict();var n9=P(d0),Gle=/^[a-z0-9-]+$/,Kle=/^[A-Za-z0-9_-]+$/,r9=N({name:k(),description:k()}).strict();N({skill:N({name:k().min(1),scope:n9,path:k().min(1),frontmatter:r9,body:k(),files:M(N({path:k().min(1),text:k().nullable()})).optional()}).strict()}).strict();var qle=N({skills:M(N({name:k().min(1),description:k().optional(),scope:n9,path:k().min(1),absolutePath:k().min(1).optional(),installed:j(),hosts:M(k()),installedVersion:k().optional(),bundledVersion:k().optional(),updateAvailable:j().optional()}).strict()),truncated:j()}).strict();N({scope:n9.default(`project`),name:k(),body:k().optional(),frontmatter:r9,...y3,summary:b3}).strict(),N({path:k().min(1),created:j(),warnings:M(k())}).strict(),N({scope:n9.default(`project`),name:k(),...y3,summary:b3}).strict(),N({name:k().min(1),version:k().min(1),previousVersion:k().optional(),checkpointRef:k().optional()}).strict(),N({existed:j(),path:k().min(1)}).strict(),N({scope:n9.default(`project`),fromName:k(),toName:k(),body:k().optional(),frontmatter:r9.optional(),...y3,summary:b3}).strict(),N({from:k().min(1),to:k().min(1),committed:j()}).strict();var i9=P([`reference`,`script`]);N({scope:n9.default(`project`),name:k(),path:k().min(1),content:k(),...y3,summary:b3}).strict(),N({path:k().min(1),created:j(),kind:i9,content:j()}).strict(),N({path:k().min(1),kind:i9,text:k()}).strict(),N({path:k().min(1),existed:j(),kind:i9}).strict(),N({scope:n9.default(`project`),name:k(),targets:M(e9).optional().meta({description:`Explicit editor ids to install into; omit to use project-configured editors.`}),...y3,summary:b3}).strict(),N({name:k().min(1),hosts:M(k()),scripts:j(),warnings:M(k()),warningCodes:M(P([`no-targets`,`scripts-present`]))}).strict(),N({scope:n9.default(`project`),name:k()}).strict(),N({name:k().min(1),uninstalled:j()}).strict();var Jle=N({targets:M(e9),configured:j()}).strict();N({targets:M(e9)}).strict(),N({targets:M(e9),reprojected:M(N({name:k(),hosts:M(k())}).strict()),bundleHosts:M(k()),removedFrom:M(k())}).strict(),N({scope:n9.default(`project`),name:k(),version:k().regex(/^[0-9a-f]{40}$/i),...y3,summary:b3}).strict(),N({name:k().min(1),version:k(),restoredFiles:M(k()),warnings:M(k())}).strict(),N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:P([`navigation`,`relevance`]).optional(),scopes:M(P([`page`,`folder`,`content`,`file`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional(),source:P([`omnibar`,`mcp`,`http`]).optional()}).loose();var Yle=N({kind:P([`page`,`folder`,`content`,`file`]),path:k().min(1),title:k(),score:A(),signals:dc(k(),ac()),snippet:k().optional()}).loose(),Xle=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose();N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),keyHint:k().nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(Yle),elapsedMs:A().nonnegative(),semantic:Xle.optional(),truncated:j().optional(),ready:j().optional()}).loose();var Zle=N({version:k().min(1),recordedAt:k().min(1)}).loose();N({currentVersion:k().min(1),targets:dc(k(),Zle.nullable())}).loose();var Qle=`server-info`,$le=`branch-switched`,eue=`disk-ack`,tue=`config-validation-rejected`,nue=`config-ignore-nested-error`,a9=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),rue=N({v:F(1),ch:F(Qle),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),iue=N({v:F(1),ch:F($le),seq:A(),branch:k().min(1)}).loose(),aue=N({v:F(1),ch:a9,seq:A()}).loose(),oue=N({v:F(1),ch:F(eue),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),sue=N({v:F(1),ch:F(tue),seq:A(),docName:k().min(1),error:uu}).loose(),cue=N({v:F(1),ch:F(nue),seq:A(),path:k().min(1),error:k().min(1)}).loose();function lue(e){let t;try{t=new URL(e)}catch{return null}let n=t.pathname.match(/^\/video\/(\d+)/);if(n)return n[1]??null;let r=t.pathname.match(/^\/(\d+)/);return r?r[1]??null:null}function uue(e){if(typeof e!=`string`||e.length===0)return e;let t=t8(e);if(t){let e=t.noCookie?`www.youtube-nocookie.com`:`www.youtube.com`,n=t.startSeconds===null?``:`?start=${t.startSeconds}`;return`https://${e}/embed/${t.id}${n}`}if($6(e)){let t=lue(e);return t?`https://player.vimeo.com/video/${t}`:e}let n=Z6(e);if(n){let e=n.startRaw===null?``:`?t=${n.startRaw}`;return`https://www.loom.com/embed/${n.id}${e}`}return e}var due=`https://api.github.com/repos/inkeep/open-knowledge`;async function fue(e){let{signal:t,...n}=e??{},r=t?AbortSignal.any([AbortSignal.timeout(5e3),t]):AbortSignal.timeout(5e3);try{let e=await fetch(due,{headers:{accept:`application/vnd.github+json`,"user-agent":`openknowledge.ai`},...n,signal:r});if(!e.ok)return console.warn(`[github-stars] GitHub API responded ${e.status}`),null;let t=await e.json();return typeof t.stargazers_count==`number`?t.stargazers_count:null}catch(e){return console.warn(`[github-stars] fetch failed: ${e instanceof Error?e.message:String(e)}`),null}}function pue(e){if(!e)return{height:null,viewerFragment:``};let t=e.split(`&`).filter(e=>e.length>0),n=null,r=[];for(let e of t){let t=e.indexOf(`=`);if(t===-1){r.push(e);continue}let i=e.slice(0,t),a=e.slice(t+1);if(i===`height`){let e=Number.parseInt(a,10);!Number.isNaN(e)&&e>0&&(n=e);continue}r.push(e)}return{height:n,viewerFragment:r.join(`&`)}}new O1.default;var mue=new O1.default;mue.Diff_Timeout=.25;var hue=N({path:M(lc([k(),A()])),message:k(),issueCode:k()});uc(`code`,[N({code:F(`SCHEMA_INVALID`),issues:M(hue)}),N({code:F(`WRITE_ERROR`),detail:k()})]);function gue(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function _ue(e){if(e.code!==`SCHEMA_INVALID`)return{};let t={};for(let n of e.issues){let e=n.path[0];typeof e==`string`&&(t[e]=t[e]?`${t[e]}; ${n.message}`:n.message)}return t}var vue={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function yue(e){if(e.trim()===``)return{doc:new dn({}),map:{}};let t;try{t=_r(e)}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new dn({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=W7.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function bue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function o9(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=C(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(bue(n)){let r=e.createNode(n),i=b(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function xue(e){return e===``?``:`---\n${e.endsWith(`
|
|
549
|
+
`)?e.slice(0,-1):e}\n---\n`}var s9=65536;function c9(e){let t=e.match(J0);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function Sue(e){if(e.trim()===``)return{doc:new dn({}),map:{}};let t;try{t=_r(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new dn({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=W7.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function l9(e){return e===``?{doc:new dn({}),map:{}}:Sue(Z0(e))}function u9(e){let{fenced:t}=c9(e),{map:n,parseError:r}=l9(t);return{map:n??{},parseError:r}}function d9(e){let{fenced:t}=c9(e);if(t===``)return[];let{doc:n,map:r}=l9(t);return r===null?[]:h9(n)}function f9(e){return typeof e==`object`&&!!e&&`key`in e}function p9(e){let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}function m9(e,t){let n=e.key;if(typeof n==`string`){e.key=t;return}if(n&&typeof n==`object`){n.value=t;return}e.key=t}function h9(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!f9(e))continue;let t=p9(e);t!==null&&n.push(t)}return n}function g9(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function Cue(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:xue(e.toString(vue))}function wue(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:s9}:null}function _9(e){let t=Cue(e),n=wue(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function Tue(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:z7}};let{doc:n,map:r}=l9(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{g9(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=H7.safeParse(r);if(!t.success)return{ok:!1,error:{kind:`invalid_value`,key:e,reason:t.error.issues[0]?.message??`invalid value`}};n.set(e,o9(n,n.get(e,!0),t.data))}return _9(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Eue(e,t,n,r={}){if(t===`frontmatter`||n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:z7}};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(t===n)return{ok:!0,nextFenced:e};let o=i.contents;if(!o||!(`items`in o)||!Array.isArray(o.items))return{ok:!1,error:{kind:`unknown_key`,key:t}};let s=o.items.find(e=>f9(e)&&p9(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>f9(e)&&e!==s&&p9(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return m9(s,n),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function v9(e,t){let{doc:n,map:r}=l9(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let i=n.contents;if(!i||!(`items`in i)||!Array.isArray(i.items))return{ok:!0,nextFenced:e};let a=h9(n);if(a.length!==t.length||!y9(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(f9),r=[];for(let n of t){let i=e.findIndex(e=>p9(e)===n);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};let[o]=e.splice(i,1);o&&r.push(o)}return i.items=r,_9(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function y9(e,t){let n=new Map;for(let t of e)n.set(t,(n.get(t)??0)+1);for(let e of t){let t=(n.get(e)??0)-1;if(t<0)return!1;n.set(e,t)}for(let e of n.values())if(e!==0)return!1;return!0}function b9(e){if(e.length===0)return{kind:`invalid_path`,path:[...e],reason:`path must have at least one segment`};for(let t=0;t<e.length;t++){let n=e[t];if(typeof n!=`string`&&typeof n!=`number`)return{kind:`invalid_path`,path:[...e],reason:`path segment at index ${t} must be string or number`};if(typeof n==`number`&&(!Number.isInteger(n)||n<0))return{kind:`invalid_path`,path:[...e],reason:`numeric path segment at index ${t} must be a non-negative integer`}}return e[0]===`frontmatter`?{kind:`reserved_key`,key:z7}:null}function Due(e,t,n){let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=H7.safeParse(n);if(!o.success)return{ok:!1,error:{kind:`invalid_value`,key:String(t[t.length-1]),reason:o.error.issues[0]?.message??`invalid value`}};try{return g9(i),i.setIn(t,o9(i,i.getIn(t,!0),o.data)),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Oue(e,t){let n=b9(t);if(n)return{ok:!1,error:n};let{doc:r,map:i}=l9(e);if(i===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{return r.getIn(t,!0)===void 0?{ok:!0,nextFenced:e}:(r.deleteIn(t),_9(r))}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function kue(e,t){if(t.length===0){let t=e.contents;return b(t)?t:null}let n=e.getIn(t,!0);return b(n)?n:null}function Aue(e,t,n,r={}){let i=b9(t);if(i)return{ok:!1,error:i};let a=t[t.length-1];if(typeof a!=`string`)return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot rename: last path segment must be a string (map key)`}};if(t.length===1&&n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:z7}};let{doc:o,map:s}=l9(e);if(s===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(a===n)return{ok:!0,nextFenced:e};let c=kue(o,t.slice(0,-1));if(!c)return{ok:!1,error:{kind:`unknown_key`,key:a}};let l=c.items.find(e=>f9(e)&&p9(e)===a);if(!l)return{ok:!1,error:{kind:`unknown_key`,key:a}};if(!r.allowDuplicate&&c.items.some(e=>f9(e)&&e!==l&&p9(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return m9(l,n),_9(o)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function jue(e,t,n){if(t.length===0)return v9(e,n);let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!b(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a map`}};let s=[];for(let e of o.items){if(!f9(e))continue;let t=p9(e);t!==null&&s.push(t)}if(s.length!==n.length||!y9(s,n))return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};try{let e=o.items.filter(f9),t=[];for(let r of n){let i=e.findIndex(e=>p9(e)===r);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};let[a]=e.splice(i,1);a&&t.push(a)}return o.items=t,_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Mue(e,t,n){let r=b9(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=l9(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!C(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a sequence`}};let s=o,c=s.items.length,l=Array.from({length:c},(e,t)=>t),u=[...n];if(!Nue(u,c))return{ok:!1,error:{kind:`reorder_mismatch`,expected:l.map(String),got:u.map(String)}};try{let e=s.items.slice();return s.items=u.map(t=>e[t]),_9(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Nue(e,t){if(e.length!==t)return!1;let n=Array(t).fill(!1);for(let r of e){if(!Number.isInteger(r)||r<0||r>=t||n[r])return!1;n[r]=!0}return!0}var Pue=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function x9(e){return{ok:!1,error:e}}function Fue(e){return{ok:!0,...e}}function Iue(e){return{ok:!0,...e}}function Lue(e){return{ok:!0,...e}}function S9(e){return{ok:!0,...e}}function C9(e){switch(e.kind){case`unknown_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`unknown key '${e.key}'`,issueCode:`unknown_key`}]};case`duplicate_target`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`key '${e.key}' already exists`,issueCode:`duplicate_target`}]};case`invalid_value`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:e.reason,issueCode:`invalid_value`}]};case`reserved_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`'${e.key}' is a reserved frontmatter key`,issueCode:`reserved_key`}]};case`reorder_mismatch`:return{code:`WRITE_ERROR`,detail:`reorder list does not match current keys (state changed mid-drag)`};case`region_too_large`:return{code:`SCHEMA_INVALID`,issues:[{path:[],message:`Frontmatter region exceeds ${s9}-byte limit (would be ${e.bytes})`,issueCode:`region_too_large`}]};case`parse_failed`:return{code:`WRITE_ERROR`,detail:`Frontmatter YAML is malformed; fix in source mode to commit (${e.reason})`};case`invalid_path`:return{code:`SCHEMA_INVALID`,issues:[{path:[...e.path],message:e.reason,issueCode:`invalid_path`}]}}}function Rue(e,t){if(e.parseError!==t.parseError||e.keys.length!==t.keys.length)return!1;for(let n=0;n<e.keys.length;n++)if(e.keys[n]!==t.keys[n])return!1;for(let n of e.keys)if(!G7(e.map[n],t.map[n]))return!1;return!0}var zue=5;function w9(e){let t=e.toString();return{snapshot:Bue(t),raw:t}}function Bue(e){let{map:t,parseError:n}=u9(e);return{map:t,keys:d9(e),parseError:n}}function T9(e){return e.startsWith(`---`)}function Vue(e){let t=e.document,n=t.getText(`source`),r=new Set,i=w9(n),a=i.snapshot,o=c9(i.raw).fenced,s=T9(i.raw),c=!1;function l(e=!1){if(c)return;let t,i;try{let e=w9(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!e&&Rue(a,t)){s=T9(i);return}a=t,o=c9(i).fenced,s=T9(i);for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}let u=e=>{c||Hue(e,o.length,s)&&l()};n.observe(u),e.on(`synced`,d);function d(){l(!0)}function f(e){let r;return t.transact(()=>{let{fenced:t}=c9(n.toString());r=e(t),r.ok&&r.nextFenced!==t&&(n.delete(0,t.length),r.nextFenced!==``&&n.insert(0,r.nextFenced))},Pue),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function p(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,`frontmatter`))return x9({code:`SCHEMA_INVALID`,issues:[{path:[z7],message:`'${z7}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=Jce.safeParse(e);if(!t.success)return x9({code:`SCHEMA_INVALID`,issues:t.error.issues.map(gue)});let n=t.data,r=Object.keys(n),i=f(e=>Tue(e,n));return i.ok?Fue({appliedKeys:r}):x9(C9(i.error))}function m(e,t,n={}){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>Eue(r,e,t,n));return r.ok?Iue({oldKey:e,newKey:t}):x9(C9(r.error))}function h(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>v9(t,e));return t.ok?Lue({orderedKeys:[...e]}):x9(C9(t.error))}function g(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>Due(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}function _(e){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>Oue(t,e));return t.ok?S9({path:[...e]}):x9(C9(t.error))}function v(e,t,n={}){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>Aue(r,e,t,n));return r.ok?S9({path:[...e]}):x9(C9(r.error))}function y(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>jue(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}function b(e,t){if(c)return x9({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>Mue(n,e,t));return n.ok?S9({path:[...e]}):x9(C9(n.error))}return{current(){return w9(n).snapshot},patch(e){return p(e)},rename(e,t,n){return m(e,t,n)},reorder(e){return h(e)},patchPath(e,t){return g(e,t)},deletePath(e){return _(e)},renamePath(e,t,n){return v(e,t,n)},reorderPath(e,t){return y(e,t)},reorderSeqPath(e,t){return b(e,t)},subscribe(e){return r.add(e),()=>{r.delete(e)}},dispose(){c||(c=!0,n.unobserve(u),e.off(`synced`,d),r.clear())}}}function Hue(e,t,n){if(t===0&&n)return!0;let r=t>0?t:zue,i=0;for(let t of e.delta){if(typeof t.retain==`number`){i+=t.retain;continue}if(typeof t.insert==`string`){if(i<r)return!0;i+=t.insert.length;continue}if(t.insert!==void 0){if(i<r)return!0;i+=1;continue}if(typeof t.delete==`number`&&i<r)return!0}return!1}var Uue=new O1.default;Uue.Match_Threshold=.5;var E9=/^[a-zA-Z0-9][\w/-]*$/;function Wue(e){if(typeof e!=`string`)return!1;let t=e.startsWith(`#`)?e.slice(1):e;return E9.test(t)}var Gue=`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`;function Kue(e){return e.startsWith(`#`)?e.slice(1):e}function que(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Jue(e){if(!e||e.trim()===``)return[];let{map:t}=yue(e);if(!t)return[];let n=que(t.tags),r=[];for(let e of n){let t=Kue(e);E9.test(t)&&r.push(t)}return r}var Yue=P(d0),Xue=sc({hosts:M(k()),scope:Yue,scripts:j(),installedAt:Ks()});sc({schema:F(1),skills:dc(k(),Xue).default({})});var Zue=100,Que=500,$ue=450,ede={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},D9=new WeakMap;function tde(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function O9(e){return e.trim().toLowerCase()}var nde=/\.(?:md|mdx)$/;function rde(e,t){if(t!==`page`)return e;let n=e.replace(nde,``);return n.length>0?n:e}function k9(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function ide(e){let t=k9(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function A9(e){let t=R$({schema:ede});return e.length>0&&Y$(t,e),t}function ade(e){let t={documents:e};return D9.set(t,A9(e)),t}function ode(e){let t=D9.get(e);if(t)return t;let n=A9(e.documents);return D9.set(e,n),n}function sde(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function j9(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function cde(e,t){let n=O9(t);if(!n)return 0;let r=rde(n,e.kind),i=O9(e.title),a=O9(e.name),o=O9(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}var lde=.5;function M9(e,t){let n=cde(e,t);return n<=0?n:g3(e.path)?n*lde:n}var ude=60;function dde(e){return e===`file`?-ude:0}var fde=1e3,N9=50,pde=1,mde=1,hde=.001;function gde(e,t,n,r,i){let a=i>0?t/i:0,o=N9>0?n/N9:0,s=r===`file`?-hde:0,c=pde*a+mde*o+s;return e*fde+c}function P9(e,t,n,r){return e+t*20+n+dde(r)}function F9(e,t,n,r,i,a){return e===`relevance`?P9(t,n,r,i):gde(t,n,r,i,a)}function _de(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function I9(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function vde(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 yde(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function bde(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 xde(e,t){return O9(t).length<4?0:+(e===`full_text`)}function Sde(e){let{lexical:t,fullText:n}=e.signals;return t>=Que?`lexical`:t===$ue&&n<=0?`pathOnly`:`body`}function Cde(e){let t=[],n=[],r=[];for(let i of e){let e=Sde(i);e===`lexical`?t.length<Zue&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function L9(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=Cde(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function wde(e,t,n={}){let r=n.intent??`omnibar`,i=_de(r,n.ranking),a=tde(n.limit),o=new Set(n.scopes??sde(r)),s=e.documents.filter(e=>j9(e,o)),c=O9(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=T1(ode(e),{term:c,properties:yde(r),boost:bde(r),tolerance:xde(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>j9(e.document,o)).map(e=>[e.document.id,e.score])),d=vde(s),f=new Map;for(let e of s)M9(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)j9(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=I9(f.values(),u);return L9([...f.values()].map(t=>{let n=Math.max(0,M9(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:F9(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return L9(Tde({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function R9(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function Tde(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=I9(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,M9(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?F9(o,t,n,s,e.kind,m):P9(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=R9(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=R9(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=+(e.lexical>0),r=+(t.lexical>0);if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function Ede(e){return`https://github.com/${e.owner}/${e.repo}.git`}function Dde(e,t){return!e||e.length===0?`true`:t.detached?`detached`:t.currentBranch===null||t.currentBranch===e?`true`:`false`}var z9=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),B9=globalThis;B9[z9]===void 0&&(B9[z9]=So());var V9=B9[z9],H9=sc({version:k().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(V9,{description:`Recorded skill version for this target.`}),recordedAt:Ks().register(V9,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(V9,{description:`Install-source surface that recorded this entry.`}).optional()}),Ode=sc({enabled:j().register(V9,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Ks().register(V9,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});sc({schema:F(1).register(V9,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:sc({"claude-cowork":H9.optional(),"cli-hosts":H9.optional()}).register(V9,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:dc(k(),Ode).register(V9,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional()});var U9=class extends Error{chunksCompleted;totalChunks;bytesWritten;bytesRemaining;cause;constructor(e,t){let n=e instanceof Error?e.message:typeof e==`string`?e:`unknown error`;super(`chunked insert failed after ${t.chunksCompleted}/${t.totalChunks} chunks (${t.bytesWritten} bytes written, ${t.bytesRemaining} bytes lost): ${n}`),this.name=`ChunkedInsertError`,this.chunksCompleted=t.chunksCompleted,this.totalChunks=t.totalChunks,this.bytesWritten=t.bytesWritten,this.bytesRemaining=t.bytesRemaining,this.cause=e}};async function kde(e,t,n,r,i={}){let a=i.thresholdBytes??512e3,o=i.chunkSizeBytes??51200,s=i.origin,c=i.yieldFn??Ade,l=i.resolveOffset??(e=>e);if(r.length<=a){e.transact(()=>{t.insert(n,r)},s);return}let u=Math.ceil(r.length/o),d=0,f=n,p=0,m=0;for(;d<r.length;){let n=Math.min(d+o,r.length),i=r.slice(d,n);try{let n=l(f);e.transact(()=>{t.insert(n,i)},s)}catch(e){throw new U9(e,{chunksCompleted:p,totalChunks:u,bytesWritten:m,bytesRemaining:r.length-d})}p++,m+=i.length,f+=i.length,d=n,d<r.length&&await c()}}function Ade(){return new Promise(e=>{let t=globalThis;t.document?.hidden!==!0&&typeof t.requestAnimationFrame==`function`?t.requestAnimationFrame(()=>e()):setTimeout(()=>e(),0)})}function jde(){let e=!1,t=``,n=0;return r=>{let i=Mde(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 Mde(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}var Nde=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],Pde={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`},Fde={cursor:`#FFFFFF`,windsurf:`#FFFFFF`},W9=[`#f0ece3`,`#fff5e1`,`#f9e1db`,`#f5def7`,`#ece2fb`,`#dce8fa`,`#DBF3FB`];function Ide(e,t=Nde){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}function Lde(e){let t=e.trim();if(!t)return`?`;let n=t.split(/[-\s]+/).filter(Boolean);if(!n.length)return`?`;if(n.length>=2)return n.slice(0,2).map(e=>e[0]??``).join(``).toUpperCase();let r=n[0],i=[r[0]];for(let e=1;e<r.length&&i.length<2;e++){let t=r[e-1],n=r[e];t===t.toLowerCase()&&n===n.toUpperCase()&&n!==n.toLowerCase()&&i.push(n)}return i.length>=2?i.join(``).toUpperCase():r.slice(0,2).toUpperCase()}function Rde(e){let t=e.trim();if(!t)return e;if(t.includes(` `)||!/[-_]/.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);return n.length?n.map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):t}var zde={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function Bde(e){return e?zde[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}function Vde(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2;if(i===a)return[0,0,o*100];let s=i-a,c=o>.5?s/(2-i-a):s/(i+a),l;return l=i===t?((n-r)/s+(n<r?6:0))/6:i===n?((r-t)/s+2)/6:((t-n)/s+4)/6,[l*360,c*100,o*100]}function Hde(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function Ude(e){let[t]=Vde(e);return Hde(t,45,32)}var Wde=[`Curious`,`Brave`,`Clever`,`Swift`,`Gentle`,`Bright`,`Wise`,`Bold`,`Calm`,`Keen`],Gde=[`Bird`,`Cat`,`Dog`,`Fish`,`Mouse`,`Rabbit`,`Shrimp`,`Snail`,`Squirrel`,`Turtle`],G9=`ok-user-name-v3`,K9=`ok-user-color-v3`;function q9(e){return e[Math.floor(Math.random()*e.length)]}function Kde(){return`${q9(Wde)} ${q9(Gde)}`}function qde(){return q9(W9)}function J9(e){try{return localStorage.getItem(e)}catch{return null}}function Y9(e,t){try{localStorage.setItem(e,t)}catch{}}function Jde(){let e=new URLSearchParams(window.location.search).get(`coeditor`)||`standalone`,t=crypto.randomUUID(),n=J9(G9),r=J9(K9);return n||(n=Kde(),Y9(G9,n)),r||(r=qde(),Y9(K9,r)),{name:n,color:r,coeditor:e,tabId:t}}function Yde(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}function Xde(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}var X9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Z9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function Q9(e){return e.split(`/`).filter(Boolean)}function $9(e){let t=e.trim();return X9.test(t)||t.startsWith(`//`)}function Zde(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if($9(n))return{kind:`external`,url:n};let r=Yde(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=Z9(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function Qde(e,t){let n=e.trim();if(!n)return null;if($9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=Z9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function $de(e,t){let n=e.trim();if(!n||X9.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function efe(e,t,n=null,r=`.md`){let i=Q9(e);i.pop();let a=Q9(t),o=0;for(;o<i.length&&o<a.length&&i[o]===a[o];)o+=1;let s=i.slice(o).map(()=>`..`),c=a.slice(o),l=[...s,...c].join(`/`);return l||=a.at(-1)??t,!l.startsWith(`./`)&&!l.startsWith(`../`)&&(l=`./${l}`),`${l}${r}${n?`#${n}`:``}`}function tfe(e){return e.replace(/[/\\:*?"<>|\0]/g,`-`).replace(/\s+/g,` `).replace(/-+/g,`-`).trim().replace(/^[-.\s]+|[-.\s]+$/g,``)}export{d0 as $,Ol as $i,E0 as $n,yT as $r,kde as $t,ele as A,K_ as Ai,f7 as An,uue as Ar,Jle as At,W9 as B,uf as Bi,Mae as Bn,E7 as Br,c4 as Bt,Ole as C,Ry as Ci,n0 as Cn,L1 as Cr,i0 as Ct,Fle as D,av as Di,_ue as Dn,d9 as Dr,O3 as Dt,T0 as E,Dx as Ei,Jue as En,m0 as Er,k3 as Et,t0 as F,ip as Fi,Jde as Fn,_0 as Fr,Z2 as Ft,r2 as G,Uc as Gi,Dae as Gn,k9 as Gr,Vue as Gt,gle as H,I as Hi,wae as Hn,Z0 as Hr,a3 as Ht,Y0 as I,ap as Ii,i4 as In,X0 as Ir,Wle as It,cle as J,tl as Ji,Cae as Jn,CD as Jr,p3 as Jt,w0 as K,Xc as Ki,Aae as Kn,Are as Kr,X1 as Kt,Gue as L,cp as Li,r0 as Ln,u4 as Lr,Ile as Lt,kle as M,R as Mi,G7 as Mn,wde as Mr,Kle as Mt,O0 as N,Tp as Ni,fue as Nn,l4 as Nr,d3 as Nt,a9 as O,l_ as Oi,K0 as On,u9 as Or,M3 as Ot,j0 as P,Op as Pi,Tce as Pn,o3 as Pr,f3 as Pt,u0 as Q,qc as Qi,f2 as Qn,Vw as Qr,Ede as Qt,E9 as R,ef as Ri,Bie as Rn,t2 as Rr,V3 as Rt,z0 as S,Nv as Si,yce as Sn,pue as Sr,Gle as St,lce as T,Wx as Ti,Z9 as Tn,t8 as Tr,w3 as Tt,Zoe as U,Gu as Ui,Tae as Un,D7 as Ur,Xde as Ut,M6 as V,Id as Vi,Nae as Vn,R1 as Vr,fle as Vt,n2 as W,L as Wi,jae as Wn,b4 as Wr,W1 as Wt,mce as X,el as Xi,kae as Xn,TD as Xr,m4 as Xt,mle as Y,Vl as Yi,Oae as Yn,ED as Yr,f4 as Yt,fce as Z,Zc as Zi,qce as Zn,oT as Zr,efe as Zt,a0 as _,k as _a,Xy as _i,v8 as _n,t7 as _r,w2 as _t,Cle as a,wl as aa,gb as ai,G0 as an,F0 as ar,hle as at,S0 as b,ti as ba,Nx as bi,Ude as bn,Z6 as br,s2 as bt,nle as c,du as ca,Gx as ci,D4 as cn,Wue as cr,A0 as ct,sue as d,Wl as da,Ty as di,T4 as dn,x0 as dr,z3 as dt,Jc as ea,TT as ei,Dde as en,$9 as er,w7 as et,aue as f,Zl as fa,Ey as fi,K4 as fn,Uce as fr,B3 as ft,c0 as g,N as ga,Jy as gi,jde as gn,W0 as gr,_ce as gt,k1 as h,F as ha,zy as hi,Lde as hn,Z1 as hr,z7 as ht,Sle as i,Ml as ia,Kb as ii,M1 as in,f0 as ir,P0 as it,$ce as j,dp as ji,Rde as jn,tfe as jr,qle as jt,Q7 as k,f_ as ki,gce as kn,$de as kr,e9 as kt,iue as l,gl as la,Cy as li,E4 as ln,$6 as lr,Mle as lt,rue as m,lte as ma,rb as mi,S4 as mn,Vie as mr,P1 as mt,Fde as n,Ul as na,wx as ni,Qde as nn,g3 as nr,C2 as nt,N1 as o,Il as oa,qx as oi,Ide as on,l2 as or,L0 as ot,oue as p,jl as pa,nb as pi,w4 as pn,Bce as pr,F1 as pt,p2 as q,Kl as qi,Eae as qn,Ere as qr,d4 as qt,D0 as r,Hc as ra,lx as ri,j1 as rn,Q6 as rr,x4 as rt,rle as s,mu as sa,Jx as si,J4 as sn,c2 as sr,R0 as st,Pde as t,nl as ta,gT as ti,Zde as tn,Yce as tr,Jse as tt,cue as u,_l as ua,Mx as ui,C4 as un,bce as ur,Ale as ut,s0 as v,vee as va,Zy as vi,ade as vn,n4 as vr,Ple as vt,Dle as w,yb as wi,o4 as wn,r4 as wr,R3 as wt,U9 as x,ny as xi,N0 as xn,y0 as xr,p0 as xt,o0 as y,yee as ya,_b as yi,ide as yn,g0 as yr,a2 as yt,ale as z,df as zi,Bde as zn,uce as zr,a4 as zt};
|