@nuasite/cms-studio 0.47.5 → 0.48.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.
@@ -1,4 +1,4 @@
1
- var iE=t=>{throw TypeError(t)};var sE=(t,e,n)=>e.has(t)||iE("Cannot "+n);var tt=(t,e,n)=>(sE(t,e,"read from private field"),n?n.call(t):e.get(t)),Ut=(t,e,n)=>e.has(t)?iE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),su=(t,e,n,r)=>(sE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function VT(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r1={exports:{}},Gc={};var aE;function U4(){if(aE)return Gc;aE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var u in i)u!=="key"&&(s[u]=i[u])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return Gc.Fragment=e,Gc.jsx=n,Gc.jsxs=n,Gc}var oE;function J4(){return oE||(oE=1,r1.exports=U4()),r1.exports}var I=J4();const q4=409;class Ci extends Error{constructor(e,n,r){super(r),this.status=e,this.code=n,this.name="CmsClientError"}get isUnauthorized(){return this.code==="unauthorized"||this.status===401}get isForbidden(){return this.code==="forbidden"||this.status===403}get isNotFound(){return this.code==="not_found"||this.status===404}}function lE(t){return ch(t)&&typeof t.error=="string"&&typeof t.code=="string"}function ch(t){return typeof t=="object"&&t!==null}function H4(t){return ch(t)?t.code==="conflict"&&typeof t.serverHash=="string"&&ch(t.serverFrontmatter):!1}const K4=["not_found","conflict","validation","parse_error","io_error","unsupported","unauthorized"];function G4(t){return K4.includes(t)}function uE(t){return t instanceof Ci&&(t.status===501||t.code==="unsupported")}function Y4(t){const e=t.endsWith("/")?t.slice(0,-1):t;async function n(h){const d=await fetch(`${e}${h}`,{method:"GET",credentials:"include",headers:{accept:"application/json"}});if(!d.ok)throw await r(d);return await d.json()}async function r(h){const d=await h.json().catch(()=>null);return s(h.status,d)}function i(h,d){if(lE(h))return h.error;if(ch(h)){const g=h.error;if(ch(g)&&typeof g.message=="string")return g.message}return d}function s(h,d){return h===403?new Ci(403,"forbidden",i(d,"You do not have access to this project.")):lE(d)&&G4(d.code)?new Ci(h,d.code,d.error):h===401?new Ci(401,"unauthorized","Your session has expired. Please reload."):new Ci(h,"unknown",i(d,`Request failed (${h})`))}function o(h,d){const g={method:h,credentials:"include",headers:{accept:"application/json"}};return d!==void 0&&(g.body=JSON.stringify(d),g.headers={accept:"application/json","content-type":"application/json"}),g}async function u(h,d,g){const y=await fetch(`${e}${h}`,o(d,g));if(!y.ok)throw await r(y);return await y.json()}function c(h,d){return`/collections/${encodeURIComponent(h)}/entries/${encodeURIComponent(d)}`}return{getProject(){return n("/project")},getConfig(){return n("/config")},getCollections(){return n("/collections")},getComponents(){return n("/components")},getEntries(h,d={}){const g=new URLSearchParams;d.fields!==void 0&&g.set("fields",d.fields),d.draft!==void 0&&g.set("draft",d.draft),d.cursor!==void 0&&g.set("cursor",d.cursor),d.limit!==void 0&&g.set("limit",String(d.limit));const y=g.toString(),b=y===""?"":`?${y}`;return n(`/collections/${encodeURIComponent(h)}/entries${b}`)},getEntry(h,d){return n(c(h,d))},async updateEntry(h,d,g){const y=await fetch(`${e}${c(h,d)}`,o("PATCH",g));if(y.status===q4){const k=await y.json().catch(()=>null);if(H4(k))return{status:"conflict",conflict:k};throw s(y.status,k)}if(!y.ok)throw await r(y);return{status:"ok",result:await y.json()}},createEntry(h,d){return u(`/collections/${encodeURIComponent(h)}/entries`,"POST",d)},deleteEntry(h,d){return u(c(h,d),"DELETE")},renameEntry(h,d,g){return u(`${c(h,d)}/rename`,"POST",{to:g})},addArrayItem(h,d,g,y,b){const k=b===void 0?{field:g,value:y}:{field:g,value:y,index:b};return u(`${c(h,d)}/array`,"POST",k)},removeArrayItem(h,d,g,y){return u(`${c(h,d)}/array`,"DELETE",{field:g,index:y})},listMedia(h={}){const d=new URLSearchParams;h.folder!==void 0&&d.set("folder",h.folder),h.cursor!==void 0&&d.set("cursor",h.cursor),h.limit!==void 0&&d.set("limit",String(h.limit));const g=d.toString();return n(`/media${g===""?"":`?${g}`}`)},async uploadMedia(h,d={}){const g=new URLSearchParams;d.collection!==void 0&&g.set("collection",d.collection),d.entry!==void 0&&g.set("entry",d.entry),d.field!==void 0&&g.set("field",d.field),d.folder!==void 0&&g.set("folder",d.folder);const y=g.toString(),b=new FormData;b.append("file",h);const k=await fetch(`${e}/media${y===""?"":`?${y}`}`,{method:"POST",credentials:"include",headers:{accept:"application/json"},body:b});if(!k.ok)throw await r(k);return await k.json()},mediaFileUrl(h,d,g){return`${e}${c(h,d)}/asset?path=${encodeURIComponent(g)}`},mediaAssetUrl(h){return`${e}/asset?path=${encodeURIComponent(h)}`},deleteMedia(h){return u(`/media/${encodeURIComponent(h)}`,"DELETE")},createFolder(h){return u("/media","POST",{folder:h})}}}function Q4(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function FT(t,e){switch(t){case"boolean":return e==="true"||e==="1"||e.toLowerCase()==="yes";case"number":case"year":case"month":{const n=Number(e);return e.trim()===""||Number.isNaN(n)?e:n}case"date":case"datetime":case"time":return cE(e);case"array":case"object":return cE(e);default:return e}}function cE(t){const e=t.trim();if(e!==""){if(!(e.startsWith("{")||e.startsWith("[")||e.startsWith('"')))return t;try{return JSON.parse(e)}catch{return t}}}function W4(t,e){const n=new Map(e.map(i=>[i.name,i])),r={};for(const[i,s]of Object.entries(t.frontmatter)){const o=n.get(i);r[i]=o?FT(o.type,s.value):s.value}return{frontmatter:r,body:t.body}}function X4(t){const e={};for(const n of t)if(!n.hidden){if(n.defaultValue!==void 0){e[n.name]=n.defaultValue;continue}e[n.name]=PT(n.type)}return{frontmatter:e,body:""}}function PT(t){switch(t){case"boolean":return!1;case"array":return[];case"object":return{};case"date":case"datetime":case"time":case"month":return;default:return""}}function Z4(t,e,n){const r=new Map(n.map(s=>[s.name,s])),i={};for(const[s,o]of Object.entries(t)){const u=r.get(s);i[s]=u&&typeof o=="string"?FT(u.type,o):o}return{frontmatter:i,body:e??""}}function fS(t,e){switch(t){case"boolean":return e==="true";case"number":{if(e.trim()==="")return;const n=Number(e);return Number.isNaN(n)?e:n}case"year":case"month":{if(e.trim()==="")return;const n=Number(e);return Number.isNaN(n)?e:n}case"date":case"datetime":case"time":return e.trim()===""?void 0:e;default:return e}}function Ps(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function ez(t){return typeof t=="boolean"?t:typeof t=="string"?t==="true"||t==="1"||t.toLowerCase()==="yes":!!t}function tz(t){return Array.isArray(t)?t:[]}function nz(t){return Q4(t)?t:{}}function jT(t,e,n){return{...t,frontmatter:{...t.frontmatter,[e]:n}}}var i1={exports:{}},Ke={};var fE;function rz(){if(fE)return Ke;fE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function b(F){return F===null||typeof F!="object"?null:(F=y&&F[y]||F["@@iterator"],typeof F=="function"?F:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,N={};function M(F,ee,V){this.props=F,this.context=ee,this.refs=N,this.updater=V||k}M.prototype.isReactComponent={},M.prototype.setState=function(F,ee){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,ee,"setState")},M.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function j(){}j.prototype=M.prototype;function P(F,ee,V){this.props=F,this.context=ee,this.refs=N,this.updater=V||k}var U=P.prototype=new j;U.constructor=P,E(U,M.prototype),U.isPureReactComponent=!0;var L=Array.isArray;function C(){}var z={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function J(F,ee,V){var be=V.ref;return{$$typeof:t,type:F,key:ee,ref:be!==void 0?be:null,props:V}}function K(F,ee){return J(F.type,ee,F.props)}function de(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function ce(F){var ee={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(V){return ee[V]})}var Se=/\/+/g;function Re(F,ee){return typeof F=="object"&&F!==null&&F.key!=null?ce(""+F.key):ee.toString(36)}function Y(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(C,C):(F.status="pending",F.then(function(ee){F.status==="pending"&&(F.status="fulfilled",F.value=ee)},function(ee){F.status==="pending"&&(F.status="rejected",F.reason=ee)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function W(F,ee,V,be,De){var Me=typeof F;(Me==="undefined"||Me==="boolean")&&(F=null);var Xe=!1;if(F===null)Xe=!0;else switch(Me){case"bigint":case"string":case"number":Xe=!0;break;case"object":switch(F.$$typeof){case t:case e:Xe=!0;break;case d:return Xe=F._init,W(Xe(F._payload),ee,V,be,De)}}if(Xe)return De=De(F),Xe=be===""?"."+Re(F,0):be,L(De)?(V="",Xe!=null&&(V=Xe.replace(Se,"$&/")+"/"),W(De,ee,V,"",function(zt){return zt})):De!=null&&(de(De)&&(De=K(De,V+(De.key==null||F&&F.key===De.key?"":(""+De.key).replace(Se,"$&/")+"/")+Xe)),ee.push(De)),1;Xe=0;var Ct=be===""?".":be+":";if(L(F))for(var Ze=0;Ze<F.length;Ze++)be=F[Ze],Me=Ct+Re(be,Ze),Xe+=W(be,ee,V,Me,De);else if(Ze=b(F),typeof Ze=="function")for(F=Ze.call(F),Ze=0;!(be=F.next()).done;)be=be.value,Me=Ct+Re(be,Ze++),Xe+=W(be,ee,V,Me,De);else if(Me==="object"){if(typeof F.then=="function")return W(Y(F),ee,V,be,De);throw ee=String(F),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return Xe}function ue(F,ee,V){if(F==null)return F;var be=[],De=0;return W(F,be,"","",function(Me){return ee.call(V,Me,De++)}),be}function ke(F){if(F._status===-1){var ee=F._result;ee=ee(),ee.then(function(V){(F._status===0||F._status===-1)&&(F._status=1,F._result=V)},function(V){(F._status===0||F._status===-1)&&(F._status=2,F._result=V)}),F._status===-1&&(F._status=0,F._result=ee)}if(F._status===1)return F._result.default;throw F._result}var ze=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ee=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(ee))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)},D={map:ue,forEach:function(F,ee,V){ue(F,function(){ee.apply(this,arguments)},V)},count:function(F){var ee=0;return ue(F,function(){ee++}),ee},toArray:function(F){return ue(F,function(ee){return ee})||[]},only:function(F){if(!de(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return Ke.Activity=g,Ke.Children=D,Ke.Component=M,Ke.Fragment=n,Ke.Profiler=i,Ke.PureComponent=P,Ke.StrictMode=r,Ke.Suspense=c,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(F){return z.H.useMemoCache(F)}},Ke.cache=function(F){return function(){return F.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(F,ee,V){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var be=E({},F.props),De=F.key;if(ee!=null)for(Me in ee.key!==void 0&&(De=""+ee.key),ee)!G.call(ee,Me)||Me==="key"||Me==="__self"||Me==="__source"||Me==="ref"&&ee.ref===void 0||(be[Me]=ee[Me]);var Me=arguments.length-2;if(Me===1)be.children=V;else if(1<Me){for(var Xe=Array(Me),Ct=0;Ct<Me;Ct++)Xe[Ct]=arguments[Ct+2];be.children=Xe}return J(F.type,De,be)},Ke.createContext=function(F){return F={$$typeof:o,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:s,_context:F},F},Ke.createElement=function(F,ee,V){var be,De={},Me=null;if(ee!=null)for(be in ee.key!==void 0&&(Me=""+ee.key),ee)G.call(ee,be)&&be!=="key"&&be!=="__self"&&be!=="__source"&&(De[be]=ee[be]);var Xe=arguments.length-2;if(Xe===1)De.children=V;else if(1<Xe){for(var Ct=Array(Xe),Ze=0;Ze<Xe;Ze++)Ct[Ze]=arguments[Ze+2];De.children=Ct}if(F&&F.defaultProps)for(be in Xe=F.defaultProps,Xe)De[be]===void 0&&(De[be]=Xe[be]);return J(F,Me,De)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(F){return{$$typeof:u,render:F}},Ke.isValidElement=de,Ke.lazy=function(F){return{$$typeof:d,_payload:{_status:-1,_result:F},_init:ke}},Ke.memo=function(F,ee){return{$$typeof:h,type:F,compare:ee===void 0?null:ee}},Ke.startTransition=function(F){var ee=z.T,V={};z.T=V;try{var be=F(),De=z.S;De!==null&&De(V,be),typeof be=="object"&&be!==null&&typeof be.then=="function"&&be.then(C,ze)}catch(Me){ze(Me)}finally{ee!==null&&V.types!==null&&(ee.types=V.types),z.T=ee}},Ke.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ke.use=function(F){return z.H.use(F)},Ke.useActionState=function(F,ee,V){return z.H.useActionState(F,ee,V)},Ke.useCallback=function(F,ee){return z.H.useCallback(F,ee)},Ke.useContext=function(F){return z.H.useContext(F)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(F,ee){return z.H.useDeferredValue(F,ee)},Ke.useEffect=function(F,ee){return z.H.useEffect(F,ee)},Ke.useEffectEvent=function(F){return z.H.useEffectEvent(F)},Ke.useId=function(){return z.H.useId()},Ke.useImperativeHandle=function(F,ee,V){return z.H.useImperativeHandle(F,ee,V)},Ke.useInsertionEffect=function(F,ee){return z.H.useInsertionEffect(F,ee)},Ke.useLayoutEffect=function(F,ee){return z.H.useLayoutEffect(F,ee)},Ke.useMemo=function(F,ee){return z.H.useMemo(F,ee)},Ke.useOptimistic=function(F,ee){return z.H.useOptimistic(F,ee)},Ke.useReducer=function(F,ee,V){return z.H.useReducer(F,ee,V)},Ke.useRef=function(F){return z.H.useRef(F)},Ke.useState=function(F){return z.H.useState(F)},Ke.useSyncExternalStore=function(F,ee,V){return z.H.useSyncExternalStore(F,ee,V)},Ke.useTransition=function(){return z.H.useTransition()},Ke.version="19.2.7",Ke}var hE;function hS(){return hE||(hE=1,i1.exports=rz()),i1.exports}var ae=hS();function iz(t){const e={};for(const n of t.props)e[n.name]=n.defaultValue??"";return e}const sz={position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh",zIndex:1e3},az={width:"min(440px, 92vw)",maxHeight:"70vh",display:"flex",flexDirection:"column",background:"#fff",border:"1px solid #d4d4d8",borderRadius:10,boxShadow:"0 12px 32px rgba(0,0,0,0.18)",overflow:"hidden",fontSize:13},oz={border:"none",borderBottom:"1px solid #ececed",padding:"10px 12px",font:"inherit",outline:"none"},lz={textAlign:"left",border:"none",background:"transparent",padding:"8px 12px",cursor:"pointer",borderRadius:0};function uz({open:t,components:e,onInsert:n,onClose:r}){const[i,s]=ae.useState(""),o=ae.useMemo(()=>{const u=i.trim().toLowerCase();return e.filter(c=>u===""||c.name.toLowerCase().includes(u)||(c.description??"").toLowerCase().includes(u))},[e,i]);return t?I.jsx("div",{style:sz,onMouseDown:r,children:I.jsxs("div",{style:az,onMouseDown:u=>u.stopPropagation(),children:[I.jsx("input",{style:oz,placeholder:"Search components…",autoFocus:!0,value:i,onChange:u=>s(u.target.value)}),I.jsxs("div",{style:{overflowY:"auto"},children:[o.length===0?I.jsx("div",{style:{padding:12,color:"#a1a1aa"},children:"No components"}):null,o.map(u=>I.jsxs("button",{type:"button",style:lz,onClick:()=>{n(u.name,iz(u)),r()},children:[I.jsx("div",{style:{fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},children:u.name}),u.description?I.jsx("div",{style:{color:"#71717a",fontSize:12},children:u.description}):null]},u.name))]})]})}):null}var si=(function(t){return t.docTypeError="docTypeError",t.contextNotFound="contextNotFound",t.timerNotFound="timerNotFound",t.ctxCallOutOfScope="ctxCallOutOfScope",t.createNodeInParserFail="createNodeInParserFail",t.stackOverFlow="stackOverFlow",t.parserMatchError="parserMatchError",t.serializerMatchError="serializerMatchError",t.getAtomFromSchemaFail="getAtomFromSchemaFail",t.expectDomTypeError="expectDomTypeError",t.callCommandBeforeEditorView="callCommandBeforeEditorView",t.missingRootElement="missingRootElement",t.missingNodeInSchema="missingNodeInSchema",t.missingMarkInSchema="missingMarkInSchema",t.ctxNotBind="ctxNotBind",t.missingYjsDoc="missingYjsDoc",t})({}),ai=class extends Error{constructor(t,e){super(e),this.name="MilkdownError",this.code=t}},cz=(t,e)=>typeof e=="function"?"[Function]":e,xg=t=>JSON.stringify(t,cz);function fz(t){return new ai(si.docTypeError,`Doc type error, unsupported type: ${xg(t)}`)}function hz(t){return new ai(si.contextNotFound,`Context "${t}" not found, do you forget to inject it?`)}function pz(t){return new ai(si.timerNotFound,`Timer "${t}" not found, do you forget to record it?`)}function bg(){return new ai(si.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function dz(t,e,n){const r=`Cannot create node for ${"name"in t?t.name:t}`,i=o=>{if(o==null)return"null";if(Array.isArray(o))return`[${o.map(i).join(", ")}]`;if(typeof o=="object")return"toJSON"in o&&typeof o.toJSON=="function"?JSON.stringify(o.toJSON()):"spec"in o?JSON.stringify(o.spec):JSON.stringify(o);if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return JSON.stringify(o);if(typeof o=="function")return`[Function: ${o.name||"anonymous"}]`;try{return String(o)}catch{return"[Unserializable]"}},s=[["[Description]",r],["[Attributes]",e],["[Content]",(n??[]).map(o=>o?typeof o=="object"&&"type"in o?`${o}`:i(o):"null")]].reduce((o,[u,c])=>{const h=`${u}: ${i(c)}.`;return o.concat(h)},[]);return new ai(si.createNodeInParserFail,s.join(`
1
+ var iE=t=>{throw TypeError(t)};var sE=(t,e,n)=>e.has(t)||iE("Cannot "+n);var tt=(t,e,n)=>(sE(t,e,"read from private field"),n?n.call(t):e.get(t)),Ut=(t,e,n)=>e.has(t)?iE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),su=(t,e,n,r)=>(sE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function VT(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r1={exports:{}},Gc={};var aE;function U4(){if(aE)return Gc;aE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var u in i)u!=="key"&&(s[u]=i[u])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return Gc.Fragment=e,Gc.jsx=n,Gc.jsxs=n,Gc}var oE;function J4(){return oE||(oE=1,r1.exports=U4()),r1.exports}var I=J4();const q4=409;class Ci extends Error{constructor(e,n,r){super(r),this.status=e,this.code=n,this.name="CmsClientError"}get isUnauthorized(){return this.code==="unauthorized"||this.status===401}get isForbidden(){return this.code==="forbidden"||this.status===403}get isNotFound(){return this.code==="not_found"||this.status===404}}function lE(t){return ch(t)&&typeof t.error=="string"&&typeof t.code=="string"}function ch(t){return typeof t=="object"&&t!==null}function H4(t){return ch(t)?t.code==="conflict"&&typeof t.serverHash=="string"&&ch(t.serverFrontmatter):!1}const K4=["not_found","conflict","validation","parse_error","io_error","unsupported","unauthorized"];function G4(t){return K4.includes(t)}function uE(t){return t instanceof Ci&&(t.status===501||t.code==="unsupported")}function Y4(t){const e=t.endsWith("/")?t.slice(0,-1):t;async function n(h){const d=await fetch(`${e}${h}`,{method:"GET",credentials:"include",headers:{accept:"application/json"}});if(!d.ok)throw await r(d);return await d.json()}async function r(h){const d=await h.json().catch(()=>null);return s(h.status,d)}function i(h,d){if(lE(h))return h.error;if(ch(h)){const g=h.error;if(ch(g)&&typeof g.message=="string")return g.message}return d}function s(h,d){return h===403?new Ci(403,"forbidden",i(d,"You do not have access to this project.")):lE(d)&&G4(d.code)?new Ci(h,d.code,d.error):h===401?new Ci(401,"unauthorized","Your session has expired. Please reload."):new Ci(h,"unknown",i(d,`Request failed (${h})`))}function o(h,d){const g={method:h,credentials:"include",headers:{accept:"application/json"}};return d!==void 0&&(g.body=JSON.stringify(d),g.headers={accept:"application/json","content-type":"application/json"}),g}async function u(h,d,g){const y=await fetch(`${e}${h}`,o(d,g));if(!y.ok)throw await r(y);return await y.json()}function c(h,d){return`/collections/${encodeURIComponent(h)}/entries/${encodeURIComponent(d)}`}return{getProject(){return n("/project")},getConfig(){return n("/config")},getCollections(){return n("/collections")},getComponents(){return n("/components")},getEntries(h,d={}){const g=new URLSearchParams;d.fields!==void 0&&g.set("fields",d.fields),d.draft!==void 0&&g.set("draft",d.draft),d.cursor!==void 0&&g.set("cursor",d.cursor),d.limit!==void 0&&g.set("limit",String(d.limit));const y=g.toString(),b=y===""?"":`?${y}`;return n(`/collections/${encodeURIComponent(h)}/entries${b}`)},getEntry(h,d){return n(c(h,d))},async updateEntry(h,d,g){const y=await fetch(`${e}${c(h,d)}`,o("PATCH",g));if(y.status===q4){const k=await y.json().catch(()=>null);if(H4(k))return{status:"conflict",conflict:k};throw s(y.status,k)}if(!y.ok)throw await r(y);return{status:"ok",result:await y.json()}},createEntry(h,d){return u(`/collections/${encodeURIComponent(h)}/entries`,"POST",d)},deleteEntry(h,d){return u(c(h,d),"DELETE")},renameEntry(h,d,g){return u(`${c(h,d)}/rename`,"POST",{to:g})},addArrayItem(h,d,g,y,b){const k=b===void 0?{field:g,value:y}:{field:g,value:y,index:b};return u(`${c(h,d)}/array`,"POST",k)},removeArrayItem(h,d,g,y){return u(`${c(h,d)}/array`,"DELETE",{field:g,index:y})},listMedia(h={}){const d=new URLSearchParams;h.folder!==void 0&&d.set("folder",h.folder),h.cursor!==void 0&&d.set("cursor",h.cursor),h.limit!==void 0&&d.set("limit",String(h.limit)),h.includeProjectImages&&d.set("includeProjectImages","true");const g=d.toString();return n(`/media${g===""?"":`?${g}`}`)},async uploadMedia(h,d={}){const g=new URLSearchParams;d.collection!==void 0&&g.set("collection",d.collection),d.entry!==void 0&&g.set("entry",d.entry),d.field!==void 0&&g.set("field",d.field),d.folder!==void 0&&g.set("folder",d.folder);const y=g.toString(),b=new FormData;b.append("file",h);const k=await fetch(`${e}/media${y===""?"":`?${y}`}`,{method:"POST",credentials:"include",headers:{accept:"application/json"},body:b});if(!k.ok)throw await r(k);return await k.json()},mediaFileUrl(h,d,g){return`${e}${c(h,d)}/asset?path=${encodeURIComponent(g)}`},mediaAssetUrl(h){return`${e}/asset?path=${encodeURIComponent(h)}`},deleteMedia(h){return u(`/media/${encodeURIComponent(h)}`,"DELETE")},createFolder(h){return u("/media","POST",{folder:h})}}}function Q4(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function FT(t,e){switch(t){case"boolean":return e==="true"||e==="1"||e.toLowerCase()==="yes";case"number":case"year":case"month":{const n=Number(e);return e.trim()===""||Number.isNaN(n)?e:n}case"date":case"datetime":case"time":return cE(e);case"array":case"object":return cE(e);default:return e}}function cE(t){const e=t.trim();if(e!==""){if(!(e.startsWith("{")||e.startsWith("[")||e.startsWith('"')))return t;try{return JSON.parse(e)}catch{return t}}}function W4(t,e){const n=new Map(e.map(i=>[i.name,i])),r={};for(const[i,s]of Object.entries(t.frontmatter)){const o=n.get(i);r[i]=o?FT(o.type,s.value):s.value}return{frontmatter:r,body:t.body}}function X4(t){const e={};for(const n of t)if(!n.hidden){if(n.defaultValue!==void 0){e[n.name]=n.defaultValue;continue}e[n.name]=PT(n.type)}return{frontmatter:e,body:""}}function PT(t){switch(t){case"boolean":return!1;case"array":return[];case"object":return{};case"date":case"datetime":case"time":case"month":return;default:return""}}function Z4(t,e,n){const r=new Map(n.map(s=>[s.name,s])),i={};for(const[s,o]of Object.entries(t)){const u=r.get(s);i[s]=u&&typeof o=="string"?FT(u.type,o):o}return{frontmatter:i,body:e??""}}function fS(t,e){switch(t){case"boolean":return e==="true";case"number":{if(e.trim()==="")return;const n=Number(e);return Number.isNaN(n)?e:n}case"year":case"month":{if(e.trim()==="")return;const n=Number(e);return Number.isNaN(n)?e:n}case"date":case"datetime":case"time":return e.trim()===""?void 0:e;default:return e}}function Ps(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function ez(t){return typeof t=="boolean"?t:typeof t=="string"?t==="true"||t==="1"||t.toLowerCase()==="yes":!!t}function tz(t){return Array.isArray(t)?t:[]}function nz(t){return Q4(t)?t:{}}function jT(t,e,n){return{...t,frontmatter:{...t.frontmatter,[e]:n}}}var i1={exports:{}},Ke={};var fE;function rz(){if(fE)return Ke;fE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function b(F){return F===null||typeof F!="object"?null:(F=y&&F[y]||F["@@iterator"],typeof F=="function"?F:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,N={};function M(F,ee,V){this.props=F,this.context=ee,this.refs=N,this.updater=V||k}M.prototype.isReactComponent={},M.prototype.setState=function(F,ee){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,ee,"setState")},M.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function j(){}j.prototype=M.prototype;function P(F,ee,V){this.props=F,this.context=ee,this.refs=N,this.updater=V||k}var U=P.prototype=new j;U.constructor=P,E(U,M.prototype),U.isPureReactComponent=!0;var L=Array.isArray;function C(){}var z={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function J(F,ee,V){var be=V.ref;return{$$typeof:t,type:F,key:ee,ref:be!==void 0?be:null,props:V}}function K(F,ee){return J(F.type,ee,F.props)}function de(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function ce(F){var ee={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(V){return ee[V]})}var Se=/\/+/g;function Re(F,ee){return typeof F=="object"&&F!==null&&F.key!=null?ce(""+F.key):ee.toString(36)}function Y(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(C,C):(F.status="pending",F.then(function(ee){F.status==="pending"&&(F.status="fulfilled",F.value=ee)},function(ee){F.status==="pending"&&(F.status="rejected",F.reason=ee)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function W(F,ee,V,be,De){var Me=typeof F;(Me==="undefined"||Me==="boolean")&&(F=null);var Xe=!1;if(F===null)Xe=!0;else switch(Me){case"bigint":case"string":case"number":Xe=!0;break;case"object":switch(F.$$typeof){case t:case e:Xe=!0;break;case d:return Xe=F._init,W(Xe(F._payload),ee,V,be,De)}}if(Xe)return De=De(F),Xe=be===""?"."+Re(F,0):be,L(De)?(V="",Xe!=null&&(V=Xe.replace(Se,"$&/")+"/"),W(De,ee,V,"",function(zt){return zt})):De!=null&&(de(De)&&(De=K(De,V+(De.key==null||F&&F.key===De.key?"":(""+De.key).replace(Se,"$&/")+"/")+Xe)),ee.push(De)),1;Xe=0;var Ct=be===""?".":be+":";if(L(F))for(var Ze=0;Ze<F.length;Ze++)be=F[Ze],Me=Ct+Re(be,Ze),Xe+=W(be,ee,V,Me,De);else if(Ze=b(F),typeof Ze=="function")for(F=Ze.call(F),Ze=0;!(be=F.next()).done;)be=be.value,Me=Ct+Re(be,Ze++),Xe+=W(be,ee,V,Me,De);else if(Me==="object"){if(typeof F.then=="function")return W(Y(F),ee,V,be,De);throw ee=String(F),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return Xe}function ue(F,ee,V){if(F==null)return F;var be=[],De=0;return W(F,be,"","",function(Me){return ee.call(V,Me,De++)}),be}function ke(F){if(F._status===-1){var ee=F._result;ee=ee(),ee.then(function(V){(F._status===0||F._status===-1)&&(F._status=1,F._result=V)},function(V){(F._status===0||F._status===-1)&&(F._status=2,F._result=V)}),F._status===-1&&(F._status=0,F._result=ee)}if(F._status===1)return F._result.default;throw F._result}var ze=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ee=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(ee))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)},D={map:ue,forEach:function(F,ee,V){ue(F,function(){ee.apply(this,arguments)},V)},count:function(F){var ee=0;return ue(F,function(){ee++}),ee},toArray:function(F){return ue(F,function(ee){return ee})||[]},only:function(F){if(!de(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return Ke.Activity=g,Ke.Children=D,Ke.Component=M,Ke.Fragment=n,Ke.Profiler=i,Ke.PureComponent=P,Ke.StrictMode=r,Ke.Suspense=c,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(F){return z.H.useMemoCache(F)}},Ke.cache=function(F){return function(){return F.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(F,ee,V){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var be=E({},F.props),De=F.key;if(ee!=null)for(Me in ee.key!==void 0&&(De=""+ee.key),ee)!G.call(ee,Me)||Me==="key"||Me==="__self"||Me==="__source"||Me==="ref"&&ee.ref===void 0||(be[Me]=ee[Me]);var Me=arguments.length-2;if(Me===1)be.children=V;else if(1<Me){for(var Xe=Array(Me),Ct=0;Ct<Me;Ct++)Xe[Ct]=arguments[Ct+2];be.children=Xe}return J(F.type,De,be)},Ke.createContext=function(F){return F={$$typeof:o,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:s,_context:F},F},Ke.createElement=function(F,ee,V){var be,De={},Me=null;if(ee!=null)for(be in ee.key!==void 0&&(Me=""+ee.key),ee)G.call(ee,be)&&be!=="key"&&be!=="__self"&&be!=="__source"&&(De[be]=ee[be]);var Xe=arguments.length-2;if(Xe===1)De.children=V;else if(1<Xe){for(var Ct=Array(Xe),Ze=0;Ze<Xe;Ze++)Ct[Ze]=arguments[Ze+2];De.children=Ct}if(F&&F.defaultProps)for(be in Xe=F.defaultProps,Xe)De[be]===void 0&&(De[be]=Xe[be]);return J(F,Me,De)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(F){return{$$typeof:u,render:F}},Ke.isValidElement=de,Ke.lazy=function(F){return{$$typeof:d,_payload:{_status:-1,_result:F},_init:ke}},Ke.memo=function(F,ee){return{$$typeof:h,type:F,compare:ee===void 0?null:ee}},Ke.startTransition=function(F){var ee=z.T,V={};z.T=V;try{var be=F(),De=z.S;De!==null&&De(V,be),typeof be=="object"&&be!==null&&typeof be.then=="function"&&be.then(C,ze)}catch(Me){ze(Me)}finally{ee!==null&&V.types!==null&&(ee.types=V.types),z.T=ee}},Ke.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ke.use=function(F){return z.H.use(F)},Ke.useActionState=function(F,ee,V){return z.H.useActionState(F,ee,V)},Ke.useCallback=function(F,ee){return z.H.useCallback(F,ee)},Ke.useContext=function(F){return z.H.useContext(F)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(F,ee){return z.H.useDeferredValue(F,ee)},Ke.useEffect=function(F,ee){return z.H.useEffect(F,ee)},Ke.useEffectEvent=function(F){return z.H.useEffectEvent(F)},Ke.useId=function(){return z.H.useId()},Ke.useImperativeHandle=function(F,ee,V){return z.H.useImperativeHandle(F,ee,V)},Ke.useInsertionEffect=function(F,ee){return z.H.useInsertionEffect(F,ee)},Ke.useLayoutEffect=function(F,ee){return z.H.useLayoutEffect(F,ee)},Ke.useMemo=function(F,ee){return z.H.useMemo(F,ee)},Ke.useOptimistic=function(F,ee){return z.H.useOptimistic(F,ee)},Ke.useReducer=function(F,ee,V){return z.H.useReducer(F,ee,V)},Ke.useRef=function(F){return z.H.useRef(F)},Ke.useState=function(F){return z.H.useState(F)},Ke.useSyncExternalStore=function(F,ee,V){return z.H.useSyncExternalStore(F,ee,V)},Ke.useTransition=function(){return z.H.useTransition()},Ke.version="19.2.7",Ke}var hE;function hS(){return hE||(hE=1,i1.exports=rz()),i1.exports}var ae=hS();function iz(t){const e={};for(const n of t.props)e[n.name]=n.defaultValue??"";return e}const sz={position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh",zIndex:1e3},az={width:"min(440px, 92vw)",maxHeight:"70vh",display:"flex",flexDirection:"column",background:"#fff",border:"1px solid #d4d4d8",borderRadius:10,boxShadow:"0 12px 32px rgba(0,0,0,0.18)",overflow:"hidden",fontSize:13},oz={border:"none",borderBottom:"1px solid #ececed",padding:"10px 12px",font:"inherit",outline:"none"},lz={textAlign:"left",border:"none",background:"transparent",padding:"8px 12px",cursor:"pointer",borderRadius:0};function uz({open:t,components:e,onInsert:n,onClose:r}){const[i,s]=ae.useState(""),o=ae.useMemo(()=>{const u=i.trim().toLowerCase();return e.filter(c=>u===""||c.name.toLowerCase().includes(u)||(c.description??"").toLowerCase().includes(u))},[e,i]);return t?I.jsx("div",{style:sz,onMouseDown:r,children:I.jsxs("div",{style:az,onMouseDown:u=>u.stopPropagation(),children:[I.jsx("input",{style:oz,placeholder:"Search components…",autoFocus:!0,value:i,onChange:u=>s(u.target.value)}),I.jsxs("div",{style:{overflowY:"auto"},children:[o.length===0?I.jsx("div",{style:{padding:12,color:"#a1a1aa"},children:"No components"}):null,o.map(u=>I.jsxs("button",{type:"button",style:lz,onClick:()=>{n(u.name,iz(u)),r()},children:[I.jsx("div",{style:{fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},children:u.name}),u.description?I.jsx("div",{style:{color:"#71717a",fontSize:12},children:u.description}):null]},u.name))]})]})}):null}var si=(function(t){return t.docTypeError="docTypeError",t.contextNotFound="contextNotFound",t.timerNotFound="timerNotFound",t.ctxCallOutOfScope="ctxCallOutOfScope",t.createNodeInParserFail="createNodeInParserFail",t.stackOverFlow="stackOverFlow",t.parserMatchError="parserMatchError",t.serializerMatchError="serializerMatchError",t.getAtomFromSchemaFail="getAtomFromSchemaFail",t.expectDomTypeError="expectDomTypeError",t.callCommandBeforeEditorView="callCommandBeforeEditorView",t.missingRootElement="missingRootElement",t.missingNodeInSchema="missingNodeInSchema",t.missingMarkInSchema="missingMarkInSchema",t.ctxNotBind="ctxNotBind",t.missingYjsDoc="missingYjsDoc",t})({}),ai=class extends Error{constructor(t,e){super(e),this.name="MilkdownError",this.code=t}},cz=(t,e)=>typeof e=="function"?"[Function]":e,xg=t=>JSON.stringify(t,cz);function fz(t){return new ai(si.docTypeError,`Doc type error, unsupported type: ${xg(t)}`)}function hz(t){return new ai(si.contextNotFound,`Context "${t}" not found, do you forget to inject it?`)}function pz(t){return new ai(si.timerNotFound,`Timer "${t}" not found, do you forget to record it?`)}function bg(){return new ai(si.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function dz(t,e,n){const r=`Cannot create node for ${"name"in t?t.name:t}`,i=o=>{if(o==null)return"null";if(Array.isArray(o))return`[${o.map(i).join(", ")}]`;if(typeof o=="object")return"toJSON"in o&&typeof o.toJSON=="function"?JSON.stringify(o.toJSON()):"spec"in o?JSON.stringify(o.spec):JSON.stringify(o);if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return JSON.stringify(o);if(typeof o=="function")return`[Function: ${o.name||"anonymous"}]`;try{return String(o)}catch{return"[Unserializable]"}},s=[["[Description]",r],["[Attributes]",e],["[Content]",(n??[]).map(o=>o?typeof o=="object"&&"type"in o?`${o}`:i(o):"null")]].reduce((o,[u,c])=>{const h=`${u}: ${i(c)}.`;return o.concat(h)},[]);return new ai(si.createNodeInParserFail,s.join(`
2
2
  `))}function $T(){return new ai(si.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function mz(t){return new ai(si.parserMatchError,`Cannot match target parser for node: ${xg(t)}.`)}function gz(t){return new ai(si.serializerMatchError,`Cannot match target serializer for node: ${xg(t)}.`)}function Ki(t){return new ai(si.expectDomTypeError,`Expect to be a dom, but get: ${xg(t)}.`)}function s1(){return new ai(si.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function yz(t){return new ai(si.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${t}" in schema.`)}function xz(t){return new ai(si.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${t}" in schema.`)}var UT=class{constructor(){this.sliceMap=new Map,this.get=t=>{const e=typeof t=="string"?[...this.sliceMap.values()].find(n=>n.type.name===t):this.sliceMap.get(t.id);if(!e)throw hz(typeof t=="string"?t:t.name);return e},this.remove=t=>{const e=typeof t=="string"?[...this.sliceMap.values()].find(n=>n.type.name===t):this.sliceMap.get(t.id);e&&this.sliceMap.delete(e.type.id)},this.has=t=>typeof t=="string"?[...this.sliceMap.values()].some(e=>e.type.name===t):this.sliceMap.has(t.id)}},bz=class{#t=[];#e;#r=()=>{this.#t.forEach(e=>e(this.#e))};constructor(e,n,r){this.set=i=>{this.#e=i,this.#r()},this.get=()=>this.#e,this.update=i=>{this.#e=i(this.#e),this.#r()},this.type=r,this.#e=n,e.set(r.id,this)}on(e){return this.#t.push(e),()=>{this.#t=this.#t.filter(n=>n!==e)}}once(e){const n=this.on(r=>{e(r),n()});return n}off(e){this.#t=this.#t.filter(n=>n!==e)}offAll(){this.#t=[]}},Sz=class{constructor(t,e){this.id=Symbol(`Context-${e}`),this.name=e,this._defaultValue=t,this._typeInfo=()=>{throw bg()}}create(t,e=this._defaultValue){return new bz(t,e,this)}},at=(t,e)=>new Sz(t,e),vz=class{#t;#e;#r;#n=new Set;#o=new Set;#s=new Map;#i=new Map;constructor(t,e,n){this.read=()=>({metadata:this.#t,injectedSlices:[...this.#n].map(r=>({name:typeof r=="string"?r:r.name,value:this.#a(r)})),consumedSlices:[...this.#o].map(r=>({name:typeof r=="string"?r:r.name,value:this.#a(r)})),recordedTimers:[...this.#s].map(([r,{duration:i}])=>({name:r.name,duration:i,status:this.#l(r)})),waitTimers:[...this.#i].map(([r,{duration:i}])=>({name:r.name,duration:i,status:this.#l(r)}))}),this.onRecord=r=>{this.#s.set(r,{start:Date.now(),duration:0})},this.onClear=r=>{this.#s.delete(r)},this.onDone=r=>{const i=this.#s.get(r);i&&(i.duration=Date.now()-i.start)},this.onWait=(r,i)=>{const s=Date.now();i.finally(()=>{this.#i.set(r,{duration:Date.now()-s})}).catch(console.error)},this.onInject=r=>{this.#n.add(r)},this.onRemove=r=>{this.#n.delete(r)},this.onUse=r=>{this.#o.add(r)},this.#e=t,this.#r=e,this.#t=n}#a=t=>this.#e.get(t).get();#l=t=>this.#r.get(t).status},kz=class JT{#t;#e;#r;#n;constructor(e,n,r){this.produce=i=>i&&Object.keys(i).length?new JT(this.#t,this.#e,{...i}):this,this.inject=(i,s)=>{const o=i.create(this.#t.sliceMap);return s!=null&&o.set(s),this.#n?.onInject(i),this},this.remove=i=>(this.#t.remove(i),this.#n?.onRemove(i),this),this.record=i=>(i.create(this.#e.store),this.#n?.onRecord(i),this),this.clearTimer=i=>(this.#e.remove(i),this.#n?.onClear(i),this),this.isInjected=i=>this.#t.has(i),this.isRecorded=i=>this.#e.has(i),this.use=i=>(this.#n?.onUse(i),this.#t.get(i)),this.get=i=>this.use(i).get(),this.set=(i,s)=>this.use(i).set(s),this.update=(i,s)=>this.use(i).update(s),this.timer=i=>this.#e.get(i),this.done=i=>{this.timer(i).done(),this.#n?.onDone(i)},this.wait=i=>{const s=this.timer(i).start();return this.#n?.onWait(i,s),s},this.waitTimers=async i=>{await Promise.all(this.get(i).map(s=>this.wait(s)))},this.#t=e,this.#e=n,this.#r=r,r&&(this.#n=new vz(e,n,r))}get meta(){return this.#r}get inspector(){return this.#n}},Cz=class{constructor(){this.store=new Map,this.get=t=>{const e=this.store.get(t.id);if(!e)throw pz(t.name);return e},this.remove=t=>{this.store.delete(t.id)},this.has=t=>this.store.has(t.id)}},wz=class{#t=null;#e=null;#r;#n="pending";constructor(t,e){this.start=()=>(this.#t??=new Promise((n,r)=>{this.#e=i=>{i instanceof CustomEvent&&i.detail.id===this.#r&&(this.#n="resolved",this.#o(),i.stopImmediatePropagation(),n())},this.#s(()=>{this.#n==="pending"&&(this.#n="rejected"),this.#o(),r(new Error(`Timing ${this.type.name} timeout.`))}),this.#n="pending",addEventListener(this.type.name,this.#e)}),this.#t),this.done=()=>{const n=new CustomEvent(this.type.name,{detail:{id:this.#r}});dispatchEvent(n)},this.#r=Symbol(e.name),this.type=e,t.set(e.id,this)}get status(){return this.#n}#o=()=>{this.#e&&removeEventListener(this.type.name,this.#e)};#s=t=>{setTimeout(()=>{t()},this.type.timeout)}},Ez=class{constructor(t,e=3e3){this.create=n=>new wz(n,this),this.id=Symbol(`Timer-${t}`),this.name=t,this.timeout=e}},Gi=(t,e=3e3)=>new Ez(t,e);const Az={};function pS(t,e){const n=Az,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return qT(t,r,i)}function qT(t,e,n){if(Nz(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return pE(t.children,e,n)}return Array.isArray(t)?pE(t,e,n):""}function pE(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=qT(t[i],e,n);return r.join("")}function Nz(t){return!!(t&&typeof t=="object")}const dE=document.createElement("i");function fh(t){const e="&"+t+";";dE.innerHTML=e;const n=dE.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Er(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Wr(t,e){return t.length>0?(Er(t,t.length,0,e),t):e}const mE={}.hasOwnProperty;function dS(t){const e={};let n=-1;for(;++n<t.length;)Tz(e,t[n]);return e}function Tz(t,e){let n;for(n in e){const i=(mE.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){mE.call(i,o)||(i[o]=[]);const u=s[o];Mz(i[o],Array.isArray(u)?u:u?[u]:[])}}}function Mz(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Er(t,0,0,r)}function HT(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function wi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=Qa(/[A-Za-z]/),vn=Qa(/[\dA-Za-z]/),Oz=Qa(/[#-'*+\--9=?A-Z^-~]/);function Cm(t){return t!==null&&(t<32||t===127)}const Lx=Qa(/\d/),Rz=Qa(/[\dA-Fa-f]/),Dz=Qa(/[!-/:-@[-`{-~]/);function Ce(t){return t!==null&&t<-2}function We(t){return t!==null&&(t<0||t===32)}function qe(t){return t===-2||t===-1||t===32}const Sg=Qa(new RegExp("\\p{P}|\\p{S}","u")),Vn=Qa(/\s/);function Qa(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function He(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return qe(c)?(t.enter(n),u(c)):e(c)}function u(c){return qe(c)&&s++<i?(t.consume(c),u):(t.exit(n),e(c))}}const Iz={tokenize:_z};function _z(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),He(t,e,"linePrefix")}function i(u){return t.enter("paragraph"),s(u)}function s(u){const c=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(u)}function o(u){if(u===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(u);return}return Ce(u)?(t.consume(u),t.exit("chunkText"),s):(t.consume(u),o)}}const zz={tokenize:Lz},gE={tokenize:Bz};function Lz(t){const e=this,n=[];let r=0,i,s,o;return u;function u(P){if(r<n.length){const U=n[r];return e.containerState=U[1],t.attempt(U[0].continuation,c,h)(P)}return h(P)}function c(P){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&j();const U=e.events.length;let L=U,C;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){C=e.events[L][1].end;break}M(r);let z=U;for(;z<e.events.length;)e.events[z][1].end={...C},z++;return Er(e.events,L+1,0,e.events.slice(U)),e.events.length=z,h(P)}return u(P)}function h(P){if(r===n.length){if(!i)return y(P);if(i.currentConstruct&&i.currentConstruct.concrete)return k(P);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(gE,d,g)(P)}function d(P){return i&&j(),M(r),y(P)}function g(P){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,k(P)}function y(P){return e.containerState={},t.attempt(gE,b,k)(P)}function b(P){return r++,n.push([e.currentConstruct,e.containerState]),y(P)}function k(P){if(P===null){i&&j(),M(0),t.consume(P);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),E(P)}function E(P){if(P===null){N(t.exit("chunkFlow"),!0),M(0),t.consume(P);return}return Ce(P)?(t.consume(P),N(t.exit("chunkFlow")),r=0,e.interrupt=void 0,u):(t.consume(P),E)}function N(P,U){const L=e.sliceStream(P);if(U&&L.push(null),P.previous=s,s&&(s.next=P),s=P,i.defineSkip(P.start),i.write(L),e.parser.lazy[P.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;const z=e.events.length;let G=z,J,K;for(;G--;)if(e.events[G][0]==="exit"&&e.events[G][1].type==="chunkFlow"){if(J){K=e.events[G][1].end;break}J=!0}for(M(r),C=z;C<e.events.length;)e.events[C][1].end={...K},C++;Er(e.events,G+1,0,e.events.slice(z)),e.events.length=C}}function M(P){let U=n.length;for(;U-- >P;){const L=n[U];e.containerState=L[1],L[0].exit.call(e,t)}n.length=P}function j(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Bz(t,e,n){return He(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Iu(t){if(t===null||We(t)||Vn(t))return 1;if(Sg(t))return 2}function vg(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const Bx={name:"attention",resolveAll:Vz,tokenize:Fz};function Vz(t,e){let n=-1,r,i,s,o,u,c,h,d;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;c=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const g={...t[r][1].end},y={...t[n][1].start};yE(g,-c),yE(y,c),o={type:c>1?"strongSequence":"emphasisSequence",start:g,end:{...t[r][1].end}},u={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:y},s={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...u.end}},t[r][1].end={...o.start},t[n][1].start={...u.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=Wr(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=Wr(h,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),h=Wr(h,vg(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=Wr(h,[["exit",s,e],["enter",u,e],["exit",u,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(d=2,h=Wr(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,Er(t,r-1,n-r+3,h),n=r+h.length-d-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function Fz(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Iu(r);let s;return o;function o(c){return s=c,t.enter("attentionSequence"),u(c)}function u(c){if(c===s)return t.consume(c),u;const h=t.exit("attentionSequence"),d=Iu(c),g=!d||d===2&&i||n.includes(c),y=!i||i===2&&d||n.includes(r);return h._open=!!(s===42?g:g&&(i||!y)),h._close=!!(s===42?y:y&&(d||!g)),e(c)}}function yE(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const Pz={name:"autolink",tokenize:jz};function jz(t,e,n){let r=0;return i;function i(b){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(b){return sn(b)?(t.consume(b),o):b===64?n(b):h(b)}function o(b){return b===43||b===45||b===46||vn(b)?(r=1,u(b)):h(b)}function u(b){return b===58?(t.consume(b),r=0,c):(b===43||b===45||b===46||vn(b))&&r++<32?(t.consume(b),u):(r=0,h(b))}function c(b){return b===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):b===null||b===32||b===60||Cm(b)?n(b):(t.consume(b),c)}function h(b){return b===64?(t.consume(b),d):Oz(b)?(t.consume(b),h):n(b)}function d(b){return vn(b)?g(b):n(b)}function g(b){return b===46?(t.consume(b),r=0,d):b===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):y(b)}function y(b){if((b===45||vn(b))&&r++<63){const k=b===45?y:g;return t.consume(b),k}return n(b)}}const ju={partial:!0,tokenize:$z};function $z(t,e,n){return r;function r(s){return qe(s)?He(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ce(s)?e(s):n(s)}}const KT={continuation:{tokenize:Jz},exit:qz,name:"blockQuote",tokenize:Uz};function Uz(t,e,n){const r=this;return i;function i(o){if(o===62){const u=r.containerState;return u.open||(t.enter("blockQuote",{_container:!0}),u.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return qe(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function Jz(t,e,n){const r=this;return i;function i(o){return qe(o)?He(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(KT,e,n)(o)}}function qz(t){t.exit("blockQuote")}const GT={name:"characterEscape",tokenize:Hz};function Hz(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return Dz(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const YT={name:"characterReference",tokenize:Kz};function Kz(t,e,n){const r=this;let i=0,s,o;return u;function u(g){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),c}function c(g){return g===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(g),t.exit("characterReferenceMarkerNumeric"),h):(t.enter("characterReferenceValue"),s=31,o=vn,d(g))}function h(g){return g===88||g===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(g),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=Rz,d):(t.enter("characterReferenceValue"),s=7,o=Lx,d(g))}function d(g){if(g===59&&i){const y=t.exit("characterReferenceValue");return o===vn&&!fh(r.sliceSerialize(y))?n(g):(t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(g)&&i++<s?(t.consume(g),d):n(g)}}const xE={partial:!0,tokenize:Yz},bE={concrete:!0,name:"codeFenced",tokenize:Gz};function Gz(t,e,n){const r=this,i={partial:!0,tokenize:L};let s=0,o=0,u;return c;function c(C){return h(C)}function h(C){const z=r.events[r.events.length-1];return s=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,u=C,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===u?(o++,t.consume(C),d):o<3?n(C):(t.exit("codeFencedFenceSequence"),qe(C)?He(t,g,"whitespace")(C):g(C))}function g(C){return C===null||Ce(C)?(t.exit("codeFencedFence"),r.interrupt?e(C):t.check(xE,E,U)(C)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||Ce(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),g(C)):qe(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),He(t,b,"whitespace")(C)):C===96&&C===u?n(C):(t.consume(C),y)}function b(C){return C===null||Ce(C)?g(C):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),k(C))}function k(C){return C===null||Ce(C)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),g(C)):C===96&&C===u?n(C):(t.consume(C),k)}function E(C){return t.attempt(i,U,N)(C)}function N(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),M}function M(C){return s>0&&qe(C)?He(t,j,"linePrefix",s+1)(C):j(C)}function j(C){return C===null||Ce(C)?t.check(xE,E,U)(C):(t.enter("codeFlowValue"),P(C))}function P(C){return C===null||Ce(C)?(t.exit("codeFlowValue"),j(C)):(t.consume(C),P)}function U(C){return t.exit("codeFenced"),e(C)}function L(C,z,G){let J=0;return K;function K(Y){return C.enter("lineEnding"),C.consume(Y),C.exit("lineEnding"),de}function de(Y){return C.enter("codeFencedFence"),qe(Y)?He(C,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):ce(Y)}function ce(Y){return Y===u?(C.enter("codeFencedFenceSequence"),Se(Y)):G(Y)}function Se(Y){return Y===u?(J++,C.consume(Y),Se):J>=o?(C.exit("codeFencedFenceSequence"),qe(Y)?He(C,Re,"whitespace")(Y):Re(Y)):G(Y)}function Re(Y){return Y===null||Ce(Y)?(C.exit("codeFencedFence"),z(Y)):G(Y)}}}function Yz(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const a1={name:"codeIndented",tokenize:Wz},Qz={partial:!0,tokenize:Xz};function Wz(t,e,n){const r=this;return i;function i(h){return t.enter("codeIndented"),He(t,s,"linePrefix",5)(h)}function s(h){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(h):n(h)}function o(h){return h===null?c(h):Ce(h)?t.attempt(Qz,o,c)(h):(t.enter("codeFlowValue"),u(h))}function u(h){return h===null||Ce(h)?(t.exit("codeFlowValue"),o(h)):(t.consume(h),u)}function c(h){return t.exit("codeIndented"),e(h)}}function Xz(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Ce(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):He(t,s,"linePrefix",5)(o)}function s(o){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(o):Ce(o)?i(o):n(o)}}const Zz={name:"codeText",previous:tL,resolve:eL,tokenize:nL};function eL(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function tL(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function nL(t,e,n){let r=0,i,s;return o;function o(g){return t.enter("codeText"),t.enter("codeTextSequence"),u(g)}function u(g){return g===96?(t.consume(g),r++,u):(t.exit("codeTextSequence"),c(g))}function c(g){return g===null?n(g):g===32?(t.enter("space"),t.consume(g),t.exit("space"),c):g===96?(s=t.enter("codeTextSequence"),i=0,d(g)):Ce(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),c):(t.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||Ce(g)?(t.exit("codeTextData"),c(g)):(t.consume(g),h)}function d(g){return g===96?(t.consume(g),i++,d):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(g)):(s.type="codeTextData",h(g))}}class rL{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Yc(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Yc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Yc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Yc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Yc(this.left,n.reverse())}}}function Yc(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function QT(t){const e={};let n=-1,r,i,s,o,u,c,h;const d=new rL(t);for(;++n<d.length;){for(;n in e;)n=e[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,iL(d,n)),n=e[n],h=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},u=d.slice(i,n),u.unshift(r),d.splice(i,n-i+1,u))}}return Er(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!h}function iL(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const u=o.events,c=[],h={};let d,g,y=-1,b=n,k=0,E=0;const N=[E];for(;b;){for(;t.get(++i)[1]!==b;);s.push(i),b._tokenizer||(d=r.sliceStream(b),b.next||d.push(null),g&&o.defineSkip(b.start),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++y<u.length;)u[y][0]==="exit"&&u[y-1][0]==="enter"&&u[y][1].type===u[y-1][1].type&&u[y][1].start.line!==u[y][1].end.line&&(E=y+1,N.push(E),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(o.events=[],b?(b._tokenizer=void 0,b.previous=void 0):N.pop(),y=N.length;y--;){const M=u.slice(N[y],N[y+1]),j=s.pop();c.push([j,j+M.length-1]),t.splice(j,2,M)}for(c.reverse(),y=-1;++y<c.length;)h[k+c[y][0]]=k+c[y][1],k+=c[y][1]-c[y][0]-1;return h}const sL={resolve:oL,tokenize:lL},aL={partial:!0,tokenize:uL};function oL(t){return QT(t),t}function lL(t,e){let n;return r;function r(u){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?s(u):Ce(u)?t.check(aL,o,s)(u):(t.consume(u),i)}function s(u){return t.exit("chunkContent"),t.exit("content"),e(u)}function o(u){return t.consume(u),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function uL(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),He(t,s,"linePrefix")}function s(o){if(o===null||Ce(o))return n(o);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function WT(t,e,n,r,i,s,o,u,c){const h=c||Number.POSITIVE_INFINITY;let d=0;return g;function g(M){return M===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(M),t.exit(s),y):M===null||M===32||M===41||Cm(M)?n(M):(t.enter(r),t.enter(o),t.enter(u),t.enter("chunkString",{contentType:"string"}),E(M))}function y(M){return M===62?(t.enter(s),t.consume(M),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(u),t.enter("chunkString",{contentType:"string"}),b(M))}function b(M){return M===62?(t.exit("chunkString"),t.exit(u),y(M)):M===null||M===60||Ce(M)?n(M):(t.consume(M),M===92?k:b)}function k(M){return M===60||M===62||M===92?(t.consume(M),b):b(M)}function E(M){return!d&&(M===null||M===41||We(M))?(t.exit("chunkString"),t.exit(u),t.exit(o),t.exit(r),e(M)):d<h&&M===40?(t.consume(M),d++,E):M===41?(t.consume(M),d--,E):M===null||M===32||M===40||Cm(M)?n(M):(t.consume(M),M===92?N:E)}function N(M){return M===40||M===41||M===92?(t.consume(M),E):E(M)}}function XT(t,e,n,r,i,s){const o=this;let u=0,c;return h;function h(b){return t.enter(r),t.enter(i),t.consume(b),t.exit(i),t.enter(s),d}function d(b){return u>999||b===null||b===91||b===93&&!c||b===94&&!u&&"_hiddenFootnoteSupport"in o.parser.constructs?n(b):b===93?(t.exit(s),t.enter(i),t.consume(b),t.exit(i),t.exit(r),e):Ce(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||Ce(b)||u++>999?(t.exit("chunkString"),d(b)):(t.consume(b),c||(c=!qe(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(t.consume(b),u++,g):g(b)}}function ZT(t,e,n,r,i,s){let o;return u;function u(y){return y===34||y===39||y===40?(t.enter(r),t.enter(i),t.consume(y),t.exit(i),o=y===40?41:y,c):n(y)}function c(y){return y===o?(t.enter(i),t.consume(y),t.exit(i),t.exit(r),e):(t.enter(s),h(y))}function h(y){return y===o?(t.exit(s),c(o)):y===null?n(y):Ce(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),He(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===o||y===null||Ce(y)?(t.exit("chunkString"),h(y)):(t.consume(y),y===92?g:d)}function g(y){return y===o||y===92?(t.consume(y),d):d(y)}}function Ts(t,e){let n;return r;function r(i){return Ce(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):qe(i)?He(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const cL={name:"definition",tokenize:hL},fL={partial:!0,tokenize:pL};function hL(t,e,n){const r=this;let i;return s;function s(b){return t.enter("definition"),o(b)}function o(b){return XT.call(r,t,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return i=wi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),c):n(b)}function c(b){return We(b)?Ts(t,h)(b):h(b)}function h(b){return WT(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function d(b){return t.attempt(fL,g,g)(b)}function g(b){return qe(b)?He(t,y,"whitespace")(b):y(b)}function y(b){return b===null||Ce(b)?(t.exit("definition"),r.parser.defined.push(i),e(b)):n(b)}}function pL(t,e,n){return r;function r(u){return We(u)?Ts(t,i)(u):n(u)}function i(u){return ZT(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function s(u){return qe(u)?He(t,o,"whitespace")(u):o(u)}function o(u){return u===null||Ce(u)?e(u):n(u)}}const dL={name:"hardBreakEscape",tokenize:mL};function mL(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Ce(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const gL={name:"headingAtx",resolve:yL,tokenize:xL};function yL(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Er(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function xL(t,e,n){let r=0;return i;function i(d){return t.enter("atxHeading"),s(d)}function s(d){return t.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(t.consume(d),o):d===null||We(d)?(t.exit("atxHeadingSequence"),u(d)):n(d)}function u(d){return d===35?(t.enter("atxHeadingSequence"),c(d)):d===null||Ce(d)?(t.exit("atxHeading"),e(d)):qe(d)?He(t,u,"whitespace")(d):(t.enter("atxHeadingText"),h(d))}function c(d){return d===35?(t.consume(d),c):(t.exit("atxHeadingSequence"),u(d))}function h(d){return d===null||d===35||We(d)?(t.exit("atxHeadingText"),u(d)):(t.consume(d),h)}}const bL=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],SE=["pre","script","style","textarea"],SL={concrete:!0,name:"htmlFlow",resolveTo:CL,tokenize:wL},vL={partial:!0,tokenize:AL},kL={partial:!0,tokenize:EL};function CL(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function wL(t,e,n){const r=this;let i,s,o,u,c;return h;function h(V){return d(V)}function d(V){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(V),g}function g(V){return V===33?(t.consume(V),y):V===47?(t.consume(V),s=!0,E):V===63?(t.consume(V),i=3,r.interrupt?e:D):sn(V)?(t.consume(V),o=String.fromCharCode(V),N):n(V)}function y(V){return V===45?(t.consume(V),i=2,b):V===91?(t.consume(V),i=5,u=0,k):sn(V)?(t.consume(V),i=4,r.interrupt?e:D):n(V)}function b(V){return V===45?(t.consume(V),r.interrupt?e:D):n(V)}function k(V){const be="CDATA[";return V===be.charCodeAt(u++)?(t.consume(V),u===be.length?r.interrupt?e:ce:k):n(V)}function E(V){return sn(V)?(t.consume(V),o=String.fromCharCode(V),N):n(V)}function N(V){if(V===null||V===47||V===62||We(V)){const be=V===47,De=o.toLowerCase();return!be&&!s&&SE.includes(De)?(i=1,r.interrupt?e(V):ce(V)):bL.includes(o.toLowerCase())?(i=6,be?(t.consume(V),M):r.interrupt?e(V):ce(V)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(V):s?j(V):P(V))}return V===45||vn(V)?(t.consume(V),o+=String.fromCharCode(V),N):n(V)}function M(V){return V===62?(t.consume(V),r.interrupt?e:ce):n(V)}function j(V){return qe(V)?(t.consume(V),j):K(V)}function P(V){return V===47?(t.consume(V),K):V===58||V===95||sn(V)?(t.consume(V),U):qe(V)?(t.consume(V),P):K(V)}function U(V){return V===45||V===46||V===58||V===95||vn(V)?(t.consume(V),U):L(V)}function L(V){return V===61?(t.consume(V),C):qe(V)?(t.consume(V),L):P(V)}function C(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(t.consume(V),c=V,z):qe(V)?(t.consume(V),C):G(V)}function z(V){return V===c?(t.consume(V),c=null,J):V===null||Ce(V)?n(V):(t.consume(V),z)}function G(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||We(V)?L(V):(t.consume(V),G)}function J(V){return V===47||V===62||qe(V)?P(V):n(V)}function K(V){return V===62?(t.consume(V),de):n(V)}function de(V){return V===null||Ce(V)?ce(V):qe(V)?(t.consume(V),de):n(V)}function ce(V){return V===45&&i===2?(t.consume(V),W):V===60&&i===1?(t.consume(V),ue):V===62&&i===4?(t.consume(V),F):V===63&&i===3?(t.consume(V),D):V===93&&i===5?(t.consume(V),ze):Ce(V)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(vL,ee,Se)(V)):V===null||Ce(V)?(t.exit("htmlFlowData"),Se(V)):(t.consume(V),ce)}function Se(V){return t.check(kL,Re,ee)(V)}function Re(V){return t.enter("lineEnding"),t.consume(V),t.exit("lineEnding"),Y}function Y(V){return V===null||Ce(V)?Se(V):(t.enter("htmlFlowData"),ce(V))}function W(V){return V===45?(t.consume(V),D):ce(V)}function ue(V){return V===47?(t.consume(V),o="",ke):ce(V)}function ke(V){if(V===62){const be=o.toLowerCase();return SE.includes(be)?(t.consume(V),F):ce(V)}return sn(V)&&o.length<8?(t.consume(V),o+=String.fromCharCode(V),ke):ce(V)}function ze(V){return V===93?(t.consume(V),D):ce(V)}function D(V){return V===62?(t.consume(V),F):V===45&&i===2?(t.consume(V),D):ce(V)}function F(V){return V===null||Ce(V)?(t.exit("htmlFlowData"),ee(V)):(t.consume(V),F)}function ee(V){return t.exit("htmlFlow"),e(V)}}function EL(t,e,n){const r=this;return i;function i(o){return Ce(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function AL(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(ju,e,n)}}const NL={name:"htmlText",tokenize:TL};function TL(t,e,n){const r=this;let i,s,o;return u;function u(D){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(D),c}function c(D){return D===33?(t.consume(D),h):D===47?(t.consume(D),L):D===63?(t.consume(D),P):sn(D)?(t.consume(D),G):n(D)}function h(D){return D===45?(t.consume(D),d):D===91?(t.consume(D),s=0,k):sn(D)?(t.consume(D),j):n(D)}function d(D){return D===45?(t.consume(D),b):n(D)}function g(D){return D===null?n(D):D===45?(t.consume(D),y):Ce(D)?(o=g,ue(D)):(t.consume(D),g)}function y(D){return D===45?(t.consume(D),b):g(D)}function b(D){return D===62?W(D):D===45?y(D):g(D)}function k(D){const F="CDATA[";return D===F.charCodeAt(s++)?(t.consume(D),s===F.length?E:k):n(D)}function E(D){return D===null?n(D):D===93?(t.consume(D),N):Ce(D)?(o=E,ue(D)):(t.consume(D),E)}function N(D){return D===93?(t.consume(D),M):E(D)}function M(D){return D===62?W(D):D===93?(t.consume(D),M):E(D)}function j(D){return D===null||D===62?W(D):Ce(D)?(o=j,ue(D)):(t.consume(D),j)}function P(D){return D===null?n(D):D===63?(t.consume(D),U):Ce(D)?(o=P,ue(D)):(t.consume(D),P)}function U(D){return D===62?W(D):P(D)}function L(D){return sn(D)?(t.consume(D),C):n(D)}function C(D){return D===45||vn(D)?(t.consume(D),C):z(D)}function z(D){return Ce(D)?(o=z,ue(D)):qe(D)?(t.consume(D),z):W(D)}function G(D){return D===45||vn(D)?(t.consume(D),G):D===47||D===62||We(D)?J(D):n(D)}function J(D){return D===47?(t.consume(D),W):D===58||D===95||sn(D)?(t.consume(D),K):Ce(D)?(o=J,ue(D)):qe(D)?(t.consume(D),J):W(D)}function K(D){return D===45||D===46||D===58||D===95||vn(D)?(t.consume(D),K):de(D)}function de(D){return D===61?(t.consume(D),ce):Ce(D)?(o=de,ue(D)):qe(D)?(t.consume(D),de):J(D)}function ce(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(t.consume(D),i=D,Se):Ce(D)?(o=ce,ue(D)):qe(D)?(t.consume(D),ce):(t.consume(D),Re)}function Se(D){return D===i?(t.consume(D),i=void 0,Y):D===null?n(D):Ce(D)?(o=Se,ue(D)):(t.consume(D),Se)}function Re(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||We(D)?J(D):(t.consume(D),Re)}function Y(D){return D===47||D===62||We(D)?J(D):n(D)}function W(D){return D===62?(t.consume(D),t.exit("htmlTextData"),t.exit("htmlText"),e):n(D)}function ue(D){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),ke}function ke(D){return qe(D)?He(t,ze,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ze(D)}function ze(D){return t.enter("htmlTextData"),o(D)}}const mS={name:"labelEnd",resolveAll:DL,resolveTo:IL,tokenize:_L},ML={tokenize:zL},OL={tokenize:LL},RL={tokenize:BL};function DL(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&Er(t,0,t.length,n),t}function IL(t,e){let n=t.length,r=0,i,s,o,u;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const c={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},h={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},d={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return u=[["enter",c,e],["enter",h,e]],u=Wr(u,t.slice(s+1,s+r+3)),u=Wr(u,[["enter",d,e]]),u=Wr(u,vg(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),u=Wr(u,[["exit",d,e],t[o-2],t[o-1],["exit",h,e]]),u=Wr(u,t.slice(o+1)),u=Wr(u,[["exit",c,e]]),Er(t,s,t.length,u),t}function _L(t,e,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return u;function u(y){return s?s._inactive?g(y):(o=r.parser.defined.includes(wi(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(y),t.exit("labelMarker"),t.exit("labelEnd"),c):n(y)}function c(y){return y===40?t.attempt(ML,d,o?d:g)(y):y===91?t.attempt(OL,d,o?h:g)(y):o?d(y):g(y)}function h(y){return t.attempt(RL,d,g)(y)}function d(y){return e(y)}function g(y){return s._balanced=!0,n(y)}}function zL(t,e,n){return r;function r(g){return t.enter("resource"),t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),i}function i(g){return We(g)?Ts(t,s)(g):s(g)}function s(g){return g===41?d(g):WT(t,o,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function o(g){return We(g)?Ts(t,c)(g):d(g)}function u(g){return n(g)}function c(g){return g===34||g===39||g===40?ZT(t,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):d(g)}function h(g){return We(g)?Ts(t,d)(g):d(g)}function d(g){return g===41?(t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),t.exit("resource"),e):n(g)}}function LL(t,e,n){const r=this;return i;function i(u){return XT.call(r,t,s,o,"reference","referenceMarker","referenceString")(u)}function s(u){return r.parser.defined.includes(wi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(u):n(u)}function o(u){return n(u)}}function BL(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const VL={name:"labelStartImage",resolveAll:mS.resolveAll,tokenize:FL};function FL(t,e,n){const r=this;return i;function i(u){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(u),t.exit("labelImageMarker"),s}function s(u){return u===91?(t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelImage"),o):n(u)}function o(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):e(u)}}const PL={name:"labelStartLink",resolveAll:mS.resolveAll,tokenize:jL};function jL(t,e,n){const r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const o1={name:"lineEnding",tokenize:$L};function $L(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),He(t,e,"linePrefix")}}const Pd={name:"thematicBreak",tokenize:UL};function UL(t,e,n){let r=0,i;return s;function s(h){return t.enter("thematicBreak"),o(h)}function o(h){return i=h,u(h)}function u(h){return h===i?(t.enter("thematicBreakSequence"),c(h)):r>=3&&(h===null||Ce(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===i?(t.consume(h),r++,c):(t.exit("thematicBreakSequence"),qe(h)?He(t,u,"whitespace")(h):u(h))}}const lr={continuation:{tokenize:KL},exit:YL,name:"list",tokenize:HL},JL={partial:!0,tokenize:QL},qL={partial:!0,tokenize:GL};function HL(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return u;function u(b){const k=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:Lx(b)){if(r.containerState.type||(r.containerState.type=k,t.enter(k,{_container:!0})),k==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(Pd,n,h)(b):h(b);if(!r.interrupt||b===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(b)}return n(b)}function c(b){return Lx(b)&&++o<10?(t.consume(b),c):(!r.interrupt||o<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(t.exit("listItemValue"),h(b)):n(b)}function h(b){return t.enter("listItemMarker"),t.consume(b),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,t.check(ju,r.interrupt?n:d,t.attempt(JL,y,g))}function d(b){return r.containerState.initialBlankLine=!0,s++,y(b)}function g(b){return qe(b)?(t.enter("listItemPrefixWhitespace"),t.consume(b),t.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(b)}}function KL(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(ju,i,s);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,He(t,e,"listItemIndent",r.containerState.size+1)(u)}function s(u){return r.containerState.furtherBlankLines||!qe(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(qL,e,o)(u))}function o(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,He(t,t.attempt(lr,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function GL(t,e,n){const r=this;return He(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function YL(t){t.exit(this.containerState.type)}function QL(t,e,n){const r=this;return He(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!qe(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const vE={name:"setextUnderline",resolveTo:WL,tokenize:XL};function WL(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function XL(t,e,n){const r=this;let i;return s;function s(h){let d=r.events.length,g;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){g=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(t.enter("setextHeadingLine"),i=h,o(h)):n(h)}function o(h){return t.enter("setextHeadingLineSequence"),u(h)}function u(h){return h===i?(t.consume(h),u):(t.exit("setextHeadingLineSequence"),qe(h)?He(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||Ce(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const ZL={tokenize:e5};function e5(t){const e=this,n=t.attempt(ju,r,t.attempt(this.parser.constructs.flowInitial,i,He(t,t.attempt(this.parser.constructs.flow,i,t.attempt(sL,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const t5={resolveAll:tM()},n5=eM("string"),r5=eM("text");function eM(t){return{resolveAll:tM(t==="text"?i5:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,u);return o;function o(d){return h(d)?s(d):u(d)}function u(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return h(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function h(d){if(d===null)return!0;const g=i[d];let y=-1;if(g)for(;++y<g.length;){const b=g[y];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function tM(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function i5(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,o=-1,u=0,c;for(;s--;){const h=i[s];if(typeof h=="string"){for(o=h.length;h.charCodeAt(o-1)===32;)u++,o--;if(o)break;o=-1}else if(h===-2)c=!0,u++;else if(h!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(u=0),u){const h={type:n===t.length||c||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-u,offset:r.end.offset-u},end:{...r.end}};r.end={...h.start},r.start.offset===r.end.offset?Object.assign(r,h):(t.splice(n,0,["enter",h,e],["exit",h,e]),n+=2)}n++}return t}const s5={42:lr,43:lr,45:lr,48:lr,49:lr,50:lr,51:lr,52:lr,53:lr,54:lr,55:lr,56:lr,57:lr,62:KT},a5={91:cL},o5={[-2]:a1,[-1]:a1,32:a1},l5={35:gL,42:Pd,45:[vE,Pd],60:SL,61:vE,95:Pd,96:bE,126:bE},u5={38:YT,92:GT},c5={[-5]:o1,[-4]:o1,[-3]:o1,33:VL,38:YT,42:Bx,60:[Pz,NL],91:PL,92:[dL,GT],93:mS,95:Bx,96:Zz},f5={null:[Bx,t5]},h5={null:[42,95]},p5={null:[]},d5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:h5,contentInitial:a5,disable:p5,document:s5,flow:l5,flowInitial:o5,insideSpan:f5,string:u5,text:c5},Symbol.toStringTag,{value:"Module"}));function m5(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],u=[];const c={attempt:z(L),check:z(C),consume:j,enter:P,exit:U,interrupt:z(C,{interrupt:!0})},h={code:null,containerState:{},defineSkip:E,events:[],now:k,parser:t,previous:null,sliceSerialize:y,sliceStream:b,write:g};let d=e.tokenize.call(h,c);return e.resolveAll&&s.push(e),h;function g(de){return o=Wr(o,de),N(),o[o.length-1]!==null?[]:(G(e,0),h.events=vg(s,h.events,h),h.events)}function y(de,ce){return y5(b(de),ce)}function b(de){return g5(o,de)}function k(){const{_bufferIndex:de,_index:ce,line:Se,column:Re,offset:Y}=r;return{_bufferIndex:de,_index:ce,line:Se,column:Re,offset:Y}}function E(de){i[de.line]=de.column,K()}function N(){let de;for(;r._index<o.length;){const ce=o[r._index];if(typeof ce=="string")for(de=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===de&&r._bufferIndex<ce.length;)M(ce.charCodeAt(r._bufferIndex));else M(ce)}}function M(de){d=d(de)}function j(de){Ce(de)?(r.line++,r.column=1,r.offset+=de===-3?2:1,K()):de!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=de}function P(de,ce){const Se=ce||{};return Se.type=de,Se.start=k(),h.events.push(["enter",Se,h]),u.push(Se),Se}function U(de){const ce=u.pop();return ce.end=k(),h.events.push(["exit",ce,h]),ce}function L(de,ce){G(de,ce.from)}function C(de,ce){ce.restore()}function z(de,ce){return Se;function Se(Re,Y,W){let ue,ke,ze,D;return Array.isArray(Re)?ee(Re):"tokenize"in Re?ee([Re]):F(Re);function F(Me){return Xe;function Xe(Ct){const Ze=Ct!==null&&Me[Ct],zt=Ct!==null&&Me.null,Lt=[...Array.isArray(Ze)?Ze:Ze?[Ze]:[],...Array.isArray(zt)?zt:zt?[zt]:[]];return ee(Lt)(Ct)}}function ee(Me){return ue=Me,ke=0,Me.length===0?W:V(Me[ke])}function V(Me){return Xe;function Xe(Ct){return D=J(),ze=Me,Me.partial||(h.currentConstruct=Me),Me.name&&h.parser.constructs.disable.null.includes(Me.name)?De():Me.tokenize.call(ce?Object.assign(Object.create(h),ce):h,c,be,De)(Ct)}}function be(Me){return de(ze,D),Y}function De(Me){return D.restore(),++ke<ue.length?V(ue[ke]):W}}}function G(de,ce){de.resolveAll&&!s.includes(de)&&s.push(de),de.resolve&&Er(h.events,ce,h.events.length-ce,de.resolve(h.events.slice(ce),h)),de.resolveTo&&(h.events=de.resolveTo(h.events,h))}function J(){const de=k(),ce=h.previous,Se=h.currentConstruct,Re=h.events.length,Y=Array.from(u);return{from:Re,restore:W};function W(){r=de,h.previous=ce,h.currentConstruct=Se,h.events.length=Re,u=Y,K()}}function K(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function g5(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const u=o[0];typeof u=="string"?o[0]=u.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function y5(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
3
3
  `;break}case-3:{o=`\r
4
4
  `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function x5(t){const r={constructs:dS([d5,...(t||{}).extensions||[]]),content:i(Iz),defined:[],document:i(zz),flow:i(ZL),lazy:{},string:i(n5),text:i(r5)};return r;function i(s){return o;function o(u){return m5(r,s,u)}}}function b5(t){for(;!QT(t););return t}const kE=/[\0\t\n\r]/g;function S5(){let t=1,e="",n=!0,r;return i;function i(s,o,u){const c=[];let h,d,g,y,b;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),g=0,e="",n&&(s.charCodeAt(0)===65279&&g++,n=void 0);g<s.length;){if(kE.lastIndex=g,h=kE.exec(s),y=h&&h.index!==void 0?h.index:s.length,b=s.charCodeAt(y),!h){e=s.slice(g);break}if(b===10&&g===y&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),g<y&&(c.push(s.slice(g,y)),t+=y-g),b){case 0:{c.push(65533),t++;break}case 9:{for(d=Math.ceil(t/4)*4,c.push(-2);t++<d;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:r=!0,t=1}g=y+1}return u&&(r&&c.push(-5),e&&c.push(e),c.push(null)),c}}const v5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nM(t){return t.replace(v5,k5)}function k5(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return HT(n.slice(s?2:1),s?16:10)}return fh(n)||t}function Ms(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?CE(t.position):"start"in t||"end"in t?CE(t):"line"in t||"column"in t?Vx(t):""}function Vx(t){return wE(t&&t.line)+":"+wE(t&&t.column)}function CE(t){return Vx(t&&t.start)+"-"+Vx(t&&t.end)}function wE(t){return t&&typeof t=="number"?t:1}const rM={}.hasOwnProperty;function C5(t,e,n){return typeof e!="string"&&(n=e,e=void 0),w5(n)(b5(x5(n).document().write(S5()(t,e,!0))))}function w5(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ci),autolinkProtocol:J,autolinkEmail:J,atxHeading:s(dr),blockQuote:s(zt),characterEscape:J,characterReference:J,codeFenced:s(Lt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Lt,o),codeText:s(Oi,o),codeTextData:J,data:J,codeFlowValue:J,definition:s(ui),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Wn),hardBreakEscape:s(Or),hardBreakTrailing:s(Or),htmlFlow:s(Xn,o),htmlFlowData:J,htmlText:s(Xn,o),htmlTextData:J,image:s(mr),label:o,link:s(ci),listItem:s(Rr),listItemValue:y,listOrdered:s(Rn,g),listUnordered:s(Rn),paragraph:s(Ri),reference:V,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(dr),strong:s(Dr),thematicBreak:s(Zi)},exit:{atxHeading:c(),atxHeadingSequence:L,autolink:c(),autolinkEmail:Ze,autolinkProtocol:Ct,blockQuote:c(),characterEscapeValue:K,characterReferenceMarkerHexadecimal:De,characterReferenceMarkerNumeric:De,characterReferenceValue:Me,characterReference:Xe,codeFenced:c(N),codeFencedFence:E,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:K,codeIndented:c(M),codeText:c(Y),codeTextData:K,data:K,definition:c(),definitionDestinationString:U,definitionLabelString:j,definitionTitleString:P,emphasis:c(),hardBreakEscape:c(ce),hardBreakTrailing:c(ce),htmlFlow:c(Se),htmlFlowData:K,htmlText:c(Re),htmlTextData:K,image:c(ue),label:ze,labelText:ke,lineEnding:de,link:c(W),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:be,resourceDestinationString:D,resourceTitleString:F,resource:ee,setextHeading:c(G),setextHeadingLineSequence:z,setextHeadingText:C,strong:c(),thematicBreak:c()}};iM(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(le){let me={type:"root",children:[]};const _={stack:[me],tokenStack:[],config:e,enter:u,exit:h,buffer:o,resume:d,data:n},Ie=[];let Pe=-1;for(;++Pe<le.length;)if(le[Pe][1].type==="listOrdered"||le[Pe][1].type==="listUnordered")if(le[Pe][0]==="enter")Ie.push(Pe);else{const tn=Ie.pop();Pe=i(le,tn,Pe)}for(Pe=-1;++Pe<le.length;){const tn=e[le[Pe][0]];rM.call(tn,le[Pe][1].type)&&tn[le[Pe][1].type].call(Object.assign({sliceSerialize:le[Pe][2].sliceSerialize},_),le[Pe][1])}if(_.tokenStack.length>0){const tn=_.tokenStack[_.tokenStack.length-1];(tn[1]||EE).call(_,void 0,tn[0])}for(me.position={start:wa(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:wa(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<e.transforms.length;)me=e.transforms[Pe](me)||me;return me}function i(le,me,_){let Ie=me-1,Pe=-1,tn=!1,Zn,ve,_t,yn;for(;++Ie<=_;){const St=le[Ie];switch(St[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{St[0]==="enter"?Pe++:Pe--,yn=void 0;break}case"lineEndingBlank":{St[0]==="enter"&&(Zn&&!yn&&!Pe&&!_t&&(_t=Ie),yn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:yn=void 0}if(!Pe&&St[0]==="enter"&&St[1].type==="listItemPrefix"||Pe===-1&&St[0]==="exit"&&(St[1].type==="listUnordered"||St[1].type==="listOrdered")){if(Zn){let er=Ie;for(ve=void 0;er--;){const Dn=le[er];if(Dn[1].type==="lineEnding"||Dn[1].type==="lineEndingBlank"){if(Dn[0]==="exit")continue;ve&&(le[ve][1].type="lineEndingBlank",tn=!0),Dn[1].type="lineEnding",ve=er}else if(!(Dn[1].type==="linePrefix"||Dn[1].type==="blockQuotePrefix"||Dn[1].type==="blockQuotePrefixWhitespace"||Dn[1].type==="blockQuoteMarker"||Dn[1].type==="listItemIndent"))break}_t&&(!ve||_t<ve)&&(Zn._spread=!0),Zn.end=Object.assign({},ve?le[ve][1].start:St[1].end),le.splice(ve||Ie,0,["exit",Zn,St[2]]),Ie++,_++}if(St[1].type==="listItemPrefix"){const er={type:"listItem",_spread:!1,start:Object.assign({},St[1].start),end:void 0};Zn=er,le.splice(Ie,0,["enter",er,St[2]]),Ie++,_++,_t=void 0,yn=!0}}}return le[me][1]._spread=tn,_}function s(le,me){return _;function _(Ie){u.call(this,le(Ie),Ie),me&&me.call(this,Ie)}}function o(){this.stack.push({type:"fragment",children:[]})}function u(le,me,_){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([me,_||void 0]),le.position={start:wa(me.start),end:void 0}}function c(le){return me;function me(_){le&&le.call(this,_),h.call(this,_)}}function h(le,me){const _=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==le.type&&(me?me.call(this,le,Ie[0]):(Ie[1]||EE).call(this,le,Ie[0]));else throw new Error("Cannot close `"+le.type+"` ("+Ms({start:le.start,end:le.end})+"): it’s not open");_.position.end=wa(le.end)}function d(){return pS(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),me=this.stack[this.stack.length-1];me.lang=le}function k(){const le=this.resume(),me=this.stack[this.stack.length-1];me.meta=le}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const le=this.resume(),me=this.stack[this.stack.length-1];me.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const le=this.resume(),me=this.stack[this.stack.length-1];me.value=le.replace(/(\r?\n|\r)$/g,"")}function j(le){const me=this.resume(),_=this.stack[this.stack.length-1];_.label=me,_.identifier=wi(this.sliceSerialize(le)).toLowerCase()}function P(){const le=this.resume(),me=this.stack[this.stack.length-1];me.title=le}function U(){const le=this.resume(),me=this.stack[this.stack.length-1];me.url=le}function L(le){const me=this.stack[this.stack.length-1];if(!me.depth){const _=this.sliceSerialize(le).length;me.depth=_}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function z(le){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function J(le){const _=this.stack[this.stack.length-1].children;let Ie=_[_.length-1];(!Ie||Ie.type!=="text")&&(Ie=$e(),Ie.position={start:wa(le.start),end:void 0},_.push(Ie)),this.stack.push(Ie)}function K(le){const me=this.stack.pop();me.value+=this.sliceSerialize(le),me.position.end=wa(le.end)}function de(le){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const _=me.children[me.children.length-1];_.position.end=wa(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(me.type)&&(J.call(this,le),K.call(this,le))}function ce(){this.data.atHardBreak=!0}function Se(){const le=this.resume(),me=this.stack[this.stack.length-1];me.value=le}function Re(){const le=this.resume(),me=this.stack[this.stack.length-1];me.value=le}function Y(){const le=this.resume(),me=this.stack[this.stack.length-1];me.value=le}function W(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=me,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ue(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=me,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ke(le){const me=this.sliceSerialize(le),_=this.stack[this.stack.length-2];_.label=nM(me),_.identifier=wi(me).toLowerCase()}function ze(){const le=this.stack[this.stack.length-1],me=this.resume(),_=this.stack[this.stack.length-1];if(this.data.inReference=!0,_.type==="link"){const Ie=le.children;_.children=Ie}else _.alt=me}function D(){const le=this.resume(),me=this.stack[this.stack.length-1];me.url=le}function F(){const le=this.resume(),me=this.stack[this.stack.length-1];me.title=le}function ee(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function be(le){const me=this.resume(),_=this.stack[this.stack.length-1];_.label=me,_.identifier=wi(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function De(le){this.data.characterReferenceType=le.type}function Me(le){const me=this.sliceSerialize(le),_=this.data.characterReferenceType;let Ie;_?(Ie=HT(me,_==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=fh(me);const Pe=this.stack[this.stack.length-1];Pe.value+=Ie}function Xe(le){const me=this.stack.pop();me.position.end=wa(le.end)}function Ct(le){K.call(this,le);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(le)}function Ze(le){K.call(this,le);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(le)}function zt(){return{type:"blockquote",children:[]}}function Lt(){return{type:"code",lang:null,meta:null,value:""}}function Oi(){return{type:"inlineCode",value:""}}function ui(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Wn(){return{type:"emphasis",children:[]}}function dr(){return{type:"heading",depth:0,children:[]}}function Or(){return{type:"break"}}function Xn(){return{type:"html",value:""}}function mr(){return{type:"image",title:null,url:"",alt:null}}function ci(){return{type:"link",title:null,url:"",children:[]}}function Rn(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function Rr(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Ri(){return{type:"paragraph",children:[]}}function Dr(){return{type:"strong",children:[]}}function $e(){return{type:"text",value:""}}function Zi(){return{type:"thematicBreak"}}}function wa(t){return{line:t.line,column:t.column,offset:t.offset}}function iM(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?iM(t,r):E5(t,r)}}function E5(t,e){let n;for(n in e)if(rM.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function EE(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Ms({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Ms({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Ms({start:e.start,end:e.end})+") is still open")}function wm(t){const e=this;e.parser=n;function n(r){return C5(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}const AE={}.hasOwnProperty;function A5(t,e){const n=e||{};function r(i,...s){let o=r.invalid;const u=r.handlers;if(i&&AE.call(i,t)){const c=String(i[t]);o=AE.call(u,c)?u[c]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const N5={}.hasOwnProperty;function sM(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)sM(t,e.extensions[n]);for(r in e)if(N5.call(e,r))switch(r){case"extensions":break;case"unsafe":{NE(t[r],e[r]);break}case"join":{NE(t[r],e[r]);break}case"handlers":{T5(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function NE(t,e){e&&t.push(...e)}function T5(t,e){e&&Object.assign(t,e)}function M5(t,e,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(t,s.current()),O5);return i(),o}function O5(t,e,n){return">"+(n?"":" ")+t}function aM(t,e){return TE(t,e.inConstruct,!0)&&!TE(t,e.notInConstruct,!1)}function TE(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function ME(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
@@ -54,7 +54,7 @@ var iE=t=>{throw TypeError(t)};var sE=(t,e,n)=>e.has(t)||iE("Cannot "+n);var tt=
54
54
  `:" ")+s.indentLines(s.containerFlow(r,u.current()),e?nI:YU))),h(),c}}function YU(t,e,n){return e===0?t:nI(t,e,n)}function nI(t,e,n){return(n?"":" ")+t}const QU=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];rI.peek=tJ;function WU(){return{canContainEols:["delete"],enter:{strikethrough:ZU},exit:{strikethrough:eJ}}}function XU(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:QU}],handlers:{delete:rI}}}function ZU(t){this.enter({type:"delete",children:[]},t)}function eJ(t){this.exit(t)}function rI(t,e,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(t,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function tJ(){return"~"}function nJ(t){return t.length}function rJ(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||nJ,s=[],o=[],u=[],c=[];let h=0,d=-1;for(;++d<t.length;){const E=[],N=[];let M=-1;for(t[d].length>h&&(h=t[d].length);++M<t[d].length;){const j=iJ(t[d][M]);if(n.alignDelimiters!==!1){const P=i(j);N[M]=P,(c[M]===void 0||P>c[M])&&(c[M]=P)}E.push(j)}o[d]=E,u[d]=N}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<h;)s[g]=UN(r[g]);else{const E=UN(r);for(;++g<h;)s[g]=E}g=-1;const y=[],b=[];for(;++g<h;){const E=s[g];let N="",M="";E===99?(N=":",M=":"):E===108?N=":":E===114&&(M=":");let j=n.alignDelimiters===!1?1:Math.max(1,c[g]-N.length-M.length);const P=N+"-".repeat(j)+M;n.alignDelimiters!==!1&&(j=N.length+j+M.length,j>c[g]&&(c[g]=j),b[g]=j),y[g]=P}o.splice(1,0,y),u.splice(1,0,b),d=-1;const k=[];for(;++d<o.length;){const E=o[d],N=u[d];g=-1;const M=[];for(;++g<h;){const j=E[g]||"";let P="",U="";if(n.alignDelimiters!==!1){const L=c[g]-(N[g]||0),C=s[g];C===114?P=" ".repeat(L):C===99?L%2?(P=" ".repeat(L/2+.5),U=" ".repeat(L/2-.5)):(P=" ".repeat(L/2),U=P):U=" ".repeat(L)}n.delimiterStart!==!1&&!g&&M.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&j==="")&&(n.delimiterStart!==!1||g)&&M.push(" "),n.alignDelimiters!==!1&&M.push(P),M.push(j),n.alignDelimiters!==!1&&M.push(U),n.padding!==!1&&M.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&M.push("|")}k.push(n.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return k.join(`
55
55
  `)}function iJ(t){return t==null?"":String(t)}function UN(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function sJ(){return{enter:{table:aJ,tableData:JN,tableHeader:JN,tableRow:lJ},exit:{codeText:uJ,table:oJ,tableData:lx,tableHeader:lx,tableRow:lx}}}function aJ(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function oJ(t){this.exit(t),this.data.inTable=void 0}function lJ(t){this.enter({type:"tableRow",children:[]},t)}function lx(t){this.exit(t)}function JN(t){this.enter({type:"tableCell",children:[]},t)}function uJ(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,cJ));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function cJ(t,e){return e==="|"?e:t}function fJ(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
56
56
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:o,tableCell:c,tableRow:u}};function o(b,k,E,N){return h(d(b,E,N),b.align)}function u(b,k,E,N){const M=g(b,E,N),j=h([M]);return j.slice(0,j.indexOf(`
57
- `))}function c(b,k,E,N){const M=E.enter("tableCell"),j=E.enter("phrasing"),P=E.containerPhrasing(b,{...N,before:s,after:s});return j(),M(),P}function h(b,k){return rJ(b,{align:k,alignDelimiters:r,padding:n,stringLength:i})}function d(b,k,E){const N=b.children;let M=-1;const j=[],P=k.enter("table");for(;++M<N.length;)j[M]=g(N[M],k,E);return P(),j}function g(b,k,E){const N=b.children;let M=-1;const j=[],P=k.enter("tableRow");for(;++M<N.length;)j[M]=c(N[M],b,k,E);return P(),j}function y(b,k,E){let N=xS.inlineCode(b,k,E);return E.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function hJ(){return{exit:{taskListCheckValueChecked:qN,taskListCheckValueUnchecked:qN,paragraph:dJ}}}function pJ(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:mJ}}}function qN(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function dJ(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const u=i[s];if(u.type==="paragraph"){o=u;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function mJ(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);s&&u.move(o);let c=xS.listItem(t,e,n,{...r,...u.current()});return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),c;function h(d){return d+o}}function gJ(){return[AU(),KU(),WU(),sJ(),hJ()]}function yJ(t){return{extensions:[NU(),GU(t),XU(),fJ(t),pJ()]}}const xJ={tokenize:wJ,partial:!0},iI={tokenize:EJ,partial:!0},sI={tokenize:AJ,partial:!0},aI={tokenize:NJ,partial:!0},bJ={tokenize:TJ,partial:!0},oI={name:"wwwAutolink",tokenize:kJ,previous:uI},lI={name:"protocolAutolink",tokenize:CJ,previous:cI},Hs={name:"emailAutolink",tokenize:vJ,previous:fI},Qi={};function SJ(){return{text:Qi}}let Eo=48;for(;Eo<123;)Qi[Eo]=Hs,Eo++,Eo===58?Eo=65:Eo===91&&(Eo=97);Qi[43]=Hs;Qi[45]=Hs;Qi[46]=Hs;Qi[95]=Hs;Qi[72]=[Hs,lI];Qi[104]=[Hs,lI];Qi[87]=[Hs,oI];Qi[119]=[Hs,oI];function vJ(t,e,n){const r=this;let i,s;return o;function o(g){return!nS(g)||!fI.call(r,r.previous)||ik(r.events)?n(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(g))}function u(g){return nS(g)?(t.consume(g),u):g===64?(t.consume(g),c):n(g)}function c(g){return g===46?t.check(bJ,d,h)(g):g===45||g===95||vn(g)?(s=!0,t.consume(g),c):d(g)}function h(g){return t.consume(g),i=!0,c}function d(g){return s&&i&&sn(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(g)):n(g)}}function kJ(t,e,n){const r=this;return i;function i(o){return o!==87&&o!==119||!uI.call(r,r.previous)||ik(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(xJ,t.attempt(iI,t.attempt(sI,s),n),n)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function CJ(t,e,n){const r=this;let i="",s=!1;return o;function o(g){return(g===72||g===104)&&cI.call(r,r.previous)&&!ik(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(g),t.consume(g),u):n(g)}function u(g){if(sn(g)&&i.length<5)return i+=String.fromCodePoint(g),t.consume(g),u;if(g===58){const y=i.toLowerCase();if(y==="http"||y==="https")return t.consume(g),c}return n(g)}function c(g){return g===47?(t.consume(g),s?h:(s=!0,c)):n(g)}function h(g){return g===null||Cm(g)||We(g)||Vn(g)||Sg(g)?n(g):t.attempt(iI,t.attempt(sI,d),n)(g)}function d(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(g)}}function wJ(t,e,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),i):o===46&&r===3?(t.consume(o),s):n(o)}function s(o){return o===null?n(o):e(o)}}function EJ(t,e,n){let r,i,s;return o;function o(h){return h===46||h===95?t.check(aI,c,u)(h):h===null||We(h)||Vn(h)||h!==45&&Sg(h)?c(h):(s=!0,t.consume(h),o)}function u(h){return h===95?r=!0:(i=r,r=void 0),t.consume(h),o}function c(h){return i||r||!s?n(h):e(h)}}function AJ(t,e){let n=0,r=0;return i;function i(o){return o===40?(n++,t.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(aI,e,s)(o):o===null||We(o)||Vn(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&r++,t.consume(o),i}}function NJ(t,e,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(t.consume(u),r):u===38?(t.consume(u),s):u===93?(t.consume(u),i):u===60||u===null||We(u)||Vn(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||We(u)||Vn(u)?e(u):r(u)}function s(u){return sn(u)?o(u):n(u)}function o(u){return u===59?(t.consume(u),r):sn(u)?(t.consume(u),o):n(u)}}function TJ(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return vn(s)?n(s):e(s)}}function uI(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||We(t)}function cI(t){return!sn(t)}function fI(t){return!(t===47||nS(t))}function nS(t){return t===43||t===45||t===46||t===95||vn(t)}function ik(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const MJ={tokenize:BJ,partial:!0};function OJ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:_J,continuation:{tokenize:zJ},exit:LJ}},text:{91:{name:"gfmFootnoteCall",tokenize:IJ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:RJ,resolveTo:DJ}}}}function RJ(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!o||!o._balanced)return n(c);const h=wi(r.sliceSerialize({start:o.end,end:r.now()}));return h.codePointAt(0)!==94||!s.includes(h.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function DJ(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function IJ(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return u;function u(g){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),c}function c(g){return g!==94?n(g):(t.enter("gfmFootnoteCallMarker"),t.consume(g),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(g){if(s>999||g===93&&!o||g===null||g===91||We(g))return n(g);if(g===93){t.exit("chunkString");const y=t.exit("gfmFootnoteCallString");return i.includes(wi(r.sliceSerialize(y)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(g)}return We(g)||(o=!0),s++,t.consume(g),g===92?d:h}function d(g){return g===91||g===92||g===93?(t.consume(g),s++,h):h(g)}}function _J(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,u;return c;function c(k){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",d):n(k)}function d(k){if(o>999||k===93&&!u||k===null||k===91||We(k))return n(k);if(k===93){t.exit("chunkString");const E=t.exit("gfmFootnoteDefinitionLabelString");return s=wi(r.sliceSerialize(E)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),y}return We(k)||(u=!0),o++,t.consume(k),k===92?g:d}function g(k){return k===91||k===92||k===93?(t.consume(k),o++,d):d(k)}function y(k){return k===58?(t.enter("definitionMarker"),t.consume(k),t.exit("definitionMarker"),i.includes(s)||i.push(s),He(t,b,"gfmFootnoteDefinitionWhitespace")):n(k)}function b(k){return e(k)}}function zJ(t,e,n){return t.check(ju,e,t.attempt(MJ,e,n))}function LJ(t){t.exit("gfmFootnoteDefinition")}function BJ(t,e,n){const r=this;return He(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):n(s)}}function VJ(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,u){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let h=c;for(;h--;)if(o[h][0]==="exit"&&o[h][1].type==="strikethroughSequenceTemporary"&&o[h][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[h][1].end.offset-o[h][1].start.offset){o[c][1].type="strikethroughSequence",o[h][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[h][1].start),end:Object.assign({},o[c][1].end)},g={type:"strikethroughText",start:Object.assign({},o[h][1].end),end:Object.assign({},o[c][1].start)},y=[["enter",d,u],["enter",o[h][1],u],["exit",o[h][1],u],["enter",g,u]],b=u.parser.constructs.insideSpan.null;b&&Er(y,y.length,0,vg(b,o.slice(h+1,c),u)),Er(y,y.length,0,[["exit",g,u],["enter",o[c][1],u],["exit",o[c][1],u],["exit",d,u]]),Er(o,h-1,c-h+3,y),c=h+y.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function s(o,u,c){const h=this.previous,d=this.events;let g=0;return y;function y(k){return h===126&&d[d.length-1][1].type!=="characterEscape"?c(k):(o.enter("strikethroughSequenceTemporary"),b(k))}function b(k){const E=Iu(h);if(k===126)return g>1?c(k):(o.consume(k),g++,b);if(g<2&&!n)return c(k);const N=o.exit("strikethroughSequenceTemporary"),M=Iu(k);return N._open=!M||M===2&&!!E,N._close=!E||E===2&&!!M,u(k)}}}class FJ{constructor(){this.map=[]}add(e,n,r){PJ(this,e,n,r)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function PJ(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function jJ(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function $J(){return{flow:{null:{name:"table",tokenize:UJ,resolveAll:JJ}}}}function UJ(t,e,n){const r=this;let i=0,s=0,o;return u;function u(K){let de=r.events.length-1;for(;de>-1;){const Re=r.events[de][1].type;if(Re==="lineEnding"||Re==="linePrefix")de--;else break}const ce=de>-1?r.events[de][1].type:null,Se=ce==="tableHead"||ce==="tableRow"?C:c;return Se===C&&r.parser.lazy[r.now().line]?n(K):Se(K)}function c(K){return t.enter("tableHead"),t.enter("tableRow"),h(K)}function h(K){return K===124||(o=!0,s+=1),d(K)}function d(K){return K===null?n(K):Ce(K)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(K),t.exit("lineEnding"),b):n(K):qe(K)?He(t,d,"whitespace")(K):(s+=1,o&&(o=!1,i+=1),K===124?(t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),o=!0,d):(t.enter("data"),g(K)))}function g(K){return K===null||K===124||We(K)?(t.exit("data"),d(K)):(t.consume(K),K===92?y:g)}function y(K){return K===92||K===124?(t.consume(K),g):g(K)}function b(K){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(K):(t.enter("tableDelimiterRow"),o=!1,qe(K)?He(t,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):k(K))}function k(K){return K===45||K===58?N(K):K===124?(o=!0,t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),E):L(K)}function E(K){return qe(K)?He(t,N,"whitespace")(K):N(K)}function N(K){return K===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(K),t.exit("tableDelimiterMarker"),M):K===45?(s+=1,M(K)):K===null||Ce(K)?U(K):L(K)}function M(K){return K===45?(t.enter("tableDelimiterFiller"),j(K)):L(K)}function j(K){return K===45?(t.consume(K),j):K===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(K),t.exit("tableDelimiterMarker"),P):(t.exit("tableDelimiterFiller"),P(K))}function P(K){return qe(K)?He(t,U,"whitespace")(K):U(K)}function U(K){return K===124?k(K):K===null||Ce(K)?!o||i!==s?L(K):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(K)):L(K)}function L(K){return n(K)}function C(K){return t.enter("tableRow"),z(K)}function z(K){return K===124?(t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),z):K===null||Ce(K)?(t.exit("tableRow"),e(K)):qe(K)?He(t,z,"whitespace")(K):(t.enter("data"),G(K))}function G(K){return K===null||K===124||We(K)?(t.exit("data"),z(K)):(t.consume(K),K===92?J:G)}function J(K){return K===92||K===124?(t.consume(K),G):G(K)}}function JJ(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],u=!1,c=0,h,d,g;const y=new FJ;for(;++n<t.length;){const b=t[n],k=b[1];b[0]==="enter"?k.type==="tableHead"?(u=!1,c!==0&&(HN(y,e,c,h,d),d=void 0,c=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",h,e]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(r=!0,g=void 0,s=[0,0,0,0],o=[0,n+1,0,0],u&&(u=!1,d={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",d,e]])),i=k.type==="tableDelimiterRow"?2:d?3:1):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],g=Vd(y,e,s,i,void 0,g),s=[0,0,0,0]),o[2]=n)):k.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],g=Vd(y,e,s,i,void 0,g)),s=o,o=[s[1],n,0,0])):k.type==="tableHead"?(u=!0,c=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(c=n,s[1]!==0?(o[0]=o[1],g=Vd(y,e,s,i,n,g)):o[1]!==0&&(g=Vd(y,e,o,i,n,g)),i=0):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&HN(y,e,c,h,d),y.consume(e.events),n=-1;++n<e.events.length;){const b=e.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=jJ(e.events,n))}return t}function Vd(t,e,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},Eu(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const c=Eu(e.events,n[1]);if(s={type:o,start:Object.assign({},c),end:Object.assign({},c)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const h=Eu(e.events,n[2]),d=Eu(e.events,n[3]),g={type:u,start:Object.assign({},h),end:Object.assign({},d)};if(t.add(n[2],0,[["enter",g,e]]),r!==2){const y=e.events[n[2]],b=e.events[n[3]];if(y[1].end=Object.assign({},b[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,E=n[3]-n[2]-1;t.add(k,E,[])}}t.add(n[3]+1,0,[["exit",g,e]])}return i!==void 0&&(s.end=Object.assign({},Eu(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function HN(t,e,n,r,i){const s=[],o=Eu(e.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),r.end=Object.assign({},o),s.push(["exit",r,e]),t.add(n+1,0,s)}function Eu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const qJ={name:"tasklistCheck",tokenize:KJ};function HJ(){return{text:{91:qJ}}}function KJ(t,e,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),s)}function s(c){return We(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(c)}function u(c){return Ce(c)?e(c):qe(c)?t.check({tokenize:GJ},e,n)(c):n(c)}}function GJ(t,e,n){return He(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function YJ(t){return dS([SJ(),OJ(),VJ(t),$J(),HJ()])}const QJ={};function WJ(t){const e=this,n=t||QJ,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(YJ(n)),s.push(gJ()),o.push(yJ(n))}function Fe(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-gfm",...e}}),t}var sk=Xh("strike_through");Fe(sk,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var up=qu("strike_through",t=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",t.get(sk.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,n,r)=>{e.openMark(r),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,n)=>{e.withMark(n,"delete")}}}));Fe(up.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});Fe(up.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var Hg=Ue("ToggleStrikeThrough",t=>()=>Ag(up.type(t)));Fe(Hg,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var hI=pr(t=>Gh(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),up.type(t)));Fe(hI,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var ak=Mr("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:t=>{const e=t.get(xt);return()=>e.call(Hg.key)}}});Fe(ak.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});Fe(ak.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var cp=Aj({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:t=>t.style.textAlign||"left",setDOMAttr:(t,e)=>{e.style=`text-align: ${t||"left"}`}}}}),_s=en("table",()=>({...cp.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="table",runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r,isHeader:o===0}));t.openNode(n),t.next(i),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table",runner:(t,e)=>{const n=e.content.firstChild?.content;if(!n)return;const r=[];n.forEach(i=>{r.push(i.attrs.alignment)}),t.openNode("table",void 0,{align:r}),t.next(e.content),t.closeNode()}}}));Fe(_s.node,{displayName:"NodeSchema<table>",group:"Table"});Fe(_s.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var fp=en("table_header_row",()=>({...cp.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:t=>t instanceof HTMLElement&&t.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:t=>!!(t.type==="tableRow"&&t.isHeader),runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o],isHeader:e.isHeader}));t.openNode(n),t.next(i),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow",void 0,{isHeader:!0}),t.next(e.content),t.closeNode())}}}));Fe(fp.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});Fe(fp.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var Yu=en("table_row",()=>({...cp.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:t=>t.type==="tableRow",runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o]}));t.openNode(n),t.next(i),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow"),t.next(e.content),t.closeNode())}}}));Fe(Yu.node,{displayName:"NodeSchema<tableRow>",group:"Table"});Fe(Yu.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var hp=en("table_cell",()=>({...cp.table_cell,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!t.isHeader,runner:(t,e,n)=>{const r=e.align;t.openNode(n,{alignment:r}).openNode(t.schema.nodes.paragraph).next(e.children).closeNode().closeNode()}},toMarkdown:{match:t=>t.type.name==="table_cell",runner:(t,e)=>{t.openNode("tableCell").next(e.content).closeNode()}}}));Fe(hp.node,{displayName:"NodeSchema<tableCell>",group:"Table"});Fe(hp.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Pu=en("table_header",()=>({...cp.table_header,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!!t.isHeader,runner:(t,e,n)=>{const r=e.align;t.openNode(n,{alignment:r}),t.openNode(t.schema.nodes.paragraph),t.next(e.children),t.closeNode(),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header",runner:(t,e)=>{t.openNode("tableCell"),t.next(e.content),t.closeNode()}}}));Fe(Pu.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});Fe(Pu.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function pI(t,e=3,n=3){const r=Array(n).fill(0).map(()=>hp.type(t).createAndFill()),i=Array(n).fill(0).map(()=>Pu.type(t).createAndFill()),s=Array(e).fill(0).map((o,u)=>u===0?fp.type(t).create(null,i):Yu.type(t).create(null,r));return _s.type(t).create(null,s)}function dI(t){return(e,n)=>r=>{n=n??r.selection.from;const i=r.doc.resolve(n),s=YB(c=>c.type.name==="table")(i),o=s?{node:s.node,from:s.start}:void 0,u=t==="row";if(o){const c=bt.get(o.node);if(e>=0&&e<(u?c.height:c.width)){const h=c.positionAt(u?e:c.height-1,u?c.width-1:e,o.node),d=r.doc.resolve(o.from+h),g=u?Rt.rowSelection:Rt.colSelection,y=c.positionAt(u?e:0,u?0:e,o.node),b=r.doc.resolve(o.from+y);return TO(r.setSelection(g(d,b)))}}return r}}var XJ=dI("row"),ZJ=dI("col");function mI(t,e,{map:n,tableStart:r,table:i},s){const o=Array(s).fill(0).reduce((c,h,d)=>c+i.child(d).nodeSize,r),u=Array(n.width).fill(0).map((c,h)=>{const d=i.nodeAt(n.map[h]);return hp.type(t).createAndFill({alignment:d?.attrs.alignment})});return e.insert(o,Yu.type(t).create(null,u)),e}function eq(t){const e=ap(t.$from);if(!e)return;const n=bt.get(e.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(r=>{const i=e.node.nodeAt(r),s=r+e.start;return{pos:s,start:s+1,node:i}})}function tq(t){const e=eq(t.selection);if(e&&e[0]){const n=t.doc.resolve(e[0].pos),r=e[e.length-1];if(r){const i=t.doc.resolve(r.pos);return TO(t.setSelection(new Rt(i,n)))}}return t}var ok=Ue("GoToPrevTableCell",()=>()=>SD(-1));Fe(ok,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var lk=Ue("GoToNextTableCell",()=>()=>SD(1));Fe(lk,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var uk=Ue("ExitTable",t=>()=>(e,n)=>{if(!oi(e))return!1;const{$head:r}=e.selection,i=GB(r,_s.type(t));if(!i)return!1;const{to:s}=i,o=e.tr.replaceWith(s,s,Ui.type(t).createAndFill());return o.setSelection(Ve.near(o.doc.resolve(s),1)).scrollIntoView(),n?.(o),!0});Fe(uk,{displayName:"Command<breakTableCommand>",group:"Table"});var ck=Ue("InsertTable",t=>({row:e,col:n}={})=>(r,i)=>{const{selection:s,tr:o}=r,{from:u}=s,c=pI(t,e,n),h=o.replaceSelectionWith(c),d=Ve.findFrom(h.doc.resolve(u),1,!0);return d&&h.setSelection(d),i?.(h),!0});Fe(ck,{displayName:"Command<insertTableCommand>",group:"Table"});var gI=Ue("MoveRow",()=>({from:t,to:e,pos:n}={})=>e$({from:t??0,to:e??0,pos:n}));Fe(gI,{displayName:"Command<moveRowCommand>",group:"Table"});var yI=Ue("MoveCol",()=>({from:t,to:e,pos:n}={})=>t$({from:t??0,to:e??0,pos:n}));Fe(yI,{displayName:"Command<moveColCommand>",group:"Table"});var xI=Ue("SelectRow",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(XJ(t.index,t.pos)(r))});Fe(xI,{displayName:"Command<selectRowCommand>",group:"Table"});var bI=Ue("SelectCol",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(ZJ(t.index,t.pos)(r))});Fe(bI,{displayName:"Command<selectColCommand>",group:"Table"});var SI=Ue("SelectTable",()=>()=>(t,e)=>{const{tr:n}=t;return!!e?.(tq(n))});Fe(SI,{displayName:"Command<selectTableCommand>",group:"Table"});var vI=Ue("DeleteSelectedCells",()=>()=>(t,e)=>{const{selection:n}=t;if(!(n instanceof Rt))return!1;const r=n.isRowSelection(),i=n.isColSelection();return r&&i?Zj(t,e):i?Kj(t,e):Yj(t,e)});Fe(vI,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var kI=Ue("AddColBefore",()=>()=>Jj);Fe(kI,{displayName:"Command<addColBeforeCommand>",group:"Table"});var CI=Ue("AddColAfter",()=>()=>qj);Fe(CI,{displayName:"Command<addColAfterCommand>",group:"Table"});var wI=Ue("AddRowBefore",t=>()=>(e,n)=>{if(!oi(e))return!1;if(n){const r=to(e);n(mI(t,e.tr,r,r.top))}return!0});Fe(wI,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var EI=Ue("AddRowAfter",t=>()=>(e,n)=>{if(!oi(e))return!1;if(n){const r=to(e);n(mI(t,e.tr,r,r.bottom))}return!0});Fe(EI,{displayName:"Command<addRowAfterCommand>",group:"Table"});var AI=Ue("SetAlign",()=>(t="left")=>Qj("alignment",t));Fe(AI,{displayName:"Command<setAlignCommand>",group:"Table"});var NI=pr(t=>new Tr(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,n,r,i)=>{const s=e.doc.resolve(r);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),_s.type(t)))return null;const o=pI(t,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),u=e.tr.replaceRangeWith(r,i,o);return u.setSelection(Ae.create(u.doc,r+3)).scrollIntoView()}));Fe(NI,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var TI=cF(t=>({run:(e,n,r)=>{if(r)return e;function i(h){const d=h.childCount,g=h.lastChild?.childCount??0;if(d===0||g===0)return Ui.type(t).create();const y=h.firstChild;if(!(g>0&&y&&y.childCount===0))return h;if(d>=3){const N=h.child(1),M=[];for(let U=0;U<N.childCount;U++){const L=N.child(U);M.push(Pu.type(t).create(L.attrs,L.content,L.marks))}const j=y.type.create(y.attrs,M),P=[];for(let U=2;U<d;U++)P.push(h.child(U));return h.type.create(h.attrs,[j,...P])}const b=Array(g).fill(0).map(()=>Pu.type(t).createAndFill()),k=new H(Q.from(b),0,0),E=y.replace(0,0,k);return h.replace(0,y.nodeSize,new H(Q.from(E),0,0))}function s(h){const d=Yu.type(t),g=[];let y=[],b=!1;function k(){if(y.length===0)return;const E=fp.type(t).createAndFill(),N=_s.type(t).create(null,[E,...y]);g.push(i(N)),y=[]}return h.forEach(E=>{E.type===d?(b=!0,y.push(E)):(k(),g.push(E))}),k(),b?Q.from(g):h}function o(h){let d=s(h),g=d!==h;const y=[];return d.forEach(b=>{if(b.type===_s.type(t)){const k=i(b);k!==b&&(g=!0),y.push(k)}else if(b.childCount>0){const k=o(b.content);k!==b.content?(g=!0,y.push(b.copy(k))):y.push(b)}else y.push(b)}),g?Q.from(y):h}function u(h){const d=[],g=[];h.forEach(y=>g.push(y));for(let y=0;y<g.length;y++){const b=g[y],k=g[y+1];b.type===Ui.type(t)&&b.content.size===0&&k&&k.type===_s.type(t)||d.push(b)}return d.length<g.length?Q.from(d):h}let c=o(e.content);return c=u(c),new H(Q.from(c),e.openStart,e.openEnd)}}));Fe(TI,{displayName:"PasteRule<table>",group:"Table"});var fk=Mr("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:t=>{const e=t.get(xt);return()=>e.call(lk.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:t=>{const e=t.get(xt);return()=>e.call(ok.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:t=>{const e=t.get(xt);return()=>e.call(uk.key)}}});Fe(fk.ctx,{displayName:"KeymapCtx<table>",group:"Table"});Fe(fk.shortcuts,{displayName:"Keymap<table>",group:"Table"});var ux="footnote_definition",KN="footnoteDefinition",hk=en("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${ux}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Ki(t);return{label:t.dataset.label}},contentElement:"dd"}],toDOM:t=>{const e=t.attrs.label;return["dl",{"data-label":e,"data-type":ux},["dt",e],["dd",0]]},parseMarkdown:{match:({type:t})=>t===KN,runner:(t,e,n)=>{t.openNode(n,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:t=>t.type.name===ux,runner:(t,e)=>{t.openNode(KN,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));Fe(hk.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});Fe(hk.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var cx="footnote_reference",pk=en("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${cx}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Ki(t);return{label:t.dataset.label}}}],toDOM:t=>{const e=t.attrs.label;return["sup",{"data-label":e,"data-type":cx},e]},parseMarkdown:{match:({type:t})=>t==="footnoteReference",runner:(t,e,n)=>{t.addNode(n,{label:e.label})}},toMarkdown:{match:t=>t.type.name===cx,runner:(t,e)=>{t.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));Fe(pk.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});Fe(pk.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var dk=Us.extendSchema(t=>e=>{const n=t(e);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:r=>{if(!(r instanceof HTMLElement))throw Ki(r);return{label:r.dataset.label,listType:r.dataset.listType,spread:r.dataset.spread,checked:r.dataset.checked?r.dataset.checked==="true":null}}},...n?.parseDOM||[]],toDOM:r=>n.toDOM&&r.attrs.checked==null?n.toDOM(r):["li",{"data-item-type":"task","data-label":r.attrs.label,"data-list-type":r.attrs.listType,"data-spread":r.attrs.spread,"data-checked":r.attrs.checked},0],parseMarkdown:{match:({type:r})=>r==="listItem",runner:(r,i,s)=>{if(i.checked==null){n.parseMarkdown.runner(r,i,s);return}const o=i.label!=null?`${i.label}.`:"•",u=i.checked!=null?!!i.checked:null,c=i.label!=null?"ordered":"bullet",h=i.spread!=null?`${i.spread}`:"true";r.openNode(s,{label:o,listType:c,spread:h,checked:u}),r.next(i.children),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="list_item",runner:(r,i)=>{if(i.attrs.checked==null){n.toMarkdown.runner(r,i);return}const s=i.attrs.label,o=i.attrs.listType,u=i.attrs.spread==="true",c=i.attrs.checked;r.openNode("listItem",void 0,{label:s,listType:o,spread:u,checked:c}),r.next(i.content),r.closeNode()}}}});Fe(dk.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});Fe(dk.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var MI=pr(()=>new Tr(/^\[(?<checked>\s|x)\]\s$/,(t,e,n,r)=>{const i=t.doc.resolve(n);let s=0,o=i.node(s);for(;o&&o.type.name!=="list_item";)s--,o=i.node(s);if(!o||o.attrs.checked!=null)return null;const u=e.groups?.checked==="x",c=i.before(s),h=t.tr;return h.deleteRange(n,r).setNodeMarkup(c,void 0,{...o.attrs,checked:u}),h}));Fe(MI,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var nq=[ak,fk].flat(),rq=[NI,MI],iq=[hI],sq=[TI],OI=$s(()=>SU);Fe(OI,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var aq=$s(()=>f$({}));Fe(aq,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var RI=$s(()=>v$({allowTableNodeSelection:!0}));Fe(RI,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var mk=Ni("remarkGFM",()=>WJ);Fe(mk.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});Fe(mk.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var oq=new hr("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function lq(t,e){let n=0;return e.forEach((r,i,s)=>{r===t&&(n=s)}),n}var DI=$s(()=>new fr({key:oq,appendTransaction:(t,e,n)=>{let r;const i=(s,o)=>{if(r||(r=n.tr),s.type.name!=="table_cell")return;const u=n.doc.resolve(o),c=u.node(u.depth),h=u.node(u.depth-1).firstChild;if(!h)return;const d=lq(s,c),g=h.maybeChild(d);if(!g)return;const y=g.attrs.alignment;y!==s.attrs.alignment&&r.setNodeMarkup(o,void 0,{...s.attrs,alignment:y})};return e.doc!==n.doc&&n.doc.descendants(i),r}}));Fe(DI,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var uq=[DI,OI,mk,RI].flat(),cq=[dk,_s,fp,Yu,Pu,hp,hk,pk,sk,up].flat(),fq=[lk,ok,uk,ck,gI,yI,xI,bI,SI,vI,wI,EI,kI,CI,AI,Hg],II=[cq,rq,sq,iq,nq,fq,uq].flat();const gk={display:"flex",gap:6,alignItems:"center",padding:6,border:"1px solid #d4d4d8",borderRadius:6,background:"#fff",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",marginTop:6},eg={flex:1,border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 8px",font:"inherit",outline:"none",minWidth:0},_h={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},hq=gk,pq=eg,fx=_h;function dq({initialUrl:t,isEdit:e,onApply:n,onRemove:r,onClose:i}){const[s,o]=ae.useState(t),u=()=>{const c=s.trim();c!==""&&n(c)};return I.jsxs("div",{style:hq,"data-mdx-action":"link",onMouseDown:c=>c.stopPropagation(),children:[I.jsx("input",{style:pq,autoFocus:!0,placeholder:"https://…",value:s,onChange:c=>o(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),u()),c.key==="Escape"&&i()}}),I.jsx("button",{type:"button",style:{...fx,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:c=>c.preventDefault(),onClick:u,children:e?"Update":"Add"}),e&&r?I.jsx("button",{type:"button",style:{...fx,color:"#dc2626"},onMouseDown:c=>c.preventDefault(),onClick:r,children:"Remove"}):null,I.jsx("button",{type:"button",style:fx,onMouseDown:c=>c.preventDefault(),onClick:i,children:"Cancel"})]})}const mq={...gk,flexWrap:"wrap"},GN={fontSize:11,color:"#71717a",whiteSpace:"nowrap"};function gq({initialAlt:t,onApply:e,onClose:n}){const[r,i]=ae.useState(t),[s,o]=ae.useState(""),u=()=>e(r.trim(),s.trim()),c=h=>{h.key==="Enter"&&(h.preventDefault(),u()),h.key==="Escape"&&n()};return I.jsxs("div",{style:mq,"data-mdx-action":"image",onMouseDown:h=>h.stopPropagation(),children:[I.jsx("span",{style:GN,children:"Alt"}),I.jsx("input",{style:eg,autoFocus:!0,placeholder:"Alt text for screen readers",value:r,onChange:h=>i(h.currentTarget.value),onKeyDown:c}),I.jsx("span",{style:GN,children:"Caption"}),I.jsx("input",{style:eg,placeholder:"Caption / source (optional)",value:s,onChange:h=>o(h.currentTarget.value),onKeyDown:c}),I.jsx("button",{type:"button",style:{..._h,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:h=>h.preventDefault(),onClick:u,children:"Insert"}),I.jsx("button",{type:"button",style:_h,onMouseDown:h=>h.preventDefault(),onClick:n,children:"Cancel"})]})}function YN(t){return typeof t!="object"||t===null?!1:"status"in t&&t.status===501||"code"in t&&t.code==="unsupported"}const QN=new Set(["image/svg+xml","image/x-icon"]),yq=[{value:"all",label:"All"},{value:"photo",label:"Photos"},{value:"graphic",label:"Graphics"},{value:"document",label:"Documents"}];function xq(t,e){return e==="all"?!0:e==="photo"?t.startsWith("image/")&&!QN.has(t):e==="graphic"?QN.has(t):e==="document"?t==="application/pdf":!0}const bq={position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1100},Sq={width:"min(760px, 94vw)",maxHeight:"82vh",display:"flex",flexDirection:"column",background:"#fff",border:"1px solid #d4d4d8",borderRadius:12,boxShadow:"0 16px 48px rgba(0,0,0,0.28)",overflow:"hidden",fontSize:13,color:"#27272a"},vq={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #ececed"},kq={display:"flex",flexDirection:"column",gap:10,padding:"12px 16px",borderBottom:"1px solid #ececed"},Wc={display:"flex",alignItems:"center",gap:8},WN={flex:1,border:"1px solid #d4d4d8",borderRadius:6,padding:"6px 10px",font:"inherit",outline:"none"},Au={border:"1px solid #d4d4d8",background:"#fff",borderRadius:6,padding:"6px 12px",font:"inherit",cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},XN={...Au,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},Cq={display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10,padding:16,overflowY:"auto"},ZN={position:"relative",aspectRatio:"1 / 1",border:"1px solid #e4e4e7",borderRadius:8,overflow:"hidden",cursor:"pointer",background:"#fafafa",padding:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6},wq={position:"absolute",left:0,right:0,bottom:0,padding:"4px 6px",fontSize:11,color:"#fff",background:"linear-gradient(to top, rgba(0,0,0,0.65), transparent)",textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};function _I({media:t,context:e,field:n,accept:r="image/*,application/pdf",onSelect:i,onClose:s}){const[o,u]=ae.useState([]),[c,h]=ae.useState([]),[d,g]=ae.useState(""),[y,b]=ae.useState(""),[k,E]=ae.useState("all"),[N,M]=ae.useState(!1),[j,P]=ae.useState(!1),[U,L]=ae.useState(!1),[C,z]=ae.useState(null),[G,J]=ae.useState(!1),[K,de]=ae.useState(""),ce=ae.useRef(null),Se=ae.useMemo(()=>async D=>{M(!0),z(null);try{const F=await t.listMedia({folder:D||void 0});u(F.items),h(F.folders)}catch(F){YN(F)?P(!0):z(F instanceof Error?F.message:"Failed to load media")}finally{M(!1)}},[t]);ae.useEffect(()=>{Se(d)},[Se,d]);const Re=D=>{b(""),g(D)},Y=async D=>{L(!0),z(null);try{const F=await t.uploadMedia(D,{...e,field:n,folder:d||void 0});if(F.success&&F.url){if(F.url.startsWith("./")){i(F.url,F.annotation??"");return}const ee={id:F.id??F.url,url:F.url,filename:F.filename??D.name,annotation:F.annotation,contentType:D.type||"application/octet-stream",folder:d||void 0};u(V=>[ee,...V])}else z(F.error??"Upload failed")}catch(F){YN(F)?P(!0):z(F instanceof Error?F.message:"Upload failed")}finally{L(!1)}},W=async()=>{const D=K.trim();if(!D||!t.createFolder)return;if(/[/\\:*?"<>|]/.test(D)){z("Invalid folder name");return}const F=d?`${d}/${D}`:D;try{const ee=await t.createFolder(F);ee.success?h(V=>[...V,{name:D,path:F}].sort((be,De)=>be.name.localeCompare(De.name))):z(ee.error??"Failed to create folder")}catch(ee){z(ee instanceof Error?ee.message:"Failed to create folder")}de(""),J(!1)},ue=ae.useMemo(()=>{const D=k==="all"?o:o.filter(ee=>xq(ee.contentType,k)),F=y.trim().toLowerCase();return F===""?D:D.filter(ee=>ee.filename.toLowerCase().includes(F))},[o,k,y]),ke=ae.useMemo(()=>{if(!d)return[];const D=d.split("/");return D.map((F,ee)=>({name:F,path:D.slice(0,ee+1).join("/")}))},[d]),ze=!y&&k==="all";return I.jsx("div",{style:bq,onMouseDown:s,"data-cms-ui":"",children:I.jsxs("div",{style:Sq,onMouseDown:D=>D.stopPropagation(),onDrop:D=>{D.preventDefault();const F=D.dataTransfer.files[0];F&&Y(F)},onDragOver:D=>D.preventDefault(),children:[I.jsxs("div",{style:vq,children:[I.jsx("strong",{style:{fontSize:15},children:"Media Library"}),I.jsx("button",{type:"button",style:{...Au,border:"none",fontSize:18,lineHeight:1,padding:2},onClick:s,"aria-label":"Close",children:"×"})]}),I.jsxs("div",{style:kq,children:[ke.length>0?I.jsxs("div",{style:{...Wc,gap:4,fontSize:12,color:"#71717a"},children:[I.jsx("button",{type:"button",style:{...Au,border:"none",padding:"0 2px"},onClick:()=>Re(""),children:"root"}),ke.map((D,F)=>I.jsxs("span",{style:Wc,children:[I.jsx("span",{children:"/"}),F===ke.length-1?I.jsx("span",{style:{color:"#27272a",fontWeight:600},children:D.name}):I.jsx("button",{type:"button",style:{...Au,border:"none",padding:"0 2px"},onClick:()=>Re(D.path),children:D.name})]},D.path))]}):null,I.jsxs("div",{style:Wc,children:[I.jsx("input",{style:WN,placeholder:"Search files…",value:y,onChange:D=>b(D.target.value)}),t.createFolder?I.jsx("button",{type:"button",style:Au,onClick:()=>J(D=>!D),children:"New folder"}):null,I.jsx("button",{type:"button",style:XN,disabled:j||U,onClick:()=>ce.current?.click(),children:U?"Uploading…":"Upload"}),I.jsx("input",{ref:ce,type:"file",accept:r,style:{display:"none"},onChange:D=>{const F=D.target.files?.[0];F&&Y(F),D.target.value=""}})]}),I.jsx("div",{style:{...Wc,gap:4},children:yq.map(D=>I.jsx("button",{type:"button",style:{...Au,padding:"3px 10px",fontSize:12,...k===D.value?{background:"#2563eb",borderColor:"#2563eb",color:"#fff"}:{}},onClick:()=>E(D.value),children:D.label},D.value))}),G&&t.createFolder?I.jsxs("div",{style:Wc,children:[I.jsx("input",{style:WN,autoFocus:!0,placeholder:"Folder name…",value:K,onChange:D=>de(D.target.value),onKeyDown:D=>{D.key==="Enter"&&W(),D.key==="Escape"&&(J(!1),de(""))}}),I.jsx("button",{type:"button",style:XN,onClick:()=>{W()},children:"Create"})]}):null,j?I.jsx("div",{style:{fontSize:12,color:"#a16207"},children:"Media uploads are not configured for this project."}):null,C?I.jsx("div",{style:{fontSize:12,color:"#dc2626"},children:C}):null]}),N?I.jsx("div",{style:{padding:32,textAlign:"center",color:"#a1a1aa"},children:"Loading…"}):c.length===0&&ue.length===0?I.jsx("div",{style:{padding:32,textAlign:"center",color:"#a1a1aa"},children:y||k!=="all"?"No matching files.":"No files yet. Upload one to get started."}):I.jsxs("div",{style:Cq,children:[ze?c.map(D=>I.jsxs("button",{type:"button",style:ZN,onClick:()=>Re(D.path),title:D.name,children:[I.jsx("span",{style:{fontSize:30},children:"📁"}),I.jsx("span",{style:{fontSize:12,color:"#52525b",maxWidth:"90%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.name})]},D.path)):null,ue.map(D=>I.jsxs("button",{type:"button",style:ZN,title:D.filename,onClick:()=>i(D.url,D.annotation||D.filename||"Image"),children:[D.contentType.startsWith("image/")?I.jsx("img",{src:D.url,alt:D.annotation||D.filename,style:{width:"100%",height:"100%",objectFit:"cover"}}):I.jsx("span",{style:{fontSize:30},children:D.contentType==="application/pdf"?"📄":"📎"}),I.jsx("span",{style:wq,children:D.filename})]},D.id))]}),I.jsxs("div",{style:{padding:"10px 16px",borderTop:"1px solid #ececed",fontSize:12,color:"#a1a1aa",textAlign:"center"},children:["Drag and drop a file here to upload",d?` to ${d}`:"","."]})]})})}const rS={bold:!1,italic:!1,strikethrough:!1,link:!1,linkHref:null,bulletList:!1,orderedList:!1,listStyle:null,blockquote:!1,heading:null};function Eq(t){const{state:e}=t,{$from:n,from:r,to:i}=e.selection;let s=!1,o=!1,u=!1,c=!1,h=null;const d=e.storedMarks||n.marks();for(const N of d)N.type.name==="strong"&&(s=!0),N.type.name==="emphasis"&&(o=!0),N.type.name==="strike_through"&&(u=!0),N.type.name==="link"&&(c=!0,h=typeof N.attrs.href=="string"?N.attrs.href:null);r!==i&&e.doc.nodesBetween(r,i,N=>{for(const M of N.marks)M.type.name==="strong"&&(s=!0),M.type.name==="emphasis"&&(o=!0),M.type.name==="strike_through"&&(u=!0),M.type.name==="link"&&(c=!0,h=typeof M.attrs.href=="string"?M.attrs.href:null)});let g=!1,y=!1,b=null,k=!1,E=null;for(let N=n.depth;N>0;N--){const M=n.node(N);(M.type.name==="bullet_list"||M.type.name==="ordered_list")&&(M.type.name==="bullet_list"&&(g=!0),M.type.name==="ordered_list"&&(y=!0),b===null&&(b=typeof M.attrs.listStyle=="string"?M.attrs.listStyle:null)),M.type.name==="blockquote"&&(k=!0)}if(n.parent.type.name==="heading"){const N=n.parent.attrs.level;E=typeof N=="number"?N:null}return{bold:s,italic:o,strikethrough:u,link:c,linkHref:h,bulletList:g,orderedList:y,listStyle:b,blockquote:k,heading:E}}function Aq(t,e){const{$from:n}=t.state.selection;for(let r=n.depth;r>0;r--)if(n.node(r).type.name===e)return!0;return!1}function Nq(t,e){const{state:n}=t,r=n.schema.nodes.heading,i=n.schema.nodes.paragraph;if(!r||!i)return;const{$from:s}=n.selection,o=s.parent.type.name==="heading"&&s.parent.attrs.level===e,u=o?i:r,c=o?void 0:{level:e},h=s.before(s.depth),d=n.selection.$to.after(n.selection.$to.depth);t.dispatch(n.tr.setBlockType(h,d,u,c)),t.focus()}function Tq(t){const{state:e}=t,{from:n,to:r}=e.selection,i=e.schema.marks.link;if(!i)return;let s=n,o=r;e.doc.nodesBetween(n,n===r?r+1:r,(u,c)=>{if(i.isInSet(u.marks))return s=c,o=c+u.nodeSize,!1}),t.dispatch(e.tr.removeMark(s,o,i))}function Mq(t,e){return t.bold===e.bold&&t.italic===e.italic&&t.strikethrough===e.strikethrough&&t.link===e.link&&t.linkHref===e.linkHref&&t.bulletList===e.bulletList&&t.orderedList===e.orderedList&&t.listStyle===e.listStyle&&t.blockquote===e.blockquote&&t.heading===e.heading}function Oq(t,e){let n=0,r=rS;const i=()=>{const u=t.ctx.get(gn),c=Eq(u);Mq(c,r)||(r=c,e(c))},s=t.ctx.get(gn),o=s.dispatch.bind(s);return s.dispatch=u=>{o(u),(u.selectionSet||u.docChanged)&&(cancelAnimationFrame(n),n=requestAnimationFrame(i))},i(),()=>{cancelAnimationFrame(n)}}const Rq=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],eT={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function zI(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=48&&e<=57}function Dq(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=102||e>=65&&e<=70||e>=48&&e<=57}function Iq(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=122||e>=65&&e<=90}function tT(t){return Iq(t)||zI(t)}const _q=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function Kg(t,e){const n=e||{},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,i=[];let s=0,o=-1,u="",c,h;n.position&&("start"in n.position||"indent"in n.position?(h=n.position.indent,c=n.position.start):c=n.position);let d=(c?c.line:0)||1,g=(c?c.column:0)||1,y=k(),b;for(s--;++s<=t.length;)if(b===10&&(g=(h?h[o]:0)||1),b=t.charCodeAt(s),b===38){const M=t.charCodeAt(s+1);if(M===9||M===10||M===12||M===32||M===38||M===60||Number.isNaN(M)||r&&M===r){u+=String.fromCharCode(b),g++;continue}const j=s+1;let P=j,U=j,L;if(M===35){U=++P;const Se=t.charCodeAt(U);Se===88||Se===120?(L="hexadecimal",U=++P):L="decimal"}else L="named";let C="",z="",G="";const J=L==="named"?tT:L==="decimal"?zI:Dq;for(U--;++U<=t.length;){const Se=t.charCodeAt(U);if(!J(Se))break;G+=String.fromCharCode(Se),L==="named"&&Rq.includes(G)&&(C=G,z=fh(G))}let K=t.charCodeAt(U)===59;if(K){U++;const Se=L==="named"?fh(G):!1;Se&&(C=G,z=Se)}let de=1+U-j,ce="";if(!(!K&&n.nonTerminated===!1))if(!G)L!=="named"&&E(4,de);else if(L==="named"){if(K&&!z)E(5,1);else if(C!==G&&(U=P+C.length,de=1+U-P,K=!1),!K){const Se=C?1:3;if(n.attribute){const Re=t.charCodeAt(U);Re===61?(E(Se,de),z=""):tT(Re)?z="":E(Se,de)}else E(Se,de)}ce=z}else{K||E(2,de);let Se=Number.parseInt(G,L==="hexadecimal"?16:10);if(zq(Se))E(7,de),ce="�";else if(Se in eT)E(6,de),ce=eT[Se];else{let Re="";Lq(Se)&&E(6,de),Se>65535&&(Se-=65536,Re+=String.fromCharCode(Se>>>10|55296),Se=56320|Se&1023),ce=Re+String.fromCharCode(Se)}}if(ce){N(),y=k(),s=U-1,g+=U-j+1,i.push(ce);const Se=k();Se.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,ce,{start:y,end:Se},t.slice(j-1,U)),y=Se}else G=t.slice(j-1,U),u+=G,g+=G.length,s=U-1}else b===10&&(d++,o++,g=0),Number.isNaN(b)?N():(u+=String.fromCharCode(b),g++);return i.join("");function k(){return{line:d,column:g,offset:s+((c?c.offset:0)||0)}}function E(M,j){let P;n.warning&&(P=k(),P.column+=j,P.offset+=j,n.warning.call(n.warningContext||void 0,_q[M],P,M))}function N(){u&&(i.push(u),n.text&&n.text.call(n.textContext||void 0,u,{start:y,end:k()}),u="")}}function zq(t){return t>=55296&&t<=57343||t>1114111}function Lq(t){return t>=1&&t<=8||t===11||t>=13&&t<=31||t>=127&&t<=159||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534}const Bq=/["&'<>`]/g,Vq=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Fq=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Pq=/[|\\{}()[\]^$+*?.]/g,nT=new WeakMap;function jq(t,e){if(t=t.replace(e.subset?$q(e.subset):Bq,r),e.subset||e.escapeOnly)return t;return t.replace(Vq,n).replace(Fq,r);function n(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function r(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function $q(t){let e=nT.get(t);return e||(e=Uq(t),nT.set(t,e)),e}function Uq(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Pq,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function Jq(t){return"&#x"+t.toString(16).toUpperCase()+";"}function qq(t,e){return jq(t,Object.assign({format:Jq},e))}function Hq(){return{canContainEols:["textDirective"],enter:{directiveContainer:Kq,directiveContainerAttributes:px,directiveContainerLabel:Qq,directiveLeaf:Gq,directiveLeafAttributes:px,directiveText:Yq,directiveTextAttributes:px},exit:{directiveContainer:bx,directiveContainerAttributeClassValue:mx,directiveContainerAttributeIdValue:dx,directiveContainerAttributeName:yx,directiveContainerAttributeValue:gx,directiveContainerAttributes:xx,directiveContainerLabel:Wq,directiveContainerName:hx,directiveLeaf:bx,directiveLeafAttributeClassValue:mx,directiveLeafAttributeIdValue:dx,directiveLeafAttributeName:yx,directiveLeafAttributeValue:gx,directiveLeafAttributes:xx,directiveLeafName:hx,directiveText:bx,directiveTextAttributeClassValue:mx,directiveTextAttributeIdValue:dx,directiveTextAttributeName:yx,directiveTextAttributeValue:gx,directiveTextAttributes:xx,directiveTextName:hx}}}function Kq(t){yk.call(this,"containerDirective",t)}function Gq(t){yk.call(this,"leafDirective",t)}function Yq(t){yk.call(this,"textDirective",t)}function yk(t,e){this.enter({type:t,name:"",attributes:{},children:[]},e)}function hx(t){const e=this.stack[this.stack.length-1];e.type==="containerDirective"||e.type==="leafDirective"||e.type,e.name=this.sliceSerialize(t)}function Qq(t){this.enter({type:"paragraph",data:{directiveLabel:!0},children:[]},t)}function Wq(t){this.exit(t)}function px(){this.data.directiveAttributes=[],this.buffer()}function dx(t){this.data.directiveAttributes.push(["id",Kg(this.sliceSerialize(t),{attribute:!0})])}function mx(t){this.data.directiveAttributes.push(["class",Kg(this.sliceSerialize(t),{attribute:!0})])}function gx(t){const e=this.data.directiveAttributes;e[e.length-1][1]=Kg(this.sliceSerialize(t),{attribute:!0})}function yx(t){this.data.directiveAttributes.push([this.sliceSerialize(t),""])}function xx(){const t=this.data.directiveAttributes,e={};let n=-1;for(;++n<t.length;){const i=t[n];i[0]==="class"&&e.class?e.class+=" "+i[1]:e[i[0]]=i[1]}this.data.directiveAttributes=void 0,this.resume();const r=this.stack[this.stack.length-1];r.type==="containerDirective"||r.type==="leafDirective"||r.type,r.attributes=e}function bx(t){this.exit(t)}function xk(t,e,n,r,i,s,o,u,c,h,d,g,y,b,k){let E,N;return M;function M(Y){return t.enter(r),t.enter(i),t.consume(Y),t.exit(i),j}function j(Y){return Y===35?(E=o,P(Y)):Y===46?(E=u,P(Y)):Y===58||Y===95||sn(Y)?(t.enter(s),t.enter(c),t.consume(Y),C):k&&qe(Y)?He(t,j,"whitespace")(Y):!k&&We(Y)?Ts(t,j)(Y):Re(Y)}function P(Y){const W=E+"Marker";return t.enter(s),t.enter(E),t.enter(W),t.consume(Y),t.exit(W),U}function U(Y){if(Y===null||Y===34||Y===35||Y===39||Y===46||Y===60||Y===61||Y===62||Y===96||Y===125||We(Y))return n(Y);const W=E+"Value";return t.enter(W),t.consume(Y),L}function L(Y){if(Y===null||Y===34||Y===39||Y===60||Y===61||Y===62||Y===96)return n(Y);if(Y===35||Y===46||Y===125||We(Y)){const W=E+"Value";return t.exit(W),t.exit(E),t.exit(s),j(Y)}return t.consume(Y),L}function C(Y){return Y===45||Y===46||Y===58||Y===95||vn(Y)?(t.consume(Y),C):(t.exit(c),k&&qe(Y)?He(t,z,"whitespace")(Y):!k&&We(Y)?Ts(t,z)(Y):z(Y))}function z(Y){return Y===61?(t.enter(h),t.consume(Y),t.exit(h),G):(t.exit(s),j(Y))}function G(Y){return Y===null||Y===60||Y===61||Y===62||Y===96||Y===125||k&&Ce(Y)?n(Y):Y===34||Y===39?(t.enter(d),t.enter(y),t.consume(Y),t.exit(y),N=Y,K):k&&qe(Y)?He(t,G,"whitespace")(Y):!k&&We(Y)?Ts(t,G)(Y):(t.enter(g),t.enter(b),t.consume(Y),N=void 0,J)}function J(Y){return Y===null||Y===34||Y===39||Y===60||Y===61||Y===62||Y===96?n(Y):Y===125||We(Y)?(t.exit(b),t.exit(g),t.exit(s),j(Y)):(t.consume(Y),J)}function K(Y){return Y===N?(t.enter(y),t.consume(Y),t.exit(y),t.exit(d),t.exit(s),Se):(t.enter(g),de(Y))}function de(Y){return Y===N?(t.exit(g),K(Y)):Y===null?n(Y):Ce(Y)?k?n(Y):Ts(t,de)(Y):(t.enter(b),t.consume(Y),ce)}function ce(Y){return Y===N||Y===null||Ce(Y)?(t.exit(b),de(Y)):(t.consume(Y),ce)}function Se(Y){return Y===125||We(Y)?j(Y):Re(Y)}function Re(Y){return Y===125?(t.enter(i),t.consume(Y),t.exit(i),t.exit(r),e):n(Y)}}function bk(t,e,n,r,i,s,o){let u=0,c=0,h;return d;function d(N){return t.enter(r),t.enter(i),t.consume(N),t.exit(i),g}function g(N){return N===93?(t.enter(i),t.consume(N),t.exit(i),t.exit(r),e):(t.enter(s),y(N))}function y(N){if(N===93&&!c)return E(N);const M=t.enter("chunkText",{contentType:"text",previous:h});return h&&(h.next=M),h=M,b(N)}function b(N){return N===null||u>999||N===91&&++c>32?n(N):N===93&&!c--?(t.exit("chunkText"),E(N)):Ce(N)?o?n(N):(t.consume(N),t.exit("chunkText"),y):(t.consume(N),N===92?k:b)}function k(N){return N===91||N===92||N===93?(t.consume(N),u++,b):b(N)}function E(N){return t.exit(s),t.enter(i),t.consume(N),t.exit(i),t.exit(r),e}}function Sk(t,e,n,r){const i=this;return s;function s(u){return sn(u)?(t.enter(r),t.consume(u),o):n(u)}function o(u){return u===45||u===95||vn(u)?(t.consume(u),o):(t.exit(r),i.previous===45||i.previous===95?n(u):e(u))}}const Xq={tokenize:tH,concrete:!0},Zq={tokenize:nH,partial:!0},eH={tokenize:rH,partial:!0},Fd={tokenize:iH,partial:!0};function tH(t,e,n){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let o=0,u;return c;function c(J){return t.enter("directiveContainer"),t.enter("directiveContainerFence"),t.enter("directiveContainerSequence"),h(J)}function h(J){return J===58?(t.consume(J),o++,h):o<3?n(J):(t.exit("directiveContainerSequence"),Sk.call(r,t,d,n,"directiveContainerName")(J))}function d(J){return J===91?t.attempt(Zq,g,g)(J):g(J)}function g(J){return J===123?t.attempt(eH,y,y)(J):y(J)}function y(J){return He(t,b,"whitespace")(J)}function b(J){return t.exit("directiveContainerFence"),J===null?z(J):Ce(J)?r.interrupt?e(J):t.attempt(Fd,k,z)(J):n(J)}function k(J){return J===null?z(J):Ce(J)?t.check(Fd,P,z)(J):(t.enter("directiveContainerContent"),E(J))}function E(J){return t.attempt({tokenize:G,partial:!0},C,s?He(t,N,"linePrefix",s+1):N)(J)}function N(J){return J===null?C(J):Ce(J)?t.check(Fd,j,C)(J):j(J)}function M(J){if(J===null){const K=t.exit("chunkDocument");return r.parser.lazy[K.start.line]=!1,C(J)}return Ce(J)?t.check(Fd,U,L)(J):(t.consume(J),M)}function j(J){const K=t.enter("chunkDocument",{contentType:"document",previous:u});return u&&(u.next=K),u=K,M(J)}function P(J){return t.enter("directiveContainerContent"),E(J)}function U(J){t.consume(J);const K=t.exit("chunkDocument");return r.parser.lazy[K.start.line]=!1,E}function L(J){const K=t.exit("chunkDocument");return r.parser.lazy[K.start.line]=!1,C(J)}function C(J){return t.exit("directiveContainerContent"),z(J)}function z(J){return t.exit("directiveContainer"),e(J)}function G(J,K,de){let ce=0;return He(J,Se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function Se(W){return J.enter("directiveContainerFence"),J.enter("directiveContainerSequence"),Re(W)}function Re(W){return W===58?(J.consume(W),ce++,Re):ce<o?de(W):(J.exit("directiveContainerSequence"),He(J,Y,"whitespace")(W))}function Y(W){return W===null||Ce(W)?(J.exit("directiveContainerFence"),K(W)):de(W)}}}function nH(t,e,n){return bk(t,e,n,"directiveContainerLabel","directiveContainerLabelMarker","directiveContainerLabelString",!0)}function rH(t,e,n){return xk(t,e,n,"directiveContainerAttributes","directiveContainerAttributesMarker","directiveContainerAttribute","directiveContainerAttributeId","directiveContainerAttributeClass","directiveContainerAttributeName","directiveContainerAttributeInitializerMarker","directiveContainerAttributeValueLiteral","directiveContainerAttributeValue","directiveContainerAttributeValueMarker","directiveContainerAttributeValueData",!0)}function iH(t,e,n){const r=this;return i;function i(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const sH={tokenize:lH},aH={tokenize:uH,partial:!0},oH={tokenize:cH,partial:!0};function lH(t,e,n){const r=this;return i;function i(d){return t.enter("directiveLeaf"),t.enter("directiveLeafSequence"),t.consume(d),s}function s(d){return d===58?(t.consume(d),t.exit("directiveLeafSequence"),Sk.call(r,t,o,n,"directiveLeafName")):n(d)}function o(d){return d===91?t.attempt(aH,u,u)(d):u(d)}function u(d){return d===123?t.attempt(oH,c,c)(d):c(d)}function c(d){return He(t,h,"whitespace")(d)}function h(d){return d===null||Ce(d)?(t.exit("directiveLeaf"),e(d)):n(d)}}function uH(t,e,n){return bk(t,e,n,"directiveLeafLabel","directiveLeafLabelMarker","directiveLeafLabelString",!0)}function cH(t,e,n){return xk(t,e,n,"directiveLeafAttributes","directiveLeafAttributesMarker","directiveLeafAttribute","directiveLeafAttributeId","directiveLeafAttributeClass","directiveLeafAttributeName","directiveLeafAttributeInitializerMarker","directiveLeafAttributeValueLiteral","directiveLeafAttributeValue","directiveLeafAttributeValueMarker","directiveLeafAttributeValueData",!0)}const fH={tokenize:mH,previous:dH},hH={tokenize:gH,partial:!0},pH={tokenize:yH,partial:!0};function dH(t){return t!==58||this.events[this.events.length-1][1].type==="characterEscape"}function mH(t,e,n){const r=this;return i;function i(c){return t.enter("directiveText"),t.enter("directiveTextMarker"),t.consume(c),t.exit("directiveTextMarker"),Sk.call(r,t,s,n,"directiveTextName")}function s(c){return c===58?n(c):c===91?t.attempt(hH,o,o)(c):o(c)}function o(c){return c===123?t.attempt(pH,u,u)(c):u(c)}function u(c){return t.exit("directiveText"),e(c)}}function gH(t,e,n){return bk(t,e,n,"directiveTextLabel","directiveTextLabelMarker","directiveTextLabelString")}function yH(t,e,n){return xk(t,e,n,"directiveTextAttributes","directiveTextAttributesMarker","directiveTextAttribute","directiveTextAttributeId","directiveTextAttributeClass","directiveTextAttributeName","directiveTextAttributeInitializerMarker","directiveTextAttributeValueLiteral","directiveTextAttributeValue","directiveTextAttributeValueMarker","directiveTextAttributeValueData")}function xH(){return{text:{58:fH},flow:{58:[Xq,sH]}}}const tg="youtube";function bH(t){if(!t||typeof t!="object")return"";const e=Object.entries(t),n=t.id;if(typeof n=="string"&&n)return n;for(const[r,i]of e)if(i===""||i==null)return r;return""}const LI=Ju("youtube",()=>({group:"block",atom:!0,isolating:!0,selectable:!0,draggable:!1,attrs:{videoId:{default:""}},toDOM:t=>["div",{"data-youtube":t.attrs.videoId,class:"youtube-block"}],parseDOM:[{tag:"div[data-youtube]",getAttrs:t=>({videoId:t.getAttribute("data-youtube")||""})}],parseMarkdown:{match:t=>(t.type==="leafDirective"||t.type==="containerDirective"||t.type==="textDirective")&&t.name===tg,runner:(t,e,n)=>{const r=bH(e.attributes);t.addNode(n,{videoId:r})}},toMarkdown:{match:t=>t.type.name==="youtube",runner:(t,e)=>{t.addNode("leafDirective",void 0,void 0,{name:tg,attributes:{id:e.attrs.videoId}})}}}));function SH(t){const e=t.attributes,n=e&&typeof e=="object"?String(e.id??""):"";return`::${tg}{#${n}}`}const vH=function(){const t=this.data("toMarkdownExtensions")??[],e={handlers:{leafDirective:SH}};t.push(e),this.data("toMarkdownExtensions",t)},kH=Ni("remarkYoutubeDirective",()=>vH),BI=Ue("insertYoutube",()=>t=>(e,n)=>{if(!t)return!1;const r=e.schema.nodes.youtube;if(!r)return!1;const i=r.create({videoId:t});return n&&n(e.tr.replaceSelectionWith(i).scrollIntoView()),!0}),iS="list",CH=/^[A-Za-z0-9_-]+$/,wH=new Set(["textDirective","leafDirective","containerDirective"]);function Pi(t){if(typeof t!="string")return null;const[e]=t.trim().split(/\s+/);return!e||!CH.test(e)?null:e}function zs(t){return Array.isArray(t?.children)?t.children:null}function Sx(t){const e=zs(t);return e&&e.length>0?e[e.length-1]:void 0}function VI(t){return!t.attributes||typeof t.attributes!="object"||Array.isArray(t.attributes)?null:t.attributes}function EH(t){return Pi(VI(t)?.class)}function FI(t,e){const n=zs(t);if(t?.type!=="paragraph"||n?.length!==1)return!1;const r=n[0];return r?.type!=="text"||typeof r.value!="string"?!1:e===void 0?!0:r.value===e}function AH(t){if(!FI(t))return null;const e=zs(t)?.[0];return typeof e?.value!="string"?null:/^:::list\{\.([A-Za-z0-9_-]+)\}$/.exec(e.value)?.[1]??null}function rT(t){return t?.type==="list"}function NH(t,e,n){if(FI(e[n],":::"))return e.splice(n,1),!0;const r=Sx(t),i=Sx(r);if(!i||i.type!=="paragraph")return!1;const s=zs(i),o=Sx(i);if(!s||o?.type!=="text"||typeof o.value!="string")return!1;if(o.value===":::")s.pop();else if(o.value.endsWith(`
57
+ `))}function c(b,k,E,N){const M=E.enter("tableCell"),j=E.enter("phrasing"),P=E.containerPhrasing(b,{...N,before:s,after:s});return j(),M(),P}function h(b,k){return rJ(b,{align:k,alignDelimiters:r,padding:n,stringLength:i})}function d(b,k,E){const N=b.children;let M=-1;const j=[],P=k.enter("table");for(;++M<N.length;)j[M]=g(N[M],k,E);return P(),j}function g(b,k,E){const N=b.children;let M=-1;const j=[],P=k.enter("tableRow");for(;++M<N.length;)j[M]=c(N[M],b,k,E);return P(),j}function y(b,k,E){let N=xS.inlineCode(b,k,E);return E.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function hJ(){return{exit:{taskListCheckValueChecked:qN,taskListCheckValueUnchecked:qN,paragraph:dJ}}}function pJ(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:mJ}}}function qN(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function dJ(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const u=i[s];if(u.type==="paragraph"){o=u;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function mJ(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);s&&u.move(o);let c=xS.listItem(t,e,n,{...r,...u.current()});return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),c;function h(d){return d+o}}function gJ(){return[AU(),KU(),WU(),sJ(),hJ()]}function yJ(t){return{extensions:[NU(),GU(t),XU(),fJ(t),pJ()]}}const xJ={tokenize:wJ,partial:!0},iI={tokenize:EJ,partial:!0},sI={tokenize:AJ,partial:!0},aI={tokenize:NJ,partial:!0},bJ={tokenize:TJ,partial:!0},oI={name:"wwwAutolink",tokenize:kJ,previous:uI},lI={name:"protocolAutolink",tokenize:CJ,previous:cI},Hs={name:"emailAutolink",tokenize:vJ,previous:fI},Qi={};function SJ(){return{text:Qi}}let Eo=48;for(;Eo<123;)Qi[Eo]=Hs,Eo++,Eo===58?Eo=65:Eo===91&&(Eo=97);Qi[43]=Hs;Qi[45]=Hs;Qi[46]=Hs;Qi[95]=Hs;Qi[72]=[Hs,lI];Qi[104]=[Hs,lI];Qi[87]=[Hs,oI];Qi[119]=[Hs,oI];function vJ(t,e,n){const r=this;let i,s;return o;function o(g){return!nS(g)||!fI.call(r,r.previous)||ik(r.events)?n(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(g))}function u(g){return nS(g)?(t.consume(g),u):g===64?(t.consume(g),c):n(g)}function c(g){return g===46?t.check(bJ,d,h)(g):g===45||g===95||vn(g)?(s=!0,t.consume(g),c):d(g)}function h(g){return t.consume(g),i=!0,c}function d(g){return s&&i&&sn(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(g)):n(g)}}function kJ(t,e,n){const r=this;return i;function i(o){return o!==87&&o!==119||!uI.call(r,r.previous)||ik(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(xJ,t.attempt(iI,t.attempt(sI,s),n),n)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function CJ(t,e,n){const r=this;let i="",s=!1;return o;function o(g){return(g===72||g===104)&&cI.call(r,r.previous)&&!ik(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(g),t.consume(g),u):n(g)}function u(g){if(sn(g)&&i.length<5)return i+=String.fromCodePoint(g),t.consume(g),u;if(g===58){const y=i.toLowerCase();if(y==="http"||y==="https")return t.consume(g),c}return n(g)}function c(g){return g===47?(t.consume(g),s?h:(s=!0,c)):n(g)}function h(g){return g===null||Cm(g)||We(g)||Vn(g)||Sg(g)?n(g):t.attempt(iI,t.attempt(sI,d),n)(g)}function d(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(g)}}function wJ(t,e,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),i):o===46&&r===3?(t.consume(o),s):n(o)}function s(o){return o===null?n(o):e(o)}}function EJ(t,e,n){let r,i,s;return o;function o(h){return h===46||h===95?t.check(aI,c,u)(h):h===null||We(h)||Vn(h)||h!==45&&Sg(h)?c(h):(s=!0,t.consume(h),o)}function u(h){return h===95?r=!0:(i=r,r=void 0),t.consume(h),o}function c(h){return i||r||!s?n(h):e(h)}}function AJ(t,e){let n=0,r=0;return i;function i(o){return o===40?(n++,t.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(aI,e,s)(o):o===null||We(o)||Vn(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&r++,t.consume(o),i}}function NJ(t,e,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(t.consume(u),r):u===38?(t.consume(u),s):u===93?(t.consume(u),i):u===60||u===null||We(u)||Vn(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||We(u)||Vn(u)?e(u):r(u)}function s(u){return sn(u)?o(u):n(u)}function o(u){return u===59?(t.consume(u),r):sn(u)?(t.consume(u),o):n(u)}}function TJ(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return vn(s)?n(s):e(s)}}function uI(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||We(t)}function cI(t){return!sn(t)}function fI(t){return!(t===47||nS(t))}function nS(t){return t===43||t===45||t===46||t===95||vn(t)}function ik(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const MJ={tokenize:BJ,partial:!0};function OJ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:_J,continuation:{tokenize:zJ},exit:LJ}},text:{91:{name:"gfmFootnoteCall",tokenize:IJ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:RJ,resolveTo:DJ}}}}function RJ(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!o||!o._balanced)return n(c);const h=wi(r.sliceSerialize({start:o.end,end:r.now()}));return h.codePointAt(0)!==94||!s.includes(h.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function DJ(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function IJ(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return u;function u(g){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),c}function c(g){return g!==94?n(g):(t.enter("gfmFootnoteCallMarker"),t.consume(g),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(g){if(s>999||g===93&&!o||g===null||g===91||We(g))return n(g);if(g===93){t.exit("chunkString");const y=t.exit("gfmFootnoteCallString");return i.includes(wi(r.sliceSerialize(y)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(g)}return We(g)||(o=!0),s++,t.consume(g),g===92?d:h}function d(g){return g===91||g===92||g===93?(t.consume(g),s++,h):h(g)}}function _J(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,u;return c;function c(k){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",d):n(k)}function d(k){if(o>999||k===93&&!u||k===null||k===91||We(k))return n(k);if(k===93){t.exit("chunkString");const E=t.exit("gfmFootnoteDefinitionLabelString");return s=wi(r.sliceSerialize(E)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),y}return We(k)||(u=!0),o++,t.consume(k),k===92?g:d}function g(k){return k===91||k===92||k===93?(t.consume(k),o++,d):d(k)}function y(k){return k===58?(t.enter("definitionMarker"),t.consume(k),t.exit("definitionMarker"),i.includes(s)||i.push(s),He(t,b,"gfmFootnoteDefinitionWhitespace")):n(k)}function b(k){return e(k)}}function zJ(t,e,n){return t.check(ju,e,t.attempt(MJ,e,n))}function LJ(t){t.exit("gfmFootnoteDefinition")}function BJ(t,e,n){const r=this;return He(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):n(s)}}function VJ(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,u){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let h=c;for(;h--;)if(o[h][0]==="exit"&&o[h][1].type==="strikethroughSequenceTemporary"&&o[h][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[h][1].end.offset-o[h][1].start.offset){o[c][1].type="strikethroughSequence",o[h][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[h][1].start),end:Object.assign({},o[c][1].end)},g={type:"strikethroughText",start:Object.assign({},o[h][1].end),end:Object.assign({},o[c][1].start)},y=[["enter",d,u],["enter",o[h][1],u],["exit",o[h][1],u],["enter",g,u]],b=u.parser.constructs.insideSpan.null;b&&Er(y,y.length,0,vg(b,o.slice(h+1,c),u)),Er(y,y.length,0,[["exit",g,u],["enter",o[c][1],u],["exit",o[c][1],u],["exit",d,u]]),Er(o,h-1,c-h+3,y),c=h+y.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function s(o,u,c){const h=this.previous,d=this.events;let g=0;return y;function y(k){return h===126&&d[d.length-1][1].type!=="characterEscape"?c(k):(o.enter("strikethroughSequenceTemporary"),b(k))}function b(k){const E=Iu(h);if(k===126)return g>1?c(k):(o.consume(k),g++,b);if(g<2&&!n)return c(k);const N=o.exit("strikethroughSequenceTemporary"),M=Iu(k);return N._open=!M||M===2&&!!E,N._close=!E||E===2&&!!M,u(k)}}}class FJ{constructor(){this.map=[]}add(e,n,r){PJ(this,e,n,r)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function PJ(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function jJ(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function $J(){return{flow:{null:{name:"table",tokenize:UJ,resolveAll:JJ}}}}function UJ(t,e,n){const r=this;let i=0,s=0,o;return u;function u(K){let de=r.events.length-1;for(;de>-1;){const Re=r.events[de][1].type;if(Re==="lineEnding"||Re==="linePrefix")de--;else break}const ce=de>-1?r.events[de][1].type:null,Se=ce==="tableHead"||ce==="tableRow"?C:c;return Se===C&&r.parser.lazy[r.now().line]?n(K):Se(K)}function c(K){return t.enter("tableHead"),t.enter("tableRow"),h(K)}function h(K){return K===124||(o=!0,s+=1),d(K)}function d(K){return K===null?n(K):Ce(K)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(K),t.exit("lineEnding"),b):n(K):qe(K)?He(t,d,"whitespace")(K):(s+=1,o&&(o=!1,i+=1),K===124?(t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),o=!0,d):(t.enter("data"),g(K)))}function g(K){return K===null||K===124||We(K)?(t.exit("data"),d(K)):(t.consume(K),K===92?y:g)}function y(K){return K===92||K===124?(t.consume(K),g):g(K)}function b(K){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(K):(t.enter("tableDelimiterRow"),o=!1,qe(K)?He(t,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):k(K))}function k(K){return K===45||K===58?N(K):K===124?(o=!0,t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),E):L(K)}function E(K){return qe(K)?He(t,N,"whitespace")(K):N(K)}function N(K){return K===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(K),t.exit("tableDelimiterMarker"),M):K===45?(s+=1,M(K)):K===null||Ce(K)?U(K):L(K)}function M(K){return K===45?(t.enter("tableDelimiterFiller"),j(K)):L(K)}function j(K){return K===45?(t.consume(K),j):K===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(K),t.exit("tableDelimiterMarker"),P):(t.exit("tableDelimiterFiller"),P(K))}function P(K){return qe(K)?He(t,U,"whitespace")(K):U(K)}function U(K){return K===124?k(K):K===null||Ce(K)?!o||i!==s?L(K):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(K)):L(K)}function L(K){return n(K)}function C(K){return t.enter("tableRow"),z(K)}function z(K){return K===124?(t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),z):K===null||Ce(K)?(t.exit("tableRow"),e(K)):qe(K)?He(t,z,"whitespace")(K):(t.enter("data"),G(K))}function G(K){return K===null||K===124||We(K)?(t.exit("data"),z(K)):(t.consume(K),K===92?J:G)}function J(K){return K===92||K===124?(t.consume(K),G):G(K)}}function JJ(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],u=!1,c=0,h,d,g;const y=new FJ;for(;++n<t.length;){const b=t[n],k=b[1];b[0]==="enter"?k.type==="tableHead"?(u=!1,c!==0&&(HN(y,e,c,h,d),d=void 0,c=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",h,e]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(r=!0,g=void 0,s=[0,0,0,0],o=[0,n+1,0,0],u&&(u=!1,d={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",d,e]])),i=k.type==="tableDelimiterRow"?2:d?3:1):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],g=Vd(y,e,s,i,void 0,g),s=[0,0,0,0]),o[2]=n)):k.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],g=Vd(y,e,s,i,void 0,g)),s=o,o=[s[1],n,0,0])):k.type==="tableHead"?(u=!0,c=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(c=n,s[1]!==0?(o[0]=o[1],g=Vd(y,e,s,i,n,g)):o[1]!==0&&(g=Vd(y,e,o,i,n,g)),i=0):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&HN(y,e,c,h,d),y.consume(e.events),n=-1;++n<e.events.length;){const b=e.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=jJ(e.events,n))}return t}function Vd(t,e,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},Eu(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const c=Eu(e.events,n[1]);if(s={type:o,start:Object.assign({},c),end:Object.assign({},c)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const h=Eu(e.events,n[2]),d=Eu(e.events,n[3]),g={type:u,start:Object.assign({},h),end:Object.assign({},d)};if(t.add(n[2],0,[["enter",g,e]]),r!==2){const y=e.events[n[2]],b=e.events[n[3]];if(y[1].end=Object.assign({},b[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,E=n[3]-n[2]-1;t.add(k,E,[])}}t.add(n[3]+1,0,[["exit",g,e]])}return i!==void 0&&(s.end=Object.assign({},Eu(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function HN(t,e,n,r,i){const s=[],o=Eu(e.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),r.end=Object.assign({},o),s.push(["exit",r,e]),t.add(n+1,0,s)}function Eu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const qJ={name:"tasklistCheck",tokenize:KJ};function HJ(){return{text:{91:qJ}}}function KJ(t,e,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),s)}function s(c){return We(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(c)}function u(c){return Ce(c)?e(c):qe(c)?t.check({tokenize:GJ},e,n)(c):n(c)}}function GJ(t,e,n){return He(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function YJ(t){return dS([SJ(),OJ(),VJ(t),$J(),HJ()])}const QJ={};function WJ(t){const e=this,n=t||QJ,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(YJ(n)),s.push(gJ()),o.push(yJ(n))}function Fe(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-gfm",...e}}),t}var sk=Xh("strike_through");Fe(sk,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var up=qu("strike_through",t=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",t.get(sk.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,n,r)=>{e.openMark(r),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,n)=>{e.withMark(n,"delete")}}}));Fe(up.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});Fe(up.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var Hg=Ue("ToggleStrikeThrough",t=>()=>Ag(up.type(t)));Fe(Hg,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var hI=pr(t=>Gh(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),up.type(t)));Fe(hI,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var ak=Mr("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:t=>{const e=t.get(xt);return()=>e.call(Hg.key)}}});Fe(ak.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});Fe(ak.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var cp=Aj({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:t=>t.style.textAlign||"left",setDOMAttr:(t,e)=>{e.style=`text-align: ${t||"left"}`}}}}),_s=en("table",()=>({...cp.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="table",runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r,isHeader:o===0}));t.openNode(n),t.next(i),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table",runner:(t,e)=>{const n=e.content.firstChild?.content;if(!n)return;const r=[];n.forEach(i=>{r.push(i.attrs.alignment)}),t.openNode("table",void 0,{align:r}),t.next(e.content),t.closeNode()}}}));Fe(_s.node,{displayName:"NodeSchema<table>",group:"Table"});Fe(_s.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var fp=en("table_header_row",()=>({...cp.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:t=>t instanceof HTMLElement&&t.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:t=>!!(t.type==="tableRow"&&t.isHeader),runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o],isHeader:e.isHeader}));t.openNode(n),t.next(i),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow",void 0,{isHeader:!0}),t.next(e.content),t.closeNode())}}}));Fe(fp.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});Fe(fp.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var Yu=en("table_row",()=>({...cp.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:t=>t.type==="tableRow",runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o]}));t.openNode(n),t.next(i),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow"),t.next(e.content),t.closeNode())}}}));Fe(Yu.node,{displayName:"NodeSchema<tableRow>",group:"Table"});Fe(Yu.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var hp=en("table_cell",()=>({...cp.table_cell,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!t.isHeader,runner:(t,e,n)=>{const r=e.align;t.openNode(n,{alignment:r}).openNode(t.schema.nodes.paragraph).next(e.children).closeNode().closeNode()}},toMarkdown:{match:t=>t.type.name==="table_cell",runner:(t,e)=>{t.openNode("tableCell").next(e.content).closeNode()}}}));Fe(hp.node,{displayName:"NodeSchema<tableCell>",group:"Table"});Fe(hp.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Pu=en("table_header",()=>({...cp.table_header,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!!t.isHeader,runner:(t,e,n)=>{const r=e.align;t.openNode(n,{alignment:r}),t.openNode(t.schema.nodes.paragraph),t.next(e.children),t.closeNode(),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header",runner:(t,e)=>{t.openNode("tableCell"),t.next(e.content),t.closeNode()}}}));Fe(Pu.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});Fe(Pu.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function pI(t,e=3,n=3){const r=Array(n).fill(0).map(()=>hp.type(t).createAndFill()),i=Array(n).fill(0).map(()=>Pu.type(t).createAndFill()),s=Array(e).fill(0).map((o,u)=>u===0?fp.type(t).create(null,i):Yu.type(t).create(null,r));return _s.type(t).create(null,s)}function dI(t){return(e,n)=>r=>{n=n??r.selection.from;const i=r.doc.resolve(n),s=YB(c=>c.type.name==="table")(i),o=s?{node:s.node,from:s.start}:void 0,u=t==="row";if(o){const c=bt.get(o.node);if(e>=0&&e<(u?c.height:c.width)){const h=c.positionAt(u?e:c.height-1,u?c.width-1:e,o.node),d=r.doc.resolve(o.from+h),g=u?Rt.rowSelection:Rt.colSelection,y=c.positionAt(u?e:0,u?0:e,o.node),b=r.doc.resolve(o.from+y);return TO(r.setSelection(g(d,b)))}}return r}}var XJ=dI("row"),ZJ=dI("col");function mI(t,e,{map:n,tableStart:r,table:i},s){const o=Array(s).fill(0).reduce((c,h,d)=>c+i.child(d).nodeSize,r),u=Array(n.width).fill(0).map((c,h)=>{const d=i.nodeAt(n.map[h]);return hp.type(t).createAndFill({alignment:d?.attrs.alignment})});return e.insert(o,Yu.type(t).create(null,u)),e}function eq(t){const e=ap(t.$from);if(!e)return;const n=bt.get(e.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(r=>{const i=e.node.nodeAt(r),s=r+e.start;return{pos:s,start:s+1,node:i}})}function tq(t){const e=eq(t.selection);if(e&&e[0]){const n=t.doc.resolve(e[0].pos),r=e[e.length-1];if(r){const i=t.doc.resolve(r.pos);return TO(t.setSelection(new Rt(i,n)))}}return t}var ok=Ue("GoToPrevTableCell",()=>()=>SD(-1));Fe(ok,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var lk=Ue("GoToNextTableCell",()=>()=>SD(1));Fe(lk,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var uk=Ue("ExitTable",t=>()=>(e,n)=>{if(!oi(e))return!1;const{$head:r}=e.selection,i=GB(r,_s.type(t));if(!i)return!1;const{to:s}=i,o=e.tr.replaceWith(s,s,Ui.type(t).createAndFill());return o.setSelection(Ve.near(o.doc.resolve(s),1)).scrollIntoView(),n?.(o),!0});Fe(uk,{displayName:"Command<breakTableCommand>",group:"Table"});var ck=Ue("InsertTable",t=>({row:e,col:n}={})=>(r,i)=>{const{selection:s,tr:o}=r,{from:u}=s,c=pI(t,e,n),h=o.replaceSelectionWith(c),d=Ve.findFrom(h.doc.resolve(u),1,!0);return d&&h.setSelection(d),i?.(h),!0});Fe(ck,{displayName:"Command<insertTableCommand>",group:"Table"});var gI=Ue("MoveRow",()=>({from:t,to:e,pos:n}={})=>e$({from:t??0,to:e??0,pos:n}));Fe(gI,{displayName:"Command<moveRowCommand>",group:"Table"});var yI=Ue("MoveCol",()=>({from:t,to:e,pos:n}={})=>t$({from:t??0,to:e??0,pos:n}));Fe(yI,{displayName:"Command<moveColCommand>",group:"Table"});var xI=Ue("SelectRow",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(XJ(t.index,t.pos)(r))});Fe(xI,{displayName:"Command<selectRowCommand>",group:"Table"});var bI=Ue("SelectCol",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(ZJ(t.index,t.pos)(r))});Fe(bI,{displayName:"Command<selectColCommand>",group:"Table"});var SI=Ue("SelectTable",()=>()=>(t,e)=>{const{tr:n}=t;return!!e?.(tq(n))});Fe(SI,{displayName:"Command<selectTableCommand>",group:"Table"});var vI=Ue("DeleteSelectedCells",()=>()=>(t,e)=>{const{selection:n}=t;if(!(n instanceof Rt))return!1;const r=n.isRowSelection(),i=n.isColSelection();return r&&i?Zj(t,e):i?Kj(t,e):Yj(t,e)});Fe(vI,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var kI=Ue("AddColBefore",()=>()=>Jj);Fe(kI,{displayName:"Command<addColBeforeCommand>",group:"Table"});var CI=Ue("AddColAfter",()=>()=>qj);Fe(CI,{displayName:"Command<addColAfterCommand>",group:"Table"});var wI=Ue("AddRowBefore",t=>()=>(e,n)=>{if(!oi(e))return!1;if(n){const r=to(e);n(mI(t,e.tr,r,r.top))}return!0});Fe(wI,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var EI=Ue("AddRowAfter",t=>()=>(e,n)=>{if(!oi(e))return!1;if(n){const r=to(e);n(mI(t,e.tr,r,r.bottom))}return!0});Fe(EI,{displayName:"Command<addRowAfterCommand>",group:"Table"});var AI=Ue("SetAlign",()=>(t="left")=>Qj("alignment",t));Fe(AI,{displayName:"Command<setAlignCommand>",group:"Table"});var NI=pr(t=>new Tr(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,n,r,i)=>{const s=e.doc.resolve(r);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),_s.type(t)))return null;const o=pI(t,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),u=e.tr.replaceRangeWith(r,i,o);return u.setSelection(Ae.create(u.doc,r+3)).scrollIntoView()}));Fe(NI,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var TI=cF(t=>({run:(e,n,r)=>{if(r)return e;function i(h){const d=h.childCount,g=h.lastChild?.childCount??0;if(d===0||g===0)return Ui.type(t).create();const y=h.firstChild;if(!(g>0&&y&&y.childCount===0))return h;if(d>=3){const N=h.child(1),M=[];for(let U=0;U<N.childCount;U++){const L=N.child(U);M.push(Pu.type(t).create(L.attrs,L.content,L.marks))}const j=y.type.create(y.attrs,M),P=[];for(let U=2;U<d;U++)P.push(h.child(U));return h.type.create(h.attrs,[j,...P])}const b=Array(g).fill(0).map(()=>Pu.type(t).createAndFill()),k=new H(Q.from(b),0,0),E=y.replace(0,0,k);return h.replace(0,y.nodeSize,new H(Q.from(E),0,0))}function s(h){const d=Yu.type(t),g=[];let y=[],b=!1;function k(){if(y.length===0)return;const E=fp.type(t).createAndFill(),N=_s.type(t).create(null,[E,...y]);g.push(i(N)),y=[]}return h.forEach(E=>{E.type===d?(b=!0,y.push(E)):(k(),g.push(E))}),k(),b?Q.from(g):h}function o(h){let d=s(h),g=d!==h;const y=[];return d.forEach(b=>{if(b.type===_s.type(t)){const k=i(b);k!==b&&(g=!0),y.push(k)}else if(b.childCount>0){const k=o(b.content);k!==b.content?(g=!0,y.push(b.copy(k))):y.push(b)}else y.push(b)}),g?Q.from(y):h}function u(h){const d=[],g=[];h.forEach(y=>g.push(y));for(let y=0;y<g.length;y++){const b=g[y],k=g[y+1];b.type===Ui.type(t)&&b.content.size===0&&k&&k.type===_s.type(t)||d.push(b)}return d.length<g.length?Q.from(d):h}let c=o(e.content);return c=u(c),new H(Q.from(c),e.openStart,e.openEnd)}}));Fe(TI,{displayName:"PasteRule<table>",group:"Table"});var fk=Mr("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:t=>{const e=t.get(xt);return()=>e.call(lk.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:t=>{const e=t.get(xt);return()=>e.call(ok.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:t=>{const e=t.get(xt);return()=>e.call(uk.key)}}});Fe(fk.ctx,{displayName:"KeymapCtx<table>",group:"Table"});Fe(fk.shortcuts,{displayName:"Keymap<table>",group:"Table"});var ux="footnote_definition",KN="footnoteDefinition",hk=en("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${ux}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Ki(t);return{label:t.dataset.label}},contentElement:"dd"}],toDOM:t=>{const e=t.attrs.label;return["dl",{"data-label":e,"data-type":ux},["dt",e],["dd",0]]},parseMarkdown:{match:({type:t})=>t===KN,runner:(t,e,n)=>{t.openNode(n,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:t=>t.type.name===ux,runner:(t,e)=>{t.openNode(KN,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));Fe(hk.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});Fe(hk.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var cx="footnote_reference",pk=en("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${cx}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw Ki(t);return{label:t.dataset.label}}}],toDOM:t=>{const e=t.attrs.label;return["sup",{"data-label":e,"data-type":cx},e]},parseMarkdown:{match:({type:t})=>t==="footnoteReference",runner:(t,e,n)=>{t.addNode(n,{label:e.label})}},toMarkdown:{match:t=>t.type.name===cx,runner:(t,e)=>{t.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));Fe(pk.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});Fe(pk.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var dk=Us.extendSchema(t=>e=>{const n=t(e);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:r=>{if(!(r instanceof HTMLElement))throw Ki(r);return{label:r.dataset.label,listType:r.dataset.listType,spread:r.dataset.spread,checked:r.dataset.checked?r.dataset.checked==="true":null}}},...n?.parseDOM||[]],toDOM:r=>n.toDOM&&r.attrs.checked==null?n.toDOM(r):["li",{"data-item-type":"task","data-label":r.attrs.label,"data-list-type":r.attrs.listType,"data-spread":r.attrs.spread,"data-checked":r.attrs.checked},0],parseMarkdown:{match:({type:r})=>r==="listItem",runner:(r,i,s)=>{if(i.checked==null){n.parseMarkdown.runner(r,i,s);return}const o=i.label!=null?`${i.label}.`:"•",u=i.checked!=null?!!i.checked:null,c=i.label!=null?"ordered":"bullet",h=i.spread!=null?`${i.spread}`:"true";r.openNode(s,{label:o,listType:c,spread:h,checked:u}),r.next(i.children),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="list_item",runner:(r,i)=>{if(i.attrs.checked==null){n.toMarkdown.runner(r,i);return}const s=i.attrs.label,o=i.attrs.listType,u=i.attrs.spread==="true",c=i.attrs.checked;r.openNode("listItem",void 0,{label:s,listType:o,spread:u,checked:c}),r.next(i.content),r.closeNode()}}}});Fe(dk.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});Fe(dk.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var MI=pr(()=>new Tr(/^\[(?<checked>\s|x)\]\s$/,(t,e,n,r)=>{const i=t.doc.resolve(n);let s=0,o=i.node(s);for(;o&&o.type.name!=="list_item";)s--,o=i.node(s);if(!o||o.attrs.checked!=null)return null;const u=e.groups?.checked==="x",c=i.before(s),h=t.tr;return h.deleteRange(n,r).setNodeMarkup(c,void 0,{...o.attrs,checked:u}),h}));Fe(MI,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var nq=[ak,fk].flat(),rq=[NI,MI],iq=[hI],sq=[TI],OI=$s(()=>SU);Fe(OI,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var aq=$s(()=>f$({}));Fe(aq,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var RI=$s(()=>v$({allowTableNodeSelection:!0}));Fe(RI,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var mk=Ni("remarkGFM",()=>WJ);Fe(mk.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});Fe(mk.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var oq=new hr("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function lq(t,e){let n=0;return e.forEach((r,i,s)=>{r===t&&(n=s)}),n}var DI=$s(()=>new fr({key:oq,appendTransaction:(t,e,n)=>{let r;const i=(s,o)=>{if(r||(r=n.tr),s.type.name!=="table_cell")return;const u=n.doc.resolve(o),c=u.node(u.depth),h=u.node(u.depth-1).firstChild;if(!h)return;const d=lq(s,c),g=h.maybeChild(d);if(!g)return;const y=g.attrs.alignment;y!==s.attrs.alignment&&r.setNodeMarkup(o,void 0,{...s.attrs,alignment:y})};return e.doc!==n.doc&&n.doc.descendants(i),r}}));Fe(DI,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var uq=[DI,OI,mk,RI].flat(),cq=[dk,_s,fp,Yu,Pu,hp,hk,pk,sk,up].flat(),fq=[lk,ok,uk,ck,gI,yI,xI,bI,SI,vI,wI,EI,kI,CI,AI,Hg],II=[cq,rq,sq,iq,nq,fq,uq].flat();const gk={display:"flex",gap:6,alignItems:"center",padding:6,border:"1px solid #d4d4d8",borderRadius:6,background:"#fff",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",marginTop:6},eg={flex:1,border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 8px",font:"inherit",outline:"none",minWidth:0},_h={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},hq=gk,pq=eg,fx=_h;function dq({initialUrl:t,isEdit:e,onApply:n,onRemove:r,onClose:i}){const[s,o]=ae.useState(t),u=()=>{const c=s.trim();c!==""&&n(c)};return I.jsxs("div",{style:hq,"data-mdx-action":"link",onMouseDown:c=>c.stopPropagation(),children:[I.jsx("input",{style:pq,autoFocus:!0,placeholder:"https://…",value:s,onChange:c=>o(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),u()),c.key==="Escape"&&i()}}),I.jsx("button",{type:"button",style:{...fx,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:c=>c.preventDefault(),onClick:u,children:e?"Update":"Add"}),e&&r?I.jsx("button",{type:"button",style:{...fx,color:"#dc2626"},onMouseDown:c=>c.preventDefault(),onClick:r,children:"Remove"}):null,I.jsx("button",{type:"button",style:fx,onMouseDown:c=>c.preventDefault(),onClick:i,children:"Cancel"})]})}const mq={...gk,flexWrap:"wrap"},GN={fontSize:11,color:"#71717a",whiteSpace:"nowrap"};function gq({initialAlt:t,onApply:e,onClose:n}){const[r,i]=ae.useState(t),[s,o]=ae.useState(""),u=()=>e(r.trim(),s.trim()),c=h=>{h.key==="Enter"&&(h.preventDefault(),u()),h.key==="Escape"&&n()};return I.jsxs("div",{style:mq,"data-mdx-action":"image",onMouseDown:h=>h.stopPropagation(),children:[I.jsx("span",{style:GN,children:"Alt"}),I.jsx("input",{style:eg,autoFocus:!0,placeholder:"Alt text for screen readers",value:r,onChange:h=>i(h.currentTarget.value),onKeyDown:c}),I.jsx("span",{style:GN,children:"Caption"}),I.jsx("input",{style:eg,placeholder:"Caption / source (optional)",value:s,onChange:h=>o(h.currentTarget.value),onKeyDown:c}),I.jsx("button",{type:"button",style:{..._h,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:h=>h.preventDefault(),onClick:u,children:"Insert"}),I.jsx("button",{type:"button",style:_h,onMouseDown:h=>h.preventDefault(),onClick:n,children:"Cancel"})]})}function YN(t){return typeof t!="object"||t===null?!1:"status"in t&&t.status===501||"code"in t&&t.code==="unsupported"}const QN=new Set(["image/svg+xml","image/x-icon"]),yq=[{value:"all",label:"All"},{value:"photo",label:"Photos"},{value:"graphic",label:"Graphics"},{value:"document",label:"Documents"}];function xq(t,e){return e==="all"?!0:e==="photo"?t.startsWith("image/")&&!QN.has(t):e==="graphic"?QN.has(t):e==="document"?t==="application/pdf":!0}const bq={position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1100},Sq={width:"min(760px, 94vw)",maxHeight:"82vh",display:"flex",flexDirection:"column",background:"#fff",border:"1px solid #d4d4d8",borderRadius:12,boxShadow:"0 16px 48px rgba(0,0,0,0.28)",overflow:"hidden",fontSize:13,color:"#27272a"},vq={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #ececed"},kq={display:"flex",flexDirection:"column",gap:10,padding:"12px 16px",borderBottom:"1px solid #ececed"},Wc={display:"flex",alignItems:"center",gap:8},WN={flex:1,border:"1px solid #d4d4d8",borderRadius:6,padding:"6px 10px",font:"inherit",outline:"none"},Au={border:"1px solid #d4d4d8",background:"#fff",borderRadius:6,padding:"6px 12px",font:"inherit",cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},XN={...Au,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},Cq={display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10,padding:16,overflowY:"auto"},ZN={position:"relative",aspectRatio:"1 / 1",border:"1px solid #e4e4e7",borderRadius:8,overflow:"hidden",cursor:"pointer",background:"#fafafa",padding:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6},wq={position:"absolute",left:0,right:0,bottom:0,padding:"4px 6px",fontSize:11,color:"#fff",background:"linear-gradient(to top, rgba(0,0,0,0.65), transparent)",textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};function _I({media:t,context:e,field:n,accept:r="image/*,application/pdf",onSelect:i,onClose:s}){const[o,u]=ae.useState([]),[c,h]=ae.useState([]),[d,g]=ae.useState(""),[y,b]=ae.useState(""),[k,E]=ae.useState("all"),[N,M]=ae.useState(!1),[j,P]=ae.useState(!1),[U,L]=ae.useState(!1),[C,z]=ae.useState(null),[G,J]=ae.useState(!1),[K,de]=ae.useState(""),ce=ae.useRef(null),Se=ae.useMemo(()=>async D=>{M(!0),z(null);try{const F=await t.listMedia({folder:D||void 0});u(F.items),h(F.folders)}catch(F){YN(F)?P(!0):z(F instanceof Error?F.message:"Failed to load media")}finally{M(!1)}},[t]);ae.useEffect(()=>{Se(d)},[Se,d]);const Re=D=>{b(""),g(D)},Y=async D=>{L(!0),z(null);try{const F=await t.uploadMedia(D,{...e,field:n,folder:d||void 0});if(F.success&&F.url){if(F.url.startsWith("./")){i(F.url,F.annotation??"");return}const ee={id:F.id??F.url,url:F.url,filename:F.filename??D.name,annotation:F.annotation,contentType:D.type||"application/octet-stream",folder:d||void 0};u(V=>[ee,...V])}else z(F.error??"Upload failed")}catch(F){YN(F)?P(!0):z(F instanceof Error?F.message:"Upload failed")}finally{L(!1)}},W=async()=>{const D=K.trim();if(!D||!t.createFolder)return;if(/[/\\:*?"<>|]/.test(D)){z("Invalid folder name");return}const F=d?`${d}/${D}`:D;try{const ee=await t.createFolder(F);ee.success?h(V=>[...V,{name:D,path:F}].sort((be,De)=>be.name.localeCompare(De.name))):z(ee.error??"Failed to create folder")}catch(ee){z(ee instanceof Error?ee.message:"Failed to create folder")}de(""),J(!1)},ue=ae.useMemo(()=>{const D=k==="all"?o:o.filter(ee=>xq(ee.contentType,k)),F=y.trim().toLowerCase();return F===""?D:D.filter(ee=>ee.filename.toLowerCase().includes(F))},[o,k,y]),ke=ae.useMemo(()=>{if(!d)return[];const D=d.split("/");return D.map((F,ee)=>({name:F,path:D.slice(0,ee+1).join("/")}))},[d]),ze=!y&&k==="all";return I.jsx("div",{style:bq,onMouseDown:s,"data-cms-ui":"",children:I.jsxs("div",{style:Sq,onMouseDown:D=>D.stopPropagation(),onDrop:D=>{D.preventDefault();const F=D.dataTransfer.files[0];F&&Y(F)},onDragOver:D=>D.preventDefault(),children:[I.jsxs("div",{style:vq,children:[I.jsx("strong",{style:{fontSize:15},children:"Media Library"}),I.jsx("button",{type:"button",style:{...Au,border:"none",fontSize:18,lineHeight:1,padding:2},onClick:s,"aria-label":"Close",children:"×"})]}),I.jsxs("div",{style:kq,children:[ke.length>0?I.jsxs("div",{style:{...Wc,gap:4,fontSize:12,color:"#71717a"},children:[I.jsx("button",{type:"button",style:{...Au,border:"none",padding:"0 2px"},onClick:()=>Re(""),children:"root"}),ke.map((D,F)=>I.jsxs("span",{style:Wc,children:[I.jsx("span",{children:"/"}),F===ke.length-1?I.jsx("span",{style:{color:"#27272a",fontWeight:600},children:D.name}):I.jsx("button",{type:"button",style:{...Au,border:"none",padding:"0 2px"},onClick:()=>Re(D.path),children:D.name})]},D.path))]}):null,I.jsxs("div",{style:Wc,children:[I.jsx("input",{style:WN,placeholder:"Search files…",value:y,onChange:D=>b(D.target.value)}),t.createFolder?I.jsx("button",{type:"button",style:Au,onClick:()=>J(D=>!D),children:"New folder"}):null,I.jsx("button",{type:"button",style:XN,disabled:j||U,onClick:()=>ce.current?.click(),children:U?"Uploading…":"Upload"}),I.jsx("input",{ref:ce,type:"file",accept:r,style:{display:"none"},onChange:D=>{const F=D.target.files?.[0];F&&Y(F),D.target.value=""}})]}),I.jsx("div",{style:{...Wc,gap:4},children:yq.map(D=>I.jsx("button",{type:"button",style:{...Au,padding:"3px 10px",fontSize:12,...k===D.value?{background:"#2563eb",borderColor:"#2563eb",color:"#fff"}:{}},onClick:()=>E(D.value),children:D.label},D.value))}),G&&t.createFolder?I.jsxs("div",{style:Wc,children:[I.jsx("input",{style:WN,autoFocus:!0,placeholder:"Folder name…",value:K,onChange:D=>de(D.target.value),onKeyDown:D=>{D.key==="Enter"&&W(),D.key==="Escape"&&(J(!1),de(""))}}),I.jsx("button",{type:"button",style:XN,onClick:()=>{W()},children:"Create"})]}):null,j?I.jsx("div",{style:{fontSize:12,color:"#a16207"},children:"Media uploads are not configured for this project."}):null,C?I.jsx("div",{style:{fontSize:12,color:"#dc2626"},children:C}):null]}),N?I.jsx("div",{style:{padding:32,textAlign:"center",color:"#a1a1aa"},children:"Loading…"}):c.length===0&&ue.length===0?I.jsx("div",{style:{padding:32,textAlign:"center",color:"#a1a1aa"},children:y||k!=="all"?"No matching files.":"No files yet. Upload one to get started."}):I.jsxs("div",{style:Cq,children:[ze?c.map(D=>I.jsxs("button",{type:"button",style:ZN,onClick:()=>Re(D.path),title:D.name,children:[I.jsx("span",{style:{fontSize:30},children:"📁"}),I.jsx("span",{style:{fontSize:12,color:"#52525b",maxWidth:"90%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.name})]},D.path)):null,ue.map(D=>I.jsxs("button",{type:"button",style:ZN,title:D.filename,onClick:()=>i(D.url,D.annotation||D.filename||"Image"),children:[D.contentType.startsWith("image/")?I.jsx("img",{src:D.thumbnailUrl??D.url,alt:D.annotation||D.filename,style:{width:"100%",height:"100%",objectFit:"cover"}}):I.jsx("span",{style:{fontSize:30},children:D.contentType==="application/pdf"?"📄":"📎"}),I.jsx("span",{style:wq,children:D.filename})]},D.id))]}),I.jsxs("div",{style:{padding:"10px 16px",borderTop:"1px solid #ececed",fontSize:12,color:"#a1a1aa",textAlign:"center"},children:["Drag and drop a file here to upload",d?` to ${d}`:"","."]})]})})}const rS={bold:!1,italic:!1,strikethrough:!1,link:!1,linkHref:null,bulletList:!1,orderedList:!1,listStyle:null,blockquote:!1,heading:null};function Eq(t){const{state:e}=t,{$from:n,from:r,to:i}=e.selection;let s=!1,o=!1,u=!1,c=!1,h=null;const d=e.storedMarks||n.marks();for(const N of d)N.type.name==="strong"&&(s=!0),N.type.name==="emphasis"&&(o=!0),N.type.name==="strike_through"&&(u=!0),N.type.name==="link"&&(c=!0,h=typeof N.attrs.href=="string"?N.attrs.href:null);r!==i&&e.doc.nodesBetween(r,i,N=>{for(const M of N.marks)M.type.name==="strong"&&(s=!0),M.type.name==="emphasis"&&(o=!0),M.type.name==="strike_through"&&(u=!0),M.type.name==="link"&&(c=!0,h=typeof M.attrs.href=="string"?M.attrs.href:null)});let g=!1,y=!1,b=null,k=!1,E=null;for(let N=n.depth;N>0;N--){const M=n.node(N);(M.type.name==="bullet_list"||M.type.name==="ordered_list")&&(M.type.name==="bullet_list"&&(g=!0),M.type.name==="ordered_list"&&(y=!0),b===null&&(b=typeof M.attrs.listStyle=="string"?M.attrs.listStyle:null)),M.type.name==="blockquote"&&(k=!0)}if(n.parent.type.name==="heading"){const N=n.parent.attrs.level;E=typeof N=="number"?N:null}return{bold:s,italic:o,strikethrough:u,link:c,linkHref:h,bulletList:g,orderedList:y,listStyle:b,blockquote:k,heading:E}}function Aq(t,e){const{$from:n}=t.state.selection;for(let r=n.depth;r>0;r--)if(n.node(r).type.name===e)return!0;return!1}function Nq(t,e){const{state:n}=t,r=n.schema.nodes.heading,i=n.schema.nodes.paragraph;if(!r||!i)return;const{$from:s}=n.selection,o=s.parent.type.name==="heading"&&s.parent.attrs.level===e,u=o?i:r,c=o?void 0:{level:e},h=s.before(s.depth),d=n.selection.$to.after(n.selection.$to.depth);t.dispatch(n.tr.setBlockType(h,d,u,c)),t.focus()}function Tq(t){const{state:e}=t,{from:n,to:r}=e.selection,i=e.schema.marks.link;if(!i)return;let s=n,o=r;e.doc.nodesBetween(n,n===r?r+1:r,(u,c)=>{if(i.isInSet(u.marks))return s=c,o=c+u.nodeSize,!1}),t.dispatch(e.tr.removeMark(s,o,i))}function Mq(t,e){return t.bold===e.bold&&t.italic===e.italic&&t.strikethrough===e.strikethrough&&t.link===e.link&&t.linkHref===e.linkHref&&t.bulletList===e.bulletList&&t.orderedList===e.orderedList&&t.listStyle===e.listStyle&&t.blockquote===e.blockquote&&t.heading===e.heading}function Oq(t,e){let n=0,r=rS;const i=()=>{const u=t.ctx.get(gn),c=Eq(u);Mq(c,r)||(r=c,e(c))},s=t.ctx.get(gn),o=s.dispatch.bind(s);return s.dispatch=u=>{o(u),(u.selectionSet||u.docChanged)&&(cancelAnimationFrame(n),n=requestAnimationFrame(i))},i(),()=>{cancelAnimationFrame(n)}}const Rq=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],eT={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function zI(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=48&&e<=57}function Dq(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=102||e>=65&&e<=70||e>=48&&e<=57}function Iq(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=122||e>=65&&e<=90}function tT(t){return Iq(t)||zI(t)}const _q=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function Kg(t,e){const n=e||{},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,i=[];let s=0,o=-1,u="",c,h;n.position&&("start"in n.position||"indent"in n.position?(h=n.position.indent,c=n.position.start):c=n.position);let d=(c?c.line:0)||1,g=(c?c.column:0)||1,y=k(),b;for(s--;++s<=t.length;)if(b===10&&(g=(h?h[o]:0)||1),b=t.charCodeAt(s),b===38){const M=t.charCodeAt(s+1);if(M===9||M===10||M===12||M===32||M===38||M===60||Number.isNaN(M)||r&&M===r){u+=String.fromCharCode(b),g++;continue}const j=s+1;let P=j,U=j,L;if(M===35){U=++P;const Se=t.charCodeAt(U);Se===88||Se===120?(L="hexadecimal",U=++P):L="decimal"}else L="named";let C="",z="",G="";const J=L==="named"?tT:L==="decimal"?zI:Dq;for(U--;++U<=t.length;){const Se=t.charCodeAt(U);if(!J(Se))break;G+=String.fromCharCode(Se),L==="named"&&Rq.includes(G)&&(C=G,z=fh(G))}let K=t.charCodeAt(U)===59;if(K){U++;const Se=L==="named"?fh(G):!1;Se&&(C=G,z=Se)}let de=1+U-j,ce="";if(!(!K&&n.nonTerminated===!1))if(!G)L!=="named"&&E(4,de);else if(L==="named"){if(K&&!z)E(5,1);else if(C!==G&&(U=P+C.length,de=1+U-P,K=!1),!K){const Se=C?1:3;if(n.attribute){const Re=t.charCodeAt(U);Re===61?(E(Se,de),z=""):tT(Re)?z="":E(Se,de)}else E(Se,de)}ce=z}else{K||E(2,de);let Se=Number.parseInt(G,L==="hexadecimal"?16:10);if(zq(Se))E(7,de),ce="�";else if(Se in eT)E(6,de),ce=eT[Se];else{let Re="";Lq(Se)&&E(6,de),Se>65535&&(Se-=65536,Re+=String.fromCharCode(Se>>>10|55296),Se=56320|Se&1023),ce=Re+String.fromCharCode(Se)}}if(ce){N(),y=k(),s=U-1,g+=U-j+1,i.push(ce);const Se=k();Se.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,ce,{start:y,end:Se},t.slice(j-1,U)),y=Se}else G=t.slice(j-1,U),u+=G,g+=G.length,s=U-1}else b===10&&(d++,o++,g=0),Number.isNaN(b)?N():(u+=String.fromCharCode(b),g++);return i.join("");function k(){return{line:d,column:g,offset:s+((c?c.offset:0)||0)}}function E(M,j){let P;n.warning&&(P=k(),P.column+=j,P.offset+=j,n.warning.call(n.warningContext||void 0,_q[M],P,M))}function N(){u&&(i.push(u),n.text&&n.text.call(n.textContext||void 0,u,{start:y,end:k()}),u="")}}function zq(t){return t>=55296&&t<=57343||t>1114111}function Lq(t){return t>=1&&t<=8||t===11||t>=13&&t<=31||t>=127&&t<=159||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534}const Bq=/["&'<>`]/g,Vq=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Fq=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Pq=/[|\\{}()[\]^$+*?.]/g,nT=new WeakMap;function jq(t,e){if(t=t.replace(e.subset?$q(e.subset):Bq,r),e.subset||e.escapeOnly)return t;return t.replace(Vq,n).replace(Fq,r);function n(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function r(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function $q(t){let e=nT.get(t);return e||(e=Uq(t),nT.set(t,e)),e}function Uq(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Pq,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function Jq(t){return"&#x"+t.toString(16).toUpperCase()+";"}function qq(t,e){return jq(t,Object.assign({format:Jq},e))}function Hq(){return{canContainEols:["textDirective"],enter:{directiveContainer:Kq,directiveContainerAttributes:px,directiveContainerLabel:Qq,directiveLeaf:Gq,directiveLeafAttributes:px,directiveText:Yq,directiveTextAttributes:px},exit:{directiveContainer:bx,directiveContainerAttributeClassValue:mx,directiveContainerAttributeIdValue:dx,directiveContainerAttributeName:yx,directiveContainerAttributeValue:gx,directiveContainerAttributes:xx,directiveContainerLabel:Wq,directiveContainerName:hx,directiveLeaf:bx,directiveLeafAttributeClassValue:mx,directiveLeafAttributeIdValue:dx,directiveLeafAttributeName:yx,directiveLeafAttributeValue:gx,directiveLeafAttributes:xx,directiveLeafName:hx,directiveText:bx,directiveTextAttributeClassValue:mx,directiveTextAttributeIdValue:dx,directiveTextAttributeName:yx,directiveTextAttributeValue:gx,directiveTextAttributes:xx,directiveTextName:hx}}}function Kq(t){yk.call(this,"containerDirective",t)}function Gq(t){yk.call(this,"leafDirective",t)}function Yq(t){yk.call(this,"textDirective",t)}function yk(t,e){this.enter({type:t,name:"",attributes:{},children:[]},e)}function hx(t){const e=this.stack[this.stack.length-1];e.type==="containerDirective"||e.type==="leafDirective"||e.type,e.name=this.sliceSerialize(t)}function Qq(t){this.enter({type:"paragraph",data:{directiveLabel:!0},children:[]},t)}function Wq(t){this.exit(t)}function px(){this.data.directiveAttributes=[],this.buffer()}function dx(t){this.data.directiveAttributes.push(["id",Kg(this.sliceSerialize(t),{attribute:!0})])}function mx(t){this.data.directiveAttributes.push(["class",Kg(this.sliceSerialize(t),{attribute:!0})])}function gx(t){const e=this.data.directiveAttributes;e[e.length-1][1]=Kg(this.sliceSerialize(t),{attribute:!0})}function yx(t){this.data.directiveAttributes.push([this.sliceSerialize(t),""])}function xx(){const t=this.data.directiveAttributes,e={};let n=-1;for(;++n<t.length;){const i=t[n];i[0]==="class"&&e.class?e.class+=" "+i[1]:e[i[0]]=i[1]}this.data.directiveAttributes=void 0,this.resume();const r=this.stack[this.stack.length-1];r.type==="containerDirective"||r.type==="leafDirective"||r.type,r.attributes=e}function bx(t){this.exit(t)}function xk(t,e,n,r,i,s,o,u,c,h,d,g,y,b,k){let E,N;return M;function M(Y){return t.enter(r),t.enter(i),t.consume(Y),t.exit(i),j}function j(Y){return Y===35?(E=o,P(Y)):Y===46?(E=u,P(Y)):Y===58||Y===95||sn(Y)?(t.enter(s),t.enter(c),t.consume(Y),C):k&&qe(Y)?He(t,j,"whitespace")(Y):!k&&We(Y)?Ts(t,j)(Y):Re(Y)}function P(Y){const W=E+"Marker";return t.enter(s),t.enter(E),t.enter(W),t.consume(Y),t.exit(W),U}function U(Y){if(Y===null||Y===34||Y===35||Y===39||Y===46||Y===60||Y===61||Y===62||Y===96||Y===125||We(Y))return n(Y);const W=E+"Value";return t.enter(W),t.consume(Y),L}function L(Y){if(Y===null||Y===34||Y===39||Y===60||Y===61||Y===62||Y===96)return n(Y);if(Y===35||Y===46||Y===125||We(Y)){const W=E+"Value";return t.exit(W),t.exit(E),t.exit(s),j(Y)}return t.consume(Y),L}function C(Y){return Y===45||Y===46||Y===58||Y===95||vn(Y)?(t.consume(Y),C):(t.exit(c),k&&qe(Y)?He(t,z,"whitespace")(Y):!k&&We(Y)?Ts(t,z)(Y):z(Y))}function z(Y){return Y===61?(t.enter(h),t.consume(Y),t.exit(h),G):(t.exit(s),j(Y))}function G(Y){return Y===null||Y===60||Y===61||Y===62||Y===96||Y===125||k&&Ce(Y)?n(Y):Y===34||Y===39?(t.enter(d),t.enter(y),t.consume(Y),t.exit(y),N=Y,K):k&&qe(Y)?He(t,G,"whitespace")(Y):!k&&We(Y)?Ts(t,G)(Y):(t.enter(g),t.enter(b),t.consume(Y),N=void 0,J)}function J(Y){return Y===null||Y===34||Y===39||Y===60||Y===61||Y===62||Y===96?n(Y):Y===125||We(Y)?(t.exit(b),t.exit(g),t.exit(s),j(Y)):(t.consume(Y),J)}function K(Y){return Y===N?(t.enter(y),t.consume(Y),t.exit(y),t.exit(d),t.exit(s),Se):(t.enter(g),de(Y))}function de(Y){return Y===N?(t.exit(g),K(Y)):Y===null?n(Y):Ce(Y)?k?n(Y):Ts(t,de)(Y):(t.enter(b),t.consume(Y),ce)}function ce(Y){return Y===N||Y===null||Ce(Y)?(t.exit(b),de(Y)):(t.consume(Y),ce)}function Se(Y){return Y===125||We(Y)?j(Y):Re(Y)}function Re(Y){return Y===125?(t.enter(i),t.consume(Y),t.exit(i),t.exit(r),e):n(Y)}}function bk(t,e,n,r,i,s,o){let u=0,c=0,h;return d;function d(N){return t.enter(r),t.enter(i),t.consume(N),t.exit(i),g}function g(N){return N===93?(t.enter(i),t.consume(N),t.exit(i),t.exit(r),e):(t.enter(s),y(N))}function y(N){if(N===93&&!c)return E(N);const M=t.enter("chunkText",{contentType:"text",previous:h});return h&&(h.next=M),h=M,b(N)}function b(N){return N===null||u>999||N===91&&++c>32?n(N):N===93&&!c--?(t.exit("chunkText"),E(N)):Ce(N)?o?n(N):(t.consume(N),t.exit("chunkText"),y):(t.consume(N),N===92?k:b)}function k(N){return N===91||N===92||N===93?(t.consume(N),u++,b):b(N)}function E(N){return t.exit(s),t.enter(i),t.consume(N),t.exit(i),t.exit(r),e}}function Sk(t,e,n,r){const i=this;return s;function s(u){return sn(u)?(t.enter(r),t.consume(u),o):n(u)}function o(u){return u===45||u===95||vn(u)?(t.consume(u),o):(t.exit(r),i.previous===45||i.previous===95?n(u):e(u))}}const Xq={tokenize:tH,concrete:!0},Zq={tokenize:nH,partial:!0},eH={tokenize:rH,partial:!0},Fd={tokenize:iH,partial:!0};function tH(t,e,n){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let o=0,u;return c;function c(J){return t.enter("directiveContainer"),t.enter("directiveContainerFence"),t.enter("directiveContainerSequence"),h(J)}function h(J){return J===58?(t.consume(J),o++,h):o<3?n(J):(t.exit("directiveContainerSequence"),Sk.call(r,t,d,n,"directiveContainerName")(J))}function d(J){return J===91?t.attempt(Zq,g,g)(J):g(J)}function g(J){return J===123?t.attempt(eH,y,y)(J):y(J)}function y(J){return He(t,b,"whitespace")(J)}function b(J){return t.exit("directiveContainerFence"),J===null?z(J):Ce(J)?r.interrupt?e(J):t.attempt(Fd,k,z)(J):n(J)}function k(J){return J===null?z(J):Ce(J)?t.check(Fd,P,z)(J):(t.enter("directiveContainerContent"),E(J))}function E(J){return t.attempt({tokenize:G,partial:!0},C,s?He(t,N,"linePrefix",s+1):N)(J)}function N(J){return J===null?C(J):Ce(J)?t.check(Fd,j,C)(J):j(J)}function M(J){if(J===null){const K=t.exit("chunkDocument");return r.parser.lazy[K.start.line]=!1,C(J)}return Ce(J)?t.check(Fd,U,L)(J):(t.consume(J),M)}function j(J){const K=t.enter("chunkDocument",{contentType:"document",previous:u});return u&&(u.next=K),u=K,M(J)}function P(J){return t.enter("directiveContainerContent"),E(J)}function U(J){t.consume(J);const K=t.exit("chunkDocument");return r.parser.lazy[K.start.line]=!1,E}function L(J){const K=t.exit("chunkDocument");return r.parser.lazy[K.start.line]=!1,C(J)}function C(J){return t.exit("directiveContainerContent"),z(J)}function z(J){return t.exit("directiveContainer"),e(J)}function G(J,K,de){let ce=0;return He(J,Se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function Se(W){return J.enter("directiveContainerFence"),J.enter("directiveContainerSequence"),Re(W)}function Re(W){return W===58?(J.consume(W),ce++,Re):ce<o?de(W):(J.exit("directiveContainerSequence"),He(J,Y,"whitespace")(W))}function Y(W){return W===null||Ce(W)?(J.exit("directiveContainerFence"),K(W)):de(W)}}}function nH(t,e,n){return bk(t,e,n,"directiveContainerLabel","directiveContainerLabelMarker","directiveContainerLabelString",!0)}function rH(t,e,n){return xk(t,e,n,"directiveContainerAttributes","directiveContainerAttributesMarker","directiveContainerAttribute","directiveContainerAttributeId","directiveContainerAttributeClass","directiveContainerAttributeName","directiveContainerAttributeInitializerMarker","directiveContainerAttributeValueLiteral","directiveContainerAttributeValue","directiveContainerAttributeValueMarker","directiveContainerAttributeValueData",!0)}function iH(t,e,n){const r=this;return i;function i(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const sH={tokenize:lH},aH={tokenize:uH,partial:!0},oH={tokenize:cH,partial:!0};function lH(t,e,n){const r=this;return i;function i(d){return t.enter("directiveLeaf"),t.enter("directiveLeafSequence"),t.consume(d),s}function s(d){return d===58?(t.consume(d),t.exit("directiveLeafSequence"),Sk.call(r,t,o,n,"directiveLeafName")):n(d)}function o(d){return d===91?t.attempt(aH,u,u)(d):u(d)}function u(d){return d===123?t.attempt(oH,c,c)(d):c(d)}function c(d){return He(t,h,"whitespace")(d)}function h(d){return d===null||Ce(d)?(t.exit("directiveLeaf"),e(d)):n(d)}}function uH(t,e,n){return bk(t,e,n,"directiveLeafLabel","directiveLeafLabelMarker","directiveLeafLabelString",!0)}function cH(t,e,n){return xk(t,e,n,"directiveLeafAttributes","directiveLeafAttributesMarker","directiveLeafAttribute","directiveLeafAttributeId","directiveLeafAttributeClass","directiveLeafAttributeName","directiveLeafAttributeInitializerMarker","directiveLeafAttributeValueLiteral","directiveLeafAttributeValue","directiveLeafAttributeValueMarker","directiveLeafAttributeValueData",!0)}const fH={tokenize:mH,previous:dH},hH={tokenize:gH,partial:!0},pH={tokenize:yH,partial:!0};function dH(t){return t!==58||this.events[this.events.length-1][1].type==="characterEscape"}function mH(t,e,n){const r=this;return i;function i(c){return t.enter("directiveText"),t.enter("directiveTextMarker"),t.consume(c),t.exit("directiveTextMarker"),Sk.call(r,t,s,n,"directiveTextName")}function s(c){return c===58?n(c):c===91?t.attempt(hH,o,o)(c):o(c)}function o(c){return c===123?t.attempt(pH,u,u)(c):u(c)}function u(c){return t.exit("directiveText"),e(c)}}function gH(t,e,n){return bk(t,e,n,"directiveTextLabel","directiveTextLabelMarker","directiveTextLabelString")}function yH(t,e,n){return xk(t,e,n,"directiveTextAttributes","directiveTextAttributesMarker","directiveTextAttribute","directiveTextAttributeId","directiveTextAttributeClass","directiveTextAttributeName","directiveTextAttributeInitializerMarker","directiveTextAttributeValueLiteral","directiveTextAttributeValue","directiveTextAttributeValueMarker","directiveTextAttributeValueData")}function xH(){return{text:{58:fH},flow:{58:[Xq,sH]}}}const tg="youtube";function bH(t){if(!t||typeof t!="object")return"";const e=Object.entries(t),n=t.id;if(typeof n=="string"&&n)return n;for(const[r,i]of e)if(i===""||i==null)return r;return""}const LI=Ju("youtube",()=>({group:"block",atom:!0,isolating:!0,selectable:!0,draggable:!1,attrs:{videoId:{default:""}},toDOM:t=>["div",{"data-youtube":t.attrs.videoId,class:"youtube-block"}],parseDOM:[{tag:"div[data-youtube]",getAttrs:t=>({videoId:t.getAttribute("data-youtube")||""})}],parseMarkdown:{match:t=>(t.type==="leafDirective"||t.type==="containerDirective"||t.type==="textDirective")&&t.name===tg,runner:(t,e,n)=>{const r=bH(e.attributes);t.addNode(n,{videoId:r})}},toMarkdown:{match:t=>t.type.name==="youtube",runner:(t,e)=>{t.addNode("leafDirective",void 0,void 0,{name:tg,attributes:{id:e.attrs.videoId}})}}}));function SH(t){const e=t.attributes,n=e&&typeof e=="object"?String(e.id??""):"";return`::${tg}{#${n}}`}const vH=function(){const t=this.data("toMarkdownExtensions")??[],e={handlers:{leafDirective:SH}};t.push(e),this.data("toMarkdownExtensions",t)},kH=Ni("remarkYoutubeDirective",()=>vH),BI=Ue("insertYoutube",()=>t=>(e,n)=>{if(!t)return!1;const r=e.schema.nodes.youtube;if(!r)return!1;const i=r.create({videoId:t});return n&&n(e.tr.replaceSelectionWith(i).scrollIntoView()),!0}),iS="list",CH=/^[A-Za-z0-9_-]+$/,wH=new Set(["textDirective","leafDirective","containerDirective"]);function Pi(t){if(typeof t!="string")return null;const[e]=t.trim().split(/\s+/);return!e||!CH.test(e)?null:e}function zs(t){return Array.isArray(t?.children)?t.children:null}function Sx(t){const e=zs(t);return e&&e.length>0?e[e.length-1]:void 0}function VI(t){return!t.attributes||typeof t.attributes!="object"||Array.isArray(t.attributes)?null:t.attributes}function EH(t){return Pi(VI(t)?.class)}function FI(t,e){const n=zs(t);if(t?.type!=="paragraph"||n?.length!==1)return!1;const r=n[0];return r?.type!=="text"||typeof r.value!="string"?!1:e===void 0?!0:r.value===e}function AH(t){if(!FI(t))return null;const e=zs(t)?.[0];return typeof e?.value!="string"?null:/^:::list\{\.([A-Za-z0-9_-]+)\}$/.exec(e.value)?.[1]??null}function rT(t){return t?.type==="list"}function NH(t,e,n){if(FI(e[n],":::"))return e.splice(n,1),!0;const r=Sx(t),i=Sx(r);if(!i||i.type!=="paragraph")return!1;const s=zs(i),o=Sx(i);if(!s||o?.type!=="text"||typeof o.value!="string")return!1;if(o.value===":::")s.pop();else if(o.value.endsWith(`
58
58
  :::`))o.value=o.value.slice(0,-4);else return!1;return s.length===0&&zs(r)?.pop(),!0}function TH(t){return t==="containerDirective"?":::":t==="leafDirective"?"::":":"}function MH(t){if(!t||typeof t!="object"||Array.isArray(t))return"";const e=[];for(const[n,r]of Object.entries(t))if(n==="class"&&typeof r=="string")for(const i of r.split(/\s+/).filter(Boolean))e.push(`.${i}`);else n==="id"&&typeof r=="string"?e.push(`#${r}`):r===""||r==null?e.push(n):e.push(`${n}="${String(r)}"`);return e.length>0?`{${e.join(" ")}}`:""}function Xc(t){return{type:"text",value:t}}function OH(t){const e=TH(t.type),n=typeof t.name=="string"?t.name:"",r=zs(t)??[],i=MH(t.attributes);if(t.type==="textDirective"){const o=[Xc(`${e}${n}`)];return r.length>0&&o.push(Xc("["),...r,Xc("]")),i&&o.push(Xc(i)),o}return[{type:"paragraph",children:[Xc(`${e}${n}${i}`)]},...r]}function PI(t){const e=zs(t);if(e)for(let n=0;n<e.length;n++){const r=e[n];if(!r)continue;if(r.type==="containerDirective"){const o=r,u=o.name===iS?EH(o):null,c=zs(o),h=c?.length===1?c[0]:void 0;if(u&&rT(h)){e[n]={...h,listStyle:u};continue}}const i=AH(r),s=e[n+1];if(i&&rT(s)&&NH(s,e,n+2)){e.splice(n,1),e[n]={...s,listStyle:i};continue}if(PI(r),wH.has(r.type)){if(r.name===tg)continue;const o=r.type==="containerDirective"&&r.name===iS?zs(r)??[]:OH(r);e.splice(n,1,...o),n+=o.length-1}}}function RH(t){return!!(t&&typeof t=="object"&&"containerFlow"in t&&typeof t.containerFlow=="function")}const DH=(t,e,n,r)=>{if(!RH(n))return"";const i=Pi(VI(t)?.class),s=n.containerFlow(t,r);return`:::list${i?`{.${i}}`:""}
59
59
  ${s}
60
60
  :::`},IH=function(){const t=this.data("toMarkdownExtensions")??[],e={handlers:{containerDirective:DH}};return t.push(e),this.data("toMarkdownExtensions",t),n=>{PI(n)}},_H=Ni("remarkListDirective",()=>IH),zH=function(){const t=this.data("micromarkExtensions")??[];t.push(xH()),this.data("micromarkExtensions",t);const e=this.data("fromMarkdownExtensions")??[];e.push(Hq()),this.data("fromMarkdownExtensions",e)},LH=Ni("remarkDirective",()=>zH);function jI(t){return t&&typeof t=="object"?t:{}}function BH(t){if(t)return{name:iS,attributes:{class:t}}}function $I(t,e,n){const r=Pi(e.attrs.listStyle),i=BH(r);i&&t.openNode("containerDirective",void 0,i),t.openNode("list",void 0,n).next(e.content).closeNode(),i&&t.closeNode()}const VH=ml.extendSchema(t=>e=>{const n=t(e);return{...n,attrs:{...n.attrs,listStyle:{default:null,validate:"string|null"}},parseDOM:[{tag:"ul",getAttrs:r=>{const i=jI(n.parseDOM?.[0]?.getAttrs?.(r)),s=r instanceof HTMLElement?Pi(r.className):null;return{...i,listStyle:s}}}],toDOM:r=>{const i=Pi(r.attrs.listStyle);return["ul",{...e.get(Lg.key)(r),...i?{class:i}:{},"data-spread":r.attrs.spread},0]},parseMarkdown:{match:({type:r,ordered:i})=>r==="list"&&!i,runner:(r,i,s)=>{r.openNode(s,{spread:i.spread===!0,listStyle:Pi(i.listStyle)}).next(i.children).closeNode()}},toMarkdown:{match:r=>r.type.name==="bullet_list",runner:(r,i)=>{$I(r,i,{ordered:!1,spread:i.attrs.spread===!0})}}}}),FH=gl.extendSchema(t=>e=>{const n=t(e);return{...n,attrs:{...n.attrs,listStyle:{default:null,validate:"string|null"}},parseDOM:[{tag:"ol",getAttrs:r=>{const i=jI(n.parseDOM?.[0]?.getAttrs?.(r)),s=r instanceof HTMLElement?Pi(r.className):null;return{...i,listStyle:s}}}],toDOM:r=>{const i=Pi(r.attrs.listStyle);return["ol",{...e.get(Vg.key)(r),...r.attrs.order===1?{}:{start:r.attrs.order},...i?{class:i}:{},"data-spread":r.attrs.spread},0]},parseMarkdown:{match:({type:r,ordered:i})=>r==="list"&&!!i,runner:(r,i,s)=>{r.openNode(s,{order:typeof i.start=="number"?i.start:1,spread:i.spread===!0,listStyle:Pi(i.listStyle)}).next(i.children).closeNode()}},toMarkdown:{match:r=>r.type.name==="ordered_list",runner:(r,i)=>{$I(r,i,{ordered:!0,start:typeof i.attrs.order=="number"?i.attrs.order:1,spread:i.attrs.spread===!0})}}}}),UI=Ue("SetListStyle",()=>t=>(e,n)=>{const r=new Set([e.schema.nodes.bullet_list,e.schema.nodes.ordered_list].filter(Boolean));if(r.size===0)return!1;const i=Pi(t),s=new Map,{from:o,to:u,$from:c}=e.selection;for(let h=c.depth;h>0;h--){const d=c.node(h);if(r.has(d.type)){s.set(c.before(h),d);break}}if(e.doc.nodesBetween(o,u,(h,d)=>{r.has(h.type)&&s.set(d,h)}),s.size===0)return!1;if(n){let h=e.tr;for(const[d,g]of s)h=h.setNodeMarkup(d,void 0,{...g.attrs,listStyle:i});n(h.scrollIntoView())}return!0}),PH=[LH,_H,VH,FH,UI].flat(),jH=/^[A-Za-z0-9_-]{11}$/,$H=/(?:youtu\.be\/|\/(?:embed|shorts|v)\/)([A-Za-z0-9_-]{11})/;function UH(t){const e=t.trim();if(!e)return null;if(jH.test(e))return e;const n=/[?&]v=([A-Za-z0-9_-]{11})/.exec(e);if(n)return n[1]??null;const r=$H.exec(e);return r?r[1]??null:null}const JH={fontSize:11,color:"#dc2626",whiteSpace:"nowrap"};function qH({onApply:t,onClose:e}){const[n,r]=ae.useState(""),[i,s]=ae.useState(!1),o=()=>{const u=UH(n);if(!u){s(!0);return}t(u)};return I.jsxs("div",{style:gk,"data-mdx-action":"youtube",onMouseDown:u=>u.stopPropagation(),children:[I.jsx("input",{style:eg,autoFocus:!0,placeholder:"YouTube URL or ID",value:n,onChange:u=>{r(u.currentTarget.value),i&&s(!1)},onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),o()),u.key==="Escape"&&e()}}),i?I.jsx("span",{style:JH,children:"No video id found"}):null,I.jsx("button",{type:"button",style:{..._h,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:u=>u.preventDefault(),onClick:o,children:"Insert"}),I.jsx("button",{type:"button",style:_h,onMouseDown:u=>u.preventDefault(),onClick:e,children:"Cancel"})]})}function HH(t){const[e,n]=ae.useState(rS);return ae.useEffect(()=>{if(!t){n(rS);return}return Oq(t,n)},[t]),e}function vx(t,e){Nq(t.ctx.get(gn),e)}function iT(t,e){const n=t.ctx.get(gn);Aq(n,e==="bullet"?"bullet_list":"ordered_list")?t.action(ki(Pg.key)):t.action(ki(e==="bullet"?Bg.key:Fg.key))}function KH(t,e){t.ctx.get(gn).focus(),t.action(ki(UI.key,e))}function GH(t,e,n,r){t.action(i=>{const s=i.get(gn),o=s.state.schema.nodes.image;o&&(s.focus(),s.dispatch(s.state.tr.replaceSelectionWith(o.create({src:e,alt:n,title:r})).scrollIntoView()))})}function YH(t,e){t.action(ki(BI.key,e))}const QH={display:"flex",flexWrap:"wrap",alignItems:"center",gap:3,padding:"4px 6px",borderBottom:"1px solid #ececed",background:"#fafafa"},kx={width:1,height:18,background:"#e4e4e7",margin:"0 3px"},JI={border:"1px solid transparent",background:"transparent",borderRadius:4,padding:"2px 7px",font:"inherit",fontSize:12,lineHeight:1.4,cursor:"pointer",color:"#52525b"},WH={...JI,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},XH={border:"1px solid #d4d4d8",borderRadius:4,background:"#fff",color:"#3f3f46",font:"inherit",fontSize:12,lineHeight:1.4,padding:"2px 6px",maxWidth:150};function ar({active:t,title:e,onClick:n,style:r,children:i}){return I.jsx("button",{type:"button",title:e,"data-mdx-action":"format",onMouseDown:s=>s.preventDefault(),onClick:n,style:{...t?WH:JI,...r},children:i})}function qI({editor:t,listStyles:e,media:n,mediaContext:r,field:i,onInsertComponent:s}){const o=HH(t),[u,c]=ae.useState(!1),[h,d]=ae.useState(!1),[g,y]=ae.useState(!1),[b,k]=ae.useState(null),E=t===null,N=(e?.length??0)>0,M=o.bulletList||o.orderedList,j=o.listStyle&&e?.some(L=>L.class===o.listStyle)?o.listStyle:"",P=L=>{if(c(!1),!t)return;t.ctx.get(gn).focus(),t.action(ki(o.link?iv.key:rv.key,{href:L}))},U=()=>{if(c(!1),!t)return;const L=t.ctx.get(gn);L.focus(),Tq(L)};return I.jsxs("div",{children:[I.jsxs("div",{style:QH,children:[I.jsx(ar,{active:o.bold,title:"Bold",onClick:()=>t?.action(ki(Dg.key)),style:{fontWeight:700},children:"B"}),I.jsx(ar,{active:o.italic,title:"Italic",onClick:()=>t?.action(ki(Rg.key)),style:{fontStyle:"italic"},children:"I"}),I.jsx(ar,{active:o.strikethrough,title:"Strikethrough",onClick:()=>t?.action(ki(Hg.key)),style:{textDecoration:"line-through"},children:"S"}),I.jsx("span",{style:kx}),I.jsx(ar,{active:o.heading===2,title:"Heading 2",onClick:()=>t&&vx(t,2),children:"H2"}),I.jsx(ar,{active:o.heading===3,title:"Heading 3",onClick:()=>t&&vx(t,3),children:"H3"}),I.jsx(ar,{active:o.heading===4,title:"Heading 4",onClick:()=>t&&vx(t,4),children:"H4"}),I.jsx("span",{style:kx}),I.jsx(ar,{active:o.bulletList,title:"Bullet list",onClick:()=>t&&iT(t,"bullet"),children:"• List"}),I.jsx(ar,{active:o.orderedList,title:"Numbered list",onClick:()=>t&&iT(t,"ordered"),children:"1. List"}),N?I.jsxs("select",{title:"List style","aria-label":"List style",disabled:E||!M,value:j,onChange:L=>{t&&KH(t,L.currentTarget.value||null)},style:{...XH,opacity:E||!M?.55:1,cursor:E||!M?"not-allowed":"default"},children:[I.jsx("option",{value:"",children:"Default"}),e?.map(L=>I.jsx("option",{value:L.class,children:L.label},L.class))]}):null,I.jsx(ar,{active:o.blockquote,title:"Quote",onClick:()=>t?.action(ki(zg.key)),children:"❝"}),I.jsx(ar,{title:"Insert table",onClick:()=>t?.action(ki(ck.key,{row:3,col:3})),children:"▦ Table"}),I.jsx(ar,{active:g,title:"Insert YouTube",onClick:()=>!E&&y(L=>!L),children:"YouTube"}),I.jsx("span",{style:kx}),I.jsx(ar,{active:o.link||u,title:"Link",onClick:()=>!E&&c(L=>!L),children:"🔗 Link"}),n?I.jsx(ar,{title:"Insert image",onClick:()=>!E&&d(!0),children:"🖼 Image"}):null,s?I.jsxs(I.Fragment,{children:[I.jsx("span",{style:{flex:1}}),I.jsx(ar,{title:"Insert component block",onClick:()=>!E&&s(),style:{border:"1px solid #d4d4d8",color:"#3f3f46"},children:"+ Component"})]}):null]}),u?I.jsx("div",{style:{padding:"0 6px"},children:I.jsx(dq,{initialUrl:o.linkHref??"https://",isEdit:o.link,onApply:P,onRemove:o.link?U:void 0,onClose:()=>c(!1)})}):null,g?I.jsx("div",{style:{padding:"0 6px"},children:I.jsx(qH,{onApply:L=>{y(!1),t&&YH(t,L)},onClose:()=>y(!1)})}):null,b?I.jsx("div",{style:{padding:"0 6px"},children:I.jsx(gq,{initialAlt:b.alt,onApply:(L,C)=>{const{url:z}=b;k(null),t&&GH(t,z,L,C)},onClose:()=>k(null)})}):null,h&&n?I.jsx(_I,{media:n,context:r,field:i,accept:"image/*",onSelect:(L,C)=>{d(!1),t&&k({url:L,alt:C??""})},onClose:()=>d(!1)}):null]})}function ZH(){return{enter:{mdxFlowExpression:tK,mdxTextExpression:nK},exit:{mdxFlowExpression:sT,mdxFlowExpressionChunk:aT,mdxTextExpression:sT,mdxTextExpressionChunk:aT}}}function eK(){return{handlers:{mdxFlowExpression:oT,mdxTextExpression:oT},unsafe:[{character:"{",inConstruct:["phrasing"]},{atBreak:!0,character:"{"}]}}function tK(t){this.enter({type:"mdxFlowExpression",value:""},t),this.buffer()}function nK(t){this.enter({type:"mdxTextExpression",value:""},t),this.buffer()}function sT(t){const e=this.resume(),n=t.estree,r=this.stack[this.stack.length-1];r.type==="mdxFlowExpression"||r.type,this.exit(t),r.value=e,n&&(r.data={estree:n})}function aT(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function oT(t,e,n){const r=t.value||"";return"{"+n.indentLines(r,function(s,o,u){return(o===0||u?"":" ")+s})+"}"}const HI=" ";function rK(){return{canContainEols:["mdxJsxTextElement"],enter:{mdxJsxFlowTag:r,mdxJsxFlowTagClosingMarker:i,mdxJsxFlowTagAttribute:g,mdxJsxFlowTagExpressionAttribute:y,mdxJsxFlowTagAttributeValueLiteral:t,mdxJsxFlowTagAttributeValueExpression:t,mdxJsxFlowTagSelfClosingMarker:o,mdxJsxTextTag:r,mdxJsxTextTagClosingMarker:i,mdxJsxTextTagAttribute:g,mdxJsxTextTagExpressionAttribute:y,mdxJsxTextTagAttributeValueLiteral:t,mdxJsxTextTagAttributeValueExpression:t,mdxJsxTextTagSelfClosingMarker:o},exit:{mdxJsxFlowTagClosingMarker:u,mdxJsxFlowTagNamePrimary:c,mdxJsxFlowTagNameMember:h,mdxJsxFlowTagNameLocal:d,mdxJsxFlowTagExpressionAttribute:b,mdxJsxFlowTagExpressionAttributeValue:n,mdxJsxFlowTagAttributeNamePrimary:k,mdxJsxFlowTagAttributeNameLocal:E,mdxJsxFlowTagAttributeValueLiteral:N,mdxJsxFlowTagAttributeValueLiteralValue:n,mdxJsxFlowTagAttributeValueExpression:M,mdxJsxFlowTagAttributeValueExpressionValue:n,mdxJsxFlowTagSelfClosingMarker:j,mdxJsxFlowTag:P,mdxJsxTextTagClosingMarker:u,mdxJsxTextTagNamePrimary:c,mdxJsxTextTagNameMember:h,mdxJsxTextTagNameLocal:d,mdxJsxTextTagExpressionAttribute:b,mdxJsxTextTagExpressionAttributeValue:n,mdxJsxTextTagAttributeNamePrimary:k,mdxJsxTextTagAttributeNameLocal:E,mdxJsxTextTagAttributeValueLiteral:N,mdxJsxTextTagAttributeValueLiteralValue:n,mdxJsxTextTagAttributeValueExpression:M,mdxJsxTextTagAttributeValueExpressionValue:n,mdxJsxTextTagSelfClosingMarker:j,mdxJsxTextTag:P}};function t(){this.buffer()}function e(z){return{line:z.line,column:z.column,offset:z.offset}}function n(z){this.config.enter.data.call(this,z),this.config.exit.data.call(this,z)}function r(z){const G={name:void 0,attributes:[],close:!1,selfClosing:!1,start:z.start,end:z.end};this.data.mdxJsxTagStack||(this.data.mdxJsxTagStack=[]),this.data.mdxJsxTag=G,this.buffer()}function i(z){if(this.data.mdxJsxTagStack.length===0)throw new mt("Unexpected closing slash `/` in tag, expected an open tag first",{start:z.start,end:z.end},"mdast-util-mdx-jsx:unexpected-closing-slash")}function s(z){if(this.data.mdxJsxTag.close)throw new mt("Unexpected attribute in closing tag, expected the end of the tag",{start:z.start,end:z.end},"mdast-util-mdx-jsx:unexpected-attribute")}function o(z){if(this.data.mdxJsxTag.close)throw new mt("Unexpected self-closing slash `/` in closing tag, expected the end of the tag",{start:z.start,end:z.end},"mdast-util-mdx-jsx:unexpected-self-closing-slash")}function u(){const z=this.data.mdxJsxTag;z.close=!0}function c(z){const G=this.data.mdxJsxTag;G.name=this.sliceSerialize(z)}function h(z){const G=this.data.mdxJsxTag;G.name+="."+this.sliceSerialize(z)}function d(z){const G=this.data.mdxJsxTag;G.name+=":"+this.sliceSerialize(z)}function g(z){const G=this.data.mdxJsxTag;s.call(this,z),G.attributes.push({type:"mdxJsxAttribute",name:"",value:null,position:{start:e(z.start),end:void 0}})}function y(z){const G=this.data.mdxJsxTag;s.call(this,z),G.attributes.push({type:"mdxJsxExpressionAttribute",value:"",position:{start:e(z.start),end:void 0}}),this.buffer()}function b(z){const G=this.data.mdxJsxTag,J=G.attributes[G.attributes.length-1];J.type;const K=z.estree;J.value=this.resume(),J.position,J.position.end=e(z.end),K&&(J.data={estree:K})}function k(z){const G=this.data.mdxJsxTag,J=G.attributes[G.attributes.length-1];J.type,J.name=this.sliceSerialize(z),J.position,J.position.end=e(z.end)}function E(z){const G=this.data.mdxJsxTag,J=G.attributes[G.attributes.length-1];J.type,J.name+=":"+this.sliceSerialize(z),J.position,J.position.end=e(z.end)}function N(z){const G=this.data.mdxJsxTag,J=G.attributes[G.attributes.length-1];J.value=Kg(this.resume(),{nonTerminated:!1}),J.position,J.position.end=e(z.end)}function M(z){const G=this.data.mdxJsxTag,J=G.attributes[G.attributes.length-1];J.type;const K={type:"mdxJsxAttributeValueExpression",value:this.resume()},de=z.estree;de&&(K.data={estree:de}),J.value=K,J.position,J.position.end=e(z.end)}function j(){const z=this.data.mdxJsxTag;z.selfClosing=!0}function P(z){const G=this.data.mdxJsxTag,J=this.data.mdxJsxTagStack,K=J[J.length-1];if(G.close&&K.name!==G.name)throw new mt("Unexpected closing tag `"+C(G)+"`, expected corresponding closing tag for `"+C(K)+"` ("+Ms(K)+")",{start:z.start,end:z.end},"mdast-util-mdx-jsx:end-tag-mismatch");this.resume(),G.close?J.pop():this.enter({type:z.type==="mdxJsxTextTag"?"mdxJsxTextElement":"mdxJsxFlowElement",name:G.name||null,attributes:G.attributes,children:[]},z,U),G.selfClosing||G.close?this.exit(z,L):J.push(G)}function U(z,G){const J=this.data.mdxJsxTagStack,K=J[J.length-1],de=z?" before the end of `"+z.type+"`":"",ce=z?{start:z.start,end:z.end}:void 0;throw new mt("Expected a closing tag for `"+C(K)+"` ("+Ms({start:G.start,end:G.end})+")"+de,ce,"mdast-util-mdx-jsx:end-tag-mismatch")}function L(z,G){const J=this.data.mdxJsxTag;throw new mt("Expected the closing tag `"+C(J)+"` either after the end of `"+G.type+"` ("+Ms(G.end)+") or another opening tag after the start of `"+G.type+"` ("+Ms(G.start)+")",{start:z.start,end:z.end},"mdast-util-mdx-jsx:end-tag-mismatch")}function C(z){return"<"+(z.close?"/":"")+(z.name||"")+">"}}function iK(t){const e=t||{},n=e.quote||'"',r=e.quoteSmart||!1,i=e.tightSelfClosing||!1,s=e.printWidth||Number.POSITIVE_INFINITY,o=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize attribute values with `"+n+"` for `options.quote`, expected `\"`, or `'`");return u.peek=aK,{handlers:{mdxJsxFlowElement:u,mdxJsxTextElement:u},unsafe:[{character:"<",inConstruct:["phrasing"]},{atBreak:!0,character:"<"}],fences:!0,resourceLink:!0};function u(c,h,d,g){const y=c.type==="mdxJsxFlowElement",b=c.name?!c.children||c.children.length===0:!1,k=KI(d),E=GI(k),N=d.createTracker(g),M=d.createTracker(g),j=[],P=(y?E:"")+"<"+(c.name||""),U=d.enter(c.type);if(N.move(P),M.move(P),c.attributes&&c.attributes.length>0){if(!c.name)throw new Error("Cannot serialize fragment w/ attributes");let J=-1;for(;++J<c.attributes.length;){const K=c.attributes[J];let de;if(K.type==="mdxJsxExpressionAttribute")de="{"+(K.value||"")+"}";else{if(!K.name)throw new Error("Cannot serialize attribute w/o name");const ce=K.value,Se=K.name;let Re="";if(ce!=null)if(typeof ce=="object")Re="{"+(ce.value||"")+"}";else{const Y=r&&Zm(ce,n)>Zm(ce,o)?o:n;Re=Y+qq(ce,{subset:[Y]})+Y}de=Se+(Re?"=":"")+Re}j.push(de)}}let L=!1;const C=j.join(" ");y&&(/\r?\n|\r/.test(C)||N.current().now.column+C.length+(b?i?2:3:1)>s)&&(L=!0);let z=N,G=P;if(L){z=M;let J=-1;for(;++J<j.length;)j[J]=E+HI+j[J];G+=z.move(`