@nuasite/cms-studio 0.43.3 → 0.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,121 @@
1
+ var F2=t=>{throw TypeError(t)};var P2=(t,e,n)=>e.has(t)||F2("Cannot "+n);var Ze=(t,e,n)=>(P2(t,e,"read from private field"),n?n.call(t):e.get(t)),Ut=(t,e,n)=>e.has(t)?F2("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),iu=(t,e,n,r)=>(P2(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 xT(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Zy={exports:{}},qc={};var j2;function v4(){if(j2)return qc;j2=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 qc.Fragment=e,qc.jsx=n,qc.jsxs=n,qc}var $2;function C4(){return $2||($2=1,Zy.exports=v4()),Zy.exports}var I=C4();const w4=409;class vi 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 U2(t){return lh(t)&&typeof t.error=="string"&&typeof t.code=="string"}function lh(t){return typeof t=="object"&&t!==null}function E4(t){return lh(t)?t.code==="conflict"&&typeof t.serverHash=="string"&&lh(t.serverFrontmatter):!1}const N4=["not_found","conflict","validation","parse_error","io_error","unsupported","unauthorized"];function A4(t){return N4.includes(t)}function J2(t){return t instanceof vi&&(t.status===501||t.code==="unsupported")}function T4(t){const e=t.endsWith("/")?t.slice(0,-1):t;async function n(h){const m=await fetch(`${e}${h}`,{method:"GET",credentials:"include",headers:{accept:"application/json"}});if(!m.ok)throw await r(m);return await m.json()}async function r(h){const m=await h.json().catch(()=>null);return s(h.status,m)}function i(h,m){if(U2(h))return h.error;if(lh(h)){const g=h.error;if(lh(g)&&typeof g.message=="string")return g.message}return m}function s(h,m){return h===403?new vi(403,"forbidden",i(m,"You do not have access to this project.")):U2(m)&&A4(m.code)?new vi(h,m.code,m.error):h===401?new vi(401,"unauthorized","Your session has expired. Please reload."):new vi(h,"unknown",i(m,`Request failed (${h})`))}function o(h,m){const g={method:h,credentials:"include",headers:{accept:"application/json"}};return m!==void 0&&(g.body=JSON.stringify(m),g.headers={accept:"application/json","content-type":"application/json"}),g}async function u(h,m,g){const y=await fetch(`${e}${h}`,o(m,g));if(!y.ok)throw await r(y);return await y.json()}function c(h,m){return`/collections/${encodeURIComponent(h)}/entries/${encodeURIComponent(m)}`}return{getProject(){return n("/project")},getConfig(){return n("/config")},getCollections(){return n("/collections")},getComponents(){return n("/components")},getEntries(h,m={}){const g=new URLSearchParams;m.fields!==void 0&&g.set("fields",m.fields),m.draft!==void 0&&g.set("draft",m.draft),m.cursor!==void 0&&g.set("cursor",m.cursor),m.limit!==void 0&&g.set("limit",String(m.limit));const y=g.toString(),b=y===""?"":`?${y}`;return n(`/collections/${encodeURIComponent(h)}/entries${b}`)},getEntry(h,m){return n(c(h,m))},async updateEntry(h,m,g){const y=await fetch(`${e}${c(h,m)}`,o("PATCH",g));if(y.status===w4){const v=await y.json().catch(()=>null);if(E4(v))return{status:"conflict",conflict:v};throw s(y.status,v)}if(!y.ok)throw await r(y);return{status:"ok",result:await y.json()}},createEntry(h,m){return u(`/collections/${encodeURIComponent(h)}/entries`,"POST",m)},deleteEntry(h,m){return u(c(h,m),"DELETE")},renameEntry(h,m,g){return u(`${c(h,m)}/rename`,"POST",{to:g})},addArrayItem(h,m,g,y,b){const v=b===void 0?{field:g,value:y}:{field:g,value:y,index:b};return u(`${c(h,m)}/array`,"POST",v)},removeArrayItem(h,m,g,y){return u(`${c(h,m)}/array`,"DELETE",{field:g,index:y})},listMedia(h={}){const m=new URLSearchParams;h.folder!==void 0&&m.set("folder",h.folder),h.cursor!==void 0&&m.set("cursor",h.cursor),h.limit!==void 0&&m.set("limit",String(h.limit));const g=m.toString();return n(`/media${g===""?"":`?${g}`}`)},async uploadMedia(h,m={}){const g=new URLSearchParams;m.collection!==void 0&&g.set("collection",m.collection),m.entry!==void 0&&g.set("entry",m.entry),m.field!==void 0&&g.set("field",m.field),m.folder!==void 0&&g.set("folder",m.folder);const y=g.toString(),b=new FormData;b.append("file",h);const v=await fetch(`${e}/media${y===""?"":`?${y}`}`,{method:"POST",credentials:"include",headers:{accept:"application/json"},body:b});if(!v.ok)throw await r(v);return await v.json()},mediaFileUrl(h,m,g){return`${e}${c(h,m)}/asset?path=${encodeURIComponent(g)}`},deleteMedia(h){return u(`/media/${encodeURIComponent(h)}`,"DELETE")},createFolder(h){return u("/media","POST",{folder:h})}}}function M4(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function bT(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"array":case"object":return O4(e);default:return e}}function O4(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 R4(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?bT(o.type,s.value):s.value}return{frontmatter:r,body:t.body}}function D4(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]=ST(n.type)}return{frontmatter:e,body:""}}function ST(t){switch(t){case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}function I4(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"?bT(u.type,o):o}return{frontmatter:i,body:e??""}}function Xb(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}default:return e}}function Bs(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function _4(t){return typeof t=="boolean"?t:typeof t=="string"?t==="true"||t==="1"||t.toLowerCase()==="yes":!!t}function z4(t){return Array.isArray(t)?t:[]}function L4(t){return M4(t)?t:{}}function kT(t,e,n){return{...t,frontmatter:{...t.frontmatter,[e]:n}}}var e1={exports:{}},He={};var H2;function B4(){if(H2)return He;H2=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"),m=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 v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,T={};function M(F,Q,V){this.props=F,this.context=Q,this.refs=T,this.updater=V||v}M.prototype.isReactComponent={},M.prototype.setState=function(F,Q){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,Q,"setState")},M.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function j(){}j.prototype=M.prototype;function P(F,Q,V){this.props=F,this.context=Q,this.refs=T,this.updater=V||v}var J=P.prototype=new j;J.constructor=P,N(J,M.prototype),J.isPureReactComponent=!0;var L=Array.isArray;function C(){}var z={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function ie(F,Q,V){var xe=V.ref;return{$$typeof:t,type:F,key:Q,ref:xe!==void 0?xe:null,props:V}}function K(F,Q){return ie(F.type,Q,F.props)}function pe(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function fe(F){var Q={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(V){return Q[V]})}var Se=/\/+/g;function _e(F,Q){return typeof F=="object"&&F!==null&&F.key!=null?fe(""+F.key):Q.toString(36)}function Re(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(Q){F.status==="pending"&&(F.status="fulfilled",F.value=Q)},function(Q){F.status==="pending"&&(F.status="rejected",F.reason=Q)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function X(F,Q,V,xe,Oe){var Te=typeof F;(Te==="undefined"||Te==="boolean")&&(F=null);var We=!1;if(F===null)We=!0;else switch(Te){case"bigint":case"string":case"number":We=!0;break;case"object":switch(F.$$typeof){case t:case e:We=!0;break;case m:return We=F._init,X(We(F._payload),Q,V,xe,Oe)}}if(We)return Oe=Oe(F),We=xe===""?"."+_e(F,0):xe,L(Oe)?(V="",We!=null&&(V=We.replace(Se,"$&/")+"/"),X(Oe,Q,V,"",function(zt){return zt})):Oe!=null&&(pe(Oe)&&(Oe=K(Oe,V+(Oe.key==null||F&&F.key===Oe.key?"":(""+Oe.key).replace(Se,"$&/")+"/")+We)),Q.push(Oe)),1;We=0;var Ct=xe===""?".":xe+":";if(L(F))for(var Xe=0;Xe<F.length;Xe++)xe=F[Xe],Te=Ct+_e(xe,Xe),We+=X(xe,Q,V,Te,Oe);else if(Xe=b(F),typeof Xe=="function")for(F=Xe.call(F),Xe=0;!(xe=F.next()).done;)xe=xe.value,Te=Ct+_e(xe,Xe++),We+=X(xe,Q,V,Te,Oe);else if(Te==="object"){if(typeof F.then=="function")return X(Re(F),Q,V,xe,Oe);throw Q=String(F),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return We}function oe(F,Q,V){if(F==null)return F;var xe=[],Oe=0;return X(F,xe,"","",function(Te){return Q.call(V,Te,Oe++)}),xe}function ke(F){if(F._status===-1){var Q=F._result;Q=Q(),Q.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=Q)}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 Q=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(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)},D={map:oe,forEach:function(F,Q,V){oe(F,function(){Q.apply(this,arguments)},V)},count:function(F){var Q=0;return oe(F,function(){Q++}),Q},toArray:function(F){return oe(F,function(Q){return Q})||[]},only:function(F){if(!pe(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return He.Activity=g,He.Children=D,He.Component=M,He.Fragment=n,He.Profiler=i,He.PureComponent=P,He.StrictMode=r,He.Suspense=c,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,He.__COMPILER_RUNTIME={__proto__:null,c:function(F){return z.H.useMemoCache(F)}},He.cache=function(F){return function(){return F.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(F,Q,V){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var xe=N({},F.props),Oe=F.key;if(Q!=null)for(Te in Q.key!==void 0&&(Oe=""+Q.key),Q)!q.call(Q,Te)||Te==="key"||Te==="__self"||Te==="__source"||Te==="ref"&&Q.ref===void 0||(xe[Te]=Q[Te]);var Te=arguments.length-2;if(Te===1)xe.children=V;else if(1<Te){for(var We=Array(Te),Ct=0;Ct<Te;Ct++)We[Ct]=arguments[Ct+2];xe.children=We}return ie(F.type,Oe,xe)},He.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},He.createElement=function(F,Q,V){var xe,Oe={},Te=null;if(Q!=null)for(xe in Q.key!==void 0&&(Te=""+Q.key),Q)q.call(Q,xe)&&xe!=="key"&&xe!=="__self"&&xe!=="__source"&&(Oe[xe]=Q[xe]);var We=arguments.length-2;if(We===1)Oe.children=V;else if(1<We){for(var Ct=Array(We),Xe=0;Xe<We;Xe++)Ct[Xe]=arguments[Xe+2];Oe.children=Ct}if(F&&F.defaultProps)for(xe in We=F.defaultProps,We)Oe[xe]===void 0&&(Oe[xe]=We[xe]);return ie(F,Te,Oe)},He.createRef=function(){return{current:null}},He.forwardRef=function(F){return{$$typeof:u,render:F}},He.isValidElement=pe,He.lazy=function(F){return{$$typeof:m,_payload:{_status:-1,_result:F},_init:ke}},He.memo=function(F,Q){return{$$typeof:h,type:F,compare:Q===void 0?null:Q}},He.startTransition=function(F){var Q=z.T,V={};z.T=V;try{var xe=F(),Oe=z.S;Oe!==null&&Oe(V,xe),typeof xe=="object"&&xe!==null&&typeof xe.then=="function"&&xe.then(C,ze)}catch(Te){ze(Te)}finally{Q!==null&&V.types!==null&&(Q.types=V.types),z.T=Q}},He.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},He.use=function(F){return z.H.use(F)},He.useActionState=function(F,Q,V){return z.H.useActionState(F,Q,V)},He.useCallback=function(F,Q){return z.H.useCallback(F,Q)},He.useContext=function(F){return z.H.useContext(F)},He.useDebugValue=function(){},He.useDeferredValue=function(F,Q){return z.H.useDeferredValue(F,Q)},He.useEffect=function(F,Q){return z.H.useEffect(F,Q)},He.useEffectEvent=function(F){return z.H.useEffectEvent(F)},He.useId=function(){return z.H.useId()},He.useImperativeHandle=function(F,Q,V){return z.H.useImperativeHandle(F,Q,V)},He.useInsertionEffect=function(F,Q){return z.H.useInsertionEffect(F,Q)},He.useLayoutEffect=function(F,Q){return z.H.useLayoutEffect(F,Q)},He.useMemo=function(F,Q){return z.H.useMemo(F,Q)},He.useOptimistic=function(F,Q){return z.H.useOptimistic(F,Q)},He.useReducer=function(F,Q,V){return z.H.useReducer(F,Q,V)},He.useRef=function(F){return z.H.useRef(F)},He.useState=function(F){return z.H.useState(F)},He.useSyncExternalStore=function(F,Q,V){return z.H.useSyncExternalStore(F,Q,V)},He.useTransition=function(){return z.H.useTransition()},He.version="19.2.7",He}var q2;function Qb(){return q2||(q2=1,e1.exports=B4()),e1.exports}var le=Qb();function V4(t){const e={};for(const n of t.props)e[n.name]=n.defaultValue??"";return e}const F4={position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh",zIndex:1e3},P4={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},j4={border:"none",borderBottom:"1px solid #ececed",padding:"10px 12px",font:"inherit",outline:"none"},$4={textAlign:"left",border:"none",background:"transparent",padding:"8px 12px",cursor:"pointer",borderRadius:0};function U4({open:t,components:e,onInsert:n,onClose:r}){const[i,s]=le.useState(""),o=le.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:F4,onMouseDown:r,children:I.jsxs("div",{style:P4,onMouseDown:u=>u.stopPropagation(),children:[I.jsx("input",{style:j4,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:$4,onClick:()=>{n(u.name,V4(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}},J4=(t,e)=>typeof e=="function"?"[Function]":e,mg=t=>JSON.stringify(t,J4);function H4(t){return new ai(si.docTypeError,`Doc type error, unsupported type: ${mg(t)}`)}function q4(t){return new ai(si.contextNotFound,`Context "${t}" not found, do you forget to inject it?`)}function K4(t){return new ai(si.timerNotFound,`Timer "${t}" not found, do you forget to record it?`)}function gg(){return new ai(si.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function G4(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
+ `))}function vT(){return new ai(si.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function Y4(t){return new ai(si.parserMatchError,`Cannot match target parser for node: ${mg(t)}.`)}function W4(t){return new ai(si.serializerMatchError,`Cannot match target serializer for node: ${mg(t)}.`)}function qi(t){return new ai(si.expectDomTypeError,`Expect to be a dom, but get: ${mg(t)}.`)}function t1(){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 X4(t){return new ai(si.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${t}" in schema.`)}function Q4(t){return new ai(si.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${t}" in schema.`)}var CT=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 q4(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)}},Z4=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=[]}},ez=class{constructor(t,e){this.id=Symbol(`Context-${e}`),this.name=e,this._defaultValue=t,this._typeInfo=()=>{throw gg()}}create(t,e=this._defaultValue){return new Z4(t,e,this)}},st=(t,e)=>new ez(t,e),tz=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},nz=class wT{#t;#e;#r;#n;constructor(e,n,r){this.produce=i=>i&&Object.keys(i).length?new wT(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 tz(e,n,r))}get meta(){return this.#r}get inspector(){return this.#n}},rz=class{constructor(){this.store=new Map,this.get=t=>{const e=this.store.get(t.id);if(!e)throw K4(t.name);return e},this.remove=t=>{this.store.delete(t.id)},this.has=t=>this.store.has(t.id)}},iz=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)}},sz=class{constructor(t,e=3e3){this.create=n=>new iz(n,this),this.id=Symbol(`Timer-${t}`),this.name=t,this.timeout=e}},Ki=(t,e=3e3)=>new sz(t,e);const az={};function Zb(t,e){const n=az,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ET(t,r,i)}function ET(t,e,n){if(oz(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 K2(t.children,e,n)}return Array.isArray(t)?K2(t,e,n):""}function K2(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=ET(t[i],e,n);return r.join("")}function oz(t){return!!(t&&typeof t=="object")}const G2=document.createElement("i");function uh(t){const e="&"+t+";";G2.innerHTML=e;const n=G2.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 Xr(t,e){return t.length>0?(Er(t,t.length,0,e),t):e}const Y2={}.hasOwnProperty;function eS(t){const e={};let n=-1;for(;++n<t.length;)lz(e,t[n]);return e}function lz(t,e){let n;for(n in e){const i=(Y2.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){Y2.call(i,o)||(i[o]=[]);const u=s[o];uz(i[o],Array.isArray(u)?u:u?[u]:[])}}}function uz(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 NT(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 Ci(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Sn=Ga(/[A-Za-z]/),lr=Ga(/[\dA-Za-z]/),cz=Ga(/[#-'*+\--9=?A-Z^-~]/);function km(t){return t!==null&&(t<32||t===127)}const wx=Ga(/\d/),fz=Ga(/[\dA-Fa-f]/),hz=Ga(/[!-/:-@[-`{-~]/);function Ae(t){return t!==null&&t<-2}function ct(t){return t!==null&&(t<0||t===32)}function Ge(t){return t===-2||t===-1||t===32}const yg=Ga(new RegExp("\\p{P}|\\p{S}","u")),Bn=Ga(/\s/);function Ga(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function nt(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return Ge(c)?(t.enter(n),u(c)):e(c)}function u(c){return Ge(c)&&s++<i?(t.consume(c),u):(t.exit(n),e(c))}}const pz={tokenize:dz};function dz(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"),nt(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 Ae(u)?(t.consume(u),t.exit("chunkText"),s):(t.consume(u),o)}}const mz={tokenize:gz},W2={tokenize:yz};function gz(t){const e=this,n=[];let r=0,i,s,o;return u;function u(P){if(r<n.length){const J=n[r];return e.containerState=J[1],t.attempt(J[0].continuation,c,h)(P)}return h(P)}function c(P){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&j();const J=e.events.length;let L=J,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=J;for(;z<e.events.length;)e.events[z][1].end={...C},z++;return Er(e.events,L+1,0,e.events.slice(J)),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 v(P);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(W2,m,g)(P)}function m(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,v(P)}function y(P){return e.containerState={},t.attempt(W2,b,v)(P)}function b(P){return r++,n.push([e.currentConstruct,e.containerState]),y(P)}function v(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}),N(P)}function N(P){if(P===null){T(t.exit("chunkFlow"),!0),M(0),t.consume(P);return}return Ae(P)?(t.consume(P),T(t.exit("chunkFlow")),r=0,e.interrupt=void 0,u):(t.consume(P),N)}function T(P,J){const L=e.sliceStream(P);if(J&&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 q=z,ie,K;for(;q--;)if(e.events[q][0]==="exit"&&e.events[q][1].type==="chunkFlow"){if(ie){K=e.events[q][1].end;break}ie=!0}for(M(r),C=z;C<e.events.length;)e.events[C][1].end={...K},C++;Er(e.events,q+1,0,e.events.slice(z)),e.events.length=C}}function M(P){let J=n.length;for(;J-- >P;){const L=n[J];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 yz(t,e,n){return nt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Du(t){if(t===null||ct(t)||Bn(t))return 1;if(yg(t))return 2}function xg(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 Ex={name:"attention",resolveAll:xz,tokenize:bz};function xz(t,e){let n=-1,r,i,s,o,u,c,h,m;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};X2(g,-c),X2(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=Xr(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=Xr(h,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),h=Xr(h,xg(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=Xr(h,[["exit",s,e],["enter",u,e],["exit",u,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(m=2,h=Xr(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):m=0,Er(t,r-1,n-r+3,h),n=r+h.length-m-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function bz(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Du(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"),m=Du(c),g=!m||m===2&&i||n.includes(c),y=!i||i===2&&m||n.includes(r);return h._open=!!(s===42?g:g&&(i||!y)),h._close=!!(s===42?y:y&&(m||!g)),e(c)}}function X2(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const Sz={name:"autolink",tokenize:kz};function kz(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||lr(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||lr(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||km(b)?n(b):(t.consume(b),c)}function h(b){return b===64?(t.consume(b),m):cz(b)?(t.consume(b),h):n(b)}function m(b){return lr(b)?g(b):n(b)}function g(b){return b===46?(t.consume(b),r=0,m):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||lr(b))&&r++<63){const v=b===45?y:g;return t.consume(b),v}return n(b)}}const Pu={partial:!0,tokenize:vz};function vz(t,e,n){return r;function r(s){return Ge(s)?nt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ae(s)?e(s):n(s)}}const AT={continuation:{tokenize:wz},exit:Ez,name:"blockQuote",tokenize:Cz};function Cz(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 Ge(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function wz(t,e,n){const r=this;return i;function i(o){return Ge(o)?nt(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(AT,e,n)(o)}}function Ez(t){t.exit("blockQuote")}const TT={name:"characterEscape",tokenize:Nz};function Nz(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 hz(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const MT={name:"characterReference",tokenize:Az};function Az(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=lr,m(g))}function h(g){return g===88||g===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(g),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=fz,m):(t.enter("characterReferenceValue"),s=7,o=wx,m(g))}function m(g){if(g===59&&i){const y=t.exit("characterReferenceValue");return o===lr&&!uh(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),m):n(g)}}const Q2={partial:!0,tokenize:Mz},Z2={concrete:!0,name:"codeFenced",tokenize:Tz};function Tz(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"),m(C)}function m(C){return C===u?(o++,t.consume(C),m):o<3?n(C):(t.exit("codeFencedFenceSequence"),Ge(C)?nt(t,g,"whitespace")(C):g(C))}function g(C){return C===null||Ae(C)?(t.exit("codeFencedFence"),r.interrupt?e(C):t.check(Q2,N,J)(C)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||Ae(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),g(C)):Ge(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),nt(t,b,"whitespace")(C)):C===96&&C===u?n(C):(t.consume(C),y)}function b(C){return C===null||Ae(C)?g(C):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===null||Ae(C)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),g(C)):C===96&&C===u?n(C):(t.consume(C),v)}function N(C){return t.attempt(i,J,T)(C)}function T(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),M}function M(C){return s>0&&Ge(C)?nt(t,j,"linePrefix",s+1)(C):j(C)}function j(C){return C===null||Ae(C)?t.check(Q2,N,J)(C):(t.enter("codeFlowValue"),P(C))}function P(C){return C===null||Ae(C)?(t.exit("codeFlowValue"),j(C)):(t.consume(C),P)}function J(C){return t.exit("codeFenced"),e(C)}function L(C,z,q){let ie=0;return K;function K(Re){return C.enter("lineEnding"),C.consume(Re),C.exit("lineEnding"),pe}function pe(Re){return C.enter("codeFencedFence"),Ge(Re)?nt(C,fe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Re):fe(Re)}function fe(Re){return Re===u?(C.enter("codeFencedFenceSequence"),Se(Re)):q(Re)}function Se(Re){return Re===u?(ie++,C.consume(Re),Se):ie>=o?(C.exit("codeFencedFenceSequence"),Ge(Re)?nt(C,_e,"whitespace")(Re):_e(Re)):q(Re)}function _e(Re){return Re===null||Ae(Re)?(C.exit("codeFencedFence"),z(Re)):q(Re)}}}function Mz(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 n1={name:"codeIndented",tokenize:Rz},Oz={partial:!0,tokenize:Dz};function Rz(t,e,n){const r=this;return i;function i(h){return t.enter("codeIndented"),nt(t,s,"linePrefix",5)(h)}function s(h){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?o(h):n(h)}function o(h){return h===null?c(h):Ae(h)?t.attempt(Oz,o,c)(h):(t.enter("codeFlowValue"),u(h))}function u(h){return h===null||Ae(h)?(t.exit("codeFlowValue"),o(h)):(t.consume(h),u)}function c(h){return t.exit("codeIndented"),e(h)}}function Dz(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Ae(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):nt(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):Ae(o)?i(o):n(o)}}const Iz={name:"codeText",previous:zz,resolve:_z,tokenize:Lz};function _z(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 zz(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Lz(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,m(g)):Ae(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||Ae(g)?(t.exit("codeTextData"),c(g)):(t.consume(g),h)}function m(g){return g===96?(t.consume(g),i++,m):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(g)):(s.type="codeTextData",h(g))}}class Bz{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&&Kc(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),Kc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Kc(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);Kc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Kc(this.left,n.reverse())}}}function Kc(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 OT(t){const e={};let n=-1,r,i,s,o,u,c,h;const m=new Bz(t);for(;++n<m.length;){for(;n in e;)n=e[n];if(r=m.get(n),n&&r[1].type==="chunkFlow"&&m.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,Vz(m,n)),n=e[n],h=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=m.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(m.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={...m.get(i)[1].start},u=m.slice(i,n),u.unshift(r),m.splice(i,n-i+1,u))}}return Er(t,0,Number.POSITIVE_INFINITY,m.slice(0)),!h}function Vz(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 m,g,y=-1,b=n,v=0,N=0;const T=[N];for(;b;){for(;t.get(++i)[1]!==b;);s.push(i),b._tokenizer||(m=r.sliceStream(b),b.next||m.push(null),g&&o.defineSkip(b.start),b._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(m),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&&(N=y+1,T.push(N),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(o.events=[],b?(b._tokenizer=void 0,b.previous=void 0):T.pop(),y=T.length;y--;){const M=u.slice(T[y],T[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[v+c[y][0]]=v+c[y][1],v+=c[y][1]-c[y][0]-1;return h}const Fz={resolve:jz,tokenize:$z},Pz={partial:!0,tokenize:Uz};function jz(t){return OT(t),t}function $z(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):Ae(u)?t.check(Pz,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 Uz(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),nt(t,s,"linePrefix")}function s(o){if(o===null||Ae(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 RT(t,e,n,r,i,s,o,u,c){const h=c||Number.POSITIVE_INFINITY;let m=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||km(M)?n(M):(t.enter(r),t.enter(o),t.enter(u),t.enter("chunkString",{contentType:"string"}),N(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||Ae(M)?n(M):(t.consume(M),M===92?v:b)}function v(M){return M===60||M===62||M===92?(t.consume(M),b):b(M)}function N(M){return!m&&(M===null||M===41||ct(M))?(t.exit("chunkString"),t.exit(u),t.exit(o),t.exit(r),e(M)):m<h&&M===40?(t.consume(M),m++,N):M===41?(t.consume(M),m--,N):M===null||M===32||M===40||km(M)?n(M):(t.consume(M),M===92?T:N)}function T(M){return M===40||M===41||M===92?(t.consume(M),N):N(M)}}function DT(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),m}function m(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):Ae(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),m):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||Ae(b)||u++>999?(t.exit("chunkString"),m(b)):(t.consume(b),c||(c=!Ge(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(t.consume(b),u++,g):g(b)}}function IT(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):Ae(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),nt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===o||y===null||Ae(y)?(t.exit("chunkString"),h(y)):(t.consume(y),y===92?g:m)}function g(y){return y===o||y===92?(t.consume(y),m):m(y)}}function Ff(t,e){let n;return r;function r(i){return Ae(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ge(i)?nt(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const Jz={name:"definition",tokenize:qz},Hz={partial:!0,tokenize:Kz};function qz(t,e,n){const r=this;let i;return s;function s(b){return t.enter("definition"),o(b)}function o(b){return DT.call(r,t,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return i=Ci(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 ct(b)?Ff(t,h)(b):h(b)}function h(b){return RT(t,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function m(b){return t.attempt(Hz,g,g)(b)}function g(b){return Ge(b)?nt(t,y,"whitespace")(b):y(b)}function y(b){return b===null||Ae(b)?(t.exit("definition"),r.parser.defined.push(i),e(b)):n(b)}}function Kz(t,e,n){return r;function r(u){return ct(u)?Ff(t,i)(u):n(u)}function i(u){return IT(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function s(u){return Ge(u)?nt(t,o,"whitespace")(u):o(u)}function o(u){return u===null||Ae(u)?e(u):n(u)}}const Gz={name:"hardBreakEscape",tokenize:Yz};function Yz(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Ae(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const Wz={name:"headingAtx",resolve:Xz,tokenize:Qz};function Xz(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 Qz(t,e,n){let r=0;return i;function i(m){return t.enter("atxHeading"),s(m)}function s(m){return t.enter("atxHeadingSequence"),o(m)}function o(m){return m===35&&r++<6?(t.consume(m),o):m===null||ct(m)?(t.exit("atxHeadingSequence"),u(m)):n(m)}function u(m){return m===35?(t.enter("atxHeadingSequence"),c(m)):m===null||Ae(m)?(t.exit("atxHeading"),e(m)):Ge(m)?nt(t,u,"whitespace")(m):(t.enter("atxHeadingText"),h(m))}function c(m){return m===35?(t.consume(m),c):(t.exit("atxHeadingSequence"),u(m))}function h(m){return m===null||m===35||ct(m)?(t.exit("atxHeadingText"),u(m)):(t.consume(m),h)}}const Zz=["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"],eE=["pre","script","style","textarea"],eL={concrete:!0,name:"htmlFlow",resolveTo:rL,tokenize:iL},tL={partial:!0,tokenize:aL},nL={partial:!0,tokenize:sL};function rL(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 iL(t,e,n){const r=this;let i,s,o,u,c;return h;function h(V){return m(V)}function m(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,N):V===63?(t.consume(V),i=3,r.interrupt?e:D):Sn(V)?(t.consume(V),o=String.fromCharCode(V),T):n(V)}function y(V){return V===45?(t.consume(V),i=2,b):V===91?(t.consume(V),i=5,u=0,v):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 v(V){const xe="CDATA[";return V===xe.charCodeAt(u++)?(t.consume(V),u===xe.length?r.interrupt?e:fe:v):n(V)}function N(V){return Sn(V)?(t.consume(V),o=String.fromCharCode(V),T):n(V)}function T(V){if(V===null||V===47||V===62||ct(V)){const xe=V===47,Oe=o.toLowerCase();return!xe&&!s&&eE.includes(Oe)?(i=1,r.interrupt?e(V):fe(V)):Zz.includes(o.toLowerCase())?(i=6,xe?(t.consume(V),M):r.interrupt?e(V):fe(V)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(V):s?j(V):P(V))}return V===45||lr(V)?(t.consume(V),o+=String.fromCharCode(V),T):n(V)}function M(V){return V===62?(t.consume(V),r.interrupt?e:fe):n(V)}function j(V){return Ge(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),J):Ge(V)?(t.consume(V),P):K(V)}function J(V){return V===45||V===46||V===58||V===95||lr(V)?(t.consume(V),J):L(V)}function L(V){return V===61?(t.consume(V),C):Ge(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):Ge(V)?(t.consume(V),C):q(V)}function z(V){return V===c?(t.consume(V),c=null,ie):V===null||Ae(V)?n(V):(t.consume(V),z)}function q(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||ct(V)?L(V):(t.consume(V),q)}function ie(V){return V===47||V===62||Ge(V)?P(V):n(V)}function K(V){return V===62?(t.consume(V),pe):n(V)}function pe(V){return V===null||Ae(V)?fe(V):Ge(V)?(t.consume(V),pe):n(V)}function fe(V){return V===45&&i===2?(t.consume(V),X):V===60&&i===1?(t.consume(V),oe):V===62&&i===4?(t.consume(V),F):V===63&&i===3?(t.consume(V),D):V===93&&i===5?(t.consume(V),ze):Ae(V)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(tL,Q,Se)(V)):V===null||Ae(V)?(t.exit("htmlFlowData"),Se(V)):(t.consume(V),fe)}function Se(V){return t.check(nL,_e,Q)(V)}function _e(V){return t.enter("lineEnding"),t.consume(V),t.exit("lineEnding"),Re}function Re(V){return V===null||Ae(V)?Se(V):(t.enter("htmlFlowData"),fe(V))}function X(V){return V===45?(t.consume(V),D):fe(V)}function oe(V){return V===47?(t.consume(V),o="",ke):fe(V)}function ke(V){if(V===62){const xe=o.toLowerCase();return eE.includes(xe)?(t.consume(V),F):fe(V)}return Sn(V)&&o.length<8?(t.consume(V),o+=String.fromCharCode(V),ke):fe(V)}function ze(V){return V===93?(t.consume(V),D):fe(V)}function D(V){return V===62?(t.consume(V),F):V===45&&i===2?(t.consume(V),D):fe(V)}function F(V){return V===null||Ae(V)?(t.exit("htmlFlowData"),Q(V)):(t.consume(V),F)}function Q(V){return t.exit("htmlFlow"),e(V)}}function sL(t,e,n){const r=this;return i;function i(o){return Ae(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(Pu,e,n)}}const oL={name:"htmlText",tokenize:lL};function lL(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),q):n(D)}function h(D){return D===45?(t.consume(D),m):D===91?(t.consume(D),s=0,v):Sn(D)?(t.consume(D),j):n(D)}function m(D){return D===45?(t.consume(D),b):n(D)}function g(D){return D===null?n(D):D===45?(t.consume(D),y):Ae(D)?(o=g,oe(D)):(t.consume(D),g)}function y(D){return D===45?(t.consume(D),b):g(D)}function b(D){return D===62?X(D):D===45?y(D):g(D)}function v(D){const F="CDATA[";return D===F.charCodeAt(s++)?(t.consume(D),s===F.length?N:v):n(D)}function N(D){return D===null?n(D):D===93?(t.consume(D),T):Ae(D)?(o=N,oe(D)):(t.consume(D),N)}function T(D){return D===93?(t.consume(D),M):N(D)}function M(D){return D===62?X(D):D===93?(t.consume(D),M):N(D)}function j(D){return D===null||D===62?X(D):Ae(D)?(o=j,oe(D)):(t.consume(D),j)}function P(D){return D===null?n(D):D===63?(t.consume(D),J):Ae(D)?(o=P,oe(D)):(t.consume(D),P)}function J(D){return D===62?X(D):P(D)}function L(D){return Sn(D)?(t.consume(D),C):n(D)}function C(D){return D===45||lr(D)?(t.consume(D),C):z(D)}function z(D){return Ae(D)?(o=z,oe(D)):Ge(D)?(t.consume(D),z):X(D)}function q(D){return D===45||lr(D)?(t.consume(D),q):D===47||D===62||ct(D)?ie(D):n(D)}function ie(D){return D===47?(t.consume(D),X):D===58||D===95||Sn(D)?(t.consume(D),K):Ae(D)?(o=ie,oe(D)):Ge(D)?(t.consume(D),ie):X(D)}function K(D){return D===45||D===46||D===58||D===95||lr(D)?(t.consume(D),K):pe(D)}function pe(D){return D===61?(t.consume(D),fe):Ae(D)?(o=pe,oe(D)):Ge(D)?(t.consume(D),pe):ie(D)}function fe(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(t.consume(D),i=D,Se):Ae(D)?(o=fe,oe(D)):Ge(D)?(t.consume(D),fe):(t.consume(D),_e)}function Se(D){return D===i?(t.consume(D),i=void 0,Re):D===null?n(D):Ae(D)?(o=Se,oe(D)):(t.consume(D),Se)}function _e(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ct(D)?ie(D):(t.consume(D),_e)}function Re(D){return D===47||D===62||ct(D)?ie(D):n(D)}function X(D){return D===62?(t.consume(D),t.exit("htmlTextData"),t.exit("htmlText"),e):n(D)}function oe(D){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),ke}function ke(D){return Ge(D)?nt(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 tS={name:"labelEnd",resolveAll:hL,resolveTo:pL,tokenize:dL},uL={tokenize:mL},cL={tokenize:gL},fL={tokenize:yL};function hL(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 pL(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}},m={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return u=[["enter",c,e],["enter",h,e]],u=Xr(u,t.slice(s+1,s+r+3)),u=Xr(u,[["enter",m,e]]),u=Xr(u,xg(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),u=Xr(u,[["exit",m,e],t[o-2],t[o-1],["exit",h,e]]),u=Xr(u,t.slice(o+1)),u=Xr(u,[["exit",c,e]]),Er(t,s,t.length,u),t}function dL(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(Ci(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(uL,m,o?m:g)(y):y===91?t.attempt(cL,m,o?h:g)(y):o?m(y):g(y)}function h(y){return t.attempt(fL,m,g)(y)}function m(y){return e(y)}function g(y){return s._balanced=!0,n(y)}}function mL(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 ct(g)?Ff(t,s)(g):s(g)}function s(g){return g===41?m(g):RT(t,o,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function o(g){return ct(g)?Ff(t,c)(g):m(g)}function u(g){return n(g)}function c(g){return g===34||g===39||g===40?IT(t,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):m(g)}function h(g){return ct(g)?Ff(t,m)(g):m(g)}function m(g){return g===41?(t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),t.exit("resource"),e):n(g)}}function gL(t,e,n){const r=this;return i;function i(u){return DT.call(r,t,s,o,"reference","referenceMarker","referenceString")(u)}function s(u){return r.parser.defined.includes(Ci(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(u):n(u)}function o(u){return n(u)}}function yL(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 xL={name:"labelStartImage",resolveAll:tS.resolveAll,tokenize:bL};function bL(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 SL={name:"labelStartLink",resolveAll:tS.resolveAll,tokenize:kL};function kL(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 r1={name:"lineEnding",tokenize:vL};function vL(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),nt(t,e,"linePrefix")}}const Vd={name:"thematicBreak",tokenize:CL};function CL(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||Ae(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===i?(t.consume(h),r++,c):(t.exit("thematicBreakSequence"),Ge(h)?nt(t,u,"whitespace")(h):u(h))}}const or={continuation:{tokenize:AL},exit:ML,name:"list",tokenize:NL},wL={partial:!0,tokenize:OL},EL={partial:!0,tokenize:TL};function NL(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 v=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:wx(b)){if(r.containerState.type||(r.containerState.type=v,t.enter(v,{_container:!0})),v==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(Vd,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 wx(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(Pu,r.interrupt?n:m,t.attempt(wL,y,g))}function m(b){return r.containerState.initialBlankLine=!0,s++,y(b)}function g(b){return Ge(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 AL(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Pu,i,s);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,nt(t,e,"listItemIndent",r.containerState.size+1)(u)}function s(u){return r.containerState.furtherBlankLines||!Ge(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(EL,e,o)(u))}function o(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,nt(t,t.attempt(or,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function TL(t,e,n){const r=this;return nt(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 ML(t){t.exit(this.containerState.type)}function OL(t,e,n){const r=this;return nt(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!Ge(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const tE={name:"setextUnderline",resolveTo:RL,tokenize:DL};function RL(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 DL(t,e,n){const r=this;let i;return s;function s(h){let m=r.events.length,g;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){g=r.events[m][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"),Ge(h)?nt(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||Ae(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const IL={tokenize:_L};function _L(t){const e=this,n=t.attempt(Pu,r,t.attempt(this.parser.constructs.flowInitial,i,nt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Fz,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 zL={resolveAll:zT()},LL=_T("string"),BL=_T("text");function _T(t){return{resolveAll:zT(t==="text"?VL: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(m){return h(m)?s(m):u(m)}function u(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),c}function c(m){return h(m)?(n.exit("data"),s(m)):(n.consume(m),c)}function h(m){if(m===null)return!0;const g=i[m];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 zT(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 VL(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 FL={42:or,43:or,45:or,48:or,49:or,50:or,51:or,52:or,53:or,54:or,55:or,56:or,57:or,62:AT},PL={91:Jz},jL={[-2]:n1,[-1]:n1,32:n1},$L={35:Wz,42:Vd,45:[tE,Vd],60:eL,61:tE,95:Vd,96:Z2,126:Z2},UL={38:MT,92:TT},JL={[-5]:r1,[-4]:r1,[-3]:r1,33:xL,38:MT,42:Ex,60:[Sz,oL],91:SL,92:[Gz,TT],93:tS,95:Ex,96:Iz},HL={null:[Ex,zL]},qL={null:[42,95]},KL={null:[]},GL=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qL,contentInitial:PL,disable:KL,document:FL,flow:$L,flowInitial:jL,insideSpan:HL,string:UL,text:JL},Symbol.toStringTag,{value:"Module"}));function YL(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:J,interrupt:z(C,{interrupt:!0})},h={code:null,containerState:{},defineSkip:N,events:[],now:v,parser:t,previous:null,sliceSerialize:y,sliceStream:b,write:g};let m=e.tokenize.call(h,c);return e.resolveAll&&s.push(e),h;function g(pe){return o=Xr(o,pe),T(),o[o.length-1]!==null?[]:(q(e,0),h.events=xg(s,h.events,h),h.events)}function y(pe,fe){return XL(b(pe),fe)}function b(pe){return WL(o,pe)}function v(){const{_bufferIndex:pe,_index:fe,line:Se,column:_e,offset:Re}=r;return{_bufferIndex:pe,_index:fe,line:Se,column:_e,offset:Re}}function N(pe){i[pe.line]=pe.column,K()}function T(){let pe;for(;r._index<o.length;){const fe=o[r._index];if(typeof fe=="string")for(pe=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===pe&&r._bufferIndex<fe.length;)M(fe.charCodeAt(r._bufferIndex));else M(fe)}}function M(pe){m=m(pe)}function j(pe){Ae(pe)?(r.line++,r.column=1,r.offset+=pe===-3?2:1,K()):pe!==-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=pe}function P(pe,fe){const Se=fe||{};return Se.type=pe,Se.start=v(),h.events.push(["enter",Se,h]),u.push(Se),Se}function J(pe){const fe=u.pop();return fe.end=v(),h.events.push(["exit",fe,h]),fe}function L(pe,fe){q(pe,fe.from)}function C(pe,fe){fe.restore()}function z(pe,fe){return Se;function Se(_e,Re,X){let oe,ke,ze,D;return Array.isArray(_e)?Q(_e):"tokenize"in _e?Q([_e]):F(_e);function F(Te){return We;function We(Ct){const Xe=Ct!==null&&Te[Ct],zt=Ct!==null&&Te.null,Lt=[...Array.isArray(Xe)?Xe:Xe?[Xe]:[],...Array.isArray(zt)?zt:zt?[zt]:[]];return Q(Lt)(Ct)}}function Q(Te){return oe=Te,ke=0,Te.length===0?X:V(Te[ke])}function V(Te){return We;function We(Ct){return D=ie(),ze=Te,Te.partial||(h.currentConstruct=Te),Te.name&&h.parser.constructs.disable.null.includes(Te.name)?Oe():Te.tokenize.call(fe?Object.assign(Object.create(h),fe):h,c,xe,Oe)(Ct)}}function xe(Te){return pe(ze,D),Re}function Oe(Te){return D.restore(),++ke<oe.length?V(oe[ke]):X}}}function q(pe,fe){pe.resolveAll&&!s.includes(pe)&&s.push(pe),pe.resolve&&Er(h.events,fe,h.events.length-fe,pe.resolve(h.events.slice(fe),h)),pe.resolveTo&&(h.events=pe.resolveTo(h.events,h))}function ie(){const pe=v(),fe=h.previous,Se=h.currentConstruct,_e=h.events.length,Re=Array.from(u);return{from:_e,restore:X};function X(){r=pe,h.previous=fe,h.currentConstruct=Se,h.events.length=_e,u=Re,K()}}function K(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function WL(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 XL(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
+ `;break}case-3:{o=`\r
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 QL(t){const r={constructs:eS([GL,...(t||{}).extensions||[]]),content:i(pz),defined:[],document:i(mz),flow:i(IL),lazy:{},string:i(LL),text:i(BL)};return r;function i(s){return o;function o(u){return YL(r,s,u)}}}function ZL(t){for(;!OT(t););return t}const nE=/[\0\t\n\r]/g;function e5(){let t=1,e="",n=!0,r;return i;function i(s,o,u){const c=[];let h,m,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(nE.lastIndex=g,h=nE.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(m=Math.ceil(t/4)*4,c.push(-2);t++<m;)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 t5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function LT(t){return t.replace(t5,n5)}function n5(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return NT(n.slice(s?2:1),s?16:10)}return uh(n)||t}function As(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?rE(t.position):"start"in t||"end"in t?rE(t):"line"in t||"column"in t?Nx(t):""}function Nx(t){return iE(t&&t.line)+":"+iE(t&&t.column)}function rE(t){return Nx(t&&t.start)+"-"+Nx(t&&t.end)}function iE(t){return t&&typeof t=="number"?t:1}const BT={}.hasOwnProperty;function r5(t,e,n){return typeof e!="string"&&(n=e,e=void 0),i5(n)(ZL(QL(n).document().write(e5()(t,e,!0))))}function i5(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ci),autolinkProtocol:ie,autolinkEmail:ie,atxHeading:s(dr),blockQuote:s(zt),characterEscape:ie,characterReference:ie,codeFenced:s(Lt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Lt,o),codeText:s(Ti,o),codeTextData:ie,data:ie,codeFlowValue:ie,definition:s(ui),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Wn),hardBreakEscape:s(Or),hardBreakTrailing:s(Or),htmlFlow:s(Xn,o),htmlFlowData:ie,htmlText:s(Xn,o),htmlTextData:ie,image:s(mr),label:o,link:s(ci),listItem:s(Rr),listItemValue:y,listOrdered:s(On,g),listUnordered:s(On),paragraph:s(Mi),reference:V,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(dr),strong:s(Dr),thematicBreak:s(Qi)},exit:{atxHeading:c(),atxHeadingSequence:L,autolink:c(),autolinkEmail:Xe,autolinkProtocol:Ct,blockQuote:c(),characterEscapeValue:K,characterReferenceMarkerHexadecimal:Oe,characterReferenceMarkerNumeric:Oe,characterReferenceValue:Te,characterReference:We,codeFenced:c(T),codeFencedFence:N,codeFencedFenceInfo:b,codeFencedFenceMeta:v,codeFlowValue:K,codeIndented:c(M),codeText:c(Re),codeTextData:K,data:K,definition:c(),definitionDestinationString:J,definitionLabelString:j,definitionTitleString:P,emphasis:c(),hardBreakEscape:c(fe),hardBreakTrailing:c(fe),htmlFlow:c(Se),htmlFlowData:K,htmlText:c(_e),htmlTextData:K,image:c(oe),label:ze,labelText:ke,lineEnding:pe,link:c(X),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:xe,resourceDestinationString:D,resourceTitleString:F,resource:Q,setextHeading:c(q),setextHeadingLineSequence:z,setextHeadingText:C,strong:c(),thematicBreak:c()}};VT(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(ae){let de={type:"root",children:[]};const _={stack:[de],tokenStack:[],config:e,enter:u,exit:h,buffer:o,resume:m,data:n},De=[];let Pe=-1;for(;++Pe<ae.length;)if(ae[Pe][1].type==="listOrdered"||ae[Pe][1].type==="listUnordered")if(ae[Pe][0]==="enter")De.push(Pe);else{const tn=De.pop();Pe=i(ae,tn,Pe)}for(Pe=-1;++Pe<ae.length;){const tn=e[ae[Pe][0]];BT.call(tn,ae[Pe][1].type)&&tn[ae[Pe][1].type].call(Object.assign({sliceSerialize:ae[Pe][2].sliceSerialize},_),ae[Pe][1])}if(_.tokenStack.length>0){const tn=_.tokenStack[_.tokenStack.length-1];(tn[1]||sE).call(_,void 0,tn[0])}for(de.position={start:va(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:va(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<e.transforms.length;)de=e.transforms[Pe](de)||de;return de}function i(ae,de,_){let De=de-1,Pe=-1,tn=!1,Qn,be,_t,gn;for(;++De<=_;){const St=ae[De];switch(St[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{St[0]==="enter"?Pe++:Pe--,gn=void 0;break}case"lineEndingBlank":{St[0]==="enter"&&(Qn&&!gn&&!Pe&&!_t&&(_t=De),gn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gn=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(Qn){let Zn=De;for(be=void 0;Zn--;){const Rn=ae[Zn];if(Rn[1].type==="lineEnding"||Rn[1].type==="lineEndingBlank"){if(Rn[0]==="exit")continue;be&&(ae[be][1].type="lineEndingBlank",tn=!0),Rn[1].type="lineEnding",be=Zn}else if(!(Rn[1].type==="linePrefix"||Rn[1].type==="blockQuotePrefix"||Rn[1].type==="blockQuotePrefixWhitespace"||Rn[1].type==="blockQuoteMarker"||Rn[1].type==="listItemIndent"))break}_t&&(!be||_t<be)&&(Qn._spread=!0),Qn.end=Object.assign({},be?ae[be][1].start:St[1].end),ae.splice(be||De,0,["exit",Qn,St[2]]),De++,_++}if(St[1].type==="listItemPrefix"){const Zn={type:"listItem",_spread:!1,start:Object.assign({},St[1].start),end:void 0};Qn=Zn,ae.splice(De,0,["enter",Zn,St[2]]),De++,_++,_t=void 0,gn=!0}}}return ae[de][1]._spread=tn,_}function s(ae,de){return _;function _(De){u.call(this,ae(De),De),de&&de.call(this,De)}}function o(){this.stack.push({type:"fragment",children:[]})}function u(ae,de,_){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([de,_||void 0]),ae.position={start:va(de.start),end:void 0}}function c(ae){return de;function de(_){ae&&ae.call(this,_),h.call(this,_)}}function h(ae,de){const _=this.stack.pop(),De=this.tokenStack.pop();if(De)De[0].type!==ae.type&&(de?de.call(this,ae,De[0]):(De[1]||sE).call(this,ae,De[0]));else throw new Error("Cannot close `"+ae.type+"` ("+As({start:ae.start,end:ae.end})+"): it’s not open");_.position.end=va(ae.end)}function m(){return Zb(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(ae){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.lang=ae}function v(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.meta=ae}function N(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae.replace(/(\r?\n|\r)$/g,"")}function j(ae){const de=this.resume(),_=this.stack[this.stack.length-1];_.label=de,_.identifier=Ci(this.sliceSerialize(ae)).toLowerCase()}function P(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.title=ae}function J(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.url=ae}function L(ae){const de=this.stack[this.stack.length-1];if(!de.depth){const _=this.sliceSerialize(ae).length;de.depth=_}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function z(ae){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function ie(ae){const _=this.stack[this.stack.length-1].children;let De=_[_.length-1];(!De||De.type!=="text")&&(De=$e(),De.position={start:va(ae.start),end:void 0},_.push(De)),this.stack.push(De)}function K(ae){const de=this.stack.pop();de.value+=this.sliceSerialize(ae),de.position.end=va(ae.end)}function pe(ae){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const _=de.children[de.children.length-1];_.position.end=va(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(de.type)&&(ie.call(this,ae),K.call(this,ae))}function fe(){this.data.atHardBreak=!0}function Se(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function _e(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function Re(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.value=ae}function X(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=de,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function oe(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=de,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function ke(ae){const de=this.sliceSerialize(ae),_=this.stack[this.stack.length-2];_.label=LT(de),_.identifier=Ci(de).toLowerCase()}function ze(){const ae=this.stack[this.stack.length-1],de=this.resume(),_=this.stack[this.stack.length-1];if(this.data.inReference=!0,_.type==="link"){const De=ae.children;_.children=De}else _.alt=de}function D(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.url=ae}function F(){const ae=this.resume(),de=this.stack[this.stack.length-1];de.title=ae}function Q(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function xe(ae){const de=this.resume(),_=this.stack[this.stack.length-1];_.label=de,_.identifier=Ci(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function Oe(ae){this.data.characterReferenceType=ae.type}function Te(ae){const de=this.sliceSerialize(ae),_=this.data.characterReferenceType;let De;_?(De=NT(de,_==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):De=uh(de);const Pe=this.stack[this.stack.length-1];Pe.value+=De}function We(ae){const de=this.stack.pop();de.position.end=va(ae.end)}function Ct(ae){K.call(this,ae);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(ae)}function Xe(ae){K.call(this,ae);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(ae)}function zt(){return{type:"blockquote",children:[]}}function Lt(){return{type:"code",lang:null,meta:null,value:""}}function Ti(){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 On(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function Rr(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function Mi(){return{type:"paragraph",children:[]}}function Dr(){return{type:"strong",children:[]}}function $e(){return{type:"text",value:""}}function Qi(){return{type:"thematicBreak"}}}function va(t){return{line:t.line,column:t.column,offset:t.offset}}function VT(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?VT(t,r):s5(t,r)}}function s5(t,e){let n;for(n in e)if(BT.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 sE(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+As({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+As({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+As({start:e.start,end:e.end})+") is still open")}function vm(t){const e=this;e.parser=n;function n(r){return r5(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 o5={}.hasOwnProperty;function FT(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)FT(t,e.extensions[n]);for(r in e)if(o5.call(e,r))switch(r){case"extensions":break;case"unsafe":{oE(t[r],e[r]);break}case"join":{oE(t[r],e[r]);break}case"handlers":{l5(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function oE(t,e){e&&t.push(...e)}function l5(t,e){e&&Object.assign(t,e)}function u5(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()),c5);return i(),o}function c5(t,e,n){return">"+(n?"":" ")+t}function PT(t,e){return lE(t,e.inConstruct,!0)&&!lE(t,e.notInConstruct,!1)}function lE(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 uE(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
5
+ `&&PT(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
6
+ `}function f5(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=n.indexOf(e,i);return o}function Ax(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function h5(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function p5(t,e,n,r){const i=h5(n),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(Ax(t,n)){const g=n.enter("codeIndented"),y=n.indentLines(s,d5);return g(),y}const u=n.createTracker(r),c=i.repeat(Math.max(f5(s,i)+1,3)),h=n.enter("codeFenced");let m=u.move(c);if(t.lang){const g=n.enter(`codeFencedLang${o}`);m+=u.move(n.safe(t.lang,{before:m,after:" ",encode:["`"],...u.current()})),g()}if(t.lang&&t.meta){const g=n.enter(`codeFencedMeta${o}`);m+=u.move(" "),m+=u.move(n.safe(t.meta,{before:m,after:`
7
+ `,encode:["`"],...u.current()})),g()}return m+=u.move(`
8
+ `),s&&(m+=u.move(s+`
9
+ `)),m+=u.move(c),h(),m}function d5(t,e,n){return(n?"":" ")+t}function nS(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function m5(t,e,n,r){const i=nS(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let u=n.enter("label");const c=n.createTracker(r);let h=c.move("[");return h+=c.move(n.safe(n.associationId(t),{before:h,after:"]",...c.current()})),h+=c.move("]: "),u(),!t.url||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(u=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":`
10
+ `,...c.current()}))),u(),t.title&&(u=n.enter(`title${s}`),h+=c.move(" "+i),h+=c.move(n.safe(t.title,{before:h,after:i,...c.current()})),h+=c.move(i),u()),o(),h}function g5(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function ja(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Cm(t,e,n){const r=Du(t),i=Du(e);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}jT.peek=y5;function jT(t,e,n,r){const i=g5(n),s=n.enter("emphasis"),o=n.createTracker(r),u=o.move(i);let c=o.move(n.containerPhrasing(t,{after:i,before:u,...o.current()}));const h=c.charCodeAt(0),m=Cm(r.before.charCodeAt(r.before.length-1),h,i);m.inside&&(c=ja(h)+c.slice(1));const g=c.charCodeAt(c.length-1),y=Cm(r.after.charCodeAt(0),g,i);y.inside&&(c=c.slice(0,-1)+ja(g));const b=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:m.outside},u+c+b}function y5(t,e,n){return n.options.emphasis||"*"}const bg=(function(t){if(t==null)return k5;if(typeof t=="function")return Sg(t);if(typeof t=="object")return Array.isArray(t)?x5(t):b5(t);if(typeof t=="string")return S5(t);throw new Error("Expected function, string, or object as test")});function x5(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=bg(t[n]);return Sg(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function b5(t){const e=t;return Sg(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function S5(t){return Sg(e);function e(n){return n&&n.type===t}}function Sg(t){return e;function e(n,r,i){return!!(v5(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function k5(){return!0}function v5(t){return t!==null&&typeof t=="object"&&"type"in t}const $T=[],C5=!0,Tx=!1,Mx="skip";function ju(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=bg(i),o=r?-1:1;u(t,void 0,[])();function u(c,h,m){const g=c&&typeof c=="object"?c:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(c.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=$T,v,N,T;if((!e||s(c,h,m[m.length-1]||void 0))&&(b=w5(n(c,m)),b[0]===Tx))return b;if("children"in c&&c.children){const M=c;if(M.children&&b[0]!==Mx)for(N=(r?M.children.length:-1)+o,T=m.concat(M);N>-1&&N<M.children.length;){const j=M.children[N];if(v=u(j,N,T)(),v[0]===Tx)return v;N=typeof v[1]=="number"?v[1]:N+o}}return b}}}function w5(t){return Array.isArray(t)?t:typeof t=="number"?[C5,t]:t==null?$T:[t]}function E5(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),ju(t,s,u,i);function u(c,h){const m=h[h.length-1],g=m?m.children.indexOf(c):void 0;return o(c,g,m)}}function UT(t,e){let n=!1;return E5(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Tx}),!!((!t.depth||t.depth<3)&&Zb(t)&&(e.options.setext||n))}function N5(t,e,n,r){const i=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(r);if(UT(t,n)){const m=n.enter("headingSetext"),g=n.enter("phrasing"),y=n.containerPhrasing(t,{...s.current(),before:`
11
+ `,after:`
12
+ `});return g(),m(),y+`
13
+ `+(i===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
14
+ `))+1))}const o="#".repeat(i),u=n.enter("headingAtx"),c=n.enter("phrasing");s.move(o+" ");let h=n.containerPhrasing(t,{before:"# ",after:`
15
+ `,...s.current()});return/^[\t ]/.test(h)&&(h=ja(h.charCodeAt(0))+h.slice(1)),h=h?o+" "+h:o,n.options.closeAtx&&(h+=" "+o),c(),u(),h}JT.peek=A5;function JT(t){return t.value||""}function A5(){return"<"}HT.peek=T5;function HT(t,e,n,r){const i=nS(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let u=n.enter("label");const c=n.createTracker(r);let h=c.move("![");return h+=c.move(n.safe(t.alt,{before:h,after:"]",...c.current()})),h+=c.move("]("),u(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(u=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":")",...c.current()}))),u(),t.title&&(u=n.enter(`title${s}`),h+=c.move(" "+i),h+=c.move(n.safe(t.title,{before:h,after:i,...c.current()})),h+=c.move(i),u()),h+=c.move(")"),o(),h}function T5(){return"!"}qT.peek=M5;function qT(t,e,n,r){const i=t.referenceType,s=n.enter("imageReference");let o=n.enter("label");const u=n.createTracker(r);let c=u.move("![");const h=n.safe(t.alt,{before:c,after:"]",...u.current()});c+=u.move(h+"]["),o();const m=n.stack;n.stack=[],o=n.enter("reference");const g=n.safe(n.associationId(t),{before:c,after:"]",...u.current()});return o(),n.stack=m,s(),i==="full"||!h||h!==g?c+=u.move(g+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function M5(){return"!"}KT.peek=O5;function KT(t,e,n){let r=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],u=n.compilePattern(o);let c;if(o.atBreak)for(;c=u.exec(r);){let h=c.index;r.charCodeAt(h)===10&&r.charCodeAt(h-1)===13&&h--,r=r.slice(0,h)+" "+r.slice(c.index+1)}}return i+r+i}function O5(){return"`"}function GT(t,e){const n=Zb(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}YT.peek=R5;function YT(t,e,n,r){const i=nS(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let u,c;if(GT(t,n)){const m=n.stack;n.stack=[],u=n.enter("autolink");let g=o.move("<");return g+=o.move(n.containerPhrasing(t,{before:g,after:">",...o.current()})),g+=o.move(">"),u(),n.stack=m,g}u=n.enter("link"),c=n.enter("label");let h=o.move("[");return h+=o.move(n.containerPhrasing(t,{before:h,after:"](",...o.current()})),h+=o.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=o.move("<"),h+=o.move(n.safe(t.url,{before:h,after:">",...o.current()})),h+=o.move(">")):(c=n.enter("destinationRaw"),h+=o.move(n.safe(t.url,{before:h,after:t.title?" ":")",...o.current()}))),c(),t.title&&(c=n.enter(`title${s}`),h+=o.move(" "+i),h+=o.move(n.safe(t.title,{before:h,after:i,...o.current()})),h+=o.move(i),c()),h+=o.move(")"),u(),h}function R5(t,e,n){return GT(t,n)?"<":"["}WT.peek=D5;function WT(t,e,n,r){const i=t.referenceType,s=n.enter("linkReference");let o=n.enter("label");const u=n.createTracker(r);let c=u.move("[");const h=n.containerPhrasing(t,{before:c,after:"]",...u.current()});c+=u.move(h+"]["),o();const m=n.stack;n.stack=[],o=n.enter("reference");const g=n.safe(n.associationId(t),{before:c,after:"]",...u.current()});return o(),n.stack=m,s(),i==="full"||!h||h!==g?c+=u.move(g+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function D5(){return"["}function rS(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function I5(t){const e=rS(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function _5(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function XT(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function z5(t,e,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=t.ordered?_5(n):rS(n);const u=t.ordered?o==="."?")":".":I5(n);let c=e&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!t.ordered){const m=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),XT(n)===o&&m){let g=-1;for(;++g<t.children.length;){const y=t.children[g];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=u),n.bulletCurrent=o;const h=n.containerFlow(t,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),h}function L5(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function B5(t,e,n,r){const i=L5(n);let s=n.bulletCurrent||rS(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const u=n.createTracker(r);u.move(s+" ".repeat(o-s.length)),u.shift(o);const c=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,u.current()),m);return c(),h;function m(g,y,b){return y?(b?"":" ".repeat(o))+g:(b?s:s+" ".repeat(o-s.length))+g}}function V5(t,e,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(t,r);return s(),i(),o}const F5=bg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function P5(t,e,n,r){return(t.children.some(function(o){return F5(o)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function j5(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}QT.peek=$5;function QT(t,e,n,r){const i=j5(n),s=n.enter("strong"),o=n.createTracker(r),u=o.move(i+i);let c=o.move(n.containerPhrasing(t,{after:i,before:u,...o.current()}));const h=c.charCodeAt(0),m=Cm(r.before.charCodeAt(r.before.length-1),h,i);m.inside&&(c=ja(h)+c.slice(1));const g=c.charCodeAt(c.length-1),y=Cm(r.after.charCodeAt(0),g,i);y.inside&&(c=c.slice(0,-1)+ja(g));const b=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:m.outside},u+c+b}function $5(t,e,n){return n.options.strong||"*"}function U5(t,e,n,r){return n.safe(t.value,r)}function J5(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function H5(t,e,n){const r=(XT(n)+(n.options.ruleSpaces?" ":"")).repeat(J5(n));return n.options.ruleSpaces?r.slice(0,-1):r}const iS={blockquote:u5,break:uE,code:p5,definition:m5,emphasis:jT,hardBreak:uE,heading:N5,html:JT,image:HT,imageReference:qT,inlineCode:KT,link:YT,linkReference:WT,list:z5,listItem:B5,paragraph:V5,root:P5,strong:QT,text:U5,thematicBreak:H5},q5=[K5];function K5(t,e,n,r){if(e.type==="code"&&Ax(e,r)&&(t.type==="list"||t.type===e.type&&Ax(t,r)))return!1;if("spread"in n&&typeof n.spread=="boolean")return t.type==="paragraph"&&(t.type===e.type||e.type==="definition"||e.type==="heading"&&UT(e,r))?void 0:n.spread?1:0}const vo=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],G5=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
16
+ `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:vo},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
17
+ ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:vo},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
18
+ *])`},{character:"*",inConstruct:"phrasing",notInConstruct:vo},{atBreak:!0,character:"+",after:`(?:[ \r
19
+ ])`},{atBreak:!0,character:"-",after:`(?:[ \r
20
+ -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
21
+ ]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:vo},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:vo},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:vo},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:vo},{atBreak:!0,character:"~"}];function Y5(t){return t.label||!t.identifier?t.label||"":LT(t.identifier)}function W5(t){if(!t._compiled){const e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}function X5(t,e,n){const r=e.indexStack,i=t.children||[],s=[];let o=-1,u=n.before,c;r.push(-1);let h=e.createTracker(n);for(;++o<i.length;){const m=i[o];let g;if(r[r.length-1]=o,o+1<i.length){let v=e.handle.handlers[i[o+1].type];v&&v.peek&&(v=v.peek),g=v?v(i[o+1],t,e,{before:"",after:"",...h.current()}).charAt(0):""}else g=n.after;s.length>0&&(u==="\r"||u===`
22
+ `)&&m.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),u=" ",h=e.createTracker(n),h.move(s.join("")));let y=e.handle(m,t,e,{...h.current(),after:g,before:u});c&&c===y.slice(0,1)&&(y=ja(c.charCodeAt(0))+y.slice(1));const b=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,c=void 0,b&&(s.length>0&&b.before&&u===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+ja(u.charCodeAt(0))),b.after&&(c=g)),h.move(y),s.push(y),u=y.slice(-1)}return r.pop(),s.join("")}function Q5(t,e,n){const r=e.indexStack,i=t.children||[],s=e.createTracker(n),o=[];let u=-1;for(r.push(-1);++u<i.length;){const c=i[u];r[r.length-1]=u,o.push(s.move(e.handle(c,t,e,{before:`
23
+ `,after:`
24
+ `,...s.current()}))),c.type!=="list"&&(e.bulletLastUsed=void 0),u<i.length-1&&o.push(s.move(Z5(c,i[u+1],t,e)))}return r.pop(),o.join("")}function Z5(t,e,n,r){let i=r.join.length;for(;i--;){const s=r.join[i](t,e,n,r);if(s===!0||s===1)break;if(typeof s=="number")return`
25
+ `.repeat(1+s);if(s===!1)return`
26
+
27
+ <!---->
28
+
29
+ `}return`
30
+
31
+ `}const e9=/\r?\n|\r/g;function t9(t,e){const n=[];let r=0,i=0,s;for(;s=e9.exec(t);)o(t.slice(r,s.index)),n.push(s[0]),r=s.index+s[0].length,i++;return o(t.slice(r)),n.join("");function o(u){n.push(e(u,i,!u))}}function n9(t,e,n){const r=(n.before||"")+(e||"")+(n.after||""),i=[],s=[],o={};let u=-1;for(;++u<t.unsafe.length;){const m=t.unsafe[u];if(!PT(t.stack,m))continue;const g=t.compilePattern(m);let y;for(;y=g.exec(r);){const b="before"in m||!!m.atBreak,v="after"in m,N=y.index+(b?y[1].length:0);i.includes(N)?(o[N].before&&!b&&(o[N].before=!1),o[N].after&&!v&&(o[N].after=!1)):(i.push(N),o[N]={before:b,after:v})}}i.sort(r9);let c=n.before?n.before.length:0;const h=r.length-(n.after?n.after.length:0);for(u=-1;++u<i.length;){const m=i[u];m<c||m>=h||m+1<h&&i[u+1]===m+1&&o[m].after&&!o[m+1].before&&!o[m+1].after||i[u-1]===m-1&&o[m].before&&!o[m-1].before&&!o[m-1].after||(c!==m&&s.push(cE(r.slice(c,m),"\\")),c=m,/[!-/:-@[-`{-~]/.test(r.charAt(m))&&(!n.encode||!n.encode.includes(r.charAt(m)))?s.push("\\"):(s.push(ja(r.charCodeAt(m))),c++))}return s.push(cE(r.slice(c,h),n.after)),s.join("")}function r9(t,e){return t-e}function cE(t,e){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],s=t+e;let o=-1,u=0,c;for(;c=n.exec(s);)r.push(c.index);for(;++o<r.length;)u!==r[o]&&i.push(t.slice(u,r[o])),i.push("\\"),u=r[o];return i.push(t.slice(u)),i.join("")}function i9(t){const e=t||{},n=e.now||{};let r=e.lineShift||0,i=n.line||1,s=n.column||1;return{move:c,current:o,shift:u};function o(){return{now:{line:i,column:s},lineShift:r}}function u(h){r+=h}function c(h){const m=h||"",g=m.split(/\r?\n|\r/g),y=g[g.length-1];return i+=g.length-1,s=g.length===1?s+y.length:1+y.length+r,m}}function s9(t,e){const n=e||{},r={associationId:Y5,containerPhrasing:u9,containerFlow:c9,createTracker:i9,compilePattern:W5,enter:s,handlers:{...iS},handle:void 0,indentLines:t9,indexStack:[],join:[...q5],options:{},safe:f9,stack:[],unsafe:[...G5]};FT(r,n),r.options.tightDefinitions&&r.join.push(l9),r.handle=a5("type",{invalid:a9,unknown:o9,handlers:r.handlers});let i=r.handle(t,void 0,r,{before:`
32
+ `,after:`
33
+ `,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
34
+ `),i;function s(o){return r.stack.push(o),u;function u(){r.stack.pop()}}}function a9(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function o9(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function l9(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function u9(t,e){return X5(t,this,e)}function c9(t,e){return Q5(t,this,e)}function f9(t,e){return n9(this,t,e)}function Ox(t){const e=this;e.compiler=n;function n(r){return s9(r,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}function fE(t){if(t)throw t}var i1,hE;function h9(){if(hE)return i1;hE=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},s=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var m=t.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!g)return!1;var y;for(y in h);return typeof y>"u"||t.call(h,y)},o=function(h,m){n&&m.name==="__proto__"?n(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},u=function(h,m){if(m==="__proto__")if(t.call(h,m)){if(r)return r(h,m).value}else return;return h[m]};return i1=function c(){var h,m,g,y,b,v,N=arguments[0],T=1,M=arguments.length,j=!1;for(typeof N=="boolean"&&(j=N,N=arguments[1]||{},T=2),(N==null||typeof N!="object"&&typeof N!="function")&&(N={});T<M;++T)if(h=arguments[T],h!=null)for(m in h)g=u(N,m),y=u(h,m),N!==y&&(j&&y&&(s(y)||(b=i(y)))?(b?(b=!1,v=g&&i(g)?g:[]):v=g&&s(g)?g:{},o(N,{name:m,newValue:c(j,v,y)})):typeof y<"u"&&o(N,{name:m,newValue:y}));return N},i1}var p9=h9();const s1=xT(p9);function Rx(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function d9(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);u(null,...i);function u(c,...h){const m=t[++s];let g=-1;if(c){o(c);return}for(;++g<i.length;)(h[g]===null||h[g]===void 0)&&(h[g]=i[g]);i=h,m?m9(m,u)(...h):o(null,...h)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function m9(t,e){let n;return r;function r(...o){const u=t.length>o.length;let c;u&&o.push(i);try{c=t.apply(this,o)}catch(h){const m=h;if(u&&n)throw m;return i(m)}u||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(o,...u){n||(n=!0,e(o,...u))}function s(o){i(null,o)}}class mt extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const u=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=As(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}mt.prototype.file="";mt.prototype.name="";mt.prototype.reason="";mt.prototype.message="";mt.prototype.stack="";mt.prototype.column=void 0;mt.prototype.line=void 0;mt.prototype.ancestors=void 0;mt.prototype.cause=void 0;mt.prototype.fatal=void 0;mt.prototype.place=void 0;mt.prototype.ruleId=void 0;mt.prototype.source=void 0;const zi={basename:g9,dirname:y9,extname:x9,join:b9,sep:"/"};function g9(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Uh(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,u=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),u>-1&&(t.codePointAt(i)===e.codePointAt(u--)?u<0&&(r=i):(u=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function y9(t){if(Uh(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function x9(t){Uh(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const u=t.codePointAt(e);if(u===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),u===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function b9(...t){let e=-1,n;for(;++e<t.length;)Uh(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":S9(n)}function S9(t){Uh(t);const e=t.codePointAt(0)===47;let n=k9(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function k9(t,e){let n="",r=0,i=-1,s=0,o=-1,u,c;for(;++o<=t.length;){if(o<t.length)u=t.codePointAt(o);else{if(u===47)break;u=47}if(u===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else u===46&&s>-1?s++:s=-1}return n}function Uh(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const v9={cwd:C9};function C9(){return"/"}function Dx(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function w9(t){if(typeof t=="string")t=new URL(t);else if(!Dx(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return E9(t)}function E9(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const a1=["history","path","basename","stem","extname","dirname"];class N9{constructor(e){let n;e?Dx(e)?n={path:e}:typeof e=="string"||A9(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":v9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<a1.length;){const s=a1[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)a1.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?zi.basename(this.path):void 0}set basename(e){l1(e,"basename"),o1(e,"basename"),this.path=zi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?zi.dirname(this.path):void 0}set dirname(e){pE(this.basename,"dirname"),this.path=zi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?zi.extname(this.path):void 0}set extname(e){if(o1(e,"extname"),pE(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=zi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Dx(e)&&(e=w9(e)),l1(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?zi.basename(this.path,this.extname):void 0}set stem(e){l1(e,"stem"),o1(e,"stem"),this.path=zi.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new mt(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function o1(t,e){if(t&&t.includes(zi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+zi.sep+"`")}function l1(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function pE(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function A9(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const T9=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),M9={}.hasOwnProperty;class sS extends T9{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=d9()}copy(){const e=new sS;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(s1(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(f1("data",this.frozen),this.namespace[e]=n,this):M9.call(this.namespace,e)&&this.namespace[e]||void 0:e?(f1("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Od(e),r=this.parser||this.Parser;return u1("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),u1("process",this.parser||this.Parser),c1("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const u=Od(e),c=r.parse(u);r.run(c,u,function(m,g,y){if(m||!g||!y)return h(m);const b=g,v=r.stringify(b,y);R9(v)?y.value=v:y.result=v,h(m,y)});function h(m,g){m||!g?o(m):s?s(g):n(void 0,g)}}}processSync(e){let n=!1,r;return this.freeze(),u1("processSync",this.parser||this.Parser),c1("processSync",this.compiler||this.Compiler),this.process(e,i),mE("processSync","process",n),r;function i(s,o){n=!0,fE(s),r=o}}run(e,n,r){dE(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,u){const c=Od(n);i.run(e,c,h);function h(m,g,y){const b=g||e;m?u(m):o?o(b):r(void 0,b,y)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),mE("runSync","run",r),i;function s(o,u){fE(o),i=u,r=!0}}stringify(e,n){this.freeze();const r=Od(n),i=this.compiler||this.Compiler;return c1("stringify",i),dE(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(f1("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?u(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(h){if(typeof h=="function")c(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[m,...g]=h;c(m,g)}else o(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function o(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(h.plugins),h.settings&&(i.settings=s1(!0,i.settings,h.settings))}function u(h){let m=-1;if(h!=null)if(Array.isArray(h))for(;++m<h.length;){const g=h[m];s(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function c(h,m){let g=-1,y=-1;for(;++g<r.length;)if(r[g][0]===h){y=g;break}if(y===-1)r.push([h,...m]);else if(m.length>0){let[b,...v]=m;const N=r[y][1];Rx(N)&&Rx(b)&&(b=s1(!0,N,b)),r[y]=[h,b,...v]}}}}const wm=new sS().freeze();function u1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function c1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function f1(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function dE(t){if(!Rx(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function mE(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Od(t){return O9(t)?t:new N9(t)}function O9(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function R9(t){return typeof t=="string"||D9(t)}function D9(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function hn(t){this.content=t}hn.prototype={constructor:hn,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new hn(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new hn(n)},addToStart:function(t,e){return new hn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new hn(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new hn(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=hn.from(t),t.size?new hn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=hn.from(t),t.size?new hn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=hn.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};hn.from=function(t){if(t instanceof hn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new hn(e)};function ZT(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=ZT(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function eM(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),u=e.child(--s),c=o.nodeSize;if(o==u){n-=c,r-=c;continue}if(!o.sameMarkup(u))return{a:n,b:r};if(o.isText&&o.text!=u.text){let h=0,m=Math.min(o.text.length,u.text.length);for(;h<m&&o.text[o.text.length-h-1]==u.text[u.text.length-h-1];)h++,n--,r--;return{a:n,b:r}}if(o.content.size||u.content.size){let h=eM(o.content,u.content,n-1,r-1);if(h)return h}n-=c,r-=c}}class G{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,u=0;u<n;o++){let c=this.content[o],h=u+c.nodeSize;if(h>e&&r(c,i+u,s||null,o)!==!1&&c.content.size){let m=u+1;c.nodesBetween(Math.max(0,e-m),Math.min(c.content.size,n-m),r,i+m)}u=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(u,c)=>{let h=u.isText?u.text.slice(Math.max(e,c)-c,n-c):u.isLeaf?i?typeof i=="function"?i(u):i:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&h||u.isTextblock)&&r&&(o?o=!1:s+=r),s+=h},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new G(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let u=this.content[s],c=o+u.nodeSize;c>e&&((o<e||c>n)&&(u.isText?u=u.cut(Math.max(0,e-o),Math.min(u.text.length,n-o)):u=u.cut(Math.max(0,e-o-1),Math.min(u.content.size,n-o-1))),r.push(u),i+=u.nodeSize),o=c}return new G(r,i)}cutByIndex(e,n){return e==n?G.empty:e==0&&n==this.content.length?this:new G(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new G(i,s)}addToStart(e){return new G([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new G(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return ZT(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return eM(this,e,n,r)}findIndex(e){if(e==0)return Rd(0,e);if(e==this.size)return Rd(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Rd(n+1,s):Rd(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return G.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new G(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return G.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new G(n||e,r)}static from(e){if(!e)return G.empty;if(e instanceof G)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new G([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}G.empty=new G([],0);const h1={index:0,offset:0};function Rd(t,e){return h1.index=t,h1.offset=e,h1}function Em(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Em(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Em(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class ut{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Em(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ut.none;if(e instanceof ut)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}}ut.none=[];class wi extends Error{}class H{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=nM(this.content,e+this.openStart,n);return r&&new H(r,this.openStart,this.openEnd)}removeBetween(e,n){return new H(tM(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return H.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new H(G.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new H(e,r,i)}}H.empty=new H(G.empty,0,0);function tM(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:u}=t.findIndex(n);if(i==e||s.isText){if(u!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(tM(s.content,e-i-1,n-i-1)))}function nM(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=nM(o.content,e-s-1,n,o);return u&&t.replaceChild(i,o.copy(u))}function I9(t,e,n){if(n.openStart>t.depth)throw new wi("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new wi("Inconsistent open depths");return rM(t,e,n,0)}function rM(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=rM(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,u=o.content;return Po(o,u.cut(0,t.parentOffset).append(n.content).append(u.cut(e.parentOffset)))}else{let{start:o,end:u}=_9(n,t);return Po(s,sM(t,o,u,e,r))}else return Po(s,Nm(t,e,r))}function iM(t,e){if(!e.type.compatibleContent(t.type))throw new wi("Cannot join "+e.type.name+" onto "+t.type.name)}function Ix(t,e,n){let r=t.node(n);return iM(r,e.node(n)),r}function Fo(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Pf(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Fo(t.nodeAfter,r),s++));for(let u=s;u<o;u++)Fo(i.child(u),r);e&&e.depth==n&&e.textOffset&&Fo(e.nodeBefore,r)}function Po(t,e){return t.type.checkContent(e),t.copy(e)}function sM(t,e,n,r,i){let s=t.depth>i&&Ix(t,e,i+1),o=r.depth>i&&Ix(n,r,i+1),u=[];return Pf(null,t,i,u),s&&o&&e.index(i)==n.index(i)?(iM(s,o),Fo(Po(s,sM(t,e,n,r,i+1)),u)):(s&&Fo(Po(s,Nm(t,e,i+1)),u),Pf(e,n,i,u),o&&Fo(Po(o,Nm(n,r,i+1)),u)),Pf(r,null,i,u),new G(u)}function Nm(t,e,n){let r=[];if(Pf(null,t,n,r),t.depth>n){let i=Ix(t,e,n+1);Fo(Po(i,Nm(t,e,n+1)),r)}return Pf(e,null,n,r),new G(r)}function _9(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(G.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class ch{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ut.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let u=r;r=i,i=u}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new aM(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:u,offset:c}=o.content.findIndex(s),h=s-c;if(r.push(o,u,i+c),!h||(o=o.child(u),o.isText))break;s=h-1,i+=c+1}return new ch(n,r,s)}static resolveCached(e,n){let r=gE.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else gE.set(e,r=new z9);let i=r.elts[r.i]=ch.resolve(e,n);return r.i=(r.i+1)%L9,i}}class z9{constructor(){this.elts=[],this.i=0}}const L9=12,gE=new WeakMap;class aM{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const B9=Object.create(null);let Ms=class _x{constructor(e,n,r,i=ut.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||G.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Em(this.attrs,n||e.defaultAttrs||B9)&&ut.sameSet(this.marks,r||ut.none)}copy(e=null){return e==this.content?this:new _x(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new _x(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return H.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),u=i.start(o),h=i.node(o).content.cut(i.pos-u,s.pos-u);return new H(h,i.depth-o,s.depth-o)}replace(e,n,r){return I9(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return ch.resolveCached(this,e)}resolveNoCache(e){return ch.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),oM(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=G.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),u=o&&o.matchFragment(this.content,n);if(!u||!u.validEnd)return!1;for(let c=i;c<s;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ut.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ut.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=G.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Ms.prototype.text=void 0;class Am extends Ms{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):oM(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Am(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Am(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function oM(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Zo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new V9(e,n);if(r.next==null)return Zo.empty;let i=lM(r);r.next&&r.err("Unexpected trailing text");let s=H9(J9(i));return q9(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,u){let c=o.matchFragment(e,r);if(c&&(!n||c.validEnd))return G.from(u.map(h=>h.createAndFill()));for(let h=0;h<o.next.length;h++){let{type:m,next:g}=o.next[h];if(!(m.isText||m.hasRequiredAttrs())&&i.indexOf(g)==-1){i.push(g);let y=s(g,u.concat(m));if(y)return y}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let u=i;u.type;u=u.via)o.push(u.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:u,next:c}=s.next[o];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in n)&&(!i.type||c.validEnd)&&(r.push({match:u.contentMatch,type:u,via:i}),n[u.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
35
+ `)}}Zo.empty=new Zo(!0);class V9{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function lM(t){let e=[];do e.push(F9(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function F9(t){let e=[];do e.push(P9(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function P9(t){let e=U9(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=j9(t,e);else break;return e}function yE(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function j9(t,e){let n=yE(t),r=n;return t.eat(",")&&(t.next!="}"?r=yE(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function $9(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function U9(t){if(t.eat("(")){let e=lM(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=$9(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function J9(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,u,c){let h={term:c,to:u};return e[o].push(h),h}function i(o,u){o.forEach(c=>c.to=u)}function s(o,u){if(o.type=="choice")return o.exprs.reduce((c,h)=>c.concat(s(h,u)),[]);if(o.type=="seq")for(let c=0;;c++){let h=s(o.exprs[c],u);if(c==o.exprs.length-1)return h;i(h,u=n())}else if(o.type=="star"){let c=n();return r(u,c),i(s(o.expr,c),c),[r(c)]}else if(o.type=="plus"){let c=n();return i(s(o.expr,u),c),i(s(o.expr,c),c),[r(c)]}else{if(o.type=="opt")return[r(u)].concat(s(o.expr,u));if(o.type=="range"){let c=u;for(let h=0;h<o.min;h++){let m=n();i(s(o.expr,c),m),c=m}if(o.max==-1)i(s(o.expr,c),c);else for(let h=o.min;h<o.max;h++){let m=n();r(c,m),i(s(o.expr,c),m),c=m}return[r(c)]}else{if(o.type=="name")return[r(u,void 0,o.value)];throw new Error("Unknown expr type")}}}}function uM(t,e){return e-t}function xE(t,e){let n=[];return r(e),n.sort(uM);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:u,to:c}=s[o];!u&&n.indexOf(c)==-1&&r(c)}}}function H9(t){let e=Object.create(null);return n(xE(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:u,to:c})=>{if(!u)return;let h;for(let m=0;m<i.length;m++)i[m][0]==u&&(h=i[m][1]);xE(t,c).forEach(m=>{h||i.push([u,h=[]]),h.indexOf(m)==-1&&h.push(m)})})});let s=e[r.join(",")]=new Zo(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let u=i[o][1].sort(uM);s.next.push({type:i[o][0],next:e[u.join(",")]||n(u)})}return s}}function q9(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let u=0;u<i.next.length;u++){let{type:c,next:h}=i.next[u];o.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(h)==-1&&r.push(h)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function cM(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function fM(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function hM(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function pM(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new G9(t,r,e[r]);return n}let Tm=class dM{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=pM(e,r.attrs),this.defaultAttrs=cM(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Zo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:fM(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ms(this,this.computeAttrs(e),G.from(n),ut.setFrom(r))}createChecked(e=null,n,r){return n=G.from(n),this.checkContent(n),new Ms(this,this.computeAttrs(e),n,ut.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=G.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(G.empty,!0);return s?new Ms(this,e,n.append(s),ut.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){hM(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ut.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new dM(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function K9(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class G9{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?K9(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Jh{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=pM(e,i.attrs),this.excluded=null;let s=cM(this.attrs);this.instance=s?new ut(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ut(this,fM(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Jh(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){hM(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Y9{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=hn.from(e.nodes),n.marks=hn.from(e.marks||{}),this.nodes=Tm.compile(this.spec.nodes,this),this.marks=Jh.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",u=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Zo.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=u=="_"?null:u?bE(this,u.split(" ")):u==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:bE(this,o.split(" "))}this.nodeFromJSON=i=>Ms.fromJSON(this,i),this.markFromJSON=i=>ut.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Tm){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Am(r,r.defaultAttrs,e,ut.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function bE(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let u in t.marks){let c=t.marks[u];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function W9(t){return t.tag!=null}function X9(t){return t.style!=null}class $a{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(W9(i))this.tags.push(i);else if(X9(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new kE(this,n,!1);return r.addAll(e,ut.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new kE(this,n,!0);return r.addAll(e,ut.none,n.from,n.to),H.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(eB(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],u=o.style;if(!(u.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||u.length>e.length&&(u.charCodeAt(e.length)!=61||u.slice(e.length+1)!=n))){if(o.getAttrs){let c=o.getAttrs(n);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let u=n[o];if((u.priority==null?50:u.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=vE(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=vE(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new $a(e,$a.schemaRules(e)))}}const mM={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Q9={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},gM={ol:!0,ul:!0},fh=1,zx=2,jf=4;function SE(t,e,n){return e!=null?(e?fh:0)|(e==="full"?zx:0):t&&t.whitespace=="pre"?fh|zx:n&~jf}class Dd{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=ut.none,this.match=s||(o&jf?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(G.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&fh)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=G.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(G.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!mM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class kE{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=SE(null,n.preserveWhitespace,0)|(r?jf:0);i?s=new Dd(i.type,i.attrs,ut.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Dd(null,null,ut.none,!0,null,o):s=new Dd(e.schema.topNodeType,null,ut.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&zx?"full":this.localPreserveWS||(i.options&fh)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
36
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let u=r.split(/\r?\n|\r/);for(let c=0;c<u.length;c++)c&&this.insertNode(o.linebreakReplacement.create(),n,!0),u[c]&&this.insertNode(o.text(u[c]),n,!/\S/.test(u[c]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let u=i.content[i.content.length-1],c=e.previousSibling;(!u||c&&c.nodeName=="BR"||u.isText&&/[ \t\r\n\u000c]$/.test(u.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),u;gM.hasOwnProperty(o)&&this.parser.normalizeLists&&Z9(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,r));e:if(c?c.ignore:Q9.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let h,m=this.needsBlock;if(mM.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),h=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let g=c&&c.skip?n:this.readStyles(e,n);g&&this.addAll(e,g),h&&this.sync(s),this.needsBlock=m}else{let h=this.readStyles(e,n);h&&this.addElementByRule(e,c,h,c.consuming===!1?u:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
37
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let u=void 0;;){let c=this.parser.matchStyle(s,o,this,u);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(h=>!c.clearMark(h)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)u=c;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(o,n.attrs||null,r,n.preserveWhitespace);c&&(s=!0,r=c)}else{let c=this.parser.schema.marks[n.mark];r=r.concat(c.create(n.attrs))}let u=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}s&&this.sync(u)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,u=i==null?null:e.childNodes[i];o!=u;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,u=0;o>=0;o--){let c=this.nodes[o],h=c.findWrapping(e);if(h&&(!i||i.length>h.length+u)&&(i=h,s=c,!h.length))break;if(c.solid){if(r)break;u+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=ut.none;for(let u of i.concat(e.marks))(s.type?s.type.allowsMarkType(u.type):CE(u.type,e.type))&&(o=u.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let u=SE(e,s,o.options);o.options&jf&&o.content.length==0&&(u|=jf);let c=ut.none;return r=r.filter(h=>(o.type?o.type.allowsMarkType(h.type):CE(h.type,e))?(c=h.addToSet(c),!1):!0),this.nodes.push(new Dd(e,n,c,i,null,u)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=fh)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(u,c)=>{for(;u>=0;u--){let h=n[u];if(h==""){if(u==n.length-1||u==0)continue;for(;c>=s;c--)if(o(u-1,c))return!0;return!1}else{let m=c>0||c==0&&i?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!m||m.name!=h&&!m.isInGroup(h))return!1;c--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function Z9(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&gM.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function eB(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function vE(t){let e={};for(let n in t)e[n]=t[n];return e}function CE(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=u=>{s.push(u);for(let c=0;c<u.edgeCount;c++){let{type:h,next:m}=u.edge(c);if(h==e||s.indexOf(m)<0&&o(m))return!0}};if(o(i.contentMatch))return!0}}class Gi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=p1(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let u=0,c=0;for(;u<s.length&&c<o.marks.length;){let h=o.marks[c];if(!this.marks[h.type.name]){c++;continue}if(!h.eq(s[u][0])||h.type.spec.spanning===!1)break;u++,c++}for(;u<s.length;)i=s.pop()[1];for(;c<o.marks.length;){let h=o.marks[c++],m=this.serializeMark(h,o.isInline,n);m&&(s.push([h,i]),i.appendChild(m.dom),i=m.contentDOM||m.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Fd(p1(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Fd(p1(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Fd(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Gi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=wE(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return wE(e.marks)}}function wE(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function p1(t){return t.document||window.document}const EE=new WeakMap;function tB(t){let e=EE.get(t);return e===void 0&&EE.set(t,e=nB(t)),e}function nB(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Fd(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=tB(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let u,c=n?t.createElementNS(n,i):t.createElement(i),h=e[1],m=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){m=2;for(let g in h)if(h[g]!=null){let y=g.indexOf(" ");y>0?c.setAttributeNS(g.slice(0,y),g.slice(y+1),h[g]):g=="style"&&c.style?c.style.cssText=h[g]:c.setAttribute(g,h[g])}}for(let g=m;g<e.length;g++){let y=e[g];if(y===0){if(g<e.length-1||g>m)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:b,contentDOM:v}=Fd(t,y,n,r);if(c.appendChild(b),v){if(u)throw new RangeError("Multiple content holes");u=v}}}return{dom:c,contentDOM:u}}const yM=65535,xM=Math.pow(2,16);function rB(t,e){return t+e*xM}function NE(t){return t&yM}function iB(t){return(t-(t&yM))/xM}const bM=1,SM=2,Pd=4,kM=8;let AE=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&kM)>0}get deletedBefore(){return(this.delInfo&(bM|Pd))>0}get deletedAfter(){return(this.delInfo&(SM|Pd))>0}get deletedAcross(){return(this.delInfo&Pd)>0}},el=class uu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&uu.empty)return uu.empty}recover(e){let n=0,r=NE(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+iB(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:m);if(r)return b;let v=e==(n<0?c:g)?null:rB(u/3,e-c),N=e==c?SM:e==g?bM:Pd;return(n<0?e!=c:e!=g)&&(N|=kM),new AE(b,N,v)}i+=m-h}return r?e+i:new AE(e+i,0,null)}touches(e,n){let r=0,i=NE(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],m=this.ranges[i+r];e(u,u+h,c,c+m),s+=m-h}}invert(){return new uu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?uu.empty:new uu(e<0?[0,-e,0]:[0,0,e])}};el.empty=new el([]);const d1=Object.create(null);let vn=class{getMap(){return el.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=d1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in d1)throw new RangeError("Duplicate use of step JSON ID "+e);return d1[e]=n,n.prototype.jsonID=e,n}},Vn=class Zc{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Zc(e,null)}static fail(e){return new Zc(null,e)}static fromReplace(e,n,r,i){try{return Zc.ok(e.replace(n,r,i))}catch(s){if(s instanceof wi)return Zc.fail(s.message);throw s}}};function aS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(aS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return G.fromArray(r)}let vM=class ef extends vn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(aS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Vn.fromReplace(e,this.from,this.to,s)}invert(){return new CM(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ef(n.pos,r.pos,this.mark)}merge(e){return e instanceof ef&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ef(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ef(n.from,n.to,e.markFromJSON(n.mark))}};vn.jsonID("addMark",vM);let CM=class tf extends vn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(aS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Vn.fromReplace(e,this.from,this.to,r)}invert(){return new vM(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new tf(n.pos,r.pos,this.mark)}merge(e){return e instanceof tf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new tf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new tf(n.from,n.to,e.markFromJSON(n.mark))}};vn.jsonID("removeMark",CM);let wM=class nf extends vn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Vn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new nf(this.pos,n.marks[i]);return new nf(this.pos,this.mark)}}return new EM(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new nf(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new nf(n.pos,e.markFromJSON(n.mark))}};vn.jsonID("addNodeMark",wM);let EM=class Lx extends vn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Vn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new wM(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Lx(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Lx(n.pos,e.markFromJSON(n.mark))}};vn.jsonID("removeNodeMark",EM);let kg=class wo extends vn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Bx(e,this.from,this.to)?Vn.fail("Structure replace would overwrite content"):Vn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new el([this.from,this.to-this.from,this.slice.size])}invert(e){return new wo(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new wo(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof wo)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new wo(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new wo(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new wo(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};vn.jsonID("replace",kg);let Mm=class jd extends vn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Bx(e,this.from,this.gapFrom)||Bx(e,this.gapTo,this.to)))return Vn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Vn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Vn.fromReplace(e,this.from,this.to,r):Vn.fail("Content does not fit in gap")}getMap(){return new el([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new jd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new jd(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new jd(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};vn.jsonID("replaceAround",Mm);function Bx(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function sB(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function oS(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),u=t.$from.index(r)+i,c=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(u,c,n))return r;if(r==0||o.type.spec.isolating||!sB(o,u,c))break;u&&(i=1),c<o.childCount&&(s=1)}return null}function aB(t,e,n=null,r=t){let i=oB(t,e),s=i&&lB(r,e);return s?i.map(TE).concat({type:e,attrs:n}).concat(s.map(TE)):null}function TE(t){return{type:t,attrs:null}}function oB(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function lB(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:o}function $d(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,m=n-2;h>s;h--,m--){let g=i.node(h),y=i.index(h);if(g.type.spec.isolating)return!1;let b=g.content.cutByIndex(y,g.childCount),v=r&&r[m+1];v&&(b=b.replaceChild(0,v.type.create(v.attrs)));let N=r&&r[m]||g;if(!g.canReplace(y+1,g.childCount)||!N.type.validContent(b))return!1}let u=i.indexAfter(s),c=r&&r[0];return i.node(s).canReplaceWith(u,u,c?c.type:i.node(s+1).type)}function NM(t,e){let n=t.resolve(e),r=n.index();return cB(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function uB(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function cB(t,e){return!!(t&&e&&!t.isLeaf&&uB(t,e))}function lS(t,e,n=e,r=H.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return fB(i,s,r)?new kg(e,n,r):new hB(i,s,r).fit()}function fB(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let hB=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=G.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=G.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,u=i.depth;for(;o&&u&&s.childCount==1;)s=s.firstChild.content,o--,u--;let c=new H(s,o,u);return e>-1?new Mm(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new kg(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=m1(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],m,g=null;if(n==1&&(o?h.matchType(o.type)||(g=h.fillBefore(G.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:g};if(n==2&&o&&(m=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:m};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=m1(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new H(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=m1(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new H(rf(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new H(rf(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let N=0;N<s.length;N++)this.openFrontierNode(s[N]);let o=this.unplaced,u=r?r.content:o.content,c=o.openStart-e,h=0,m=[],{match:g,type:y}=this.frontier[n];if(i){for(let N=0;N<i.childCount;N++)m.push(i.child(N));g=g.matchFragment(i)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let N=u.child(h),T=g.matchType(N.type);if(!T)break;h++,(h>1||c==0||N.content.size)&&(g=T,m.push(AM(N.mark(y.allowedMarks(N.marks)),h==1?c:0,h==u.childCount?b:-1)))}let v=h==u.childCount;v||(b=-1),this.placed=sf(this.placed,n,G.from(m)),this.frontier[n].match=g,v&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let N=0,T=u;N<b;N++){let M=T.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),T=M.content}this.unplaced=v?e==0?H.empty:new H(rf(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new H(rf(o.content,e,h),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!g1(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=g1(e,n,i,r,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],m=g1(e,u,h,c,!0);if(!m||m.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=sf(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=sf(this.placed,this.depth,G.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=sf(this.placed,this.frontier.length,n))}};function rf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(rf(t.firstChild.content,e-1,n)))}function sf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(sf(t.lastChild.content,e-1,n)))}function m1(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function AM(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,AM(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(G.empty,!0)))),t.copy(r)}function g1(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,o);return u&&!pB(n,s.content,o)?u:null}function pB(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}let dB=class Ud extends vn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Vn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}getMap(){return el.empty}invert(e){return new Ud(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ud(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ud(n.pos,n.attr,n.value)}};vn.jsonID("attr",dB);let mB=class Vx extends vn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Vn.ok(r)}getMap(){return el.empty}invert(e){return new Vx(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Vx(n.attr,n.value)}};vn.jsonID("docAttr",mB);let hh=class extends Error{};hh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};hh.prototype=Object.create(Error.prototype);hh.prototype.constructor=hh;hh.prototype.name="TransformError";const TM=65535,MM=Math.pow(2,16);function gB(t,e){return t+e*MM}function ME(t){return t&TM}function yB(t){return(t-(t&TM))/MM}const OM=1,RM=2,Jd=4,DM=8;let Fx=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&DM)>0}get deletedBefore(){return(this.delInfo&(OM|Jd))>0}get deletedAfter(){return(this.delInfo&(RM|Jd))>0}get deletedAcross(){return(this.delInfo&Jd)>0}},tl=class cu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&cu.empty)return cu.empty}recover(e){let n=0,r=ME(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+yB(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:m);if(r)return b;let v=e==(n<0?c:g)?null:gB(u/3,e-c),N=e==c?RM:e==g?OM:Jd;return(n<0?e!=c:e!=g)&&(N|=DM),new Fx(b,N,v)}i+=m-h}return r?e+i:new Fx(e+i,0,null)}touches(e,n){let r=0,i=ME(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],m=this.ranges[i+r];e(u,u+h,c,c+m),s+=m-h}}invert(){return new cu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?cu.empty:new cu(e<0?[0,-e,0]:[0,0,e])}};tl.empty=new tl([]);let xB=class Px{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Px(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Px;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],u=o.mapResult(e,n);if(u.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(u.recover);continue}}i|=u.delInfo,e=u.pos}return r?e:new Fx(e,i,null)}};const y1=Object.create(null);let Cn=class{getMap(){return tl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=y1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in y1)throw new RangeError("Duplicate use of step JSON ID "+e);return y1[e]=n,n.prototype.jsonID=e,n}},Fn=class af{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new af(e,null)}static fail(e){return new af(null,e)}static fromReplace(e,n,r,i){try{return af.ok(e.replace(n,r,i))}catch(s){if(s instanceof wi)return af.fail(s.message);throw s}}};function uS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(uS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return G.fromArray(r)}let cS=class of extends Cn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(uS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Fn.fromReplace(e,this.from,this.to,s)}invert(){return new Hh(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new of(n.pos,r.pos,this.mark)}merge(e){return e instanceof of&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new of(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new of(n.from,n.to,e.markFromJSON(n.mark))}};Cn.jsonID("addMark",cS);let Hh=class lf extends Cn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(uS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Fn.fromReplace(e,this.from,this.to,r)}invert(){return new cS(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new lf(n.pos,r.pos,this.mark)}merge(e){return e instanceof lf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new lf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new lf(n.from,n.to,e.markFromJSON(n.mark))}};Cn.jsonID("removeMark",Hh);let fS=class uf extends Cn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Fn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new uf(this.pos,n.marks[i]);return new uf(this.pos,this.mark)}}return new Om(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new uf(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new uf(n.pos,e.markFromJSON(n.mark))}};Cn.jsonID("addNodeMark",fS);let Om=class jx extends Cn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Fn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fS(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new jx(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new jx(n.pos,e.markFromJSON(n.mark))}};Cn.jsonID("removeNodeMark",Om);let Is=class Eo extends Cn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&$x(e,this.from,this.to)?Fn.fail("Structure replace would overwrite content"):Fn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new tl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Eo(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Eo(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Eo)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Eo(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Eo(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Eo(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};Cn.jsonID("replace",Is);let hl=class Hd extends Cn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&($x(e,this.from,this.gapFrom)||$x(e,this.gapTo,this.to)))return Fn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Fn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Fn.fromReplace(e,this.from,this.to,r):Fn.fail("Content does not fit in gap")}getMap(){return new tl([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Hd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Hd(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Hd(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};Cn.jsonID("replaceAround",hl);function $x(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function bB(t,e,n,r){let i=[],s=[],o,u;t.doc.nodesBetween(e,n,(c,h,m)=>{if(!c.isInline)return;let g=c.marks;if(!r.isInSet(g)&&m.type.allowsMarkType(r.type)){let y=Math.max(h,e),b=Math.min(h+c.nodeSize,n),v=r.addToSet(g);for(let N=0;N<g.length;N++)g[N].isInSet(v)||(o&&o.to==y&&o.mark.eq(g[N])?o.to=b:i.push(o=new Hh(y,b,g[N])));u&&u.to==y?u.to=b:s.push(u=new cS(y,b,r))}}),i.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function SB(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,u)=>{if(!o.isInline)return;s++;let c=null;if(r instanceof Jh){let h=o.marks,m;for(;m=r.isInSet(h);)(c||(c=[])).push(m),h=m.removeFromSet(h)}else r?r.isInSet(o.marks)&&(c=[r]):c=o.marks;if(c&&c.length){let h=Math.min(u+o.nodeSize,n);for(let m=0;m<c.length;m++){let g=c[m],y;for(let b=0;b<i.length;b++){let v=i[b];v.step==s-1&&g.eq(i[b].style)&&(y=v)}y?(y.to=h,y.step=s):i.push({style:g,from:Math.max(u,e),to:h,step:s})}}}),i.forEach(o=>t.step(new Hh(o.from,o.to,o.style)))}function hS(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],u=e+1;for(let c=0;c<s.childCount;c++){let h=s.child(c),m=u+h.nodeSize,g=r.matchType(h.type);if(!g)o.push(new Is(u,m,H.empty));else{r=g;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new Hh(u,m,h.marks[y]));if(i&&h.isText&&n.whitespace!="pre"){let y,b=/\r?\n|\r/g,v;for(;y=b.exec(h.text);)v||(v=new H(G.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),o.push(new Is(u+y.index,u+y.index+y[0].length,v))}}u=m}if(!r.validEnd){let c=r.fillBefore(G.empty,!0);t.replace(u,u,new H(c,0,0))}for(let c=o.length-1;c>=0;c--)t.step(o[c])}function kB(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),u=i.after(s+1),c=o,h=u,m=G.empty,g=0;for(let v=s,N=!1;v>n;v--)N||r.index(v)>0?(N=!0,m=G.from(r.node(v).copy(m)),g++):c--;let y=G.empty,b=0;for(let v=s,N=!1;v>n;v--)N||i.after(v+1)<i.end(v)?(N=!0,y=G.from(i.node(v).copy(y)),b++):h++;t.step(new hl(c,h,o,u,new H(m.append(y),g,b),m.size-g,!0))}function vB(t,e,n){let r=G.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let u=n[o].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=G.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new hl(i,s,i,s,new H(r,0,0),n.length,!0))}function CB(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,u)=>{let c=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,c)&&wB(t.doc,t.mapping.slice(s).map(u),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!v?h=!1:!b&&v&&(h=!0)}h===!1&&_M(t,o,u,s),hS(t,t.mapping.slice(s).map(u,1),r,void 0,h===null);let m=t.mapping.slice(s),g=m.map(u,1),y=m.map(u+o.nodeSize,1);return t.step(new hl(g,y,g+1,y-1,new H(G.from(r.create(c,null,o.marks)),0,0),1,!0)),h===!0&&IM(t,o,u,s),!1}})}function IM(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,u=/\r?\n|\r/g;for(;o=u.exec(i.text);){let c=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function _M(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
38
+ `))}})}function wB(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function EB(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new hl(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new H(G.from(o),0,0),1,!0))}function NB(t,e,n=1,r){let i=t.doc.resolve(e),s=G.empty,o=G.empty;for(let u=i.depth,c=i.depth-n,h=n-1;u>c;u--,h--){s=G.from(i.node(u).copy(s));let m=r&&r[h];o=G.from(m?m.type.create(m.attrs,o):i.node(u).copy(o))}t.step(new Is(e,e,new H(s.append(o),n,n),!0))}function AB(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let m=o.whitespace=="pre",g=!!o.contentMatch.matchType(i);m&&!g?r=!1:!m&&g&&(r=!0)}let u=t.steps.length;if(r===!1){let m=t.doc.resolve(e+n);_M(t,m.node(),m.before(),u)}o.inlineContent&&hS(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let c=t.mapping.slice(u),h=c.map(e-n);if(t.step(new Is(h,c.map(e+n,-1),H.empty,!0)),r===!0){let m=t.doc.resolve(h);IM(t,m.node(),m.before(),t.steps.length)}return t}function TB(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function MB(t,e,n=e,r=H.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return zM(i,s,r)?new Is(e,n,r):new OB(i,s,r).fit()}function zM(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let OB=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=G.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=G.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,u=i.depth;for(;o&&u&&s.childCount==1;)s=s.firstChild.content,o--,u--;let c=new H(s,o,u);return e>-1?new hl(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Is(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=x1(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],m,g=null;if(n==1&&(o?h.matchType(o.type)||(g=h.fillBefore(G.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:g};if(n==2&&o&&(m=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:m};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=x1(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new H(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=x1(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new H(cf(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new H(cf(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let N=0;N<s.length;N++)this.openFrontierNode(s[N]);let o=this.unplaced,u=r?r.content:o.content,c=o.openStart-e,h=0,m=[],{match:g,type:y}=this.frontier[n];if(i){for(let N=0;N<i.childCount;N++)m.push(i.child(N));g=g.matchFragment(i)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let N=u.child(h),T=g.matchType(N.type);if(!T)break;h++,(h>1||c==0||N.content.size)&&(g=T,m.push(LM(N.mark(y.allowedMarks(N.marks)),h==1?c:0,h==u.childCount?b:-1)))}let v=h==u.childCount;v||(b=-1),this.placed=ff(this.placed,n,G.from(m)),this.frontier[n].match=g,v&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let N=0,T=u;N<b;N++){let M=T.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),T=M.content}this.unplaced=v?e==0?H.empty:new H(cf(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new H(cf(o.content,e,h),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!b1(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=b1(e,n,i,r,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],m=b1(e,u,h,c,!0);if(!m||m.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=ff(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ff(this.placed,this.depth,G.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=ff(this.placed,this.frontier.length,n))}};function cf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(cf(t.firstChild.content,e-1,n)))}function ff(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ff(t.lastChild.content,e-1,n)))}function x1(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function LM(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,LM(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(G.empty,!0)))),t.copy(r)}function b1(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,o);return u&&!RB(n,s.content,o)?u:null}function RB(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function DB(t){return t.spec.defining||t.spec.definingForContent}function IB(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(zM(i,s,r))return t.step(new Is(e,n,r));let o=VM(i,s);o[o.length-1]==0&&o.pop();let u=-(i.depth+1);o.unshift(u);for(let y=i.depth,b=i.pos-1;y>0;y--,b--){let v=i.node(y).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(y)>-1?u=y:i.before(y)==b&&o.splice(1,0,-y)}let c=o.indexOf(u),h=[],m=r.openStart;for(let y=r.content,b=0;;b++){let v=y.firstChild;if(h.push(v),b==r.openStart)break;y=v.content}for(let y=m-1;y>=0;y--){let b=h[y],v=DB(b.type);if(v&&!b.sameMarkup(i.node(Math.abs(u)-1)))m=y;else if(v||!b.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let b=(y+m+1)%(r.openStart+1),v=h[b];if(v)for(let N=0;N<o.length;N++){let T=o[(N+c)%o.length],M=!0;T<0&&(M=!1,T=-T);let j=i.node(T-1),P=i.index(T-1);if(j.canReplaceWith(P,P,v.type,v.marks))return t.replace(i.before(T),M?s.after(T):n,new H(BM(r.content,0,r.openStart,b),b,r.openEnd))}}let g=t.steps.length;for(let y=o.length-1;y>=0&&(t.replace(e,n,r),!(t.steps.length>g));y--){let b=o[y];b<0||(e=i.before(b),n=s.after(b))}}function BM(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(BM(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(G.empty,!0))}return t}function _B(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=TB(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new H(G.from(r),0,0))}function zB(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=VM(r,i);for(let o=0;o<s.length;o++){let u=s[o],c=o==s.length-1;if(c&&u==0||r.node(u).type.contentMatch.validEnd)return t.delete(r.start(u),i.end(u));if(u>0&&(c||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return t.delete(r.before(u),i.after(u))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function VM(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}let FM=class qd extends Cn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Fn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}getMap(){return tl.empty}invert(e){return new qd(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new qd(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new qd(n.pos,n.attr,n.value)}};Cn.jsonID("attr",FM);let PM=class Ux extends Cn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Fn.ok(r)}getMap(){return tl.empty}invert(e){return new Ux(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ux(n.attr,n.value)}};Cn.jsonID("docAttr",PM);let Iu=class extends Error{};Iu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Iu.prototype=Object.create(Error.prototype);Iu.prototype.constructor=Iu;Iu.prototype.name="TransformError";let LB=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new xB}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Iu(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,u,c)=>{e=Math.min(e,u),n=Math.max(n,c)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=H.empty){let i=MB(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new H(G.from(r),0,0))}delete(e,n){return this.replace(e,n,H.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return IB(this,e,n,r),this}replaceRangeWith(e,n,r){return _B(this,e,n,r),this}deleteRange(e,n){return zB(this,e,n),this}lift(e,n){return kB(this,e,n),this}join(e,n=1){return AB(this,e,n),this}wrap(e,n){return vB(this,e,n),this}setBlockType(e,n=e,r,i=null){return CB(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return EB(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new FM(e,n,r)),this}setDocAttribute(e,n){return this.step(new PM(e,n)),this}addNodeMark(e,n){return this.step(new fS(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ut)n.isInSet(r.marks)&&this.step(new Om(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Om(e,s)),i=s.removeFromSet(i);for(let u=o.length-1;u>=0;u--)this.step(o[u])}return this}split(e,n=1,r){return NB(this,e,n,r),this}addMark(e,n,r){return bB(this,e,n,r),this}removeMark(e,n,r){return SB(this,e,n,r),this}clearIncompatible(e,n,r){return hS(this,e,n,r),this}};const S1=Object.create(null);class Ve{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new jM(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=H.empty){let r=n.content.lastChild,i=null;for(let u=0;u<n.openEnd;u++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let u=0;u<o.length;u++){let{$from:c,$to:h}=o[u],m=e.mapping.slice(s);e.replaceRange(m.map(c.pos),m.map(h.pos),u?H.empty:n),u==0&&DE(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:u}=i[s],c=e.mapping.slice(r),h=c.map(o.pos),m=c.map(u.pos);s?e.deleteRange(h,m):(e.replaceRangeWith(h,m,n),DE(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new we(e):fu(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?fu(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):fu(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Hn(e.node(0))}static atStart(e){return fu(e,e,0,0,1)||new Hn(e)}static atEnd(e){return fu(e,e,e.content.size,e.childCount,-1)||new Hn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=S1[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in S1)throw new RangeError("Duplicate use of selection JSON ID "+e);return S1[e]=n,n.prototype.jsonID=e,n}getBookmark(){return we.between(this.$anchor,this.$head).getBookmark()}}Ve.prototype.visible=!0;class jM{constructor(e,n){this.$from=e,this.$to=n}}let OE=!1;function RE(t){!OE&&!t.parent.inlineContent&&(OE=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class we extends Ve{constructor(e,n=e){RE(e),RE(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ve.near(r);let i=e.resolve(n.map(this.anchor));return new we(i.parent.inlineContent?i:r,r)}replace(e,n=H.empty){if(super.replace(e,n),n==H.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof we&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new vg(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new we(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Ve.findFrom(n,r,!0)||Ve.findFrom(n,-r,!0);if(s)n=s.$head;else return Ve.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Ve.findFrom(e,-r,!0)||Ve.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new we(e,n)}}Ve.jsonID("text",we);class vg{constructor(e,n){this.anchor=e,this.head=n}map(e){return new vg(e.map(this.anchor),e.map(this.head))}resolve(e){return we.between(e.resolve(this.anchor),e.resolve(this.head))}}class ge extends Ve{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Ve.near(s):new ge(s)}content(){return new H(G.from(this.node),0,0)}eq(e){return e instanceof ge&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new pS(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ge(e.resolve(n.anchor))}static create(e,n){return new ge(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ge.prototype.visible=!1;Ve.jsonID("node",ge);class pS{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new vg(r,r):new pS(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ge.isSelectable(r)?new ge(n):Ve.near(n)}}class Hn extends Ve{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=H.empty){if(n==H.empty){e.delete(0,e.doc.content.size);let r=Ve.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Hn(e)}map(e){return new Hn(e)}eq(e){return e instanceof Hn}getBookmark(){return BB}}Ve.jsonID("all",Hn);const BB={map(){return this},resolve(t){return new Hn(t)}};function fu(t,e,n,r,i,s=!1){if(e.inlineContent)return we.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let u=e.child(o);if(u.isAtom){if(!s&&ge.isSelectable(u))return ge.create(t,n-(i<0?u.nodeSize:0))}else{let c=fu(t,u,n+i,i<0?u.childCount:0,i,s);if(c)return c}n+=u.nodeSize*i}return null}function DE(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Is||i instanceof hl))return;let s=t.mapping.maps[r],o;s.forEach((u,c,h,m)=>{o==null&&(o=m)}),t.setSelection(Ve.near(t.doc.resolve(o),n))}const IE=1,Id=2,_E=4;class VB extends LB{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|IE)&~Id,this.storedMarks=null,this}get selectionSet(){return(this.updated&IE)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Id,this}ensureMarks(e){return ut.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Id)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Id,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ut.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Ve.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=_E,this}get scrolledIntoView(){return(this.updated&_E)>0}}function zE(t,e){return!e||!t?t:t.bind(e)}class hf{constructor(e,n,r){this.name=e,this.init=zE(n.init,r),this.apply=zE(n.apply,r)}}const FB=[new hf("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new hf("selection",{init(t,e){return t.selection||Ve.atStart(e.doc)},apply(t){return t.selection}}),new hf("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new hf("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class k1{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=FB.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new hf(r.key,r.spec.state,r))})}}class Do{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let u=this.config.plugins[o];if(u.spec.appendTransaction){let c=i?i[o].n:0,h=i?i[o].state:this,m=c<n.length&&u.spec.appendTransaction.call(u,c?n.slice(c):n,h,r);if(m&&r.filterTransaction(m,o)){if(m.setMeta("appendedTransaction",e),!i){i=[];for(let g=0;g<this.config.plugins.length;g++)i.push(g<o?{state:r,n:n.length}:{state:this,n:0})}n.push(m),r=r.applyInner(m),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Do(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new VB(this)}static create(e){let n=new k1(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Do(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new k1(this.schema,e.plugins),r=n.fields,i=new Do(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new k1(e.schema,e.plugins),s=new Do(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Ms.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Ve.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let u in r){let c=r[u],h=c.spec.state;if(c.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,u)){s[o.name]=h.fromJSON.call(c,e,n[u],s);return}}s[o.name]=o.init(e,s)}}),s}}function $M(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=$M(i,e,{})),n[r]=i}return n}class fr{constructor(e){this.spec=e,this.props={},e.props&&$M(e.props,this,this.props),this.key=e.key?e.key.key:UM("plugin")}getState(e){return e[this.key]}}const v1=Object.create(null);function UM(t){return t in v1?t+"$"+ ++v1[t]:(v1[t]=0,t+"$")}class hr{constructor(e="key"){this.key=UM(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const dS=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function JM(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const HM=(t,e,n)=>{let r=JM(t,n);if(!r)return!1;let i=mS(r);if(!i){let o=r.blockRange(),u=o&&oS(o);return u==null?!1:(e&&e(t.tr.lift(o,u).scrollIntoView()),!0)}let s=i.nodeBefore;if(GM(t,i,e,-1))return!0;if(r.parent.content.size==0&&(_u(s,"end")||ge.isSelectable(s)))for(let o=r.depth;;o--){let u=lS(t.doc,r.before(o),r.after(o),H.empty);if(u&&u.slice.size<u.to-u.from){if(e){let c=t.tr.step(u);c.setSelection(_u(s,"end")?Ve.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):ge.create(c.doc,i.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},PB=(t,e,n)=>{let r=JM(t,n);if(!r)return!1;let i=mS(r);return i?jB(t,i,e):!1};function jB(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let m=i.lastChild;if(!m)return!1;i=m}let o=e.nodeAfter,u=o,c=e.pos+1;for(;!u.isTextblock;c++){if(u.type.spec.isolating)return!1;let m=u.firstChild;if(!m)return!1;u=m}let h=lS(t.doc,s,c,H.empty);if(!h||h.from!=s||h instanceof kg&&h.slice.size>=c-s)return!1;if(n){let m=t.tr.step(h);m.setSelection(we.create(m.doc,s)),n(m.scrollIntoView())}return!0}function _u(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const qM=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=mS(r)}let o=s&&s.nodeBefore;return!o||!ge.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ge.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function mS(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function $B(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const UB=(t,e,n)=>{let r=$B(t,n);if(!r)return!1;let i=KM(r);if(!i)return!1;let s=i.nodeAfter;if(GM(t,i,e,1))return!0;if(r.parent.content.size==0&&(_u(s,"start")||ge.isSelectable(s))){let o=lS(t.doc,r.before(),r.after(),H.empty);if(o&&o.slice.size<o.to-o.from){if(e){let u=t.tr.step(o);u.setSelection(_u(s,"start")?Ve.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):ge.create(u.doc,u.mapping.map(i.pos))),e(u.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},JB=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=KM(r)}let o=s&&s.nodeAfter;return!o||!ge.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ge.create(t.doc,s.pos)).scrollIntoView()),!0)};function KM(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const HB=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
39
+ `).scrollIntoView()),!0)};function gS(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const qB=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=gS(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let u=n.after(),c=t.tr.replaceWith(u,u,o.createAndFill());c.setSelection(Ve.near(c.doc.resolve(u),1)),e(c.scrollIntoView())}return!0},KB=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Hn||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=gS(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=t.tr.insert(o,s.createAndFill());u.setSelection(we.create(u.doc,o+1)),e(u.scrollIntoView())}return!0},GB=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if($d(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&oS(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function YB(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof ge&&e.selection.node.isBlock)return!r.parentOffset||!$d(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,u,c=!1,h=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){c=r.end(b)==r.pos+(r.depth-b),h=r.start(b)==r.pos-(r.depth-b),u=gS(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),s.unshift(c&&u?{type:u}:null),o=b;break}else{if(b==1)return!1;s.unshift(null)}let m=e.tr;(e.selection instanceof we||e.selection instanceof Hn)&&m.deleteSelection();let g=m.mapping.map(r.pos),y=$d(m.doc,g,s.length,s);if(y||(s[0]=u?{type:u}:null,y=$d(m.doc,g,s.length,s)),!y)return!1;if(m.split(g,s.length,s),!c&&h&&r.node(o).type!=u){let b=m.mapping.map(r.before(o)),v=m.doc.resolve(b);u&&r.node(o-1).canReplaceWith(v.index(),v.index()+1,u)&&m.setNodeMarkup(m.mapping.map(r.before(o)),u)}return n&&n(m.scrollIntoView()),!0}}const WB=YB(),XB=(t,e)=>(e&&e(t.tr.setSelection(new Hn(t.doc))),!0);function QB(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||NM(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function GM(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,u,c=i.type.spec.isolating||s.type.spec.isolating;if(!c&&QB(t,e,n))return!0;let h=!c&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(u=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&u.matchType(o[0]||s.type).validEnd){if(n){let b=e.pos+s.nodeSize,v=G.empty;for(let M=o.length-1;M>=0;M--)v=G.from(o[M].create(null,v));v=G.from(i.copy(v));let N=t.tr.step(new Mm(e.pos-1,b,e.pos,b,new H(v,1,0),o.length,!0)),T=N.doc.resolve(b+2*o.length);T.nodeAfter&&T.nodeAfter.type==i.type&&NM(N.doc,T.pos)&&N.join(T.pos),n(N.scrollIntoView())}return!0}let m=s.type.spec.isolating||r>0&&c?null:Ve.findFrom(e,1),g=m&&m.$from.blockRange(m.$to),y=g&&oS(g);if(y!=null&&y>=e.depth)return n&&n(t.tr.lift(g,y).scrollIntoView()),!0;if(h&&_u(s,"start",!0)&&_u(i,"end")){let b=i,v=[];for(;v.push(b),!b.isTextblock;)b=b.lastChild;let N=s,T=1;for(;!N.isTextblock;N=N.firstChild)T++;if(b.canReplace(b.childCount,b.childCount,N.content)){if(n){let M=G.empty;for(let P=v.length-1;P>=0;P--)M=G.from(v[P].copy(M));let j=t.tr.step(new Mm(e.pos-v.length,e.pos+s.nodeSize,e.pos+T,e.pos+s.nodeSize-T,new H(M,v.length,0),0,!0));n(j.scrollIntoView())}return!0}}return!1}function YM(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(we.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const ZB=YM(-1),e8=YM(1);function yS(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),u=o&&aB(o,t,e);return u?(r&&r(n.tr.wrap(o,u).scrollIntoView()),!0):!1}}function ph(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:u}}=n.selection.ranges[s];n.doc.nodesBetween(o,u,(c,h)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)i=!0;else{let m=n.doc.resolve(h),g=m.index();i=m.parent.canReplaceWith(g,g+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:u},$to:{pos:c}}=n.selection.ranges[o];s.setBlockType(u,c,t,e)}r(s.scrollIntoView())}return!0}}function t8(t,e,n,r){for(let i=0;i<e.length;i++){let{$from:s,$to:o}=e[i],u=s.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(s.pos,o.pos,(c,h)=>{if(u)return!1;u=c.inlineContent&&c.type.allowsMarkType(n)}),u)return!0}return!1}function Cg(t,e=null,n){return function(r,i){let{empty:s,$cursor:o,ranges:u}=r.selection;if(s&&!o||!t8(r.doc,u,t))return!1;if(i)if(o)t.isInSet(r.storedMarks||o.marks())?i(r.tr.removeStoredMark(t)):i(r.tr.addStoredMark(t.create(e)));else{let c,h=r.tr;c=!u.some(m=>r.doc.rangeHasMark(m.$from.pos,m.$to.pos,t));for(let m=0;m<u.length;m++){let{$from:g,$to:y}=u[m];if(!c)h.removeMark(g.pos,y.pos,t);else{let b=g.pos,v=y.pos,N=g.nodeAfter,T=y.nodeBefore,M=N&&N.isText?/^\s*/.exec(N.text)[0].length:0,j=T&&T.isText?/\s*$/.exec(T.text)[0].length:0;b+M<v&&(b+=M,v-=j),h.addMark(b,v,t.create(e))}}i(h.scrollIntoView())}return!0}}function $u(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}let C1=$u(dS,HM,qM),LE=$u(dS,UB,JB);const Es={Enter:$u(HB,KB,GB,WB),"Mod-Enter":qB,Backspace:C1,"Mod-Backspace":C1,"Shift-Backspace":C1,Delete:LE,"Mod-Delete":LE,"Mod-a":XB},WM={"Ctrl-h":Es.Backspace,"Alt-Backspace":Es["Mod-Backspace"],"Ctrl-d":Es.Delete,"Ctrl-Alt-Backspace":Es["Mod-Delete"],"Alt-Delete":Es["Mod-Delete"],"Alt-d":Es["Mod-Delete"],"Ctrl-a":ZB,"Ctrl-e":e8};for(let t in Es)WM[t]=Es[t];const n8=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,r8=n8?WM:Es,XM=65535,QM=Math.pow(2,16);function i8(t,e){return t+e*QM}function BE(t){return t&XM}function s8(t){return(t-(t&XM))/QM}const ZM=1,eO=2,Kd=4,tO=8;let VE=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&tO)>0}get deletedBefore(){return(this.delInfo&(ZM|Kd))>0}get deletedAfter(){return(this.delInfo&(eO|Kd))>0}get deletedAcross(){return(this.delInfo&Kd)>0}},nl=class hu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&hu.empty)return hu.empty}recover(e){let n=0,r=BE(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+s8(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:m);if(r)return b;let v=e==(n<0?c:g)?null:i8(u/3,e-c),N=e==c?eO:e==g?ZM:Kd;return(n<0?e!=c:e!=g)&&(N|=tO),new VE(b,N,v)}i+=m-h}return r?e+i:new VE(e+i,0,null)}touches(e,n){let r=0,i=BE(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],m=this.ranges[i+r];e(u,u+h,c,c+m),s+=m-h}}invert(){return new hu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?hu.empty:new hu(e<0?[0,-e,0]:[0,0,e])}};nl.empty=new nl([]);const w1=Object.create(null);let wn=class{getMap(){return nl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=w1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in w1)throw new RangeError("Duplicate use of step JSON ID "+e);return w1[e]=n,n.prototype.jsonID=e,n}},Pn=class pf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new pf(e,null)}static fail(e){return new pf(null,e)}static fromReplace(e,n,r,i){try{return pf.ok(e.replace(n,r,i))}catch(s){if(s instanceof wi)return pf.fail(s.message);throw s}}};function xS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(xS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return G.fromArray(r)}let nO=class df extends wn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(xS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Pn.fromReplace(e,this.from,this.to,s)}invert(){return new rO(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new df(n.pos,r.pos,this.mark)}merge(e){return e instanceof df&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new df(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new df(n.from,n.to,e.markFromJSON(n.mark))}};wn.jsonID("addMark",nO);let rO=class mf extends wn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(xS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Pn.fromReplace(e,this.from,this.to,r)}invert(){return new nO(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new mf(n.pos,r.pos,this.mark)}merge(e){return e instanceof mf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new mf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new mf(n.from,n.to,e.markFromJSON(n.mark))}};wn.jsonID("removeMark",rO);let iO=class gf extends wn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Pn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new gf(this.pos,n.marks[i]);return new gf(this.pos,this.mark)}}return new sO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new gf(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new gf(n.pos,e.markFromJSON(n.mark))}};wn.jsonID("addNodeMark",iO);let sO=class Jx extends wn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Pn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new iO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Jx(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Jx(n.pos,e.markFromJSON(n.mark))}};wn.jsonID("removeNodeMark",sO);let a8=class No extends wn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Hx(e,this.from,this.to)?Pn.fail("Structure replace would overwrite content"):Pn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new nl([this.from,this.to-this.from,this.slice.size])}invert(e){return new No(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new No(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof No)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new No(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new No(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new No(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};wn.jsonID("replace",a8);let o8=class Gd extends wn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Hx(e,this.from,this.gapFrom)||Hx(e,this.gapTo,this.to)))return Pn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Pn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Pn.fromReplace(e,this.from,this.to,r):Pn.fail("Content does not fit in gap")}getMap(){return new nl([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Gd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Gd(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Gd(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};wn.jsonID("replaceAround",o8);function Hx(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function l8(t,e,n=null,r=t){let i=u8(t,e),s=i&&c8(r,e);return s?i.map(FE).concat({type:e,attrs:n}).concat(s.map(FE)):null}function FE(t){return{type:t,attrs:null}}function u8(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function c8(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:o}function f8(t,e){let n=t.resolve(e),r=n.index();return p8(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function h8(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function p8(t,e){return!!(t&&e&&!t.isLeaf&&h8(t,e))}let d8=class Yd extends wn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Pn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Pn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}getMap(){return nl.empty}invert(e){return new Yd(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yd(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yd(n.pos,n.attr,n.value)}};wn.jsonID("attr",d8);let m8=class qx extends wn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Pn.ok(r)}getMap(){return nl.empty}invert(e){return new qx(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new qx(n.attr,n.value)}};wn.jsonID("docAttr",m8);let dh=class extends Error{};dh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};dh.prototype=Object.create(Error.prototype);dh.prototype.constructor=dh;dh.prototype.name="TransformError";class Tr{constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?g8(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function g8(t){return function(e,n,r,i){let s=t;if(n[1]){let o=n[0].lastIndexOf(n[1]);s+=n[0].slice(o+n[1].length),r+=o;let u=r-i;u>0&&(s=n[0].slice(o-u,o)+s,r=i)}return e.tr.insertText(s,r,i)}}const y8=(t,e)=>{let n=t.plugins;for(let r=0;r<n.length;r++){let i=n[r],s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){let o=t.tr,u=s.transform;for(let c=u.steps.length-1;c>=0;c--)o.step(u.steps[c].invert(u.docs[c]));if(s.text){let c=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,c))}else o.delete(s.from,s.to);e(o)}return!0}}return!1};new Tr(/--$/,"—",{inCodeMark:!1});new Tr(/\.\.\.$/,"…",{inCodeMark:!1});new Tr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Tr(/"$/,"”",{inCodeMark:!1});new Tr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Tr(/'$/,"’",{inCodeMark:!1});function bS(t,e,n=null,r){return new Tr(t,(i,s,o,u)=>{let c=n instanceof Function?n(s):n,h=i.tr.delete(o,u),m=h.doc.resolve(o),g=m.blockRange(),y=g&&l8(g,e,c);if(!y)return null;h.wrap(g,y);let b=h.doc.resolve(o-1).nodeBefore;return b&&b.type==e&&f8(h.doc,o-1)&&(!r||r(s,b))&&h.join(o-1),h})}function aO(t,e,n=null){return new Tr(t,(r,i,s,o)=>{let u=r.doc.resolve(s),c=n instanceof Function?n(i):n;return u.node(-1).canReplaceWith(u.index(-1),u.indexAfter(-1),e)?r.tr.delete(s,o).setBlockType(s,s,e,c):null})}const Ua=typeof navigator<"u"?navigator:null,PE=typeof document<"u"?document:null,Ya=Ua&&Ua.userAgent||"",Kx=/Edge\/(\d+)/.exec(Ya),oO=/MSIE \d/.exec(Ya),Gx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ya),SS=!!(oO||Gx||Kx);oO?document.documentMode:Gx?+Gx[1]:Kx&&+Kx[1];const x8=!SS&&/gecko\/(\d+)/i.test(Ya);x8&&+(/Firefox\/(\d+)/.exec(Ya)||[0,0])[1];const Yx=!SS&&/Chrome\/(\d+)/.exec(Ya),b8=!!Yx;Yx&&+Yx[1];const S8=!SS&&!!Ua&&/Apple Computer/.test(Ua.vendor),k8=S8&&(/Mobile\/\w+/.test(Ya)||!!Ua&&Ua.maxTouchPoints>2);k8||Ua&&/Mac/.test(Ua.platform);const v8=/Android \d/.test(Ya),C8=!!PE&&"webkitFontSmoothing"in PE.documentElement.style;C8&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];function E1(t,e,n,r,i,s){if(t.composing)return!1;const o=t.state,u=o.doc.resolve(e);if(u.parent.type.spec.code)return!1;const c=u.parent.textBetween(Math.max(0,u.parentOffset-500),u.parentOffset,void 0,"")+r;for(let h of i){const m=h,g=m.match.exec(c),y=g&&g[0]&&m.handler(o,g,e-(g[0].length-r.length),n);if(y)return m.undoable!==!1&&y.setMeta(s,{transform:y,from:e,to:n,text:r}),t.dispatch(y),!0}return!1}const w8=new hr("MILKDOWN_CUSTOM_INPUTRULES");function E8({rules:t}){const e=new fr({key:w8,isInputRules:!0,state:{init(){return null},apply(n,r){const i=n.getMeta(this);return i||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,i,s){return E1(n,r,i,s,t,e)},handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:r}=n.state.selection;r&&E1(n,r.pos,r.pos,"",t,e)}),!1),keydown:(n,r)=>!(v8&&b8&&r.key==="Enter")||n.composing?!1:n.someProp("handleKeyDown",i=>i(n,r))?(r.preventDefault(),!0):!1},handleKeyDown(n,r){if(r.key!=="Enter")return!1;const{$cursor:i}=n.state.selection;return i?E1(n,i.pos,i.pos,`
40
+ `,t,e):!1}}});return e}function qh(t,e,n={}){return new Tr(t,(r,i,s,o)=>{var u,c,h,m;const{tr:g}=r,y=i.length;let b=i[y-1],v=i[0],N=[],T;const M={group:b,fullMatch:v,start:s,end:o},j=(u=n.updateCaptured)==null?void 0:u.call(n,M);if(Object.assign(M,j),{group:b,fullMatch:v,start:s,end:o}=M,v===null||b?.trim()==="")return null;if(b){const P=v.search(/\S/),J=s+v.indexOf(b),L=J+b.length;N=(c=g.storedMarks)!=null?c:[],L<o&&g.delete(L,o),J>s&&g.delete(s+P,J),T=s+P+b.length;const C=(h=n.getAttr)==null?void 0:h.call(n,i);g.addMark(s,T,e.create(C)),g.setStoredMarks(N),(m=n.beforeDispatch)==null||m.call(n,{match:i,start:s,end:o,tr:g})}return g})}function lO(t){return Object.assign(Object.create(t),t).setTime(Date.now())}function N8(t,e){return Array.isArray(t)&&t.includes(e.type)||e.type===t}function A8(t){return e=>{for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r)){const i=e.before(n),s=e.after(n);return{from:i,to:s,node:r}}}}}function T8(t,e){return A8(n=>n.type===e)(t)}function M8(t){return e=>{for(let n=e.depth;n>0;n--){const r=e.node(n);if(t(r))return{pos:e.before(n),start:e.start(n),depth:n,node:r}}}}function O8(t,e){if(!(t instanceof ge))return;const{node:n,$from:r}=t;if(N8(e,n))return{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}}const R8=(t,e)=>{const{selection:n,doc:r}=t;if(n instanceof ge)return{hasNode:n.node.type===e,pos:n.from,target:n.node};const{from:i,to:s}=n;let o=!1,u=-1,c=null;return r.nodesBetween(i,s,(h,m)=>c?!1:h.type===e?(o=!0,u=m,c=h,!1):!0),{hasNode:o,pos:u,target:c}};var Ja={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Rm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},D8=typeof navigator<"u"&&/Mac/.test(navigator.platform),I8=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var pn=0;pn<10;pn++)Ja[48+pn]=Ja[96+pn]=String(pn);for(var pn=1;pn<=24;pn++)Ja[pn+111]="F"+pn;for(var pn=65;pn<=90;pn++)Ja[pn]=String.fromCharCode(pn+32),Rm[pn]=String.fromCharCode(pn);for(var N1 in Ja)Rm.hasOwnProperty(N1)||(Rm[N1]=Ja[N1]);function _8(t){var e=D8&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||I8&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Rm:Ja)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const z8=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),L8=typeof navigator<"u"&&/Win/.test(navigator.platform);function B8(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let u=0;u<e.length-1;u++){let c=e[u];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))z8?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function V8(t){let e=Object.create(null);for(let n in t)e[B8(n)]=t[n];return e}function A1(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function F8(t){return new fr({props:{handleKeyDown:uO(t)}})}function uO(t){let e=V8(t);return function(n,r){let i=_8(r),s,o=e[A1(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=e[A1(i,r,!1)];if(u&&u(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(L8&&r.ctrlKey&&r.altKey)&&(s=Ja[r.keyCode])&&s!=i){let u=e[A1(s,r)];if(u&&u(n.state,n.dispatch,n))return!0}}return!1}}var cO=class{},fO=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=t=>{this.top()?.push(t)},this.open=t=>{this.elements.push(t)},this.close=()=>{const t=this.elements.pop();if(!t)throw vT();return t}}},P8=class hO extends cO{constructor(e,n,r){super(),this.type=e,this.content=n,this.attrs=r}push(e,...n){this.content.push(e,...n)}pop(){return this.content.pop()}static create(e,n,r){return new hO(e,n,r)}},Li,Lh,ag,og,lg,Bh,Vh,Wo,j8=(Wo=class extends fO{constructor(n){super();Ut(this,Li,ut.none);Ut(this,Lh,n=>n.isText);Ut(this,ag,(n,r)=>{if(Ze(this,Lh).call(this,n)&&Ze(this,Lh).call(this,r)&&ut.sameSet(n.marks,r.marks))return this.schema.text(n.text+r.text,n.marks)});Ut(this,og,n=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.parseMarkdown.match(n));if(!r)throw Y4(n);return r});Ut(this,lg,n=>{const r=Ze(this,og).call(this,n);r.spec.parseMarkdown.runner(this,n,r)});Ut(this,Bh,()=>{iu(this,Li,ut.none);const n=this.close();return Ze(this,Vh).call(this,n.type,n.attrs,n.content)});Ut(this,Vh,(n,r,i)=>{const s=n.createAndFill(r,i,Ze(this,Li));if(!s)throw G4(n,r,i);return this.push(s),s});this.injectRoot=(r,i,s)=>(this.openNode(i,s),this.next(r.children),this),this.openNode=(r,i)=>(this.open(P8.create(r,[],i)),this),this.closeNode=()=>{try{Ze(this,Bh).call(this)}catch(r){console.error(r)}return this},this.addNode=(r,i,s)=>{try{Ze(this,Vh).call(this,r,i,s)}catch(o){console.error(o)}return this},this.openMark=(r,i)=>(iu(this,Li,r.create(i).addToSet(Ze(this,Li))),this),this.closeMark=r=>(iu(this,Li,r.removeFromSet(Ze(this,Li))),this),this.addText=r=>{try{const i=this.top();if(!i)throw vT();const s=i.pop(),o=this.schema.text(r,Ze(this,Li));if(!s)return i.push(o),this;const u=Ze(this,ag).call(this,s,o);return u?(i.push(u),this):(i.push(s,o),this)}catch(i){return console.error(i),this}},this.build=()=>{let r;do r=Ze(this,Bh).call(this);while(this.size());return r},this.next=(r=[])=>([r].flat().forEach(i=>Ze(this,lg).call(this,i)),this),this.toDoc=()=>this.build(),this.run=(r,i)=>{const s=r.runSync(r.parse(i),i);return this.next(s),this},this.schema=n}},Li=new WeakMap,Lh=new WeakMap,ag=new WeakMap,og=new WeakMap,lg=new WeakMap,Bh=new WeakMap,Vh=new WeakMap,Wo.create=(n,r)=>{const i=new Wo(n);return s=>(i.run(r,s),i.toDoc())},Wo),Xo,jE=(Xo=class extends cO{constructor(e,n,r,i={}){super(),this.type=e,this.children=n,this.value=r,this.props=i,this.push=(s,...o)=>{this.children||(this.children=[]),this.children.push(s,...o)},this.pop=()=>this.children?.pop()}},Xo.create=(e,n,r,i={})=>new Xo(e,n,r,i),Xo),$8=t=>Object.prototype.hasOwnProperty.call(t,"size"),Ns,Fh,ug,cg,Ph,fg,jh,hg,pg,Ru,Vo,dg,$h,Qo,U8=(Qo=class extends fO{constructor(n){super();Ut(this,Ns,ut.none);Ut(this,Fh,n=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.toMarkdown.match(n));if(!r)throw W4(n.type);return r});Ut(this,ug,n=>Ze(this,Fh).call(this,n).spec.toMarkdown.runner(this,n));Ut(this,cg,(n,r)=>Ze(this,Fh).call(this,n).spec.toMarkdown.runner(this,n,r));Ut(this,Ph,n=>{const{marks:r}=n,i=s=>s.type.spec.priority??50;[...r].sort((s,o)=>i(s)-i(o)).every(s=>!Ze(this,cg).call(this,s,n))&&Ze(this,ug).call(this,n),r.forEach(s=>Ze(this,$h).call(this,s))});Ut(this,fg,(n,r)=>{if(n.type===r||n.children?.length!==1)return n;const i=c=>{if(c.type===r)return c.value!=null?null:c;if(c.children?.length!==1)return null;const[h]=c.children;return h?i(h):null},s=i(n);if(!s)return n;const o=s.children?[...s.children]:void 0,u={...n,children:o};return u.children=o,s.children=[u],s});Ut(this,jh,n=>{const{children:r}=n;return r&&(n.children=r.reduce((i,s,o)=>{if(o===0)return[s];const u=i.at(-1);if(u&&u.isMark&&s.isMark){s=Ze(this,fg).call(this,s,u.type);const{children:c,...h}=s,{children:m,...g}=u;if(s.type===u.type&&c&&m&&JSON.stringify(h)===JSON.stringify(g)){const y={...g,children:[...m,...c]};return i.slice(0,-1).concat(Ze(this,jh).call(this,y))}}return i.concat(s)},[])),n});Ut(this,hg,n=>{const r={...n.props,type:n.type};return n.children&&(r.children=n.children),n.value&&(r.value=n.value),r});Ut(this,pg,(n,r)=>{let i="",s="";const o=n.children;let u=-1,c=-1;const h=g=>{g&&g.forEach((y,b)=>{y.type==="text"&&y.value&&(u<0&&(u=b),c=b)})};if(o){h(o);const g=o?.[c],y=o?.[u];if(g&&g.value.endsWith(" ")){const b=g.value,v=b.trimEnd();s=b.slice(v.length),g.value=v}if(y&&y.value.startsWith(" ")){const b=y.value,v=b.trimStart();i=b.slice(0,b.length-v.length),y.value=v}}i.length&&Ze(this,Vo).call(this,"text",void 0,i);const m=r();return s.length&&Ze(this,Vo).call(this,"text",void 0,s),m});Ut(this,Ru,(n=!1)=>{const r=this.close(),i=()=>Ze(this,Vo).call(this,r.type,r.children,r.value,r.props);return n?Ze(this,pg).call(this,r,i):i()});Ut(this,Vo,(n,r,i,s)=>{const o=jE.create(n,r,i,s),u=Ze(this,jh).call(this,Ze(this,hg).call(this,o));return this.push(u),u});Ut(this,dg,(n,r,i,s)=>n.isInSet(Ze(this,Ns))?this:(iu(this,Ns,n.addToSet(Ze(this,Ns))),this.openNode(r,i,{...s,isMark:!0})));Ut(this,$h,n=>{n.isInSet(Ze(this,Ns))&&(iu(this,Ns,n.type.removeFromSet(Ze(this,Ns))),Ze(this,Ru).call(this,!0))});this.openNode=(r,i,s)=>(this.open(jE.create(r,void 0,i,s)),this),this.closeNode=()=>(Ze(this,Ru).call(this),this),this.addNode=(r,i,s,o)=>(Ze(this,Vo).call(this,r,i,s,o),this),this.withMark=(r,i,s,o)=>(Ze(this,dg).call(this,r,i,s,o),this),this.closeMark=r=>(Ze(this,$h).call(this,r),this),this.build=()=>{let r=null;do r=Ze(this,Ru).call(this);while(this.size());return r},this.next=r=>$8(r)?(r.forEach(i=>{Ze(this,Ph).call(this,i)}),this):(Ze(this,Ph).call(this,r),this),this.toString=r=>r.stringify(this.build()),this.run=r=>(this.next(r),this),this.schema=n}},Ns=new WeakMap,Fh=new WeakMap,ug=new WeakMap,cg=new WeakMap,Ph=new WeakMap,fg=new WeakMap,jh=new WeakMap,hg=new WeakMap,pg=new WeakMap,Ru=new WeakMap,Vo=new WeakMap,dg=new WeakMap,$h=new WeakMap,Qo.create=(n,r)=>{const i=new Qo(n);return s=>(i.run(s),i.toString(r))},Qo);const pO=65535,dO=Math.pow(2,16);function J8(t,e){return t+e*dO}function $E(t){return t&pO}function H8(t){return(t-(t&pO))/dO}const mO=1,gO=2,Wd=4,yO=8;let UE=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&yO)>0}get deletedBefore(){return(this.delInfo&(mO|Wd))>0}get deletedAfter(){return(this.delInfo&(gO|Wd))>0}get deletedAcross(){return(this.delInfo&Wd)>0}},rl=class pu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&pu.empty)return pu.empty}recover(e){let n=0,r=$E(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+H8(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:m);if(r)return b;let v=e==(n<0?c:g)?null:J8(u/3,e-c),N=e==c?gO:e==g?mO:Wd;return(n<0?e!=c:e!=g)&&(N|=yO),new UE(b,N,v)}i+=m-h}return r?e+i:new UE(e+i,0,null)}touches(e,n){let r=0,i=$E(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],m=this.ranges[i+r];e(u,u+h,c,c+m),s+=m-h}}invert(){return new pu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?pu.empty:new pu(e<0?[0,-e,0]:[0,0,e])}};rl.empty=new rl([]);const T1=Object.create(null);let En=class{getMap(){return rl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=T1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in T1)throw new RangeError("Duplicate use of step JSON ID "+e);return T1[e]=n,n.prototype.jsonID=e,n}},jn=class yf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new yf(e,null)}static fail(e){return new yf(null,e)}static fromReplace(e,n,r,i){try{return yf.ok(e.replace(n,r,i))}catch(s){if(s instanceof wi)return yf.fail(s.message);throw s}}};function kS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(kS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return G.fromArray(r)}let xO=class xf extends En{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(kS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return jn.fromReplace(e,this.from,this.to,s)}invert(){return new bO(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new xf(n.pos,r.pos,this.mark)}merge(e){return e instanceof xf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new xf(n.from,n.to,e.markFromJSON(n.mark))}};En.jsonID("addMark",xO);let bO=class bf extends En{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(kS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return jn.fromReplace(e,this.from,this.to,r)}invert(){return new xO(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new bf(n.pos,r.pos,this.mark)}merge(e){return e instanceof bf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new bf(n.from,n.to,e.markFromJSON(n.mark))}};En.jsonID("removeMark",bO);let SO=class Sf extends En{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Sf(this.pos,n.marks[i]);return new Sf(this.pos,this.mark)}}return new kO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Sf(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Sf(n.pos,e.markFromJSON(n.mark))}};En.jsonID("addNodeMark",SO);let kO=class Wx extends En{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new SO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Wx(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Wx(n.pos,e.markFromJSON(n.mark))}};En.jsonID("removeNodeMark",kO);let q8=class Ao extends En{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Xx(e,this.from,this.to)?jn.fail("Structure replace would overwrite content"):jn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new rl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ao(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ao(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ao)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ao(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ao(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ao(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};En.jsonID("replace",q8);let K8=class Xd extends En{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Xx(e,this.from,this.gapFrom)||Xx(e,this.gapTo,this.to)))return jn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return jn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?jn.fromReplace(e,this.from,this.to,r):jn.fail("Content does not fit in gap")}getMap(){return new rl([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Xd(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Xd(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Xd(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};En.jsonID("replaceAround",K8);function Xx(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function G8(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let u=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(u>0?1:0),h=r.node(o),m=!1;if(s==1)m=h.canReplace(c,c,i);else{let g=h.contentMatchAt(c).findWrapping(i.firstChild.type);m=g&&h.canReplaceWith(c,c,g[0])}if(m)return u==0?r.pos:u<0?r.before(o+1):r.after(o+1)}return null}let Y8=class Qd extends En{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return jn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}getMap(){return rl.empty}invert(e){return new Qd(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Qd(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Qd(n.pos,n.attr,n.value)}};En.jsonID("attr",Y8);let W8=class Qx extends En{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return jn.ok(r)}getMap(){return rl.empty}invert(e){return new Qx(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Qx(n.attr,n.value)}};En.jsonID("docAttr",W8);let mh=class extends Error{};mh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};mh.prototype=Object.create(Error.prototype);mh.prototype.constructor=mh;mh.prototype.name="TransformError";const dn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},zu=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Zx=null;const ws=function(t,e,n){let r=Zx||(Zx=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},X8=function(){Zx=null},il=function(t,e,n,r){return n&&(JE(t,e,n,r,-1)||JE(t,e,n,r,1))},Q8=/^(img|br|input|textarea|hr)$/i;function JE(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Qr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Kh(t)||Q8.test(t.nodeName)||t.contentEditable=="false")return!1;e=dn(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Qr(t):0}else return!1}}function Qr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Z8(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Qr(t)}else if(t.parentNode&&!Kh(t))e=dn(t),t=t.parentNode;else return null}}function e7(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Kh(t))e=dn(t)+1,t=t.parentNode;else return null}}function t7(t,e,n){for(let r=e==0,i=e==Qr(t);r||i;){if(t==n)return!0;let s=dn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Qr(t)}}function Kh(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const wg=function(t){return t.focusNode&&il(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Oo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function n7(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function r7(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Qr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Qr(r.startContainer),r.startOffset)}}}const Pi=typeof navigator<"u"?navigator:null,HE=typeof document<"u"?document:null,Wa=Pi&&Pi.userAgent||"",eb=/Edge\/(\d+)/.exec(Wa),vO=/MSIE \d/.exec(Wa),tb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Wa),ur=!!(vO||tb||eb),Va=vO?document.documentMode:tb?+tb[1]:eb?+eb[1]:0,ei=!ur&&/gecko\/(\d+)/i.test(Wa);ei&&+(/Firefox\/(\d+)/.exec(Wa)||[0,0])[1];const nb=!ur&&/Chrome\/(\d+)/.exec(Wa),mn=!!nb,CO=nb?+nb[1]:0,kn=!ur&&!!Pi&&/Apple Computer/.test(Pi.vendor),Lu=kn&&(/Mobile\/\w+/.test(Wa)||!!Pi&&Pi.maxTouchPoints>2),Gr=Lu||(Pi?/Mac/.test(Pi.platform):!1),wO=Pi?/Win/.test(Pi.platform):!1,Ts=/Android \d/.test(Wa),Gh=!!HE&&"webkitFontSmoothing"in HE.documentElement.style,i7=Gh?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function s7(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function vs(t,e){return typeof t=="number"?t:t[e]}function a7(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function qE(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=zu(o);continue}let u=o,c=u==s.body,h=c?s7(s):a7(u),m=0,g=0;if(e.top<h.top+vs(r,"top")?g=-(h.top-e.top+vs(i,"top")):e.bottom>h.bottom-vs(r,"bottom")&&(g=e.bottom-e.top>h.bottom-h.top?e.top+vs(i,"top")-h.top:e.bottom-h.bottom+vs(i,"bottom")),e.left<h.left+vs(r,"left")?m=-(h.left-e.left+vs(i,"left")):e.right>h.right-vs(r,"right")&&(m=e.right-h.right+vs(i,"right")),m||g)if(c)s.defaultView.scrollBy(m,g);else{let b=u.scrollLeft,v=u.scrollTop;g&&(u.scrollTop+=g),m&&(u.scrollLeft+=m);let N=u.scrollLeft-b,T=u.scrollTop-v;e={left:e.left-N,top:e.top-T,right:e.right-N,bottom:e.bottom-T}}let y=c?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(y))break;o=y=="absolute"?o.offsetParent:zu(o)}}function o7(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let u=t.root.elementFromPoint(s,o);if(!u||u==t.dom||!t.dom.contains(u))continue;let c=u.getBoundingClientRect();if(c.top>=n-20){r=u,i=c.top;break}}return{refDOM:r,refTop:i,stack:EO(t.dom)}}function EO(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=zu(r));return e}function l7({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;NO(n,r==0?0:r-e)}function NO(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let su=null;function u7(t){if(t.setActive)return t.setActive();if(su)return t.focus(su);let e=EO(t);t.focus(su==null?{get preventScroll(){return su={preventScroll:!0},!0}}:void 0),su||(su=!1,NO(e,0))}function AO(t,e){let n,r=2e8,i,s=0,o=e.top,u=e.top,c,h;for(let m=t.firstChild,g=0;m;m=m.nextSibling,g++){let y;if(m.nodeType==1)y=m.getClientRects();else if(m.nodeType==3)y=ws(m).getClientRects();else continue;for(let b=0;b<y.length;b++){let v=y[b];if(v.top<=o&&v.bottom>=u){o=Math.max(v.bottom,o),u=Math.min(v.top,u);let N=v.left>e.left?v.left-e.left:v.right<e.left?e.left-v.right:0;if(N<r){n=m,r=N,i=N&&n.nodeType==3?{left:v.right<e.left?v.right:v.left,top:e.top}:e,m.nodeType==1&&N&&(s=g+(e.left>=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!c&&v.left<=e.left&&v.right>=e.left&&(c=m,h={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(s=g+1)}}return!n&&c&&(n=c,i=h,r=0),n&&n.nodeType==3?c7(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:AO(n,i)}function c7(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=Ca(r,1);if(o.top!=o.bottom&&vS(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function vS(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function f7(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function h7(t,e,n){let{node:r,offset:i}=AO(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function p7(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let u=t.docView.nearestDesc(s,!0),c;if(!u)return null;if(u.dom.nodeType==1&&(u.node.isBlock&&u.parent||!u.contentDOM)&&((c=u.dom.getBoundingClientRect()).width||c.height)&&(u.node.isBlock&&u.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(u.dom.nodeName)&&(!o&&c.left>r.left||c.top>r.top?i=u.posBefore:(!o&&c.right<r.left||c.bottom<r.top)&&(i=u.posAfter),o=!0),!u.contentDOM&&i<0&&!u.node.isText))return(u.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?u.posBefore:u.posAfter;s=u.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function TO(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let u=o.getClientRects();for(let c=0;c<u.length;c++){let h=u[c];if(vS(e,h))return TO(o,e,h)}}if((s=(s+1)%r)==i)break}return t}function d7(t,e){let n=t.dom.ownerDocument,r,i=0,s=r7(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),u;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let h=t.dom.getBoundingClientRect();if(!vS(e,h)||(o=TO(t.dom,e,h),!o))return null}if(kn)for(let h=o;r&&h;h=zu(h))h.draggable&&(r=void 0);if(o=f7(o,e),r){if(ei&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let m=r.childNodes[i],g;m.nodeName=="IMG"&&(g=m.getBoundingClientRect()).right<=e.left&&g.bottom>e.top&&i++}let h;Gh&&i&&r.nodeType==1&&(h=r.childNodes[i-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?u=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(u=p7(t,r,i,e))}u==null&&(u=h7(t,o,e));let c=t.docView.nearestDesc(o,!0);return{pos:u,inside:c?c.posAtStart-c.border:-1}}function KE(t){return t.top<t.bottom||t.left<t.right}function Ca(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(KE(r))return r}return Array.prototype.find.call(n,KE)||t.getBoundingClientRect()}const m7=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function MO(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Gh||ei;if(r.nodeType==3)if(o&&(m7.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let c=Ca(ws(r,i,i),n);if(ei&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let h=Ca(ws(r,i-1,i-1),-1);if(h.top==c.top){let m=Ca(ws(r,i,i+1),-1);if(m.top!=c.top)return Gc(m,m.left<h.left)}}return c}else{let c=i,h=i,m=n<0?1:-1;return n<0&&!i?(h++,m=-1):n>=0&&i==r.nodeValue.length?(c--,m=1):n<0?c--:h++,Gc(Ca(ws(r,c,h),m),m<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Qr(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return M1(c.getBoundingClientRect(),!1)}if(s==null&&i<Qr(r)){let c=r.childNodes[i];if(c.nodeType==1)return M1(c.getBoundingClientRect(),!0)}return M1(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Qr(r))){let c=r.childNodes[i-1],h=c.nodeType==3?ws(c,Qr(c)-(o?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(h)return Gc(Ca(h,1),!1)}if(s==null&&i<Qr(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let h=c?c.nodeType==3?ws(c,0,o?0:1):c.nodeType==1?c:null:null;if(h)return Gc(Ca(h,-1),!0)}return Gc(Ca(r.nodeType==3?ws(r):r,-n),n>=0)}function Gc(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function M1(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function OO(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function g7(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return OO(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let u=t.docView.nearestDesc(s,!0);if(!u)break;if(u.node.isBlock){s=u.contentDOM||u.dom;break}s=u.dom.parentNode}let o=MO(t,i.pos,1);for(let u=s.firstChild;u;u=u.nextSibling){let c;if(u.nodeType==1)c=u.getClientRects();else if(u.nodeType==3)c=ws(u,0,u.nodeValue.length).getClientRects();else continue;for(let h=0;h<c.length;h++){let m=c[h];if(m.bottom>m.top+1&&(n=="up"?o.top-m.top>(m.bottom-o.top)*2:m.bottom-o.bottom>(o.bottom-m.top)*2))return!1}}return!0})}const y7=/[\u0590-\u08ac]/;function x7(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,u=t.domSelection();return u?!y7.test(r.parent.textContent)||!u.modify?n=="left"||n=="backward"?s:o:OO(t,e,()=>{let{focusNode:c,focusOffset:h,anchorNode:m,anchorOffset:g}=t.domSelectionRange(),y=u.caretBidiLevel;u.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:N}=t.domSelectionRange(),T=v&&!b.contains(v.nodeType==1?v:v.parentNode)||c==v&&h==N;try{u.collapse(m,g),c&&(c!=m||h!=g)&&u.extend&&u.extend(c,h)}catch{}return y!=null&&(u.caretBidiLevel=y),T}):r.pos==r.start()||r.pos==r.end()}let GE=null,YE=null,WE=!1;function b7(t,e,n){return GE==e&&YE==n?WE:(GE=e,YE=n,WE=n=="up"||n=="down"?g7(t,e,n):x7(t,e,n))}const ti=0,XE=1,Io=2,ji=3;class Yh{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=ti,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>dn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let u=i.children[o];if(u.size){i=u;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],u=s+o.size;if(u>e||o instanceof DO){i=e-s;break}s=u}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof RO&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?dn(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?dn(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,u=0;;u++){let c=this.children[u],h=o+c.size;if(i==-1&&e<=h){let m=o+c.border;if(e>=m&&n<=h-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,m);e=o;for(let g=u;g>0;g--){let y=this.children[g-1];if(y.size&&y.dom.parentNode==this.contentDOM&&!y.emptyChildAt(1)){i=dn(y.dom)+1;break}e-=y.size}i==-1&&(i=0)}if(i>-1&&(h>n||u==this.children.length-1)){n=h;for(let m=u+1;m<this.children.length;m++){let g=this.children[m];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(-1)){s=dn(g.dom);break}n+=g.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=h}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let b=0,v=0;b<this.children.length;b++){let N=this.children[b],T=v+N.size;if(s>v&&o<T)return N.setSelection(e-v-N.border,n-v-N.border,r,i);v=T}let u=this.domFromPos(e,e?-1:1),c=n==e?u:this.domFromPos(n,n?-1:1),h=r.root.getSelection(),m=r.domSelectionRange(),g=!1;if((ei||kn)&&e==n){let{node:b,offset:v}=u;if(b.nodeType==3){if(g=!!(v&&b.nodeValue[v-1]==`
41
+ `),g&&v==b.nodeValue.length)for(let N=b,T;N;N=N.parentNode){if(T=N.nextSibling){T.nodeName=="BR"&&(u=c={node:T.parentNode,offset:dn(T)+1});break}let M=N.pmViewDesc;if(M&&M.node&&M.node.isBlock)break}}else{let N=b.childNodes[v-1];g=N&&(N.nodeName=="BR"||N.contentEditable=="false")}}if(ei&&m.focusNode&&m.focusNode!=c.node&&m.focusNode.nodeType==1){let b=m.focusNode.childNodes[m.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||g&&kn)&&il(u.node,u.offset,m.anchorNode,m.anchorOffset)&&il(c.node,c.offset,m.focusNode,m.focusOffset))return;let y=!1;if((h.extend||e==n)&&!(g&&ei)){h.collapse(u.node,u.offset);try{e!=n&&h.extend(c.node,c.offset),y=!0}catch{}}if(!y){if(e>n){let v=u;u=c,c=v}let b=document.createRange();b.setEnd(c.node,c.offset),b.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(b)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let u=r+s.border,c=o-s.border;if(e>=u&&n<=c){this.dirty=e==r||n==o?Io:XE,e==u&&n==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ji:s.markDirty(e-u,n-u);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Io:ji}r=o}this.dirty=Io}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Io:XE;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class RO extends Yh{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let u=document.createElement("span");u.appendChild(o),o=u}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==ti&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class S7 extends Yh{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class sl extends Yh{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=Gi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new sl(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ji||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ji&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=ti){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ti}}slice(e,n,r){let i=sl.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=ib(s,n,o,r)),e>0&&(s=ib(s,0,e,r));for(let u=0;u<s.length;u++)s[u].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Fa extends Yh{constructor(e,n,r,i,s,o,u,c,h){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=u}static create(e,n,r,i,s,o){let u=s.nodeViews[n.type.name],c,h=u&&u(n,s,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),m=h&&h.dom,g=h&&h.contentDOM;if(n.isText){if(!m)m=document.createTextNode(n.text);else if(m.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else m||({dom:m,contentDOM:g}=Gi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!g&&!n.isText&&m.nodeName!="BR"&&(m.hasAttribute("contenteditable")||(m.contentEditable="false"),n.type.spec.draggable&&(m.draggable=!0));let y=m;return m=zO(m,r,n),h?c=new k7(e,n,r,i,m,g||null,y,h,s,o+1):n.isText?new Eg(e,n,r,i,m,y,s):new Fa(e,n,r,i,m,g||null,y,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>G.empty)}return e}matchesNode(e,n,r){return this.dirty==ti&&e.eq(this.node)&&Dm(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,u=s&&s.pos<0,c=new C7(this,o&&o.node,e);N7(this.node,this.innerDeco,(h,m,g)=>{h.spec.marks?c.syncToMarks(h.spec.marks,r,e,m):h.type.side>=0&&!g&&c.syncToMarks(m==this.node.childCount?ut.none:this.node.child(m).marks,r,e,m),c.placeWidget(h,e,i)},(h,m,g,y)=>{c.syncToMarks(h.marks,r,e,y);let b;c.findNodeMatch(h,m,g,y)||u&&e.state.selection.from>i&&e.state.selection.to<i+h.nodeSize&&(b=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(h,m,g,b,e)||c.updateNextNode(h,m,g,e,y,i)||c.addNode(h,m,g,e,i),i+=h.nodeSize}),c.syncToMarks([],r,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Io)&&(o&&this.protectLocalComposition(e,o),IO(this.contentDOM,this.children,e),Lu&&A7(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof we)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,u=T7(this.node.content,o,r-n,i-n);return u<0?null:{node:s,pos:u,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new S7(this,s,n,i);e.input.compositionNodes.push(o),this.children=ib(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==ji||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ti}updateOuterDeco(e){if(Dm(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=_O(this.dom,this.nodeDOM,rb(this.outerDeco,this.node,n),rb(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function QE(t,e,n,r,i){zO(r,e,t);let s=new Fa(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Eg extends Fa{constructor(e,n,r,i,s,o,u){super(e,n,r,i,s,null,o,u,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==ji||this.dirty!=ti&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=ti||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ti,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Eg(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ji)}get domAtom(){return!1}isText(e){return this.node.text==e}}class DO extends Yh{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ti&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class k7 extends Fa{constructor(e,n,r,i,s,o,u,c,h,m){super(e,n,r,i,s,o,u,h,m),this.spec=c}update(e,n,r,i){if(this.dirty==ji)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function IO(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],u=o.dom;if(u.parentNode==t){for(;u!=r;)r=ZE(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(u,r);if(o instanceof sl){let c=r?r.previousSibling:t.lastChild;IO(o.contentDOM,o.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=ZE(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const $f=function(t){t&&(this.nodeName=t)};$f.prototype=Object.create(null);const _o=[new $f];function rb(t,e,n){if(t.length==0)return _o;let r=n?_o[0]:new $f,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new $f(o.nodeName));for(let u in o){let c=o[u];c!=null&&(n&&i.length==1&&i.push(r=new $f(e.isInline?"span":"div")),u=="class"?r.class=(r.class?r.class+" ":"")+c:u=="style"?r.style=(r.style?r.style+";":"")+c:u!="nodeName"&&(r[u]=c))}}}return i}function _O(t,e,n,r){if(n==_o&&r==_o)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],u=n[s];if(s){let c;u&&u.nodeName==o.nodeName&&i!=t&&(c=i.parentNode)&&c.nodeName.toLowerCase()==o.nodeName||(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(i),u=_o[0]),i=c}v7(i,u||_o[0],o)}return i}function v7(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function zO(t,e,n){return _O(t,t,_o,rb(e,n,t.nodeType!=1))}function Dm(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function ZE(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class C7{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=w7(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,u=Math.min(o,e.length);for(;s<u&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=ti,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let c=-1,h=this.top.children.length;i<this.preMatch.index&&(h=Math.min(this.index+3,h));for(let m=this.index;m<h;m++){let g=this.top.children[m];if(g.matchesMark(e[o])&&!this.isLocked(g.dom)){c=m;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let m=sl.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,m),this.top=m,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let u=this.index,c=Math.min(this.top.children.length,u+5);u<c;u++){let h=this.top.children[u];if(h.matchesNode(e,n,r)&&!this.preMatch.matched.has(h)){s=u;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==ji&&o.dom==o.contentDOM&&(o.dirty=Io),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let u=this.index;u<this.top.children.length;u++){let c=this.top.children[u];if(c instanceof Fa){let h=this.preMatch.matched.get(c);if(h!=null&&h!=s)return!1;let m=c.dom,g,y=this.isLocked(m)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=ji&&Dm(n,c.outerDeco));if(!y&&c.update(e,n,r,i))return this.destroyBetween(this.index,u),c.dom!=m&&(this.changed=!0),this.index++,!0;if(!y&&(g=this.recreateWrapper(c,e,n,r,i,o)))return this.destroyBetween(this.index,u),this.top.children[this.index]=g,g.contentDOM&&(g.dirty=Io,g.updateChildren(i,o+1),g.dirty=ti),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Dm(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let u=Fa.create(this.top,n,r,i,s,o);if(u.contentDOM){u.children=e.children,e.children=[];for(let c of u.children)c.parent=u}return e.destroy(),u}addNode(e,n,r,i,s){let o=Fa.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new RO(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof sl;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Eg)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((kn||mn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new DO(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function w7(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let u;for(;;)if(r){let h=n.children[r-1];if(h instanceof sl)n=h,r=h.children.length;else{u=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let c=u.node;if(c){if(c!=t.child(i-1))break;--i,s.set(u,i),o.push(u)}}return{index:i,matched:s,matches:o.reverse()}}function E7(t,e){return t.type.side-e.type.side}function N7(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let h=0;h<t.childCount;h++){let m=t.child(h);r(m,i,e.forChild(s,m),h),s+=m.nodeSize}return}let o=0,u=[],c=null;for(let h=0;;){let m,g;for(;o<i.length&&i[o].to==s;){let T=i[o++];T.widget&&(m?(g||(g=[m])).push(T):m=T)}if(m)if(g){g.sort(E7);for(let T=0;T<g.length;T++)n(g[T],h,!!c)}else n(m,h,!!c);let y,b;if(c)b=-1,y=c,c=null;else if(h<t.childCount)b=h,y=t.child(h++);else break;for(let T=0;T<u.length;T++)u[T].to<=s&&u.splice(T--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)u.push(i[o++]);let v=s+y.nodeSize;if(y.isText){let T=v;o<i.length&&i[o].from<T&&(T=i[o].from);for(let M=0;M<u.length;M++)u[M].to<T&&(T=u[M].to);T<v&&(c=y.cut(T-s),y=y.cut(0,T-s),v=T,b=-1)}else for(;o<i.length&&i[o].to<v;)o++;let N=y.isInline&&!y.isLeaf?u.filter(T=>!T.inline):u.slice();r(y,N,e.forChild(s,y),b),s=v}}function A7(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function T7(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),u=s;if(s+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<t.childCount;){let h=t.child(i++);if(s+=h.nodeSize,!h.isText)break;c+=h.text}if(s>=n){if(s>=r&&c.slice(r-e.length-u,r-u)==e)return r-e.length;let h=u<r?c.lastIndexOf(e,r-u-1):-1;if(h>=0&&h+e.length+u>=n)return u+h;if(n==r&&c.length>=r+e.length-u&&c.slice(r-u,r-u+e.length)==e)return r}}return-1}function ib(t,e,n,r,i){let s=[];for(let o=0,u=0;o<t.length;o++){let c=t[o],h=u,m=u+=c.size;h>=n||m<=e?s.push(c):(h<e&&s.push(c.slice(0,e-h,r)),i&&(s.push(i),i=void 0),m>n&&s.push(c.slice(n-h,c.size,r)))}return s}function CS(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let u=r.resolve(o),c,h;if(wg(n)){for(c=o;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&ge.isSelectable(g)&&i.parent&&!(g.isInline&&t7(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new ge(o==y?u:r.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=o,y=o;for(let b=0;b<n.rangeCount;b++){let v=n.getRangeAt(b);g=Math.min(g,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(g<0)return null;[c,o]=y==t.state.selection.anchor?[y,g]:[g,y],u=r.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let m=r.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=wS(t,m,u,g)}return h}function LO(t){return t.editable?t.hasFocus():VO(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Os(t,e=!1){let n=t.state.selection;if(BO(t,n),!!LO(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&mn){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&il(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)O7(t);else{let{anchor:r,head:i}=n,s,o;eN&&!(n instanceof we)&&(n.$from.parent.inlineContent||(s=tN(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=tN(t,n.to))),t.docView.setSelection(r,i,t,e),eN&&(s&&nN(s),o&&nN(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&M7(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const eN=kn||mn&&CO<63;function tN(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(kn&&i&&i.contentEditable=="false")return O1(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return O1(i);if(s)return O1(s)}}function O1(t){return t.contentEditable="true",kn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function nN(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function M7(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!LO(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function O7(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,dn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ur&&Va<=11&&(n.disabled=!0,n.disabled=!1)}function BO(t,e){if(e instanceof ge){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(rN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else rN(t)}function rN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function wS(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||we.between(e,n,r)}function iN(t){return t.editable&&!t.hasFocus()?!1:VO(t)}function VO(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function R7(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return il(e.node,e.offset,n.anchorNode,n.anchorOffset)}function sb(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ve.findFrom(s,e)}function Aa(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function sN(t,e,n){let r=t.state.selection;if(r instanceof we)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Aa(t,new we(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=sb(t.state,e);return i&&i instanceof ge?Aa(t,i):!1}else if(!(Gr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(u))&&!o.contentDOM?ge.isSelectable(s)?Aa(t,new ge(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Gh?Aa(t,new we(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ge&&r.node.isInline)return Aa(t,new we(e>0?r.$to:r.$from));{let i=sb(t.state,e);return i?Aa(t,i):!1}}}function Im(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Uf(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function au(t,e){return e<0?D7(t):I7(t)}function D7(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(ei&&n.nodeType==1&&r<Im(n)&&Uf(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(Uf(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(FO(n))break;{let u=n.previousSibling;for(;u&&Uf(u,-1);)i=n.parentNode,s=dn(u),u=u.previousSibling;if(u)n=u,r=Im(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?ab(t,n,r):i&&ab(t,i,s)}function I7(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Im(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(Uf(u,1))s=n,o=++r;else break}else{if(FO(n))break;{let u=n.nextSibling;for(;u&&Uf(u,1);)s=u.parentNode,o=dn(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=Im(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&ab(t,s,o)}function FO(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function _7(t,e){for(;t&&e==t.childNodes.length&&!Kh(t);)e=dn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function z7(t,e){for(;t&&!e&&!Kh(t);)e=dn(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function ab(t,e,n){if(e.nodeType!=3){let s,o;(o=_7(e,n))?(e=o,n=0):(s=z7(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(wg(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Os(t)},50)}function aN(t,e){let n=t.state.doc.resolve(e);if(!(mn||wO)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function oN(t,e,n){let r=t.state.selection;if(r instanceof we&&!r.empty||n.indexOf("s")>-1||Gr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=sb(t.state,e);if(o&&o instanceof ge)return Aa(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,u=r instanceof Hn?Ve.near(o,e):Ve.findFrom(o,e);return u?Aa(t,u):!1}return!1}function lN(t,e){if(!(t.state.selection instanceof we))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function uN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function L7(t){if(!kn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;uN(t,r,"true"),setTimeout(()=>uN(t,r,"false"),20)}return!1}function B7(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function V7(t,e){let n=e.keyCode,r=B7(e);if(n==8||Gr&&n==72&&r=="c")return lN(t,-1)||au(t,-1);if(n==46&&!e.shiftKey||Gr&&n==68&&r=="c")return lN(t,1)||au(t,1);if(n==13||n==27)return!0;if(n==37||Gr&&n==66&&r=="c"){let i=n==37?aN(t,t.state.selection.from)=="ltr"?-1:1:-1;return sN(t,i,r)||au(t,i)}else if(n==39||Gr&&n==70&&r=="c"){let i=n==39?aN(t,t.state.selection.from)=="ltr"?1:-1:1;return sN(t,i,r)||au(t,i)}else{if(n==38||Gr&&n==80&&r=="c")return oN(t,-1,r)||au(t,-1);if(n==40||Gr&&n==78&&r=="c")return L7(t)||oN(t,1,r)||au(t,1);if(r==(Gr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ES(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let o=t.someProp("clipboardSerializer")||Gi.fromSchema(t.state.schema),u=HO(),c=u.createElement("div");c.appendChild(o.serializeFragment(r,{document:u}));let h=c.firstChild,m,g=0;for(;h&&h.nodeType==1&&(m=JO[h.nodeName.toLowerCase()]);){for(let b=m.length-1;b>=0;b--){let v=u.createElement(m[b]);for(;c.firstChild;)v.appendChild(c.firstChild);c.appendChild(v),g++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${s}${g?` -${g}`:""} ${JSON.stringify(n)}`);let y=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
42
+
43
+ `);return{dom:c,text:y,slice:e}}function PO(t,e,n,r,i){let s=i.parent.type.spec.code,o,u;if(!n&&!e)return null;let c=!!e&&(r||s||!n);if(c){if(t.someProp("transformPastedText",y=>{e=y(e,s||r,t)}),s)return u=new H(G.from(t.state.schema.text(e.replace(/\r\n?/g,`
44
+ `))),0,0),t.someProp("transformPasted",y=>{u=y(u,t,!0)}),u;let g=t.someProp("clipboardTextParser",y=>y(e,i,r,t));if(g)u=g;else{let y=i.marks(),{schema:b}=t.state,v=Gi.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(N=>{let T=o.appendChild(document.createElement("p"));N&&T.appendChild(v.serializeNode(b.text(N,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=$7(n),Gh&&U7(o);let h=o&&o.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let g=+m[3];g>0;g--){let y=o.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;o=y}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||$a.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||m),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!F7.test(y.parentNode.nodeName)?{ignore:!0}:null}})),m)u=J7(cN(u,+m[1],+m[2]),m[4]);else if(u=H.maxOpen(P7(u.content,i),!0),u.openStart||u.openEnd){let g=0,y=0;for(let b=u.content.firstChild;g<u.openStart&&!b.type.spec.isolating;g++,b=b.firstChild);for(let b=u.content.lastChild;y<u.openEnd&&!b.type.spec.isolating;y++,b=b.lastChild);u=cN(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const F7=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function P7(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(u=>{if(!o)return;let c=i.findWrapping(u.type),h;if(!c)return o=null;if(h=o.length&&s.length&&$O(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=UO(o[o.length-1],s.length));let m=jO(u,c);o.push(m),i=i.matchType(m.type),s=c}}),o)return G.from(o)}return t}function jO(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,G.from(t));return t}function $O(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=$O(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(G.from(jO(n,t,i+1))))}}function UO(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,UO(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(G.empty,!0);return t.copy(n.append(r))}function ob(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,u=o.content;return t.childCount>1&&(s=0),i<r-1&&(u=ob(u,e,n,r,i+1,s)),i>=n&&(u=e<0?o.contentMatchAt(0).fillBefore(u,s<=i).append(u):u.append(o.contentMatchAt(o.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function cN(t,e,n){return e<t.openStart&&(t=new H(ob(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new H(ob(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const JO={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let fN=null;function HO(){return fN||(fN=document.implementation.createHTMLDocument("title"))}let R1=null;function j7(t){let e=window.trustedTypes;return e?(R1||(R1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),R1.createHTML(t)):t}function $7(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=HO().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&JO[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=j7(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function U7(t){let e=t.querySelectorAll(mn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function J7(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let u=r.length-2;u>=0;u-=2){let c=n.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=G.from(c.create(r[u+1],i)),s++,o++}return new H(i,s,o)}const Kn={},Gn={},H7={touchstart:!0,touchmove:!0};class q7{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function K7(t){for(let e in Kn){let n=Kn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Y7(t,r)&&!NS(t,r)&&(t.editable||!(r.type in Gn))&&n(t,r)},H7[e]?{passive:!0}:void 0)}kn&&t.dom.addEventListener("input",()=>null),lb(t)}function Ia(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function G7(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function lb(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>NS(t,r))})}function NS(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Y7(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function W7(t,e){!NS(t,e)&&Kn[e.type]&&(t.editable||!(e.type in Gn))&&Kn[e.type](t,e)}Gn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!KO(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ts&&mn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Lu&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Oo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||V7(t,n)?n.preventDefault():Ia(t,"key")};Gn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Gn.keypress=(t,e)=>{let n=e;if(KO(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Gr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof we)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Ng(t){return{left:t.clientX,top:t.clientY}}function X7(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function AS(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,u=>o>s.depth?u(t,n,s.nodeAfter,s.before(o),i,!0):u(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Au(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Q7(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ge.isSelectable(r)?(Au(t,new ge(n)),!0):!1}function Z7(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ge&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let u=o>s.depth?s.nodeAfter:s.node(o);if(ge.isSelectable(u)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Au(t,ge.create(t.state.doc,i)),!0):!1}function eV(t,e,n,r,i){return AS(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?Z7(t,n):Q7(t,n))}function tV(t,e,n,r){return AS(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function nV(t,e,n,r){return AS(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||rV(t,n,r)}function rV(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Au(t,we.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(o.inlineContent)Au(t,we.create(r,u+1,u+1+o.content.size));else if(ge.isSelectable(o))Au(t,ge.create(r,u));else continue;return!0}}function TS(t){return _m(t)}const qO=Gr?"metaKey":"ctrlKey";Kn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=TS(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&X7(n,t.input.lastClick)&&!n[qO]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Ng(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new iV(t,o,n,!!r)):(s=="doubleClick"?tV:nV)(t,o.pos,o.inside,n)?n.preventDefault():Ia(t,"pointer"))};let iV=class{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[qO],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let m=e.state.doc.resolve(n.pos);s=m.parent,o=m.depth?m.before():0}const u=i?null:r.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||h instanceof ge&&h.from<=o&&h.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ei&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ia(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Os(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ng(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ia(this.view,"pointer"):eV(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||kn&&this.mightDrag&&!this.mightDrag.node.isAtom||mn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Au(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ia(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ia(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};Kn.touchstart=t=>{t.input.lastTouch=Date.now(),TS(t),Ia(t,"pointer")};Kn.touchmove=t=>{t.input.lastTouch=Date.now(),Ia(t,"pointer")};Kn.contextmenu=t=>TS(t);function KO(t,e){return t.composing?!0:kn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const sV=Ts?5e3:-1;Gn.compositionstart=Gn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof we&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||mn&&wO&&aV(t)))t.markCursor=t.state.storedMarks||n.marks(),_m(t,!0),t.markCursor=null;else if(_m(t,!e.selection.empty),ei&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let u=t.domSelection();u&&u.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}GO(t,sV)};function aV(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Gn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,GO(t,20))};function GO(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>_m(t),e))}function YO(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=lV());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function oV(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Z8(e.focusNode,e.focusOffset),r=e7(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function lV(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function _m(t,e=!1){if(!(Ts&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),YO(t),e||t.docView&&t.docView.dirty){let n=CS(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function uV(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const gh=ur&&Va<15||Lu&&i7<604;Kn.copy=Gn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=gh?null:n.clipboardData,o=r.content(),{dom:u,text:c}=ES(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):uV(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function cV(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function fV(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?yh(t,r.value,null,i,e):yh(t,r.textContent,r.innerHTML,i,e)},50)}function yh(t,e,n,r,i){let s=PO(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||H.empty)))return!0;if(!s)return!1;let o=cV(s),u=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function WO(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Gn.paste=(t,e)=>{let n=e;if(t.composing&&!Ts)return;let r=gh?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&yh(t,WO(r),r.getData("text/html"),i,n)?n.preventDefault():fV(t,n)};let XO=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const hV=Gr?"altKey":"ctrlKey";function QO(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[hV]}Kn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Ng(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ge?i.to-1:i.to))){if(r&&r.mightDrag)o=ge.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let g=t.docView.nearestDesc(n.target,!0);g&&g.node.type.spec.draggable&&g!=t.docView&&(o=ge.create(t.state.doc,g.posBefore))}}let u=(o||t.state.selection).content(),{dom:c,text:h,slice:m}=ES(t,u);(!n.dataTransfer.files.length||!mn||CO>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(gh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",gh||n.dataTransfer.setData("text/plain",h),t.dragging=new XO(m,QO(t,n),o)};Kn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Gn.dragover=Gn.dragenter=(t,e)=>e.preventDefault();Gn.drop=(t,e)=>{try{pV(t,e,t.dragging)}finally{t.dragging=null}};function pV(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Ng(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=PO(t,WO(e.dataTransfer),gh?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&QO(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||H.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?G8(t.state.doc,i.pos,s):i.pos;u==null&&(u=i.pos);let c=t.state.tr;if(o){let{node:b}=n;b?b.replace(c):c.deleteSelection()}let h=c.mapping.map(u),m=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(m?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(m&&ge.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new ge(y));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((v,N,T,M)=>b=M),c.setSelection(wS(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Kn.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Os(t)},20))};Kn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Kn.beforeinput=(t,e)=>{if(mn&&Ts&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Oo(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Gn)Kn[t]=Gn[t];function xh(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}let hN=class ZO{constructor(e,n){this.toDOM=e,this.spec=n||jo,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Ha(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ZO&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&xh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Jf=class ub{constructor(e,n){this.attrs=e,this.spec=n||jo}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ha(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ub&&xh(this.attrs,e.attrs)&&xh(this.spec,e.spec)}static is(e){return e.type instanceof ub}destroy(){}},dV=class e3{constructor(e,n){this.attrs=e,this.spec=n||jo}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Ha(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof e3&&xh(this.attrs,e.attrs)&&xh(this.spec,e.spec)}destroy(){}},Ha=class kf{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new kf(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new kf(e,e,new hN(n,r))}static inline(e,n,r,i){return new kf(e,n,new Jf(r,i))}static node(e,n,r,i){return new kf(e,n,new dV(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Jf}get widget(){return this.type instanceof hN}};const du=[],jo={};let ni=class wa{constructor(e,n){this.local=e.length?e:du,this.children=n.length?n:du}static create(e,n){return n.length?zm(n,e,0,jo):xn}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let u=this.local[o];u.from<=n&&u.to>=e&&(!s||s(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let u=this.children[o]+1;this.children[o+2].findInner(e-u,n-u,r,i+u,s)}}map(e,n,r){return this==xn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||jo)}mapInner(e,n,r,i,s){let o;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(n,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?mV(this.children,o||[],e,n,r,i,s):o?new wa(o.sort($o),du):xn}add(e,n){return n.length?this==xn?wa.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((u,c)=>{let h=c+r,m;if(m=r3(n,u,h)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(u,m,h+1):i.splice(s,0,c,c+u.nodeSize,zm(m,u,h+1,jo)),s+=3}});let o=n3(s?i3(n):n,-r);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new wa(o.length?this.local.concat(o).sort($o):this.local,i||this.children)}remove(e){return e.length==0||this==xn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,u=r[s]+n,c=r[s+1]+n;for(let m=0,g;m<e.length;m++)(g=e[m])&&g.from>u&&g.to<c&&(e[m]=null,(o||(o=[])).push(g));if(!o)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(o,u+1);h!=xn?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let u=0;u<i.length;u++)i[u].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new wa(i,r):xn}forChild(e,n){if(this==xn)return this;if(n.isLeaf)return wa.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=this.children[u+2]);break}let s=e+1,o=s+n.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<o&&c.to>s&&c.type instanceof Jf){let h=Math.max(s,c.from)-s,m=Math.min(o,c.to)-s;h<m&&(i||(i=[])).push(c.copy(h,m))}}if(i){let u=new wa(i.sort($o),du);return r?new t3([u,r]):u}return r||xn}eq(e){if(this==e)return!0;if(!(e instanceof wa)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return MS(this.localsInner(e))}localsInner(e){if(this==xn)return du;if(e.inlineContent||!this.local.some(Jf.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Jf||n.push(this.local[r]);return n}forEachSet(e){e(this)}};ni.empty=new ni([],[]);ni.removeOverlap=MS;const xn=ni.empty;let t3=class mu{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,jo));return mu.from(r)}forChild(e,n){if(n.isLeaf)return ni.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=xn&&(s instanceof mu?r=r.concat(s.members):r.push(s))}return mu.from(r)}eq(e){if(!(e instanceof mu)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?MS(r?n:n.sort($o)):du}static from(e){switch(e.length){case 0:return xn;case 1:return e[0];default:return new mu(e.every(n=>n instanceof ni)?e:e.reduce((n,r)=>n.concat(r instanceof ni?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function mV(t,e,n,r,i,s,o){let u=t.slice();for(let h=0,m=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,b,v,N)=>{let T=N-v-(b-y);for(let M=0;M<u.length;M+=3){let j=u[M+1];if(j<0||y>j+m-g)continue;let P=u[M]+m-g;b>=P?u[M+1]=y<=P?-2:-1:y>=m&&T&&(u[M]+=T,u[M+1]+=T)}g+=T}),m=n.maps[h].map(m,-1)}let c=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){c=!0,u[h+1]=-1;continue}let m=n.map(t[h]+s),g=m-i;if(g<0||g>=r.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),b=y-i,{index:v,offset:N}=r.content.findIndex(g),T=r.maybeChild(v);if(T&&N==g&&N+T.nodeSize==b){let M=u[h+2].mapInner(n,T,m+1,t[h]+s+1,o);M!=xn?(u[h]=g,u[h+1]=b,u[h+2]=M):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=gV(u,t,e,n,i,s,o),m=zm(h,r,0,o);e=m.local;for(let g=0;g<u.length;g+=3)u[g+1]<0&&(u.splice(g,3),g-=3);for(let g=0,y=0;g<m.children.length;g+=3){let b=m.children[g];for(;y<u.length&&u[y]<b;)y+=3;u.splice(y,0,m.children[g],m.children[g+1],m.children[g+2])}}return new ni(e.sort($o),u)}function n3(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Ha(i.from+e,i.to+e,i.type))}return n}function gV(t,e,n,r,i,s,o){function u(c,h){for(let m=0;m<c.local.length;m++){let g=c.local[m].map(r,i,h);g?n.push(g):o.onRemove&&o.onRemove(c.local[m].spec)}for(let m=0;m<c.children.length;m+=3)u(c.children[m+2],c.children[m]+h+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&u(t[c+2],e[c]+s+1);return n}function r3(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function i3(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function zm(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=r3(t,u,c+n);if(h){s=!0;let m=zm(h,u,n+c+1,r);m!=xn&&i.push(c,c+u.nodeSize,m)}});let o=n3(s?i3(t):t,-n).sort($o);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||(r.onRemove&&r.onRemove(o[u].spec),o.splice(u--,1));return o.length||i.length?new ni(o,i):xn}function $o(t,e){return t.from-e.from||t.to-e.to}function MS(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),pN(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),pN(e,i,r.copy(s.from,r.to)));break}}}return e}function pN(t,e,n){for(;e<t.length&&$o(n,t[e])>0;)e++;t.splice(e,0,n)}function D1(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=xn&&e.push(r)}),t.cursorWrapper&&e.push(ni.create(t.state.doc,[t.cursorWrapper.deco])),t3.from(e)}const yV={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},xV=ur&&Va<=11;class bV{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class SV{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bV,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ur&&Va<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():kn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),xV&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,yV)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(iN(this.view)){if(this.suppressingSelectionUpdates)return Os(this.view);if(ur&&Va<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&il(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=zu(s))n.add(s);for(let s=e.anchorNode;s;s=zu(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&iN(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,u=!1,c=[];if(e.editable)for(let m=0;m<n.length;m++){let g=this.registerMutation(n[m],c);g&&(s=s<0?g.from:Math.min(g.from,s),o=o<0?g.to:Math.max(g.to,o),g.typeOver&&(u=!0))}if(c.some(m=>m.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let m of c)if(m.nodeName=="BR"&&m.parentNode){let g=m.nextSibling;for(;g&&g.nodeType==1;){if(g.contentEditable=="false"){m.parentNode.removeChild(m);break}g=g.firstChild}}}else if(ei&&c.length){let m=c.filter(g=>g.nodeName=="BR");if(m.length==2){let[g,y]=m;g.parentNode&&g.parentNode.parentNode==y.parentNode?y.remove():g.remove()}else{let{focusNode:g}=this.currentSelection;for(let y of m){let b=y.parentNode;b&&b.nodeName=="LI"&&(!g||CV(e,g)!=b)&&y.remove()}}}let h=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&wg(r)&&(h=CS(e))&&h.eq(Ve.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Os(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),kV(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,wV(e,c)),this.handleDOMChange(s,o,u,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Os(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let m=0;m<e.addedNodes.length;m++){let g=e.addedNodes[m];n.push(g),g.nodeType==3&&(this.lastChangedTextNode=g)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ur&&Va<=11&&e.addedNodes.length)for(let m=0;m<e.addedNodes.length;m++){let{previousSibling:g,nextSibling:y}=e.addedNodes[m];(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(i=g),(!y||Array.prototype.indexOf.call(e.addedNodes,y)<0)&&(s=y)}let o=i&&i.parentNode==e.target?dn(i)+1:0,u=r.localPosFromDOM(e.target,o,-1),c=s&&s.parentNode==e.target?dn(s):e.target.childNodes.length,h=r.localPosFromDOM(e.target,c,1);return{from:u,to:h}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let dN=new WeakMap,mN=!1;function kV(t){if(!dN.has(t)&&(dN.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=ei,mN)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),mN=!0}}function gN(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return il(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function vV(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return gN(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?gN(t,n):null}function CV(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function wV(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let u=o;for(;;){let c=u.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;u=c}u.insertBefore(s,u.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function EV(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:u}=t.docView.parseRange(e,n),c=t.domSelectionRange(),h,m=c.anchorNode;if(m&&t.dom.contains(m.nodeType==1?m:m.parentNode)&&(h=[{node:m,offset:c.anchorOffset}],wg(c)||h.push({node:c.focusNode,offset:c.focusOffset})),mn&&t.input.lastKeyCode===8)for(let T=s;T>i;T--){let M=r.childNodes[T-1],j=M.pmViewDesc;if(M.nodeName=="BR"&&!j){s=T;break}if(!j||j.size)break}let g=t.state.doc,y=t.someProp("domParser")||$a.fromSchema(t.state.schema),b=g.resolve(o),v=null,N=y.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:i,to:s,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:NV,context:b});if(h&&h[0].pos!=null){let T=h[0].pos,M=h[1]&&h[1].pos;M==null&&(M=T),v={anchor:T+o,head:M+o}}return{doc:N,sel:v,from:o,to:u}}function NV(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(kn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||kn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const AV=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function TV(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let z=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,q=CS(t,z);if(q&&!t.state.selection.eq(q)){if(mn&&Ts&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",K=>K(t,Oo(13,"Enter"))))return;let ie=t.state.tr.setSelection(q);z=="pointer"?ie.setMeta("pointer",!0):z=="key"&&ie.scrollIntoView(),s&&ie.setMeta("composition",s),t.dispatch(ie)}return}let o=t.state.doc.resolve(e),u=o.sharedDepth(n);e=o.before(u+1),n=t.state.doc.resolve(n).after(u+1);let c=t.state.selection,h=EV(t,e,n),m=t.state.doc,g=m.slice(h.from,h.to),y,b;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(y=t.state.selection.to,b="end"):(y=t.state.selection.from,b="start"),t.input.lastKeyCode=null;let v=RV(g.content,h.doc.content,h.from,y,b);if(v&&t.input.domChangeCount++,(Lu&&t.input.lastIOSEnter>Date.now()-225||Ts)&&i.some(z=>z.nodeType==1&&!AV.test(z.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",z=>z(t,Oo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&c instanceof we&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))v={start:c.from,endA:c.to,endB:c.to};else{if(h.sel){let z=yN(t,t.state.doc,h.sel);if(z&&!z.eq(t.state.selection)){let q=t.state.tr.setSelection(z);s&&q.setMeta("composition",s),t.dispatch(q)}}return}t.state.selection.from<t.state.selection.to&&v.start==v.endB&&t.state.selection instanceof we&&(v.start>t.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?v.start=t.state.selection.from:v.endA<t.state.selection.to&&v.endA>=t.state.selection.to-2&&t.state.selection.to<=h.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),ur&&Va<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>h.from&&h.doc.textBetween(v.start-h.from-1,v.start-h.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let N=h.doc.resolveNoCache(v.start-h.from),T=h.doc.resolveNoCache(v.endB-h.from),M=m.resolve(v.start),j=N.sameParent(T)&&N.parent.inlineContent&&M.end()>=v.endA;if((Lu&&t.input.lastIOSEnter>Date.now()-225&&(!j||i.some(z=>z.nodeName=="DIV"||z.nodeName=="P"))||!j&&N.pos<h.doc.content.size&&(!N.sameParent(T)||!N.parent.inlineContent)&&N.pos<T.pos&&!/\S/.test(h.doc.textBetween(N.pos,T.pos,"","")))&&t.someProp("handleKeyDown",z=>z(t,Oo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&OV(m,v.start,v.endA,N,T)&&t.someProp("handleKeyDown",z=>z(t,Oo(8,"Backspace")))){Ts&&mn&&t.domObserver.suppressSelectionUpdates();return}mn&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),Ts&&!j&&N.start()!=T.start()&&T.parentOffset==0&&N.depth==T.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,T=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(z){return z(t,Oo(13,"Enter"))})},20));let P=v.start,J=v.endA,L=z=>{let q=z||t.state.tr.replace(P,J,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let ie=yN(t,q.doc,h.sel);ie&&!(mn&&t.composing&&ie.empty&&(v.start!=v.endB||t.input.lastChromeDelete<Date.now()-100)&&(ie.head==P||ie.head==q.mapping.map(J)-1)||ur&&ie.empty&&ie.head==P)&&q.setSelection(ie)}return s&&q.setMeta("composition",s),q.scrollIntoView()},C;if(j)if(N.pos==T.pos){ur&&Va<=11&&N.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Os(t),20));let z=L(t.state.tr.delete(P,J)),q=m.resolve(v.start).marksAcross(m.resolve(v.endA));q&&z.ensureMarks(q),t.dispatch(z)}else if(v.endA==v.endB&&(C=MV(N.parent.content.cut(N.parentOffset,T.parentOffset),M.parent.content.cut(M.parentOffset,v.endA-M.start())))){let z=L(t.state.tr);C.type=="add"?z.addMark(P,J,C.mark):z.removeMark(P,J,C.mark),t.dispatch(z)}else if(N.parent.child(N.index()).isText&&N.index()==T.index()-(T.textOffset?0:1)){let z=N.parent.textBetween(N.parentOffset,T.parentOffset),q=()=>L(t.state.tr.insertText(z,P,J));t.someProp("handleTextInput",ie=>ie(t,P,J,z,q))||t.dispatch(q())}else t.dispatch(L());else t.dispatch(L())}function yN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:wS(t,e.resolve(n.anchor),e.resolve(n.head))}function MV(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,u,c;for(let m=0;m<r.length;m++)i=r[m].removeFromSet(i);for(let m=0;m<n.length;m++)s=n[m].removeFromSet(s);if(i.length==1&&s.length==0)u=i[0],o="add",c=m=>m.mark(u.addToSet(m.marks));else if(i.length==0&&s.length==1)u=s[0],o="remove",c=m=>m.mark(u.removeFromSet(m.marks));else return null;let h=[];for(let m=0;m<e.childCount;m++)h.push(c(e.child(m)));if(G.from(h).eq(t))return{mark:u,type:o}}function OV(t,e,n,r,i){if(n-e<=i.pos-r.pos||I1(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let u=s.nodeAfter;return u!=null&&n==e+u.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(I1(s,!0,!0));return!o.parent.isTextblock||o.pos>n||I1(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function I1(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function RV(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:u}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let c=Math.max(0,s-Math.min(o,u));r-=o+c-s}if(o<s&&t.size<e.size){let c=r<=s&&r>=o?s-r:0;s-=c,s&&s<e.size&&xN(e.textBetween(s-1,s+1))&&(s+=c?1:-1),u=s+(u-o),o=s}else if(u<s){let c=r<=s&&r>=u?s-r:0;s-=c,s&&s<t.size&&xN(t.textBetween(s-1,s+1))&&(s+=c?1:-1),o=s+(o-u),u=s}return{start:s,endA:o,endB:u}}function xN(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class s3{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new q7,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(CN),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=kN(this),SN(this),this.nodeViews=vN(this),this.docView=QE(this.state.doc,bN(this),D1(this),this.dom,this),this.domObserver=new SV(this,(r,i,s,o)=>TV(this,r,i,s,o)),this.domObserver.start(),K7(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&lb(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(CN),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(YO(this),o=!0),this.state=e;let u=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(u||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=vN(this);IV(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(u||n.handleDOMEvents!=this._props.handleDOMEvents)&&lb(this),this.editable=kN(this),SN(this);let c=D1(this),h=bN(this),m=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",g=s||!this.docView.matchesNode(e.doc,h,c);(g||!e.selection.eq(i.selection))&&(o=!0);let y=m=="preserve"&&o&&this.dom.style.overflowAnchor==null&&o7(this);if(o){this.domObserver.stop();let b=g&&(ur||mn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&DV(i.selection,e.selection);if(g){let v=mn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=oV(this)),(s||!this.docView.update(e.doc,h,c,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=QE(e.doc,h,c,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&R7(this))?Os(this,b):(BO(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),m=="reset"?this.dom.scrollTop=0:m=="to selection"?this.scrollToSelection():y&&l7(y)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ge){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&qE(this,n.getBoundingClientRect(),e)}else qE(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new XO(e.slice,e.move,i<0?void 0:ge.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let u=this.directPlugins[o].props[e];if(u!=null&&(i=n?n(u):u))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let u=s[o].props[e];if(u!=null&&(i=n?n(u):u))return i}}hasFocus(){if(ur){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&u7(this.dom),Os(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return d7(this,e)}coordsAtPos(e,n=1){return MO(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return b7(this,n||this.state,e)}pasteHTML(e,n){return yh(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return yh(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return ES(this,e)}destroy(){this.docView&&(G7(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],D1(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,X8())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return W7(this,e)}domSelectionRange(){let e=this.domSelection();return e?kn&&this.root.nodeType===11&&n7(this.dom.ownerDocument)==this.dom&&vV(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}s3.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function bN(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ha.node(0,t.state.doc.content.size,e)]}function SN(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ha.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function kN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function DV(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function vN(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function IV(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function CN(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function Vs(t,e){return t.meta={package:"@milkdown/core",group:"System",...e},t}var a3={text:(t,e,n,r)=>{const i=t.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(t,e,n,r)=>{const i=t.marker||n.options.strong||"*",s=n.enter("strong"),o=n.createTracker(r);let u=o.move(i+i);return u+=o.move(n.containerPhrasing(t,{before:u,after:i,...o.current()})),u+=o.move(i+i),s(),u},emphasis:(t,e,n,r)=>{const i=t.marker||n.options.emphasis||"*",s=n.enter("emphasis"),o=n.createTracker(r);let u=o.move(i);return u+=o.move(n.containerPhrasing(t,{before:u,after:i,...o.current()})),u+=o.move(i),s(),u}},sn=st({},"editorView"),vf=st({},"editorState"),_1=st([],"initTimer"),wN=st({},"editor"),bh=st([],"inputRules"),_s=st([],"prosePlugins"),Sh=st([],"remarkPlugins"),kh=st([],"nodeView"),vh=st([],"markView"),Uo=st(wm().use(vm).use(Ox),"remark"),Hf=st({handlers:a3,encode:[]},"remarkStringifyOptions"),Zd=Ki("ConfigReady");function _V(t){const e=n=>(n.record(Zd),async()=>(await t(n),n.done(Zd),()=>{n.clearTimer(Zd)}));return Vs(e,{displayName:"Config"}),e}var Jo=Ki("InitReady");function zV(t){const e=n=>(n.inject(wN,t).inject(_s,[]).inject(Sh,[]).inject(bh,[]).inject(kh,[]).inject(vh,[]).inject(Hf,{handlers:a3,encode:[]}).inject(Uo,wm().use(vm).use(Ox)).inject(_1,[Zd]).record(Jo),async()=>{await n.waitTimers(_1);const r=n.get(Hf);return n.set(Uo,wm().use(vm).use(Ox,r)),n.done(Jo),()=>{n.remove(wN).remove(_s).remove(Sh).remove(bh).remove(kh).remove(vh).remove(Hf).remove(Uo).remove(_1).clearTimer(Jo)}});return Vs(e,{displayName:"Init"}),e}var qn=Ki("SchemaReady"),z1=st([],"schemaTimer"),Rs=st({},"schema"),qf=st([],"nodes"),Kf=st([],"marks");function EN(t){return{...t,parseDOM:t.parseDOM?.map(e=>({priority:t.priority,...e}))}}var o3=t=>(t.inject(Rs,{}).inject(qf,[]).inject(Kf,[]).inject(z1,[Jo]).record(qn),async()=>{await t.waitTimers(z1);const e=t.get(Uo),n=t.get(Sh).reduce((i,s)=>i.use(s.plugin,s.options),e);t.set(Uo,n);const r=new Y9({nodes:Object.fromEntries(t.get(qf).map(([i,s])=>[i,EN(s)])),marks:Object.fromEntries(t.get(Kf).map(([i,s])=>[i,EN(s)]))});return t.set(Rs,r),t.done(qn),()=>{t.remove(Rs).remove(qf).remove(Kf).remove(z1).clearTimer(qn)}});Vs(o3,{displayName:"Schema"});var l3=class{constructor(){this.setCtx=t=>{this.#e=t},this.chain=()=>{if(this.#e==null)throw t1();const t=this.#e,e=[],n=this.get.bind(this),r={run:()=>{const s=$u(...e),o=t.get(sn);return s(o.state,o.dispatch,o)},inline:s=>(e.push(s),r),pipe:i.bind(this)};function i(s,o){const u=n(s);return e.push(u(o)),r}return r}}#t=new CT;#e=null;get ctx(){return this.#e}create(t,e){const n=t.create(this.#t.sliceMap);return n.set(e),n}get(t){return this.#t.get(t).get()}remove(t){return this.#t.remove(t)}call(t,e){if(this.#e==null)throw t1();const n=this.get(t)(e),r=this.#e.get(sn);return n(r.state,r.dispatch,r)}inline(t){if(this.#e==null)throw t1();const e=this.#e.get(sn);return t(e.state,e.dispatch,e)}};function LV(t="cmdKey"){return st((()=>()=>!1),t)}var xt=st(new l3,"commands"),L1=st([qn],"commandsTimer"),Gf=Ki("CommandsReady"),u3=t=>{const e=new l3;return e.setCtx(t),t.inject(xt,e).inject(L1,[qn]).record(Gf),async()=>(await t.waitTimers(L1),t.done(Gf),()=>{t.remove(xt).remove(L1).clearTimer(Gf)})};Vs(u3,{displayName:"Commands"});function BV(t){return t.Backspace=$u(y8,dS,PB,qM),t}var c3=class{constructor(){this.setCtx=t=>{this.#t=t},this.add=t=>(this.#e.push(t),()=>{this.#e=this.#e.filter(e=>e!==t)}),this.addObjectKeymap=t=>{const e=[];return Object.entries(t).forEach(([n,r])=>{if(typeof r=="function"){const i={key:n,onRun:()=>r};this.#e.push(i),e.push(()=>{this.#e=this.#e.filter(s=>s!==i)})}else this.#e.push(r),e.push(()=>{this.#e=this.#e.filter(i=>i!==r)})}),()=>{e.forEach(n=>n())}},this.addBaseKeymap=()=>{const t=BV(r8);return this.addObjectKeymap(t)},this.build=()=>{const t={};return this.#e.forEach(e=>{t[e.key]=[...t[e.key]||[],e]}),Object.fromEntries(Object.entries(t).map(([e,n])=>{const r=n.sort((s,o)=>(o.priority??50)-(s.priority??50));return[e,(s,o,u)=>{const c=this.#t;if(c==null)throw gg();return $u(...r.map(h=>h.onRun(c)))(s,o,u)}]}))}}#t=null;#e=[];get ctx(){return this.#t}},Lm=st(new c3,"keymap"),B1=st([qn],"keymapTimer"),Yf=Ki("KeymapReady"),VV=t=>{const e=new c3;return e.setCtx(t),t.inject(Lm,e).inject(B1,[qn]).record(Yf),async()=>(await t.waitTimers(B1),t.done(Yf),()=>{t.remove(Lm).remove(B1).clearTimer(Yf)})},em=Ki("ParserReady"),f3=(()=>{throw gg()}),Wf=st(f3,"parser"),V1=st([],"parserTimer"),h3=t=>(t.inject(Wf,f3).inject(V1,[qn]).record(em),async()=>{await t.waitTimers(V1);const e=t.get(Uo),n=t.get(Rs);return t.set(Wf,j8.create(n,e)),t.done(em),()=>{t.remove(Wf).remove(V1).clearTimer(em)}});Vs(h3,{displayName:"Parser"});var Xf=Ki("SerializerReady"),F1=st([],"serializerTimer"),p3=(()=>{throw gg()}),tm=st(p3,"serializer"),d3=t=>(t.inject(tm,p3).inject(F1,[qn]).record(Xf),async()=>{await t.waitTimers(F1);const e=t.get(Uo),n=t.get(Rs);return t.set(tm,U8.create(n,e)),t.done(Xf),()=>{t.remove(tm).remove(F1).clearTimer(Xf)}});Vs(d3,{displayName:"Serializer"});var Qf=st("","defaultValue"),nm=st(t=>t,"stateOptions"),P1=st([],"editorStateTimer"),rm=Ki("EditorStateReady");function FV(t,e,n){if(typeof t=="string")return e(t);if(t.type==="html")return $a.fromSchema(n).parse(t.dom);if(t.type==="json")return Ms.fromJSON(n,t.value);throw H4(t)}var PV=new hr("MILKDOWN_STATE_TRACKER"),m3=t=>(t.inject(Qf,"").inject(vf,{}).inject(nm,e=>e).inject(P1,[em,Xf,Gf,Yf]).record(rm),async()=>{await t.waitTimers(P1);const e=t.get(Rs),n=t.get(Wf),r=t.get(bh),i=t.get(nm),s=t.get(_s),o=FV(t.get(Qf),n,e),u=t.get(Lm),c=u.addBaseKeymap(),h=[...s,new fr({key:PV,state:{init:()=>{},apply:(y,b,v,N)=>{t.set(vf,N)}}}),E8({rules:r}),F8(u.build())];t.set(_s,h);const m=i({schema:e,doc:o,plugins:h}),g=Do.create(m);return t.set(vf,g),t.done(rm),()=>{c(),t.remove(Qf).remove(vf).remove(nm).remove(P1).clearTimer(rm)}});Vs(m3,{displayName:"EditorState"});var Ch=st([],"pasteRule"),j1=st([qn],"pasteRuleTimer"),im=Ki("PasteRuleReady"),g3=t=>(t.inject(Ch,[]).inject(j1,[qn]).record(im),async()=>(await t.waitTimers(j1),t.done(im),()=>{t.remove(Ch).remove(j1).clearTimer(im)}));Vs(g3,{displayName:"PasteRule"});var sm=Ki("EditorViewReady"),$1=st([],"editorViewTimer"),U1=st({},"editorViewOptions"),Zf=st(null,"root"),cb=st(null,"rootDOM"),fb=st({},"rootAttrs");function jV(t,e){const n=document.createElement("div");n.className="milkdown",t.appendChild(n),e.set(cb,n);const r=e.get(fb);return Object.entries(r).forEach(([i,s])=>n.setAttribute(i,s)),n}function $V(t){t.classList.add("editor"),t.setAttribute("role","textbox")}var UV=new hr("MILKDOWN_VIEW_CLEAR"),y3=t=>(t.inject(Zf,document.body).inject(sn,{}).inject(U1,{}).inject(cb,null).inject(fb,{}).inject($1,[rm,im]).record(sm),async()=>{await t.wait(Jo);const e=t.get(Zf)||document.body,n=typeof e=="string"?document.querySelector(e):e;t.update(_s,o=>[new fr({key:UV,view:u=>{const c=n?jV(n,t):void 0;return(()=>{if(c&&n){const m=u.dom;n.replaceChild(c,m),c.appendChild(m)}})(),{destroy:()=>{c?.parentNode&&c?.parentNode.replaceChild(u.dom,c),c?.remove()}}}}),...o]),await t.waitTimers($1);const r=t.get(vf),i=t.get(U1),s=new s3(n,{state:r,nodeViews:Object.fromEntries(t.get(kh)),markViews:Object.fromEntries(t.get(vh)),transformPasted:(o,u,c)=>(t.get(Ch).sort((h,m)=>(m.priority??50)-(h.priority??50)).map(h=>h.run).forEach(h=>{o=h(o,u,c)}),o),...i});return $V(s.dom),t.set(sn,s),t.done(sm),()=>{s?.destroy(),t.remove(Zf).remove(sn).remove(U1).remove(cb).remove(fb).remove($1).clearTimer(sm)}});Vs(y3,{displayName:"EditorView"});var Hr=(function(t){return t.Idle="Idle",t.OnCreate="OnCreate",t.Created="Created",t.OnDestroy="OnDestroy",t.Destroyed="Destroyed",t})({}),x3=class b3{constructor(){this.enableInspector=(e=!0)=>(this.#t=e,this),this.onStatusChange=e=>(this.#n=e,this),this.config=e=>(this.#r.push(e),this),this.removeConfig=e=>(this.#r=this.#r.filter(n=>n!==e),this),this.use=e=>{const n=[e].flat();return n.flat().forEach(r=>{this.#i.set(r,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#e===Hr.Created&&this.#c(n,this.#i),this},this.remove=async e=>this.#e===Hr.OnCreate?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(n=>{setTimeout(()=>{n(this.remove(e))},50)})):(await this.#f([e].flat(),!0),this),this.create=async()=>this.#e===Hr.OnCreate?this:(this.#e===Hr.Created&&await this.destroy(),this.#u(Hr.OnCreate),this.#p(),this.#c([...this.#i.keys()],this.#i),await Promise.all([this.#h(this.#a),this.#h(this.#i)].flat()),this.#u(Hr.Created),this),this.destroy=async(e=!1)=>this.#e===Hr.Destroyed||this.#e===Hr.OnDestroy?this:this.#e===Hr.OnCreate?new Promise(n=>{setTimeout(()=>{n(this.destroy(e))},50)}):(e&&(this.#r=[]),this.#u(Hr.OnDestroy),await this.#f([...this.#i.keys()],e),await this.#d(),this.#u(Hr.Destroyed),this),this.action=e=>e(this.#l),this.inspect=()=>this.#t?[...this.#a.values(),...this.#i.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new b3}#t=!1;#e=Hr.Idle;#r=[];#n=()=>{};#o=new CT;#s=new rz;#i=new Map;#a=new Map;#l=new nz(this.#o,this.#s);#p=()=>{const e=_V(async r=>{await Promise.all(this.#r.map(i=>Promise.resolve(i(r))))}),n=[o3,h3,d3,u3,VV,g3,m3,y3,zV(this),e];this.#c(n,this.#a)};#c=(e,n)=>{e.forEach(r=>{const i=this.#l.produce(this.#t?r.meta:void 0),s=r(i);n.set(r,{ctx:i,handler:s,cleanup:void 0})})};#f=(e,n=!1)=>Promise.all([e].flat().map(async r=>{const i=this.#i.get(r)?.cleanup;return n?this.#i.delete(r):this.#i.set(r,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof i=="function"?i():i}));#d=async()=>{await Promise.all([...this.#a.entries()].map(async([e,{cleanup:n}])=>typeof n=="function"?n():n)),this.#a.clear()};#u=e=>{this.#e=e,this.#n(e)};#h=e=>[...e.entries()].map(async([n,r])=>{const{ctx:i,handler:s}=r;if(!s)return;const o=await s();e.set(n,{ctx:i,handler:s,cleanup:o})});get ctx(){return this.#l}get status(){return this.#e}};function Ue(t,e){const n=LV(t),r=i=>async()=>{r.key=n,await i.wait(Gf);const s=e(i);return i.get(xt).create(n,s),r.run=o=>i.get(xt).call(t,o),()=>{i.get(xt).remove(n)}};return r}function pr(t){const e=n=>async()=>{await n.wait(qn);const r=t(n);return n.update(bh,i=>[...i,r]),e.inputRule=r,()=>{n.update(bh,i=>i.filter(s=>s!==r))}};return e}function JV(t){const e=n=>async()=>{await n.wait(qn);const r=t(n);return n.update(Ch,i=>[...i,r]),e.pasteRule=r,()=>{n.update(Ch,i=>i.filter(s=>s!==r))}};return e}function HV(t,e){const n=r=>async()=>{const i=e(r);return r.update(Kf,s=>[...s.filter(o=>o[0]!==t),[t,i]]),n.id=t,n.schema=i,()=>{r.update(Kf,s=>s.filter(([o])=>o!==t))}};return n.type=r=>{const i=r.get(Rs).marks[t];if(!i)throw Q4(t);return i},n}function Wh(t,e){const n=r=>async()=>{const i=e(r);return r.update(qf,s=>[...s.filter(o=>o[0]!==t),[t,i]]),n.id=t,n.schema=i,()=>{r.update(qf,s=>s.filter(([o])=>o!==t))}};return n.type=r=>{const i=r.get(Rs).nodes[t];if(!i)throw X4(t);return i},n}function Fs(t){let e;const n=r=>async()=>(await r.wait(qn),e=t(r),r.update(_s,i=>[...i,e]),()=>{r.update(_s,i=>i.filter(s=>s!==e))});return n.plugin=()=>e,n.key=()=>e.spec.key,n}function qV(t){const e=n=>async()=>{await n.wait(Yf);const r=n.get(Lm),i=t(n),s=r.addObjectKeymap(i);return e.keymap=i,()=>{s()}};return e}function KV(t,e){const n=r=>async()=>{await r.wait(qn);const i=e(r);return t.type(r)instanceof Tm?r.update(kh,s=>[...s,[t.id,i]]):r.update(vh,s=>[...s,[t.id,i]]),n.view=i,n.type=t,()=>{t.type(r)instanceof Tm?r.update(kh,s=>s.filter(o=>o[0]!==t.id)):r.update(vh,s=>s.filter(o=>o[0]!==t.id))}};return n}function Xa(t,e){const n=st(t,e),r=i=>(i.inject(n),()=>()=>{i.remove(n)});return r.key=n,r}function en(t,e){const n=Xa(e,t),r=Wh(t,s=>s.get(n.key)(s)),i=[n,r];return i.id=r.id,i.node=r,i.type=s=>r.type(s),i.ctx=n,i.key=n.key,i.extendSchema=s=>en(t,s(e)),i}function Uu(t,e){const n=Xa(e,t),r=HV(t,s=>s.get(n.key)(s)),i=[n,r];return i.id=r.id,i.mark=r,i.type=s=>r.type(s),i.ctx=n,i.key=n.key,i.extendSchema=s=>Uu(t,s(e)),i}function Mr(t,e){const n=Xa(Object.fromEntries(Object.entries(e).map(([s,{shortcuts:o,priority:u}])=>[s,{shortcuts:o,priority:u}])),`${t}Keymap`),r=qV(s=>{const o=s.get(n.key),u=Object.entries(e).flatMap(([c,{command:h}])=>{const m=o[c],g=[m.shortcuts].flat(),y=m.priority;return g.map(b=>[b,{key:b,onRun:h,priority:y}])});return Object.fromEntries(u)}),i=[n,r];return i.ctx=n,i.shortcuts=r,i.key=n.key,i.keymap=r.keymap,i}var Ei=(t,e=()=>({}))=>Xa(e,`${t}Attr`),Xh=(t,e=()=>({}))=>Xa(e,`${t}Attr`);function Ps(t,e,n){const r=Xa({},t),i=o=>async()=>{await o.wait(Jo);const u={plugin:e(o),options:o.get(r.key)};return o.update(Sh,c=>[...c,u]),()=>{o.update(Sh,c=>c.filter(h=>h!==u))}},s=[r,i];return s.id=t,s.plugin=i,s.options=r,s}function Bi(t,e){return n=>n.get(xt).call(t,e)}function S3(t,e=!1){return n=>{const r=n.get(sn),i=n.get(Wf)(t);if(!i)return;if(!e){const{state:c}=r;return r.dispatch(c.tr.replace(0,c.doc.content.size,new H(i.content,0,0)))}const s=n.get(Rs),o=n.get(nm)({schema:s,doc:i,plugins:n.get(_s)}),u=Do.create(o);r.updateState(u)}}const k3=65535,v3=Math.pow(2,16);function GV(t,e){return t+e*v3}function NN(t){return t&k3}function YV(t){return(t-(t&k3))/v3}const C3=1,w3=2,am=4,E3=8;let AN=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&E3)>0}get deletedBefore(){return(this.delInfo&(C3|am))>0}get deletedAfter(){return(this.delInfo&(w3|am))>0}get deletedAcross(){return(this.delInfo&am)>0}},al=class gu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&gu.empty)return gu.empty}recover(e){let n=0,r=NN(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+YV(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:m);if(r)return b;let v=e==(n<0?c:g)?null:GV(u/3,e-c),N=e==c?w3:e==g?C3:am;return(n<0?e!=c:e!=g)&&(N|=E3),new AN(b,N,v)}i+=m-h}return r?e+i:new AN(e+i,0,null)}touches(e,n){let r=0,i=NN(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],m=this.ranges[i+r];e(u,u+h,c,c+m),s+=m-h}}invert(){return new gu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?gu.empty:new gu(e<0?[0,-e,0]:[0,0,e])}};al.empty=new al([]);const J1=Object.create(null);let Nn=class{getMap(){return al.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=J1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in J1)throw new RangeError("Duplicate use of step JSON ID "+e);return J1[e]=n,n.prototype.jsonID=e,n}},$n=class Cf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Cf(e,null)}static fail(e){return new Cf(null,e)}static fromReplace(e,n,r,i){try{return Cf.ok(e.replace(n,r,i))}catch(s){if(s instanceof wi)return Cf.fail(s.message);throw s}}};function OS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(OS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return G.fromArray(r)}let N3=class wf extends Nn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(OS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return $n.fromReplace(e,this.from,this.to,s)}invert(){return new A3(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new wf(n.pos,r.pos,this.mark)}merge(e){return e instanceof wf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new wf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new wf(n.from,n.to,e.markFromJSON(n.mark))}};Nn.jsonID("addMark",N3);let A3=class Ef extends Nn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(OS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return $n.fromReplace(e,this.from,this.to,r)}invert(){return new N3(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ef(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ef&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ef(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ef(n.from,n.to,e.markFromJSON(n.mark))}};Nn.jsonID("removeMark",A3);let T3=class Nf extends Nn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return $n.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return $n.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Nf(this.pos,n.marks[i]);return new Nf(this.pos,this.mark)}}return new M3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Nf(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Nf(n.pos,e.markFromJSON(n.mark))}};Nn.jsonID("addNodeMark",T3);let M3=class hb extends Nn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return $n.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return $n.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new T3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new hb(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new hb(n.pos,e.markFromJSON(n.mark))}};Nn.jsonID("removeNodeMark",M3);let WV=class To extends Nn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&pb(e,this.from,this.to)?$n.fail("Structure replace would overwrite content"):$n.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new al([this.from,this.to-this.from,this.slice.size])}invert(e){return new To(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new To(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof To)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new To(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new To(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new To(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};Nn.jsonID("replace",WV);let Ag=class om extends Nn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(pb(e,this.from,this.gapFrom)||pb(e,this.gapTo,this.to)))return $n.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return $n.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?$n.fromReplace(e,this.from,this.to,r):$n.fail("Content does not fit in gap")}getMap(){return new al([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new om(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new om(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new om(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};Nn.jsonID("replaceAround",Ag);function pb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function XV(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function QV(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),u=t.$from.index(r)+i,c=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(u,c,n))return r;if(r==0||o.type.spec.isolating||!XV(o,u,c))break;u&&(i=1),c<o.childCount&&(s=1)}return null}function ZV(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,m=n-2;h>s;h--,m--){let g=i.node(h),y=i.index(h);if(g.type.spec.isolating)return!1;let b=g.content.cutByIndex(y,g.childCount),v=r&&r[m+1];v&&(b=b.replaceChild(0,v.type.create(v.attrs)));let N=r&&r[m]||g;if(!g.canReplace(y+1,g.childCount)||!N.type.validContent(b))return!1}let u=i.indexAfter(s),c=r&&r[0];return i.node(s).canReplaceWith(u,u,c?c.type:i.node(s+1).type)}function eF(t,e){let n=t.resolve(e),r=n.index();return nF(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function tF(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function nF(t,e){return!!(t&&e&&!t.isLeaf&&tF(t,e))}let rF=class lm extends Nn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return $n.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return $n.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}getMap(){return al.empty}invert(e){return new lm(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new lm(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new lm(n.pos,n.attr,n.value)}};Nn.jsonID("attr",rF);let iF=class db extends Nn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return $n.ok(r)}getMap(){return al.empty}invert(e){return new db(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new db(n.attr,n.value)}};Nn.jsonID("docAttr",iF);let wh=class extends Error{};wh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};wh.prototype=Object.create(Error.prototype);wh.prototype.constructor=wh;wh.prototype.name="TransformError";function sF(t,e){return function(n,r){let{$from:i,$to:s,node:o}=n.selection;if(o&&o.isBlock||i.depth<2||!i.sameParent(s))return!1;let u=i.node(-1);if(u.type!=t)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=t||i.index(-2)!=i.node(-2).childCount-1)return!1;if(r){let g=G.empty,y=i.index(-1)?1:i.index(-2)?2:3;for(let M=i.depth-y;M>=i.depth-3;M--)g=G.from(i.node(M).copy(g));let b=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;g=g.append(G.from(t.createAndFill()));let v=i.before(i.depth-(y-1)),N=n.tr.replace(v,i.after(-b),new H(g,4-y,0)),T=-1;N.doc.nodesBetween(v,N.doc.content.size,(M,j)=>{if(T>-1)return!1;M.isTextblock&&M.content.size==0&&(T=j+1)}),T>-1&&N.setSelection(Ve.near(N.doc.resolve(T))),r(N.scrollIntoView())}return!0}let c=s.pos==i.end()?u.contentMatchAt(0).defaultType:null,h=n.tr.delete(i.pos,s.pos),m=c?[null,{type:c}]:void 0;return ZV(h.doc,i.pos,2,m)?(r&&r(h.split(i.pos,2,m).scrollIntoView()),!0):!1}}function aF(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?oF(e,n,t,s):lF(e,n,s):!0:!1}}function oF(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Ag(s-1,o,s,o,new H(G.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new aM(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const u=QV(r);if(u==null)return!1;i.lift(r,u);let c=i.doc.resolve(i.mapping.map(s,-1)-1);return eF(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function lF(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,v=n.endIndex-1,N=n.startIndex;v>N;v--)b-=i.child(v).nodeSize,r.delete(b-1,b+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let u=n.startIndex==0,c=n.endIndex==i.childCount,h=s.node(-1),m=s.index(-1);if(!h.canReplace(m+(u?0:1),m+1,o.content.append(c?G.empty:G.from(i))))return!1;let g=s.pos,y=g+o.nodeSize;return r.step(new Ag(g-(u?1:0),y+(c?1:0),g+1,y-1,new H((u?G.empty:G.from(i.copy(G.empty))).append(c?G.empty:G.from(i.copy(G.empty))),u?0:1,c?0:1),u?0:1)),e(r.scrollIntoView()),!0}function uF(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,h=>h.childCount>0&&h.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let u=s.parent,c=u.child(o-1);if(c.type!=t)return!1;if(n){let h=c.lastChild&&c.lastChild.type==u.type,m=G.from(h?t.create():null),g=new H(G.from(t.create(null,G.from(u.type.create(null,m)))),h?3:1,0),y=s.start,b=s.end;n(e.tr.step(new Ag(y-(h?3:1),b,y,b,g,1,!0)).scrollIntoView())}return!0}}const O3=65535,R3=Math.pow(2,16);function cF(t,e){return t+e*R3}function TN(t){return t&O3}function fF(t){return(t-(t&O3))/R3}const D3=1,I3=2,um=4,_3=8;let MN=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&_3)>0}get deletedBefore(){return(this.delInfo&(D3|um))>0}get deletedAfter(){return(this.delInfo&(I3|um))>0}get deletedAcross(){return(this.delInfo&um)>0}},ol=class yu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&yu.empty)return yu.empty}recover(e){let n=0,r=TN(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+fF(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:m);if(r)return b;let v=e==(n<0?c:g)?null:cF(u/3,e-c),N=e==c?I3:e==g?D3:um;return(n<0?e!=c:e!=g)&&(N|=_3),new MN(b,N,v)}i+=m-h}return r?e+i:new MN(e+i,0,null)}touches(e,n){let r=0,i=TN(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],m=this.ranges[i+r];e(u,u+h,c,c+m),s+=m-h}}invert(){return new yu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?yu.empty:new yu(e<0?[0,-e,0]:[0,0,e])}};ol.empty=new ol([]);const H1=Object.create(null);let An=class{getMap(){return ol.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=H1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in H1)throw new RangeError("Duplicate use of step JSON ID "+e);return H1[e]=n,n.prototype.jsonID=e,n}},Un=class Af{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Af(e,null)}static fail(e){return new Af(null,e)}static fromReplace(e,n,r,i){try{return Af.ok(e.replace(n,r,i))}catch(s){if(s instanceof wi)return Af.fail(s.message);throw s}}};function RS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(RS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return G.fromArray(r)}let DS=class Tf extends An{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(RS(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Un.fromReplace(e,this.from,this.to,s)}invert(){return new z3(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Tf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Tf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Tf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Tf(n.from,n.to,e.markFromJSON(n.mark))}};An.jsonID("addMark",DS);let z3=class Mf extends An{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(RS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Un.fromReplace(e,this.from,this.to,r)}invert(){return new DS(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Mf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Mf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mf(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Mf(n.from,n.to,e.markFromJSON(n.mark))}};An.jsonID("removeMark",z3);let L3=class Of extends An{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Un.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Un.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Of(this.pos,n.marks[i]);return new Of(this.pos,this.mark)}}return new B3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Of(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Of(n.pos,e.markFromJSON(n.mark))}};An.jsonID("addNodeMark",L3);let B3=class mb extends An{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Un.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Un.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new L3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new mb(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new mb(n.pos,e.markFromJSON(n.mark))}};An.jsonID("removeNodeMark",B3);let IS=class Ea extends An{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&gb(e,this.from,this.to)?Un.fail("Structure replace would overwrite content"):Un.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ol([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ea(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Ea.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Ea(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ea)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ea(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ea(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ea(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};IS.MAP_BIAS=1;An.jsonID("replace",IS);let hF=class cm extends An{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(gb(e,this.from,this.gapFrom)||gb(e,this.gapTo,this.to)))return Un.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Un.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Un.fromReplace(e,this.from,this.to,r):Un.fail("Content does not fit in gap")}getMap(){return new ol([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new cm(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new cm(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new cm(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};An.jsonID("replaceAround",hF);function gb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function pF(t,e,n=null,r=t){let i=dF(t,e),s=i&&mF(r,e);return s?i.map(ON).concat({type:e,attrs:n}).concat(s.map(ON)):null}function ON(t){return{type:t,attrs:null}}function dF(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function mF(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:o}let gF=class fm extends An{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Un.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Un.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}getMap(){return ol.empty}invert(e){return new fm(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fm(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new fm(n.pos,n.attr,n.value)}};An.jsonID("attr",gF);let yF=class yb extends An{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Un.ok(r)}getMap(){return ol.empty}invert(e){return new yb(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new yb(n.attr,n.value)}};An.jsonID("docAttr",yF);let Eh=class extends Error{};Eh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Eh.prototype=Object.create(Error.prototype);Eh.prototype.constructor=Eh;Eh.prototype.name="TransformError";function _S(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),ju(t,s,u,i);function u(c,h){const m=h[h.length-1],g=m?m.children.indexOf(c):void 0;return o(c,g,m)}}function xF(t,e,n,r){let i,s,o;s=e,o=n,i=r,ju(t,s,u,i);function u(c,h){const m=h[h.length-1],g=m?m.children.indexOf(c):void 0;return o(c,g,m)}}function bF(t){const e=new Map;if(!t||!t.type)throw new Error("mdast-util-definitions expected node");return xF(t,"definition",function(r){const i=RN(r.identifier);i&&!e.get(i)&&e.set(i,r)}),n;function n(r){const i=RN(r);return e.get(i)}}function RN(t){return String(t||"").toUpperCase()}function SF(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),ju(t,s,u,i);function u(c,h){const m=h[h.length-1],g=m?m.children.indexOf(c):void 0;return o(c,g,m)}}function kF(){return function(t){const e=bF(t);SF(t,function(n,r,i){if(n.type==="definition"&&i!==void 0&&typeof r=="number")return i.children.splice(r,1),[Mx,r];if(n.type==="imageReference"||n.type==="linkReference"){const s=e(n.identifier);if(s&&i&&typeof r=="number")return i.children[r]=n.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:n.alt}:{type:"link",url:s.url,title:s.title,children:n.children},[Mx,r]}})}}function V3(t,e){if(!(e.childCount>=1&&e.lastChild?.type.name==="hardbreak")){t.next(e.content);return}const n=[];e.content.forEach((r,i,s)=>{s!==e.childCount-1&&n.push(r)}),t.next(G.fromArray(n))}function ce(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-commonmark",...e}}),t}var zS=Xh("emphasis");ce(zS,{displayName:"Attr<emphasis>",group:"Emphasis"});var Ju=Uu("emphasis",t=>({attrs:{marker:{default:t.get(Hf).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",t.get(zS.key)(e)],parseMarkdown:{match:e=>e.type==="emphasis",runner:(e,n,r)=>{e.openMark(r,{marker:n.marker}),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="emphasis",runner:(e,n)=>{e.withMark(n,"emphasis",void 0,{marker:n.attrs.marker})}}}));ce(Ju.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});ce(Ju.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var Tg=Ue("ToggleEmphasis",t=>()=>Cg(Ju.type(t)));ce(Tg,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var F3=pr(t=>qh(/(?:^|[^*])\*([^*]+)\*$/,Ju.type(t),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:n+1}}));ce(F3,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var P3=pr(t=>qh(/\b_(?![_\s])(.*?[^_\s])_\b/,Ju.type(t),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:n+1}}));ce(P3,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var LS=Mr("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:t=>{const e=t.get(xt);return()=>e.call(Tg.key)}}});ce(LS.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});ce(LS.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var BS=Xh("strong");ce(BS,{displayName:"Attr<strong>",group:"Strong"});var Qh=Uu("strong",t=>({attrs:{marker:{default:t.get(Hf).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>e.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>e==="bold"},{style:"font-weight=400",clearMark:e=>e.type.name=="strong"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:e=>["strong",t.get(BS.key)(e)],parseMarkdown:{match:e=>e.type==="strong",runner:(e,n,r)=>{e.openMark(r,{marker:n.marker}),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strong",runner:(e,n)=>{e.withMark(n,"strong",void 0,{marker:n.attrs.marker})}}}));ce(Qh.mark,{displayName:"MarkSchema<strong>",group:"Strong"});ce(Qh.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var Mg=Ue("ToggleStrong",t=>()=>Cg(Qh.type(t)));ce(Mg,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var j3=pr(t=>qh(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),Qh.type(t),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));ce(j3,{displayName:"InputRule<strong>",group:"Strong"});var VS=Mr("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:t=>{const e=t.get(xt);return()=>e.call(Mg.key)}}});ce(VS.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});ce(VS.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var FS=Xh("inlineCode");ce(FS,{displayName:"Attr<inlineCode>",group:"InlineCode"});var _a=Uu("inlineCode",t=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:e=>["code",t.get(FS.key)(e)],parseMarkdown:{match:e=>e.type==="inlineCode",runner:(e,n,r)=>{e.openMark(r),e.addText(n.value),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="inlineCode",runner:(e,n,r)=>(e.withMark(n,"inlineCode",r.text||""),!0)}}));ce(_a.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});ce(_a.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var PS=Ue("ToggleInlineCode",t=>()=>(e,n)=>{const{selection:r,tr:i}=e;if(r.empty)return!1;const{from:s,to:o}=r;return e.doc.rangeHasMark(s,o,_a.type(t))?(n?.(i.removeMark(s,o,_a.type(t))),!0):(Object.keys(e.schema.marks).filter(u=>u!==_a.type.name).map(u=>e.schema.marks[u]).forEach(u=>{i.removeMark(s,o,u)}),n?.(i.addMark(s,o,_a.type(t).create())),!0)});ce(PS,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var $3=pr(t=>qh(/(?:`)([^`]+)(?:`)$/,_a.type(t)));ce($3,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var jS=Mr("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:t=>{const e=t.get(xt);return()=>e.call(PS.key)}}});ce(jS.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});ce(jS.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var $S=Xh("link");ce($S,{displayName:"Attr<link>",group:"Link"});var Tu=Uu("link",t=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw qi(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...t.get($S.key)(e),...e.attrs}],parseMarkdown:{match:e=>e.type==="link",runner:(e,n,r)=>{const i=n.url,s=n.title;e.openMark(r,{href:i,title:s}),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="link",runner:(e,n)=>{e.withMark(n,"link",void 0,{title:n.attrs.title,url:n.attrs.href})}}}));ce(Tu.mark,{displayName:"MarkSchema<link>",group:"Link"});var US=Ue("ToggleLink",t=>(e={})=>Cg(Tu.type(t),e));ce(US,{displayName:"Command<toggleLinkCommand>",group:"Link"});var JS=Ue("UpdateLink",t=>(e={})=>(n,r)=>{if(!r)return!1;let i,s=-1;const{selection:o}=n,{from:u,to:c}=o;if(n.doc.nodesBetween(u,u===c?c+1:c,(v,N)=>{if(Tu.type(t).isInSet(v.marks))return i=v,s=N,!1}),!i)return!1;const h=i.marks.find(({type:v})=>v===Tu.type(t));if(!h)return!1;const m=s,g=s+i.nodeSize,{tr:y}=n,b=Tu.type(t).create({...h.attrs,...e});return b?(r(y.removeMark(m,g,h).addMark(m,g,b).setSelection(new we(y.selection.$anchor)).scrollIntoView()),!0):!1});ce(JS,{displayName:"Command<updateLinkCommand>",group:"Link"});var U3=Wh("doc",()=>({content:"block+",parseMarkdown:{match:({type:t})=>t==="root",runner:(t,e,n)=>{t.injectRoot(e,n)}},toMarkdown:{match:t=>t.type.name==="doc",runner:(t,e)=>{t.openNode("root"),t.next(e.content)}}}));ce(U3,{displayName:"NodeSchema<doc>",group:"Doc"});function vF(t){return ju(t,e=>e.type==="html"&&["<br />","<br>","<br >","<br/>"].includes(e.value?.trim()),(e,n)=>{if(!n.length)return;const r=n[n.length-1];if(!r)return;const i=r.children.indexOf(e);i!==-1&&r.children.splice(i,1)},!0)}var Og=Ps("remark-preserve-empty-line",()=>()=>vF);ce(Og.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});ce(Og.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var HS=Ei("paragraph");ce(HS,{displayName:"Attr<paragraph>",group:"Paragraph"});var $i=en("paragraph",t=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",t.get(HS.key)(e),0],parseMarkdown:{match:e=>e.type==="paragraph",runner:(e,n,r)=>{e.openNode(r),n.children?e.next(n.children):e.addText(n.value||""),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="paragraph",runner:(e,n)=>{const r=t.get(sn).state?.doc.lastChild;e.openNode("paragraph"),(!n.content||n.content.size===0)&&n!==r&&CF(t)?e.addNode("html",void 0,"<br />"):V3(e,n),e.closeNode()}}}));function CF(t){let e=!1;try{t.get(Og.id),e=!0}catch{e=!1}return e}ce($i.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});ce($i.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var qS=Ue("TurnIntoText",t=>()=>ph($i.type(t)));ce(qS,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var KS=Mr("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:t=>{const e=t.get(xt);return()=>e.call(qS.key)}}});ce(KS.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});ce(KS.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var wF=Array(6).fill(0).map((t,e)=>e+1);function EF(t){return t.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var Rg=Xa(EF,"headingIdGenerator");ce(Rg,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var GS=Ei("heading");ce(GS,{displayName:"Attr<heading>",group:"Heading"});var pl=en("heading",t=>{const e=t.get(Rg.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:wF.map(n=>({tag:`h${n}`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw qi(r);return{level:n,id:r.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...t.get(GS.key)(n),id:n.attrs.id||e(n)},0],parseMarkdown:{match:({type:n})=>n==="heading",runner:(n,r,i)=>{const s=r.depth;n.openNode(i,{level:s}),n.next(r.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="heading",runner:(n,r)=>{n.openNode("heading",void 0,{depth:r.attrs.level}),V3(n,r),n.closeNode()}}}});ce(pl.node,{displayName:"NodeSchema<heading>",group:"Heading"});ce(pl.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var J3=pr(t=>aO(/^(?<hashes>#+)\s$/,pl.type(t),e=>{const n=e.groups?.hashes?.length||0,{$from:r}=t.get(sn).state.selection,i=r.node();if(i.type.name==="heading"){let s=Number(i.attrs.level)+Number(n);return s>6&&(s=6),{level:s}}return{level:n}}));ce(J3,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var Ta=Ue("WrapInHeading",t=>e=>(e??=1,e<1?ph($i.type(t)):ph(pl.type(t),{level:e})));ce(Ta,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var YS=Ue("DowngradeHeading",t=>()=>(e,n,r)=>{const{$from:i}=e.selection,s=i.node();if(s.type!==pl.type(t)||!e.selection.empty||i.parentOffset!==0)return!1;const o=s.attrs.level-1;return o?(n?.(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...s.attrs,level:o})),!0):ph($i.type(t))(e,n,r)});ce(YS,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var WS=Mr("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:t=>{const e=t.get(xt);return()=>e.call(Ta.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:t=>{const e=t.get(xt);return()=>e.call(Ta.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:t=>{const e=t.get(xt);return()=>e.call(Ta.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:t=>{const e=t.get(xt);return()=>e.call(Ta.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:t=>{const e=t.get(xt);return()=>e.call(Ta.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:t=>{const e=t.get(xt);return()=>e.call(Ta.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:t=>{const e=t.get(xt);return()=>e.call(YS.key)}}});ce(WS.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});ce(WS.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var XS=Ei("blockquote");ce(XS,{displayName:"Attr<blockquote>",group:"Blockquote"});var Zh=en("blockquote",t=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",t.get(XS.key)(e),0],parseMarkdown:{match:({type:e})=>e==="blockquote",runner:(e,n,r)=>{e.openNode(r).next(n.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="blockquote",runner:(e,n)=>{e.openNode("blockquote").next(n.content).closeNode()}}}));ce(Zh.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});ce(Zh.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var H3=pr(t=>bS(/^\s*>\s$/,Zh.type(t)));ce(H3,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var Dg=Ue("WrapInBlockquote",t=>()=>yS(Zh.type(t)));ce(Dg,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var QS=Mr("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:t=>{const e=t.get(xt);return()=>e.call(Dg.key)}}});ce(QS.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});ce(QS.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var ZS=Ei("codeBlock",()=>({pre:{},code:{}}));ce(ZS,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var ep=en("code_block",t=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw qi(e);return{language:e.dataset.language}}}],toDOM:e=>{const n=t.get(ZS.key)(e),r=e.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...i},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>e==="code",runner:(e,n,r)=>{const i=n.lang??"",s=n.value;e.openNode(r,{language:i}),s&&e.addText(s),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="code_block",runner:(e,n)=>{e.addNode("code",void 0,n.content.firstChild?.text||"",{lang:n.attrs.language})}}}));ce(ep.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});ce(ep.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var q3=pr(t=>aO(/^```(?<language>[a-z]*)?[\s\n]$/,ep.type(t),e=>({language:e.groups?.language??""})));ce(q3,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var ek=Ue("CreateCodeBlock",t=>(e="")=>ph(ep.type(t),{language:e}));ce(ek,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var NF=Ue("UpdateCodeBlockLanguage",()=>({pos:t,language:e}={pos:-1,language:""})=>(n,r)=>t>=0?(r?.(n.tr.setNodeAttribute(t,"language",e)),!0):!1);ce(NF,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var tk=Mr("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:t=>{const e=t.get(xt);return()=>e.call(ek.key)}}});ce(tk.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});ce(tk.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var nk=Ei("image");ce(nk,{displayName:"Attr<image>",group:"Image"});var Hu=en("image",t=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw qi(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...t.get(nk.key)(e),...e.attrs}],parseMarkdown:{match:({type:e})=>e==="image",runner:(e,n,r)=>{const i=n.url,s=n.alt,o=n.title;e.addNode(r,{src:i,alt:s,title:o})}},toMarkdown:{match:e=>e.type.name==="image",runner:(e,n)=>{e.addNode("image",void 0,void 0,{title:n.attrs.title,url:n.attrs.src,alt:n.attrs.alt})}}}));ce(Hu.node,{displayName:"NodeSchema<image>",group:"Image"});ce(Hu.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var K3=Ue("InsertImage",t=>(e={})=>(n,r)=>{if(!r)return!0;const{src:i="",alt:s="",title:o=""}=e,u=Hu.type(t).create({src:i,alt:s,title:o});return u&&r(n.tr.replaceSelectionWith(u).scrollIntoView()),!0});ce(K3,{displayName:"Command<insertImageCommand>",group:"Image"});var G3=Ue("UpdateImage",t=>(e={})=>(n,r)=>{const i=O8(n.selection,Hu.type(t));if(!i)return!1;const{node:s,pos:o}=i,u={...s.attrs},{src:c,alt:h,title:m}=e;return c!==void 0&&(u.src=c),h!==void 0&&(u.alt=h),m!==void 0&&(u.title=m),r?.(n.tr.setNodeMarkup(o,void 0,u).scrollIntoView()),!0});ce(G3,{displayName:"Command<updateImageCommand>",group:"Image"});var AF=pr(t=>new Tr(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,n,r,i)=>{const[s,o,u="",c]=n;return s?e.tr.replaceWith(r,i,Hu.type(t).create({src:u,alt:o,title:c})):null}));ce(AF,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var Bm=Ei("hardbreak",t=>({"data-type":"hardbreak","data-is-inline":t.attrs.isInline}));ce(Bm,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var Ho=en("hardbreak",t=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:e=>e.attrs.isInline?["span",t.get(Bm.key)(e)," "]:["br",t.get(Bm.key)(e)],parseMarkdown:{match:({type:e})=>e==="break",runner:(e,n,r)=>{e.addNode(r,{isInline:!!n.data?.isInline})}},leafText:()=>`
45
+ `,toMarkdown:{match:e=>e.type.name==="hardbreak",runner:(e,n)=>{n.attrs.isInline?e.addNode("text",void 0,`
46
+ `):e.addNode("break")}}}));ce(Ho.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});ce(Ho.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var rk=Ue("InsertHardbreak",t=>()=>(e,n)=>{const{selection:r,tr:i}=e;if(!(r instanceof we))return!1;if(r.empty){const s=r.$from.node();if(s.childCount>0&&s.lastChild?.type.name==="hardbreak")return n?.(i.replaceRangeWith(r.to-1,r.to,e.schema.node("paragraph")).setSelection(Ve.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(Ho.type(t).create()).scrollIntoView()),!0});ce(rk,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var ik=Mr("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:t=>{const e=t.get(xt);return()=>e.call(rk.key)}}});ce(ik.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});ce(ik.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var sk=Ei("hr");ce(sk,{displayName:"Attr<hr>",group:"Hr"});var tp=en("hr",t=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:e=>["hr",t.get(sk.key)(e)],parseMarkdown:{match:({type:e})=>e==="thematicBreak",runner:(e,n,r)=>{e.addNode(r)}},toMarkdown:{match:e=>e.type.name==="hr",runner:e=>{e.addNode("thematicBreak")}}}));ce(tp.node,{displayName:"NodeSchema<hr>",group:"Hr"});ce(tp.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var Y3=pr(t=>new Tr(/^(?:---|___\s|\*\*\*\s)$/,(e,n,r,i)=>{const{tr:s}=e;return n[0]&&s.replaceWith(r-1,i,tp.type(t).create()),s}));ce(Y3,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var W3=Ue("InsertHr",t=>()=>(e,n)=>{if(!n)return!0;const r=$i.node.type(t).create(),{tr:i,selection:s}=e,{from:o}=s,u=tp.type(t).create();if(!u)return!0;const c=i.replaceSelectionWith(u).insert(o,r),h=Ve.findFrom(c.doc.resolve(o),1,!0);return h&&n(c.setSelection(h).scrollIntoView()),!0});ce(W3,{displayName:"Command<insertHrCommand>",group:"Hr"});var Ig=Ei("bulletList");ce(Ig,{displayName:"Attr<bulletList>",group:"BulletList"});var dl=en("bullet_list",t=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw qi(e);return{spread:e.dataset.spread==="true"}}}],toDOM:e=>["ul",{...t.get(Ig.key)(e),"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:n})=>e==="list"&&!n,runner:(e,n,r)=>{const i=n.spread!=null?`${n.spread}`:"false";e.openNode(r,{spread:i}).next(n.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="bullet_list",runner:(e,n)=>{e.openNode("list",void 0,{ordered:!1,spread:n.attrs.spread}).next(n.content).closeNode()}}}));ce(dl.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});ce(dl.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var X3=pr(t=>bS(/^\s*([-+*])\s$/,dl.type(t)));ce(X3,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var _g=Ue("WrapInBulletList",t=>()=>yS(dl.type(t)));ce(_g,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var ak=Mr("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:t=>{const e=t.get(xt);return()=>e.call(_g.key)}}});ce(ak.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});ce(ak.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var zg=Ei("orderedList");ce(zg,{displayName:"Attr<orderedList>",group:"OrderedList"});var ml=en("ordered_list",t=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw qi(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:e=>["ol",{...t.get(zg.key)(e),...e.attrs.order===1?{}:{start:e.attrs.order},"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:n})=>e==="list"&&!!n,runner:(e,n,r)=>{const i=n.spread!=null?`${n.spread}`:"true";e.openNode(r,{spread:i,order:n.start??1}).next(n.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="ordered_list",runner:(e,n)=>{e.openNode("list",void 0,{ordered:!0,start:n.attrs.order??1,spread:n.attrs.spread==="true"}),e.next(n.content),e.closeNode()}}}));ce(ml.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});ce(ml.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var Q3=pr(t=>bS(/^\s*(\d+)\.\s$/,ml.type(t),e=>({order:Number(e[1])}),(e,n)=>n.childCount+n.attrs.order===Number(e[1])));ce(Q3,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var Lg=Ue("WrapInOrderedList",t=>()=>yS(ml.type(t)));ce(Lg,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var ok=Mr("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:t=>{const e=t.get(xt);return()=>e.call(Lg.key)}}});ce(ok.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});ce(ok.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var lk=Ei("listItem");ce(lk,{displayName:"Attr<listItem>",group:"ListItem"});var js=en("list_item",t=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw qi(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread==="true"}}}],toDOM:e=>["li",{...t.get(lk.key)(e),"data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e})=>e==="listItem",runner:(e,n,r)=>{const i=n.label!=null?`${n.label}.`:"•",s=n.label!=null?"ordered":"bullet",o=n.spread!=null?`${n.spread}`:"true";e.openNode(r,{label:i,listType:s,spread:o}),e.next(n.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="list_item",runner:(e,n)=>{e.openNode("listItem",void 0,{spread:n.attrs.spread}),e.next(n.content),e.closeNode()}}}));ce(js.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});ce(js.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var uk=Ue("SinkListItem",t=>()=>uF(js.type(t)));ce(uk,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var Bg=Ue("LiftListItem",t=>()=>aF(js.type(t)));ce(Bg,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var ck=Ue("SplitListItem",t=>()=>sF(js.type(t)));ce(ck,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function TF(t){return(e,n,r)=>{const{selection:i}=e;if(!(i instanceof we))return!1;const{empty:s,$from:o}=i;return!s||o.parentOffset!==0||o.node(-1).type!==js.type(t)?!1:HM(e,n,r)}}var fk=Ue("LiftFirstListItem",t=>()=>TF(t));ce(fk,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var hk=Mr("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:t=>{const e=t.get(xt);return()=>e.call(ck.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:t=>{const e=t.get(xt);return()=>e.call(uk.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:t=>{const e=t.get(xt);return()=>e.call(Bg.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:t=>{const e=t.get(xt);return()=>e.call(fk.key)}}});ce(hk.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});ce(hk.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var Z3=Wh("text",()=>({group:"inline",parseMarkdown:{match:({type:t})=>t==="text",runner:(t,e)=>{t.addText(e.value)}},toMarkdown:{match:t=>t.type.name==="text",runner:(t,e)=>{t.addNode("text",void 0,e.text)}}}));ce(Z3,{displayName:"NodeSchema<text>",group:"Text"});var pk=Ei("html");ce(pk,{displayName:"Attr<html>",group:"Html"});var dk=en("html",t=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:e=>{const n=document.createElement("span"),r={...t.get(pk.key)(e),"data-value":e.attrs.value,"data-type":"html"};return n.textContent=e.attrs.value,["span",r,e.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>e==="html",runner:(e,n,r)=>{e.addNode(r,{value:n.value})}},toMarkdown:{match:e=>e.type.name==="html",runner:(e,n)=>{e.addNode("html",void 0,n.attrs.value)}}}));ce(dk.node,{displayName:"NodeSchema<html>",group:"Html"});ce(dk.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var MF=[U3,HS,$i,Rg,GS,pl,Bm,Ho,XS,Zh,ZS,ep,sk,tp,nk,Hu,Ig,dl,zg,ml,lk,js,zS,Ju,BS,Qh,FS,_a,$S,Tu,pk,dk,Z3].flat(),OF=[H3,X3,Q3,q3,Y3,J3].flat(),RF=[F3,P3,$3,j3],DF=Ue("IsMarkSelected",()=>t=>e=>{if(!t)return!1;const{doc:n,selection:r}=e;return n.rangeHasMark(r.from,r.to,t)}),IF=Ue("IsNoteSelected",()=>t=>e=>t?R8(e,t).hasNode:!1),_F=Ue("ClearTextInCurrentBlock",()=>()=>(t,e)=>{let n=t.tr;const{$from:r,$to:i}=n.selection,{pos:s}=r,{pos:o}=i,u=s-r.node().content.size;return u<0?!1:(n=n.deleteRange(u,o),e?.(n),!0)}),zF=Ue("SetBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;const s=e.tr,{from:o,to:u}=s.selection;try{s.setBlockType(o,u,r,i)}catch{return!1}return n?.(s),!0}),LF=Ue("WrapInBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;let s=e.tr;try{const{$from:o,$to:u}=s.selection,c=o.blockRange(u),h=c&&pF(c,r,i);if(!h)return!1;s=s.wrap(c,h)}catch{return!1}return n?.(s),!0}),BF=Ue("AddBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;const s=e.tr;try{const o=r instanceof Ms?r:r.createAndFill(i);if(!o)return!1;s.replaceSelectionWith(o)}catch{return!1}return n?.(s),!0}),VF=Ue("SelectTextNearPos",()=>t=>(e,n)=>{const{pos:r}=t??{};if(r==null)return!1;const i=(o,u,c)=>Math.min(Math.max(o,u),c),s=e.tr;try{const o=e.doc.resolve(i(r,0,e.doc.content.size));s.setSelection(we.near(o))}catch{return!1}return n?.(s.scrollIntoView()),!0}),FF=[qS,Dg,Ta,YS,ek,rk,W3,K3,G3,Lg,_g,uk,ck,Bg,fk,Tg,PS,Mg,US,JS,DF,IF,_F,zF,LF,BF,VF],PF=[QS,tk,ik,WS,hk,ok,ak,KS,LS,jS,VS].flat(),mk=Ps("remarkAddOrderInList",()=>()=>t=>{_S(t,"list",e=>{if(e.ordered){const n=e.start??1;e.children.forEach((r,i)=>{r.label=i+n})}})});ce(mk.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});ce(mk.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var gk=Ps("remarkLineBreak",()=>()=>t=>{const e=/[\t ]*(?:\r?\n|\r)/g;_S(t,"text",(n,r,i)=>{if(!n.value||typeof n.value!="string")return;const s=[];let o=0;e.lastIndex=0;let u=e.exec(n.value);for(;u;){const c=u.index;o!==c&&s.push({type:"text",value:n.value.slice(o,c)}),s.push({type:"break",data:{isInline:!0}}),o=c+u[0].length,u=e.exec(n.value)}if(s.length>0&&i&&typeof r=="number")return o<n.value.length&&s.push({type:"text",value:n.value.slice(o)}),i.children.splice(r,1,...s),r+s.length})});ce(gk.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});ce(gk.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var yk=Ps("remarkInlineLink",()=>kF);ce(yk.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});ce(yk.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var jF=t=>!!t.children,$F=t=>t.type==="html";function UF(t,e){return n(t,0,null)[0];function n(r,i,s){if(jF(r)){const o=[];for(let u=0,c=r.children.length;u<c;u++){const h=r.children[u];if(h){const m=n(h,u,r);if(m)for(let g=0,y=m.length;g<y;g++){const b=m[g];b&&o.push(b)}}}r.children=o}return e(r,i,s)}}var JF=["root","blockquote","listItem"],xk=Ps("remarkHTMLTransformer",()=>()=>t=>{UF(t,(e,n,r)=>$F(e)?(r&&JF.includes(r.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])});ce(xk.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});ce(xk.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var bk=Ps("remarkMarker",()=>()=>(t,e)=>{const n=r=>e.value.charAt(r.position.start.offset);_S(t,r=>["strong","emphasis"].includes(r.type),r=>{r.marker=n(r)})});ce(bk.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});ce(bk.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var eR=Fs(()=>{let t=!1;const e=new fr({key:new hr("MILKDOWN_INLINE_NODES_CURSOR"),state:{init(){return!1},apply(n){if(!n.selection.empty)return!1;const r=n.selection.$from,i=r.nodeBefore,s=r.nodeAfter;return!!(i&&s&&i.isInline&&!i.isText&&s.isInline&&!s.isText)}},props:{handleDOMEvents:{compositionend:(n,r)=>t?(t=!1,requestAnimationFrame(()=>{if(e.getState(n.state)){const i=n.state.selection.from;r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",i))}}),!0):!1,compositionstart:n=>(e.getState(n.state)&&(t=!0),!1),beforeinput:(n,r)=>{if(e.getState(n.state)&&r instanceof InputEvent&&r.data&&!t){const i=n.state.selection.from;return r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",i)),!0}return!1}},decorations(n){if(e.getState(n)){const r=n.selection.$from.pos,i=document.createElement("span"),s=Ha.widget(r,i,{side:-1}),o=document.createElement("span"),u=Ha.widget(r,o);return setTimeout(()=>{i.contentEditable="true",o.contentEditable="true"}),ni.create(n.doc,[s,u])}return ni.empty}}});return e});ce(eR,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var tR=Fs(t=>new fr({key:new hr("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,n,r)=>{if(!e.length)return;const[i]=e;if(!i)return;const[s]=i.steps;if(i.getMeta("hardbreak")){if(!(s instanceof IS))return;const{from:o}=s;return r.tr.setNodeMarkup(o,Ho.type(t),void 0,[])}if(s instanceof DS){let o=r.tr;const{from:u,to:c}=s;return r.doc.nodesBetween(u,c,(h,m)=>{h.type===Ho.type(t)&&(o=o.setNodeMarkup(m,Ho.type(t),void 0,[]))}),o}}}));ce(tR,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var Sk=Xa(["table","code_block"],"hardbreakFilterNodes");ce(Sk,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var nR=Fs(t=>{const e=t.get(Sk.key);return new fr({key:new hr("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(n,r)=>{const i=n.getMeta("hardbreak"),[s]=n.steps;if(i&&s){const{from:o}=s,u=r.doc.resolve(o);let c=u.depth,h=!0;for(;c>0;)e.includes(u.node(c).type.name)&&(h=!1),c--;return h}return!0}})});ce(nR,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var rR=Fs(t=>{const e=new hr("MILKDOWN_HEADING_ID"),n=r=>{if(r.composing)return;const i=t.get(Rg.key),s=r.state.tr.setMeta("addToHistory",!1);let o=!1;const u={};r.state.doc.descendants((c,h)=>{if(c.type===pl.type(t)){if(c.textContent.trim().length===0)return;const m=c.attrs;let g=i(c);u[g]?(u[g]+=1,g+=`-#${u[g]}`):u[g]=1,m.id!==g&&(o=!0,s.setMeta(e,!0).setNodeMarkup(h,void 0,{...m,id:g}))}}),o&&r.dispatch(s)};return new fr({key:e,view:r=>(n(r),{update:(i,s)=>{i.state.doc.eq(s.doc)||n(i)}})})});ce(rR,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var iR=Fs(t=>{const e=(n,r,i)=>{if(!i.selection||n.some(g=>g.getMeta("addToHistory")===!1||!g.isGeneric))return null;const s=ml.type(t),o=dl.type(t),u=js.type(t),c=(g,y,b=1)=>{let v=!1;const N=`${y+b}.`;return g.label!==N&&(g.label=N,v=!0),v};let h=i.tr,m=!1;return i.doc.descendants((g,y,b,v)=>{if(g.type===o){const N=g.maybeChild(0);N?.type===u&&N.attrs.listType==="ordered"&&(m=!0,h.setNodeMarkup(y,s,{spread:"true"}),g.descendants((T,M,j,P)=>{if(T.type===u){const J={...T.attrs};c(J,P)&&(h=h.setNodeMarkup(M,void 0,J))}return!1}))}else if(g.type===u&&b?.type===s){const N={...g.attrs};let T=!1;N.listType!=="ordered"&&(N.listType="ordered",T=!0),b?.maybeChild(0)&&(T=c(N,v,b?.attrs.order??1)),T&&(h=h.setNodeMarkup(y,void 0,N),m=!0)}}),m?h.setMeta("addToHistory",!1):null};return new fr({key:new hr("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:e})});ce(iR,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var HF=[tR,Sk,nR,eR,mk,yk,gk,xk,bk,Og,rR,iR].flat(),sR=[MF,OF,RF,FF,PF,HF].flat();const aR=65535,oR=Math.pow(2,16);function qF(t,e){return t+e*oR}function DN(t){return t&aR}function KF(t){return(t-(t&aR))/oR}const lR=1,uR=2,hm=4,cR=8;let xb=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&cR)>0}get deletedBefore(){return(this.delInfo&(lR|hm))>0}get deletedAfter(){return(this.delInfo&(uR|hm))>0}get deletedAcross(){return(this.delInfo&hm)>0}},ll=class xu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&xu.empty)return xu.empty}recover(e){let n=0,r=DN(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+KF(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:m);if(r)return b;let v=e==(n<0?c:g)?null:qF(u/3,e-c),N=e==c?uR:e==g?lR:hm;return(n<0?e!=c:e!=g)&&(N|=cR),new xb(b,N,v)}i+=m-h}return r?e+i:new xb(e+i,0,null)}touches(e,n){let r=0,i=DN(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],m=this.ranges[i+r];e(u,u+h,c,c+m),s+=m-h}}invert(){return new xu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?xu.empty:new xu(e<0?[0,-e,0]:[0,0,e])}};ll.empty=new ll([]);class Vm{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Vm(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Vm;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],u=o.mapResult(e,n);if(u.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(u.recover);continue}}i|=u.delInfo,e=u.pos}return r?e:new xb(e,i,null)}}const q1=Object.create(null);let Tn=class{getMap(){return ll.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=q1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in q1)throw new RangeError("Duplicate use of step JSON ID "+e);return q1[e]=n,n.prototype.jsonID=e,n}},Jn=class Rf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Rf(e,null)}static fail(e){return new Rf(null,e)}static fromReplace(e,n,r,i){try{return Rf.ok(e.replace(n,r,i))}catch(s){if(s instanceof wi)return Rf.fail(s.message);throw s}}};function kk(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(kk(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return G.fromArray(r)}let vk=class Df extends Tn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(kk(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Jn.fromReplace(e,this.from,this.to,s)}invert(){return new np(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Df(n.pos,r.pos,this.mark)}merge(e){return e instanceof Df&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Df(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Df(n.from,n.to,e.markFromJSON(n.mark))}};Tn.jsonID("addMark",vk);let np=class If extends Tn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(kk(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Jn.fromReplace(e,this.from,this.to,r)}invert(){return new vk(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new If(n.pos,r.pos,this.mark)}merge(e){return e instanceof If&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new If(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new If(n.from,n.to,e.markFromJSON(n.mark))}};Tn.jsonID("removeMark",np);let Ck=class _f extends Tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Jn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new _f(this.pos,n.marks[i]);return new _f(this.pos,this.mark)}}return new Fm(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new _f(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new _f(n.pos,e.markFromJSON(n.mark))}};Tn.jsonID("addNodeMark",Ck);let Fm=class bb extends Tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Jn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ck(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new bb(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new bb(n.pos,e.markFromJSON(n.mark))}};Tn.jsonID("removeNodeMark",Fm);let qa=class Mo extends Tn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Sb(e,this.from,this.to)?Jn.fail("Structure replace would overwrite content"):Jn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ll([this.from,this.to-this.from,this.slice.size])}invert(e){return new Mo(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Mo(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Mo)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Mo(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Mo(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Mo(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};Tn.jsonID("replace",qa);let qu=class pm extends Tn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(Sb(e,this.from,this.gapFrom)||Sb(e,this.gapTo,this.to)))return Jn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Jn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Jn.fromReplace(e,this.from,this.to,r):Jn.fail("Content does not fit in gap")}getMap(){return new ll([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new pm(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new pm(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new pm(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};Tn.jsonID("replaceAround",qu);function Sb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function GF(t,e,n,r){let i=[],s=[],o,u;t.doc.nodesBetween(e,n,(c,h,m)=>{if(!c.isInline)return;let g=c.marks;if(!r.isInSet(g)&&m.type.allowsMarkType(r.type)){let y=Math.max(h,e),b=Math.min(h+c.nodeSize,n),v=r.addToSet(g);for(let N=0;N<g.length;N++)g[N].isInSet(v)||(o&&o.to==y&&o.mark.eq(g[N])?o.to=b:i.push(o=new np(y,b,g[N])));u&&u.to==y?u.to=b:s.push(u=new vk(y,b,r))}}),i.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function YF(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,u)=>{if(!o.isInline)return;s++;let c=null;if(r instanceof Jh){let h=o.marks,m;for(;m=r.isInSet(h);)(c||(c=[])).push(m),h=m.removeFromSet(h)}else r?r.isInSet(o.marks)&&(c=[r]):c=o.marks;if(c&&c.length){let h=Math.min(u+o.nodeSize,n);for(let m=0;m<c.length;m++){let g=c[m],y;for(let b=0;b<i.length;b++){let v=i[b];v.step==s-1&&g.eq(i[b].style)&&(y=v)}y?(y.to=h,y.step=s):i.push({style:g,from:Math.max(u,e),to:h,step:s})}}}),i.forEach(o=>t.step(new np(o.from,o.to,o.style)))}function wk(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],u=e+1;for(let c=0;c<s.childCount;c++){let h=s.child(c),m=u+h.nodeSize,g=r.matchType(h.type);if(!g)o.push(new qa(u,m,H.empty));else{r=g;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new np(u,m,h.marks[y]));if(i&&h.isText&&n.whitespace!="pre"){let y,b=/\r?\n|\r/g,v;for(;y=b.exec(h.text);)v||(v=new H(G.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),o.push(new qa(u+y.index,u+y.index+y[0].length,v))}}u=m}if(!r.validEnd){let c=r.fillBefore(G.empty,!0);t.replace(u,u,new H(c,0,0))}for(let c=o.length-1;c>=0;c--)t.step(o[c])}function WF(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),u=i.after(s+1),c=o,h=u,m=G.empty,g=0;for(let v=s,N=!1;v>n;v--)N||r.index(v)>0?(N=!0,m=G.from(r.node(v).copy(m)),g++):c--;let y=G.empty,b=0;for(let v=s,N=!1;v>n;v--)N||i.after(v+1)<i.end(v)?(N=!0,y=G.from(i.node(v).copy(y)),b++):h++;t.step(new qu(c,h,o,u,new H(m.append(y),g,b),m.size-g,!0))}function XF(t,e,n){let r=G.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let u=n[o].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=G.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new qu(i,s,i,s,new H(r,0,0),n.length,!0))}function QF(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,u)=>{let c=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,c)&&ZF(t.doc,t.mapping.slice(s).map(u),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!v?h=!1:!b&&v&&(h=!0)}h===!1&&hR(t,o,u,s),wk(t,t.mapping.slice(s).map(u,1),r,void 0,h===null);let m=t.mapping.slice(s),g=m.map(u,1),y=m.map(u+o.nodeSize,1);return t.step(new qu(g,y,g+1,y-1,new H(G.from(r.create(c,null,o.marks)),0,0),1,!0)),h===!0&&fR(t,o,u,s),!1}})}function fR(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,u=/\r?\n|\r/g;for(;o=u.exec(i.text);){let c=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function hR(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
47
+ `))}})}function ZF(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function eP(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new qu(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new H(G.from(o),0,0),1,!0))}function tP(t,e,n=1,r){let i=t.doc.resolve(e),s=G.empty,o=G.empty;for(let u=i.depth,c=i.depth-n,h=n-1;u>c;u--,h--){s=G.from(i.node(u).copy(s));let m=r&&r[h];o=G.from(m?m.type.create(m.attrs,o):i.node(u).copy(o))}t.step(new qa(e,e,new H(s.append(o),n,n),!0))}function nP(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let m=o.whitespace=="pre",g=!!o.contentMatch.matchType(i);m&&!g?r=!1:!m&&g&&(r=!0)}let u=t.steps.length;if(r===!1){let m=t.doc.resolve(e+n);hR(t,m.node(),m.before(),u)}o.inlineContent&&wk(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let c=t.mapping.slice(u),h=c.map(e-n);if(t.step(new qa(h,c.map(e+n,-1),H.empty,!0)),r===!0){let m=t.doc.resolve(h);fR(t,m.node(),m.before(),t.steps.length)}return t}function rP(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function iP(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let u=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(u>0?1:0),h=r.node(o),m=!1;if(s==1)m=h.canReplace(c,c,i);else{let g=h.contentMatchAt(c).findWrapping(i.firstChild.type);m=g&&h.canReplaceWith(c,c,g[0])}if(m)return u==0?r.pos:u<0?r.before(o+1):r.after(o+1)}return null}function sP(t,e,n=e,r=H.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return pR(i,s,r)?new qa(e,n,r):new aP(i,s,r).fit()}function pR(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class aP{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=G.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=G.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,u=i.depth;for(;o&&u&&s.childCount==1;)s=s.firstChild.content,o--,u--;let c=new H(s,o,u);return e>-1?new qu(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new qa(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=K1(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],m,g=null;if(n==1&&(o?h.matchType(o.type)||(g=h.fillBefore(G.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:g};if(n==2&&o&&(m=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:m};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=K1(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new H(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=K1(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new H(zf(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new H(zf(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let N=0;N<s.length;N++)this.openFrontierNode(s[N]);let o=this.unplaced,u=r?r.content:o.content,c=o.openStart-e,h=0,m=[],{match:g,type:y}=this.frontier[n];if(i){for(let N=0;N<i.childCount;N++)m.push(i.child(N));g=g.matchFragment(i)}let b=u.size+e-(o.content.size-o.openEnd);for(;h<u.childCount;){let N=u.child(h),T=g.matchType(N.type);if(!T)break;h++,(h>1||c==0||N.content.size)&&(g=T,m.push(dR(N.mark(y.allowedMarks(N.marks)),h==1?c:0,h==u.childCount?b:-1)))}let v=h==u.childCount;v||(b=-1),this.placed=Lf(this.placed,n,G.from(m)),this.frontier[n].match=g,v&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let N=0,T=u;N<b;N++){let M=T.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),T=M.content}this.unplaced=v?e==0?H.empty:new H(zf(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new H(zf(o.content,e,h),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!G1(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=G1(e,n,i,r,s);if(o){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],m=G1(e,u,h,c,!0);if(!m||m.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Lf(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Lf(this.placed,this.depth,G.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=Lf(this.placed,this.frontier.length,n))}}function zf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(zf(t.firstChild.content,e-1,n)))}function Lf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Lf(t.lastChild.content,e-1,n)))}function K1(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function dR(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,dR(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(G.empty,!0)))),t.copy(r)}function G1(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,o);return u&&!oP(n,s.content,o)?u:null}function oP(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function lP(t){return t.spec.defining||t.spec.definingForContent}function uP(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(pR(i,s,r))return t.step(new qa(e,n,r));let o=gR(i,s);o[o.length-1]==0&&o.pop();let u=-(i.depth+1);o.unshift(u);for(let y=i.depth,b=i.pos-1;y>0;y--,b--){let v=i.node(y).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(y)>-1?u=y:i.before(y)==b&&o.splice(1,0,-y)}let c=o.indexOf(u),h=[],m=r.openStart;for(let y=r.content,b=0;;b++){let v=y.firstChild;if(h.push(v),b==r.openStart)break;y=v.content}for(let y=m-1;y>=0;y--){let b=h[y],v=lP(b.type);if(v&&!b.sameMarkup(i.node(Math.abs(u)-1)))m=y;else if(v||!b.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let b=(y+m+1)%(r.openStart+1),v=h[b];if(v)for(let N=0;N<o.length;N++){let T=o[(N+c)%o.length],M=!0;T<0&&(M=!1,T=-T);let j=i.node(T-1),P=i.index(T-1);if(j.canReplaceWith(P,P,v.type,v.marks))return t.replace(i.before(T),M?s.after(T):n,new H(mR(r.content,0,r.openStart,b),b,r.openEnd))}}let g=t.steps.length;for(let y=o.length-1;y>=0&&(t.replace(e,n,r),!(t.steps.length>g));y--){let b=o[y];b<0||(e=i.before(b),n=s.after(b))}}function mR(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(mR(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(G.empty,!0))}return t}function cP(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=rP(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new H(G.from(r),0,0))}function fP(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=gR(r,i);for(let o=0;o<s.length;o++){let u=s[o],c=o==s.length-1;if(c&&u==0||r.node(u).type.contentMatch.validEnd)return t.delete(r.start(u),i.end(u));if(u>0&&(c||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return t.delete(r.before(u),i.after(u))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function gR(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}let yR=class dm extends Tn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Jn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Jn.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}getMap(){return ll.empty}invert(e){return new dm(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new dm(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new dm(n.pos,n.attr,n.value)}};Tn.jsonID("attr",yR);let xR=class kb extends Tn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Jn.ok(r)}getMap(){return ll.empty}invert(e){return new kb(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new kb(n.attr,n.value)}};Tn.jsonID("docAttr",xR);let Bu=class extends Error{};Bu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Bu.prototype=Object.create(Error.prototype);Bu.prototype.constructor=Bu;Bu.prototype.name="TransformError";class hP{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Vm}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Bu(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,u,c)=>{e=Math.min(e,u),n=Math.max(n,c)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=H.empty){let i=sP(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new H(G.from(r),0,0))}delete(e,n){return this.replace(e,n,H.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return uP(this,e,n,r),this}replaceRangeWith(e,n,r){return cP(this,e,n,r),this}deleteRange(e,n){return fP(this,e,n),this}lift(e,n){return WF(this,e,n),this}join(e,n=1){return nP(this,e,n),this}wrap(e,n){return XF(this,e,n),this}setBlockType(e,n=e,r,i=null){return QF(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return eP(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new yR(e,n,r)),this}setDocAttribute(e,n){return this.step(new xR(e,n)),this}addNodeMark(e,n){return this.step(new Ck(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ut)n.isInSet(r.marks)&&this.step(new Fm(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Fm(e,s)),i=s.removeFromSet(i);for(let u=o.length-1;u>=0;u--)this.step(o[u])}return this}split(e,n=1,r){return tP(this,e,n,r),this}addMark(e,n,r){return GF(this,e,n,r),this}removeMark(e,n,r){return YF(this,e,n,r),this}clearIncompatible(e,n,r){return wk(this,e,n,r),this}}const gl=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},bR=function(t,e,n,r){return n&&(IN(t,e,n,r,-1)||IN(t,e,n,r,1))},pP=/^(img|br|input|textarea|hr)$/i;function IN(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Pm(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ek(t)||pP.test(t.nodeName)||t.contentEditable=="false")return!1;e=gl(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Pm(t):0}else return!1}}function Pm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function dP(t,e,n){for(let r=e==0,i=e==Pm(t);r||i;){if(t==n)return!0;let s=gl(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Pm(t)}}function Ek(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const SR=function(t){return t.focusNode&&bR(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function kR(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Ui=typeof navigator<"u"?navigator:null,_N=typeof document<"u"?document:null,Qa=Ui&&Ui.userAgent||"",vb=/Edge\/(\d+)/.exec(Qa),vR=/MSIE \d/.exec(Qa),Cb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qa),rp=!!(vR||Cb||vb),CR=vR?document.documentMode:Cb?+Cb[1]:vb?+vb[1]:0,Vg=!rp&&/gecko\/(\d+)/i.test(Qa);Vg&&+(/Firefox\/(\d+)/.exec(Qa)||[0,0])[1];const wb=!rp&&/Chrome\/(\d+)/.exec(Qa),$s=!!wb,wR=wb?+wb[1]:0,yl=!rp&&!!Ui&&/Apple Computer/.test(Ui.vendor),Nk=yl&&(/Mobile\/\w+/.test(Qa)||!!Ui&&Ui.maxTouchPoints>2),Yr=Nk||(Ui?/Mac/.test(Ui.platform):!1),ER=Ui?/Win/.test(Ui.platform):!1,ip=/Android \d/.test(Qa),Ak=!!_N&&"webkitFontSmoothing"in _N.documentElement.style,mP=Ak?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function gP(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let u=r.resolve(o),c,h;if(SR(n)){for(c=o;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&ge.isSelectable(g)&&i.parent&&!(g.isInline&&dP(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new ge(o==y?u:r.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=o,y=o;for(let b=0;b<n.rangeCount;b++){let v=n.getRangeAt(b);g=Math.min(g,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(g<0)return null;[c,o]=y==t.state.selection.anchor?[y,g]:[g,y],u=r.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let m=r.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=AR(t,m,u,g)}return h}function NR(t){return t.editable?t.hasFocus():SP(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Tk(t,e=!1){let n=t.state.selection;if(bP(t,n),!!NR(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&$s){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&bR(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)xP(t);else{let{anchor:r,head:i}=n,s,o;zN&&!(n instanceof we)&&(n.$from.parent.inlineContent||(s=LN(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=LN(t,n.to))),t.docView.setSelection(r,i,t,e),zN&&(s&&BN(s),o&&BN(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&yP(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const zN=yl||$s&&wR<63;function LN(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(yl&&i&&i.contentEditable=="false")return Y1(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Y1(i);if(s)return Y1(s)}}function Y1(t){return t.contentEditable="true",yl&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function BN(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function yP(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!NR(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function xP(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,gl(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&rp&&CR<=11&&(n.disabled=!0,n.disabled=!1)}function bP(t,e){if(e instanceof ge){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(VN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else VN(t)}function VN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function AR(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||we.between(e,n,r)}function SP(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Eb(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ve.findFrom(s,e)}function Ma(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function FN(t,e,n){let r=t.state.selection;if(r instanceof we)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ma(t,new we(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Eb(t.state,e);return i&&i instanceof ge?Ma(t,i):!1}else if(!(Yr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(u))&&!o.contentDOM?ge.isSelectable(s)?Ma(t,new ge(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Ak?Ma(t,new we(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ge&&r.node.isInline)return Ma(t,new we(e>0?r.$to:r.$from));{let i=Eb(t.state,e);return i?Ma(t,i):!1}}}function jm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function eh(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ou(t,e){return e<0?kP(t):vP(t)}function kP(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Vg&&n.nodeType==1&&r<jm(n)&&eh(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(eh(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(TR(n))break;{let u=n.previousSibling;for(;u&&eh(u,-1);)i=n.parentNode,s=gl(u),u=u.previousSibling;if(u)n=u,r=jm(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Nb(t,n,r):i&&Nb(t,i,s)}function vP(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=jm(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(eh(u,1))s=n,o=++r;else break}else{if(TR(n))break;{let u=n.nextSibling;for(;u&&eh(u,1);)s=u.parentNode,o=gl(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=jm(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Nb(t,s,o)}function TR(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function CP(t,e){for(;t&&e==t.childNodes.length&&!Ek(t);)e=gl(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function wP(t,e){for(;t&&!e&&!Ek(t);)e=gl(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Nb(t,e,n){if(e.nodeType!=3){let s,o;(o=CP(e,n))?(e=o,n=0):(s=wP(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(SR(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Tk(t)},50)}function PN(t,e){let n=t.state.doc.resolve(e);if(!($s||ER)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function jN(t,e,n){let r=t.state.selection;if(r instanceof we&&!r.empty||n.indexOf("s")>-1||Yr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Eb(t.state,e);if(o&&o instanceof ge)return Ma(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,u=r instanceof Hn?Ve.near(o,e):Ve.findFrom(o,e);return u?Ma(t,u):!1}return!1}function $N(t,e){if(!(t.state.selection instanceof we))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function UN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function EP(t){if(!yl||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;UN(t,r,"true"),setTimeout(()=>UN(t,r,"false"),20)}return!1}function NP(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function AP(t,e){let n=e.keyCode,r=NP(e);if(n==8||Yr&&n==72&&r=="c")return $N(t,-1)||ou(t,-1);if(n==46&&!e.shiftKey||Yr&&n==68&&r=="c")return $N(t,1)||ou(t,1);if(n==13||n==27)return!0;if(n==37||Yr&&n==66&&r=="c"){let i=n==37?PN(t,t.state.selection.from)=="ltr"?-1:1:-1;return FN(t,i,r)||ou(t,i)}else if(n==39||Yr&&n==70&&r=="c"){let i=n==39?PN(t,t.state.selection.from)=="ltr"?1:-1:1;return FN(t,i,r)||ou(t,i)}else{if(n==38||Yr&&n==80&&r=="c")return jN(t,-1,r)||ou(t,-1);if(n==40||Yr&&n==78&&r=="c")return EP(t)||jN(t,1,r)||ou(t,1);if(r==(Yr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function MR(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let o=t.someProp("clipboardSerializer")||Gi.fromSchema(t.state.schema),u=zR(),c=u.createElement("div");c.appendChild(o.serializeFragment(r,{document:u}));let h=c.firstChild,m,g=0;for(;h&&h.nodeType==1&&(m=_R[h.nodeName.toLowerCase()]);){for(let b=m.length-1;b>=0;b--){let v=u.createElement(m[b]);for(;c.firstChild;)v.appendChild(c.firstChild);c.appendChild(v),g++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${s}${g?` -${g}`:""} ${JSON.stringify(n)}`);let y=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
48
+
49
+ `);return{dom:c,text:y,slice:e}}function OR(t,e,n,r,i){let s=i.parent.type.spec.code,o,u;if(!n&&!e)return null;let c=!!e&&(r||s||!n);if(c){if(t.someProp("transformPastedText",y=>{e=y(e,s||r,t)}),s)return u=new H(G.from(t.state.schema.text(e.replace(/\r\n?/g,`
50
+ `))),0,0),t.someProp("transformPasted",y=>{u=y(u,t,!0)}),u;let g=t.someProp("clipboardTextParser",y=>y(e,i,r,t));if(g)u=g;else{let y=i.marks(),{schema:b}=t.state,v=Gi.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(N=>{let T=o.appendChild(document.createElement("p"));N&&T.appendChild(v.serializeNode(b.text(N,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=RP(n),Ak&&DP(o);let h=o&&o.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let g=+m[3];g>0;g--){let y=o.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;o=y}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||$a.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||m),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!TP.test(y.parentNode.nodeName)?{ignore:!0}:null}})),m)u=IP(JN(u,+m[1],+m[2]),m[4]);else if(u=H.maxOpen(MP(u.content,i),!0),u.openStart||u.openEnd){let g=0,y=0;for(let b=u.content.firstChild;g<u.openStart&&!b.type.spec.isolating;g++,b=b.firstChild);for(let b=u.content.lastChild;y<u.openEnd&&!b.type.spec.isolating;y++,b=b.lastChild);u=JN(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const TP=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function MP(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(u=>{if(!o)return;let c=i.findWrapping(u.type),h;if(!c)return o=null;if(h=o.length&&s.length&&DR(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=IR(o[o.length-1],s.length));let m=RR(u,c);o.push(m),i=i.matchType(m.type),s=c}}),o)return G.from(o)}return t}function RR(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,G.from(t));return t}function DR(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=DR(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(G.from(RR(n,t,i+1))))}}function IR(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,IR(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(G.empty,!0);return t.copy(n.append(r))}function Ab(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,u=o.content;return t.childCount>1&&(s=0),i<r-1&&(u=Ab(u,e,n,r,i+1,s)),i>=n&&(u=e<0?o.contentMatchAt(0).fillBefore(u,s<=i).append(u):u.append(o.contentMatchAt(o.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function JN(t,e,n){return e<t.openStart&&(t=new H(Ab(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new H(Ab(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const _R={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let HN=null;function zR(){return HN||(HN=document.implementation.createHTMLDocument("title"))}let W1=null;function OP(t){let e=window.trustedTypes;return e?(W1||(W1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),W1.createHTML(t)):t}function RP(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=zR().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&_R[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=OP(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function DP(t){let e=t.querySelectorAll($s?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function IP(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let u=r.length-2;u>=0;u-=2){let c=n.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=G.from(c.create(r[u+1],i)),s++,o++}return new H(i,s,o)}const Ni={},Nr={};function za(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Nr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!BR(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ip&&$s&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Nk&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,kR(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||AP(t,n)?n.preventDefault():za(t,"key")};Nr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Nr.keypress=(t,e)=>{let n=e;if(BR(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Yr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof we)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Fg(t){return{left:t.clientX,top:t.clientY}}function _P(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Mk(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,u=>o>s.depth?u(t,n,s.nodeAfter,s.before(o),i,!0):u(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Mu(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function zP(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ge.isSelectable(r)?(Mu(t,new ge(n)),!0):!1}function LP(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ge&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let u=o>s.depth?s.nodeAfter:s.node(o);if(ge.isSelectable(u)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Mu(t,ge.create(t.state.doc,i)),!0):!1}function BP(t,e,n,r,i){return Mk(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?LP(t,n):zP(t,n))}function VP(t,e,n,r){return Mk(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function FP(t,e,n,r){return Mk(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||PP(t,n,r)}function PP(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Mu(t,we.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(o.inlineContent)Mu(t,we.create(r,u+1,u+1+o.content.size));else if(ge.isSelectable(o))Mu(t,ge.create(r,u));else continue;return!0}}function Ok(t){return $m(t)}const LR=Yr?"metaKey":"ctrlKey";Ni.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ok(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&_P(n,t.input.lastClick)&&!n[LR]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Fg(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new jP(t,o,n,!!r)):(s=="doubleClick"?VP:FP)(t,o.pos,o.inside,n)?n.preventDefault():za(t,"pointer"))};let jP=class{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[LR],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let m=e.state.doc.resolve(n.pos);s=m.parent,o=m.depth?m.before():0}const u=i?null:r.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||h instanceof ge&&h.from<=o&&h.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Vg&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),za(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Tk(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Fg(e))),this.updateAllowDefault(e),this.allowDefault||!n?za(this.view,"pointer"):BP(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||yl&&this.mightDrag&&!this.mightDrag.node.isAtom||$s&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Mu(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):za(this.view,"pointer")}move(e){this.updateAllowDefault(e),za(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};Ni.touchstart=t=>{t.input.lastTouch=Date.now(),Ok(t),za(t,"pointer")};Ni.touchmove=t=>{t.input.lastTouch=Date.now(),za(t,"pointer")};Ni.contextmenu=t=>Ok(t);function BR(t,e){return t.composing?!0:yl&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const $P=ip?5e3:-1;Nr.compositionstart=Nr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof we&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||$s&&ER&&UP(t)))t.markCursor=t.state.storedMarks||n.marks(),$m(t,!0),t.markCursor=null;else if($m(t,!e.selection.empty),Vg&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let u=t.domSelection();u&&u.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}VR(t,$P)};function UP(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Nr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,VR(t,20))};function VR(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>$m(t),e))}function JP(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=HP());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function HP(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function $m(t,e=!1){if(!(ip&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),JP(t),e||t.docView&&t.docView.dirty){let n=gP(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function qP(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Nh=rp&&CR<15||Nk&&mP<604;Ni.copy=Nr.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Nh?null:n.clipboardData,o=r.content(),{dom:u,text:c}=MR(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):qP(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function KP(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function GP(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Tb(t,r.value,null,i,e):Tb(t,r.textContent,r.innerHTML,i,e)},50)}function Tb(t,e,n,r,i){let s=OR(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||H.empty)))return!0;if(!s)return!1;let o=KP(s),u=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function FR(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Nr.paste=(t,e)=>{let n=e;if(t.composing&&!ip)return;let r=Nh?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Tb(t,FR(r),r.getData("text/html"),i,n)?n.preventDefault():GP(t,n)};let YP=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const WP=Yr?"altKey":"ctrlKey";function PR(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[WP]}Ni.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Fg(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ge?i.to-1:i.to))){if(r&&r.mightDrag)o=ge.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let g=t.docView.nearestDesc(n.target,!0);g&&g.node.type.spec.draggable&&g!=t.docView&&(o=ge.create(t.state.doc,g.posBefore))}}let u=(o||t.state.selection).content(),{dom:c,text:h,slice:m}=MR(t,u);(!n.dataTransfer.files.length||!$s||wR>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Nh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Nh||n.dataTransfer.setData("text/plain",h),t.dragging=new YP(m,PR(t,n),o)};Ni.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Nr.dragover=Nr.dragenter=(t,e)=>e.preventDefault();Nr.drop=(t,e)=>{try{XP(t,e,t.dragging)}finally{t.dragging=null}};function XP(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Fg(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=OR(t,FR(e.dataTransfer),Nh?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&PR(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||H.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?iP(t.state.doc,i.pos,s):i.pos;u==null&&(u=i.pos);let c=t.state.tr;if(o){let{node:b}=n;b?b.replace(c):c.deleteSelection()}let h=c.mapping.map(u),m=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(m?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(m&&ge.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new ge(y));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((v,N,T,M)=>b=M),c.setSelection(AR(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Ni.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Tk(t)},20))};Ni.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ni.beforeinput=(t,e)=>{if($s&&ip&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,kR(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Nr)Ni[t]=Nr[t];function Ah(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}let qN=class jR{constructor(e,n){this.toDOM=e,this.spec=n||qo,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new ul(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof jR&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ah(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},th=class Mb{constructor(e,n){this.attrs=e,this.spec=n||qo}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new ul(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Mb&&Ah(this.attrs,e.attrs)&&Ah(this.spec,e.spec)}static is(e){return e.type instanceof Mb}destroy(){}},QP=class $R{constructor(e,n){this.attrs=e,this.spec=n||qo}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new ul(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof $R&&Ah(this.attrs,e.attrs)&&Ah(this.spec,e.spec)}destroy(){}},ul=class Bf{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Bf(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Bf(e,e,new qN(n,r))}static inline(e,n,r,i){return new Bf(e,n,new th(r,i))}static node(e,n,r,i){return new Bf(e,n,new QP(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof th}get widget(){return this.type instanceof qN}};const bu=[],qo={};let ri=class Na{constructor(e,n){this.local=e.length?e:bu,this.children=n.length?n:bu}static create(e,n){return n.length?Um(n,e,0,qo):zn}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let u=this.local[o];u.from<=n&&u.to>=e&&(!s||s(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let u=this.children[o]+1;this.children[o+2].findInner(e-u,n-u,r,i+u,s)}}map(e,n,r){return this==zn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||qo)}mapInner(e,n,r,i,s){let o;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(n,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?ej(this.children,o||[],e,n,r,i,s):o?new Na(o.sort(Ko),bu):zn}add(e,n){return n.length?this==zn?Na.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((u,c)=>{let h=c+r,m;if(m=JR(n,u,h)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(u,m,h+1):i.splice(s,0,c,c+u.nodeSize,Um(m,u,h+1,qo)),s+=3}});let o=UR(s?HR(n):n,-r);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new Na(o.length?this.local.concat(o).sort(Ko):this.local,i||this.children)}remove(e){return e.length==0||this==zn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,u=r[s]+n,c=r[s+1]+n;for(let m=0,g;m<e.length;m++)(g=e[m])&&g.from>u&&g.to<c&&(e[m]=null,(o||(o=[])).push(g));if(!o)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(o,u+1);h!=zn?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let u=0;u<i.length;u++)i[u].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Na(i,r):zn}forChild(e,n){if(this==zn)return this;if(n.isLeaf)return Na.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=this.children[u+2]);break}let s=e+1,o=s+n.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<o&&c.to>s&&c.type instanceof th){let h=Math.max(s,c.from)-s,m=Math.min(o,c.to)-s;h<m&&(i||(i=[])).push(c.copy(h,m))}}if(i){let u=new Na(i.sort(Ko),bu);return r?new ZP([u,r]):u}return r||zn}eq(e){if(this==e)return!0;if(!(e instanceof Na)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Rk(this.localsInner(e))}localsInner(e){if(this==zn)return bu;if(e.inlineContent||!this.local.some(th.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof th||n.push(this.local[r]);return n}forEachSet(e){e(this)}};ri.empty=new ri([],[]);ri.removeOverlap=Rk;const zn=ri.empty;let ZP=class Su{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,qo));return Su.from(r)}forChild(e,n){if(n.isLeaf)return ri.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=zn&&(s instanceof Su?r=r.concat(s.members):r.push(s))}return Su.from(r)}eq(e){if(!(e instanceof Su)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Rk(r?n:n.sort(Ko)):bu}static from(e){switch(e.length){case 0:return zn;case 1:return e[0];default:return new Su(e.every(n=>n instanceof ri)?e:e.reduce((n,r)=>n.concat(r instanceof ri?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function ej(t,e,n,r,i,s,o){let u=t.slice();for(let h=0,m=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,b,v,N)=>{let T=N-v-(b-y);for(let M=0;M<u.length;M+=3){let j=u[M+1];if(j<0||y>j+m-g)continue;let P=u[M]+m-g;b>=P?u[M+1]=y<=P?-2:-1:y>=m&&T&&(u[M]+=T,u[M+1]+=T)}g+=T}),m=n.maps[h].map(m,-1)}let c=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){c=!0,u[h+1]=-1;continue}let m=n.map(t[h]+s),g=m-i;if(g<0||g>=r.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),b=y-i,{index:v,offset:N}=r.content.findIndex(g),T=r.maybeChild(v);if(T&&N==g&&N+T.nodeSize==b){let M=u[h+2].mapInner(n,T,m+1,t[h]+s+1,o);M!=zn?(u[h]=g,u[h+1]=b,u[h+2]=M):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=tj(u,t,e,n,i,s,o),m=Um(h,r,0,o);e=m.local;for(let g=0;g<u.length;g+=3)u[g+1]<0&&(u.splice(g,3),g-=3);for(let g=0,y=0;g<m.children.length;g+=3){let b=m.children[g];for(;y<u.length&&u[y]<b;)y+=3;u.splice(y,0,m.children[g],m.children[g+1],m.children[g+2])}}return new ri(e.sort(Ko),u)}function UR(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new ul(i.from+e,i.to+e,i.type))}return n}function tj(t,e,n,r,i,s,o){function u(c,h){for(let m=0;m<c.local.length;m++){let g=c.local[m].map(r,i,h);g?n.push(g):o.onRemove&&o.onRemove(c.local[m].spec)}for(let m=0;m<c.children.length;m+=3)u(c.children[m+2],c.children[m]+h+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&u(t[c+2],e[c]+s+1);return n}function JR(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function HR(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Um(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=JR(t,u,c+n);if(h){s=!0;let m=Um(h,u,n+c+1,r);m!=zn&&i.push(c,c+u.nodeSize,m)}});let o=UR(s?HR(t):t,-n).sort(Ko);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||(r.onRemove&&r.onRemove(o[u].spec),o.splice(u--,1));return o.length||i.length?new ri(o,i):zn}function Ko(t,e){return t.from-e.from||t.to-e.to}function Rk(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),KN(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),KN(e,i,r.copy(s.from,r.to)));break}}}return e}function KN(t,e,n){for(;e<t.length&&Ko(n,t[e])>0;)e++;t.splice(e,0,n)}let Ob,Rb;if(typeof WeakMap<"u"){let t=new WeakMap;Ob=e=>t.get(e),Rb=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Ob=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Rb=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var bt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let u=1;s<this.width&&this.map[e+u]==n;u++)s++;for(let u=1;o<this.height&&this.map[e+this.width*u]==n;u++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:u,top:c,bottom:h}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,u),bottom:Math.max(s,h)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const u=(t+1)*this.width;for(;o<u&&this.map[o]<i;)o++;return o==u?s-1:this.map[o]}i=s}}static get(t){return Ob(t)||Rb(t,nj(t))}};function nj(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=rj(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let h=0,m=e*n;h<m;h++)r[h]=0;for(let h=0,m=0;h<n;h++){const g=t.child(h);m++;for(let v=0;;v++){for(;i<r.length&&r[i]!=0;)i++;if(v==g.childCount)break;const N=g.child(v),{colspan:T,rowspan:M,colwidth:j}=N.attrs;for(let P=0;P<M;P++){if(P+h>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:m,n:M-P});break}const J=i+P*e;for(let L=0;L<T;L++){r[J+L]==0?r[J+L]=m:(s||(s=[])).push({type:"collision",row:h,pos:m,n:T-L});const C=j&&j[L];if(C){const z=(J+L)%e*2,q=o[z];q==null||q!=C&&o[z+1]==1?(o[z]=C,o[z+1]=1):q==C&&o[z+1]++}}}i+=T,m+=N.nodeSize}const y=(h+1)*e;let b=0;for(;i<y;)r[i++]==0&&b++;b&&(s||(s=[])).push({type:"missing",row:h,n:b}),m++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const u=new bt(e,n,r,s);let c=!1;for(let h=0;!c&&h<o.length;h+=2)o[h]!=null&&o[h+1]<n&&(c=!0);return c&&ij(u,o,t),u}function rj(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const u=t.child(o);for(let c=0;c<u.childCount;c++){const h=u.child(c);o+h.attrs.rowspan>r&&(s+=h.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const u=i.child(o);s+=u.attrs.colspan,u.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function ij(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let u=null;const c=o.attrs;for(let h=0;h<c.colspan;h++){const m=e[(i+h)%t.width*2];m!=null&&(!c.colwidth||c.colwidth[h]!=m)&&((u||(u=sj(c)))[h]=m)}u&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:u})}}function sj(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function GN(t,e){if(typeof t=="string")return{};const n=t.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(o=>Number(o)):null,i=Number(t.getAttribute("colspan")||1),s={colspan:i,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:r&&r.length==i?r:null};for(const o in e){const u=e[o].getFromDOM,c=u&&u(t);c!=null&&(s[o]=c)}return s}function YN(t,e){const n={};t.attrs.colspan!=1&&(n.colspan=t.attrs.colspan),t.attrs.rowspan!=1&&(n.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(n["data-colwidth"]=t.attrs.colwidth.join(","));for(const r in e){const i=e[r].setDOMAttr;i&&i(t.attrs[r],n)}return n}function aj(t){if(t!==null){if(!Array.isArray(t))throw new TypeError("colwidth must be null or an array");for(const e of t)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function oj(t){const e=t.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:aj}};for(const r in e)n[r]={default:e[r].default,validate:e[r].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:t.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:r=>GN(r,e)}],toDOM(r){return["td",YN(r,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>GN(r,e)}],toDOM(r){return["th",YN(r,e),0]}}}}function ii(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Da=new hr("selectingCells");function Vu(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function oi(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Pg(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Vu(e.$head)||lj(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function lj(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Db(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function uj(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Dk(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function qR(t,e,n){const r=t.node(-1),i=bt.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function cl(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function cj(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function fj(t,e,n){const r=ii(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var Rt=class Cs extends Ve{constructor(e,n=e){const r=e.node(-1),i=bt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),u=e.node(0),c=i.cellsInRect(o).filter(m=>m!=n.pos-s);c.unshift(n.pos-s);const h=c.map(m=>{const g=r.nodeAt(m);if(!g)throw new RangeError(`No cell with offset ${m} found`);const y=s+m+1;return new jM(u.resolve(y),u.resolve(y+g.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Db(r)&&Db(i)&&Dk(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Cs.rowSelection(r,i):s&&this.isColSelection()?Cs.colSelection(r,i):new Cs(r,i)}return we.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=bt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let c=i.top;c<i.bottom;c++){const h=[];for(let m=c*n.width+i.left,g=i.left;g<i.right;g++,m++){const y=n.map[m];if(s[y])continue;s[y]=!0;const b=n.findCell(y);let v=e.nodeAt(y);if(!v)throw new RangeError(`No cell with offset ${y} found`);const N=i.left-b.left,T=b.right-i.right;if(N>0||T>0){let M=v.attrs;if(N>0&&(M=cl(M,0,N)),T>0&&(M=cl(M,M.colspan-T,T)),b.left<i.left){if(v=v.type.createAndFill(M),!v)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(M)}`)}else v=v.type.create(M,v.content)}if(b.top<i.top||b.bottom>i.bottom){const M={...v.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top<i.top?v=v.type.createAndFill(M):v=v.type.create(M,v.content)}h.push(v)}o.push(e.child(c).copy(G.from(h)))}const u=this.isColSelection()&&this.isRowSelection()?e:o;return new H(G.from(u),1,1)}replace(e,n=H.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:u,$to:c}=i[o],h=e.mapping.slice(r);e.replace(h.map(u.pos),h.map(c.pos),o?H.empty:n)}const s=Ve.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new H(G.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=bt.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=bt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),u=i.findCell(n.pos-s),c=e.node(0);return o.top<=u.top?(o.top>0&&(e=c.resolve(s+i.map[o.left])),u.bottom<i.height&&(n=c.resolve(s+i.map[i.width*(i.height-1)+u.right-1]))):(u.top>0&&(n=c.resolve(s+i.map[u.left])),o.bottom<i.height&&(e=c.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Cs(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=bt.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,u=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,u)==n.width}eq(e){return e instanceof Cs&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=bt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),u=i.findCell(n.pos-s),c=e.node(0);return o.left<=u.left?(o.left>0&&(e=c.resolve(s+i.map[o.top*i.width])),u.right<i.width&&(n=c.resolve(s+i.map[i.width*(u.top+1)-1]))):(u.left>0&&(n=c.resolve(s+i.map[u.top*i.width])),o.right<i.width&&(e=c.resolve(s+i.map[i.width*(o.top+1)-1]))),new Cs(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Cs(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Cs(e.resolve(n),e.resolve(r))}getBookmark(){return new hj(this.$anchorCell.pos,this.$headCell.pos)}};Rt.prototype.visible=!1;Ve.jsonID("cell",Rt);var hj=class KR{constructor(e,n){this.anchor=e,this.head=n}map(e){return new KR(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Dk(n,r)?new Rt(n,r):Ve.near(r,1)}};function pj(t){if(!(t.selection instanceof Rt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(ul.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ri.create(t.doc,e)}function dj({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function mj({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function gj(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof ge&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Rt.create(i,r.from);else if(o=="row"){const u=i.resolve(r.from+1);s=Rt.rowSelection(u,u)}else if(!n){const u=bt.get(r.node),c=r.from+1,h=c+u.map[u.width*u.height-1];s=Rt.create(i,c+1,h)}}else r instanceof we&&dj(r)?s=we.create(i,r.from):r instanceof we&&mj(r)&&(s=we.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const yj=new hr("fix-tables");function GR(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,u=0;o<s;o++){const c=e.child(o);for(let h=u,m=Math.min(i,o+3);h<m;h++)if(t.child(h)==c){u=h+1,n+=c.nodeSize;continue e}r(c,n),u<i&&t.child(u).sameMarkup(c)?GR(t.child(u),c,n+1,r):c.nodesBetween(0,c.content.size,r,n+1),n+=c.nodeSize}}function xj(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=bj(t,i,s,n))};return e?e.doc!=t.doc&&GR(e.doc,t.doc,0,r):t.doc.descendants(r),n}function bj(t,e,n,r){const i=bt.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let c=0;c<i.height;c++)s.push(0);for(let c=0;c<i.problems.length;c++){const h=i.problems[c];if(h.type=="collision"){const m=e.nodeAt(h.pos);if(!m)continue;const g=m.attrs;for(let y=0;y<g.rowspan;y++)s[h.row+y]+=h.n;r.setNodeMarkup(r.mapping.map(n+1+h.pos),null,cl(g,g.colspan-h.n,h.n))}else if(h.type=="missing")s[h.row]+=h.n;else if(h.type=="overlong_rowspan"){const m=e.nodeAt(h.pos);if(!m)continue;r.setNodeMarkup(r.mapping.map(n+1+h.pos),null,{...m.attrs,rowspan:m.attrs.rowspan-h.n})}else if(h.type=="colwidth mismatch"){const m=e.nodeAt(h.pos);if(!m)continue;r.setNodeMarkup(r.mapping.map(n+1+h.pos),null,{...m.attrs,colwidth:h.colwidth})}else if(h.type=="zero_sized"){const m=r.mapping.map(n);r.delete(m,m+e.nodeSize)}}let o,u;for(let c=0;c<s.length;c++)s[c]&&(o==null&&(o=c),u=c);for(let c=0,h=n+1;c<i.height;c++){const m=e.child(c),g=h+m.nodeSize,y=s[c];if(y>0){let b="cell";m.firstChild&&(b=m.firstChild.type.spec.tableRole);const v=[];for(let T=0;T<y;T++){const M=ii(t.schema)[b].createAndFill();M&&v.push(M)}const N=(c==0||o==c-1)&&u==c?h+1:g-1;r.insert(r.mapping.map(N),v)}h=g}return r.setMeta(yj,{fixTables:!0})}function YR(t){const e=bt.get(t),n=[],r=e.height,i=e.width;for(let s=0;s<r;s++){const o=[];for(let u=0;u<i;u++){const c=s*i+u,h=e.map[c];if(s>0){const m=c-i;if(h===e.map[m]){o.push(null);continue}}if(u>0){const m=c-1;if(h===e.map[m]){o.push(null);continue}}o.push(t.nodeAt(h))}n.push(o)}return n}function WR(t,e){const n=[],r=bt.get(t),i=r.height,s=r.width;for(let o=0;o<i;o++){const u=t.child(o),c=[];for(let m=0;m<s;m++){const g=e[o][m];if(!g)continue;const y=r.map[o*r.width+m],b=t.nodeAt(y);if(!b)continue;const v=b.type.createChecked(g.attrs,g.content,g.marks);c.push(v)}const h=u.type.createChecked(u.attrs,c,u.marks);n.push(h)}return t.type.createChecked(t.attrs,n,t.marks)}function XR(t,e,n,r){const i=e[0]>n[0]?-1:1,s=t.splice(e[0],e.length),o=s.length%2===0?1:0;let u;return u=i===-1?n[0]:n[n.length-1]-o,t.splice(u,0,...s),t}function sp(t){return Sj(e=>e.type.spec.tableRole==="table",t)}function Sj(t,e){for(let n=e.depth;n>=0;n-=1){const r=e.node(n);if(t(r))return{node:r,pos:n===0?0:e.before(n),start:e.start(n),depth:n}}return null}function ku(t,e){const n=sp(e.$from);if(!n)return;const r=bt.get(n.node);if(!(t<0||t>r.width-1))return r.cellsInRect({left:t,right:t+1,top:0,bottom:r.height}).map(i=>{const s=n.node.nodeAt(i),o=i+n.start;return{pos:o,start:o+1,node:s,depth:n.depth+2}})}function vu(t,e){const n=sp(e.$from);if(!n)return;const r=bt.get(n.node);if(!(t<0||t>r.height-1))return r.cellsInRect({left:0,right:r.width,top:t,bottom:t+1}).map(i=>{const s=n.node.nodeAt(i),o=i+n.start;return{pos:o,start:o+1,node:s,depth:n.depth+2}})}function WN(t,e,n=e){let r=e,i=n;for(let m=e;m>=0;m--){const g=ku(m,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.colspan+m-1;b>=r&&(r=m),b>i&&(i=b)})}for(let m=e;m<=i;m++){const g=ku(m,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.colspan+m-1;y.node.attrs.colspan>1&&b>i&&(i=b)})}const s=[];for(let m=r;m<=i;m++){const g=ku(m,t.selection);g&&g.length>0&&s.push(m)}r=s[0],i=s[s.length-1];const o=ku(r,t.selection),u=vu(0,t.selection);if(!o||!u)return;const c=t.doc.resolve(o[o.length-1].pos);let h;for(let m=i;m>=r;m--){const g=ku(m,t.selection);if(g&&g.length>0){for(let y=u.length-1;y>=0;y--)if(u[y].pos===g[0].pos){h=g[0];break}if(h)break}}if(h)return{$anchor:c,$head:t.doc.resolve(h.pos),indexes:s}}function XN(t,e,n=e){let r=e,i=n;for(let m=e;m>=0;m--){const g=vu(m,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.rowspan+m-1;b>=r&&(r=m),b>i&&(i=b)})}for(let m=e;m<=i;m++){const g=vu(m,t.selection);g&&g.forEach(y=>{const b=y.node.attrs.rowspan+m-1;y.node.attrs.rowspan>1&&b>i&&(i=b)})}const s=[];for(let m=r;m<=i;m++){const g=vu(m,t.selection);g&&g.length>0&&s.push(m)}r=s[0],i=s[s.length-1];const o=vu(r,t.selection),u=ku(0,t.selection);if(!o||!u)return;const c=t.doc.resolve(o[o.length-1].pos);let h;for(let m=i;m>=r;m--){const g=vu(m,t.selection);if(g&&g.length>0){for(let y=u.length-1;y>=0;y--)if(u[y].pos===g[0].pos){h=g[0];break}if(h)break}}if(h)return{$anchor:c,$head:t.doc.resolve(h.pos),indexes:s}}function QN(t){return t[0].map((e,n)=>t.map(r=>r[n]))}function kj(t){var e,n;const{tr:r,originIndex:i,targetIndex:s,select:o,pos:u}=t,c=sp(r.doc.resolve(u));if(!c)return!1;const h=(e=WN(r,i))===null||e===void 0?void 0:e.indexes,m=(n=WN(r,s))===null||n===void 0?void 0:n.indexes;if(!h||!m||h.includes(s))return!1;const g=vj(c.node,h,m);if(r.replaceWith(c.pos,c.pos+c.node.nodeSize,g),!o)return!0;const y=bt.get(g),b=c.start,v=s,N=y.positionAt(y.height-1,v,g),T=r.doc.resolve(b+N),M=y.positionAt(0,v,g),j=r.doc.resolve(b+M);return r.setSelection(Rt.colSelection(T,j)),!0}function vj(t,e,n,r){let i=QN(YR(t));return i=XR(i,e,n),i=QN(i),WR(t,i)}function Cj(t){var e,n;const{tr:r,originIndex:i,targetIndex:s,select:o,pos:u}=t,c=sp(r.doc.resolve(u));if(!c)return!1;const h=(e=XN(r,i))===null||e===void 0?void 0:e.indexes,m=(n=XN(r,s))===null||n===void 0?void 0:n.indexes;if(!h||!m||h.includes(s))return!1;const g=wj(c.node,h,m);if(r.replaceWith(c.pos,c.pos+c.node.nodeSize,g),!o)return!0;const y=bt.get(g),b=c.start,v=s,N=y.positionAt(v,y.width-1,g),T=r.doc.resolve(b+N),M=y.positionAt(v,0,g),j=r.doc.resolve(b+M);return r.setSelection(Rt.rowSelection(T,j)),!0}function wj(t,e,n,r){let i=YR(t);return i=XR(i,e,n),WR(t,i)}function Za(t){const e=t.selection,n=Pg(t),r=n.node(-1),i=n.start(-1),s=bt.get(r);return{...e instanceof Rt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function QR(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;fj(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const u=o*e.width+i;if(i>0&&i<e.width&&e.map[u-1]==e.map[u]){const c=e.map[u],h=r.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,cj(h.attrs,i-e.colCount(c))),o+=h.attrs.rowspan-1}else{const c=s==null?ii(r.type.schema).cell:r.nodeAt(e.map[u+s]).type,h=e.positionAt(o,i,r);t.insert(t.mapping.map(n+h),c.createAndFill())}}return t}function Ej(t,e){if(!oi(t))return!1;if(e){const n=Za(t);e(QR(t.tr,n,n.left))}return!0}function Nj(t,e){if(!oi(t))return!1;if(e){const n=Za(t);e(QR(t.tr,n,n.right))}return!0}function Aj(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const u=o*e.width+i,c=e.map[u],h=n.nodeAt(c),m=h.attrs;if(i>0&&e.map[u-1]==c||i<e.width-1&&e.map[u+1]==c)t.setNodeMarkup(t.mapping.slice(s).map(r+c),null,cl(m,i-e.colCount(c)));else{const g=t.mapping.slice(s).map(r+c);t.delete(g,g+h.nodeSize)}o+=m.rowspan}}function Tj(t,e){if(!oi(t))return!1;if(e){const n=Za(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;Aj(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=bt.get(s)}e(r)}return!0}function Mj(t,{map:e,table:n,tableStart:r},i){let s=0;for(let h=0;h<i;h++)s+=n.child(h).nodeSize;const o=s+n.child(i).nodeSize,u=t.mapping.maps.length;t.delete(s+r,o+r);const c=new Set;for(let h=0,m=i*e.width;h<e.width;h++,m++){const g=e.map[m];if(!c.has(g)){if(c.add(g),i>0&&g==e.map[m-e.width]){const y=n.nodeAt(g).attrs;t.setNodeMarkup(t.mapping.slice(u).map(g+r),null,{...y,rowspan:y.rowspan-1}),h+=y.colspan-1}else if(i<e.height&&g==e.map[m+e.width]){const y=n.nodeAt(g),b=y.attrs,v=y.type.create({...b,rowspan:y.attrs.rowspan-1},y.content),N=e.positionAt(i+1,h,n);t.insert(t.mapping.slice(u).map(r+N),v),h+=b.colspan-1}}}}function Oj(t,e){if(!oi(t))return!1;if(e){const n=Za(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;Mj(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=bt.get(n.table)}e(r)}return!0}function Rj(t,e){return function(n,r){if(!oi(n))return!1;const i=Pg(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Rt?n.selection.forEachCell((o,u)=>{o.attrs[t]!==e&&s.setNodeMarkup(u,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function Dj(t){return function(e,n){if(!oi(e))return!1;if(n){const r=ii(e.schema),i=Za(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),u=o.map(c=>i.table.nodeAt(c));for(let c=0;c<o.length;c++)u[c].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[c],r.cell,u[c].attrs);if(s.steps.length===0)for(let c=0;c<o.length;c++)s.setNodeMarkup(i.tableStart+o[c],r.header_cell,u[c].attrs);n(s)}return!0}}function ZN(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function Ik(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Dj(t):function(n,r){if(!oi(n))return!1;if(r){const i=ii(n.schema),s=Za(n),o=n.tr,u=ZN("row",s,i),c=ZN("column",s,i),h=(t==="column"?u:t==="row"&&c)?1:0,m=t=="column"?{left:0,top:h,right:1,bottom:s.map.height}:t=="row"?{left:h,top:0,right:s.map.width,bottom:1}:s,g=t=="column"?c?i.cell:i.header_cell:t=="row"?u?i.cell:i.header_cell:i.cell;s.map.cellsInRect(m).forEach(y=>{const b=y+s.tableStart,v=o.doc.nodeAt(b);v&&o.setNodeMarkup(b,g,v.attrs)}),r(o)}return!0}}Ik("row",{useDeprecatedLogic:!0});Ik("column",{useDeprecatedLogic:!0});Ik("cell",{useDeprecatedLogic:!0});function Ij(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function ZR(t){return function(e,n){if(!oi(e))return!1;const r=Ij(Pg(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(we.between(i,uj(i))).scrollIntoView())}return!0}}function _j(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function _d(t,e){const n=t.selection;if(!(n instanceof Rt))return!1;if(e){const r=t.tr,i=ii(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new H(i,0,0))}),r.docChanged&&e(r)}return!0}function zj(t){return(e,n)=>{const{from:r,to:i,select:s=!0,pos:o=e.selection.from}=t,u=e.tr;return Cj({tr:u,originIndex:r,targetIndex:i,select:s,pos:o})?(n?.(u),!0):!1}}function Lj(t){return(e,n)=>{const{from:r,to:i,select:s=!0,pos:o=e.selection.from}=t,u=e.tr;return kj({tr:u,originIndex:r,targetIndex:i,select:s,pos:o})?(n?.(u),!0):!1}}function Bj(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,u=[];if(s=="row")for(let c=0;c<e.childCount;c++){let h=e.child(c).content;const m=c?0:Math.max(0,n-1),g=c<e.childCount-1?0:Math.max(0,r-1);(m||g)&&(h=Ib(ii(o).row,new H(h,m,g)).content),u.push(h)}else if(s=="cell"||s=="header_cell")u.push(n||r?Ib(ii(o).row,new H(e,n,r)).content:e);else return null;return Vj(o,u)}function Vj(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:u,colspan:c}=s.child(o).attrs;for(let h=i;h<i+u;h++)n[h]=(n[h]||0)+c}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(G.empty),n[i]<r){const s=ii(t).cell.createAndFill(),o=[];for(let u=n[i];u<r;u++)o.push(s);e[i]=e[i].append(G.from(o))}return{height:e.length,width:r,rows:e}}function Ib(t,e){const n=t.createAndFill();return new hP(n).replace(0,n.content.size,e).doc}function Fj({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let u=0;u<n.length;u++){const c=n[u],h=[];for(let m=s[u]||0,g=0;m<r;g++){let y=c.child(g%c.childCount);m+y.attrs.colspan>r&&(y=y.type.createChecked(cl(y.attrs,y.attrs.colspan,m+y.attrs.colspan-r),y.content)),h.push(y),m+=y.attrs.colspan;for(let b=1;b<y.attrs.rowspan;b++)s[u+b]=(s[u+b]||0)+y.attrs.colspan}o.push(G.from(h))}n=o,t=r}if(e!=i){const s=[];for(let o=0,u=0;o<i;o++,u++){const c=[],h=n[u%e];for(let m=0;m<h.childCount;m++){let g=h.child(m);o+g.attrs.rowspan>i&&(g=g.type.create({...g.attrs,rowspan:Math.max(1,i-g.attrs.rowspan)},g.content)),c.push(g)}s.push(G.from(c))}n=s,e=i}return{width:t,height:e,rows:n}}function Pj(t,e,n,r,i,s,o){const u=t.doc.type.schema,c=ii(u);let h,m;if(i>e.width)for(let g=0,y=0;g<e.height;g++){const b=n.child(g);y+=b.nodeSize;const v=[];let N;b.lastChild==null||b.lastChild.type==c.cell?N=h||(h=c.cell.createAndFill()):N=m||(m=c.header_cell.createAndFill());for(let T=e.width;T<i;T++)v.push(N);t.insert(t.mapping.slice(o).map(y-1+r),v)}if(s>e.height){const g=[];for(let v=0,N=(e.height-1)*e.width;v<Math.max(e.width,i);v++){const T=v>=e.width?!1:n.nodeAt(e.map[N+v]).type==c.header_cell;g.push(T?m||(m=c.header_cell.createAndFill()):h||(h=c.cell.createAndFill()))}const y=c.row.create(null,G.from(g)),b=[];for(let v=e.height;v<s;v++)b.push(y);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),b)}return!!(h||m)}function eA(t,e,n,r,i,s,o,u){if(o==0||o==e.height)return!1;let c=!1;for(let h=i;h<s;h++){const m=o*e.width+h,g=e.map[m];if(e.map[m-e.width]==g){c=!0;const y=n.nodeAt(g),{top:b,left:v}=e.findCell(g);t.setNodeMarkup(t.mapping.slice(u).map(g+r),null,{...y.attrs,rowspan:o-b}),t.insert(t.mapping.slice(u).map(e.positionAt(o,v,n)),y.type.createAndFill({...y.attrs,rowspan:b+y.attrs.rowspan-o})),h+=y.attrs.colspan-1}}return c}function tA(t,e,n,r,i,s,o,u){if(o==0||o==e.width)return!1;let c=!1;for(let h=i;h<s;h++){const m=h*e.width+o,g=e.map[m];if(e.map[m-1]==g){c=!0;const y=n.nodeAt(g),b=e.colCount(g),v=t.mapping.slice(u).map(g+r);t.setNodeMarkup(v,null,cl(y.attrs,o-b,y.attrs.colspan-(o-b))),t.insert(v+y.nodeSize,y.type.createAndFill(cl(y.attrs,0,o-b))),h+=y.attrs.rowspan-1}}return c}function nA(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=bt.get(s);const{top:u,left:c}=r,h=c+i.width,m=u+i.height,g=t.tr;let y=0;function b(){if(s=n?g.doc.nodeAt(n-1):g.doc,!s)throw new Error("No table found");o=bt.get(s),y=g.mapping.maps.length}Pj(g,o,s,n,h,m,y)&&b(),eA(g,o,s,n,c,h,u,y)&&b(),eA(g,o,s,n,c,h,m,y)&&b(),tA(g,o,s,n,u,m,c,y)&&b(),tA(g,o,s,n,u,m,h,y)&&b();for(let v=u;v<m;v++){const N=o.positionAt(v,c,s),T=o.positionAt(v,h,s);g.replace(g.mapping.slice(y).map(N+n),g.mapping.slice(y).map(T+n),new H(i.rows[v-u],0,0))}b(),g.setSelection(new Rt(g.doc.resolve(n+o.positionAt(u,c,s)),g.doc.resolve(n+o.positionAt(m-1,h-1,s)))),e(g)}const jj=uO({ArrowLeft:zd("horiz",-1),ArrowRight:zd("horiz",1),ArrowUp:zd("vert",-1),ArrowDown:zd("vert",1),"Shift-ArrowLeft":Ld("horiz",-1),"Shift-ArrowRight":Ld("horiz",1),"Shift-ArrowUp":Ld("vert",-1),"Shift-ArrowDown":Ld("vert",1),Backspace:_d,"Mod-Backspace":_d,Delete:_d,"Mod-Delete":_d});function mm(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function zd(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Rt)return mm(n,r,Ve.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=eD(i,t,e);if(o==null)return!1;if(t=="horiz")return mm(n,r,Ve.near(n.doc.resolve(s.head+e),e));{const u=n.doc.resolve(o),c=qR(u,t,e);let h;return c?h=Ve.near(c,1):e<0?h=Ve.near(n.doc.resolve(u.before(-1)),-1):h=Ve.near(n.doc.resolve(u.after(-1)),1),mm(n,r,h)}}}function Ld(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof Rt)o=s;else{const c=eD(i,t,e);if(c==null)return!1;o=new Rt(n.doc.resolve(c))}const u=qR(o.$headCell,t,e);return u?mm(n,r,new Rt(o.$anchorCell,u)):!1}}function $j(t,e){const n=t.state.doc,r=Vu(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Rt(r))),!0):!1}function Uj(t,e,n){if(!oi(t.state))return!1;let r=Bj(n);const i=t.state.selection;if(i instanceof Rt){r||(r={width:1,height:1,rows:[G.from(Ib(ii(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),u=bt.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=Fj(r,u.right-u.left,u.bottom-u.top),nA(t.state,t.dispatch,o,u,r),!0}else if(r){const s=Pg(t.state),o=s.start(-1);return nA(t.state,t.dispatch,o,bt.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function Jj(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=rA(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Rt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Vu(t.state.selection.$anchor))!=null&&((n=X1(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(c,h){let m=X1(t,h);const g=Da.getState(t.state)==null;if(!m||!Dk(c,m))if(g)m=c;else return;const y=new Rt(c,m);if(g||!t.state.selection.eq(y)){const b=t.state.tr.setSelection(y);g&&b.setMeta(Da,c.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",u),Da.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Da,-1))}function u(c){const h=c,m=Da.getState(t.state);let g;if(m!=null)g=t.state.doc.resolve(m);else if(rA(t,h.target)!=r&&(g=X1(t,e),!g))return o();g&&s(g,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",u)}function eD(t,e,n){if(!(t.state.selection instanceof we))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?o:null}}return null}function rA(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function X1(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Vu(t.state.doc.resolve(r))||Vu(t.state.doc.resolve(i))}var Hj=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),_b(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,_b(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function _b(t,e,n,r,i,s){let o=0,u=!0,c=e.firstChild;const h=t.firstChild;if(h){for(let g=0,y=0;g<h.childCount;g++){const{colspan:b,colwidth:v}=h.child(g).attrs;for(let N=0;N<b;N++,y++){const T=i==y?s:v&&v[N],M=T?T+"px":"";if(o+=T||r,T||(u=!1),c)c.style.width!=M&&(c.style.width=M),c=c.nextSibling;else{const j=document.createElement("col");j.style.width=M,e.appendChild(j)}}}for(;c;){var m;const g=c.nextSibling;(m=c.parentNode)===null||m===void 0||m.removeChild(c),c=g}u?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const Cr=new hr("tableColumnResizing");function qj({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=Hj,lastColumnResizable:i=!0}={}){const s=new fr({key:Cr,state:{init(o,u){var c;const h=(c=s.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,m=ii(u.schema).table.name;return r&&h&&(h[m]=(g,y)=>new r(g,n,y)),new Kj(-1,!1)},apply(o,u){return u.apply(o)}},props:{attributes:o=>{const u=Cr.getState(o);return u&&u.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,u)=>{Gj(o,u,t,i)},mouseleave:o=>{Yj(o)},mousedown:(o,u)=>{Wj(o,u,e,n)}},decorations:o=>{const u=Cr.getState(o);if(u&&u.activeHandle>-1)return t$(o,u.activeHandle)},nodeViews:{}}});return s}var Kj=class gm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Cr);if(r&&r.setHandle!=null)return new gm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new gm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Db(e.doc.resolve(i))||(i=-1),new gm(i,n.dragging)}return n}};function Gj(t,e,n,r){if(!t.editable)return;const i=Cr.getState(t.state);if(i&&!i.dragging){const s=Qj(e.target);let o=-1;if(s){const{left:u,right:c}=s.getBoundingClientRect();e.clientX-u<=n?o=iA(t,e,"left",n):c-e.clientX<=n&&(o=iA(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const u=t.state.doc.resolve(o),c=u.node(-1),h=bt.get(c),m=u.start(-1);if(h.colCount(u.pos-m)+u.nodeAfter.attrs.colspan-1==h.width-1)return}tD(t,o)}}}function Yj(t){if(!t.editable)return;const e=Cr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&tD(t,-1)}function Wj(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=Cr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const u=t.state.doc.nodeAt(o.activeHandle),c=Xj(t,o.activeHandle,u.attrs);t.dispatch(t.state.tr.setMeta(Cr,{setDragging:{startX:e.clientX,startWidth:c}}));function h(g){s.removeEventListener("mouseup",h),s.removeEventListener("mousemove",m);const y=Cr.getState(t.state);y?.dragging&&(Zj(t,y.activeHandle,sA(y.dragging,g,n)),t.dispatch(t.state.tr.setMeta(Cr,{setDragging:null})))}function m(g){if(!g.which)return h(g);const y=Cr.getState(t.state);if(y&&y.dragging){const b=sA(y.dragging,g,n);aA(t,y.activeHandle,b,r)}}return aA(t,o.activeHandle,c,r),s.addEventListener("mouseup",h),s.addEventListener("mousemove",m),e.preventDefault(),!0}function Xj(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,u=n;if(r)for(let c=0;c<n;c++)r[c]&&(o-=r[c],u--);return o/u}function Qj(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function iA(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,u=Vu(t.state.doc.resolve(o));if(!u)return-1;if(n=="right")return u.pos;const c=bt.get(u.node(-1)),h=u.start(-1),m=c.map.indexOf(u.pos-h);return m%c.width==0?-1:h+c.map[m-1]}function sA(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function tD(t,e){t.dispatch(t.state.tr.setMeta(Cr,{setHandle:e}))}function Zj(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=bt.get(i),o=r.start(-1),u=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let h=0;h<s.height;h++){const m=h*s.width+u;if(h&&s.map[m]==s.map[m-s.width])continue;const g=s.map[m],y=i.nodeAt(g).attrs,b=y.colspan==1?0:u-s.colCount(g);if(y.colwidth&&y.colwidth[b]==n)continue;const v=y.colwidth?y.colwidth.slice():e$(y.colspan);v[b]=n,c.setNodeMarkup(o+g,null,{...y,colwidth:v})}c.docChanged&&t.dispatch(c)}function aA(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),u=bt.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let c=t.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&_b(s,c.firstChild,c,r,u,n)}function e$(t){return Array(t).fill(0)}function t$(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ri.empty;const s=bt.get(i),o=r.start(-1),u=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let h=0;h<s.height;h++){const m=u+h*s.width;if((u==s.width-1||s.map[m]!=s.map[m+1])&&(h==0||s.map[m]!=s.map[m-s.width])){var c;const g=s.map[m],y=o+g+i.nodeAt(g).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((c=Cr.getState(t))===null||c===void 0)&&c.dragging&&n.push(ul.node(o+g,o+g+i.nodeAt(g).nodeSize,{class:"column-resize-dragging"})),n.push(ul.widget(y,b))}}return ri.create(t.doc,n)}function n$({allowTableNodeSelection:t=!1}={}){return new fr({key:Da,state:{init(){return null},apply(e,n){const r=e.getMeta(Da);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:pj,handleDOMEvents:{mousedown:Jj},createSelectionBetween(e){return Da.getState(e.state)!=null?e.state.selection:null},handleTripleClick:$j,handleKeyDown:jj,handlePaste:Uj},appendTransaction(e,n,r){return gj(r,xj(r,n),t)}})}const nD=65535,rD=Math.pow(2,16);function r$(t,e){return t+e*rD}function oA(t){return t&nD}function i$(t){return(t-(t&nD))/rD}const iD=1,sD=2,ym=4,aD=8;class lA{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&aD)>0}get deletedBefore(){return(this.delInfo&(iD|ym))>0}get deletedAfter(){return(this.delInfo&(sD|ym))>0}get deletedAcross(){return(this.delInfo&ym)>0}}class wr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&wr.empty)return wr.empty}recover(e){let n=0,r=oA(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+i$(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],m=this.ranges[u+o],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,b=c+i+(y<0?0:m);if(r)return b;let v=e==(n<0?c:g)?null:r$(u/3,e-c),N=e==c?sD:e==g?iD:ym;return(n<0?e!=c:e!=g)&&(N|=aD),new lA(b,N,v)}i+=m-h}return r?e+i:new lA(e+i,0,null)}touches(e,n){let r=0,i=oA(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],m=c+h;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],u=o-(this.inverted?s:0),c=o+(this.inverted?0:s),h=this.ranges[i+n],m=this.ranges[i+r];e(u,u+h,c,c+m),s+=m-h}}invert(){return new wr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?wr.empty:new wr(e<0?[0,-e,0]:[0,0,e])}}wr.empty=new wr([]);const Q1=Object.create(null);class Mn{getMap(){return wr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Q1[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Q1)throw new RangeError("Duplicate use of step JSON ID "+e);return Q1[e]=n,n.prototype.jsonID=e,n}}class Xt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Xt(e,null)}static fail(e){return new Xt(null,e)}static fromReplace(e,n,r,i){try{return Xt.ok(e.replace(n,r,i))}catch(s){if(s instanceof wi)return Xt.fail(s.message);throw s}}}function _k(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(_k(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return G.fromArray(r)}class zo extends Mn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new H(_k(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Xt.fromReplace(e,this.from,this.to,s)}invert(){return new Lo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new zo(n.pos,r.pos,this.mark)}merge(e){return e instanceof zo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new zo(n.from,n.to,e.markFromJSON(n.mark))}}Mn.jsonID("addMark",zo);class Lo extends Mn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(_k(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Xt.fromReplace(e,this.from,this.to,r)}invert(){return new zo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Lo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Lo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Lo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Lo(n.from,n.to,e.markFromJSON(n.mark))}}Mn.jsonID("removeMark",Lo);class Bo extends Mn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Xt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Xt.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Bo(this.pos,n.marks[i]);return new Bo(this.pos,this.mark)}}return new Th(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Bo(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Bo(n.pos,e.markFromJSON(n.mark))}}Mn.jsonID("addNodeMark",Bo);class Th extends Mn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Xt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Xt.fromReplace(e,this.pos,this.pos+1,new H(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Bo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Th(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Th(n.pos,e.markFromJSON(n.mark))}}Mn.jsonID("removeNodeMark",Th);class Oa extends Mn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&zb(e,this.from,this.to)?Xt.fail("Structure replace would overwrite content"):Xt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new wr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Oa(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Oa(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Oa)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Oa(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Oa(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Oa(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}}Mn.jsonID("replace",Oa);class nh extends Mn{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(zb(e,this.from,this.gapFrom)||zb(e,this.gapTo,this.to)))return Xt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Xt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Xt.fromReplace(e,this.from,this.to,r):Xt.fail("Content does not fit in gap")}getMap(){return new wr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new nh(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new nh(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new nh(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}}Mn.jsonID("replaceAround",nh);function zb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function s$(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let u=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(u>0?1:0),h=r.node(o),m=!1;if(s==1)m=h.canReplace(c,c,i);else{let g=h.contentMatchAt(c).findWrapping(i.firstChild.type);m=g&&h.canReplaceWith(c,c,g[0])}if(m)return u==0?r.pos:u<0?r.before(o+1):r.after(o+1)}return null}class rh extends Mn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Xt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Xt.fromReplace(e,this.pos,this.pos+1,new H(G.from(i),0,n.isLeaf?0:1))}getMap(){return wr.empty}invert(e){return new rh(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new rh(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new rh(n.pos,n.attr,n.value)}}Mn.jsonID("attr",rh);class Jm extends Mn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Xt.ok(r)}getMap(){return wr.empty}invert(e){return new Jm(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Jm(n.attr,n.value)}}Mn.jsonID("docAttr",Jm);let Mh=class extends Error{};Mh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Mh.prototype=Object.create(Error.prototype);Mh.prototype.constructor=Mh;Mh.prototype.name="TransformError";const xl=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},oD=function(t,e,n,r){return n&&(uA(t,e,n,r,-1)||uA(t,e,n,r,1))},a$=/^(img|br|input|textarea|hr)$/i;function uA(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Hm(t))){let o=t.parentNode;if(!o||o.nodeType!=1||zk(t)||a$.test(t.nodeName)||t.contentEditable=="false")return!1;e=xl(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Hm(t):0}else return!1}}function Hm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function o$(t,e,n){for(let r=e==0,i=e==Hm(t);r||i;){if(t==n)return!0;let s=xl(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Hm(t)}}function zk(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const lD=function(t){return t.focusNode&&oD(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function uD(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Ji=typeof navigator<"u"?navigator:null,cA=typeof document<"u"?document:null,eo=Ji&&Ji.userAgent||"",Lb=/Edge\/(\d+)/.exec(eo),cD=/MSIE \d/.exec(eo),Bb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(eo),ap=!!(cD||Bb||Lb),fD=cD?document.documentMode:Bb?+Bb[1]:Lb?+Lb[1]:0,jg=!ap&&/gecko\/(\d+)/i.test(eo);jg&&+(/Firefox\/(\d+)/.exec(eo)||[0,0])[1];const Vb=!ap&&/Chrome\/(\d+)/.exec(eo),Us=!!Vb,hD=Vb?+Vb[1]:0,bl=!ap&&!!Ji&&/Apple Computer/.test(Ji.vendor),Lk=bl&&(/Mobile\/\w+/.test(eo)||!!Ji&&Ji.maxTouchPoints>2),Wr=Lk||(Ji?/Mac/.test(Ji.platform):!1),pD=Ji?/Win/.test(Ji.platform):!1,op=/Android \d/.test(eo),Bk=!!cA&&"webkitFontSmoothing"in cA.documentElement.style,l$=Bk?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function u$(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let u=r.resolve(o),c,h;if(lD(n)){for(c=o;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&ge.isSelectable(g)&&i.parent&&!(g.isInline&&o$(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new ge(o==y?u:r.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=o,y=o;for(let b=0;b<n.rangeCount;b++){let v=n.getRangeAt(b);g=Math.min(g,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(g<0)return null;[c,o]=y==t.state.selection.anchor?[y,g]:[g,y],u=r.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let m=r.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=mD(t,m,u,g)}return h}function dD(t){return t.editable?t.hasFocus():p$(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Vk(t,e=!1){let n=t.state.selection;if(h$(t,n),!!dD(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Us){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&oD(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)f$(t);else{let{anchor:r,head:i}=n,s,o;fA&&!(n instanceof we)&&(n.$from.parent.inlineContent||(s=hA(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=hA(t,n.to))),t.docView.setSelection(r,i,t,e),fA&&(s&&pA(s),o&&pA(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&c$(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const fA=bl||Us&&hD<63;function hA(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(bl&&i&&i.contentEditable=="false")return Z1(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Z1(i);if(s)return Z1(s)}}function Z1(t){return t.contentEditable="true",bl&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function pA(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function c$(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!dD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function f$(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,xl(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ap&&fD<=11&&(n.disabled=!0,n.disabled=!1)}function h$(t,e){if(e instanceof ge){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(dA(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else dA(t)}function dA(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function mD(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||we.between(e,n,r)}function p$(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Fb(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ve.findFrom(s,e)}function Ra(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function mA(t,e,n){let r=t.state.selection;if(r instanceof we)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ra(t,new we(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Fb(t.state,e);return i&&i instanceof ge?Ra(t,i):!1}else if(!(Wr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(u))&&!o.contentDOM?ge.isSelectable(s)?Ra(t,new ge(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Bk?Ra(t,new we(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ge&&r.node.isInline)return Ra(t,new we(e>0?r.$to:r.$from));{let i=Fb(t.state,e);return i?Ra(t,i):!1}}}function qm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ih(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function lu(t,e){return e<0?d$(t):m$(t)}function d$(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(jg&&n.nodeType==1&&r<qm(n)&&ih(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(ih(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(gD(n))break;{let u=n.previousSibling;for(;u&&ih(u,-1);)i=n.parentNode,s=xl(u),u=u.previousSibling;if(u)n=u,r=qm(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Pb(t,n,r):i&&Pb(t,i,s)}function m$(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=qm(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(ih(u,1))s=n,o=++r;else break}else{if(gD(n))break;{let u=n.nextSibling;for(;u&&ih(u,1);)s=u.parentNode,o=xl(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=qm(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Pb(t,s,o)}function gD(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function g$(t,e){for(;t&&e==t.childNodes.length&&!zk(t);)e=xl(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function y$(t,e){for(;t&&!e&&!zk(t);)e=xl(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Pb(t,e,n){if(e.nodeType!=3){let s,o;(o=g$(e,n))?(e=o,n=0):(s=y$(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(lD(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Vk(t)},50)}function gA(t,e){let n=t.state.doc.resolve(e);if(!(Us||pD)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function yA(t,e,n){let r=t.state.selection;if(r instanceof we&&!r.empty||n.indexOf("s")>-1||Wr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Fb(t.state,e);if(o&&o instanceof ge)return Ra(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,u=r instanceof Hn?Ve.near(o,e):Ve.findFrom(o,e);return u?Ra(t,u):!1}return!1}function xA(t,e){if(!(t.state.selection instanceof we))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function bA(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function x$(t){if(!bl||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;bA(t,r,"true"),setTimeout(()=>bA(t,r,"false"),20)}return!1}function b$(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function S$(t,e){let n=e.keyCode,r=b$(e);if(n==8||Wr&&n==72&&r=="c")return xA(t,-1)||lu(t,-1);if(n==46&&!e.shiftKey||Wr&&n==68&&r=="c")return xA(t,1)||lu(t,1);if(n==13||n==27)return!0;if(n==37||Wr&&n==66&&r=="c"){let i=n==37?gA(t,t.state.selection.from)=="ltr"?-1:1:-1;return mA(t,i,r)||lu(t,i)}else if(n==39||Wr&&n==70&&r=="c"){let i=n==39?gA(t,t.state.selection.from)=="ltr"?1:-1:1;return mA(t,i,r)||lu(t,i)}else{if(n==38||Wr&&n==80&&r=="c")return yA(t,-1,r)||lu(t,-1);if(n==40||Wr&&n==78&&r=="c")return x$(t)||yA(t,1,r)||lu(t,1);if(r==(Wr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function yD(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let o=t.someProp("clipboardSerializer")||Gi.fromSchema(t.state.schema),u=CD(),c=u.createElement("div");c.appendChild(o.serializeFragment(r,{document:u}));let h=c.firstChild,m,g=0;for(;h&&h.nodeType==1&&(m=vD[h.nodeName.toLowerCase()]);){for(let b=m.length-1;b>=0;b--){let v=u.createElement(m[b]);for(;c.firstChild;)v.appendChild(c.firstChild);c.appendChild(v),g++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${s}${g?` -${g}`:""} ${JSON.stringify(n)}`);let y=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
51
+
52
+ `);return{dom:c,text:y,slice:e}}function xD(t,e,n,r,i){let s=i.parent.type.spec.code,o,u;if(!n&&!e)return null;let c=!!e&&(r||s||!n);if(c){if(t.someProp("transformPastedText",y=>{e=y(e,s||r,t)}),s)return u=new H(G.from(t.state.schema.text(e.replace(/\r\n?/g,`
53
+ `))),0,0),t.someProp("transformPasted",y=>{u=y(u,t,!0)}),u;let g=t.someProp("clipboardTextParser",y=>y(e,i,r,t));if(g)u=g;else{let y=i.marks(),{schema:b}=t.state,v=Gi.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(N=>{let T=o.appendChild(document.createElement("p"));N&&T.appendChild(v.serializeNode(b.text(N,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),o=w$(n),Bk&&E$(o);let h=o&&o.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let g=+m[3];g>0;g--){let y=o.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;o=y}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||$a.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||m),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!k$.test(y.parentNode.nodeName)?{ignore:!0}:null}})),m)u=N$(SA(u,+m[1],+m[2]),m[4]);else if(u=H.maxOpen(v$(u.content,i),!0),u.openStart||u.openEnd){let g=0,y=0;for(let b=u.content.firstChild;g<u.openStart&&!b.type.spec.isolating;g++,b=b.firstChild);for(let b=u.content.lastChild;y<u.openEnd&&!b.type.spec.isolating;y++,b=b.lastChild);u=SA(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const k$=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function v$(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(u=>{if(!o)return;let c=i.findWrapping(u.type),h;if(!c)return o=null;if(h=o.length&&s.length&&SD(c,s,u,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=kD(o[o.length-1],s.length));let m=bD(u,c);o.push(m),i=i.matchType(m.type),s=c}}),o)return G.from(o)}return t}function bD(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,G.from(t));return t}function SD(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=SD(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(G.from(bD(n,t,i+1))))}}function kD(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,kD(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(G.empty,!0);return t.copy(n.append(r))}function jb(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,u=o.content;return t.childCount>1&&(s=0),i<r-1&&(u=jb(u,e,n,r,i+1,s)),i>=n&&(u=e<0?o.contentMatchAt(0).fillBefore(u,s<=i).append(u):u.append(o.contentMatchAt(o.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function SA(t,e,n){return e<t.openStart&&(t=new H(jb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new H(jb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const vD={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let kA=null;function CD(){return kA||(kA=document.implementation.createHTMLDocument("title"))}let ex=null;function C$(t){let e=window.trustedTypes;return e?(ex||(ex=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),ex.createHTML(t)):t}function w$(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=CD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&vD[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=C$(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function E$(t){let e=t.querySelectorAll(Us?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function N$(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let u=r.length-2;u>=0;u-=2){let c=n.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=G.from(c.create(r[u+1],i)),s++,o++}return new H(i,s,o)}const Ai={},Ar={};function La(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Ar.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!ED(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(op&&Us&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Lk&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,uD(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||S$(t,n)?n.preventDefault():La(t,"key")};Ar.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ar.keypress=(t,e)=>{let n=e;if(ED(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Wr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof we)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function $g(t){return{left:t.clientX,top:t.clientY}}function A$(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Fk(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,u=>o>s.depth?u(t,n,s.nodeAfter,s.before(o),i,!0):u(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Ou(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function T$(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ge.isSelectable(r)?(Ou(t,new ge(n)),!0):!1}function M$(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ge&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let u=o>s.depth?s.nodeAfter:s.node(o);if(ge.isSelectable(u)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Ou(t,ge.create(t.state.doc,i)),!0):!1}function O$(t,e,n,r,i){return Fk(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?M$(t,n):T$(t,n))}function R$(t,e,n,r){return Fk(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function D$(t,e,n,r){return Fk(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||I$(t,n,r)}function I$(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ou(t,we.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(o.inlineContent)Ou(t,we.create(r,u+1,u+1+o.content.size));else if(ge.isSelectable(o))Ou(t,ge.create(r,u));else continue;return!0}}function Pk(t){return Km(t)}const wD=Wr?"metaKey":"ctrlKey";Ai.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Pk(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&A$(n,t.input.lastClick)&&!n[wD]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords($g(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new _$(t,o,n,!!r)):(s=="doubleClick"?R$:D$)(t,o.pos,o.inside,n)?n.preventDefault():La(t,"pointer"))};class _${constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[wD],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let m=e.state.doc.resolve(n.pos);s=m.parent,o=m.depth?m.before():0}const u=i?null:r.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||h instanceof ge&&h.from<=o&&h.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&jg&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),La(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Vk(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords($g(e))),this.updateAllowDefault(e),this.allowDefault||!n?La(this.view,"pointer"):O$(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||bl&&this.mightDrag&&!this.mightDrag.node.isAtom||Us&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Ou(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):La(this.view,"pointer")}move(e){this.updateAllowDefault(e),La(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ai.touchstart=t=>{t.input.lastTouch=Date.now(),Pk(t),La(t,"pointer")};Ai.touchmove=t=>{t.input.lastTouch=Date.now(),La(t,"pointer")};Ai.contextmenu=t=>Pk(t);function ED(t,e){return t.composing?!0:bl&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const z$=op?5e3:-1;Ar.compositionstart=Ar.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof we&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Us&&pD&&L$(t)))t.markCursor=t.state.storedMarks||n.marks(),Km(t,!0),t.markCursor=null;else if(Km(t,!e.selection.empty),jg&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let u=t.domSelection();u&&u.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}ND(t,z$)};function L$(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Ar.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,ND(t,20))};function ND(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Km(t),e))}function B$(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=V$());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function V$(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Km(t,e=!1){if(!(op&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),B$(t),e||t.docView&&t.docView.dirty){let n=u$(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function F$(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Oh=ap&&fD<15||Lk&&l$<604;Ai.copy=Ar.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Oh?null:n.clipboardData,o=r.content(),{dom:u,text:c}=yD(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):F$(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function P$(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function j$(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?$b(t,r.value,null,i,e):$b(t,r.textContent,r.innerHTML,i,e)},50)}function $b(t,e,n,r,i){let s=xD(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||H.empty)))return!0;if(!s)return!1;let o=P$(s),u=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function AD(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ar.paste=(t,e)=>{let n=e;if(t.composing&&!op)return;let r=Oh?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&$b(t,AD(r),r.getData("text/html"),i,n)?n.preventDefault():j$(t,n)};class $${constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const U$=Wr?"altKey":"ctrlKey";function TD(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[U$]}Ai.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords($g(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ge?i.to-1:i.to))){if(r&&r.mightDrag)o=ge.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let g=t.docView.nearestDesc(n.target,!0);g&&g.node.type.spec.draggable&&g!=t.docView&&(o=ge.create(t.state.doc,g.posBefore))}}let u=(o||t.state.selection).content(),{dom:c,text:h,slice:m}=yD(t,u);(!n.dataTransfer.files.length||!Us||hD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Oh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Oh||n.dataTransfer.setData("text/plain",h),t.dragging=new $$(m,TD(t,n),o)};Ai.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ar.dragover=Ar.dragenter=(t,e)=>e.preventDefault();Ar.drop=(t,e)=>{try{J$(t,e,t.dragging)}finally{t.dragging=null}};function J$(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords($g(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=xD(t,AD(e.dataTransfer),Oh?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&TD(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||H.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?s$(t.state.doc,i.pos,s):i.pos;u==null&&(u=i.pos);let c=t.state.tr;if(o){let{node:b}=n;b?b.replace(c):c.deleteSelection()}let h=c.mapping.map(u),m=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(m?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(m&&ge.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new ge(y));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((v,N,T,M)=>b=M),c.setSelection(mD(t,y,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Ai.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Vk(t)},20))};Ai.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ai.beforeinput=(t,e)=>{if(Us&&op&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,uD(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Ar)Ai[t]=Ar[t];function Rh(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Gm{constructor(e,n){this.toDOM=e,this.spec=n||Go,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Vi(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Gm&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Rh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Pa{constructor(e,n){this.attrs=e,this.spec=n||Go}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Vi(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Pa&&Rh(this.attrs,e.attrs)&&Rh(this.spec,e.spec)}static is(e){return e.type instanceof Pa}destroy(){}}class jk{constructor(e,n){this.attrs=e,this.spec=n||Go}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Vi(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof jk&&Rh(this.attrs,e.attrs)&&Rh(this.spec,e.spec)}destroy(){}}class Vi{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Vi(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Vi(e,e,new Gm(n,r))}static inline(e,n,r,i){return new Vi(e,n,new Pa(r,i))}static node(e,n,r,i){return new Vi(e,n,new jk(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Pa}get widget(){return this.type instanceof Gm}}const Cu=[],Go={};class rn{constructor(e,n){this.local=e.length?e:Cu,this.children=n.length?n:Cu}static create(e,n){return n.length?Ym(n,e,0,Go):Ln}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let u=this.local[o];u.from<=n&&u.to>=e&&(!s||s(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let u=this.children[o]+1;this.children[o+2].findInner(e-u,n-u,r,i+u,s)}}map(e,n,r){return this==Ln||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Go)}mapInner(e,n,r,i,s){let o;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(n,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?H$(this.children,o||[],e,n,r,i,s):o?new rn(o.sort(Yo),Cu):Ln}add(e,n){return n.length?this==Ln?rn.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((u,c)=>{let h=c+r,m;if(m=OD(n,u,h)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(u,m,h+1):i.splice(s,0,c,c+u.nodeSize,Ym(m,u,h+1,Go)),s+=3}});let o=MD(s?RD(n):n,-r);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new rn(o.length?this.local.concat(o).sort(Yo):this.local,i||this.children)}remove(e){return e.length==0||this==Ln?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,u=r[s]+n,c=r[s+1]+n;for(let m=0,g;m<e.length;m++)(g=e[m])&&g.from>u&&g.to<c&&(e[m]=null,(o||(o=[])).push(g));if(!o)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(o,u+1);h!=Ln?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let u=0;u<i.length;u++)i[u].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new rn(i,r):Ln}forChild(e,n){if(this==Ln)return this;if(n.isLeaf)return rn.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=this.children[u+2]);break}let s=e+1,o=s+n.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<o&&c.to>s&&c.type instanceof Pa){let h=Math.max(s,c.from)-s,m=Math.min(o,c.to)-s;h<m&&(i||(i=[])).push(c.copy(h,m))}}if(i){let u=new rn(i.sort(Yo),Cu);return r?new Ro([u,r]):u}return r||Ln}eq(e){if(this==e)return!0;if(!(e instanceof rn)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return $k(this.localsInner(e))}localsInner(e){if(this==Ln)return Cu;if(e.inlineContent||!this.local.some(Pa.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Pa||n.push(this.local[r]);return n}forEachSet(e){e(this)}}rn.empty=new rn([],[]);rn.removeOverlap=$k;const Ln=rn.empty;class Ro{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Go));return Ro.from(r)}forChild(e,n){if(n.isLeaf)return rn.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Ln&&(s instanceof Ro?r=r.concat(s.members):r.push(s))}return Ro.from(r)}eq(e){if(!(e instanceof Ro)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?$k(r?n:n.sort(Yo)):Cu}static from(e){switch(e.length){case 0:return Ln;case 1:return e[0];default:return new Ro(e.every(n=>n instanceof rn)?e:e.reduce((n,r)=>n.concat(r instanceof rn?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function H$(t,e,n,r,i,s,o){let u=t.slice();for(let h=0,m=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,b,v,N)=>{let T=N-v-(b-y);for(let M=0;M<u.length;M+=3){let j=u[M+1];if(j<0||y>j+m-g)continue;let P=u[M]+m-g;b>=P?u[M+1]=y<=P?-2:-1:y>=m&&T&&(u[M]+=T,u[M+1]+=T)}g+=T}),m=n.maps[h].map(m,-1)}let c=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){c=!0,u[h+1]=-1;continue}let m=n.map(t[h]+s),g=m-i;if(g<0||g>=r.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),b=y-i,{index:v,offset:N}=r.content.findIndex(g),T=r.maybeChild(v);if(T&&N==g&&N+T.nodeSize==b){let M=u[h+2].mapInner(n,T,m+1,t[h]+s+1,o);M!=Ln?(u[h]=g,u[h+1]=b,u[h+2]=M):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=q$(u,t,e,n,i,s,o),m=Ym(h,r,0,o);e=m.local;for(let g=0;g<u.length;g+=3)u[g+1]<0&&(u.splice(g,3),g-=3);for(let g=0,y=0;g<m.children.length;g+=3){let b=m.children[g];for(;y<u.length&&u[y]<b;)y+=3;u.splice(y,0,m.children[g],m.children[g+1],m.children[g+2])}}return new rn(e.sort(Yo),u)}function MD(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Vi(i.from+e,i.to+e,i.type))}return n}function q$(t,e,n,r,i,s,o){function u(c,h){for(let m=0;m<c.local.length;m++){let g=c.local[m].map(r,i,h);g?n.push(g):o.onRemove&&o.onRemove(c.local[m].spec)}for(let m=0;m<c.children.length;m+=3)u(c.children[m+2],c.children[m]+h+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&u(t[c+2],e[c]+s+1);return n}function OD(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function RD(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ym(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=OD(t,u,c+n);if(h){s=!0;let m=Ym(h,u,n+c+1,r);m!=Ln&&i.push(c,c+u.nodeSize,m)}});let o=MD(s?RD(t):t,-n).sort(Yo);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||(r.onRemove&&r.onRemove(o[u].spec),o.splice(u--,1));return o.length||i.length?new rn(o,i):Ln}function Yo(t,e){return t.from-e.from||t.to-e.to}function $k(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),vA(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),vA(e,i,r.copy(s.from,r.to)));break}}}return e}function vA(t,e,n){for(;e<t.length&&Yo(n,t[e])>0;)e++;t.splice(e,0,n)}var Wm=typeof navigator<"u"?navigator:null,Uk=Wm&&Wm.userAgent||"",K$=/Edge\/(\d+)/.exec(Uk),G$=/MSIE \d/.exec(Uk),Y$=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Uk),W$=!!(G$||Y$||K$),X$=!W$&&!!Wm&&/Apple Computer/.test(Wm.vendor),DD=new hr("safari-ime-span"),Ub=!1,Q$={key:DD,props:{decorations:Z$,handleDOMEvents:{compositionstart:()=>{Ub=!0},compositionend:()=>{Ub=!1}}}};function Z$(t){const{$from:e,$to:n,to:r}=t.selection;if(Ub&&e.sameParent(n)){const i=Vi.widget(r,eU,{ignoreSelection:!0,key:"safari-ime-span"});return rn.create(t.doc,[i])}}function eU(t){const e=t.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var tU=new fr(X$?Q$:{key:DD});function Xm(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}function nU(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function rU(t,e,n){const i=bg((n||{}).ignore||[]),s=iU(e);let o=-1;for(;++o<s.length;)ju(t,"text",u);function u(h,m){let g=-1,y;for(;++g<m.length;){const b=m[g],v=y?y.children:void 0;if(i(b,v?v.indexOf(b):void 0,y))return;y=b}if(y)return c(h,m)}function c(h,m){const g=m[m.length-1],y=s[o][0],b=s[o][1];let v=0;const T=g.children.indexOf(h);let M=!1,j=[];y.lastIndex=0;let P=y.exec(h.value);for(;P;){const J=P.index,L={index:P.index,input:P.input,stack:[...m,h]};let C=b(...P,L);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?y.lastIndex=J+1:(v!==J&&j.push({type:"text",value:h.value.slice(v,J)}),Array.isArray(C)?j.push(...C):C&&j.push(C),v=J+P[0].length,M=!0),!y.global)break;P=y.exec(h.value)}return M?(v<h.value.length&&j.push({type:"text",value:h.value.slice(v)}),g.children.splice(T,1,...j)):j=[h],T+j.length}}function iU(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const i=n[r];e.push([sU(i[0]),aU(i[1])])}return e}function sU(t){return typeof t=="string"?new RegExp(nU(t),"g"):t}function aU(t){return typeof t=="function"?t:function(){return t}}const tx="phrasing",nx=["autolink","link","image","label"];function oU(){return{transforms:[dU],enter:{literalAutolink:uU,literalAutolinkEmail:rx,literalAutolinkHttp:rx,literalAutolinkWww:rx},exit:{literalAutolink:pU,literalAutolinkEmail:hU,literalAutolinkHttp:cU,literalAutolinkWww:fU}}}function lU(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:tx,notInConstruct:nx},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:tx,notInConstruct:nx},{character:":",before:"[ps]",after:"\\/",inConstruct:tx,notInConstruct:nx}]}}function uU(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function rx(t){this.config.enter.autolinkProtocol.call(this,t)}function cU(t){this.config.exit.autolinkProtocol.call(this,t)}function fU(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function hU(t){this.config.exit.autolinkEmail.call(this,t)}function pU(t){this.exit(t)}function dU(t){rU(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,mU],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),gU]],{ignore:["link","linkReference"]})}function mU(t,e,n,r,i){let s="";if(!ID(i)||(/^w/i.test(e)&&(n=e+n,e="",s="http://"),!yU(n)))return!1;const o=xU(n+r);if(!o[0])return!1;const u={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[u,{type:"text",value:o[1]}]:u}function gU(t,e,n,r){return!ID(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function yU(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function xU(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const i=Xm(t,"(");let s=Xm(t,")");for(;r!==-1&&i>s;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[t,n]}function ID(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Bn(n)||yg(n))&&(!e||n!==47)}_D.peek=AU;function bU(){this.buffer()}function SU(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function kU(){this.buffer()}function vU(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function CU(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ci(this.sliceSerialize(t)).toLowerCase(),n.label=e}function wU(t){this.exit(t)}function EU(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ci(this.sliceSerialize(t)).toLowerCase(),n.label=e}function NU(t){this.exit(t)}function AU(){return"["}function _D(t,e,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),u=n.enter("reference");return s+=i.move(n.safe(n.associationId(t),{after:"]",before:s})),u(),o(),s+=i.move("]"),s}function TU(){return{enter:{gfmFootnoteCallString:bU,gfmFootnoteCall:SU,gfmFootnoteDefinitionLabelString:kU,gfmFootnoteDefinition:vU},exit:{gfmFootnoteCallString:CU,gfmFootnoteCall:wU,gfmFootnoteDefinitionLabelString:EU,gfmFootnoteDefinition:NU}}}function MU(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:_D},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const u=s.createTracker(o);let c=u.move("[^");const h=s.enter("footnoteDefinition"),m=s.enter("label");return c+=u.move(s.safe(s.associationId(r),{before:c,after:"]"})),m(),c+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),c+=u.move((e?`
54
+ `:" ")+s.indentLines(s.containerFlow(r,u.current()),e?zD:OU))),h(),c}}function OU(t,e,n){return e===0?t:zD(t,e,n)}function zD(t,e,n){return(n?"":" ")+t}const RU=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];LD.peek=LU;function DU(){return{canContainEols:["delete"],enter:{strikethrough:_U},exit:{strikethrough:zU}}}function IU(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:RU}],handlers:{delete:LD}}}function _U(t){this.enter({type:"delete",children:[]},t)}function zU(t){this.exit(t)}function LD(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 LU(){return"~"}function BU(t){return t.length}function VU(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||BU,s=[],o=[],u=[],c=[];let h=0,m=-1;for(;++m<t.length;){const N=[],T=[];let M=-1;for(t[m].length>h&&(h=t[m].length);++M<t[m].length;){const j=FU(t[m][M]);if(n.alignDelimiters!==!1){const P=i(j);T[M]=P,(c[M]===void 0||P>c[M])&&(c[M]=P)}N.push(j)}o[m]=N,u[m]=T}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<h;)s[g]=CA(r[g]);else{const N=CA(r);for(;++g<h;)s[g]=N}g=-1;const y=[],b=[];for(;++g<h;){const N=s[g];let T="",M="";N===99?(T=":",M=":"):N===108?T=":":N===114&&(M=":");let j=n.alignDelimiters===!1?1:Math.max(1,c[g]-T.length-M.length);const P=T+"-".repeat(j)+M;n.alignDelimiters!==!1&&(j=T.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),m=-1;const v=[];for(;++m<o.length;){const N=o[m],T=u[m];g=-1;const M=[];for(;++g<h;){const j=N[g]||"";let P="",J="";if(n.alignDelimiters!==!1){const L=c[g]-(T[g]||0),C=s[g];C===114?P=" ".repeat(L):C===99?L%2?(P=" ".repeat(L/2+.5),J=" ".repeat(L/2-.5)):(P=" ".repeat(L/2),J=P):J=" ".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(J),n.padding!==!1&&M.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&M.push("|")}v.push(n.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return v.join(`
55
+ `)}function FU(t){return t==null?"":String(t)}function CA(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 PU(){return{enter:{table:jU,tableData:wA,tableHeader:wA,tableRow:UU},exit:{codeText:JU,table:$U,tableData:ix,tableHeader:ix,tableRow:ix}}}function jU(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 $U(t){this.exit(t),this.data.inTable=void 0}function UU(t){this.enter({type:"tableRow",children:[]},t)}function ix(t){this.exit(t)}function wA(t){this.enter({type:"tableCell",children:[]},t)}function JU(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,HU));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function HU(t,e){return e==="|"?e:t}function qU(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
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,v,N,T){return h(m(b,N,T),b.align)}function u(b,v,N,T){const M=g(b,N,T),j=h([M]);return j.slice(0,j.indexOf(`
57
+ `))}function c(b,v,N,T){const M=N.enter("tableCell"),j=N.enter("phrasing"),P=N.containerPhrasing(b,{...T,before:s,after:s});return j(),M(),P}function h(b,v){return VU(b,{align:v,alignDelimiters:r,padding:n,stringLength:i})}function m(b,v,N){const T=b.children;let M=-1;const j=[],P=v.enter("table");for(;++M<T.length;)j[M]=g(T[M],v,N);return P(),j}function g(b,v,N){const T=b.children;let M=-1;const j=[],P=v.enter("tableRow");for(;++M<T.length;)j[M]=c(T[M],b,v,N);return P(),j}function y(b,v,N){let T=iS.inlineCode(b,v,N);return N.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function KU(){return{exit:{taskListCheckValueChecked:EA,taskListCheckValueUnchecked:EA,paragraph:YU}}}function GU(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:WU}}}function EA(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function YU(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 WU(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=iS.listItem(t,e,n,{...r,...u.current()});return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),c;function h(m){return m+o}}function XU(){return[oU(),TU(),DU(),PU(),KU()]}function QU(t){return{extensions:[lU(),MU(t),IU(),qU(t),GU()]}}const ZU={tokenize:sJ,partial:!0},BD={tokenize:aJ,partial:!0},VD={tokenize:oJ,partial:!0},FD={tokenize:lJ,partial:!0},eJ={tokenize:uJ,partial:!0},PD={name:"wwwAutolink",tokenize:rJ,previous:$D},jD={name:"protocolAutolink",tokenize:iJ,previous:UD},Js={name:"emailAutolink",tokenize:nJ,previous:JD},Yi={};function tJ(){return{text:Yi}}let Co=48;for(;Co<123;)Yi[Co]=Js,Co++,Co===58?Co=65:Co===91&&(Co=97);Yi[43]=Js;Yi[45]=Js;Yi[46]=Js;Yi[95]=Js;Yi[72]=[Js,jD];Yi[104]=[Js,jD];Yi[87]=[Js,PD];Yi[119]=[Js,PD];function nJ(t,e,n){const r=this;let i,s;return o;function o(g){return!Jb(g)||!JD.call(r,r.previous)||Jk(r.events)?n(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(g))}function u(g){return Jb(g)?(t.consume(g),u):g===64?(t.consume(g),c):n(g)}function c(g){return g===46?t.check(eJ,m,h)(g):g===45||g===95||lr(g)?(s=!0,t.consume(g),c):m(g)}function h(g){return t.consume(g),i=!0,c}function m(g){return s&&i&&Sn(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(g)):n(g)}}function rJ(t,e,n){const r=this;return i;function i(o){return o!==87&&o!==119||!$D.call(r,r.previous)||Jk(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(ZU,t.attempt(BD,t.attempt(VD,s),n),n)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function iJ(t,e,n){const r=this;let i="",s=!1;return o;function o(g){return(g===72||g===104)&&UD.call(r,r.previous)&&!Jk(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||km(g)||ct(g)||Bn(g)||yg(g)?n(g):t.attempt(BD,t.attempt(VD,m),n)(g)}function m(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(g)}}function sJ(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 aJ(t,e,n){let r,i,s;return o;function o(h){return h===46||h===95?t.check(FD,c,u)(h):h===null||ct(h)||Bn(h)||h!==45&&yg(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 oJ(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(FD,e,s)(o):o===null||ct(o)||Bn(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&r++,t.consume(o),i}}function lJ(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||ct(u)||Bn(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||ct(u)||Bn(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 uJ(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return lr(s)?n(s):e(s)}}function $D(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||ct(t)}function UD(t){return!Sn(t)}function JD(t){return!(t===47||Jb(t))}function Jb(t){return t===43||t===45||t===46||t===95||lr(t)}function Jk(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 cJ={tokenize:xJ,partial:!0};function fJ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:mJ,continuation:{tokenize:gJ},exit:yJ}},text:{91:{name:"gfmFootnoteCall",tokenize:dJ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:hJ,resolveTo:pJ}}}}function hJ(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=Ci(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 pJ(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 dJ(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||ct(g))return n(g);if(g===93){t.exit("chunkString");const y=t.exit("gfmFootnoteCallString");return i.includes(Ci(r.sliceSerialize(y)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(g)}return ct(g)||(o=!0),s++,t.consume(g),g===92?m:h}function m(g){return g===91||g===92||g===93?(t.consume(g),s++,h):h(g)}}function mJ(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,u;return c;function c(v){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(v){return v===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):n(v)}function m(v){if(o>999||v===93&&!u||v===null||v===91||ct(v))return n(v);if(v===93){t.exit("chunkString");const N=t.exit("gfmFootnoteDefinitionLabelString");return s=Ci(r.sliceSerialize(N)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),y}return ct(v)||(u=!0),o++,t.consume(v),v===92?g:m}function g(v){return v===91||v===92||v===93?(t.consume(v),o++,m):m(v)}function y(v){return v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),i.includes(s)||i.push(s),nt(t,b,"gfmFootnoteDefinitionWhitespace")):n(v)}function b(v){return e(v)}}function gJ(t,e,n){return t.check(Pu,e,t.attempt(cJ,e,n))}function yJ(t){t.exit("gfmFootnoteDefinition")}function xJ(t,e,n){const r=this;return nt(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 bJ(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 m={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",m,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,xg(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",m,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,m=this.events;let g=0;return y;function y(v){return h===126&&m[m.length-1][1].type!=="characterEscape"?c(v):(o.enter("strikethroughSequenceTemporary"),b(v))}function b(v){const N=Du(h);if(v===126)return g>1?c(v):(o.consume(v),g++,b);if(g<2&&!n)return c(v);const T=o.exit("strikethroughSequenceTemporary"),M=Du(v);return T._open=!M||M===2&&!!N,T._close=!N||N===2&&!!M,u(v)}}}class SJ{constructor(){this.map=[]}add(e,n,r){kJ(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 kJ(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 vJ(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 CJ(){return{flow:{null:{name:"table",tokenize:wJ,resolveAll:EJ}}}}function wJ(t,e,n){const r=this;let i=0,s=0,o;return u;function u(K){let pe=r.events.length-1;for(;pe>-1;){const _e=r.events[pe][1].type;if(_e==="lineEnding"||_e==="linePrefix")pe--;else break}const fe=pe>-1?r.events[pe][1].type:null,Se=fe==="tableHead"||fe==="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),m(K)}function m(K){return K===null?n(K):Ae(K)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(K),t.exit("lineEnding"),b):n(K):Ge(K)?nt(t,m,"whitespace")(K):(s+=1,o&&(o=!1,i+=1),K===124?(t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),o=!0,m):(t.enter("data"),g(K)))}function g(K){return K===null||K===124||ct(K)?(t.exit("data"),m(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,Ge(K)?nt(t,v,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):v(K))}function v(K){return K===45||K===58?T(K):K===124?(o=!0,t.enter("tableCellDivider"),t.consume(K),t.exit("tableCellDivider"),N):L(K)}function N(K){return Ge(K)?nt(t,T,"whitespace")(K):T(K)}function T(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||Ae(K)?J(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 Ge(K)?nt(t,J,"whitespace")(K):J(K)}function J(K){return K===124?v(K):K===null||Ae(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||Ae(K)?(t.exit("tableRow"),e(K)):Ge(K)?nt(t,z,"whitespace")(K):(t.enter("data"),q(K))}function q(K){return K===null||K===124||ct(K)?(t.exit("data"),z(K)):(t.consume(K),K===92?ie:q)}function ie(K){return K===92||K===124?(t.consume(K),q):q(K)}}function EJ(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],u=!1,c=0,h,m,g;const y=new SJ;for(;++n<t.length;){const b=t[n],v=b[1];b[0]==="enter"?v.type==="tableHead"?(u=!1,c!==0&&(NA(y,e,c,h,m),m=void 0,c=0),h={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},y.add(n,0,[["enter",h,e]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(r=!0,g=void 0,s=[0,0,0,0],o=[0,n+1,0,0],u&&(u=!1,m={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},y.add(n,0,[["enter",m,e]])),i=v.type==="tableDelimiterRow"?2:m?3:1):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],g=Bd(y,e,s,i,void 0,g),s=[0,0,0,0]),o[2]=n)):v.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],g=Bd(y,e,s,i,void 0,g)),s=o,o=[s[1],n,0,0])):v.type==="tableHead"?(u=!0,c=n):v.type==="tableRow"||v.type==="tableDelimiterRow"?(c=n,s[1]!==0?(o[0]=o[1],g=Bd(y,e,s,i,n,g)):o[1]!==0&&(g=Bd(y,e,o,i,n,g)),i=0):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&NA(y,e,c,h,m),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=vJ(e.events,n))}return t}function Bd(t,e,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},wu(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const c=wu(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=wu(e.events,n[2]),m=wu(e.events,n[3]),g={type:u,start:Object.assign({},h),end:Object.assign({},m)};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 v=n[2]+1,N=n[3]-n[2]-1;t.add(v,N,[])}}t.add(n[3]+1,0,[["exit",g,e]])}return i!==void 0&&(s.end=Object.assign({},wu(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function NA(t,e,n,r,i){const s=[],o=wu(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 wu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const NJ={name:"tasklistCheck",tokenize:TJ};function AJ(){return{text:{91:NJ}}}function TJ(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 ct(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 Ae(c)?e(c):Ge(c)?t.check({tokenize:MJ},e,n)(c):n(c)}}function MJ(t,e,n){return nt(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function OJ(t){return eS([tJ(),fJ(),bJ(t),CJ(),AJ()])}const RJ={};function DJ(t){const e=this,n=t||RJ,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(OJ(n)),s.push(XU()),o.push(QU(n))}function Fe(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-gfm",...e}}),t}var Hk=Xh("strike_through");Fe(Hk,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var lp=Uu("strike_through",t=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",t.get(Hk.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(lp.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});Fe(lp.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var Ug=Ue("ToggleStrikeThrough",t=>()=>Cg(lp.type(t)));Fe(Ug,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var HD=pr(t=>qh(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),lp.type(t)));Fe(HD,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var qk=Mr("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:t=>{const e=t.get(xt);return()=>e.call(Ug.key)}}});Fe(qk.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});Fe(qk.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var up=oj({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:t=>t.style.textAlign||"left",setDOMAttr:(t,e)=>{e.style=`text-align: ${t||"left"}`}}}}),Ds=en("table",()=>({...up.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(Ds.node,{displayName:"NodeSchema<table>",group:"Table"});Fe(Ds.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var cp=en("table_header_row",()=>({...up.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(cp.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});Fe(cp.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var Ku=en("table_row",()=>({...up.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(Ku.node,{displayName:"NodeSchema<tableRow>",group:"Table"});Fe(Ku.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var fp=en("table_cell",()=>({...up.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(fp.node,{displayName:"NodeSchema<tableCell>",group:"Table"});Fe(fp.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Fu=en("table_header",()=>({...up.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(Fu.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});Fe(Fu.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function qD(t,e=3,n=3){const r=Array(n).fill(0).map(()=>fp.type(t).createAndFill()),i=Array(n).fill(0).map(()=>Fu.type(t).createAndFill()),s=Array(e).fill(0).map((o,u)=>u===0?cp.type(t).create(null,i):Ku.type(t).create(null,r));return Ds.type(t).create(null,s)}function KD(t){return(e,n)=>r=>{n=n??r.selection.from;const i=r.doc.resolve(n),s=M8(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),m=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 lO(r.setSelection(g(m,b)))}}return r}}var IJ=KD("row"),_J=KD("col");function GD(t,e,{map:n,tableStart:r,table:i},s){const o=Array(s).fill(0).reduce((c,h,m)=>c+i.child(m).nodeSize,r),u=Array(n.width).fill(0).map((c,h)=>{const m=i.nodeAt(n.map[h]);return fp.type(t).createAndFill({alignment:m?.attrs.alignment})});return e.insert(o,Ku.type(t).create(null,u)),e}function zJ(t){const e=sp(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 LJ(t){const e=zJ(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 lO(t.setSelection(new Rt(i,n)))}}return t}var Kk=Ue("GoToPrevTableCell",()=>()=>ZR(-1));Fe(Kk,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var Gk=Ue("GoToNextTableCell",()=>()=>ZR(1));Fe(Gk,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var Yk=Ue("ExitTable",t=>()=>(e,n)=>{if(!oi(e))return!1;const{$head:r}=e.selection,i=T8(r,Ds.type(t));if(!i)return!1;const{to:s}=i,o=e.tr.replaceWith(s,s,$i.type(t).createAndFill());return o.setSelection(Ve.near(o.doc.resolve(s),1)).scrollIntoView(),n?.(o),!0});Fe(Yk,{displayName:"Command<breakTableCommand>",group:"Table"});var Wk=Ue("InsertTable",t=>({row:e,col:n}={})=>(r,i)=>{const{selection:s,tr:o}=r,{from:u}=s,c=qD(t,e,n),h=o.replaceSelectionWith(c),m=Ve.findFrom(h.doc.resolve(u),1,!0);return m&&h.setSelection(m),i?.(h),!0});Fe(Wk,{displayName:"Command<insertTableCommand>",group:"Table"});var YD=Ue("MoveRow",()=>({from:t,to:e,pos:n}={})=>zj({from:t??0,to:e??0,pos:n}));Fe(YD,{displayName:"Command<moveRowCommand>",group:"Table"});var WD=Ue("MoveCol",()=>({from:t,to:e,pos:n}={})=>Lj({from:t??0,to:e??0,pos:n}));Fe(WD,{displayName:"Command<moveColCommand>",group:"Table"});var XD=Ue("SelectRow",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(IJ(t.index,t.pos)(r))});Fe(XD,{displayName:"Command<selectRowCommand>",group:"Table"});var QD=Ue("SelectCol",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(_J(t.index,t.pos)(r))});Fe(QD,{displayName:"Command<selectColCommand>",group:"Table"});var ZD=Ue("SelectTable",()=>()=>(t,e)=>{const{tr:n}=t;return!!e?.(LJ(n))});Fe(ZD,{displayName:"Command<selectTableCommand>",group:"Table"});var eI=Ue("DeleteSelectedCells",()=>()=>(t,e)=>{const{selection:n}=t;if(!(n instanceof Rt))return!1;const r=n.isRowSelection(),i=n.isColSelection();return r&&i?_j(t,e):i?Tj(t,e):Oj(t,e)});Fe(eI,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var tI=Ue("AddColBefore",()=>()=>Ej);Fe(tI,{displayName:"Command<addColBeforeCommand>",group:"Table"});var nI=Ue("AddColAfter",()=>()=>Nj);Fe(nI,{displayName:"Command<addColAfterCommand>",group:"Table"});var rI=Ue("AddRowBefore",t=>()=>(e,n)=>{if(!oi(e))return!1;if(n){const r=Za(e);n(GD(t,e.tr,r,r.top))}return!0});Fe(rI,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var iI=Ue("AddRowAfter",t=>()=>(e,n)=>{if(!oi(e))return!1;if(n){const r=Za(e);n(GD(t,e.tr,r,r.bottom))}return!0});Fe(iI,{displayName:"Command<addRowAfterCommand>",group:"Table"});var sI=Ue("SetAlign",()=>(t="left")=>Rj("alignment",t));Fe(sI,{displayName:"Command<setAlignCommand>",group:"Table"});var aI=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),Ds.type(t)))return null;const o=qD(t,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),u=e.tr.replaceRangeWith(r,i,o);return u.setSelection(we.create(u.doc,r+3)).scrollIntoView()}));Fe(aI,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var oI=JV(t=>({run:(e,n,r)=>{if(r)return e;function i(h){const m=h.childCount,g=h.lastChild?.childCount??0;if(m===0||g===0)return $i.type(t).create();const y=h.firstChild;if(!(g>0&&y&&y.childCount===0))return h;if(m>=3){const T=h.child(1),M=[];for(let J=0;J<T.childCount;J++){const L=T.child(J);M.push(Fu.type(t).create(L.attrs,L.content,L.marks))}const j=y.type.create(y.attrs,M),P=[];for(let J=2;J<m;J++)P.push(h.child(J));return h.type.create(h.attrs,[j,...P])}const b=Array(g).fill(0).map(()=>Fu.type(t).createAndFill()),v=new H(G.from(b),0,0),N=y.replace(0,0,v);return h.replace(0,y.nodeSize,new H(G.from(N),0,0))}function s(h){const m=Ku.type(t),g=[];let y=[],b=!1;function v(){if(y.length===0)return;const N=cp.type(t).createAndFill(),T=Ds.type(t).create(null,[N,...y]);g.push(i(T)),y=[]}return h.forEach(N=>{N.type===m?(b=!0,y.push(N)):(v(),g.push(N))}),v(),b?G.from(g):h}function o(h){let m=s(h),g=m!==h;const y=[];return m.forEach(b=>{if(b.type===Ds.type(t)){const v=i(b);v!==b&&(g=!0),y.push(v)}else if(b.childCount>0){const v=o(b.content);v!==b.content?(g=!0,y.push(b.copy(v))):y.push(b)}else y.push(b)}),g?G.from(y):h}function u(h){const m=[],g=[];h.forEach(y=>g.push(y));for(let y=0;y<g.length;y++){const b=g[y],v=g[y+1];b.type===$i.type(t)&&b.content.size===0&&v&&v.type===Ds.type(t)||m.push(b)}return m.length<g.length?G.from(m):h}let c=o(e.content);return c=u(c),new H(G.from(c),e.openStart,e.openEnd)}}));Fe(oI,{displayName:"PasteRule<table>",group:"Table"});var Xk=Mr("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:t=>{const e=t.get(xt);return()=>e.call(Gk.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:t=>{const e=t.get(xt);return()=>e.call(Kk.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:t=>{const e=t.get(xt);return()=>e.call(Yk.key)}}});Fe(Xk.ctx,{displayName:"KeymapCtx<table>",group:"Table"});Fe(Xk.shortcuts,{displayName:"Keymap<table>",group:"Table"});var sx="footnote_definition",AA="footnoteDefinition",Qk=en("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${sx}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw qi(t);return{label:t.dataset.label}},contentElement:"dd"}],toDOM:t=>{const e=t.attrs.label;return["dl",{"data-label":e,"data-type":sx},["dt",e],["dd",0]]},parseMarkdown:{match:({type:t})=>t===AA,runner:(t,e,n)=>{t.openNode(n,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:t=>t.type.name===sx,runner:(t,e)=>{t.openNode(AA,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));Fe(Qk.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});Fe(Qk.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var ax="footnote_reference",Zk=en("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${ax}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw qi(t);return{label:t.dataset.label}}}],toDOM:t=>{const e=t.attrs.label;return["sup",{"data-label":e,"data-type":ax},e]},parseMarkdown:{match:({type:t})=>t==="footnoteReference",runner:(t,e,n)=>{t.addNode(n,{label:e.label})}},toMarkdown:{match:t=>t.type.name===ax,runner:(t,e)=>{t.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));Fe(Zk.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});Fe(Zk.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var ev=js.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 qi(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(ev.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});Fe(ev.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var lI=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(lI,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var BJ=[qk,Xk].flat(),VJ=[aI,lI],FJ=[HD],PJ=[oI],uI=Fs(()=>tU);Fe(uI,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var jJ=Fs(()=>qj({}));Fe(jJ,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var cI=Fs(()=>n$({allowTableNodeSelection:!0}));Fe(cI,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var tv=Ps("remarkGFM",()=>DJ);Fe(tv.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});Fe(tv.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var $J=new hr("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function UJ(t,e){let n=0;return e.forEach((r,i,s)=>{r===t&&(n=s)}),n}var fI=Fs(()=>new fr({key:$J,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 m=UJ(s,c),g=h.maybeChild(m);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(fI,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var JJ=[fI,uI,tv,cI].flat(),HJ=[ev,Ds,cp,Ku,Fu,fp,Qk,Zk,Hk,lp].flat(),qJ=[Gk,Kk,Yk,Wk,YD,WD,XD,QD,ZD,eI,rI,iI,tI,nI,sI,Ug],hI=[HJ,VJ,PJ,FJ,BJ,qJ,JJ].flat();const nv={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},Qm={flex:1,border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 8px",font:"inherit",outline:"none",minWidth:0},Dh={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},KJ=nv,GJ=Qm,ox=Dh;function YJ({initialUrl:t,isEdit:e,onApply:n,onRemove:r,onClose:i}){const[s,o]=le.useState(t),u=()=>{const c=s.trim();c!==""&&n(c)};return I.jsxs("div",{style:KJ,"data-mdx-action":"link",onMouseDown:c=>c.stopPropagation(),children:[I.jsx("input",{style:GJ,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:{...ox,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:c=>c.preventDefault(),onClick:u,children:e?"Update":"Add"}),e&&r?I.jsx("button",{type:"button",style:{...ox,color:"#dc2626"},onMouseDown:c=>c.preventDefault(),onClick:r,children:"Remove"}):null,I.jsx("button",{type:"button",style:ox,onMouseDown:c=>c.preventDefault(),onClick:i,children:"Cancel"})]})}const WJ={...nv,flexWrap:"wrap"},TA={fontSize:11,color:"#71717a",whiteSpace:"nowrap"};function XJ({initialAlt:t,onApply:e,onClose:n}){const[r,i]=le.useState(t),[s,o]=le.useState(""),u=()=>e(r.trim(),s.trim()),c=h=>{h.key==="Enter"&&(h.preventDefault(),u()),h.key==="Escape"&&n()};return I.jsxs("div",{style:WJ,"data-mdx-action":"image",onMouseDown:h=>h.stopPropagation(),children:[I.jsx("span",{style:TA,children:"Alt"}),I.jsx("input",{style:Qm,autoFocus:!0,placeholder:"Alt text for screen readers",value:r,onChange:h=>i(h.currentTarget.value),onKeyDown:c}),I.jsx("span",{style:TA,children:"Caption"}),I.jsx("input",{style:Qm,placeholder:"Caption / source (optional)",value:s,onChange:h=>o(h.currentTarget.value),onKeyDown:c}),I.jsx("button",{type:"button",style:{...Dh,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:h=>h.preventDefault(),onClick:u,children:"Insert"}),I.jsx("button",{type:"button",style:Dh,onMouseDown:h=>h.preventDefault(),onClick:n,children:"Cancel"})]})}function MA(t){return typeof t!="object"||t===null?!1:"status"in t&&t.status===501||"code"in t&&t.code==="unsupported"}const OA=new Set(["image/svg+xml","image/x-icon"]),QJ=[{value:"all",label:"All"},{value:"photo",label:"Photos"},{value:"graphic",label:"Graphics"},{value:"document",label:"Documents"}];function ZJ(t,e){return e==="all"?!0:e==="photo"?t.startsWith("image/")&&!OA.has(t):e==="graphic"?OA.has(t):e==="document"?t==="application/pdf":!0}const eH={position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1100},tH={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"},nH={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #ececed"},rH={display:"flex",flexDirection:"column",gap:10,padding:"12px 16px",borderBottom:"1px solid #ececed"},Yc={display:"flex",alignItems:"center",gap:8},RA={flex:1,border:"1px solid #d4d4d8",borderRadius:6,padding:"6px 10px",font:"inherit",outline:"none"},Eu={border:"1px solid #d4d4d8",background:"#fff",borderRadius:6,padding:"6px 12px",font:"inherit",cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},DA={...Eu,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},iH={display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10,padding:16,overflowY:"auto"},IA={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},sH={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 pI({media:t,context:e,field:n,accept:r="image/*,application/pdf",onSelect:i,onClose:s}){const[o,u]=le.useState([]),[c,h]=le.useState([]),[m,g]=le.useState(""),[y,b]=le.useState(""),[v,N]=le.useState("all"),[T,M]=le.useState(!1),[j,P]=le.useState(!1),[J,L]=le.useState(!1),[C,z]=le.useState(null),[q,ie]=le.useState(!1),[K,pe]=le.useState(""),fe=le.useRef(null),Se=le.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){MA(F)?P(!0):z(F instanceof Error?F.message:"Failed to load media")}finally{M(!1)}},[t]);le.useEffect(()=>{Se(m)},[Se,m]);const _e=D=>{b(""),g(D)},Re=async D=>{L(!0),z(null);try{const F=await t.uploadMedia(D,{...e,field:n,folder:m||void 0});if(F.success&&F.url){if(F.url.startsWith("./")){i(F.url,F.annotation??"");return}const Q={id:F.id??F.url,url:F.url,filename:F.filename??D.name,annotation:F.annotation,contentType:D.type||"application/octet-stream",folder:m||void 0};u(V=>[Q,...V])}else z(F.error??"Upload failed")}catch(F){MA(F)?P(!0):z(F instanceof Error?F.message:"Upload failed")}finally{L(!1)}},X=async()=>{const D=K.trim();if(!D||!t.createFolder)return;if(/[/\\:*?"<>|]/.test(D)){z("Invalid folder name");return}const F=m?`${m}/${D}`:D;try{const Q=await t.createFolder(F);Q.success?h(V=>[...V,{name:D,path:F}].sort((xe,Oe)=>xe.name.localeCompare(Oe.name))):z(Q.error??"Failed to create folder")}catch(Q){z(Q instanceof Error?Q.message:"Failed to create folder")}pe(""),ie(!1)},oe=le.useMemo(()=>{const D=v==="all"?o:o.filter(Q=>ZJ(Q.contentType,v)),F=y.trim().toLowerCase();return F===""?D:D.filter(Q=>Q.filename.toLowerCase().includes(F))},[o,v,y]),ke=le.useMemo(()=>{if(!m)return[];const D=m.split("/");return D.map((F,Q)=>({name:F,path:D.slice(0,Q+1).join("/")}))},[m]),ze=!y&&v==="all";return I.jsx("div",{style:eH,onMouseDown:s,"data-cms-ui":"",children:I.jsxs("div",{style:tH,onMouseDown:D=>D.stopPropagation(),onDrop:D=>{D.preventDefault();const F=D.dataTransfer.files[0];F&&Re(F)},onDragOver:D=>D.preventDefault(),children:[I.jsxs("div",{style:nH,children:[I.jsx("strong",{style:{fontSize:15},children:"Media Library"}),I.jsx("button",{type:"button",style:{...Eu,border:"none",fontSize:18,lineHeight:1,padding:2},onClick:s,"aria-label":"Close",children:"×"})]}),I.jsxs("div",{style:rH,children:[ke.length>0?I.jsxs("div",{style:{...Yc,gap:4,fontSize:12,color:"#71717a"},children:[I.jsx("button",{type:"button",style:{...Eu,border:"none",padding:"0 2px"},onClick:()=>_e(""),children:"root"}),ke.map((D,F)=>I.jsxs("span",{style:Yc,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:{...Eu,border:"none",padding:"0 2px"},onClick:()=>_e(D.path),children:D.name})]},D.path))]}):null,I.jsxs("div",{style:Yc,children:[I.jsx("input",{style:RA,placeholder:"Search files…",value:y,onChange:D=>b(D.target.value)}),t.createFolder?I.jsx("button",{type:"button",style:Eu,onClick:()=>ie(D=>!D),children:"New folder"}):null,I.jsx("button",{type:"button",style:DA,disabled:j||J,onClick:()=>fe.current?.click(),children:J?"Uploading…":"Upload"}),I.jsx("input",{ref:fe,type:"file",accept:r,style:{display:"none"},onChange:D=>{const F=D.target.files?.[0];F&&Re(F),D.target.value=""}})]}),I.jsx("div",{style:{...Yc,gap:4},children:QJ.map(D=>I.jsx("button",{type:"button",style:{...Eu,padding:"3px 10px",fontSize:12,...v===D.value?{background:"#2563eb",borderColor:"#2563eb",color:"#fff"}:{}},onClick:()=>N(D.value),children:D.label},D.value))}),q&&t.createFolder?I.jsxs("div",{style:Yc,children:[I.jsx("input",{style:RA,autoFocus:!0,placeholder:"Folder name…",value:K,onChange:D=>pe(D.target.value),onKeyDown:D=>{D.key==="Enter"&&X(),D.key==="Escape"&&(ie(!1),pe(""))}}),I.jsx("button",{type:"button",style:DA,onClick:()=>{X()},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]}),T?I.jsx("div",{style:{padding:32,textAlign:"center",color:"#a1a1aa"},children:"Loading…"}):c.length===0&&oe.length===0?I.jsx("div",{style:{padding:32,textAlign:"center",color:"#a1a1aa"},children:y||v!=="all"?"No matching files.":"No files yet. Upload one to get started."}):I.jsxs("div",{style:iH,children:[ze?c.map(D=>I.jsxs("button",{type:"button",style:IA,onClick:()=>_e(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,oe.map(D=>I.jsxs("button",{type:"button",style:IA,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:sH,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",m?` to ${m}`:"","."]})]})})}const Hb={bold:!1,italic:!1,strikethrough:!1,link:!1,linkHref:null,bulletList:!1,orderedList:!1,listStyle:null,blockquote:!1,heading:null};function aH(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 m=e.storedMarks||n.marks();for(const T of m)T.type.name==="strong"&&(s=!0),T.type.name==="emphasis"&&(o=!0),T.type.name==="strike_through"&&(u=!0),T.type.name==="link"&&(c=!0,h=typeof T.attrs.href=="string"?T.attrs.href:null);r!==i&&e.doc.nodesBetween(r,i,T=>{for(const M of T.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,v=!1,N=null;for(let T=n.depth;T>0;T--){const M=n.node(T);(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"&&(v=!0)}if(n.parent.type.name==="heading"){const T=n.parent.attrs.level;N=typeof T=="number"?T:null}return{bold:s,italic:o,strikethrough:u,link:c,linkHref:h,bulletList:g,orderedList:y,listStyle:b,blockquote:v,heading:N}}function oH(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 lH(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),m=n.selection.$to.after(n.selection.$to.depth);t.dispatch(n.tr.setBlockType(h,m,u,c)),t.focus()}function uH(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 cH(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 fH(t,e){let n=0,r=Hb;const i=()=>{const u=t.ctx.get(sn),c=aH(u);cH(c,r)||(r=c,e(c))},s=t.ctx.get(sn),o=s.dispatch.bind(s);return s.dispatch=u=>{o(u),(u.selectionSet||u.docChanged)&&(cancelAnimationFrame(n),n=requestAnimationFrame(i))},i(),()=>{cancelAnimationFrame(n)}}const dI="list",hH=/^[A-Za-z0-9_-]+$/;function Fi(t){if(typeof t!="string")return null;const[e]=t.trim().split(/\s+/);return!e||!hH.test(e)?null:e}function fl(t){return Array.isArray(t?.children)?t.children:null}function lx(t){const e=fl(t);return e&&e.length>0?e[e.length-1]:void 0}function mI(t){return!t.attributes||typeof t.attributes!="object"||Array.isArray(t.attributes)?null:t.attributes}function pH(t){return Fi(mI(t)?.class)}function gI(t,e){const n=fl(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 dH(t){if(!gI(t))return null;const e=fl(t)?.[0];return typeof e?.value!="string"?null:/^:::list\{\.([A-Za-z0-9_-]+)\}$/.exec(e.value)?.[1]??null}function _A(t){return t?.type==="list"}function mH(t,e,n){if(gI(e[n],":::"))return e.splice(n,1),!0;const r=lx(t),i=lx(r);if(!i||i.type!=="paragraph")return!1;const s=fl(i),o=lx(i);if(!s||o?.type!=="text"||typeof o.value!="string")return!1;if(o.value===":::")s.pop();else if(o.value.endsWith(`
58
+ :::`))o.value=o.value.slice(0,-4);else return!1;return s.length===0&&fl(r)?.pop(),!0}function yI(t){const e=fl(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===dI?pH(o):null,c=fl(o),h=c?.length===1?c[0]:void 0;if(u&&_A(h)){e[n]={...h,listStyle:u};continue}}const i=dH(r),s=e[n+1];if(i&&_A(s)&&mH(s,e,n+2)){e.splice(n,1),e[n]={...s,listStyle:i};continue}yI(r)}}function gH(t){return!!(t&&typeof t=="object"&&"containerFlow"in t&&typeof t.containerFlow=="function")}const yH=(t,e,n,r)=>{if(!gH(n))return"";const i=Fi(mI(t)?.class),s=n.containerFlow(t,r);return`:::list${i?`{.${i}}`:""}
59
+ ${s}
60
+ :::`},xH=function(){const t=this.data("toMarkdownExtensions")??[],e={handlers:{containerDirective:yH}};return t.push(e),this.data("toMarkdownExtensions",t),n=>{yI(n)}},bH=Ps("remarkListDirective",()=>xH);function xI(t){return t&&typeof t=="object"?t:{}}function SH(t){if(t)return{name:dI,attributes:{class:t}}}function bI(t,e,n){const r=Fi(e.attrs.listStyle),i=SH(r);i&&t.openNode("containerDirective",void 0,i),t.openNode("list",void 0,n).next(e.content).closeNode(),i&&t.closeNode()}const kH=dl.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=xI(n.parseDOM?.[0]?.getAttrs?.(r)),s=r instanceof HTMLElement?Fi(r.className):null;return{...i,listStyle:s}}}],toDOM:r=>{const i=Fi(r.attrs.listStyle);return["ul",{...e.get(Ig.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:Fi(i.listStyle)}).next(i.children).closeNode()}},toMarkdown:{match:r=>r.type.name==="bullet_list",runner:(r,i)=>{bI(r,i,{ordered:!1,spread:i.attrs.spread===!0})}}}}),vH=ml.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=xI(n.parseDOM?.[0]?.getAttrs?.(r)),s=r instanceof HTMLElement?Fi(r.className):null;return{...i,listStyle:s}}}],toDOM:r=>{const i=Fi(r.attrs.listStyle);return["ol",{...e.get(zg.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:Fi(i.listStyle)}).next(i.children).closeNode()}},toMarkdown:{match:r=>r.type.name==="ordered_list",runner:(r,i)=>{bI(r,i,{ordered:!0,start:typeof i.attrs.order=="number"?i.attrs.order:1,spread:i.attrs.spread===!0})}}}}),SI=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=Fi(t),s=new Map,{from:o,to:u,$from:c}=e.selection;for(let h=c.depth;h>0;h--){const m=c.node(h);if(r.has(m.type)){s.set(c.before(h),m);break}}if(e.doc.nodesBetween(o,u,(h,m)=>{r.has(h.type)&&s.set(m,h)}),s.size===0)return!1;if(n){let h=e.tr;for(const[m,g]of s)h=h.setNodeMarkup(m,void 0,{...g.attrs,listStyle:i});n(h.scrollIntoView())}return!0}),CH=[bH,kH,vH,SI].flat(),wH=/^[A-Za-z0-9_-]{11}$/,EH=/(?:youtu\.be\/|\/(?:embed|shorts|v)\/)([A-Za-z0-9_-]{11})/;function NH(t){const e=t.trim();if(!e)return null;if(wH.test(e))return e;const n=/[?&]v=([A-Za-z0-9_-]{11})/.exec(e);if(n)return n[1]??null;const r=EH.exec(e);return r?r[1]??null:null}const AH={fontSize:11,color:"#dc2626",whiteSpace:"nowrap"};function TH({onApply:t,onClose:e}){const[n,r]=le.useState(""),[i,s]=le.useState(!1),o=()=>{const u=NH(n);if(!u){s(!0);return}t(u)};return I.jsxs("div",{style:nv,"data-mdx-action":"youtube",onMouseDown:u=>u.stopPropagation(),children:[I.jsx("input",{style:Qm,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:AH,children:"No video id found"}):null,I.jsx("button",{type:"button",style:{...Dh,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:u=>u.preventDefault(),onClick:o,children:"Insert"}),I.jsx("button",{type:"button",style:Dh,onMouseDown:u=>u.preventDefault(),onClick:e,children:"Cancel"})]})}function MH(t){const[e,n]=le.useState(Hb);return le.useEffect(()=>{if(!t){n(Hb);return}return fH(t,n)},[t]),e}function ux(t,e){lH(t.ctx.get(sn),e)}function zA(t,e){const n=t.ctx.get(sn);oH(n,e==="bullet"?"bullet_list":"ordered_list")?t.action(Bi(Bg.key)):t.action(Bi(e==="bullet"?_g.key:Lg.key))}function OH(t,e){t.ctx.get(sn).focus(),t.action(Bi(SI.key,e))}function RH(t,e,n,r){t.action(i=>{const s=i.get(sn),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 DH(t,e){t.action(n=>{const r=n.get(sn),i=r.state.schema.nodes.paragraph;if(!i)return;const s=i.create(null,r.state.schema.text(`:::youtube{${e}}`));r.focus(),r.dispatch(r.state.tr.replaceSelectionWith(s).scrollIntoView())})}const IH={display:"flex",flexWrap:"wrap",alignItems:"center",gap:3,padding:"4px 6px",borderBottom:"1px solid #ececed",background:"#fafafa"},cx={width:1,height:18,background:"#e4e4e7",margin:"0 3px"},kI={border:"1px solid transparent",background:"transparent",borderRadius:4,padding:"2px 7px",font:"inherit",fontSize:12,lineHeight:1.4,cursor:"pointer",color:"#52525b"},_H={...kI,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},zH={border:"1px solid #d4d4d8",borderRadius:4,background:"#fff",color:"#3f3f46",font:"inherit",fontSize:12,lineHeight:1.4,padding:"2px 6px",maxWidth:150};function sr({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?_H:kI,...r},children:i})}function vI({editor:t,listStyles:e,media:n,mediaContext:r,field:i,onInsertComponent:s}){const o=MH(t),[u,c]=le.useState(!1),[h,m]=le.useState(!1),[g,y]=le.useState(!1),[b,v]=le.useState(null),N=t===null,T=(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(sn).focus(),t.action(Bi(o.link?JS.key:US.key,{href:L}))},J=()=>{if(c(!1),!t)return;const L=t.ctx.get(sn);L.focus(),uH(L)};return I.jsxs("div",{children:[I.jsxs("div",{style:IH,children:[I.jsx(sr,{active:o.bold,title:"Bold",onClick:()=>t?.action(Bi(Mg.key)),style:{fontWeight:700},children:"B"}),I.jsx(sr,{active:o.italic,title:"Italic",onClick:()=>t?.action(Bi(Tg.key)),style:{fontStyle:"italic"},children:"I"}),I.jsx(sr,{active:o.strikethrough,title:"Strikethrough",onClick:()=>t?.action(Bi(Ug.key)),style:{textDecoration:"line-through"},children:"S"}),I.jsx("span",{style:cx}),I.jsx(sr,{active:o.heading===2,title:"Heading 2",onClick:()=>t&&ux(t,2),children:"H2"}),I.jsx(sr,{active:o.heading===3,title:"Heading 3",onClick:()=>t&&ux(t,3),children:"H3"}),I.jsx(sr,{active:o.heading===4,title:"Heading 4",onClick:()=>t&&ux(t,4),children:"H4"}),I.jsx("span",{style:cx}),I.jsx(sr,{active:o.bulletList,title:"Bullet list",onClick:()=>t&&zA(t,"bullet"),children:"• List"}),I.jsx(sr,{active:o.orderedList,title:"Numbered list",onClick:()=>t&&zA(t,"ordered"),children:"1. List"}),T?I.jsxs("select",{title:"List style","aria-label":"List style",disabled:N||!M,value:j,onChange:L=>{t&&OH(t,L.currentTarget.value||null)},style:{...zH,opacity:N||!M?.55:1,cursor:N||!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(sr,{active:o.blockquote,title:"Quote",onClick:()=>t?.action(Bi(Dg.key)),children:"❝"}),I.jsx(sr,{title:"Insert table",onClick:()=>t?.action(Bi(Wk.key,{row:3,col:3})),children:"▦ Table"}),I.jsx(sr,{active:g,title:"Insert YouTube",onClick:()=>!N&&y(L=>!L),children:"YouTube"}),I.jsx("span",{style:cx}),I.jsx(sr,{active:o.link||u,title:"Link",onClick:()=>!N&&c(L=>!L),children:"🔗 Link"}),n?I.jsx(sr,{title:"Insert image",onClick:()=>!N&&m(!0),children:"🖼 Image"}):null,s?I.jsxs(I.Fragment,{children:[I.jsx("span",{style:{flex:1}}),I.jsx(sr,{title:"Insert component block",onClick:()=>!N&&s(),style:{border:"1px solid #d4d4d8",color:"#3f3f46"},children:"+ Component"})]}):null]}),u?I.jsx("div",{style:{padding:"0 6px"},children:I.jsx(YJ,{initialUrl:o.linkHref??"https://",isEdit:o.link,onApply:P,onRemove:o.link?J:void 0,onClose:()=>c(!1)})}):null,g?I.jsx("div",{style:{padding:"0 6px"},children:I.jsx(TH,{onApply:L=>{y(!1),t&&DH(t,L)},onClose:()=>y(!1)})}):null,b?I.jsx("div",{style:{padding:"0 6px"},children:I.jsx(XJ,{initialAlt:b.alt,onApply:(L,C)=>{const{url:z}=b;v(null),t&&RH(t,z,L,C)},onClose:()=>v(null)})}):null,h&&n?I.jsx(pI,{media:n,context:r,field:i,accept:"image/*",onSelect:(L,C)=>{m(!1),t&&v({url:L,alt:C??""})},onClose:()=>m(!1)}):null]})}function LH(){return{enter:{mdxFlowExpression:VH,mdxTextExpression:FH},exit:{mdxFlowExpression:LA,mdxFlowExpressionChunk:BA,mdxTextExpression:LA,mdxTextExpressionChunk:BA}}}function BH(){return{handlers:{mdxFlowExpression:VA,mdxTextExpression:VA},unsafe:[{character:"{",inConstruct:["phrasing"]},{atBreak:!0,character:"{"}]}}function VH(t){this.enter({type:"mdxFlowExpression",value:""},t),this.buffer()}function FH(t){this.enter({type:"mdxTextExpression",value:""},t),this.buffer()}function LA(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 BA(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function VA(t,e,n){const r=t.value||"";return"{"+n.indentLines(r,function(s,o,u){return(o===0||u?"":" ")+s})+"}"}const PH=["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"],FA={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 CI(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=48&&e<=57}function jH(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=102||e>=65&&e<=70||e>=48&&e<=57}function $H(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=122||e>=65&&e<=90}function PA(t){return $H(t)||CI(t)}const UH=["","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 JH(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 m=(c?c.line:0)||1,g=(c?c.column:0)||1,y=v(),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,J=j,L;if(M===35){J=++P;const Se=t.charCodeAt(J);Se===88||Se===120?(L="hexadecimal",J=++P):L="decimal"}else L="named";let C="",z="",q="";const ie=L==="named"?PA:L==="decimal"?CI:jH;for(J--;++J<=t.length;){const Se=t.charCodeAt(J);if(!ie(Se))break;q+=String.fromCharCode(Se),L==="named"&&PH.includes(q)&&(C=q,z=uh(q))}let K=t.charCodeAt(J)===59;if(K){J++;const Se=L==="named"?uh(q):!1;Se&&(C=q,z=Se)}let pe=1+J-j,fe="";if(!(!K&&n.nonTerminated===!1))if(!q)L!=="named"&&N(4,pe);else if(L==="named"){if(K&&!z)N(5,1);else if(C!==q&&(J=P+C.length,pe=1+J-P,K=!1),!K){const Se=C?1:3;if(n.attribute){const _e=t.charCodeAt(J);_e===61?(N(Se,pe),z=""):PA(_e)?z="":N(Se,pe)}else N(Se,pe)}fe=z}else{K||N(2,pe);let Se=Number.parseInt(q,L==="hexadecimal"?16:10);if(HH(Se))N(7,pe),fe="�";else if(Se in FA)N(6,pe),fe=FA[Se];else{let _e="";qH(Se)&&N(6,pe),Se>65535&&(Se-=65536,_e+=String.fromCharCode(Se>>>10|55296),Se=56320|Se&1023),fe=_e+String.fromCharCode(Se)}}if(fe){T(),y=v(),s=J-1,g+=J-j+1,i.push(fe);const Se=v();Se.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,fe,{start:y,end:Se},t.slice(j-1,J)),y=Se}else q=t.slice(j-1,J),u+=q,g+=q.length,s=J-1}else b===10&&(m++,o++,g=0),Number.isNaN(b)?T():(u+=String.fromCharCode(b),g++);return i.join("");function v(){return{line:m,column:g,offset:s+((c?c.offset:0)||0)}}function N(M,j){let P;n.warning&&(P=v(),P.column+=j,P.offset+=j,n.warning.call(n.warningContext||void 0,UH[M],P,M))}function T(){u&&(i.push(u),n.text&&n.text.call(n.textContext||void 0,u,{start:y,end:v()}),u="")}}function HH(t){return t>=55296&&t<=57343||t>1114111}function qH(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 KH=/["&'<>`]/g,GH=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,YH=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,WH=/[|\\{}()[\]^$+*?.]/g,jA=new WeakMap;function XH(t,e){if(t=t.replace(e.subset?QH(e.subset):KH,r),e.subset||e.escapeOnly)return t;return t.replace(GH,n).replace(YH,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 QH(t){let e=jA.get(t);return e||(e=ZH(t),jA.set(t,e)),e}function ZH(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(WH,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function eq(t){return"&#x"+t.toString(16).toUpperCase()+";"}function tq(t,e){return XH(t,Object.assign({format:eq},e))}const wI=" ";function nq(){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:m,mdxJsxFlowTagExpressionAttribute:b,mdxJsxFlowTagExpressionAttributeValue:n,mdxJsxFlowTagAttributeNamePrimary:v,mdxJsxFlowTagAttributeNameLocal:N,mdxJsxFlowTagAttributeValueLiteral:T,mdxJsxFlowTagAttributeValueLiteralValue:n,mdxJsxFlowTagAttributeValueExpression:M,mdxJsxFlowTagAttributeValueExpressionValue:n,mdxJsxFlowTagSelfClosingMarker:j,mdxJsxFlowTag:P,mdxJsxTextTagClosingMarker:u,mdxJsxTextTagNamePrimary:c,mdxJsxTextTagNameMember:h,mdxJsxTextTagNameLocal:m,mdxJsxTextTagExpressionAttribute:b,mdxJsxTextTagExpressionAttributeValue:n,mdxJsxTextTagAttributeNamePrimary:v,mdxJsxTextTagAttributeNameLocal:N,mdxJsxTextTagAttributeValueLiteral:T,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 q={name:void 0,attributes:[],close:!1,selfClosing:!1,start:z.start,end:z.end};this.data.mdxJsxTagStack||(this.data.mdxJsxTagStack=[]),this.data.mdxJsxTag=q,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 q=this.data.mdxJsxTag;q.name=this.sliceSerialize(z)}function h(z){const q=this.data.mdxJsxTag;q.name+="."+this.sliceSerialize(z)}function m(z){const q=this.data.mdxJsxTag;q.name+=":"+this.sliceSerialize(z)}function g(z){const q=this.data.mdxJsxTag;s.call(this,z),q.attributes.push({type:"mdxJsxAttribute",name:"",value:null,position:{start:e(z.start),end:void 0}})}function y(z){const q=this.data.mdxJsxTag;s.call(this,z),q.attributes.push({type:"mdxJsxExpressionAttribute",value:"",position:{start:e(z.start),end:void 0}}),this.buffer()}function b(z){const q=this.data.mdxJsxTag,ie=q.attributes[q.attributes.length-1];ie.type;const K=z.estree;ie.value=this.resume(),ie.position,ie.position.end=e(z.end),K&&(ie.data={estree:K})}function v(z){const q=this.data.mdxJsxTag,ie=q.attributes[q.attributes.length-1];ie.type,ie.name=this.sliceSerialize(z),ie.position,ie.position.end=e(z.end)}function N(z){const q=this.data.mdxJsxTag,ie=q.attributes[q.attributes.length-1];ie.type,ie.name+=":"+this.sliceSerialize(z),ie.position,ie.position.end=e(z.end)}function T(z){const q=this.data.mdxJsxTag,ie=q.attributes[q.attributes.length-1];ie.value=JH(this.resume(),{nonTerminated:!1}),ie.position,ie.position.end=e(z.end)}function M(z){const q=this.data.mdxJsxTag,ie=q.attributes[q.attributes.length-1];ie.type;const K={type:"mdxJsxAttributeValueExpression",value:this.resume()},pe=z.estree;pe&&(K.data={estree:pe}),ie.value=K,ie.position,ie.position.end=e(z.end)}function j(){const z=this.data.mdxJsxTag;z.selfClosing=!0}function P(z){const q=this.data.mdxJsxTag,ie=this.data.mdxJsxTagStack,K=ie[ie.length-1];if(q.close&&K.name!==q.name)throw new mt("Unexpected closing tag `"+C(q)+"`, expected corresponding closing tag for `"+C(K)+"` ("+As(K)+")",{start:z.start,end:z.end},"mdast-util-mdx-jsx:end-tag-mismatch");this.resume(),q.close?ie.pop():this.enter({type:z.type==="mdxJsxTextTag"?"mdxJsxTextElement":"mdxJsxFlowElement",name:q.name||null,attributes:q.attributes,children:[]},z,J),q.selfClosing||q.close?this.exit(z,L):ie.push(q)}function J(z,q){const ie=this.data.mdxJsxTagStack,K=ie[ie.length-1],pe=z?" before the end of `"+z.type+"`":"",fe=z?{start:z.start,end:z.end}:void 0;throw new mt("Expected a closing tag for `"+C(K)+"` ("+As({start:q.start,end:q.end})+")"+pe,fe,"mdast-util-mdx-jsx:end-tag-mismatch")}function L(z,q){const ie=this.data.mdxJsxTag;throw new mt("Expected the closing tag `"+C(ie)+"` either after the end of `"+q.type+"` ("+As(q.end)+") or another opening tag after the start of `"+q.type+"` ("+As(q.start)+")",{start:z.start,end:z.end},"mdast-util-mdx-jsx:end-tag-mismatch")}function C(z){return"<"+(z.close?"/":"")+(z.name||"")+">"}}function rq(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=sq,{handlers:{mdxJsxFlowElement:u,mdxJsxTextElement:u},unsafe:[{character:"<",inConstruct:["phrasing"]},{atBreak:!0,character:"<"}],fences:!0,resourceLink:!0};function u(c,h,m,g){const y=c.type==="mdxJsxFlowElement",b=c.name?!c.children||c.children.length===0:!1,v=EI(m),N=NI(v),T=m.createTracker(g),M=m.createTracker(g),j=[],P=(y?N:"")+"<"+(c.name||""),J=m.enter(c.type);if(T.move(P),M.move(P),c.attributes&&c.attributes.length>0){if(!c.name)throw new Error("Cannot serialize fragment w/ attributes");let ie=-1;for(;++ie<c.attributes.length;){const K=c.attributes[ie];let pe;if(K.type==="mdxJsxExpressionAttribute")pe="{"+(K.value||"")+"}";else{if(!K.name)throw new Error("Cannot serialize attribute w/o name");const fe=K.value,Se=K.name;let _e="";if(fe!=null)if(typeof fe=="object")_e="{"+(fe.value||"")+"}";else{const Re=r&&Xm(fe,n)>Xm(fe,o)?o:n;_e=Re+tq(fe,{subset:[Re]})+Re}pe=Se+(_e?"=":"")+_e}j.push(pe)}}let L=!1;const C=j.join(" ");y&&(/\r?\n|\r/.test(C)||T.current().now.column+C.length+(b?i?2:3:1)>s)&&(L=!0);let z=T,q=P;if(L){z=M;let ie=-1;for(;++ie<j.length;)j[ie]=N+wI+j[ie];q+=z.move(`
61
+ `+j.join(`
62
+ `)+`
63
+ `+N)}else C&&(q+=z.move(" "+C));return b&&(q+=z.move((i||L?"":" ")+"/")),q+=z.move(">"),c.children&&c.children.length>0&&(c.type==="mdxJsxTextElement"?q+=z.move(m.containerPhrasing(c,{...z.current(),before:">",after:"<"})):(z.shift(2),q+=z.move(`
64
+ `),q+=z.move(iq(c,m,z.current())),q+=z.move(`
65
+ `))),b||(q+=z.move((y?N:"")+"</"+(c.name||"")+">")),J(),q}}function iq(t,e,n){const r=e.indexStack,i=t.children,s=e.createTracker(n),o=NI(EI(e)),u=[];let c=-1;for(r.push(-1);++c<i.length;){const h=i[c];r[r.length-1]=c;const m={before:`
66
+ `,after:`
67
+ `,...s.current()},g=e.handle(h,t,e,m),y=h.type==="mdxJsxFlowElement"?g:e.indentLines(g,function(b,v,N){return(N?"":o)+b});u.push(s.move(y)),h.type!=="list"&&(e.bulletLastUsed=void 0),c<i.length-1&&u.push(s.move(`
68
+
69
+ `))}return r.pop(),u.join("")}function EI(t){let e=0,n=t.stack.length;for(;--n>-1;){const r=t.stack[n];if(r==="blockquote"||r==="listItem")break;r==="mdxJsxFlowElement"&&e++}return e}function NI(t){return wI.repeat(t)}function sq(){return"<"}function aq(){return{enter:{mdxjsEsm:lq},exit:{mdxjsEsm:uq,mdxjsEsmData:cq}}}function oq(){return{handlers:{mdxjsEsm:fq}}}function lq(t){this.enter({type:"mdxjsEsm",value:""},t),this.buffer()}function uq(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(t);const r=t.estree;n.value=e,r&&(n.data={estree:r})}function cq(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function fq(t){return t.value||""}function hq(){return[LH(),nq(),aq()]}function pq(t){return{extensions:[BH(),rq(t),oq()]}}var dq=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],AI=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],mq="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",TI="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",fx={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},hx="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",gq={5:hx,"5module":hx+" export import",6:hx+" const class extends export import super"},yq=/^in(stanceof)?$/,xq=new RegExp("["+TI+"]"),bq=new RegExp("["+TI+mq+"]");function qb(t,e){for(var n=65536,r=0;r<e.length;r+=2){if(n+=e[r],n>t)return!1;if(n+=e[r+1],n>=t)return!0}return!1}function Hi(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&xq.test(String.fromCharCode(t)):e===!1?!1:qb(t,AI)}function Ka(t,e){return t<48?t===36:t<58?!0:t<65?!1:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&bq.test(String.fromCharCode(t)):e===!1?!1:qb(t,AI)||qb(t,dq)}var ft=function(e,n){n===void 0&&(n={}),this.label=e,this.keyword=n.keyword,this.beforeExpr=!!n.beforeExpr,this.startsExpr=!!n.startsExpr,this.isLoop=!!n.isLoop,this.isAssign=!!n.isAssign,this.prefix=!!n.prefix,this.postfix=!!n.postfix,this.binop=n.binop||null,this.updateContext=null};function qr(t,e){return new ft(t,{beforeExpr:!0,binop:e})}var Kr={beforeExpr:!0},ar={startsExpr:!0},rv={};function lt(t,e){return e===void 0&&(e={}),e.keyword=t,rv[t]=new ft(t,e)}var O={num:new ft("num",ar),regexp:new ft("regexp",ar),string:new ft("string",ar),name:new ft("name",ar),privateId:new ft("privateId",ar),eof:new ft("eof"),bracketL:new ft("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new ft("]"),braceL:new ft("{",{beforeExpr:!0,startsExpr:!0}),braceR:new ft("}"),parenL:new ft("(",{beforeExpr:!0,startsExpr:!0}),parenR:new ft(")"),comma:new ft(",",Kr),semi:new ft(";",Kr),colon:new ft(":",Kr),dot:new ft("."),question:new ft("?",Kr),questionDot:new ft("?."),arrow:new ft("=>",Kr),template:new ft("template"),invalidTemplate:new ft("invalidTemplate"),ellipsis:new ft("...",Kr),backQuote:new ft("`",ar),dollarBraceL:new ft("${",{beforeExpr:!0,startsExpr:!0}),eq:new ft("=",{beforeExpr:!0,isAssign:!0}),assign:new ft("_=",{beforeExpr:!0,isAssign:!0}),incDec:new ft("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new ft("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:qr("||",1),logicalAND:qr("&&",2),bitwiseOR:qr("|",3),bitwiseXOR:qr("^",4),bitwiseAND:qr("&",5),equality:qr("==/!=/===/!==",6),relational:qr("</>/<=/>=",7),bitShift:qr("<</>>/>>>",8),plusMin:new ft("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:qr("%",10),star:qr("*",10),slash:qr("/",10),starstar:new ft("**",{beforeExpr:!0}),coalesce:qr("??",1),_break:lt("break"),_case:lt("case",Kr),_catch:lt("catch"),_continue:lt("continue"),_debugger:lt("debugger"),_default:lt("default",Kr),_do:lt("do",{isLoop:!0,beforeExpr:!0}),_else:lt("else",Kr),_finally:lt("finally"),_for:lt("for",{isLoop:!0}),_function:lt("function",ar),_if:lt("if"),_return:lt("return",Kr),_switch:lt("switch"),_throw:lt("throw",Kr),_try:lt("try"),_var:lt("var"),_const:lt("const"),_while:lt("while",{isLoop:!0}),_with:lt("with"),_new:lt("new",{beforeExpr:!0,startsExpr:!0}),_this:lt("this",ar),_super:lt("super",ar),_class:lt("class",ar),_extends:lt("extends",Kr),_export:lt("export"),_import:lt("import",ar),_null:lt("null",ar),_true:lt("true",ar),_false:lt("false",ar),_in:lt("in",{beforeExpr:!0,binop:7}),_instanceof:lt("instanceof",{beforeExpr:!0,binop:7}),_typeof:lt("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:lt("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:lt("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},cr=/\r\n?|\n|\u2028|\u2029/,Sq=new RegExp(cr.source,"g");function Gu(t){return t===10||t===13||t===8232||t===8233}function MI(t,e,n){n===void 0&&(n=t.length);for(var r=e;r<n;r++){var i=t.charCodeAt(r);if(Gu(i))return r<n-1&&i===13&&t.charCodeAt(r+1)===10?r+2:r+1}return-1}var OI=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,bn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,RI=Object.prototype,kq=RI.hasOwnProperty,vq=RI.toString,Yu=Object.hasOwn||(function(t,e){return kq.call(t,e)}),$A=Array.isArray||(function(t){return vq.call(t)==="[object Array]"}),UA=Object.create(null);function Ba(t){return UA[t]||(UA[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function zs(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var Cq=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ih=function(e,n){this.line=e,this.column=n};Ih.prototype.offset=function(e){return new Ih(this.line,this.column+e)};var Jg=function(e,n,r){this.start=n,this.end=r,e.sourceFile!==null&&(this.source=e.sourceFile)};function DI(t,e){for(var n=1,r=0;;){var i=MI(t,r,e);if(i<0)return new Ih(n,e-r);++n,r=i}}var Kb={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},JA=!1;function wq(t){var e={};for(var n in Kb)e[n]=t&&Yu(t,n)?t[n]:Kb[n];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!JA&&typeof console=="object"&&console.warn&&(JA=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
70
+ Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),(!t||t.allowHashBang==null)&&(e.allowHashBang=e.ecmaVersion>=14),$A(e.onToken)){var r=e.onToken;e.onToken=function(i){return r.push(i)}}return $A(e.onComment)&&(e.onComment=Eq(e,e.onComment)),e}function Eq(t,e){return function(n,r,i,s,o,u){var c={type:n?"Block":"Line",value:r,start:i,end:s};t.locations&&(c.loc=new Jg(this,o,u)),t.ranges&&(c.range=[i,s]),e.push(c)}}var _h=1,Wu=2,iv=4,II=8,sv=16,_I=32,Hg=64,zI=128,Sl=256,hp=512,qg=_h|Wu|Sl;function av(t,e){return Wu|(t?iv:0)|(e?II:0)}var Zm=0,ov=1,Hs=2,LI=3,BI=4,VI=5,Zt=function(e,n,r){this.options=e=wq(e),this.sourceFile=e.sourceFile,this.keywords=Ba(gq[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var i="";e.allowReserved!==!0&&(i=fx[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(i+=" await")),this.reservedWords=Ba(i);var s=(i?i+" ":"")+fx.strict;this.reservedWordsStrict=Ba(s),this.reservedWordsStrictBind=Ba(s+" "+fx.strictBind),this.input=String(n),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf(`
71
+ `,r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(cr).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=O.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(_h),this.regexpState=null,this.privateNameStack=[]},Wi={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};Zt.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};Wi.inFunction.get=function(){return(this.currentVarScope().flags&Wu)>0};Wi.inGenerator.get=function(){return(this.currentVarScope().flags&II)>0};Wi.inAsync.get=function(){return(this.currentVarScope().flags&iv)>0};Wi.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(Sl|hp))return!1;if(n&Wu)return(n&iv)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Wi.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&Hg)>0||this.options.allowSuperOutsideMethod};Wi.allowDirectSuper.get=function(){return(this.currentThisScope().flags&zI)>0};Wi.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Wi.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(Sl|hp)||n&Wu&&!(n&sv))return!0}return!1};Wi.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Sl)>0};Zt.extend=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];for(var r=this,i=0;i<e.length;i++)r=e[i](r);return r};Zt.parse=function(e,n){return new this(n,e).parse()};Zt.parseExpressionAt=function(e,n,r){var i=new this(r,e,n);return i.nextToken(),i.parseExpression()};Zt.tokenizer=function(e,n){return new this(n,e)};Object.defineProperties(Zt.prototype,Wi);var Yn=Zt.prototype,Nq=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Yn.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){bn.lastIndex=t,t+=bn.exec(this.input)[0].length;var e=Nq.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){bn.lastIndex=t+e[0].length;var n=bn.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===";"||i==="}"||cr.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i==="!"&&this.input.charAt(r+1)==="=")}t+=e[0].length,bn.lastIndex=t,t+=bn.exec(this.input)[0].length,this.input[t]===";"&&t++}};Yn.eat=function(t){return this.type===t?(this.next(),!0):!1};Yn.isContextual=function(t){return this.type===O.name&&this.value===t&&!this.containsEsc};Yn.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};Yn.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};Yn.canInsertSemicolon=function(){return this.type===O.eof||this.type===O.braceR||cr.test(this.input.slice(this.lastTokEnd,this.start))};Yn.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};Yn.semicolon=function(){!this.eat(O.semi)&&!this.insertSemicolon()&&this.unexpected()};Yn.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};Yn.expect=function(t){this.eat(t)||this.unexpected()};Yn.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var Kg=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Yn.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var n=e?t.parenthesizedAssign:t.parenthesizedBind;n>-1&&this.raiseRecoverable(n,e?"Assigning to rvalue":"Parenthesized pattern")}};Yn.checkExpressionErrors=function(t,e){if(!t)return!1;var n=t.shorthandAssign,r=t.doubleProto;if(!e)return n>=0||r>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")};Yn.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};Yn.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var Ne=Zt.prototype;Ne.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==O.eof;){var n=this.parseStatement(null,!0,e);t.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var s=i[r];this.raiseRecoverable(this.undefinedExports[s].start,"Export '"+s+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var lv={kind:"loop"},Aq={kind:"switch"};Ne.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;bn.lastIndex=this.pos;var e=bn.exec(this.input),n=this.pos+e[0].length,r=this.input.charCodeAt(n);if(r===91||r===92)return!0;if(t)return!1;if(r===123||r>55295&&r<56320)return!0;if(Hi(r,!0)){for(var i=n+1;Ka(r=this.input.charCodeAt(i),!0);)++i;if(r===92||r>55295&&r<56320)return!0;var s=this.input.slice(n,i);if(!yq.test(s))return!0}return!1};Ne.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;bn.lastIndex=this.pos;var t=bn.exec(this.input),e=this.pos+t[0].length,n;return!cr.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(Ka(n=this.input.charCodeAt(e+8))||n>55295&&n<56320))};Ne.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;bn.lastIndex=this.pos;var n=bn.exec(this.input),r=this.pos+n[0].length;if(cr.test(this.input.slice(this.pos,r)))return!1;if(t){var i=r+5,s;if(this.input.slice(r,i)!=="using"||i===this.input.length||Ka(s=this.input.charCodeAt(i))||s>55295&&s<56320)return!1;bn.lastIndex=i;var o=bn.exec(this.input);if(o&&cr.test(this.input.slice(i,i+o[0].length)))return!1}if(e){var u=r+2,c;if(this.input.slice(r,u)==="of"&&(u===this.input.length||!Ka(c=this.input.charCodeAt(u))&&!(c>55295&&c<56320)))return!1}var h=this.input.charCodeAt(r);return Hi(h,!0)||h===92};Ne.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)};Ne.isUsing=function(t){return this.isUsingKeyword(!1,t)};Ne.parseStatement=function(t,e,n){var r=this.type,i=this.startNode(),s;switch(this.isLet(t)&&(r=O._var,s="let"),r){case O._break:case O._continue:return this.parseBreakContinueStatement(i,r.keyword);case O._debugger:return this.parseDebuggerStatement(i);case O._do:return this.parseDoStatement(i);case O._for:return this.parseForStatement(i);case O._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!t);case O._class:return t&&this.unexpected(),this.parseClass(i,!0);case O._if:return this.parseIfStatement(i);case O._return:return this.parseReturnStatement(i);case O._switch:return this.parseSwitchStatement(i);case O._throw:return this.parseThrowStatement(i);case O._try:return this.parseTryStatement(i);case O._const:case O._var:return s=s||this.value,t&&s!=="var"&&this.unexpected(),this.parseVarStatement(i,s);case O._while:return this.parseWhileStatement(i);case O._with:return this.parseWithStatement(i);case O.braceL:return this.parseBlock(!0,i);case O.semi:return this.parseEmptyStatement(i);case O._export:case O._import:if(this.options.ecmaVersion>10&&r===O._import){bn.lastIndex=this.pos;var o=bn.exec(this.input),u=this.pos+o[0].length,c=this.input.charCodeAt(u);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===O._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!t);var h=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(h)return e&&this.options.sourceType==="script"&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),h==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(i,!1,h),this.semicolon(),this.finishNode(i,"VariableDeclaration");var m=this.value,g=this.parseExpression();return r===O.name&&g.type==="Identifier"&&this.eat(O.colon)?this.parseLabeledStatement(i,m,g,t):this.parseExpressionStatement(i,g)}};Ne.parseBreakContinueStatement=function(t,e){var n=e==="break";this.next(),this.eat(O.semi)||this.insertSemicolon()?t.label=null:this.type!==O.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((t.label==null||i.name===t.label.name)&&(i.kind!=null&&(n||i.kind==="loop")||t.label&&n))break}return r===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,n?"BreakStatement":"ContinueStatement")};Ne.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};Ne.parseDoStatement=function(t){return this.next(),this.labels.push(lv),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(O._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(O.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};Ne.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(lv),this.enterScope(0),this.expect(O.parenL),this.type===O.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var n=this.isLet();if(this.type===O._var||this.type===O._const||n){var r=this.startNode(),i=n?"let":this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,"VariableDeclaration"),this.parseForAfterInit(t,r,e)}var s=this.isContextual("let"),o=!1,u=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(u){var c=this.startNode();return this.next(),u==="await using"&&this.next(),this.parseVar(c,!0,u),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(t,c,e)}var h=this.containsEsc,m=new Kg,g=this.start,y=e>-1?this.parseExprSubscripts(m,"await"):this.parseExpression(!0,m);return this.type===O._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===O._in&&this.unexpected(e),t.await=!0):o&&this.options.ecmaVersion>=8&&(y.start===g&&!h&&y.type==="Identifier"&&y.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(t.await=!1)),s&&o&&this.raise(y.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(y,!1,m),this.checkLValPattern(y),this.parseForIn(t,y)):(this.checkExpressionErrors(m,!0),e>-1&&this.unexpected(e),this.parseFor(t,y))};Ne.parseForAfterInit=function(t,e,n){return(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&e.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===O._in?n>-1&&this.unexpected(n):t.await=n>-1),this.parseForIn(t,e)):(n>-1&&this.unexpected(n),this.parseFor(t,e))};Ne.parseFunctionStatement=function(t,e,n){return this.next(),this.parseFunction(t,sh|(n?0:Gb),!1,e)};Ne.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(O._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};Ne.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(O.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};Ne.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(O.braceL),this.labels.push(Aq),this.enterScope(0);for(var e,n=!1;this.type!==O.braceR;)if(this.type===O._case||this.type===O._default){var r=this.type===O._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),r?e.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),n=!0,e.test=null),this.expect(O.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};Ne.parseThrowStatement=function(t){return this.next(),cr.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Tq=[];Ne.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?_I:0),this.checkLValPattern(t,e?BI:Hs),this.expect(O.parenR),t};Ne.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===O._catch){var e=this.startNode();this.next(),this.eat(O.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(O._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};Ne.parseVarStatement=function(t,e,n){return this.next(),this.parseVar(t,!1,e,n),this.semicolon(),this.finishNode(t,"VariableDeclaration")};Ne.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(lv),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};Ne.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};Ne.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};Ne.parseLabeledStatement=function(t,e,n,r){for(var i=0,s=this.labels;i<s.length;i+=1){var o=s[i];o.name===e&&this.raise(n.start,"Label '"+e+"' is already declared")}for(var u=this.type.isLoop?"loop":this.type===O._switch?"switch":null,c=this.labels.length-1;c>=0;c--){var h=this.labels[c];if(h.statementStart===t.start)h.statementStart=this.start,h.kind=u;else break}return this.labels.push({name:e,kind:u,statementStart:this.start}),t.body=this.parseStatement(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),t.label=n,this.finishNode(t,"LabeledStatement")};Ne.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};Ne.parseBlock=function(t,e,n){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(O.braceL),t&&this.enterScope(0);this.type!==O.braceR;){var r=this.parseStatement(null);e.body.push(r)}return n&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};Ne.parseFor=function(t,e){return t.init=e,this.expect(O.semi),t.test=this.type===O.semi?null:this.parseExpression(),this.expect(O.semi),t.update=this.type===O.parenR?null:this.parseExpression(),this.expect(O.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};Ne.parseForIn=function(t,e){var n=this.type===O._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(e.start,(n?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(O.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,n?"ForInStatement":"ForOfStatement")};Ne.parseVar=function(t,e,n,r){for(t.declarations=[],t.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(O.eq)?i.init=this.parseMaybeAssign(e):!r&&n==="const"&&!(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&(n==="using"||n==="await using")&&this.options.ecmaVersion>=17&&this.type!==O._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+n+" declaration"):!r&&i.id.type!=="Identifier"&&!(e&&(this.type===O._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):i.init=null,t.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(O.comma))break}return t};Ne.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?ov:Hs,!1)};var sh=1,Gb=2,FI=4;Ne.parseFunction=function(t,e,n,r,i){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===O.star&&e&Gb&&this.unexpected(),t.generator=this.eat(O.star)),this.options.ecmaVersion>=8&&(t.async=!!r),e&sh&&(t.id=e&FI&&this.type!==O.name?null:this.parseIdent(),t.id&&!(e&Gb)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?ov:Hs:LI));var s=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(av(t.async,t.generator)),e&sh||(t.id=this.type===O.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,n,!1,i),this.yieldPos=s,this.awaitPos=o,this.awaitIdentPos=u,this.finishNode(t,e&sh?"FunctionDeclaration":"FunctionExpression")};Ne.parseFunctionParams=function(t){this.expect(O.parenL),t.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Ne.parseClass=function(t,e){this.next();var n=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var r=this.enterClassBody(),i=this.startNode(),s=!1;for(i.body=[],this.expect(O.braceL);this.type!==O.braceR;){var o=this.parseClassElement(t.superClass!==null);o&&(i.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(s&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),s=!0):o.key&&o.key.type==="PrivateIdentifier"&&Mq(r,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=n,this.next(),t.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};Ne.parseClassElement=function(t){if(this.eat(O.semi))return null;var e=this.options.ecmaVersion,n=this.startNode(),r="",i=!1,s=!1,o="method",u=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(O.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===O.star?u=!0:r="static"}if(n.static=u,!r&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===O.star)&&!this.canInsertSemicolon()?s=!0:r="async"),!r&&(e>=9||!s)&&this.eat(O.star)&&(i=!0),!r&&!s&&!i){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,"Identifier")):this.parseClassElementName(n),e<13||this.type===O.parenL||o!=="method"||i||s){var h=!n.static&&eg(n,"constructor"),m=h&&t;h&&o!=="method"&&this.raise(n.key.start,"Constructor can't have get/set modifier"),n.kind=h?"constructor":o,this.parseClassMethod(n,i,s,m)}else this.parseClassField(n);return n};Ne.isClassElementNameStart=function(){return this.type===O.name||this.type===O.privateId||this.type===O.num||this.type===O.string||this.type===O.bracketL||this.type.keyword};Ne.parseClassElementName=function(t){this.type===O.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)};Ne.parseClassMethod=function(t,e,n,r){var i=t.key;t.kind==="constructor"?(e&&this.raise(i.start,"Constructor can't be a generator"),n&&this.raise(i.start,"Constructor can't be an async method")):t.static&&eg(t,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var s=t.value=this.parseMethod(e,n,r);return t.kind==="get"&&s.params.length!==0&&this.raiseRecoverable(s.start,"getter should have no params"),t.kind==="set"&&s.params.length!==1&&this.raiseRecoverable(s.start,"setter should have exactly one param"),t.kind==="set"&&s.params[0].type==="RestElement"&&this.raiseRecoverable(s.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")};Ne.parseClassField=function(t){return eg(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&eg(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(O.eq)?(this.enterScope(hp|Hg),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};Ne.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(Sl|Hg);this.type!==O.braceR;){var n=this.parseStatement(null);t.body.push(n)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};Ne.parseClassId=function(t,e){this.type===O.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,Hs,!1)):(e===!0&&this.unexpected(),t.id=null)};Ne.parseClassSuper=function(t){t.superClass=this.eat(O._extends)?this.parseExprSubscripts(null,!1):null};Ne.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};Ne.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,n=t.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],s=0;s<n.length;++s){var o=n[s];Yu(e,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,"Private field '#"+o.name+"' must be declared in an enclosing class"))}};function Mq(t,e){var n=e.key.name,r=t[n],i="true";return e.type==="MethodDefinition"&&(e.kind==="get"||e.kind==="set")&&(i=(e.static?"s":"i")+e.kind),r==="iget"&&i==="iset"||r==="iset"&&i==="iget"||r==="sget"&&i==="sset"||r==="sset"&&i==="sget"?(t[n]="true",!1):r?!0:(t[n]=i,!1)}function eg(t,e){var n=t.computed,r=t.key;return!n&&(r.type==="Identifier"&&r.name===e||r.type==="Literal"&&r.value===e)}Ne.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==O.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};Ne.parseExport=function(t,e){if(this.next(),this.eat(O.star))return this.parseExportAllDeclaration(t,e);if(this.eat(O._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==O.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var n=0,r=t.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type==="Literal"&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};Ne.parseExportDeclaration=function(t){return this.parseStatement(null)};Ne.parseExportDefaultDeclaration=function(){var t;if(this.type===O._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,sh|FI,!1,t)}else if(this.type===O._class){var n=this.startNode();return this.parseClass(n,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};Ne.checkExport=function(t,e,n){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),Yu(t,e)&&this.raiseRecoverable(n,"Duplicate export '"+e+"'"),t[e]=!0)};Ne.checkPatternExport=function(t,e){var n=e.type;if(n==="Identifier")this.checkExport(t,e,e.start);else if(n==="ObjectPattern")for(var r=0,i=e.properties;r<i.length;r+=1){var s=i[r];this.checkPatternExport(t,s)}else if(n==="ArrayPattern")for(var o=0,u=e.elements;o<u.length;o+=1){var c=u[o];c&&this.checkPatternExport(t,c)}else n==="Property"?this.checkPatternExport(t,e.value):n==="AssignmentPattern"?this.checkPatternExport(t,e.left):n==="RestElement"&&this.checkPatternExport(t,e.argument)};Ne.checkVariableExport=function(t,e){if(t)for(var n=0,r=e;n<r.length;n+=1){var i=r[n];this.checkPatternExport(t,i.id)}};Ne.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};Ne.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")};Ne.parseExportSpecifiers=function(t){var e=[],n=!0;for(this.expect(O.braceL);!this.eat(O.braceR);){if(n)n=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;e.push(this.parseExportSpecifier(t))}return e};Ne.parseImport=function(t){return this.next(),this.type===O.string?(t.specifiers=Tq,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===O.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};Ne.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,Hs),this.finishNode(t,"ImportSpecifier")};Ne.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,Hs),this.finishNode(t,"ImportDefaultSpecifier")};Ne.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,Hs),this.finishNode(t,"ImportNamespaceSpecifier")};Ne.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===O.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(O.comma)))return t;if(this.type===O.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(O.braceL);!this.eat(O.braceR);){if(e)e=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;t.push(this.parseImportSpecifier())}return t};Ne.parseWithClause=function(){var t=[];if(!this.eat(O._with))return t;this.expect(O.braceL);for(var e={},n=!0;!this.eat(O.braceR);){if(n)n=!1;else if(this.expect(O.comma),this.afterTrailingComma(O.braceR))break;var r=this.parseImportAttribute(),i=r.key.type==="Identifier"?r.key.name:r.key.value;Yu(e,i)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+i+"'"),e[i]=!0,t.push(r)}return t};Ne.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===O.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(O.colon),this.type!==O.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")};Ne.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===O.string){var t=this.parseLiteral(this.value);return Cq.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)};Ne.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};Ne.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var li=Zt.prototype;li.toAssignable=function(t,e,n){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",n&&this.checkPatternErrors(n,!0);for(var r=0,i=t.properties;r<i.length;r+=1){var s=i[r];this.toAssignable(s,e),s.type==="RestElement"&&(s.argument.type==="ArrayPattern"||s.argument.type==="ObjectPattern")&&this.raise(s.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",n&&this.checkPatternErrors(n,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,n);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else n&&this.checkPatternErrors(n,!0);return t};li.toAssignableList=function(t,e){for(var n=t.length,r=0;r<n;r++){var i=t[r];i&&this.toAssignable(i,e)}if(n){var s=t[n-1];this.options.ecmaVersion===6&&e&&s&&s.type==="RestElement"&&s.argument.type!=="Identifier"&&this.unexpected(s.argument.start)}return t};li.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};li.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==O.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};li.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case O.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(O.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case O.braceL:return this.parseObj(!0)}return this.parseIdent()};li.parseBindingList=function(t,e,n,r){for(var i=[],s=!0;!this.eat(t);)if(s?s=!1:this.expect(O.comma),e&&this.type===O.comma)i.push(null);else{if(n&&this.afterTrailingComma(t))break;if(this.type===O.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else i.push(this.parseAssignableListItem(r))}return i};li.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};li.parseBindingListItem=function(t){return t};li.parseMaybeDefault=function(t,e,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(O.eq))return n;var r=this.startNodeAt(t,e);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};li.checkLValSimple=function(t,e,n){e===void 0&&(e=Zm);var r=e!==Zm;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(r?"Binding ":"Assigning to ")+t.name+" in strict mode"),r&&(e===Hs&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),n&&(Yu(n,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),n[t.name]=!0),e!==VI&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,n);default:this.raise(t.start,(r?"Binding":"Assigning to")+" rvalue")}};li.checkLValPattern=function(t,e,n){switch(e===void 0&&(e=Zm),t.type){case"ObjectPattern":for(var r=0,i=t.properties;r<i.length;r+=1){var s=i[r];this.checkLValInnerPattern(s,e,n)}break;case"ArrayPattern":for(var o=0,u=t.elements;o<u.length;o+=1){var c=u[o];c&&this.checkLValInnerPattern(c,e,n)}break;default:this.checkLValSimple(t,e,n)}};li.checkLValInnerPattern=function(t,e,n){switch(e===void 0&&(e=Zm),t.type){case"Property":this.checkLValInnerPattern(t.value,e,n);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,n);break;case"RestElement":this.checkLValPattern(t.argument,e,n);break;default:this.checkLValPattern(t,e,n)}};var ki=function(e,n,r,i,s){this.token=e,this.isExpr=!!n,this.preserveSpace=!!r,this.override=i,this.generator=!!s},It={b_stat:new ki("{",!1),b_expr:new ki("{",!0),b_tmpl:new ki("${",!1),p_stat:new ki("(",!1),p_expr:new ki("(",!0),q_tmpl:new ki("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new ki("function",!1),f_expr:new ki("function",!0),f_expr_gen:new ki("function",!0,!1,null,!0),f_gen:new ki("function",!1,!1,null,!0)},Xu=Zt.prototype;Xu.initialContext=function(){return[It.b_stat]};Xu.curContext=function(){return this.context[this.context.length-1]};Xu.braceIsBlock=function(t){var e=this.curContext();return e===It.f_expr||e===It.f_stat?!0:t===O.colon&&(e===It.b_stat||e===It.b_expr)?!e.isExpr:t===O._return||t===O.name&&this.exprAllowed?cr.test(this.input.slice(this.lastTokEnd,this.start)):t===O._else||t===O.semi||t===O.eof||t===O.parenR||t===O.arrow?!0:t===O.braceL?e===It.b_stat:t===O._var||t===O._const||t===O.name?!1:!this.exprAllowed};Xu.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if(e.token==="function")return e.generator}return!1};Xu.updateContext=function(t){var e,n=this.type;n.keyword&&t===O.dot?this.exprAllowed=!1:(e=n.updateContext)?e.call(this,t):this.exprAllowed=n.beforeExpr};Xu.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};O.parenR.updateContext=O.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var t=this.context.pop();t===It.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};O.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?It.b_stat:It.b_expr),this.exprAllowed=!0};O.dollarBraceL.updateContext=function(){this.context.push(It.b_tmpl),this.exprAllowed=!0};O.parenL.updateContext=function(t){var e=t===O._if||t===O._for||t===O._with||t===O._while;this.context.push(e?It.p_stat:It.p_expr),this.exprAllowed=!0};O.incDec.updateContext=function(){};O._function.updateContext=O._class.updateContext=function(t){t.beforeExpr&&t!==O._else&&!(t===O.semi&&this.curContext()!==It.p_stat)&&!(t===O._return&&cr.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===O.colon||t===O.braceL)&&this.curContext()===It.b_stat)?this.context.push(It.f_expr):this.context.push(It.f_stat),this.exprAllowed=!1};O.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};O.backQuote.updateContext=function(){this.curContext()===It.q_tmpl?this.context.pop():this.context.push(It.q_tmpl),this.exprAllowed=!1};O.star.updateContext=function(t){if(t===O._function){var e=this.context.length-1;this.context[e]===It.f_expr?this.context[e]=It.f_expr_gen:this.context[e]=It.f_gen}this.exprAllowed=!0};O.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==O.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var Je=Zt.prototype;Je.checkPropClash=function(t,e,n){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var r=t.key,i;switch(r.type){case"Identifier":i=r.name;break;case"Literal":i=String(r.value);break;default:return}var s=t.kind;if(this.options.ecmaVersion>=6){i==="__proto__"&&s==="init"&&(e.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),e.proto=!0);return}i="$"+i;var o=e[i];if(o){var u;s==="init"?u=this.strict&&o.init||o.get||o.set:u=o.init||o[s],u&&this.raiseRecoverable(r.start,"Redefinition of property")}else o=e[i]={init:!1,get:!1,set:!1};o[s]=!0}};Je.parseExpression=function(t,e){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(t,e);if(this.type===O.comma){var s=this.startNodeAt(n,r);for(s.expressions=[i];this.eat(O.comma);)s.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(s,"SequenceExpression")}return i};Je.parseMaybeAssign=function(t,e,n){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var r=!1,i=-1,s=-1,o=-1;e?(i=e.parenthesizedAssign,s=e.trailingComma,o=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new Kg,r=!0);var u=this.start,c=this.startLoc;(this.type===O.parenL||this.type===O.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=t==="await");var h=this.parseMaybeConditional(t,e);if(n&&(h=n.call(this,h,u,c)),this.type.isAssign){var m=this.startNodeAt(u,c);return m.operator=this.value,this.type===O.eq&&(h=this.toAssignable(h,!1,e)),r||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=h.start&&(e.shorthandAssign=-1),this.type===O.eq?this.checkLValPattern(h):this.checkLValSimple(h),m.left=h,this.next(),m.right=this.parseMaybeAssign(t),o>-1&&(e.doubleProto=o),this.finishNode(m,"AssignmentExpression")}else r&&this.checkExpressionErrors(e,!0);return i>-1&&(e.parenthesizedAssign=i),s>-1&&(e.trailingComma=s),h};Je.parseMaybeConditional=function(t,e){var n=this.start,r=this.startLoc,i=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return i;if(this.eat(O.question)){var s=this.startNodeAt(n,r);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(O.colon),s.alternate=this.parseMaybeAssign(t),this.finishNode(s,"ConditionalExpression")}return i};Je.parseExprOps=function(t,e){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||i.start===n&&i.type==="ArrowFunctionExpression"?i:this.parseExprOp(i,n,r,-1,t)};Je.parseExprOp=function(t,e,n,r,i){var s=this.type.binop;if(s!=null&&(!i||this.type!==O._in)&&s>r){var o=this.type===O.logicalOR||this.type===O.logicalAND,u=this.type===O.coalesce;u&&(s=O.logicalAND.binop);var c=this.value;this.next();var h=this.start,m=this.startLoc,g=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),h,m,s,i),y=this.buildBinary(e,n,t,g,c,o||u);return(o&&this.type===O.coalesce||u&&(this.type===O.logicalOR||this.type===O.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(y,e,n,r,i)}return t};Je.buildBinary=function(t,e,n,r,i,s){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(t,e);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,s?"LogicalExpression":"BinaryExpression")};Je.parseMaybeUnary=function(t,e,n,r){var i=this.start,s=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(r),e=!0;else if(this.type.prefix){var u=this.startNode(),c=this.type===O.incDec;u.operator=this.value,u.prefix=!0,this.next(),u.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(t,!0),c?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&PI(u.argument)?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&Yb(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):e=!0,o=this.finishNode(u,c?"UpdateExpression":"UnaryExpression")}else if(!e&&this.type===O.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==O._in&&this.unexpected();else{if(o=this.parseExprSubscripts(t,r),this.checkExpressionErrors(t))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(i,s);h.operator=this.value,h.prefix=!1,h.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(h,"UpdateExpression")}}if(!n&&this.eat(O.starstar))if(e)this.unexpected(this.lastTokStart);else return this.buildBinary(i,s,o,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return o};function PI(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&PI(t.expression)}function Yb(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&Yb(t.expression)||t.type==="ParenthesizedExpression"&&Yb(t.expression)}Je.parseExprSubscripts=function(t,e){var n=this.start,r=this.startLoc,i=this.parseExprAtom(t,e);if(i.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return i;var s=this.parseSubscripts(i,n,r,!1,e);return t&&s.type==="MemberExpression"&&(t.parenthesizedAssign>=s.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=s.start&&(t.parenthesizedBind=-1),t.trailingComma>=s.start&&(t.trailingComma=-1)),s};Je.parseSubscripts=function(t,e,n,r,i){for(var s=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,o=!1;;){var u=this.parseSubscript(t,e,n,r,s,o,i);if(u.optional&&(o=!0),u===t||u.type==="ArrowFunctionExpression"){if(o){var c=this.startNodeAt(e,n);c.expression=u,u=this.finishNode(c,"ChainExpression")}return u}t=u}};Je.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(O.arrow)};Je.parseSubscriptAsyncArrow=function(t,e,n,r){return this.parseArrowExpression(this.startNodeAt(t,e),n,!0,r)};Je.parseSubscript=function(t,e,n,r,i,s,o){var u=this.options.ecmaVersion>=11,c=u&&this.eat(O.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(O.bracketL);if(h||c&&this.type!==O.parenL&&this.type!==O.backQuote||this.eat(O.dot)){var m=this.startNodeAt(e,n);m.object=t,h?(m.property=this.parseExpression(),this.expect(O.bracketR)):this.type===O.privateId&&t.type!=="Super"?m.property=this.parsePrivateIdent():m.property=this.parseIdent(this.options.allowReserved!=="never"),m.computed=!!h,u&&(m.optional=c),t=this.finishNode(m,"MemberExpression")}else if(!r&&this.eat(O.parenL)){var g=new Kg,y=this.yieldPos,b=this.awaitPos,v=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var N=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1,g);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(g,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=y,this.awaitPos=b,this.awaitIdentPos=v,this.parseSubscriptAsyncArrow(e,n,N,o);this.checkExpressionErrors(g,!0),this.yieldPos=y||this.yieldPos,this.awaitPos=b||this.awaitPos,this.awaitIdentPos=v||this.awaitIdentPos;var T=this.startNodeAt(e,n);T.callee=t,T.arguments=N,u&&(T.optional=c),t=this.finishNode(T,"CallExpression")}else if(this.type===O.backQuote){(c||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var M=this.startNodeAt(e,n);M.tag=t,M.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(M,"TaggedTemplateExpression")}return t};Je.parseExprAtom=function(t,e,n){this.type===O.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case O._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===O.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==O.dot&&this.type!==O.bracketL&&this.type!==O.parenL&&this.unexpected(),this.finishNode(r,"Super");case O._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case O.name:var s=this.start,o=this.startLoc,u=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!u&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(O._function))return this.overrideContext(It.f_expr),this.parseFunction(this.startNodeAt(s,o),0,!1,!0,e);if(i&&!this.canInsertSemicolon()){if(this.eat(O.arrow))return this.parseArrowExpression(this.startNodeAt(s,o),[c],!1,e);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===O.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(O.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,o),[c],!0,e)}return c;case O.regexp:var h=this.value;return r=this.parseLiteral(h.value),r.regex={pattern:h.pattern,flags:h.flags},r;case O.num:case O.string:return this.parseLiteral(this.value);case O._null:case O._true:case O._false:return r=this.startNode(),r.value=this.type===O._null?null:this.type===O._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case O.parenL:var m=this.start,g=this.parseParenAndDistinguishExpression(i,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(g)&&(t.parenthesizedAssign=m),t.parenthesizedBind<0&&(t.parenthesizedBind=m)),g;case O.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(O.bracketR,!0,!0,t),this.finishNode(r,"ArrayExpression");case O.braceL:return this.overrideContext(It.b_expr),this.parseObj(!1,t);case O._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case O._class:return this.parseClass(this.startNode(),!1);case O._new:return this.parseNew();case O.backQuote:return this.parseTemplate();case O._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}};Je.parseExprAtomDefault=function(){this.unexpected()};Je.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===O.parenL&&!t)return this.parseDynamicImport(e);if(this.type===O.dot){var n=this.startNodeAt(e.start,e.loc&&e.loc.start);return n.name="import",e.meta=this.finishNode(n,"Identifier"),this.parseImportMeta(e)}else this.unexpected()};Je.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(O.parenR)?t.options=null:(this.expect(O.comma),this.afterTrailingComma(O.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(O.parenR)||(this.expect(O.comma),this.afterTrailingComma(O.parenR)||this.unexpected())));else if(!this.eat(O.parenR)){var e=this.start;this.eat(O.comma)&&this.eat(O.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};Je.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};Je.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.value!=null?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};Je.parseParenExpression=function(){this.expect(O.parenL);var t=this.parseExpression();return this.expect(O.parenR),t};Je.shouldParseArrow=function(t){return!this.canInsertSemicolon()};Je.parseParenAndDistinguishExpression=function(t,e){var n=this.start,r=this.startLoc,i,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,u=this.startLoc,c=[],h=!0,m=!1,g=new Kg,y=this.yieldPos,b=this.awaitPos,v;for(this.yieldPos=0,this.awaitPos=0;this.type!==O.parenR;)if(h?h=!1:this.expect(O.comma),s&&this.afterTrailingComma(O.parenR,!0)){m=!0;break}else if(this.type===O.ellipsis){v=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,g,this.parseParenItem));var N=this.lastTokEnd,T=this.lastTokEndLoc;if(this.expect(O.parenR),t&&this.shouldParseArrow(c)&&this.eat(O.arrow))return this.checkPatternErrors(g,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=y,this.awaitPos=b,this.parseParenArrowList(n,r,c,e);(!c.length||m)&&this.unexpected(this.lastTokStart),v&&this.unexpected(v),this.checkExpressionErrors(g,!0),this.yieldPos=y||this.yieldPos,this.awaitPos=b||this.awaitPos,c.length>1?(i=this.startNodeAt(o,u),i.expressions=c,this.finishNodeAt(i,"SequenceExpression",N,T)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var M=this.startNodeAt(n,r);return M.expression=i,this.finishNode(M,"ParenthesizedExpression")}else return i};Je.parseParenItem=function(t){return t};Je.parseParenArrowList=function(t,e,n,r){return this.parseArrowExpression(this.startNodeAt(t,e),n,!1,r)};var Oq=[];Je.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===O.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var n=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),n&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var r=this.start,i=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),this.eat(O.parenL)?t.arguments=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1):t.arguments=Oq,this.finishNode(t,"NewExpression")};Je.parseTemplateElement=function(t){var e=t.isTagged,n=this.startNode();return this.type===O.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value.replace(/\r\n?/g,`
72
+ `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
73
+ `),cooked:this.value},this.next(),n.tail=this.type===O.backQuote,this.finishNode(n,"TemplateElement")};Je.parseTemplate=function(t){t===void 0&&(t={});var e=t.isTagged;e===void 0&&(e=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:e});for(n.quasis=[r];!r.tail;)this.type===O.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(O.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(O.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(n,"TemplateLiteral")};Je.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===O.name||this.type===O.num||this.type===O.string||this.type===O.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===O.star)&&!cr.test(this.input.slice(this.lastTokEnd,this.start))};Je.parseObj=function(t,e){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(O.braceR);){if(r)r=!1;else if(this.expect(O.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(O.braceR))break;var s=this.parseProperty(t,e);t||this.checkPropClash(s,i,e),n.properties.push(s)}return this.finishNode(n,t?"ObjectPattern":"ObjectExpression")};Je.parseProperty=function(t,e){var n=this.startNode(),r,i,s,o;if(this.options.ecmaVersion>=9&&this.eat(O.ellipsis))return t?(n.argument=this.parseIdent(!1),this.type===O.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(n,"RestElement")):(n.argument=this.parseMaybeAssign(!1,e),this.type===O.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(n,"SpreadElement"));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(t||e)&&(s=this.start,o=this.startLoc),t||(r=this.eat(O.star)));var u=this.containsEsc;return this.parsePropertyName(n),!t&&!u&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(O.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,t,r,i,s,o,e,u),this.finishNode(n,"Property")};Je.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var n=t.kind==="get"?0:1;if(t.value.params.length!==n){var r=t.value.start;t.kind==="get"?this.raiseRecoverable(r,"getter should have no params"):this.raiseRecoverable(r,"setter should have exactly one param")}else t.kind==="set"&&t.value.params[0].type==="RestElement"&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")};Je.parsePropertyValue=function(t,e,n,r,i,s,o,u){(n||r)&&this.type===O.colon&&this.unexpected(),this.eat(O.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),t.kind="init"):this.options.ecmaVersion>=6&&this.type===O.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(n,r),t.kind="init"):!e&&!u&&this.options.ecmaVersion>=5&&!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.type!==O.comma&&this.type!==O.braceR&&this.type!==O.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(t)):this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((n||r)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=i),e?t.value=this.parseMaybeDefault(i,s,this.copyNode(t.key)):this.type===O.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),t.value=this.parseMaybeDefault(i,s,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected()};Je.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(O.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(O.bracketR),t.key;t.computed=!1}return t.key=this.type===O.num||this.type===O.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};Je.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};Je.parseMethod=function(t,e,n){var r=this.startNode(),i=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=t),this.options.ecmaVersion>=8&&(r.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(av(e,r.generator)|Hg|(n?zI:0)),this.expect(O.parenL),r.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(r,"FunctionExpression")};Je.parseArrowExpression=function(t,e,n,r){var i=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(av(n,!1)|sv),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,r),this.yieldPos=i,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(t,"ArrowFunctionExpression")};Je.parseFunctionBody=function(t,e,n,r){var i=e&&this.type!==O.braceL,s=this.strict,o=!1;if(i)t.body=this.parseMaybeAssign(r),t.expression=!0,this.checkParams(t,!1);else{var u=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!s||u)&&(o=this.strictDirective(this.end),o&&u&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(t,!s&&!o&&!e&&!n&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,VI),t.body=this.parseBlock(!1,void 0,o&&!s),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()};Je.isSimpleParamList=function(t){for(var e=0,n=t;e<n.length;e+=1){var r=n[e];if(r.type!=="Identifier")return!1}return!0};Je.checkParams=function(t,e){for(var n=Object.create(null),r=0,i=t.params;r<i.length;r+=1){var s=i[r];this.checkLValInnerPattern(s,ov,e?null:n)}};Je.parseExprList=function(t,e,n,r){for(var i=[],s=!0;!this.eat(t);){if(s)s=!1;else if(this.expect(O.comma),e&&this.afterTrailingComma(t))break;var o=void 0;n&&this.type===O.comma?o=null:this.type===O.ellipsis?(o=this.parseSpread(r),r&&this.type===O.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i};Je.checkUnreserved=function(t){var e=t.start,n=t.end,r=t.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&qg)&&r==="arguments"&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(r==="arguments"||r==="await")&&this.raise(e,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(e,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,n).indexOf("\\")!==-1)){var i=this.strict?this.reservedWordsStrict:this.reservedWords;i.test(r)&&(!this.inAsync&&r==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+r+"' is reserved"))}};Je.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),e.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e};Je.parseIdentNode=function(){var t=this.startNode();return this.type===O.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,(t.name==="class"||t.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=O.name):this.unexpected(),t};Je.parsePrivateIdent=function(){var t=this.startNode();return this.type===O.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t};Je.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===O.semi||this.canInsertSemicolon()||this.type!==O.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(O.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};Je.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var tg=Zt.prototype;tg.raise=function(t,e){var n=DI(this.input,t);e+=" ("+n.line+":"+n.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var r=new SyntaxError(e);throw r.pos=t,r.loc=n,r.raisedAt=this.pos,r};tg.raiseRecoverable=tg.raise;tg.curPosition=function(){if(this.options.locations)return new Ih(this.curLine,this.pos-this.lineStart)};var to=Zt.prototype,Rq=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};to.enterScope=function(t){this.scopeStack.push(new Rq(t))};to.exitScope=function(){this.scopeStack.pop()};to.treatFunctionsAsVarInScope=function(t){return t.flags&Wu||!this.inModule&&t.flags&_h};to.declareName=function(t,e,n){var r=!1;if(e===Hs){var i=this.currentScope();r=i.lexical.indexOf(t)>-1||i.functions.indexOf(t)>-1||i.var.indexOf(t)>-1,i.lexical.push(t),this.inModule&&i.flags&_h&&delete this.undefinedExports[t]}else if(e===BI){var s=this.currentScope();s.lexical.push(t)}else if(e===LI){var o=this.currentScope();this.treatFunctionsAsVar?r=o.lexical.indexOf(t)>-1:r=o.lexical.indexOf(t)>-1||o.var.indexOf(t)>-1,o.functions.push(t)}else for(var u=this.scopeStack.length-1;u>=0;--u){var c=this.scopeStack[u];if(c.lexical.indexOf(t)>-1&&!(c.flags&_I&&c.lexical[0]===t)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(t)>-1){r=!0;break}if(c.var.push(t),this.inModule&&c.flags&_h&&delete this.undefinedExports[t],c.flags&qg)break}r&&this.raiseRecoverable(n,"Identifier '"+t+"' has already been declared")};to.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};to.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};to.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(qg|hp|Sl))return e}};to.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(qg|hp|Sl)&&!(e.flags&sv))return e}};var Gg=function(e,n,r){this.type="",this.start=n,this.end=0,e.options.locations&&(this.loc=new Jg(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[n,0])},pp=Zt.prototype;pp.startNode=function(){return new Gg(this,this.start,this.startLoc)};pp.startNodeAt=function(t,e){return new Gg(this,t,e)};function jI(t,e,n,r){return t.type=e,t.end=n,this.options.locations&&(t.loc.end=r),this.options.ranges&&(t.range[1]=n),t}pp.finishNode=function(t,e){return jI.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};pp.finishNodeAt=function(t,e,n,r){return jI.call(this,t,e,n,r)};pp.copyNode=function(t){var e=new Gg(this,t.start,this.startLoc);for(var n in t)e[n]=t[n];return e};var Dq="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",$I="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",UI=$I+" Extended_Pictographic",JI=UI,HI=JI+" EBase EComp EMod EPres ExtPict",qI=HI,Iq=qI,_q={9:$I,10:UI,11:JI,12:HI,13:qI,14:Iq},zq="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Lq={9:"",10:"",11:"",12:"",13:"",14:zq},HA="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",KI="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",GI=KI+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",YI=GI+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",WI=YI+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",XI=WI+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Bq=XI+" "+Dq,Vq={9:KI,10:GI,11:YI,12:WI,13:XI,14:Bq},QI={};function Fq(t){var e=QI[t]={binary:Ba(_q[t]+" "+HA),binaryOfStrings:Ba(Lq[t]),nonBinary:{General_Category:Ba(HA),Script:Ba(Vq[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var px=0,qA=[9,10,11,12,13,14];px<qA.length;px+=1){var Pq=qA[px];Fq(Pq)}var Ee=Zt.prototype,ng=function(e,n){this.parent=e,this.base=n||this};ng.prototype.separatedFrom=function(e){for(var n=this;n;n=n.parent)for(var r=e;r;r=r.parent)if(n.base===r.base&&n!==r)return!0;return!1};ng.prototype.sibling=function(){return new ng(this.parent,this.base)};var Xi=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=QI[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Xi.prototype.reset=function(e,n,r){var i=r.indexOf("v")!==-1,s=r.indexOf("u")!==-1;this.start=e|0,this.source=n+"",this.flags=r,i&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=s&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=s&&this.parser.options.ecmaVersion>=9)};Xi.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};Xi.prototype.at=function(e,n){n===void 0&&(n=!1);var r=this.source,i=r.length;if(e>=i)return-1;var s=r.charCodeAt(e);if(!(n||this.switchU)||s<=55295||s>=57344||e+1>=i)return s;var o=r.charCodeAt(e+1);return o>=56320&&o<=57343?(s<<10)+o-56613888:s};Xi.prototype.nextIndex=function(e,n){n===void 0&&(n=!1);var r=this.source,i=r.length;if(e>=i)return i;var s=r.charCodeAt(e),o;return!(n||this.switchU)||s<=55295||s>=57344||e+1>=i||(o=r.charCodeAt(e+1))<56320||o>57343?e+1:e+2};Xi.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)};Xi.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)};Xi.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)};Xi.prototype.eat=function(e,n){return n===void 0&&(n=!1),this.current(n)===e?(this.advance(n),!0):!1};Xi.prototype.eatChars=function(e,n){n===void 0&&(n=!1);for(var r=this.pos,i=0,s=e;i<s.length;i+=1){var o=s[i],u=this.at(r,n);if(u===-1||u!==o)return!1;r=this.nextIndex(r,n)}return this.pos=r,!0};Ee.validateRegExpFlags=function(t){for(var e=t.validFlags,n=t.flags,r=!1,i=!1,s=0;s<n.length;s++){var o=n.charAt(s);e.indexOf(o)===-1&&this.raise(t.start,"Invalid regular expression flag"),n.indexOf(o,s+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),o==="u"&&(r=!0),o==="v"&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(t.start,"Invalid regular expression flag")};function jq(t){for(var e in t)return!0;return!1}Ee.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&jq(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))};Ee.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,n=t.backReferenceNames;e<n.length;e+=1){var r=n[e];t.groupNames[r]||t.raise("Invalid named capture referenced")}};Ee.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new ng(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")};Ee.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};Ee.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))?(this.regexp_eatQuantifier(t),!0):!1};Ee.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!n,!0}return t.pos=e,!1};Ee.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=!1),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),!0):!1};Ee.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};Ee.regexp_eatBracedQuantifier=function(t,e){var n=t.pos;if(t.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(t)&&(r=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue),t.eat(125)))return i!==-1&&i<r&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=n}return!1};Ee.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)};Ee.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1};Ee.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(t),r=t.eat(45);if(n||r){for(var i=0;i<n.length;i++){var s=n.charAt(i);n.indexOf(s,i+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(r){var o=this.regexp_eatModifiers(t);!n&&!o&&t.current()===58&&t.raise("Invalid regular expression modifiers");for(var u=0;u<o.length;u++){var c=o.charAt(u);(o.indexOf(c,u+1)>-1||n.indexOf(c)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1};Ee.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):t.current()===63&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1};Ee.regexp_eatModifiers=function(t){for(var e="",n=0;(n=t.current())!==-1&&$q(n);)e+=zs(n),t.advance();return e};function $q(t){return t===105||t===109||t===115}Ee.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)};Ee.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1};Ee.regexp_eatSyntaxCharacter=function(t){var e=t.current();return ZI(e)?(t.lastIntValue=e,t.advance(),!0):!1};function ZI(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}Ee.regexp_eatPatternCharacters=function(t){for(var e=t.pos,n=0;(n=t.current())!==-1&&!ZI(n);)t.advance();return t.pos!==e};Ee.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return e!==-1&&e!==36&&!(e>=40&&e<=43)&&e!==46&&e!==63&&e!==91&&e!==94&&e!==124?(t.advance(),!0):!1};Ee.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,n=t.groupNames[t.lastStringValue];if(n)if(e)for(var r=0,i=n;r<i.length;r+=1){var s=i[r];s.separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(n||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}};Ee.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1};Ee.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=zs(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=zs(t.lastIntValue);return!0}return!1};Ee.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,r=t.current(n);return t.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(r=t.lastIntValue),Uq(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function Uq(t){return Hi(t,!0)||t===36||t===95}Ee.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,r=t.current(n);return t.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(r=t.lastIntValue),Jq(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function Jq(t){return Ka(t,!0)||t===36||t===95||t===8204||t===8205}Ee.regexp_eatAtomEscape=function(t){return this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t)?!0:(t.switchU&&(t.current()===99&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)};Ee.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var n=t.lastIntValue;if(t.switchU)return n>t.maxBackReference&&(t.maxBackReference=n),!0;if(n<=t.numCapturingParens)return!0;t.pos=e}return!1};Ee.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1};Ee.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)};Ee.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1};Ee.regexp_eatZero=function(t){return t.current()===48&&!Yg(t.lookahead())?(t.lastIntValue=0,t.advance(),!0):!1};Ee.regexp_eatControlEscape=function(t){var e=t.current();return e===116?(t.lastIntValue=9,t.advance(),!0):e===110?(t.lastIntValue=10,t.advance(),!0):e===118?(t.lastIntValue=11,t.advance(),!0):e===102?(t.lastIntValue=12,t.advance(),!0):e===114?(t.lastIntValue=13,t.advance(),!0):!1};Ee.regexp_eatControlLetter=function(t){var e=t.current();return e_(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function e_(t){return t>=65&&t<=90||t>=97&&t<=122}Ee.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){e===void 0&&(e=!1);var n=t.pos,r=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var i=t.lastIntValue;if(r&&i>=55296&&i<=56319){var s=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var o=t.lastIntValue;if(o>=56320&&o<=57343)return t.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}t.pos=s,t.lastIntValue=i}return!0}if(r&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&Hq(t.lastIntValue))return!0;r&&t.raise("Invalid unicode escape"),t.pos=n}return!1};function Hq(t){return t>=0&&t<=1114111}Ee.regexp_eatIdentityEscape=function(t){if(t.switchU)return this.regexp_eatSyntaxCharacter(t)?!0:t.eat(47)?(t.lastIntValue=47,!0):!1;var e=t.current();return e!==99&&(!t.switchN||e!==107)?(t.lastIntValue=e,t.advance(),!0):!1};Ee.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return!0}return!1};var t_=0,Ls=1,Zr=2;Ee.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(qq(e))return t.lastIntValue=-1,t.advance(),Ls;var n=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((n=e===80)||e===112)){t.lastIntValue=-1,t.advance();var r;if(t.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return n&&r===Zr&&t.raise("Invalid property name"),r;t.raise("Invalid property name")}return t_};function qq(t){return t===100||t===68||t===115||t===83||t===119||t===87}Ee.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var n=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var r=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,n,r),Ls}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,i)}return t_};Ee.regexp_validateUnicodePropertyNameAndValue=function(t,e,n){Yu(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(n)||t.raise("Invalid property value")};Ee.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return Ls;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return Zr;t.raise("Invalid property name")};Ee.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";n_(e=t.current());)t.lastStringValue+=zs(e),t.advance();return t.lastStringValue!==""};function n_(t){return e_(t)||t===95}Ee.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";Kq(e=t.current());)t.lastStringValue+=zs(e),t.advance();return t.lastStringValue!==""};function Kq(t){return n_(t)||Yg(t)}Ee.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};Ee.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),n=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&n===Zr&&t.raise("Negated character class may contain strings"),!0}return!1};Ee.regexp_classContents=function(t){return t.current()===93?Ls:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),Ls)};Ee.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var n=t.lastIntValue;t.switchU&&(e===-1||n===-1)&&t.raise("Invalid character class"),e!==-1&&n!==-1&&e>n&&t.raise("Range out of order in character class")}}};Ee.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var n=t.current();(n===99||s_(n))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var r=t.current();return r!==93?(t.lastIntValue=r,t.advance(),!0):!1};Ee.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)};Ee.regexp_classSetExpression=function(t){var e=Ls,n;if(!this.regexp_eatClassSetRange(t))if(n=this.regexp_eatClassSetOperand(t)){n===Zr&&(e=Zr);for(var r=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(n=this.regexp_eatClassSetOperand(t))){n!==Zr&&(e=Ls);continue}t.raise("Invalid character in character class")}if(r!==t.pos)return e;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(r!==t.pos)return e}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(n=this.regexp_eatClassSetOperand(t),!n)return e;n===Zr&&(e=Zr)}};Ee.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var n=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var r=t.lastIntValue;return n!==-1&&r!==-1&&n>r&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1};Ee.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?Ls:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};Ee.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var n=t.eat(94),r=this.regexp_classContents(t);if(t.eat(93))return n&&r===Zr&&t.raise("Negated character class may contain strings"),r;t.pos=e}if(t.eat(92)){var i=this.regexp_eatCharacterClassEscape(t);if(i)return i;t.pos=e}return null};Ee.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var n=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return n}else t.raise("Invalid escape");t.pos=e}return null};Ee.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===Zr&&(e=Zr);return e};Ee.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?Ls:Zr};Ee.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return this.regexp_eatCharacterEscape(t)||this.regexp_eatClassSetReservedPunctuator(t)?!0:t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1);var n=t.current();return n<0||n===t.lookahead()&&Gq(n)||Yq(n)?!1:(t.advance(),t.lastIntValue=n,!0)};function Gq(t){return t===33||t>=35&&t<=38||t>=42&&t<=44||t===46||t>=58&&t<=64||t===94||t===96||t===126}function Yq(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}Ee.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return Wq(e)?(t.lastIntValue=e,t.advance(),!0):!1};function Wq(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}Ee.regexp_eatClassControlLetter=function(t){var e=t.current();return Yg(e)||e===95?(t.lastIntValue=e%32,t.advance(),!0):!1};Ee.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1};Ee.regexp_eatDecimalDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;Yg(n=t.current());)t.lastIntValue=10*t.lastIntValue+(n-48),t.advance();return t.pos!==e};function Yg(t){return t>=48&&t<=57}Ee.regexp_eatHexDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;r_(n=t.current());)t.lastIntValue=16*t.lastIntValue+i_(n),t.advance();return t.pos!==e};function r_(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function i_(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}Ee.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var n=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=e*64+n*8+t.lastIntValue:t.lastIntValue=e*8+n}else t.lastIntValue=e;return!0}return!1};Ee.regexp_eatOctalDigit=function(t){var e=t.current();return s_(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function s_(t){return t>=48&&t<=55}Ee.regexp_eatFixedHexDigits=function(t,e){var n=t.pos;t.lastIntValue=0;for(var r=0;r<e;++r){var i=t.current();if(!r_(i))return t.pos=n,!1;t.lastIntValue=16*t.lastIntValue+i_(i),t.advance()}return!0};var uv=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Jg(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},at=Zt.prototype;at.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new uv(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};at.getToken=function(){return this.next(),new uv(this)};typeof Symbol<"u"&&(at[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===O.eof,value:e}}}});at.nextToken=function(){var t=this.curContext();if((!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(O.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};at.readToken=function(t){return Hi(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};at.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=56320)return t;var e=this.input.charCodeAt(this.pos+1);return e<=56319||e>=57344?t:(t<<10)+e-56613888};at.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(n===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations)for(var r=void 0,i=e;(r=MI(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,n),e,this.pos,t,this.curPosition())};at.skipLineComment=function(t){for(var e=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!Gu(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,n,this.curPosition())};at.skipSpace=function(){e:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(t>8&&t<14||t>=5760&&OI.test(String.fromCharCode(t)))++this.pos;else break e}}};at.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=t,this.value=e,this.updateContext(n)};at.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&t===46&&e===46?(this.pos+=3,this.finishToken(O.ellipsis)):(++this.pos,this.finishToken(O.dot))};at.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(O.assign,2):this.finishOp(O.slash,1)};at.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),n=1,r=t===42?O.star:O.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++n,r=O.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(O.assign,n+1):this.finishOp(r,n)};at.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(O.assign,3)}return this.finishOp(t===124?O.logicalOR:O.logicalAND,2)}return e===61?this.finishOp(O.assign,2):this.finishOp(t===124?O.bitwiseOR:O.bitwiseAND,1)};at.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(O.assign,2):this.finishOp(O.bitwiseXOR,1)};at.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?e===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||cr.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(O.incDec,2):e===61?this.finishOp(O.assign,2):this.finishOp(O.plusMin,1)};at.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),n=1;return e===t?(n=t===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(O.assign,n+1):this.finishOp(O.bitShift,n)):e===33&&t===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(e===61&&(n=2),this.finishOp(O.relational,n))};at.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(O.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(O.arrow)):this.finishOp(t===61?O.eq:O.prefix,1)};at.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(e===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(O.questionDot,2)}if(e===63){if(t>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(O.assign,3)}return this.finishOp(O.coalesce,2)}}return this.finishOp(O.question,1)};at.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),Hi(e,!0)||e===92))return this.finishToken(O.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+zs(e)+"'")};at.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(O.parenL);case 41:return++this.pos,this.finishToken(O.parenR);case 59:return++this.pos,this.finishToken(O.semi);case 44:return++this.pos,this.finishToken(O.comma);case 91:return++this.pos,this.finishToken(O.bracketL);case 93:return++this.pos,this.finishToken(O.bracketR);case 123:return++this.pos,this.finishToken(O.braceL);case 125:return++this.pos,this.finishToken(O.braceR);case 58:return++this.pos,this.finishToken(O.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(O.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(e===120||e===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(e===111||e===79)return this.readRadixNumber(8);if(e===98||e===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(O.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+zs(t)+"'")};at.finishOp=function(t,e){var n=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,n)};at.readRegexp=function(){for(var t,e,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(cr.test(r)&&this.raise(n,"Unterminated regular expression"),t)t=!1;else{if(r==="[")e=!0;else if(r==="]"&&e)e=!1;else if(r==="/"&&!e)break;t=r==="\\"}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var s=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(s);var u=this.regexpState||(this.regexpState=new Xi(this));u.reset(n,i,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(O.regexp,{pattern:i,flags:o,value:c})};at.readInt=function(t,e,n){for(var r=this.options.ecmaVersion>=12&&e===void 0,i=n&&this.input.charCodeAt(this.pos)===48,s=this.pos,o=0,u=0,c=0,h=e??1/0;c<h;++c,++this.pos){var m=this.input.charCodeAt(this.pos),g=void 0;if(r&&m===95){i&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),u===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),c===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),u=m;continue}if(m>=97?g=m-97+10:m>=65?g=m-65+10:m>=48&&m<=57?g=m-48:g=1/0,g>=t)break;u=m,o=o*t+g}return r&&u===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===s||e!=null&&this.pos-s!==e?null:o};function Xq(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function a_(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}at.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var n=this.readInt(t);return n==null&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=a_(this.input.slice(e,this.pos)),++this.pos):Hi(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(O.num,n)};at.readNumber=function(t){var e=this.pos;!t&&this.readInt(10,void 0,!0)===null&&this.raise(e,"Invalid number");var n=this.pos-e>=2&&this.input.charCodeAt(e)===48;n&&this.strict&&this.raise(e,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!n&&!t&&this.options.ecmaVersion>=11&&r===110){var i=a_(this.input.slice(e,this.pos));return++this.pos,Hi(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(O.num,i)}n&&/[89]/.test(this.input.slice(e,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(e,"Invalid number")),Hi(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=Xq(this.input.slice(e,this.pos),n);return this.finishToken(O.num,s)};at.readCodePoint=function(){var t=this.input.charCodeAt(this.pos),e;if(t===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(n,"Code point out of bounds")}else e=this.readHexChar(4);return e};at.readString=function(t){for(var e="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===t)break;r===92?(e+=this.input.slice(n,this.pos),e+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Gu(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(n,this.pos++),this.finishToken(O.string,e)};var o_={};at.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===o_)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};at.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw o_;this.raise(t,e)};at.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===O.template||this.type===O.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(O.dollarBraceL)):(++this.pos,this.finishToken(O.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(O.template,t));if(n===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(Gu(n)){switch(t+=this.input.slice(e,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:t+=`
74
+ `;break;default:t+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}};at.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(O.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
75
+ `&&++this.pos;case`
76
+ `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};at.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
77
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return zs(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,e=this.input.charCodeAt(this.pos),(r!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-r.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(i)}return Gu(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}};at.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n};at.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(Ka(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,t+=this.input.slice(n,this.pos);var s=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var o=this.readCodePoint();(e?Hi:Ka)(o,r)||this.invalidStringToken(s,"Invalid Unicode escape"),t+=zs(o),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)};at.readWord=function(){var t=this.readWord1(),e=O.name;return this.keywords.test(t)&&(e=rv[t]),this.finishToken(e,t)};var Qq="8.15.0";Zt.acorn={Parser:Zt,version:Qq,defaultOptions:Kb,Position:Ih,SourceLocation:Jg,getLineInfo:DI,Node:Gg,TokenType:ft,tokTypes:O,keywordTypes:rv,TokContext:ki,tokContexts:It,isIdentifierChar:Ka,isIdentifierStart:Hi,Token:uv,isNewLine:Gu,lineBreak:cr,lineBreakG:Sq,nonASCIIwhitespace:OI};var dx={exports:{}},mx,KA;function Zq(){return KA||(KA=1,mx={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),mx}var Vf={exports:{}},eK=Vf.exports,GA;function YA(){return GA||(GA=1,(function(t,e){(function(n,r){r(e)})(eK,(function(n){var r=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],i=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],s="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",o="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",u={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},c="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",h={5:c,"5module":c+" export import",6:c+" const class extends export import super"},m=/^in(stanceof)?$/,g=new RegExp("["+o+"]"),y=new RegExp("["+o+s+"]");function b(p,S){for(var w=65536,A=0;A<S.length;A+=2){if(w+=S[A],w>p)return!1;if(w+=S[A+1],w>=p)return!0}return!1}function v(p,S){return p<65?p===36:p<91?!0:p<97?p===95:p<123?!0:p<=65535?p>=170&&g.test(String.fromCharCode(p)):S===!1?!1:b(p,i)}function N(p,S){return p<48?p===36:p<58?!0:p<65?!1:p<91?!0:p<97?p===95:p<123?!0:p<=65535?p>=170&&y.test(String.fromCharCode(p)):S===!1?!1:b(p,i)||b(p,r)}var T=function(S,w){w===void 0&&(w={}),this.label=S,this.keyword=w.keyword,this.beforeExpr=!!w.beforeExpr,this.startsExpr=!!w.startsExpr,this.isLoop=!!w.isLoop,this.isAssign=!!w.isAssign,this.prefix=!!w.prefix,this.postfix=!!w.postfix,this.binop=w.binop||null,this.updateContext=null};function M(p,S){return new T(p,{beforeExpr:!0,binop:S})}var j={beforeExpr:!0},P={startsExpr:!0},J={};function L(p,S){return S===void 0&&(S={}),S.keyword=p,J[p]=new T(p,S)}var C={num:new T("num",P),regexp:new T("regexp",P),string:new T("string",P),name:new T("name",P),privateId:new T("privateId",P),eof:new T("eof"),bracketL:new T("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new T("]"),braceL:new T("{",{beforeExpr:!0,startsExpr:!0}),braceR:new T("}"),parenL:new T("(",{beforeExpr:!0,startsExpr:!0}),parenR:new T(")"),comma:new T(",",j),semi:new T(";",j),colon:new T(":",j),dot:new T("."),question:new T("?",j),questionDot:new T("?."),arrow:new T("=>",j),template:new T("template"),invalidTemplate:new T("invalidTemplate"),ellipsis:new T("...",j),backQuote:new T("`",P),dollarBraceL:new T("${",{beforeExpr:!0,startsExpr:!0}),eq:new T("=",{beforeExpr:!0,isAssign:!0}),assign:new T("_=",{beforeExpr:!0,isAssign:!0}),incDec:new T("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new T("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:M("||",1),logicalAND:M("&&",2),bitwiseOR:M("|",3),bitwiseXOR:M("^",4),bitwiseAND:M("&",5),equality:M("==/!=/===/!==",6),relational:M("</>/<=/>=",7),bitShift:M("<</>>/>>>",8),plusMin:new T("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:M("%",10),star:M("*",10),slash:M("/",10),starstar:new T("**",{beforeExpr:!0}),coalesce:M("??",1),_break:L("break"),_case:L("case",j),_catch:L("catch"),_continue:L("continue"),_debugger:L("debugger"),_default:L("default",j),_do:L("do",{isLoop:!0,beforeExpr:!0}),_else:L("else",j),_finally:L("finally"),_for:L("for",{isLoop:!0}),_function:L("function",P),_if:L("if"),_return:L("return",j),_switch:L("switch"),_throw:L("throw",j),_try:L("try"),_var:L("var"),_const:L("const"),_while:L("while",{isLoop:!0}),_with:L("with"),_new:L("new",{beforeExpr:!0,startsExpr:!0}),_this:L("this",P),_super:L("super",P),_class:L("class",P),_extends:L("extends",j),_export:L("export"),_import:L("import",P),_null:L("null",P),_true:L("true",P),_false:L("false",P),_in:L("in",{beforeExpr:!0,binop:7}),_instanceof:L("instanceof",{beforeExpr:!0,binop:7}),_typeof:L("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:L("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:L("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},z=/\r\n?|\n|\u2028|\u2029/,q=new RegExp(z.source,"g");function ie(p){return p===10||p===13||p===8232||p===8233}function K(p,S,w){w===void 0&&(w=p.length);for(var A=S;A<w;A++){var B=p.charCodeAt(A);if(ie(B))return A<w-1&&B===13&&p.charCodeAt(A+1)===10?A+2:A+1}return-1}var pe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,fe=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Se=Object.prototype,_e=Se.hasOwnProperty,Re=Se.toString,X=Object.hasOwn||(function(p,S){return _e.call(p,S)}),oe=Array.isArray||(function(p){return Re.call(p)==="[object Array]"}),ke=Object.create(null);function ze(p){return ke[p]||(ke[p]=new RegExp("^(?:"+p.replace(/ /g,"|")+")$"))}function D(p){return p<=65535?String.fromCharCode(p):(p-=65536,String.fromCharCode((p>>10)+55296,(p&1023)+56320))}var F=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Q=function(S,w){this.line=S,this.column=w};Q.prototype.offset=function(S){return new Q(this.line,this.column+S)};var V=function(S,w,A){this.start=w,this.end=A,S.sourceFile!==null&&(this.source=S.sourceFile)};function xe(p,S){for(var w=1,A=0;;){var B=K(p,A,S);if(B<0)return new Q(w,S-A);++w,A=B}}var Oe={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Te=!1;function We(p){var S={};for(var w in Oe)S[w]=p&&X(p,w)?p[w]:Oe[w];if(S.ecmaVersion==="latest"?S.ecmaVersion=1e8:S.ecmaVersion==null?(!Te&&typeof console=="object"&&console.warn&&(Te=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
78
+ Defaulting to 2020, but this will stop working in the future.`)),S.ecmaVersion=11):S.ecmaVersion>=2015&&(S.ecmaVersion-=2009),S.allowReserved==null&&(S.allowReserved=S.ecmaVersion<5),(!p||p.allowHashBang==null)&&(S.allowHashBang=S.ecmaVersion>=14),oe(S.onToken)){var A=S.onToken;S.onToken=function(B){return A.push(B)}}if(oe(S.onComment)&&(S.onComment=Ct(S,S.onComment)),S.sourceType==="commonjs"&&S.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return S}function Ct(p,S){return function(w,A,B,W,ee,me){var ye={type:w?"Block":"Line",value:A,start:B,end:W};p.locations&&(ye.loc=new V(this,ee,me)),p.ranges&&(ye.range=[B,W]),S.push(ye)}}var Xe=1,zt=2,Lt=4,Ti=8,ui=16,Wn=32,dr=64,Or=128,Xn=256,mr=512,ci=1024,On=Xe|zt|Xn;function Rr(p,S){return zt|(p?Lt:0)|(S?Ti:0)}var Mi=0,Dr=1,$e=2,Qi=3,ae=4,de=5,_=function(S,w,A){this.options=S=We(S),this.sourceFile=S.sourceFile,this.keywords=ze(h[S.ecmaVersion>=6?6:S.sourceType==="module"?"5module":5]);var B="";S.allowReserved!==!0&&(B=u[S.ecmaVersion>=6?6:S.ecmaVersion===5?5:3],S.sourceType==="module"&&(B+=" await")),this.reservedWords=ze(B);var W=(B?B+" ":"")+u.strict;this.reservedWordsStrict=ze(W),this.reservedWordsStrictBind=ze(W+" "+u.strictBind),this.input=String(w),this.containsEsc=!1,A?(this.pos=A,this.lineStart=this.input.lastIndexOf(`
79
+ `,A-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(z).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=C.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=S.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&S.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?zt:Xe),this.regexpState=null,this.privateNameStack=[]},De={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};_.prototype.parse=function(){var S=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(S)},De.inFunction.get=function(){return(this.currentVarScope().flags&zt)>0},De.inGenerator.get=function(){return(this.currentVarScope().flags&Ti)>0},De.inAsync.get=function(){return(this.currentVarScope().flags&Lt)>0},De.canAwait.get=function(){for(var p=this.scopeStack.length-1;p>=0;p--){var S=this.scopeStack[p],w=S.flags;if(w&(Xn|mr))return!1;if(w&zt)return(w&Lt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},De.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Xe)},De.allowSuper.get=function(){var p=this.currentThisScope(),S=p.flags;return(S&dr)>0||this.options.allowSuperOutsideMethod},De.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Or)>0},De.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},De.allowNewDotTarget.get=function(){for(var p=this.scopeStack.length-1;p>=0;p--){var S=this.scopeStack[p],w=S.flags;if(w&(Xn|mr)||w&zt&&!(w&ui))return!0}return!1},De.allowUsing.get=function(){var p=this.currentScope(),S=p.flags;return!(S&ci||!this.inModule&&S&Xe)},De.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Xn)>0},_.extend=function(){for(var S=[],w=arguments.length;w--;)S[w]=arguments[w];for(var A=this,B=0;B<S.length;B++)A=S[B](A);return A},_.parse=function(S,w){return new this(w,S).parse()},_.parseExpressionAt=function(S,w,A){var B=new this(A,S,w);return B.nextToken(),B.parseExpression()},_.tokenizer=function(S,w){return new this(w,S)},Object.defineProperties(_.prototype,De);var Pe=_.prototype,tn=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Pe.strictDirective=function(p){if(this.options.ecmaVersion<5)return!1;for(;;){fe.lastIndex=p,p+=fe.exec(this.input)[0].length;var S=tn.exec(this.input.slice(p));if(!S)return!1;if((S[1]||S[2])==="use strict"){fe.lastIndex=p+S[0].length;var w=fe.exec(this.input),A=w.index+w[0].length,B=this.input.charAt(A);return B===";"||B==="}"||z.test(w[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(B)||B==="!"&&this.input.charAt(A+1)==="=")}p+=S[0].length,fe.lastIndex=p,p+=fe.exec(this.input)[0].length,this.input[p]===";"&&p++}},Pe.eat=function(p){return this.type===p?(this.next(),!0):!1},Pe.isContextual=function(p){return this.type===C.name&&this.value===p&&!this.containsEsc},Pe.eatContextual=function(p){return this.isContextual(p)?(this.next(),!0):!1},Pe.expectContextual=function(p){this.eatContextual(p)||this.unexpected()},Pe.canInsertSemicolon=function(){return this.type===C.eof||this.type===C.braceR||z.test(this.input.slice(this.lastTokEnd,this.start))},Pe.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Pe.semicolon=function(){!this.eat(C.semi)&&!this.insertSemicolon()&&this.unexpected()},Pe.afterTrailingComma=function(p,S){if(this.type===p)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),S||this.next(),!0},Pe.expect=function(p){this.eat(p)||this.unexpected()},Pe.unexpected=function(p){this.raise(p??this.start,"Unexpected token")};var Qn=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Pe.checkPatternErrors=function(p,S){if(p){p.trailingComma>-1&&this.raiseRecoverable(p.trailingComma,"Comma is not permitted after the rest element");var w=S?p.parenthesizedAssign:p.parenthesizedBind;w>-1&&this.raiseRecoverable(w,S?"Assigning to rvalue":"Parenthesized pattern")}},Pe.checkExpressionErrors=function(p,S){if(!p)return!1;var w=p.shorthandAssign,A=p.doubleProto;if(!S)return w>=0||A>=0;w>=0&&this.raise(w,"Shorthand property assignments are valid only in destructuring patterns"),A>=0&&this.raiseRecoverable(A,"Redefinition of __proto__ property")},Pe.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},Pe.isSimpleAssignTarget=function(p){return p.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(p.expression):p.type==="Identifier"||p.type==="MemberExpression"};var be=_.prototype;be.parseTopLevel=function(p){var S=Object.create(null);for(p.body||(p.body=[]);this.type!==C.eof;){var w=this.parseStatement(null,!0,S);p.body.push(w)}if(this.inModule)for(var A=0,B=Object.keys(this.undefinedExports);A<B.length;A+=1){var W=B[A];this.raiseRecoverable(this.undefinedExports[W].start,"Export '"+W+"' is not defined")}return this.adaptDirectivePrologue(p.body),this.next(),p.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(p,"Program")};var _t={kind:"loop"},gn={kind:"switch"};be.isLet=function(p){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;fe.lastIndex=this.pos;var S=fe.exec(this.input),w=this.pos+S[0].length,A=this.fullCharCodeAt(w);if(A===91||A===92)return!0;if(p)return!1;if(A===123)return!0;if(v(A)){var B=w;do w+=A<=65535?1:2;while(N(A=this.fullCharCodeAt(w)));if(A===92)return!0;var W=this.input.slice(B,w);if(!m.test(W))return!0}return!1},be.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;fe.lastIndex=this.pos;var p=fe.exec(this.input),S=this.pos+p[0].length,w;return!z.test(this.input.slice(this.pos,S))&&this.input.slice(S,S+8)==="function"&&(S+8===this.input.length||!(N(w=this.fullCharCodeAt(S+8))||w===92))},be.isUsingKeyword=function(p,S){if(this.options.ecmaVersion<17||!this.isContextual(p?"await":"using"))return!1;fe.lastIndex=this.pos;var w=fe.exec(this.input),A=this.pos+w[0].length;if(z.test(this.input.slice(this.pos,A)))return!1;if(p){var B=A+5,W;if(this.input.slice(A,B)!=="using"||B===this.input.length||N(W=this.fullCharCodeAt(B))||W===92)return!1;fe.lastIndex=B;var ee=fe.exec(this.input);if(A=B+ee[0].length,ee&&z.test(this.input.slice(B,A)))return!1}var me=this.fullCharCodeAt(A);if(!v(me)&&me!==92)return!1;var ye=A;do A+=me<=65535?1:2;while(N(me=this.fullCharCodeAt(A)));if(me===92)return!0;var Le=this.input.slice(ye,A);return!(m.test(Le)||S&&Le==="of")},be.isAwaitUsing=function(p){return this.isUsingKeyword(!0,p)},be.isUsing=function(p){return this.isUsingKeyword(!1,p)},be.parseStatement=function(p,S,w){var A=this.type,B=this.startNode(),W;switch(this.isLet(p)&&(A=C._var,W="let"),A){case C._break:case C._continue:return this.parseBreakContinueStatement(B,A.keyword);case C._debugger:return this.parseDebuggerStatement(B);case C._do:return this.parseDoStatement(B);case C._for:return this.parseForStatement(B);case C._function:return p&&(this.strict||p!=="if"&&p!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(B,!1,!p);case C._class:return p&&this.unexpected(),this.parseClass(B,!0);case C._if:return this.parseIfStatement(B);case C._return:return this.parseReturnStatement(B);case C._switch:return this.parseSwitchStatement(B);case C._throw:return this.parseThrowStatement(B);case C._try:return this.parseTryStatement(B);case C._const:case C._var:return W=W||this.value,p&&W!=="var"&&this.unexpected(),this.parseVarStatement(B,W);case C._while:return this.parseWhileStatement(B);case C._with:return this.parseWithStatement(B);case C.braceL:return this.parseBlock(!0,B);case C.semi:return this.parseEmptyStatement(B);case C._export:case C._import:if(this.options.ecmaVersion>10&&A===C._import){fe.lastIndex=this.pos;var ee=fe.exec(this.input),me=this.pos+ee[0].length,ye=this.input.charCodeAt(me);if(ye===40||ye===46)return this.parseExpressionStatement(B,this.parseExpression())}return this.options.allowImportExportEverywhere||(S||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),A===C._import?this.parseImport(B):this.parseExport(B,w);default:if(this.isAsyncFunction())return p&&this.unexpected(),this.next(),this.parseFunctionStatement(B,!0,!p);var Le=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Le)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),Le==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(B,!1,Le),this.semicolon(),this.finishNode(B,"VariableDeclaration");var qe=this.value,yt=this.parseExpression();return A===C.name&&yt.type==="Identifier"&&this.eat(C.colon)?this.parseLabeledStatement(B,qe,yt,p):this.parseExpressionStatement(B,yt)}},be.parseBreakContinueStatement=function(p,S){var w=S==="break";this.next(),this.eat(C.semi)||this.insertSemicolon()?p.label=null:this.type!==C.name?this.unexpected():(p.label=this.parseIdent(),this.semicolon());for(var A=0;A<this.labels.length;++A){var B=this.labels[A];if((p.label==null||B.name===p.label.name)&&(B.kind!=null&&(w||B.kind==="loop")||p.label&&w))break}return A===this.labels.length&&this.raise(p.start,"Unsyntactic "+S),this.finishNode(p,w?"BreakStatement":"ContinueStatement")},be.parseDebuggerStatement=function(p){return this.next(),this.semicolon(),this.finishNode(p,"DebuggerStatement")},be.parseDoStatement=function(p){return this.next(),this.labels.push(_t),p.body=this.parseStatement("do"),this.labels.pop(),this.expect(C._while),p.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(C.semi):this.semicolon(),this.finishNode(p,"DoWhileStatement")},be.parseForStatement=function(p){this.next();var S=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(_t),this.enterScope(0),this.expect(C.parenL),this.type===C.semi)return S>-1&&this.unexpected(S),this.parseFor(p,null);var w=this.isLet();if(this.type===C._var||this.type===C._const||w){var A=this.startNode(),B=w?"let":this.value;return this.next(),this.parseVar(A,!0,B),this.finishNode(A,"VariableDeclaration"),this.parseForAfterInit(p,A,S)}var W=this.isContextual("let"),ee=!1,me=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(me){var ye=this.startNode();return this.next(),me==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(ye,!0,me),this.finishNode(ye,"VariableDeclaration"),this.parseForAfterInit(p,ye,S)}var Le=this.containsEsc,qe=new Qn,yt=this.start,Ft=S>-1?this.parseExprSubscripts(qe,"await"):this.parseExpression(!0,qe);return this.type===C._in||(ee=this.options.ecmaVersion>=6&&this.isContextual("of"))?(S>-1?(this.type===C._in&&this.unexpected(S),p.await=!0):ee&&this.options.ecmaVersion>=8&&(Ft.start===yt&&!Le&&Ft.type==="Identifier"&&Ft.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(p.await=!1)),W&&ee&&this.raise(Ft.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Ft,!1,qe),this.checkLValPattern(Ft),this.parseForIn(p,Ft)):(this.checkExpressionErrors(qe,!0),S>-1&&this.unexpected(S),this.parseFor(p,Ft))},be.parseForAfterInit=function(p,S,w){return(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&S.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===C._in?w>-1&&this.unexpected(w):p.await=w>-1),this.parseForIn(p,S)):(w>-1&&this.unexpected(w),this.parseFor(p,S))},be.parseFunctionStatement=function(p,S,w){return this.next(),this.parseFunction(p,Zn|(w?0:Rn),!1,S)},be.parseIfStatement=function(p){return this.next(),p.test=this.parseParenExpression(),p.consequent=this.parseStatement("if"),p.alternate=this.eat(C._else)?this.parseStatement("if"):null,this.finishNode(p,"IfStatement")},be.parseReturnStatement=function(p){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(C.semi)||this.insertSemicolon()?p.argument=null:(p.argument=this.parseExpression(),this.semicolon()),this.finishNode(p,"ReturnStatement")},be.parseSwitchStatement=function(p){this.next(),p.discriminant=this.parseParenExpression(),p.cases=[],this.expect(C.braceL),this.labels.push(gn),this.enterScope(ci);for(var S,w=!1;this.type!==C.braceR;)if(this.type===C._case||this.type===C._default){var A=this.type===C._case;S&&this.finishNode(S,"SwitchCase"),p.cases.push(S=this.startNode()),S.consequent=[],this.next(),A?S.test=this.parseExpression():(w&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),w=!0,S.test=null),this.expect(C.colon)}else S||this.unexpected(),S.consequent.push(this.parseStatement(null));return this.exitScope(),S&&this.finishNode(S,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(p,"SwitchStatement")},be.parseThrowStatement=function(p){return this.next(),z.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),p.argument=this.parseExpression(),this.semicolon(),this.finishNode(p,"ThrowStatement")};var St=[];be.parseCatchClauseParam=function(){var p=this.parseBindingAtom(),S=p.type==="Identifier";return this.enterScope(S?Wn:0),this.checkLValPattern(p,S?ae:$e),this.expect(C.parenR),p},be.parseTryStatement=function(p){if(this.next(),p.block=this.parseBlock(),p.handler=null,this.type===C._catch){var S=this.startNode();this.next(),this.eat(C.parenL)?S.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),S.param=null,this.enterScope(0)),S.body=this.parseBlock(!1),this.exitScope(),p.handler=this.finishNode(S,"CatchClause")}return p.finalizer=this.eat(C._finally)?this.parseBlock():null,!p.handler&&!p.finalizer&&this.raise(p.start,"Missing catch or finally clause"),this.finishNode(p,"TryStatement")},be.parseVarStatement=function(p,S,w){return this.next(),this.parseVar(p,!1,S,w),this.semicolon(),this.finishNode(p,"VariableDeclaration")},be.parseWhileStatement=function(p){return this.next(),p.test=this.parseParenExpression(),this.labels.push(_t),p.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(p,"WhileStatement")},be.parseWithStatement=function(p){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),p.object=this.parseParenExpression(),p.body=this.parseStatement("with"),this.finishNode(p,"WithStatement")},be.parseEmptyStatement=function(p){return this.next(),this.finishNode(p,"EmptyStatement")},be.parseLabeledStatement=function(p,S,w,A){for(var B=0,W=this.labels;B<W.length;B+=1){var ee=W[B];ee.name===S&&this.raise(w.start,"Label '"+S+"' is already declared")}for(var me=this.type.isLoop?"loop":this.type===C._switch?"switch":null,ye=this.labels.length-1;ye>=0;ye--){var Le=this.labels[ye];if(Le.statementStart===p.start)Le.statementStart=this.start,Le.kind=me;else break}return this.labels.push({name:S,kind:me,statementStart:this.start}),p.body=this.parseStatement(A?A.indexOf("label")===-1?A+"label":A:"label"),this.labels.pop(),p.label=w,this.finishNode(p,"LabeledStatement")},be.parseExpressionStatement=function(p,S){return p.expression=S,this.semicolon(),this.finishNode(p,"ExpressionStatement")},be.parseBlock=function(p,S,w){for(p===void 0&&(p=!0),S===void 0&&(S=this.startNode()),S.body=[],this.expect(C.braceL),p&&this.enterScope(0);this.type!==C.braceR;){var A=this.parseStatement(null);S.body.push(A)}return w&&(this.strict=!1),this.next(),p&&this.exitScope(),this.finishNode(S,"BlockStatement")},be.parseFor=function(p,S){return p.init=S,this.expect(C.semi),p.test=this.type===C.semi?null:this.parseExpression(),this.expect(C.semi),p.update=this.type===C.parenR?null:this.parseExpression(),this.expect(C.parenR),p.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(p,"ForStatement")},be.parseForIn=function(p,S){var w=this.type===C._in;return this.next(),S.type==="VariableDeclaration"&&S.declarations[0].init!=null&&(!w||this.options.ecmaVersion<8||this.strict||S.kind!=="var"||S.declarations[0].id.type!=="Identifier")&&this.raise(S.start,(w?"for-in":"for-of")+" loop variable declaration may not have an initializer"),p.left=S,p.right=w?this.parseExpression():this.parseMaybeAssign(),this.expect(C.parenR),p.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(p,w?"ForInStatement":"ForOfStatement")},be.parseVar=function(p,S,w,A){for(p.declarations=[],p.kind=w;;){var B=this.startNode();if(this.parseVarId(B,w),this.eat(C.eq)?B.init=this.parseMaybeAssign(S):!A&&w==="const"&&!(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!A&&(w==="using"||w==="await using")&&this.options.ecmaVersion>=17&&this.type!==C._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+w+" declaration"):!A&&B.id.type!=="Identifier"&&!(S&&(this.type===C._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):B.init=null,p.declarations.push(this.finishNode(B,"VariableDeclarator")),!this.eat(C.comma))break}return p},be.parseVarId=function(p,S){p.id=S==="using"||S==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(p.id,S==="var"?Dr:$e,!1)};var Zn=1,Rn=2,dp=4;be.parseFunction=function(p,S,w,A,B){this.initFunction(p),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!A)&&(this.type===C.star&&S&Rn&&this.unexpected(),p.generator=this.eat(C.star)),this.options.ecmaVersion>=8&&(p.async=!!A),S&Zn&&(p.id=S&dp&&this.type!==C.name?null:this.parseIdent(),p.id&&!(S&Rn)&&this.checkLValSimple(p.id,this.strict||p.generator||p.async?this.treatFunctionsAsVar?Dr:$e:Qi));var W=this.yieldPos,ee=this.awaitPos,me=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Rr(p.async,p.generator)),S&Zn||(p.id=this.type===C.name?this.parseIdent():null),this.parseFunctionParams(p),this.parseFunctionBody(p,w,!1,B),this.yieldPos=W,this.awaitPos=ee,this.awaitIdentPos=me,this.finishNode(p,S&Zn?"FunctionDeclaration":"FunctionExpression")},be.parseFunctionParams=function(p){this.expect(C.parenL),p.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},be.parseClass=function(p,S){this.next();var w=this.strict;this.strict=!0,this.parseClassId(p,S),this.parseClassSuper(p);var A=this.enterClassBody(),B=this.startNode(),W=!1;for(B.body=[],this.expect(C.braceL);this.type!==C.braceR;){var ee=this.parseClassElement(p.superClass!==null);ee&&(B.body.push(ee),ee.type==="MethodDefinition"&&ee.kind==="constructor"?(W&&this.raiseRecoverable(ee.start,"Duplicate constructor in the same class"),W=!0):ee.key&&ee.key.type==="PrivateIdentifier"&&kl(A,ee)&&this.raiseRecoverable(ee.key.start,"Identifier '#"+ee.key.name+"' has already been declared"))}return this.strict=w,this.next(),p.body=this.finishNode(B,"ClassBody"),this.exitClassBody(),this.finishNode(p,S?"ClassDeclaration":"ClassExpression")},be.parseClassElement=function(p){if(this.eat(C.semi))return null;var S=this.options.ecmaVersion,w=this.startNode(),A="",B=!1,W=!1,ee="method",me=!1;if(this.eatContextual("static")){if(S>=13&&this.eat(C.braceL))return this.parseClassStaticBlock(w),w;this.isClassElementNameStart()||this.type===C.star?me=!0:A="static"}if(w.static=me,!A&&S>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===C.star)&&!this.canInsertSemicolon()?W=!0:A="async"),!A&&(S>=9||!W)&&this.eat(C.star)&&(B=!0),!A&&!W&&!B){var ye=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?ee=ye:A=ye)}if(A?(w.computed=!1,w.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),w.key.name=A,this.finishNode(w.key,"Identifier")):this.parseClassElementName(w),S<13||this.type===C.parenL||ee!=="method"||B||W){var Le=!w.static&&Zi(w,"constructor"),qe=Le&&p;Le&&ee!=="method"&&this.raise(w.key.start,"Constructor can't have get/set modifier"),w.kind=Le?"constructor":ee,this.parseClassMethod(w,B,W,qe)}else this.parseClassField(w);return w},be.isClassElementNameStart=function(){return this.type===C.name||this.type===C.privateId||this.type===C.num||this.type===C.string||this.type===C.bracketL||this.type.keyword},be.parseClassElementName=function(p){this.type===C.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),p.computed=!1,p.key=this.parsePrivateIdent()):this.parsePropertyName(p)},be.parseClassMethod=function(p,S,w,A){var B=p.key;p.kind==="constructor"?(S&&this.raise(B.start,"Constructor can't be a generator"),w&&this.raise(B.start,"Constructor can't be an async method")):p.static&&Zi(p,"prototype")&&this.raise(B.start,"Classes may not have a static property named prototype");var W=p.value=this.parseMethod(S,w,A);return p.kind==="get"&&W.params.length!==0&&this.raiseRecoverable(W.start,"getter should have no params"),p.kind==="set"&&W.params.length!==1&&this.raiseRecoverable(W.start,"setter should have exactly one param"),p.kind==="set"&&W.params[0].type==="RestElement"&&this.raiseRecoverable(W.params[0].start,"Setter cannot use rest params"),this.finishNode(p,"MethodDefinition")},be.parseClassField=function(p){return Zi(p,"constructor")?this.raise(p.key.start,"Classes can't have a field named 'constructor'"):p.static&&Zi(p,"prototype")&&this.raise(p.key.start,"Classes can't have a static field named 'prototype'"),this.eat(C.eq)?(this.enterScope(mr|dr),p.value=this.parseMaybeAssign(),this.exitScope()):p.value=null,this.semicolon(),this.finishNode(p,"PropertyDefinition")},be.parseClassStaticBlock=function(p){p.body=[];var S=this.labels;for(this.labels=[],this.enterScope(Xn|dr);this.type!==C.braceR;){var w=this.parseStatement(null);p.body.push(w)}return this.next(),this.exitScope(),this.labels=S,this.finishNode(p,"StaticBlock")},be.parseClassId=function(p,S){this.type===C.name?(p.id=this.parseIdent(),S&&this.checkLValSimple(p.id,$e,!1)):(S===!0&&this.unexpected(),p.id=null)},be.parseClassSuper=function(p){p.superClass=this.eat(C._extends)?this.parseExprSubscripts(null,!1):null},be.enterClassBody=function(){var p={declared:Object.create(null),used:[]};return this.privateNameStack.push(p),p.declared},be.exitClassBody=function(){var p=this.privateNameStack.pop(),S=p.declared,w=p.used;if(this.options.checkPrivateFields)for(var A=this.privateNameStack.length,B=A===0?null:this.privateNameStack[A-1],W=0;W<w.length;++W){var ee=w[W];X(S,ee.name)||(B?B.used.push(ee):this.raiseRecoverable(ee.start,"Private field '#"+ee.name+"' must be declared in an enclosing class"))}};function kl(p,S){var w=S.key.name,A=p[w],B="true";return S.type==="MethodDefinition"&&(S.kind==="get"||S.kind==="set")&&(B=(S.static?"s":"i")+S.kind),A==="iget"&&B==="iset"||A==="iset"&&B==="iget"||A==="sget"&&B==="sset"||A==="sset"&&B==="sget"?(p[w]="true",!1):A?!0:(p[w]=B,!1)}function Zi(p,S){var w=p.computed,A=p.key;return!w&&(A.type==="Identifier"&&A.name===S||A.type==="Literal"&&A.value===S)}be.parseExportAllDeclaration=function(p,S){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(p.exported=this.parseModuleExportName(),this.checkExport(S,p.exported,this.lastTokStart)):p.exported=null),this.expectContextual("from"),this.type!==C.string&&this.unexpected(),p.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(p.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(p,"ExportAllDeclaration")},be.parseExport=function(p,S){if(this.next(),this.eat(C.star))return this.parseExportAllDeclaration(p,S);if(this.eat(C._default))return this.checkExport(S,"default",this.lastTokStart),p.declaration=this.parseExportDefaultDeclaration(),this.finishNode(p,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())p.declaration=this.parseExportDeclaration(p),p.declaration.type==="VariableDeclaration"?this.checkVariableExport(S,p.declaration.declarations):this.checkExport(S,p.declaration.id,p.declaration.id.start),p.specifiers=[],p.source=null,this.options.ecmaVersion>=16&&(p.attributes=[]);else{if(p.declaration=null,p.specifiers=this.parseExportSpecifiers(S),this.eatContextual("from"))this.type!==C.string&&this.unexpected(),p.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(p.attributes=this.parseWithClause());else{for(var w=0,A=p.specifiers;w<A.length;w+=1){var B=A[w];this.checkUnreserved(B.local),this.checkLocalExport(B.local),B.local.type==="Literal"&&this.raise(B.local.start,"A string literal cannot be used as an exported binding without `from`.")}p.source=null,this.options.ecmaVersion>=16&&(p.attributes=[])}this.semicolon()}return this.finishNode(p,"ExportNamedDeclaration")},be.parseExportDeclaration=function(p){return this.parseStatement(null)},be.parseExportDefaultDeclaration=function(){var p;if(this.type===C._function||(p=this.isAsyncFunction())){var S=this.startNode();return this.next(),p&&this.next(),this.parseFunction(S,Zn|dp,!1,p)}else if(this.type===C._class){var w=this.startNode();return this.parseClass(w,"nullableID")}else{var A=this.parseMaybeAssign();return this.semicolon(),A}},be.checkExport=function(p,S,w){p&&(typeof S!="string"&&(S=S.type==="Identifier"?S.name:S.value),X(p,S)&&this.raiseRecoverable(w,"Duplicate export '"+S+"'"),p[S]=!0)},be.checkPatternExport=function(p,S){var w=S.type;if(w==="Identifier")this.checkExport(p,S,S.start);else if(w==="ObjectPattern")for(var A=0,B=S.properties;A<B.length;A+=1){var W=B[A];this.checkPatternExport(p,W)}else if(w==="ArrayPattern")for(var ee=0,me=S.elements;ee<me.length;ee+=1){var ye=me[ee];ye&&this.checkPatternExport(p,ye)}else w==="Property"?this.checkPatternExport(p,S.value):w==="AssignmentPattern"?this.checkPatternExport(p,S.left):w==="RestElement"&&this.checkPatternExport(p,S.argument)},be.checkVariableExport=function(p,S){if(p)for(var w=0,A=S;w<A.length;w+=1){var B=A[w];this.checkPatternExport(p,B.id)}},be.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},be.parseExportSpecifier=function(p){var S=this.startNode();return S.local=this.parseModuleExportName(),S.exported=this.eatContextual("as")?this.parseModuleExportName():S.local,this.checkExport(p,S.exported,S.exported.start),this.finishNode(S,"ExportSpecifier")},be.parseExportSpecifiers=function(p){var S=[],w=!0;for(this.expect(C.braceL);!this.eat(C.braceR);){if(w)w=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;S.push(this.parseExportSpecifier(p))}return S},be.parseImport=function(p){return this.next(),this.type===C.string?(p.specifiers=St,p.source=this.parseExprAtom()):(p.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),p.source=this.type===C.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(p.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(p,"ImportDeclaration")},be.parseImportSpecifier=function(){var p=this.startNode();return p.imported=this.parseModuleExportName(),this.eatContextual("as")?p.local=this.parseIdent():(this.checkUnreserved(p.imported),p.local=p.imported),this.checkLValSimple(p.local,$e),this.finishNode(p,"ImportSpecifier")},be.parseImportDefaultSpecifier=function(){var p=this.startNode();return p.local=this.parseIdent(),this.checkLValSimple(p.local,$e),this.finishNode(p,"ImportDefaultSpecifier")},be.parseImportNamespaceSpecifier=function(){var p=this.startNode();return this.next(),this.expectContextual("as"),p.local=this.parseIdent(),this.checkLValSimple(p.local,$e),this.finishNode(p,"ImportNamespaceSpecifier")},be.parseImportSpecifiers=function(){var p=[],S=!0;if(this.type===C.name&&(p.push(this.parseImportDefaultSpecifier()),!this.eat(C.comma)))return p;if(this.type===C.star)return p.push(this.parseImportNamespaceSpecifier()),p;for(this.expect(C.braceL);!this.eat(C.braceR);){if(S)S=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;p.push(this.parseImportSpecifier())}return p},be.parseWithClause=function(){var p=[];if(!this.eat(C._with))return p;this.expect(C.braceL);for(var S={},w=!0;!this.eat(C.braceR);){if(w)w=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;var A=this.parseImportAttribute(),B=A.key.type==="Identifier"?A.key.name:A.key.value;X(S,B)&&this.raiseRecoverable(A.key.start,"Duplicate attribute key '"+B+"'"),S[B]=!0,p.push(A)}return p},be.parseImportAttribute=function(){var p=this.startNode();return p.key=this.type===C.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(C.colon),this.type!==C.string&&this.unexpected(),p.value=this.parseExprAtom(),this.finishNode(p,"ImportAttribute")},be.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===C.string){var p=this.parseLiteral(this.value);return F.test(p.value)&&this.raise(p.start,"An export name cannot include a lone surrogate."),p}return this.parseIdent(!0)},be.adaptDirectivePrologue=function(p){for(var S=0;S<p.length&&this.isDirectiveCandidate(p[S]);++S)p[S].directive=p[S].expression.raw.slice(1,-1)},be.isDirectiveCandidate=function(p){return this.options.ecmaVersion>=5&&p.type==="ExpressionStatement"&&p.expression.type==="Literal"&&typeof p.expression.value=="string"&&(this.input[p.start]==='"'||this.input[p.start]==="'")};var an=_.prototype;an.toAssignable=function(p,S,w){if(this.options.ecmaVersion>=6&&p)switch(p.type){case"Identifier":this.inAsync&&p.name==="await"&&this.raise(p.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":p.type="ObjectPattern",w&&this.checkPatternErrors(w,!0);for(var A=0,B=p.properties;A<B.length;A+=1){var W=B[A];this.toAssignable(W,S),W.type==="RestElement"&&(W.argument.type==="ArrayPattern"||W.argument.type==="ObjectPattern")&&this.raise(W.argument.start,"Unexpected token")}break;case"Property":p.kind!=="init"&&this.raise(p.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(p.value,S);break;case"ArrayExpression":p.type="ArrayPattern",w&&this.checkPatternErrors(w,!0),this.toAssignableList(p.elements,S);break;case"SpreadElement":p.type="RestElement",this.toAssignable(p.argument,S),p.argument.type==="AssignmentPattern"&&this.raise(p.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":p.operator!=="="&&this.raise(p.left.end,"Only '=' operator can be used for specifying default value."),p.type="AssignmentPattern",delete p.operator,this.toAssignable(p.left,S);break;case"ParenthesizedExpression":this.toAssignable(p.expression,S,w);break;case"ChainExpression":this.raiseRecoverable(p.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!S)break;default:this.raise(p.start,"Assigning to rvalue")}else w&&this.checkPatternErrors(w,!0);return p},an.toAssignableList=function(p,S){for(var w=p.length,A=0;A<w;A++){var B=p[A];B&&this.toAssignable(B,S)}if(w){var W=p[w-1];this.options.ecmaVersion===6&&S&&W&&W.type==="RestElement"&&W.argument.type!=="Identifier"&&this.unexpected(W.argument.start)}return p},an.parseSpread=function(p){var S=this.startNode();return this.next(),S.argument=this.parseMaybeAssign(!1,p),this.finishNode(S,"SpreadElement")},an.parseRestBinding=function(){var p=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==C.name&&this.unexpected(),p.argument=this.parseBindingAtom(),this.finishNode(p,"RestElement")},an.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case C.bracketL:var p=this.startNode();return this.next(),p.elements=this.parseBindingList(C.bracketR,!0,!0),this.finishNode(p,"ArrayPattern");case C.braceL:return this.parseObj(!0)}return this.parseIdent()},an.parseBindingList=function(p,S,w,A){for(var B=[],W=!0;!this.eat(p);)if(W?W=!1:this.expect(C.comma),S&&this.type===C.comma)B.push(null);else{if(w&&this.afterTrailingComma(p))break;if(this.type===C.ellipsis){var ee=this.parseRestBinding();this.parseBindingListItem(ee),B.push(ee),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(p);break}else B.push(this.parseAssignableListItem(A))}return B},an.parseAssignableListItem=function(p){var S=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(S),S},an.parseBindingListItem=function(p){return p},an.parseMaybeDefault=function(p,S,w){if(w=w||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(C.eq))return w;var A=this.startNodeAt(p,S);return A.left=w,A.right=this.parseMaybeAssign(),this.finishNode(A,"AssignmentPattern")},an.checkLValSimple=function(p,S,w){S===void 0&&(S=Mi);var A=S!==Mi;switch(p.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(p.name)&&this.raiseRecoverable(p.start,(A?"Binding ":"Assigning to ")+p.name+" in strict mode"),A&&(S===$e&&p.name==="let"&&this.raiseRecoverable(p.start,"let is disallowed as a lexically bound name"),w&&(X(w,p.name)&&this.raiseRecoverable(p.start,"Argument name clash"),w[p.name]=!0),S!==de&&this.declareName(p.name,S,p.start));break;case"ChainExpression":this.raiseRecoverable(p.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":A&&this.raiseRecoverable(p.start,"Binding member expression");break;case"ParenthesizedExpression":return A&&this.raiseRecoverable(p.start,"Binding parenthesized expression"),this.checkLValSimple(p.expression,S,w);default:this.raise(p.start,(A?"Binding":"Assigning to")+" rvalue")}},an.checkLValPattern=function(p,S,w){switch(S===void 0&&(S=Mi),p.type){case"ObjectPattern":for(var A=0,B=p.properties;A<B.length;A+=1){var W=B[A];this.checkLValInnerPattern(W,S,w)}break;case"ArrayPattern":for(var ee=0,me=p.elements;ee<me.length;ee+=1){var ye=me[ee];ye&&this.checkLValInnerPattern(ye,S,w)}break;default:this.checkLValSimple(p,S,w)}},an.checkLValInnerPattern=function(p,S,w){switch(S===void 0&&(S=Mi),p.type){case"Property":this.checkLValInnerPattern(p.value,S,w);break;case"AssignmentPattern":this.checkLValPattern(p.left,S,w);break;case"RestElement":this.checkLValPattern(p.argument,S,w);break;default:this.checkLValPattern(p,S,w)}};var Jt=function(S,w,A,B,W){this.token=S,this.isExpr=!!w,this.preserveSpace=!!A,this.override=B,this.generator=!!W},gt={b_stat:new Jt("{",!1),b_expr:new Jt("{",!0),b_tmpl:new Jt("${",!1),p_stat:new Jt("(",!1),p_expr:new Jt("(",!0),q_tmpl:new Jt("`",!0,!0,function(p){return p.tryReadTemplateToken()}),f_stat:new Jt("function",!1),f_expr:new Jt("function",!0),f_expr_gen:new Jt("function",!0,!1,null,!0),f_gen:new Jt("function",!1,!1,null,!0)},Ir=_.prototype;Ir.initialContext=function(){return[gt.b_stat]},Ir.curContext=function(){return this.context[this.context.length-1]},Ir.braceIsBlock=function(p){var S=this.curContext();return S===gt.f_expr||S===gt.f_stat?!0:p===C.colon&&(S===gt.b_stat||S===gt.b_expr)?!S.isExpr:p===C._return||p===C.name&&this.exprAllowed?z.test(this.input.slice(this.lastTokEnd,this.start)):p===C._else||p===C.semi||p===C.eof||p===C.parenR||p===C.arrow?!0:p===C.braceL?S===gt.b_stat:p===C._var||p===C._const||p===C.name?!1:!this.exprAllowed},Ir.inGeneratorContext=function(){for(var p=this.context.length-1;p>=1;p--){var S=this.context[p];if(S.token==="function")return S.generator}return!1},Ir.updateContext=function(p){var S,w=this.type;w.keyword&&p===C.dot?this.exprAllowed=!1:(S=w.updateContext)?S.call(this,p):this.exprAllowed=w.beforeExpr},Ir.overrideContext=function(p){this.curContext()!==p&&(this.context[this.context.length-1]=p)},C.parenR.updateContext=C.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var p=this.context.pop();p===gt.b_stat&&this.curContext().token==="function"&&(p=this.context.pop()),this.exprAllowed=!p.isExpr},C.braceL.updateContext=function(p){this.context.push(this.braceIsBlock(p)?gt.b_stat:gt.b_expr),this.exprAllowed=!0},C.dollarBraceL.updateContext=function(){this.context.push(gt.b_tmpl),this.exprAllowed=!0},C.parenL.updateContext=function(p){var S=p===C._if||p===C._for||p===C._with||p===C._while;this.context.push(S?gt.p_stat:gt.p_expr),this.exprAllowed=!0},C.incDec.updateContext=function(){},C._function.updateContext=C._class.updateContext=function(p){p.beforeExpr&&p!==C._else&&!(p===C.semi&&this.curContext()!==gt.p_stat)&&!(p===C._return&&z.test(this.input.slice(this.lastTokEnd,this.start)))&&!((p===C.colon||p===C.braceL)&&this.curContext()===gt.b_stat)?this.context.push(gt.f_expr):this.context.push(gt.f_stat),this.exprAllowed=!1},C.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},C.backQuote.updateContext=function(){this.curContext()===gt.q_tmpl?this.context.pop():this.context.push(gt.q_tmpl),this.exprAllowed=!1},C.star.updateContext=function(p){if(p===C._function){var S=this.context.length-1;this.context[S]===gt.f_expr?this.context[S]=gt.f_expr_gen:this.context[S]=gt.f_gen}this.exprAllowed=!0},C.name.updateContext=function(p){var S=!1;this.options.ecmaVersion>=6&&p!==C.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(S=!0),this.exprAllowed=S};var je=_.prototype;je.checkPropClash=function(p,S,w){if(!(this.options.ecmaVersion>=9&&p.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(p.computed||p.method||p.shorthand))){var A=p.key,B;switch(A.type){case"Identifier":B=A.name;break;case"Literal":B=String(A.value);break;default:return}var W=p.kind;if(this.options.ecmaVersion>=6){B==="__proto__"&&W==="init"&&(S.proto&&(w?w.doubleProto<0&&(w.doubleProto=A.start):this.raiseRecoverable(A.start,"Redefinition of __proto__ property")),S.proto=!0);return}B="$"+B;var ee=S[B];if(ee){var me;W==="init"?me=this.strict&&ee.init||ee.get||ee.set:me=ee.init||ee[W],me&&this.raiseRecoverable(A.start,"Redefinition of property")}else ee=S[B]={init:!1,get:!1,set:!1};ee[W]=!0}},je.parseExpression=function(p,S){var w=this.start,A=this.startLoc,B=this.parseMaybeAssign(p,S);if(this.type===C.comma){var W=this.startNodeAt(w,A);for(W.expressions=[B];this.eat(C.comma);)W.expressions.push(this.parseMaybeAssign(p,S));return this.finishNode(W,"SequenceExpression")}return B},je.parseMaybeAssign=function(p,S,w){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(p);this.exprAllowed=!1}var A=!1,B=-1,W=-1,ee=-1;S?(B=S.parenthesizedAssign,W=S.trailingComma,ee=S.doubleProto,S.parenthesizedAssign=S.trailingComma=-1):(S=new Qn,A=!0);var me=this.start,ye=this.startLoc;(this.type===C.parenL||this.type===C.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=p==="await");var Le=this.parseMaybeConditional(p,S);if(w&&(Le=w.call(this,Le,me,ye)),this.type.isAssign){var qe=this.startNodeAt(me,ye);return qe.operator=this.value,this.type===C.eq&&(Le=this.toAssignable(Le,!1,S)),A||(S.parenthesizedAssign=S.trailingComma=S.doubleProto=-1),S.shorthandAssign>=Le.start&&(S.shorthandAssign=-1),this.type===C.eq?this.checkLValPattern(Le):this.checkLValSimple(Le),qe.left=Le,this.next(),qe.right=this.parseMaybeAssign(p),ee>-1&&(S.doubleProto=ee),this.finishNode(qe,"AssignmentExpression")}else A&&this.checkExpressionErrors(S,!0);return B>-1&&(S.parenthesizedAssign=B),W>-1&&(S.trailingComma=W),Le},je.parseMaybeConditional=function(p,S){var w=this.start,A=this.startLoc,B=this.parseExprOps(p,S);if(this.checkExpressionErrors(S))return B;if(this.eat(C.question)){var W=this.startNodeAt(w,A);return W.test=B,W.consequent=this.parseMaybeAssign(),this.expect(C.colon),W.alternate=this.parseMaybeAssign(p),this.finishNode(W,"ConditionalExpression")}return B},je.parseExprOps=function(p,S){var w=this.start,A=this.startLoc,B=this.parseMaybeUnary(S,!1,!1,p);return this.checkExpressionErrors(S)||B.start===w&&B.type==="ArrowFunctionExpression"?B:this.parseExprOp(B,w,A,-1,p)},je.parseExprOp=function(p,S,w,A,B){var W=this.type.binop;if(W!=null&&(!B||this.type!==C._in)&&W>A){var ee=this.type===C.logicalOR||this.type===C.logicalAND,me=this.type===C.coalesce;me&&(W=C.logicalAND.binop);var ye=this.value;this.next();var Le=this.start,qe=this.startLoc,yt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,B),Le,qe,W,B),Ft=this.buildBinary(S,w,p,yt,ye,ee||me);return(ee&&this.type===C.coalesce||me&&(this.type===C.logicalOR||this.type===C.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(Ft,S,w,A,B)}return p},je.buildBinary=function(p,S,w,A,B,W){A.type==="PrivateIdentifier"&&this.raise(A.start,"Private identifier can only be left side of binary expression");var ee=this.startNodeAt(p,S);return ee.left=w,ee.operator=B,ee.right=A,this.finishNode(ee,W?"LogicalExpression":"BinaryExpression")},je.parseMaybeUnary=function(p,S,w,A){var B=this.start,W=this.startLoc,ee;if(this.isContextual("await")&&this.canAwait)ee=this.parseAwait(A),S=!0;else if(this.type.prefix){var me=this.startNode(),ye=this.type===C.incDec;me.operator=this.value,me.prefix=!0,this.next(),me.argument=this.parseMaybeUnary(null,!0,ye,A),this.checkExpressionErrors(p,!0),ye?this.checkLValSimple(me.argument):this.strict&&me.operator==="delete"&&Qu(me.argument)?this.raiseRecoverable(me.start,"Deleting local variable in strict mode"):me.operator==="delete"&&no(me.argument)?this.raiseRecoverable(me.start,"Private fields can not be deleted"):S=!0,ee=this.finishNode(me,ye?"UpdateExpression":"UnaryExpression")}else if(!S&&this.type===C.privateId)(A||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),ee=this.parsePrivateIdent(),this.type!==C._in&&this.unexpected();else{if(ee=this.parseExprSubscripts(p,A),this.checkExpressionErrors(p))return ee;for(;this.type.postfix&&!this.canInsertSemicolon();){var Le=this.startNodeAt(B,W);Le.operator=this.value,Le.prefix=!1,Le.argument=ee,this.checkLValSimple(ee),this.next(),ee=this.finishNode(Le,"UpdateExpression")}}if(!w&&this.eat(C.starstar))if(S)this.unexpected(this.lastTokStart);else return this.buildBinary(B,W,ee,this.parseMaybeUnary(null,!1,!1,A),"**",!1);else return ee};function Qu(p){return p.type==="Identifier"||p.type==="ParenthesizedExpression"&&Qu(p.expression)}function no(p){return p.type==="MemberExpression"&&p.property.type==="PrivateIdentifier"||p.type==="ChainExpression"&&no(p.expression)||p.type==="ParenthesizedExpression"&&no(p.expression)}je.parseExprSubscripts=function(p,S){var w=this.start,A=this.startLoc,B=this.parseExprAtom(p,S);if(B.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return B;var W=this.parseSubscripts(B,w,A,!1,S);return p&&W.type==="MemberExpression"&&(p.parenthesizedAssign>=W.start&&(p.parenthesizedAssign=-1),p.parenthesizedBind>=W.start&&(p.parenthesizedBind=-1),p.trailingComma>=W.start&&(p.trailingComma=-1)),W},je.parseSubscripts=function(p,S,w,A,B){for(var W=this.options.ecmaVersion>=8&&p.type==="Identifier"&&p.name==="async"&&this.lastTokEnd===p.end&&!this.canInsertSemicolon()&&p.end-p.start===5&&this.potentialArrowAt===p.start,ee=!1;;){var me=this.parseSubscript(p,S,w,A,W,ee,B);if(me.optional&&(ee=!0),me===p||me.type==="ArrowFunctionExpression"){if(ee){var ye=this.startNodeAt(S,w);ye.expression=me,me=this.finishNode(ye,"ChainExpression")}return me}p=me}},je.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(C.arrow)},je.parseSubscriptAsyncArrow=function(p,S,w,A){return this.parseArrowExpression(this.startNodeAt(p,S),w,!0,A)},je.parseSubscript=function(p,S,w,A,B,W,ee){var me=this.options.ecmaVersion>=11,ye=me&&this.eat(C.questionDot);A&&ye&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Le=this.eat(C.bracketL);if(Le||ye&&this.type!==C.parenL&&this.type!==C.backQuote||this.eat(C.dot)){var qe=this.startNodeAt(S,w);qe.object=p,Le?(qe.property=this.parseExpression(),this.expect(C.bracketR)):this.type===C.privateId&&p.type!=="Super"?qe.property=this.parsePrivateIdent():qe.property=this.parseIdent(this.options.allowReserved!=="never"),qe.computed=!!Le,me&&(qe.optional=ye),p=this.finishNode(qe,"MemberExpression")}else if(!A&&this.eat(C.parenL)){var yt=new Qn,Ft=this.yieldPos,Zs=this.awaitPos,Pt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var zr=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1,yt);if(B&&!ye&&this.shouldParseAsyncArrow())return this.checkPatternErrors(yt,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=Ft,this.awaitPos=Zs,this.awaitIdentPos=Pt,this.parseSubscriptAsyncArrow(S,w,zr,ee);this.checkExpressionErrors(yt,!0),this.yieldPos=Ft||this.yieldPos,this.awaitPos=Zs||this.awaitPos,this.awaitIdentPos=Pt||this.awaitIdentPos;var gi=this.startNodeAt(S,w);gi.callee=p,gi.arguments=zr,me&&(gi.optional=ye),p=this.finishNode(gi,"CallExpression")}else if(this.type===C.backQuote){(ye||W)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Lr=this.startNodeAt(S,w);Lr.tag=p,Lr.quasi=this.parseTemplate({isTagged:!0}),p=this.finishNode(Lr,"TaggedTemplateExpression")}return p},je.parseExprAtom=function(p,S,w){this.type===C.slash&&this.readRegexp();var A,B=this.potentialArrowAt===this.start;switch(this.type){case C._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),A=this.startNode(),this.next(),this.type===C.parenL&&!this.allowDirectSuper&&this.raise(A.start,"super() call outside constructor of a subclass"),this.type!==C.dot&&this.type!==C.bracketL&&this.type!==C.parenL&&this.unexpected(),this.finishNode(A,"Super");case C._this:return A=this.startNode(),this.next(),this.finishNode(A,"ThisExpression");case C.name:var W=this.start,ee=this.startLoc,me=this.containsEsc,ye=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!me&&ye.name==="async"&&!this.canInsertSemicolon()&&this.eat(C._function))return this.overrideContext(gt.f_expr),this.parseFunction(this.startNodeAt(W,ee),0,!1,!0,S);if(B&&!this.canInsertSemicolon()){if(this.eat(C.arrow))return this.parseArrowExpression(this.startNodeAt(W,ee),[ye],!1,S);if(this.options.ecmaVersion>=8&&ye.name==="async"&&this.type===C.name&&!me&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return ye=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(C.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(W,ee),[ye],!0,S)}return ye;case C.regexp:var Le=this.value;return A=this.parseLiteral(Le.value),A.regex={pattern:Le.pattern,flags:Le.flags},A;case C.num:case C.string:return this.parseLiteral(this.value);case C._null:case C._true:case C._false:return A=this.startNode(),A.value=this.type===C._null?null:this.type===C._true,A.raw=this.type.keyword,this.next(),this.finishNode(A,"Literal");case C.parenL:var qe=this.start,yt=this.parseParenAndDistinguishExpression(B,S);return p&&(p.parenthesizedAssign<0&&!this.isSimpleAssignTarget(yt)&&(p.parenthesizedAssign=qe),p.parenthesizedBind<0&&(p.parenthesizedBind=qe)),yt;case C.bracketL:return A=this.startNode(),this.next(),A.elements=this.parseExprList(C.bracketR,!0,!0,p),this.finishNode(A,"ArrayExpression");case C.braceL:return this.overrideContext(gt.b_expr),this.parseObj(!1,p);case C._function:return A=this.startNode(),this.next(),this.parseFunction(A,0);case C._class:return this.parseClass(this.startNode(),!1);case C._new:return this.parseNew();case C.backQuote:return this.parseTemplate();case C._import:return this.options.ecmaVersion>=11?this.parseExprImport(w):this.unexpected();default:return this.parseExprAtomDefault()}},je.parseExprAtomDefault=function(){this.unexpected()},je.parseExprImport=function(p){var S=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===C.parenL&&!p)return this.parseDynamicImport(S);if(this.type===C.dot){var w=this.startNodeAt(S.start,S.loc&&S.loc.start);return w.name="import",S.meta=this.finishNode(w,"Identifier"),this.parseImportMeta(S)}else this.unexpected()},je.parseDynamicImport=function(p){if(this.next(),p.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(C.parenR)?p.options=null:(this.expect(C.comma),this.afterTrailingComma(C.parenR)?p.options=null:(p.options=this.parseMaybeAssign(),this.eat(C.parenR)||(this.expect(C.comma),this.afterTrailingComma(C.parenR)||this.unexpected())));else if(!this.eat(C.parenR)){var S=this.start;this.eat(C.comma)&&this.eat(C.parenR)?this.raiseRecoverable(S,"Trailing comma is not allowed in import()"):this.unexpected(S)}return this.finishNode(p,"ImportExpression")},je.parseImportMeta=function(p){this.next();var S=this.containsEsc;return p.property=this.parseIdent(!0),p.property.name!=="meta"&&this.raiseRecoverable(p.property.start,"The only valid meta property for import is 'import.meta'"),S&&this.raiseRecoverable(p.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(p.start,"Cannot use 'import.meta' outside a module"),this.finishNode(p,"MetaProperty")},je.parseLiteral=function(p){var S=this.startNode();return S.value=p,S.raw=this.input.slice(this.start,this.end),S.raw.charCodeAt(S.raw.length-1)===110&&(S.bigint=S.value!=null?S.value.toString():S.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(S,"Literal")},je.parseParenExpression=function(){this.expect(C.parenL);var p=this.parseExpression();return this.expect(C.parenR),p},je.shouldParseArrow=function(p){return!this.canInsertSemicolon()},je.parseParenAndDistinguishExpression=function(p,S){var w=this.start,A=this.startLoc,B,W=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var ee=this.start,me=this.startLoc,ye=[],Le=!0,qe=!1,yt=new Qn,Ft=this.yieldPos,Zs=this.awaitPos,Pt;for(this.yieldPos=0,this.awaitPos=0;this.type!==C.parenR;)if(Le?Le=!1:this.expect(C.comma),W&&this.afterTrailingComma(C.parenR,!0)){qe=!0;break}else if(this.type===C.ellipsis){Pt=this.start,ye.push(this.parseParenItem(this.parseRestBinding())),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else ye.push(this.parseMaybeAssign(!1,yt,this.parseParenItem));var zr=this.lastTokEnd,gi=this.lastTokEndLoc;if(this.expect(C.parenR),p&&this.shouldParseArrow(ye)&&this.eat(C.arrow))return this.checkPatternErrors(yt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Ft,this.awaitPos=Zs,this.parseParenArrowList(w,A,ye,S);(!ye.length||qe)&&this.unexpected(this.lastTokStart),Pt&&this.unexpected(Pt),this.checkExpressionErrors(yt,!0),this.yieldPos=Ft||this.yieldPos,this.awaitPos=Zs||this.awaitPos,ye.length>1?(B=this.startNodeAt(ee,me),B.expressions=ye,this.finishNodeAt(B,"SequenceExpression",zr,gi)):B=ye[0]}else B=this.parseParenExpression();if(this.options.preserveParens){var Lr=this.startNodeAt(w,A);return Lr.expression=B,this.finishNode(Lr,"ParenthesizedExpression")}else return B},je.parseParenItem=function(p){return p},je.parseParenArrowList=function(p,S,w,A){return this.parseArrowExpression(this.startNodeAt(p,S),w,!1,A)};var ro=[];je.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var p=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===C.dot){var S=this.startNodeAt(p.start,p.loc&&p.loc.start);S.name="new",p.meta=this.finishNode(S,"Identifier"),this.next();var w=this.containsEsc;return p.property=this.parseIdent(!0),p.property.name!=="target"&&this.raiseRecoverable(p.property.start,"The only valid meta property for new is 'new.target'"),w&&this.raiseRecoverable(p.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(p.start,"'new.target' can only be used in functions and class static block"),this.finishNode(p,"MetaProperty")}var A=this.start,B=this.startLoc;return p.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),A,B,!0,!1),this.eat(C.parenL)?p.arguments=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1):p.arguments=ro,this.finishNode(p,"NewExpression")},je.parseTemplateElement=function(p){var S=p.isTagged,w=this.startNode();return this.type===C.invalidTemplate?(S||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),w.value={raw:this.value.replace(/\r\n?/g,`
80
+ `),cooked:null}):w.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
81
+ `),cooked:this.value},this.next(),w.tail=this.type===C.backQuote,this.finishNode(w,"TemplateElement")},je.parseTemplate=function(p){p===void 0&&(p={});var S=p.isTagged;S===void 0&&(S=!1);var w=this.startNode();this.next(),w.expressions=[];var A=this.parseTemplateElement({isTagged:S});for(w.quasis=[A];!A.tail;)this.type===C.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(C.dollarBraceL),w.expressions.push(this.parseExpression()),this.expect(C.braceR),w.quasis.push(A=this.parseTemplateElement({isTagged:S}));return this.next(),this.finishNode(w,"TemplateLiteral")},je.isAsyncProp=function(p){return!p.computed&&p.key.type==="Identifier"&&p.key.name==="async"&&(this.type===C.name||this.type===C.num||this.type===C.string||this.type===C.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===C.star)&&!z.test(this.input.slice(this.lastTokEnd,this.start))},je.parseObj=function(p,S){var w=this.startNode(),A=!0,B={};for(w.properties=[],this.next();!this.eat(C.braceR);){if(A)A=!1;else if(this.expect(C.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(C.braceR))break;var W=this.parseProperty(p,S);p||this.checkPropClash(W,B,S),w.properties.push(W)}return this.finishNode(w,p?"ObjectPattern":"ObjectExpression")},je.parseProperty=function(p,S){var w=this.startNode(),A,B,W,ee;if(this.options.ecmaVersion>=9&&this.eat(C.ellipsis))return p?(w.argument=this.parseIdent(!1),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(w,"RestElement")):(w.argument=this.parseMaybeAssign(!1,S),this.type===C.comma&&S&&S.trailingComma<0&&(S.trailingComma=this.start),this.finishNode(w,"SpreadElement"));this.options.ecmaVersion>=6&&(w.method=!1,w.shorthand=!1,(p||S)&&(W=this.start,ee=this.startLoc),p||(A=this.eat(C.star)));var me=this.containsEsc;return this.parsePropertyName(w),!p&&!me&&this.options.ecmaVersion>=8&&!A&&this.isAsyncProp(w)?(B=!0,A=this.options.ecmaVersion>=9&&this.eat(C.star),this.parsePropertyName(w)):B=!1,this.parsePropertyValue(w,p,A,B,W,ee,S,me),this.finishNode(w,"Property")},je.parseGetterSetter=function(p){var S=p.key.name;this.parsePropertyName(p),p.value=this.parseMethod(!1),p.kind=S;var w=p.kind==="get"?0:1;if(p.value.params.length!==w){var A=p.value.start;p.kind==="get"?this.raiseRecoverable(A,"getter should have no params"):this.raiseRecoverable(A,"setter should have exactly one param")}else p.kind==="set"&&p.value.params[0].type==="RestElement"&&this.raiseRecoverable(p.value.params[0].start,"Setter cannot use rest params")},je.parsePropertyValue=function(p,S,w,A,B,W,ee,me){(w||A)&&this.type===C.colon&&this.unexpected(),this.eat(C.colon)?(p.value=S?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,ee),p.kind="init"):this.options.ecmaVersion>=6&&this.type===C.parenL?(S&&this.unexpected(),p.method=!0,p.value=this.parseMethod(w,A),p.kind="init"):!S&&!me&&this.options.ecmaVersion>=5&&!p.computed&&p.key.type==="Identifier"&&(p.key.name==="get"||p.key.name==="set")&&this.type!==C.comma&&this.type!==C.braceR&&this.type!==C.eq?((w||A)&&this.unexpected(),this.parseGetterSetter(p)):this.options.ecmaVersion>=6&&!p.computed&&p.key.type==="Identifier"?((w||A)&&this.unexpected(),this.checkUnreserved(p.key),p.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=B),S?p.value=this.parseMaybeDefault(B,W,this.copyNode(p.key)):this.type===C.eq&&ee?(ee.shorthandAssign<0&&(ee.shorthandAssign=this.start),p.value=this.parseMaybeDefault(B,W,this.copyNode(p.key))):p.value=this.copyNode(p.key),p.kind="init",p.shorthand=!0):this.unexpected()},je.parsePropertyName=function(p){if(this.options.ecmaVersion>=6){if(this.eat(C.bracketL))return p.computed=!0,p.key=this.parseMaybeAssign(),this.expect(C.bracketR),p.key;p.computed=!1}return p.key=this.type===C.num||this.type===C.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},je.initFunction=function(p){p.id=null,this.options.ecmaVersion>=6&&(p.generator=p.expression=!1),this.options.ecmaVersion>=8&&(p.async=!1)},je.parseMethod=function(p,S,w){var A=this.startNode(),B=this.yieldPos,W=this.awaitPos,ee=this.awaitIdentPos;return this.initFunction(A),this.options.ecmaVersion>=6&&(A.generator=p),this.options.ecmaVersion>=8&&(A.async=!!S),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Rr(S,A.generator)|dr|(w?Or:0)),this.expect(C.parenL),A.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(A,!1,!0,!1),this.yieldPos=B,this.awaitPos=W,this.awaitIdentPos=ee,this.finishNode(A,"FunctionExpression")},je.parseArrowExpression=function(p,S,w,A){var B=this.yieldPos,W=this.awaitPos,ee=this.awaitIdentPos;return this.enterScope(Rr(w,!1)|ui),this.initFunction(p),this.options.ecmaVersion>=8&&(p.async=!!w),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,p.params=this.toAssignableList(S,!0),this.parseFunctionBody(p,!0,!1,A),this.yieldPos=B,this.awaitPos=W,this.awaitIdentPos=ee,this.finishNode(p,"ArrowFunctionExpression")},je.parseFunctionBody=function(p,S,w,A){var B=S&&this.type!==C.braceL,W=this.strict,ee=!1;if(B)p.body=this.parseMaybeAssign(A),p.expression=!0,this.checkParams(p,!1);else{var me=this.options.ecmaVersion>=7&&!this.isSimpleParamList(p.params);(!W||me)&&(ee=this.strictDirective(this.end),ee&&me&&this.raiseRecoverable(p.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var ye=this.labels;this.labels=[],ee&&(this.strict=!0),this.checkParams(p,!W&&!ee&&!S&&!w&&this.isSimpleParamList(p.params)),this.strict&&p.id&&this.checkLValSimple(p.id,de),p.body=this.parseBlock(!1,void 0,ee&&!W),p.expression=!1,this.adaptDirectivePrologue(p.body.body),this.labels=ye}this.exitScope()},je.isSimpleParamList=function(p){for(var S=0,w=p;S<w.length;S+=1){var A=w[S];if(A.type!=="Identifier")return!1}return!0},je.checkParams=function(p,S){for(var w=Object.create(null),A=0,B=p.params;A<B.length;A+=1){var W=B[A];this.checkLValInnerPattern(W,Dr,S?null:w)}},je.parseExprList=function(p,S,w,A){for(var B=[],W=!0;!this.eat(p);){if(W)W=!1;else if(this.expect(C.comma),S&&this.afterTrailingComma(p))break;var ee=void 0;w&&this.type===C.comma?ee=null:this.type===C.ellipsis?(ee=this.parseSpread(A),A&&this.type===C.comma&&A.trailingComma<0&&(A.trailingComma=this.start)):ee=this.parseMaybeAssign(!1,A),B.push(ee)}return B},je.checkUnreserved=function(p){var S=p.start,w=p.end,A=p.name;if(this.inGenerator&&A==="yield"&&this.raiseRecoverable(S,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&A==="await"&&this.raiseRecoverable(S,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&On)&&A==="arguments"&&this.raiseRecoverable(S,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(A==="arguments"||A==="await")&&this.raise(S,"Cannot use "+A+" in class static initialization block"),this.keywords.test(A)&&this.raise(S,"Unexpected keyword '"+A+"'"),!(this.options.ecmaVersion<6&&this.input.slice(S,w).indexOf("\\")!==-1)){var B=this.strict?this.reservedWordsStrict:this.reservedWords;B.test(A)&&(!this.inAsync&&A==="await"&&this.raiseRecoverable(S,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(S,"The keyword '"+A+"' is reserved"))}},je.parseIdent=function(p){var S=this.parseIdentNode();return this.next(!!p),this.finishNode(S,"Identifier"),p||(this.checkUnreserved(S),S.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=S.start)),S},je.parseIdentNode=function(){var p=this.startNode();return this.type===C.name?p.name=this.value:this.type.keyword?(p.name=this.type.keyword,(p.name==="class"||p.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=C.name):this.unexpected(),p},je.parsePrivateIdent=function(){var p=this.startNode();return this.type===C.privateId?p.name=this.value:this.unexpected(),this.next(),this.finishNode(p,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(p.start,"Private field '#"+p.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(p)),p},je.parseYield=function(p){this.yieldPos||(this.yieldPos=this.start);var S=this.startNode();return this.next(),this.type===C.semi||this.canInsertSemicolon()||this.type!==C.star&&!this.type.startsExpr?(S.delegate=!1,S.argument=null):(S.delegate=this.eat(C.star),S.argument=this.parseMaybeAssign(p)),this.finishNode(S,"YieldExpression")},je.parseAwait=function(p){this.awaitPos||(this.awaitPos=this.start);var S=this.startNode();return this.next(),S.argument=this.parseMaybeUnary(null,!0,!1,p),this.finishNode(S,"AwaitExpression")};var vl=_.prototype;vl.raise=function(p,S){var w=xe(this.input,p);S+=" ("+w.line+":"+w.column+")",this.sourceFile&&(S+=" in "+this.sourceFile);var A=new SyntaxError(S);throw A.pos=p,A.loc=w,A.raisedAt=this.pos,A},vl.raiseRecoverable=vl.raise,vl.curPosition=function(){if(this.options.locations)return new Q(this.curLine,this.pos-this.lineStart)};var fi=_.prototype,mp=function(S){this.flags=S,this.var=[],this.lexical=[],this.functions=[]};fi.enterScope=function(p){this.scopeStack.push(new mp(p))},fi.exitScope=function(){this.scopeStack.pop()},fi.treatFunctionsAsVarInScope=function(p){return p.flags&zt||!this.inModule&&p.flags&Xe},fi.declareName=function(p,S,w){var A=!1;if(S===$e){var B=this.currentScope();A=B.lexical.indexOf(p)>-1||B.functions.indexOf(p)>-1||B.var.indexOf(p)>-1,B.lexical.push(p),this.inModule&&B.flags&Xe&&delete this.undefinedExports[p]}else if(S===ae){var W=this.currentScope();W.lexical.push(p)}else if(S===Qi){var ee=this.currentScope();this.treatFunctionsAsVar?A=ee.lexical.indexOf(p)>-1:A=ee.lexical.indexOf(p)>-1||ee.var.indexOf(p)>-1,ee.functions.push(p)}else for(var me=this.scopeStack.length-1;me>=0;--me){var ye=this.scopeStack[me];if(ye.lexical.indexOf(p)>-1&&!(ye.flags&Wn&&ye.lexical[0]===p)||!this.treatFunctionsAsVarInScope(ye)&&ye.functions.indexOf(p)>-1){A=!0;break}if(ye.var.push(p),this.inModule&&ye.flags&Xe&&delete this.undefinedExports[p],ye.flags&On)break}A&&this.raiseRecoverable(w,"Identifier '"+p+"' has already been declared")},fi.checkLocalExport=function(p){this.scopeStack[0].lexical.indexOf(p.name)===-1&&this.scopeStack[0].var.indexOf(p.name)===-1&&(this.undefinedExports[p.name]=p)},fi.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},fi.currentVarScope=function(){for(var p=this.scopeStack.length-1;;p--){var S=this.scopeStack[p];if(S.flags&(On|mr|Xn))return S}},fi.currentThisScope=function(){for(var p=this.scopeStack.length-1;;p--){var S=this.scopeStack[p];if(S.flags&(On|mr|Xn)&&!(S.flags&ui))return S}};var qs=function(S,w,A){this.type="",this.start=w,this.end=0,S.options.locations&&(this.loc=new V(S,A)),S.options.directSourceFile&&(this.sourceFile=S.options.directSourceFile),S.options.ranges&&(this.range=[w,0])},es=_.prototype;es.startNode=function(){return new qs(this,this.start,this.startLoc)},es.startNodeAt=function(p,S){return new qs(this,p,S)};function Cl(p,S,w,A){return p.type=S,p.end=w,this.options.locations&&(p.loc.end=A),this.options.ranges&&(p.range[1]=w),p}es.finishNode=function(p,S){return Cl.call(this,p,S,this.lastTokEnd,this.lastTokEndLoc)},es.finishNodeAt=function(p,S,w,A){return Cl.call(this,p,S,w,A)},es.copyNode=function(p){var S=new qs(this,p.start,this.startLoc);for(var w in p)S[w]=p[w];return S};var gp="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",Zu="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",hi=Zu+" Extended_Pictographic",Ht=hi,on=Ht+" EBase EComp EMod EPres ExtPict",ts=on,ec=ts,Xg={9:Zu,10:hi,11:Ht,12:on,13:ts,14:ec},Qg="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",yp={9:"",10:"",11:"",12:"",13:"",14:Qg},Ks="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",wl="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",ns=wl+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",rs=ns+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Gs=rs+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",is=Gs+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",qt=is+" "+gp,xp={9:wl,10:ns,11:rs,12:Gs,13:is,14:qt},tc={};function ss(p){var S=tc[p]={binary:ze(Xg[p]+" "+Ks),binaryOfStrings:ze(yp[p]),nonBinary:{General_Category:ze(Ks),Script:ze(xp[p])}};S.nonBinary.Script_Extensions=S.nonBinary.Script,S.nonBinary.gc=S.nonBinary.General_Category,S.nonBinary.sc=S.nonBinary.Script,S.nonBinary.scx=S.nonBinary.Script_Extensions}for(var Oi=0,bp=[9,10,11,12,13,14];Oi<bp.length;Oi+=1){var Sp=bp[Oi];ss(Sp)}var ve=_.prototype,El=function(S,w){this.parent=S,this.base=w||this};El.prototype.separatedFrom=function(S){for(var w=this;w;w=w.parent)for(var A=S;A;A=A.parent)if(w.base===A.base&&w!==A)return!0;return!1},El.prototype.sibling=function(){return new El(this.parent,this.base)};var Dn=function(S){this.parser=S,this.validFlags="gim"+(S.options.ecmaVersion>=6?"uy":"")+(S.options.ecmaVersion>=9?"s":"")+(S.options.ecmaVersion>=13?"d":"")+(S.options.ecmaVersion>=15?"v":""),this.unicodeProperties=tc[S.options.ecmaVersion>=14?14:S.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Dn.prototype.reset=function(S,w,A){var B=A.indexOf("v")!==-1,W=A.indexOf("u")!==-1;this.start=S|0,this.source=w+"",this.flags=A,B&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=W&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=W&&this.parser.options.ecmaVersion>=9)},Dn.prototype.raise=function(S){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+S)},Dn.prototype.at=function(S,w){w===void 0&&(w=!1);var A=this.source,B=A.length;if(S>=B)return-1;var W=A.charCodeAt(S);if(!(w||this.switchU)||W<=55295||W>=57344||S+1>=B)return W;var ee=A.charCodeAt(S+1);return ee>=56320&&ee<=57343?(W<<10)+ee-56613888:W},Dn.prototype.nextIndex=function(S,w){w===void 0&&(w=!1);var A=this.source,B=A.length;if(S>=B)return B;var W=A.charCodeAt(S),ee;return!(w||this.switchU)||W<=55295||W>=57344||S+1>=B||(ee=A.charCodeAt(S+1))<56320||ee>57343?S+1:S+2},Dn.prototype.current=function(S){return S===void 0&&(S=!1),this.at(this.pos,S)},Dn.prototype.lookahead=function(S){return S===void 0&&(S=!1),this.at(this.nextIndex(this.pos,S),S)},Dn.prototype.advance=function(S){S===void 0&&(S=!1),this.pos=this.nextIndex(this.pos,S)},Dn.prototype.eat=function(S,w){return w===void 0&&(w=!1),this.current(w)===S?(this.advance(w),!0):!1},Dn.prototype.eatChars=function(S,w){w===void 0&&(w=!1);for(var A=this.pos,B=0,W=S;B<W.length;B+=1){var ee=W[B],me=this.at(A,w);if(me===-1||me!==ee)return!1;A=this.nextIndex(A,w)}return this.pos=A,!0},ve.validateRegExpFlags=function(p){for(var S=p.validFlags,w=p.flags,A=!1,B=!1,W=0;W<w.length;W++){var ee=w.charAt(W);S.indexOf(ee)===-1&&this.raise(p.start,"Invalid regular expression flag"),w.indexOf(ee,W+1)>-1&&this.raise(p.start,"Duplicate regular expression flag"),ee==="u"&&(A=!0),ee==="v"&&(B=!0)}this.options.ecmaVersion>=15&&A&&B&&this.raise(p.start,"Invalid regular expression flag")};function Nl(p){for(var S in p)return!0;return!1}ve.validateRegExpPattern=function(p){this.regexp_pattern(p),!p.switchN&&this.options.ecmaVersion>=9&&Nl(p.groupNames)&&(p.switchN=!0,this.regexp_pattern(p))},ve.regexp_pattern=function(p){p.pos=0,p.lastIntValue=0,p.lastStringValue="",p.lastAssertionIsQuantifiable=!1,p.numCapturingParens=0,p.maxBackReference=0,p.groupNames=Object.create(null),p.backReferenceNames.length=0,p.branchID=null,this.regexp_disjunction(p),p.pos!==p.source.length&&(p.eat(41)&&p.raise("Unmatched ')'"),(p.eat(93)||p.eat(125))&&p.raise("Lone quantifier brackets")),p.maxBackReference>p.numCapturingParens&&p.raise("Invalid escape");for(var S=0,w=p.backReferenceNames;S<w.length;S+=1){var A=w[S];p.groupNames[A]||p.raise("Invalid named capture referenced")}},ve.regexp_disjunction=function(p){var S=this.options.ecmaVersion>=16;for(S&&(p.branchID=new El(p.branchID,null)),this.regexp_alternative(p);p.eat(124);)S&&(p.branchID=p.branchID.sibling()),this.regexp_alternative(p);S&&(p.branchID=p.branchID.parent),this.regexp_eatQuantifier(p,!0)&&p.raise("Nothing to repeat"),p.eat(123)&&p.raise("Lone quantifier brackets")},ve.regexp_alternative=function(p){for(;p.pos<p.source.length&&this.regexp_eatTerm(p););},ve.regexp_eatTerm=function(p){return this.regexp_eatAssertion(p)?(p.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(p)&&p.switchU&&p.raise("Invalid quantifier"),!0):(p.switchU?this.regexp_eatAtom(p):this.regexp_eatExtendedAtom(p))?(this.regexp_eatQuantifier(p),!0):!1},ve.regexp_eatAssertion=function(p){var S=p.pos;if(p.lastAssertionIsQuantifiable=!1,p.eat(94)||p.eat(36))return!0;if(p.eat(92)){if(p.eat(66)||p.eat(98))return!0;p.pos=S}if(p.eat(40)&&p.eat(63)){var w=!1;if(this.options.ecmaVersion>=9&&(w=p.eat(60)),p.eat(61)||p.eat(33))return this.regexp_disjunction(p),p.eat(41)||p.raise("Unterminated group"),p.lastAssertionIsQuantifiable=!w,!0}return p.pos=S,!1},ve.regexp_eatQuantifier=function(p,S){return S===void 0&&(S=!1),this.regexp_eatQuantifierPrefix(p,S)?(p.eat(63),!0):!1},ve.regexp_eatQuantifierPrefix=function(p,S){return p.eat(42)||p.eat(43)||p.eat(63)||this.regexp_eatBracedQuantifier(p,S)},ve.regexp_eatBracedQuantifier=function(p,S){var w=p.pos;if(p.eat(123)){var A=0,B=-1;if(this.regexp_eatDecimalDigits(p)&&(A=p.lastIntValue,p.eat(44)&&this.regexp_eatDecimalDigits(p)&&(B=p.lastIntValue),p.eat(125)))return B!==-1&&B<A&&!S&&p.raise("numbers out of order in {} quantifier"),!0;p.switchU&&!S&&p.raise("Incomplete quantifier"),p.pos=w}return!1},ve.regexp_eatAtom=function(p){return this.regexp_eatPatternCharacters(p)||p.eat(46)||this.regexp_eatReverseSolidusAtomEscape(p)||this.regexp_eatCharacterClass(p)||this.regexp_eatUncapturingGroup(p)||this.regexp_eatCapturingGroup(p)},ve.regexp_eatReverseSolidusAtomEscape=function(p){var S=p.pos;if(p.eat(92)){if(this.regexp_eatAtomEscape(p))return!0;p.pos=S}return!1},ve.regexp_eatUncapturingGroup=function(p){var S=p.pos;if(p.eat(40)){if(p.eat(63)){if(this.options.ecmaVersion>=16){var w=this.regexp_eatModifiers(p),A=p.eat(45);if(w||A){for(var B=0;B<w.length;B++){var W=w.charAt(B);w.indexOf(W,B+1)>-1&&p.raise("Duplicate regular expression modifiers")}if(A){var ee=this.regexp_eatModifiers(p);!w&&!ee&&p.current()===58&&p.raise("Invalid regular expression modifiers");for(var me=0;me<ee.length;me++){var ye=ee.charAt(me);(ee.indexOf(ye,me+1)>-1||w.indexOf(ye)>-1)&&p.raise("Duplicate regular expression modifiers")}}}}if(p.eat(58)){if(this.regexp_disjunction(p),p.eat(41))return!0;p.raise("Unterminated group")}}p.pos=S}return!1},ve.regexp_eatCapturingGroup=function(p){if(p.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(p):p.current()===63&&p.raise("Invalid group"),this.regexp_disjunction(p),p.eat(41))return p.numCapturingParens+=1,!0;p.raise("Unterminated group")}return!1},ve.regexp_eatModifiers=function(p){for(var S="",w=0;(w=p.current())!==-1&&pi(w);)S+=D(w),p.advance();return S};function pi(p){return p===105||p===109||p===115}ve.regexp_eatExtendedAtom=function(p){return p.eat(46)||this.regexp_eatReverseSolidusAtomEscape(p)||this.regexp_eatCharacterClass(p)||this.regexp_eatUncapturingGroup(p)||this.regexp_eatCapturingGroup(p)||this.regexp_eatInvalidBracedQuantifier(p)||this.regexp_eatExtendedPatternCharacter(p)},ve.regexp_eatInvalidBracedQuantifier=function(p){return this.regexp_eatBracedQuantifier(p,!0)&&p.raise("Nothing to repeat"),!1},ve.regexp_eatSyntaxCharacter=function(p){var S=p.current();return In(S)?(p.lastIntValue=S,p.advance(),!0):!1};function In(p){return p===36||p>=40&&p<=43||p===46||p===63||p>=91&&p<=94||p>=123&&p<=125}ve.regexp_eatPatternCharacters=function(p){for(var S=p.pos,w=0;(w=p.current())!==-1&&!In(w);)p.advance();return p.pos!==S},ve.regexp_eatExtendedPatternCharacter=function(p){var S=p.current();return S!==-1&&S!==36&&!(S>=40&&S<=43)&&S!==46&&S!==63&&S!==91&&S!==94&&S!==124?(p.advance(),!0):!1},ve.regexp_groupSpecifier=function(p){if(p.eat(63)){this.regexp_eatGroupName(p)||p.raise("Invalid group");var S=this.options.ecmaVersion>=16,w=p.groupNames[p.lastStringValue];if(w)if(S)for(var A=0,B=w;A<B.length;A+=1){var W=B[A];W.separatedFrom(p.branchID)||p.raise("Duplicate capture group name")}else p.raise("Duplicate capture group name");S?(w||(p.groupNames[p.lastStringValue]=[])).push(p.branchID):p.groupNames[p.lastStringValue]=!0}},ve.regexp_eatGroupName=function(p){if(p.lastStringValue="",p.eat(60)){if(this.regexp_eatRegExpIdentifierName(p)&&p.eat(62))return!0;p.raise("Invalid capture group name")}return!1},ve.regexp_eatRegExpIdentifierName=function(p){if(p.lastStringValue="",this.regexp_eatRegExpIdentifierStart(p)){for(p.lastStringValue+=D(p.lastIntValue);this.regexp_eatRegExpIdentifierPart(p);)p.lastStringValue+=D(p.lastIntValue);return!0}return!1},ve.regexp_eatRegExpIdentifierStart=function(p){var S=p.pos,w=this.options.ecmaVersion>=11,A=p.current(w);return p.advance(w),A===92&&this.regexp_eatRegExpUnicodeEscapeSequence(p,w)&&(A=p.lastIntValue),kp(A)?(p.lastIntValue=A,!0):(p.pos=S,!1)};function kp(p){return v(p,!0)||p===36||p===95}ve.regexp_eatRegExpIdentifierPart=function(p){var S=p.pos,w=this.options.ecmaVersion>=11,A=p.current(w);return p.advance(w),A===92&&this.regexp_eatRegExpUnicodeEscapeSequence(p,w)&&(A=p.lastIntValue),Zg(A)?(p.lastIntValue=A,!0):(p.pos=S,!1)};function Zg(p){return N(p,!0)||p===36||p===95||p===8204||p===8205}ve.regexp_eatAtomEscape=function(p){return this.regexp_eatBackReference(p)||this.regexp_eatCharacterClassEscape(p)||this.regexp_eatCharacterEscape(p)||p.switchN&&this.regexp_eatKGroupName(p)?!0:(p.switchU&&(p.current()===99&&p.raise("Invalid unicode escape"),p.raise("Invalid escape")),!1)},ve.regexp_eatBackReference=function(p){var S=p.pos;if(this.regexp_eatDecimalEscape(p)){var w=p.lastIntValue;if(p.switchU)return w>p.maxBackReference&&(p.maxBackReference=w),!0;if(w<=p.numCapturingParens)return!0;p.pos=S}return!1},ve.regexp_eatKGroupName=function(p){if(p.eat(107)){if(this.regexp_eatGroupName(p))return p.backReferenceNames.push(p.lastStringValue),!0;p.raise("Invalid named reference")}return!1},ve.regexp_eatCharacterEscape=function(p){return this.regexp_eatControlEscape(p)||this.regexp_eatCControlLetter(p)||this.regexp_eatZero(p)||this.regexp_eatHexEscapeSequence(p)||this.regexp_eatRegExpUnicodeEscapeSequence(p,!1)||!p.switchU&&this.regexp_eatLegacyOctalEscapeSequence(p)||this.regexp_eatIdentityEscape(p)},ve.regexp_eatCControlLetter=function(p){var S=p.pos;if(p.eat(99)){if(this.regexp_eatControlLetter(p))return!0;p.pos=S}return!1},ve.regexp_eatZero=function(p){return p.current()===48&&!mi(p.lookahead())?(p.lastIntValue=0,p.advance(),!0):!1},ve.regexp_eatControlEscape=function(p){var S=p.current();return S===116?(p.lastIntValue=9,p.advance(),!0):S===110?(p.lastIntValue=10,p.advance(),!0):S===118?(p.lastIntValue=11,p.advance(),!0):S===102?(p.lastIntValue=12,p.advance(),!0):S===114?(p.lastIntValue=13,p.advance(),!0):!1},ve.regexp_eatControlLetter=function(p){var S=p.current();return Al(S)?(p.lastIntValue=S%32,p.advance(),!0):!1};function Al(p){return p>=65&&p<=90||p>=97&&p<=122}ve.regexp_eatRegExpUnicodeEscapeSequence=function(p,S){S===void 0&&(S=!1);var w=p.pos,A=S||p.switchU;if(p.eat(117)){if(this.regexp_eatFixedHexDigits(p,4)){var B=p.lastIntValue;if(A&&B>=55296&&B<=56319){var W=p.pos;if(p.eat(92)&&p.eat(117)&&this.regexp_eatFixedHexDigits(p,4)){var ee=p.lastIntValue;if(ee>=56320&&ee<=57343)return p.lastIntValue=(B-55296)*1024+(ee-56320)+65536,!0}p.pos=W,p.lastIntValue=B}return!0}if(A&&p.eat(123)&&this.regexp_eatHexDigits(p)&&p.eat(125)&&vp(p.lastIntValue))return!0;A&&p.raise("Invalid unicode escape"),p.pos=w}return!1};function vp(p){return p>=0&&p<=1114111}ve.regexp_eatIdentityEscape=function(p){if(p.switchU)return this.regexp_eatSyntaxCharacter(p)?!0:p.eat(47)?(p.lastIntValue=47,!0):!1;var S=p.current();return S!==99&&(!p.switchN||S!==107)?(p.lastIntValue=S,p.advance(),!0):!1},ve.regexp_eatDecimalEscape=function(p){p.lastIntValue=0;var S=p.current();if(S>=49&&S<=57){do p.lastIntValue=10*p.lastIntValue+(S-48),p.advance();while((S=p.current())>=48&&S<=57);return!0}return!1};var io=0,di=1,Tt=2;ve.regexp_eatCharacterClassEscape=function(p){var S=p.current();if(nc(S))return p.lastIntValue=-1,p.advance(),di;var w=!1;if(p.switchU&&this.options.ecmaVersion>=9&&((w=S===80)||S===112)){p.lastIntValue=-1,p.advance();var A;if(p.eat(123)&&(A=this.regexp_eatUnicodePropertyValueExpression(p))&&p.eat(125))return w&&A===Tt&&p.raise("Invalid property name"),A;p.raise("Invalid property name")}return io};function nc(p){return p===100||p===68||p===115||p===83||p===119||p===87}ve.regexp_eatUnicodePropertyValueExpression=function(p){var S=p.pos;if(this.regexp_eatUnicodePropertyName(p)&&p.eat(61)){var w=p.lastStringValue;if(this.regexp_eatUnicodePropertyValue(p)){var A=p.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(p,w,A),di}}if(p.pos=S,this.regexp_eatLoneUnicodePropertyNameOrValue(p)){var B=p.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(p,B)}return io},ve.regexp_validateUnicodePropertyNameAndValue=function(p,S,w){X(p.unicodeProperties.nonBinary,S)||p.raise("Invalid property name"),p.unicodeProperties.nonBinary[S].test(w)||p.raise("Invalid property value")},ve.regexp_validateUnicodePropertyNameOrValue=function(p,S){if(p.unicodeProperties.binary.test(S))return di;if(p.switchV&&p.unicodeProperties.binaryOfStrings.test(S))return Tt;p.raise("Invalid property name")},ve.regexp_eatUnicodePropertyName=function(p){var S=0;for(p.lastStringValue="";rc(S=p.current());)p.lastStringValue+=D(S),p.advance();return p.lastStringValue!==""};function rc(p){return Al(p)||p===95}ve.regexp_eatUnicodePropertyValue=function(p){var S=0;for(p.lastStringValue="";ic(S=p.current());)p.lastStringValue+=D(S),p.advance();return p.lastStringValue!==""};function ic(p){return rc(p)||mi(p)}ve.regexp_eatLoneUnicodePropertyNameOrValue=function(p){return this.regexp_eatUnicodePropertyValue(p)},ve.regexp_eatCharacterClass=function(p){if(p.eat(91)){var S=p.eat(94),w=this.regexp_classContents(p);return p.eat(93)||p.raise("Unterminated character class"),S&&w===Tt&&p.raise("Negated character class may contain strings"),!0}return!1},ve.regexp_classContents=function(p){return p.current()===93?di:p.switchV?this.regexp_classSetExpression(p):(this.regexp_nonEmptyClassRanges(p),di)},ve.regexp_nonEmptyClassRanges=function(p){for(;this.regexp_eatClassAtom(p);){var S=p.lastIntValue;if(p.eat(45)&&this.regexp_eatClassAtom(p)){var w=p.lastIntValue;p.switchU&&(S===-1||w===-1)&&p.raise("Invalid character class"),S!==-1&&w!==-1&&S>w&&p.raise("Range out of order in character class")}}},ve.regexp_eatClassAtom=function(p){var S=p.pos;if(p.eat(92)){if(this.regexp_eatClassEscape(p))return!0;if(p.switchU){var w=p.current();(w===99||ac(w))&&p.raise("Invalid class escape"),p.raise("Invalid escape")}p.pos=S}var A=p.current();return A!==93?(p.lastIntValue=A,p.advance(),!0):!1},ve.regexp_eatClassEscape=function(p){var S=p.pos;if(p.eat(98))return p.lastIntValue=8,!0;if(p.switchU&&p.eat(45))return p.lastIntValue=45,!0;if(!p.switchU&&p.eat(99)){if(this.regexp_eatClassControlLetter(p))return!0;p.pos=S}return this.regexp_eatCharacterClassEscape(p)||this.regexp_eatCharacterEscape(p)},ve.regexp_classSetExpression=function(p){var S=di,w;if(!this.regexp_eatClassSetRange(p))if(w=this.regexp_eatClassSetOperand(p)){w===Tt&&(S=Tt);for(var A=p.pos;p.eatChars([38,38]);){if(p.current()!==38&&(w=this.regexp_eatClassSetOperand(p))){w!==Tt&&(S=di);continue}p.raise("Invalid character in character class")}if(A!==p.pos)return S;for(;p.eatChars([45,45]);)this.regexp_eatClassSetOperand(p)||p.raise("Invalid character in character class");if(A!==p.pos)return S}else p.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(p)){if(w=this.regexp_eatClassSetOperand(p),!w)return S;w===Tt&&(S=Tt)}},ve.regexp_eatClassSetRange=function(p){var S=p.pos;if(this.regexp_eatClassSetCharacter(p)){var w=p.lastIntValue;if(p.eat(45)&&this.regexp_eatClassSetCharacter(p)){var A=p.lastIntValue;return w!==-1&&A!==-1&&w>A&&p.raise("Range out of order in character class"),!0}p.pos=S}return!1},ve.regexp_eatClassSetOperand=function(p){return this.regexp_eatClassSetCharacter(p)?di:this.regexp_eatClassStringDisjunction(p)||this.regexp_eatNestedClass(p)},ve.regexp_eatNestedClass=function(p){var S=p.pos;if(p.eat(91)){var w=p.eat(94),A=this.regexp_classContents(p);if(p.eat(93))return w&&A===Tt&&p.raise("Negated character class may contain strings"),A;p.pos=S}if(p.eat(92)){var B=this.regexp_eatCharacterClassEscape(p);if(B)return B;p.pos=S}return null},ve.regexp_eatClassStringDisjunction=function(p){var S=p.pos;if(p.eatChars([92,113])){if(p.eat(123)){var w=this.regexp_classStringDisjunctionContents(p);if(p.eat(125))return w}else p.raise("Invalid escape");p.pos=S}return null},ve.regexp_classStringDisjunctionContents=function(p){for(var S=this.regexp_classString(p);p.eat(124);)this.regexp_classString(p)===Tt&&(S=Tt);return S},ve.regexp_classString=function(p){for(var S=0;this.regexp_eatClassSetCharacter(p);)S++;return S===1?di:Tt},ve.regexp_eatClassSetCharacter=function(p){var S=p.pos;if(p.eat(92))return this.regexp_eatCharacterEscape(p)||this.regexp_eatClassSetReservedPunctuator(p)?!0:p.eat(98)?(p.lastIntValue=8,!0):(p.pos=S,!1);var w=p.current();return w<0||w===p.lookahead()&&Ys(w)||Cp(w)?!1:(p.advance(),p.lastIntValue=w,!0)};function Ys(p){return p===33||p>=35&&p<=38||p>=42&&p<=44||p===46||p>=58&&p<=64||p===94||p===96||p===126}function Cp(p){return p===40||p===41||p===45||p===47||p>=91&&p<=93||p>=123&&p<=125}ve.regexp_eatClassSetReservedPunctuator=function(p){var S=p.current();return wp(S)?(p.lastIntValue=S,p.advance(),!0):!1};function wp(p){return p===33||p===35||p===37||p===38||p===44||p===45||p>=58&&p<=62||p===64||p===96||p===126}ve.regexp_eatClassControlLetter=function(p){var S=p.current();return mi(S)||S===95?(p.lastIntValue=S%32,p.advance(),!0):!1},ve.regexp_eatHexEscapeSequence=function(p){var S=p.pos;if(p.eat(120)){if(this.regexp_eatFixedHexDigits(p,2))return!0;p.switchU&&p.raise("Invalid escape"),p.pos=S}return!1},ve.regexp_eatDecimalDigits=function(p){var S=p.pos,w=0;for(p.lastIntValue=0;mi(w=p.current());)p.lastIntValue=10*p.lastIntValue+(w-48),p.advance();return p.pos!==S};function mi(p){return p>=48&&p<=57}ve.regexp_eatHexDigits=function(p){var S=p.pos,w=0;for(p.lastIntValue=0;Ep(w=p.current());)p.lastIntValue=16*p.lastIntValue+sc(w),p.advance();return p.pos!==S};function Ep(p){return p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102}function sc(p){return p>=65&&p<=70?10+(p-65):p>=97&&p<=102?10+(p-97):p-48}ve.regexp_eatLegacyOctalEscapeSequence=function(p){if(this.regexp_eatOctalDigit(p)){var S=p.lastIntValue;if(this.regexp_eatOctalDigit(p)){var w=p.lastIntValue;S<=3&&this.regexp_eatOctalDigit(p)?p.lastIntValue=S*64+w*8+p.lastIntValue:p.lastIntValue=S*8+w}else p.lastIntValue=S;return!0}return!1},ve.regexp_eatOctalDigit=function(p){var S=p.current();return ac(S)?(p.lastIntValue=S-48,p.advance(),!0):(p.lastIntValue=0,!1)};function ac(p){return p>=48&&p<=55}ve.regexp_eatFixedHexDigits=function(p,S){var w=p.pos;p.lastIntValue=0;for(var A=0;A<S;++A){var B=p.current();if(!Ep(B))return p.pos=w,!1;p.lastIntValue=16*p.lastIntValue+sc(B),p.advance()}return!0};var Ws=function(S){this.type=S.type,this.value=S.value,this.start=S.start,this.end=S.end,S.options.locations&&(this.loc=new V(S,S.startLoc,S.endLoc)),S.options.ranges&&(this.range=[S.start,S.end])},Qe=_.prototype;Qe.next=function(p){!p&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Ws(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},Qe.getToken=function(){return this.next(),new Ws(this)},typeof Symbol<"u"&&(Qe[Symbol.iterator]=function(){var p=this;return{next:function(){var S=p.getToken();return{done:S.type===C.eof,value:S}}}}),Qe.nextToken=function(){var p=this.curContext();if((!p||!p.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(C.eof);if(p.override)return p.override(this);this.readToken(this.fullCharCodeAtPos())},Qe.readToken=function(p){return v(p,this.options.ecmaVersion>=6)||p===92?this.readWord():this.getTokenFromCode(p)},Qe.fullCharCodeAt=function(p){var S=this.input.charCodeAt(p);if(S<=55295||S>=56320)return S;var w=this.input.charCodeAt(p+1);return w<=56319||w>=57344?S:(S<<10)+w-56613888},Qe.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},Qe.skipBlockComment=function(){var p=this.options.onComment&&this.curPosition(),S=this.pos,w=this.input.indexOf("*/",this.pos+=2);if(w===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=w+2,this.options.locations)for(var A=void 0,B=S;(A=K(this.input,B,this.pos))>-1;)++this.curLine,B=this.lineStart=A;this.options.onComment&&this.options.onComment(!0,this.input.slice(S+2,w),S,this.pos,p,this.curPosition())},Qe.skipLineComment=function(p){for(var S=this.pos,w=this.options.onComment&&this.curPosition(),A=this.input.charCodeAt(this.pos+=p);this.pos<this.input.length&&!ie(A);)A=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(S+p,this.pos),S,this.pos,w,this.curPosition())},Qe.skipSpace=function(){e:for(;this.pos<this.input.length;){var p=this.input.charCodeAt(this.pos);switch(p){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(p>8&&p<14||p>=5760&&pe.test(String.fromCharCode(p)))++this.pos;else break e}}},Qe.finishToken=function(p,S){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var w=this.type;this.type=p,this.value=S,this.updateContext(w)},Qe.readToken_dot=function(){var p=this.input.charCodeAt(this.pos+1);if(p>=48&&p<=57)return this.readNumber(!0);var S=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&p===46&&S===46?(this.pos+=3,this.finishToken(C.ellipsis)):(++this.pos,this.finishToken(C.dot))},Qe.readToken_slash=function(){var p=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):p===61?this.finishOp(C.assign,2):this.finishOp(C.slash,1)},Qe.readToken_mult_modulo_exp=function(p){var S=this.input.charCodeAt(this.pos+1),w=1,A=p===42?C.star:C.modulo;return this.options.ecmaVersion>=7&&p===42&&S===42&&(++w,A=C.starstar,S=this.input.charCodeAt(this.pos+2)),S===61?this.finishOp(C.assign,w+1):this.finishOp(A,w)},Qe.readToken_pipe_amp=function(p){var S=this.input.charCodeAt(this.pos+1);if(S===p){if(this.options.ecmaVersion>=12){var w=this.input.charCodeAt(this.pos+2);if(w===61)return this.finishOp(C.assign,3)}return this.finishOp(p===124?C.logicalOR:C.logicalAND,2)}return S===61?this.finishOp(C.assign,2):this.finishOp(p===124?C.bitwiseOR:C.bitwiseAND,1)},Qe.readToken_caret=function(){var p=this.input.charCodeAt(this.pos+1);return p===61?this.finishOp(C.assign,2):this.finishOp(C.bitwiseXOR,1)},Qe.readToken_plus_min=function(p){var S=this.input.charCodeAt(this.pos+1);return S===p?S===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||z.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(C.incDec,2):S===61?this.finishOp(C.assign,2):this.finishOp(C.plusMin,1)},Qe.readToken_lt_gt=function(p){var S=this.input.charCodeAt(this.pos+1),w=1;return S===p?(w=p===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+w)===61?this.finishOp(C.assign,w+1):this.finishOp(C.bitShift,w)):S===33&&p===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(S===61&&(w=2),this.finishOp(C.relational,w))},Qe.readToken_eq_excl=function(p){var S=this.input.charCodeAt(this.pos+1);return S===61?this.finishOp(C.equality,this.input.charCodeAt(this.pos+2)===61?3:2):p===61&&S===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(C.arrow)):this.finishOp(p===61?C.eq:C.prefix,1)},Qe.readToken_question=function(){var p=this.options.ecmaVersion;if(p>=11){var S=this.input.charCodeAt(this.pos+1);if(S===46){var w=this.input.charCodeAt(this.pos+2);if(w<48||w>57)return this.finishOp(C.questionDot,2)}if(S===63){if(p>=12){var A=this.input.charCodeAt(this.pos+2);if(A===61)return this.finishOp(C.assign,3)}return this.finishOp(C.coalesce,2)}}return this.finishOp(C.question,1)},Qe.readToken_numberSign=function(){var p=this.options.ecmaVersion,S=35;if(p>=13&&(++this.pos,S=this.fullCharCodeAtPos(),v(S,!0)||S===92))return this.finishToken(C.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+D(S)+"'")},Qe.getTokenFromCode=function(p){switch(p){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(C.parenL);case 41:return++this.pos,this.finishToken(C.parenR);case 59:return++this.pos,this.finishToken(C.semi);case 44:return++this.pos,this.finishToken(C.comma);case 91:return++this.pos,this.finishToken(C.bracketL);case 93:return++this.pos,this.finishToken(C.bracketR);case 123:return++this.pos,this.finishToken(C.braceL);case 125:return++this.pos,this.finishToken(C.braceR);case 58:return++this.pos,this.finishToken(C.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(C.backQuote);case 48:var S=this.input.charCodeAt(this.pos+1);if(S===120||S===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(S===111||S===79)return this.readRadixNumber(8);if(S===98||S===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(p);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(p);case 124:case 38:return this.readToken_pipe_amp(p);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(p);case 60:case 62:return this.readToken_lt_gt(p);case 61:case 33:return this.readToken_eq_excl(p);case 63:return this.readToken_question();case 126:return this.finishOp(C.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+D(p)+"'")},Qe.finishOp=function(p,S){var w=this.input.slice(this.pos,this.pos+S);return this.pos+=S,this.finishToken(p,w)},Qe.readRegexp=function(){for(var p,S,w=this.pos;;){this.pos>=this.input.length&&this.raise(w,"Unterminated regular expression");var A=this.input.charAt(this.pos);if(z.test(A)&&this.raise(w,"Unterminated regular expression"),p)p=!1;else{if(A==="[")S=!0;else if(A==="]"&&S)S=!1;else if(A==="/"&&!S)break;p=A==="\\"}++this.pos}var B=this.input.slice(w,this.pos);++this.pos;var W=this.pos,ee=this.readWord1();this.containsEsc&&this.unexpected(W);var me=this.regexpState||(this.regexpState=new Dn(this));me.reset(w,B,ee),this.validateRegExpFlags(me),this.validateRegExpPattern(me);var ye=null;try{ye=new RegExp(B,ee)}catch{}return this.finishToken(C.regexp,{pattern:B,flags:ee,value:ye})},Qe.readInt=function(p,S,w){for(var A=this.options.ecmaVersion>=12&&S===void 0,B=w&&this.input.charCodeAt(this.pos)===48,W=this.pos,ee=0,me=0,ye=0,Le=S??1/0;ye<Le;++ye,++this.pos){var qe=this.input.charCodeAt(this.pos),yt=void 0;if(A&&qe===95){B&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),me===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),ye===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),me=qe;continue}if(qe>=97?yt=qe-97+10:qe>=65?yt=qe-65+10:qe>=48&&qe<=57?yt=qe-48:yt=1/0,yt>=p)break;me=qe,ee=ee*p+yt}return A&&me===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===W||S!=null&&this.pos-W!==S?null:ee};function e0(p,S){return S?parseInt(p,8):parseFloat(p.replace(/_/g,""))}function so(p){return typeof BigInt!="function"?null:BigInt(p.replace(/_/g,""))}Qe.readRadixNumber=function(p){var S=this.pos;this.pos+=2;var w=this.readInt(p);return w==null&&this.raise(this.start+2,"Expected number in radix "+p),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(w=so(this.input.slice(S,this.pos)),++this.pos):v(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(C.num,w)},Qe.readNumber=function(p){var S=this.pos;!p&&this.readInt(10,void 0,!0)===null&&this.raise(S,"Invalid number");var w=this.pos-S>=2&&this.input.charCodeAt(S)===48;w&&this.strict&&this.raise(S,"Invalid number");var A=this.input.charCodeAt(this.pos);if(!w&&!p&&this.options.ecmaVersion>=11&&A===110){var B=so(this.input.slice(S,this.pos));return++this.pos,v(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(C.num,B)}w&&/[89]/.test(this.input.slice(S,this.pos))&&(w=!1),A===46&&!w&&(++this.pos,this.readInt(10),A=this.input.charCodeAt(this.pos)),(A===69||A===101)&&!w&&(A=this.input.charCodeAt(++this.pos),(A===43||A===45)&&++this.pos,this.readInt(10)===null&&this.raise(S,"Invalid number")),v(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var W=e0(this.input.slice(S,this.pos),w);return this.finishToken(C.num,W)},Qe.readCodePoint=function(){var p=this.input.charCodeAt(this.pos),S;if(p===123){this.options.ecmaVersion<6&&this.unexpected();var w=++this.pos;S=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,S>1114111&&this.invalidStringToken(w,"Code point out of bounds")}else S=this.readHexChar(4);return S},Qe.readString=function(p){for(var S="",w=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var A=this.input.charCodeAt(this.pos);if(A===p)break;A===92?(S+=this.input.slice(w,this.pos),S+=this.readEscapedChar(!1),w=this.pos):A===8232||A===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(ie(A)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return S+=this.input.slice(w,this.pos++),this.finishToken(C.string,S)};var _r={};Qe.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(p){if(p===_r)this.readInvalidTemplateToken();else throw p}this.inTemplateElement=!1},Qe.invalidStringToken=function(p,S){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw _r;this.raise(p,S)},Qe.readTmplToken=function(){for(var p="",S=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var w=this.input.charCodeAt(this.pos);if(w===96||w===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===C.template||this.type===C.invalidTemplate)?w===36?(this.pos+=2,this.finishToken(C.dollarBraceL)):(++this.pos,this.finishToken(C.backQuote)):(p+=this.input.slice(S,this.pos),this.finishToken(C.template,p));if(w===92)p+=this.input.slice(S,this.pos),p+=this.readEscapedChar(!0),S=this.pos;else if(ie(w)){switch(p+=this.input.slice(S,this.pos),++this.pos,w){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:p+=`
82
+ `;break;default:p+=String.fromCharCode(w);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),S=this.pos}else++this.pos}},Qe.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(C.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
83
+ `&&++this.pos;case`
84
+ `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},Qe.readEscapedChar=function(p){var S=this.input.charCodeAt(++this.pos);switch(++this.pos,S){case 110:return`
85
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return D(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),p){var w=this.pos-1;this.invalidStringToken(w,"Invalid escape sequence in template string")}default:if(S>=48&&S<=55){var A=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],B=parseInt(A,8);return B>255&&(A=A.slice(0,-1),B=parseInt(A,8)),this.pos+=A.length-1,S=this.input.charCodeAt(this.pos),(A!=="0"||S===56||S===57)&&(this.strict||p)&&this.invalidStringToken(this.pos-1-A.length,p?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(B)}return ie(S)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(S)}},Qe.readHexChar=function(p){var S=this.pos,w=this.readInt(16,p);return w===null&&this.invalidStringToken(S,"Bad character escape sequence"),w},Qe.readWord1=function(){this.containsEsc=!1;for(var p="",S=!0,w=this.pos,A=this.options.ecmaVersion>=6;this.pos<this.input.length;){var B=this.fullCharCodeAtPos();if(N(B,A))this.pos+=B<=65535?1:2;else if(B===92){this.containsEsc=!0,p+=this.input.slice(w,this.pos);var W=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var ee=this.readCodePoint();(S?v:N)(ee,A)||this.invalidStringToken(W,"Invalid Unicode escape"),p+=D(ee),w=this.pos}else break;S=!1}return p+this.input.slice(w,this.pos)},Qe.readWord=function(){var p=this.readWord1(),S=C.name;return this.keywords.test(p)&&(S=J[p]),this.finishToken(S,p)};var Tl="8.16.0";_.acorn={Parser:_,version:Tl,defaultOptions:Oe,Position:Q,SourceLocation:V,getLineInfo:xe,Node:qs,TokenType:T,tokTypes:C,keywordTypes:J,TokContext:Jt,tokContexts:gt,isIdentifierChar:N,isIdentifierStart:v,Token:Ws,isNewLine:ie,lineBreak:z,lineBreakG:q,nonASCIIwhitespace:pe};function oc(p,S){return _.parse(p,S)}function Xs(p,S,w){return _.parseExpressionAt(p,S,w)}function Qs(p,S){return _.tokenizer(p,S)}n.Node=qs,n.Parser=_,n.Position=Q,n.SourceLocation=V,n.TokContext=Jt,n.Token=Ws,n.TokenType=T,n.defaultOptions=Oe,n.getLineInfo=xe,n.isIdentifierChar=N,n.isIdentifierStart=v,n.isNewLine=ie,n.keywordTypes=J,n.lineBreak=z,n.lineBreakG=q,n.nonASCIIwhitespace=pe,n.parse=oc,n.parseExpressionAt=Xs,n.tokContexts=gt,n.tokTypes=C,n.tokenizer=Qs,n.version=Tl}))})(Vf,Vf.exports)),Vf.exports}var WA;function tK(){return WA||(WA=1,(function(t){const e=Zq(),n=/^[\da-fA-F]+$/,r=/^\d+$/,i=new WeakMap;function s(c){c=c.Parser.acorn||c;let h=i.get(c);if(!h){const m=c.tokTypes,g=c.TokContext,y=c.TokenType,b=new g("<tag",!1),v=new g("</tag",!1),N=new g("<tag>...</tag>",!0,!0),T={tc_oTag:b,tc_cTag:v,tc_expr:N},M={jsxName:new y("jsxName"),jsxText:new y("jsxText",{beforeExpr:!0}),jsxTagStart:new y("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new y("jsxTagEnd")};M.jsxTagStart.updateContext=function(){this.context.push(N),this.context.push(b),this.exprAllowed=!1},M.jsxTagEnd.updateContext=function(j){let P=this.context.pop();P===b&&j===m.slash||P===v?(this.context.pop(),this.exprAllowed=this.curContext()===N):this.exprAllowed=!0},h={tokContexts:T,tokTypes:M},i.set(c,h)}return h}function o(c){if(!c)return c;if(c.type==="JSXIdentifier")return c.name;if(c.type==="JSXNamespacedName")return c.namespace.name+":"+c.name.name;if(c.type==="JSXMemberExpression")return o(c.object)+"."+o(c.property)}t.exports=function(c){return c=c||{},function(h){return u({allowNamespaces:c.allowNamespaces!==!1,allowNamespacedObjects:!!c.allowNamespacedObjects},h)}},Object.defineProperty(t.exports,"tokTypes",{get:function(){return s(YA()).tokTypes},configurable:!0,enumerable:!0});function u(c,h){const m=h.acorn||YA(),g=s(m),y=m.tokTypes,b=g.tokTypes,v=m.tokContexts,N=g.tokContexts.tc_oTag,T=g.tokContexts.tc_cTag,M=g.tokContexts.tc_expr,j=m.isNewLine,P=m.isIdentifierStart,J=m.isIdentifierChar;return class extends h{static get acornJsx(){return g}jsx_readToken(){let L="",C=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");let z=this.input.charCodeAt(this.pos);switch(z){case 60:case 123:return this.pos===this.start?z===60&&this.exprAllowed?(++this.pos,this.finishToken(b.jsxTagStart)):this.getTokenFromCode(z):(L+=this.input.slice(C,this.pos),this.finishToken(b.jsxText,L));case 38:L+=this.input.slice(C,this.pos),L+=this.jsx_readEntity(),C=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(z===62?"&gt;":"&rbrace;")+'` or `{"'+this.input[this.pos]+'"}`?');default:j(z)?(L+=this.input.slice(C,this.pos),L+=this.jsx_readNewLine(!0),C=this.pos):++this.pos}}}jsx_readNewLine(L){let C=this.input.charCodeAt(this.pos),z;return++this.pos,C===13&&this.input.charCodeAt(this.pos)===10?(++this.pos,z=L?`
86
+ `:`\r
87
+ `):z=String.fromCharCode(C),this.options.locations&&(++this.curLine,this.lineStart=this.pos),z}jsx_readString(L){let C="",z=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let q=this.input.charCodeAt(this.pos);if(q===L)break;q===38?(C+=this.input.slice(z,this.pos),C+=this.jsx_readEntity(),z=this.pos):j(q)?(C+=this.input.slice(z,this.pos),C+=this.jsx_readNewLine(!1),z=this.pos):++this.pos}return C+=this.input.slice(z,this.pos++),this.finishToken(y.string,C)}jsx_readEntity(){let L="",C=0,z,q=this.input[this.pos];q!=="&"&&this.raise(this.pos,"Entity must start with an ampersand");let ie=++this.pos;for(;this.pos<this.input.length&&C++<10;){if(q=this.input[this.pos++],q===";"){L[0]==="#"?L[1]==="x"?(L=L.substr(2),n.test(L)&&(z=String.fromCharCode(parseInt(L,16)))):(L=L.substr(1),r.test(L)&&(z=String.fromCharCode(parseInt(L,10)))):z=e[L];break}L+=q}return z||(this.pos=ie,"&")}jsx_readWord(){let L,C=this.pos;do L=this.input.charCodeAt(++this.pos);while(J(L)||L===45);return this.finishToken(b.jsxName,this.input.slice(C,this.pos))}jsx_parseIdentifier(){let L=this.startNode();return this.type===b.jsxName?L.name=this.value:this.type.keyword?L.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(L,"JSXIdentifier")}jsx_parseNamespacedName(){let L=this.start,C=this.startLoc,z=this.jsx_parseIdentifier();if(!c.allowNamespaces||!this.eat(y.colon))return z;var q=this.startNodeAt(L,C);return q.namespace=z,q.name=this.jsx_parseIdentifier(),this.finishNode(q,"JSXNamespacedName")}jsx_parseElementName(){if(this.type===b.jsxTagEnd)return"";let L=this.start,C=this.startLoc,z=this.jsx_parseNamespacedName();for(this.type===y.dot&&z.type==="JSXNamespacedName"&&!c.allowNamespacedObjects&&this.unexpected();this.eat(y.dot);){let q=this.startNodeAt(L,C);q.object=z,q.property=this.jsx_parseIdentifier(),z=this.finishNode(q,"JSXMemberExpression")}return z}jsx_parseAttributeValue(){switch(this.type){case y.braceL:let L=this.jsx_parseExpressionContainer();return L.expression.type==="JSXEmptyExpression"&&this.raise(L.start,"JSX attributes must only be assigned a non-empty expression"),L;case b.jsxTagStart:case y.string:return this.parseExprAtom();default:this.raise(this.start,"JSX value should be either an expression or a quoted JSX text")}}jsx_parseEmptyExpression(){let L=this.startNodeAt(this.lastTokEnd,this.lastTokEndLoc);return this.finishNodeAt(L,"JSXEmptyExpression",this.start,this.startLoc)}jsx_parseExpressionContainer(){let L=this.startNode();return this.next(),L.expression=this.type===y.braceR?this.jsx_parseEmptyExpression():this.parseExpression(),this.expect(y.braceR),this.finishNode(L,"JSXExpressionContainer")}jsx_parseAttribute(){let L=this.startNode();return this.eat(y.braceL)?(this.expect(y.ellipsis),L.argument=this.parseMaybeAssign(),this.expect(y.braceR),this.finishNode(L,"JSXSpreadAttribute")):(L.name=this.jsx_parseNamespacedName(),L.value=this.eat(y.eq)?this.jsx_parseAttributeValue():null,this.finishNode(L,"JSXAttribute"))}jsx_parseOpeningElementAt(L,C){let z=this.startNodeAt(L,C);z.attributes=[];let q=this.jsx_parseElementName();for(q&&(z.name=q);this.type!==y.slash&&this.type!==b.jsxTagEnd;)z.attributes.push(this.jsx_parseAttribute());return z.selfClosing=this.eat(y.slash),this.expect(b.jsxTagEnd),this.finishNode(z,q?"JSXOpeningElement":"JSXOpeningFragment")}jsx_parseClosingElementAt(L,C){let z=this.startNodeAt(L,C),q=this.jsx_parseElementName();return q&&(z.name=q),this.expect(b.jsxTagEnd),this.finishNode(z,q?"JSXClosingElement":"JSXClosingFragment")}jsx_parseElementAt(L,C){let z=this.startNodeAt(L,C),q=[],ie=this.jsx_parseOpeningElementAt(L,C),K=null;if(!ie.selfClosing){e:for(;;)switch(this.type){case b.jsxTagStart:if(L=this.start,C=this.startLoc,this.next(),this.eat(y.slash)){K=this.jsx_parseClosingElementAt(L,C);break e}q.push(this.jsx_parseElementAt(L,C));break;case b.jsxText:q.push(this.parseExprAtom());break;case y.braceL:q.push(this.jsx_parseExpressionContainer());break;default:this.unexpected()}o(K.name)!==o(ie.name)&&this.raise(K.start,"Expected corresponding JSX closing tag for <"+o(ie.name)+">")}let pe=ie.name?"Element":"Fragment";return z["opening"+pe]=ie,z["closing"+pe]=K,z.children=q,this.type===y.relational&&this.value==="<"&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(z,"JSX"+pe)}jsx_parseText(){let L=this.parseLiteral(this.value);return L.type="JSXText",L}jsx_parseElement(){let L=this.start,C=this.startLoc;return this.next(),this.jsx_parseElementAt(L,C)}parseExprAtom(L){return this.type===b.jsxText?this.jsx_parseText():this.type===b.jsxTagStart?this.jsx_parseElement():super.parseExprAtom(L)}readToken(L){let C=this.curContext();if(C===M)return this.jsx_readToken();if(C===N||C===T){if(P(L))return this.jsx_readWord();if(L==62)return++this.pos,this.finishToken(b.jsxTagEnd);if((L===34||L===39)&&C==N)return this.jsx_readString(L)}return L===60&&this.exprAllowed&&this.input.charCodeAt(this.pos+1)!==33?(++this.pos,this.finishToken(b.jsxTagStart)):super.readToken(L)}updateContext(L){if(this.type==y.braceL){var C=this.curContext();C==N?this.context.push(v.b_expr):C==M?this.context.push(v.b_tmpl):super.updateContext(L),this.exprAllowed=!0}else if(this.type===y.slash&&L===b.jsxTagStart)this.context.length-=2,this.context.push(T),this.exprAllowed=!1;else return super.updateContext(L)}}}})(dx)),dx.exports}var nK=tK();const rK=xT(nK);const iK={}.hasOwnProperty,sK=Symbol("continue"),gx=Symbol("exit"),aK=Symbol("skip");function oK(t,e){let n,r;typeof e=="function"?n=e:e&&typeof e=="object"&&(e.enter&&(n=e.enter),e.leave&&(r=e.leave)),i(t,void 0,void 0,[])();function i(s,o,u,c){return yx(s)&&(h.displayName="node ("+s.type+")"),h;function h(){const m=n?XA(n(s,o,u,c)):[];if(m[0]===gx)return m;if(m[0]!==aK){let g;for(g in s)if(iK.call(s,g)&&s[g]&&typeof s[g]=="object"&&g!=="data"&&g!=="position"){const y=c.concat(s),b=s[g];if(Array.isArray(b)){const v=b;let N=0;for(;N>-1&&N<v.length;){const T=v[N];if(yx(T)){const M=i(T,g,N,y)();if(M[0]===gx)return M;N=typeof M[1]=="number"?M[1]:N+1}else N++}}else if(yx(b)){const v=i(b,g,void 0,y)();if(v[0]===gx)return v}}}return r?XA(r(s,o,u,c)):m}}}function XA(t){return Array.isArray(t)?t:typeof t=="number"?[sK,t]:[t]}function yx(t){return!!(t&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.length>0)}function l_(t,e){const n=e.prefix||"",r=e.suffix||"",i=Object.assign({},e.acornOptions),s=[],o=[],u=i.onComment,c=i.onToken;let h=!1,m,g;const y=Object.assign({},i,{onComment:s,preserveParens:!0});c&&(y.onToken=o);const b=lK(t,e.tokenTypes),v=b.value,N=n+v+r,T=e.expression&&QA(v);if(T&&!e.allowEmpty)throw new mt("Unexpected empty expression",{place:j(0),ruleId:"unexpected-empty-expression",source:"micromark-extension-mdx-expression"});try{m=e.expression&&!T?e.acorn.parseExpressionAt(N,0,y):e.acorn.parse(N,y)}catch(P){const J=P,L=j(J.pos);J.message=String(J.message).replace(/ \(\d+:\d+\)$/,""),J.pos=L.offset,J.loc={line:L.line,column:L.column-1},g=J,h=J.raisedAt>=n.length+v.length||J.message==="Unterminated comment"}if(m&&e.expression&&!T)if(QA(N.slice(m.end,N.length-r.length)))m={type:"Program",start:0,end:n.length+v.length,body:[{type:"ExpressionStatement",expression:m,start:0,end:n.length+v.length}],sourceType:"module",comments:[]};else{const P=j(m.end),J=new Error("Unexpected content after expression");J.pos=P.offset,J.loc={line:P.line,column:P.column-1},g=J,m=void 0}if(m){if(m.comments=s,oK(m,function(P,J,L,C){let z=C[C.length-1],q=J;P.type==="ParenthesizedExpression"&&z&&q&&(typeof L=="number"&&(z=z[q],q=L),z[q]=P.expression),M(P)}),Array.isArray(u))u.push(...s);else if(typeof u=="function")for(const P of s)u(P.type==="Block",P.value,P.start,P.end,P.loc.start,P.loc.end);for(const P of o)P.end<=n.length||P.start-n.length>=v.length||(M(P),Array.isArray(c)?c.push(P):c(P))}return{estree:m,error:g,swallow:h};function M(P){const J=j(P.start),L=j(P.end);P.start=J.offset,P.end=L.offset,P.loc={start:{line:J.line,column:J.column-1,offset:J.offset},end:{line:L.line,column:L.column-1,offset:L.offset}},P.range=[P.start,P.end]}function j(P){let J=P-n.length;J<0?J=0:J>v.length&&(J=v.length);let L=uK(b.stops,J);return L||(L={line:e.start.line,column:e.start.column,offset:e.start.offset}),L}}function QA(t){return/^\s*$/.test(t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\r\n]*(\r\n|\n|\r)/g,""))}function lK(t,e){const n={value:"",stops:[]};let r=-1;for(;++r<t.length;){const i=t[r];if(i[0]==="enter"){const s=i[1].type;if(s==="lineEnding"||e.includes(s)){const o=i[2].sliceStream(i[1]);for(;o.length>0&&o[0]===-1;)o.shift();const u=cK(o);n.stops.push([n.value.length,i[1].start]),n.value+=u,n.stops.push([n.value.length,i[1].end])}}}return n}function uK(t,e){let n=0;for(;n<t.length&&t[n][0]<=e;)n+=1;if(n===0)return;const[r,i]=t[n-1],s=e-r;return{line:i.line,column:i.column+s,offset:i.offset+s}}function cK(t){let e=-1;const n=[];let r;for(;++e<t.length;){const i=t[e];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
88
+ `;break}case-3:{s=`\r
89
+ `;break}case-2:{s=" ";break}case-1:{if(r)continue;s=" ";break}default:s=String.fromCharCode(i)}r=i===-2,n.push(s)}return n.join("")}function xm(t){const e=t||{},n=e.loc||{},r=e.range||[void 0,void 0],i=ZA(n.start,r[0]||e.start),s=ZA(n.end,r[1]||e.end);if(i&&s)return{start:i,end:s}}function ZA(t,e){if(t&&typeof t=="object"){const n="line"in t?xx(t.line):void 0,r="column"in t?xx(t.column):void 0;if(n&&r!==void 0)return{line:n,column:r+1,offset:xx(e)}}}function xx(t){return typeof t=="number"&&t>-1?t:void 0}const fK=2,Nu="https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression",hK="#unexpected-end-of-file-in-expression-expected-a-corresponding-closing-brace-for-",pK="#unexpected-lazy-line-in-expression-in-container-expected-line-to-be-prefixed",eT="#unexpected-type-in-code-expected-an-object-spread-spread",dK="#unexpected-extra-content-in-spread-only-a-single-spread-is-supported",mK="#could-not-parse-expression-with-acorn";function rg(t,e,n,r,i,s,o,u,c,h,m){const g=this,y=this.events.length+3;let b=0,v,N;return T;function T(J){return t.enter(n),t.enter(r),t.consume(J),t.exit(r),v=g.now(),M}function M(J){if(J===null){if(N)throw N;const L=new mt("Unexpected end of file in expression, expected a corresponding closing brace for `{`",{place:g.now(),ruleId:"unexpected-eof",source:"micromark-extension-mdx-expression"});throw L.url=Nu+hK,L}if(Ae(J))return t.enter("lineEnding"),t.consume(J),t.exit("lineEnding"),P;if(J===125&&b===0){const L=s?gK.call(g,s,o,i,y,v,h||!1,c||!1):{type:"ok",estree:void 0};if(L.type==="ok"){t.enter(r),t.consume(J),t.exit(r);const C=t.exit(n);return u&&L.estree&&Object.assign(C,{estree:L.estree}),e}return N=L.message,t.enter(i),t.consume(J),j}return t.enter(i),j(J)}function j(J){return J===125&&b===0||J===null||Ae(J)?(t.exit(i),M(J)):(J===123&&!s?b+=1:J===125&&(b-=1),t.consume(J),j)}function P(J){const L=g.now();if(L.line!==v.line&&!m&&g.parser.lazy[L.line]){const C=new mt("Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",{place:g.now(),ruleId:"unexpected-lazy",source:"micromark-extension-mdx-expression"});throw C.url=Nu+pK,C}return Ge(J)?nt(t,M,"linePrefix",fK+1)(J):M(J)}}function gK(t,e,n,r,i,s,o){const u=l_(this.events.slice(r),{acorn:t,tokenTypes:[n],acornOptions:e,start:i,expression:!0,allowEmpty:s,prefix:o?"({":"",suffix:o?"})":""}),c=u.estree;if(o&&c){const h=c.body[0];if(h.type!=="ExpressionStatement"||h.expression.type!=="ObjectExpression"){const m=xm(h),g=new mt("Unexpected `"+h.type+"` in code: expected an object spread (`{...spread}`)",{place:m.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw g.url=Nu+eT,g}if(h.expression.properties[1]){const m=xm(h.expression.properties[1]),g=new mt("Unexpected extra content in spread: only a single spread is supported",{place:m.start,ruleId:"spread-extra",source:"micromark-extension-mdx-expression"});throw g.url=Nu+dK,g}if(h.expression.properties[0]&&h.expression.properties[0].type!=="SpreadElement"){const m=xm(h.expression.properties[0]),g=new mt("Unexpected `"+h.expression.properties[0].type+"` in code: only spread elements are supported",{place:m.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw g.url=Nu+eT,g}}if(u.error){const h=new mt("Could not parse expression with acorn",{cause:u.error,place:{line:u.error.loc.line,column:u.error.loc.column+1,offset:u.error.pos},ruleId:"acorn",source:"micromark-extension-mdx-expression"});return h.url=Nu+mK,{type:"nok",message:h}}return{type:"ok",estree:c}}function yK(t){const e=t||{},n=e.addResult,r=e.acorn,i=e.spread;let s=e.allowEmpty,o;if(s==null&&(s=!0),r){if(!r.parseExpressionAt)throw new Error("Expected a proper `acorn` instance passed in as `options.acorn`");o=Object.assign({ecmaVersion:2024,sourceType:"module"},e.acornOptions)}else if(e.acornOptions||e.addResult)throw new Error("Expected an `acorn` instance passed in as `options.acorn`");return{flow:{123:{name:"mdxFlowExpression",tokenize:u,concrete:!0}},text:{123:{name:"mdxTextExpression",tokenize:c}}};function u(h,m,g){const y=this;return b;function b(M){return v(M)}function v(M){return rg.call(y,h,N,"mdxFlowExpression","mdxFlowExpressionMarker","mdxFlowExpressionChunk",r,o,n,i,s)(M)}function N(M){return Ge(M)?nt(h,T,"whitespace")(M):T(M)}function T(M){const j=y.parser.constructs.flow[60],J=(Array.isArray(j)?j:j?[j]:[]).find(function(L){return L.name==="mdxJsxFlowTag"});return M===60&&J?h.attempt(J,T,g)(M):M===null||Ae(M)?m(M):g(M)}}function c(h,m){const g=this;return y;function y(b){return rg.call(g,h,m,"mdxTextExpression","mdxTextExpressionMarker","mdxTextExpressionChunk",r,o,n,i,s,!0)(b)}}}const xK=/[$_\p{ID_Start}]/u,bK=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,SK=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,kK={};function Si(t){return t?xK.test(String.fromCodePoint(t)):!1}function Wc(t,e){const r=(e||kK).jsx?SK:bK;return t?r.test(String.fromCodePoint(t)):!1}const tT="https://github.com/micromark/micromark-extension-mdx-jsx";function u_(t,e,n,r,i,s,o,u,c,h,m,g,y,b,v,N,T,M,j,P,J,L,C,z,q,ie,K,pe,fe,Se,_e,Re){const X=this;let oe,ke;return ze;function ze(_){return t.enter(u),t.enter(c),t.consume(_),t.exit(c),D}function D(_){return ct(_)?n(_):(oe=F,$e(_))}function F(_){if(_===47)return t.enter(h),t.consume(_),t.exit(h),oe=Q,$e;if(_===62)return Dr(_);if(_!==null&&_>=0&&Si(_))return t.enter(g),t.enter(y),t.consume(_),V;de(_,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(_===33?" (note: to create a comment in MDX, use `{/* text */}`)":""))}function Q(_){if(_===62)return Dr(_);if(_!==null&&_>=0&&Si(_))return t.enter(g),t.enter(y),t.consume(_),V;de(_,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(_===42||_===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function V(_){if(_!==null&&_>=0&&Wc(_,{jsx:!0}))return t.consume(_),V;if(_===46||_===47||_===58||_===62||_===123||ct(_)||Bn(_))return t.exit(y),oe=xe,$e(_);de(_,"in name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(_===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function xe(_){if(_===46)return t.enter(b),t.consume(_),t.exit(b),oe=Oe,$e;if(_===58)return t.enter(N),t.consume(_),t.exit(N),oe=Ct,$e;if(_===47||_===62||_===123||_!==null&&_>=0&&Si(_))return t.exit(g),Lt(_);de(_,"after name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Oe(_){if(_!==null&&_>=0&&Si(_))return t.enter(v),t.consume(_),Te;de(_,"before member name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Te(_){if(_!==null&&_>=0&&Wc(_,{jsx:!0}))return t.consume(_),Te;if(_===46||_===47||_===62||_===123||ct(_)||Bn(_))return t.exit(v),oe=We,$e(_);de(_,"in member name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(_===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function We(_){if(_===46)return t.enter(b),t.consume(_),t.exit(b),oe=Oe,$e;if(_===47||_===62||_===123||_!==null&&_>=0&&Si(_))return t.exit(g),Lt(_);de(_,"after member name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Ct(_){if(_!==null&&_>=0&&Si(_))return t.enter(T),t.consume(_),Xe;de(_,"before local name","a character that can start a name, such as a letter, `$`, or `_`"+(_===43||_!==null&&_>46&&_<58?" (note: to create a link in MDX, use `[text](url)`)":""))}function Xe(_){if(_!==null&&_>=0&&Wc(_,{jsx:!0}))return t.consume(_),Xe;if(_===47||_===62||_===123||ct(_)||Bn(_))return t.exit(T),oe=zt,$e(_);de(_,"in local name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag")}function zt(_){if(_===47||_===62||_===123||_!==null&&_>=0&&Si(_))return t.exit(g),Lt(_);de(_,"after local name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Lt(_){if(_===47)return t.enter(m),t.consume(_),t.exit(m),oe=Mi,$e;if(_===62)return Dr(_);if(_===123)return rg.call(X,t,Ti,M,j,P,r,i,s,!0,!1,o)(_);if(_!==null&&_>=0&&Si(_))return t.enter(J),t.enter(L),t.enter(C),t.consume(_),ui;de(_,"before attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Ti(_){return oe=Lt,$e(_)}function ui(_){if(_!==null&&_>=0&&Wc(_,{jsx:!0}))return t.consume(_),ui;if(_===47||_===58||_===61||_===62||_===123||ct(_)||Bn(_))return t.exit(C),oe=Wn,$e(_);de(_,"in attribute name","an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function Wn(_){if(_===58)return t.enter(z),t.consume(_),t.exit(z),oe=dr,$e;if(_===61)return t.exit(L),t.enter(ie),t.consume(_),t.exit(ie),oe=mr,$e;if(_===47||_===62||_===123||ct(_)||Bn(_)||_!==null&&_>=0&&Si(_))return t.exit(L),t.exit(J),oe=Lt,$e(_);de(_,"after attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function dr(_){if(_!==null&&_>=0&&Si(_))return t.enter(q),t.consume(_),Or;de(_,"before local attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function Or(_){if(_!==null&&_>=0&&Wc(_,{jsx:!0}))return t.consume(_),Or;if(_===47||_===61||_===62||_===123||ct(_)||Bn(_))return t.exit(q),t.exit(L),oe=Xn,$e(_);de(_,"in local attribute name","an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function Xn(_){if(_===61)return t.enter(ie),t.consume(_),t.exit(ie),oe=mr,$e;if(_===47||_===62||_===123||_!==null&&_>=0&&Si(_))return t.exit(J),Lt(_);de(_,"after local attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function mr(_){if(_===34||_===39)return t.enter(K),t.enter(pe),t.consume(_),t.exit(pe),ke=_,On;if(_===123)return rg.call(X,t,ci,Se,_e,Re,r,i,s,!1,!1,o)(_);de(_,"before attribute value","a character that can start an attribute value, such as `\"`, `'`, or `{`"+(_===60?" (note: to use an element or fragment as a prop value in MDX, use `{<element />}`)":""))}function ci(_){return t.exit(J),oe=Lt,$e(_)}function On(_){return _===null&&de(_,"in attribute value","a corresponding closing quote `"+String.fromCodePoint(ke)+"`"),_===ke?(t.enter(pe),t.consume(_),t.exit(pe),t.exit(K),t.exit(J),ke=void 0,oe=Lt,$e):Ae(_)?(oe=On,$e(_)):(t.enter(fe),Rr(_))}function Rr(_){return _===null||_===ke||Ae(_)?(t.exit(fe),On(_)):(t.consume(_),Rr)}function Mi(_){if(_===62)return Dr(_);de(_,"after self-closing slash","`>` to end the tag"+(_===42||_===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function Dr(_){return t.enter(c),t.consume(_),t.exit(c),t.exit(u),e}function $e(_){return Ae(_)?(t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),ae):Ge(_)||Bn(_)?(t.enter("esWhitespace"),Qi(_)):oe(_)}function Qi(_){return Ae(_)?(t.exit("esWhitespace"),$e(_)):Ge(_)||Bn(_)?(t.consume(_),Qi):(t.exit("esWhitespace"),oe(_))}function ae(_){if(!o&&X.parser.lazy[X.now().line]){const De=new mt("Unexpected lazy line in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",X.now(),"micromark-extension-mdx-jsx:unexpected-lazy");throw De.url=tT+"#unexpected-lazy-line-in-container-expected-line-to-be",De}return $e(_)}function de(_,De,Pe){const tn=new mt("Unexpected "+(_===null?"end of file":"character `"+(_===96?"` ` `":String.fromCodePoint(_))+"` ("+vK(_)+")")+" "+De+", expected "+Pe,X.now(),"micromark-extension-mdx-jsx:unexpected-"+(_===null?"eof":"character"));throw tn.url=tT+(_===null?"#unexpected-end-of-file-at-expected-expect":"#unexpected-character-at-expected-expect"),tn}}function vK(t){return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function CK(t,e){return{name:"mdxJsxTextTag",tokenize:n};function n(r,i,s){return u_.call(this,r,i,s,t,e.acornOptions,e.addResult,!0,"mdxJsxTextTag","mdxJsxTextTagMarker","mdxJsxTextTagClosingMarker","mdxJsxTextTagSelfClosingMarker","mdxJsxTextTagName","mdxJsxTextTagNamePrimary","mdxJsxTextTagNameMemberMarker","mdxJsxTextTagNameMember","mdxJsxTextTagNamePrefixMarker","mdxJsxTextTagNameLocal","mdxJsxTextTagExpressionAttribute","mdxJsxTextTagExpressionAttributeMarker","mdxJsxTextTagExpressionAttributeValue","mdxJsxTextTagAttribute","mdxJsxTextTagAttributeName","mdxJsxTextTagAttributeNamePrimary","mdxJsxTextTagAttributeNamePrefixMarker","mdxJsxTextTagAttributeNameLocal","mdxJsxTextTagAttributeInitializerMarker","mdxJsxTextTagAttributeValueLiteral","mdxJsxTextTagAttributeValueLiteralMarker","mdxJsxTextTagAttributeValueLiteralValue","mdxJsxTextTagAttributeValueExpression","mdxJsxTextTagAttributeValueExpressionMarker","mdxJsxTextTagAttributeValueExpressionValue")}}function wK(t,e){return{concrete:!0,name:"mdxJsxFlowTag",tokenize:n};function n(r,i,s){const o=this;return u;function u(g){return c(g)}function c(g){return u_.call(o,r,h,s,t,e.acornOptions,e.addResult,!1,"mdxJsxFlowTag","mdxJsxFlowTagMarker","mdxJsxFlowTagClosingMarker","mdxJsxFlowTagSelfClosingMarker","mdxJsxFlowTagName","mdxJsxFlowTagNamePrimary","mdxJsxFlowTagNameMemberMarker","mdxJsxFlowTagNameMember","mdxJsxFlowTagNamePrefixMarker","mdxJsxFlowTagNameLocal","mdxJsxFlowTagExpressionAttribute","mdxJsxFlowTagExpressionAttributeMarker","mdxJsxFlowTagExpressionAttributeValue","mdxJsxFlowTagAttribute","mdxJsxFlowTagAttributeName","mdxJsxFlowTagAttributeNamePrimary","mdxJsxFlowTagAttributeNamePrefixMarker","mdxJsxFlowTagAttributeNameLocal","mdxJsxFlowTagAttributeInitializerMarker","mdxJsxFlowTagAttributeValueLiteral","mdxJsxFlowTagAttributeValueLiteralMarker","mdxJsxFlowTagAttributeValueLiteralValue","mdxJsxFlowTagAttributeValueExpression","mdxJsxFlowTagAttributeValueExpressionMarker","mdxJsxFlowTagAttributeValueExpressionValue")(g)}function h(g){return Ge(g)?nt(r,m,"whitespace")(g):m(g)}function m(g){const y=o.parser.constructs.flow[123],b=Array.isArray(y)?y:y?[y]:[];let v;for(const N of b)if(N.name==="mdxFlowExpression"){v=N;break}return g===60?u(g):g===123&&v?r.attempt(v,m,s)(g):g===null||Ae(g)?i(g):s(g)}}}function EK(t){const e=t||{},n=e.acorn;let r;if(n){if(!n.parse||!n.parseExpressionAt)throw new Error("Expected a proper `acorn` instance passed in as `options.acorn`");r=Object.assign({ecmaVersion:2024,sourceType:"module"},e.acornOptions,{locations:!0})}else if(e.acornOptions||e.addResult)throw new Error("Expected an `acorn` instance passed in as `options.acorn`");return{flow:{60:wK(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})},text:{60:CK(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})}}}function NK(){return{disable:{null:["autolink","codeIndented","htmlFlow","htmlText"]}}}const AK={tokenize:OK,partial:!0},nT="https://github.com/micromark/micromark-extension-mdxjs-esm",TK=new Set(["ExportAllDeclaration","ExportDefaultDeclaration","ExportNamedDeclaration","ImportDeclaration"]);function MK(t){const e={tokenize:i,concrete:!0};if(!t||!t.acorn||!t.acorn.parse)throw new Error("Expected an `acorn` instance passed in as `options.acorn`");const n=t.acorn,r=Object.assign({ecmaVersion:2024,sourceType:"module"},t.acornOptions,{locations:!0});return{flow:{101:e,105:e}};function i(s,o,u){const c=this,h=c.parser.definedModuleSpecifiers||(c.parser.definedModuleSpecifiers=[]),m=this.events.length+1;let g="";return c.interrupt?u:y;function y(j){return c.now().column>1?u(j):(s.enter("mdxjsEsm"),s.enter("mdxjsEsmData"),s.consume(j),g+=String.fromCharCode(j),b)}function b(j){return Sn(j)?(s.consume(j),g+=String.fromCharCode(j),b):(g==="import"||g==="export")&&j===32?(s.consume(j),v):u(j)}function v(j){return j===null||Ae(j)?(s.exit("mdxjsEsmData"),N(j)):(s.consume(j),v)}function N(j){return j===null?M(j):Ae(j)?s.check(AK,M,T)(j):(s.enter("mdxjsEsmData"),v(j))}function T(j){return s.enter("lineEnding"),s.consume(j),s.exit("lineEnding"),N}function M(j){const P=l_(c.events.slice(m),{acorn:n,acornOptions:r,tokenTypes:["mdxjsEsmData"],prefix:h.length>0?"var "+h.join(",")+`
90
+ `:""});if(P.error){if(j!==null&&P.swallow)return T(j);const L=new mt("Could not parse import/exports with acorn",{cause:P.error,place:{line:P.error.loc.line,column:P.error.loc.column+1,offset:P.error.pos},ruleId:"acorn",source:"micromark-extension-mdxjs-esm"});throw L.url=nT+"#could-not-parse-importexports-with-acorn",L}h.length>0&&P.estree.body.shift();let J=-1;for(;++J<P.estree.body.length;){const L=P.estree.body[J];if(!TK.has(L.type)){const C=new mt("Unexpected `"+L.type+"` in code: only import/exports are supported",{place:xm(L),ruleId:"non-esm",source:"micromark-extension-mdxjs-esm"});throw C.url=nT+"#unexpected-type-in-code-only-importexports-are-supported",C}if(L.type==="ImportDeclaration"&&!c.interrupt){let C=-1;for(;++C<L.specifiers.length;){const z=L.specifiers[C];h.push(z.local.name)}}}return Object.assign(s.exit("mdxjsEsm"),t.addResult?{estree:P.estree}:void 0),o(j)}}}function OK(t,e,n){return r;function r(i){return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),t.attempt(Pu,e,n)}}function RK(t){const e=Object.assign({acorn:Zt.extend(rK()),acornOptions:{ecmaVersion:2024,sourceType:"module"},addResult:!0},t);return eS([MK(e),yK(e),EK(e),NK()])}const DK={};function IK(t){const e=this,n=t||DK,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(RK(n)),s.push(hq()),o.push(pq(n))}const zh="__mdx_expr__:",_K=new Set(["br","hr","img","input","meta","link","area","base","col","embed","source","track","wbr"]),zK=wm().use(vm),LK=Ps("remarkMdx",()=>IK);function BK(t){const e={};let n=!1;if(!Array.isArray(t))return{props:e,hasExpressions:n};for(const r of t)r.type==="mdxJsxAttribute"&&r.name&&(r.value===null||r.value===void 0?e[r.name]="true":typeof r.value=="string"?e[r.name]=r.value:r.value?.type==="mdxJsxAttributeValueExpression"&&(e[r.name]=`${zh}${r.value.value}`,n=!0)),r.type==="mdxJsxExpressionAttribute"&&(n=!0);return{props:e,hasExpressions:n}}function VK(t){const e=[];for(const[n,r]of Object.entries(t))r.startsWith(zh)?e.push({type:"mdxJsxAttribute",name:n,value:{type:"mdxJsxAttributeValueExpression",value:r.slice(zh.length)}}):e.push({type:"mdxJsxAttribute",name:n,value:r});return e}function c_(t){if(!t||t.length===0)return"";const e=[];for(const n of t)if(n.type==="paragraph"){const r=bm(n.children??[]);e.push(r)}else if(n.type==="text")e.push(n.value??"");else if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement"){const r=n.name??"",i=(n.attributes??[]).map(o=>{if(o.type==="mdxJsxAttribute"&&o.name){if(typeof o.value=="string")return`${o.name}="${o.value}"`;if(o.value?.type==="mdxJsxAttributeValueExpression")return`${o.name}={${o.value.value}}`}return""}).filter(Boolean).join(" "),s=c_(n.children??[]);s?e.push(`<${r}${i?" "+i:""}>${s}</${r}>`):e.push(`<${r}${i?" "+i:""} />`)}else n.value&&e.push(n.value);return e.join(`
91
+
92
+ `)}function bm(t){return t.map(e=>e.type==="text"?e.value??"":e.type==="strong"?`**${bm(e.children??[])}**`:e.type==="emphasis"?`*${bm(e.children??[])}*`:e.type==="inlineCode"?`\`${e.value??""}\``:e.type==="link"?`[${bm(e.children??[])}](${e.url??""})`:e.value??"").join("")}const f_=Wh("mdx_component",()=>({group:"block",atom:!0,isolating:!0,selectable:!0,draggable:!1,attrs:{componentName:{default:""},props:{default:"{}"},hasExpressions:{default:!1},children:{default:""}},toDOM:t=>{const e=document.createElement("div");return e.setAttribute("data-mdx-component",t.attrs.componentName),e.setAttribute("data-mdx-props",t.attrs.props),t.attrs.children&&e.setAttribute("data-mdx-children",t.attrs.children),t.attrs.hasExpressions&&e.setAttribute("data-mdx-expressions","true"),e.className="mdx-component-block",e.textContent=`<${t.attrs.componentName} />`,e},parseDOM:[{tag:"div[data-mdx-component]",getAttrs:t=>({componentName:t.getAttribute("data-mdx-component")||"",props:t.getAttribute("data-mdx-props")||"{}",children:t.getAttribute("data-mdx-children")||"",hasExpressions:t.getAttribute("data-mdx-expressions")==="true"})}],parseMarkdown:{match:t=>t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement",runner:(t,e,n)=>{const r=e.name;if(!r||_K.has(r.toLowerCase()))return;const{props:i,hasExpressions:s}=BK(e.attributes),o=c_(e.children??[]);t.addNode(n,{componentName:r,props:JSON.stringify(i),hasExpressions:s,children:o})}},toMarkdown:{match:t=>t.type.name==="mdx_component",runner:(t,e)=>{const n=e.attrs.componentName,r=JSON.parse(e.attrs.props),i=e.attrs.children||"",s=VK(r);if(i.trim()){const o=zK.parse(i);t.addNode("mdxJsxFlowElement",void 0,void 0,{name:n,attributes:s,children:o.children})}else t.addNode("mdxJsxFlowElement",void 0,void 0,{name:n,attributes:s,children:[]})}}})),rT=Ue("insertMdxComponent",()=>t=>(e,n)=>{if(!t)return!1;const r=e.schema.nodes.mdx_component;if(!r)return!1;const i=r.create({componentName:t.componentName,props:JSON.stringify(t.props),hasExpressions:!1,children:t.children||""});if(n){const{from:s}=e.selection,o=e.tr.insert(s,i);n(o)}return!0}),FK=Wh("mdx_esm",()=>({group:"block",atom:!0,attrs:{value:{default:""}},toDOM:()=>{const t=document.createElement("span");return t.style.display="none",t},parseDOM:[],parseMarkdown:{match:t=>t.type==="mdxjsEsm",runner:(t,e,n)=>{t.addNode(n,{value:e.value??""})}},toMarkdown:{match:t=>t.type.name==="mdx_esm",runner:(t,e)=>{t.addNode("mdxjsEsm",void 0,void 0,{value:e.attrs.value})}}}));var PK=typeof global=="object"&&global&&global.Object===Object&&global,jK=typeof self=="object"&&self&&self.Object===Object&&self,h_=PK||jK||Function("return this")(),ig=h_.Symbol,p_=Object.prototype,$K=p_.hasOwnProperty,UK=p_.toString,Xc=ig?ig.toStringTag:void 0;function JK(t){var e=$K.call(t,Xc),n=t[Xc];try{t[Xc]=void 0;var r=!0}catch{}var i=UK.call(t);return r&&(e?t[Xc]=n:delete t[Xc]),i}var HK=Object.prototype,qK=HK.toString;function KK(t){return qK.call(t)}var GK="[object Null]",YK="[object Undefined]",iT=ig?ig.toStringTag:void 0;function WK(t){return t==null?t===void 0?YK:GK:iT&&iT in Object(t)?JK(t):KK(t)}function XK(t){return t!=null&&typeof t=="object"}var QK="[object Symbol]";function ZK(t){return typeof t=="symbol"||XK(t)&&WK(t)==QK}var eG=/\s/;function tG(t){for(var e=t.length;e--&&eG.test(t.charAt(e)););return e}var nG=/^\s+/;function rG(t){return t&&t.slice(0,tG(t)+1).replace(nG,"")}function Wb(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var sT=NaN,iG=/^[-+]0x[0-9a-f]+$/i,sG=/^0b[01]+$/i,aG=/^0o[0-7]+$/i,oG=parseInt;function aT(t){if(typeof t=="number")return t;if(ZK(t))return sT;if(Wb(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Wb(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=rG(t);var n=sG.test(t);return n||aG.test(t)?oG(t.slice(2),n?2:8):iG.test(t)?sT:+t}var bx=function(){return h_.Date.now()},lG="Expected a function",uG=Math.max,cG=Math.min;function fG(t,e,n){var r,i,s,o,u,c,h=0,m=!1,g=!1,y=!0;if(typeof t!="function")throw new TypeError(lG);e=aT(e)||0,Wb(n)&&(m=!!n.leading,g="maxWait"in n,s=g?uG(aT(n.maxWait)||0,e):s,y="trailing"in n?!!n.trailing:y);function b(C){var z=r,q=i;return r=i=void 0,h=C,o=t.apply(q,z),o}function v(C){return h=C,u=setTimeout(M,e),m?b(C):o}function N(C){var z=C-c,q=C-h,ie=e-z;return g?cG(ie,s-q):ie}function T(C){var z=C-c,q=C-h;return c===void 0||z>=e||z<0||g&&q>=s}function M(){var C=bx();if(T(C))return j(C);u=setTimeout(M,N(C))}function j(C){return u=void 0,y&&r?b(C):(r=i=void 0,o)}function P(){u!==void 0&&clearTimeout(u),h=0,r=c=i=u=void 0}function J(){return u===void 0?o:j(bx())}function L(){var C=bx(),z=T(C);if(r=arguments,i=this,c=C,z){if(u===void 0)return v(c);if(g)return clearTimeout(u),u=setTimeout(M,e),b(c)}return u===void 0&&(u=setTimeout(M,e)),o}return L.cancel=P,L.flush=J,L}var d_=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=t=>(this.beforeMountedListeners.push(t),this),this.mounted=t=>(this.mountedListeners.push(t),this),this.updated=t=>(this.updatedListeners.push(t),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(t){return this.markdownUpdatedListeners.push(t),this}blur(t){return this.blurListeners.push(t),this}focus(t){return this.focusListeners.push(t),this}destroy(t){return this.destroyListeners.push(t),this}selectionUpdated(t){return this.selectionUpdatedListeners.push(t),this}},sg=st(new d_,"listener"),hG=new hr("MILKDOWN_LISTENER"),cv=t=>(t.inject(sg,new d_),async()=>{await t.wait(Jo);const{listeners:e}=t.get(sg);e.beforeMount.forEach(h=>h(t)),await t.wait(Xf);const n=t.get(tm);let r=null,i=null,s=null,o=null;const u=fG(()=>{if(!o)return;const{doc:h}=o;if(e.updated.length>0&&r&&!r.eq(h)&&e.updated.forEach(m=>{m(t,h,r)}),e.markdownUpdated.length>0&&r&&!r.eq(h)){const m=n(h);e.markdownUpdated.forEach(g=>{g(t,m,i)}),i=m}r=h,o=null},200),c=new fr({key:hG,view:()=>({destroy:()=>{e.destroy.forEach(h=>h(t))}}),props:{handleDOMEvents:{focus:()=>(e.focus.forEach(h=>h(t)),!1),blur:()=>(e.blur.forEach(h=>h(t)),!1)}},state:{init:(h,m)=>{r=m.doc,i=n(m.doc)},apply:h=>{const m=h.selection;(!s&&m||s&&!m.eq(s))&&(e.selectionUpdated.forEach(g=>{g(t,m,s)}),s=m),!(!(h.docChanged||h.storedMarksSet)||h.getMeta("addToHistory")===!1)&&(o=h,u())}}});t.update(_s,h=>h.concat(c)),await t.wait(sm),e.mounted.forEach(h=>h(t))});cv.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};const pG={border:"1px solid #e4e4e7",borderRadius:6,background:"#fff"},dG={padding:"6px 10px",minHeight:60,fontSize:13,lineHeight:1.5,outline:"none"};function mG({value:t,onChange:e}){const n=le.useRef(null),r=le.useRef(null),[i,s]=le.useState(null),o=le.useRef(t),u=le.useRef(!1),c=le.useRef(e);return c.current=e,le.useEffect(()=>{const h=n.current;if(!h)return;let m=!1;return(async()=>{const y=await x3.make().config(b=>{b.set(Zf,h),b.set(Qf,o.current),b.get(sg).markdownUpdated((v,N)=>{o.current=N})}).use(sR).use(hI).use(cv).create();if(m){y.destroy();return}r.current=y,s(y)})(),()=>{m=!0,r.current?.destroy(),r.current=null,s(null)}},[]),le.useEffect(()=>{!r.current||u.current||t!==o.current&&(r.current.action(S3(t)),o.current=t)},[t]),I.jsxs("div",{style:pG,children:[I.jsx(vI,{editor:i}),I.jsx("div",{ref:n,style:dG,onFocusCapture:()=>{u.current=!0},onBlurCapture:()=>{u.current=!1,o.current!==t&&c.current(o.current)}})]})}const gG={number:"number",url:"url",date:"date",datetime:"datetime-local",time:"time",email:"email",tel:"tel"};function yG(t){return t!==""&&/^(https?:\/\/|\/|\.\/)/.test(t)}const xG={border:"1px solid #d4d4d8",borderRadius:8,background:"#fafafa",margin:"8px 0",fontSize:13},bG={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"6px 10px",borderBottom:"1px solid #ececed",background:"#f1f1f3",borderTopLeftRadius:8,borderTopRightRadius:8},SG={fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},kG={padding:"8px 10px",display:"flex",flexDirection:"column",gap:8},oT={fontSize:11,color:"#71717a",marginBottom:2},Sm={width:"100%",boxSizing:"border-box",border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 6px",font:"inherit",background:"#fff"},ah={...Sm,background:"#f4f4f5",color:"#71717a"},lT={fontSize:10,color:"#a16207",background:"#fef9c3",borderRadius:3,padding:"0 4px",marginLeft:6},vG={border:"none",background:"transparent",color:"#a1a1aa",cursor:"pointer",fontSize:16,lineHeight:1,padding:2},CG={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"};function wG({name:t,value:e,propType:n,editable:r,hasMedia:i,onChange:s,onBrowse:o}){if(n==="boolean")return I.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6},children:[I.jsx("input",{type:"checkbox",checked:e==="true",disabled:!r,onChange:c=>s(c.target.checked?"true":"false")}),I.jsx("span",{style:{color:"#52525b"},children:e==="true"?"Yes":"No"})]});if(n==="image")return I.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[yG(e)?I.jsx("img",{src:e,alt:"",style:{maxHeight:96,maxWidth:"100%",objectFit:"contain",borderRadius:4,alignSelf:"flex-start"}}):null,I.jsxs("div",{style:{display:"flex",gap:6},children:[I.jsx("input",{style:r?Sm:ah,value:e,readOnly:!r,placeholder:"Image URL or path",onChange:r?c=>s(c.target.value):void 0}),r&&i?I.jsx("button",{type:"button",style:CG,"data-mdx-action":"props",onClick:o,children:"Browse"}):null]})]});if(n==="color")return I.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[I.jsx("input",{type:"color",value:e||"#000000",disabled:!r,onChange:c=>s(c.target.value),style:{width:30,height:28,padding:0,border:"1px solid #d4d4d8",borderRadius:4,background:"transparent",cursor:r?"pointer":"default"}}),I.jsx("input",{style:r?Sm:ah,value:e,readOnly:!r,placeholder:"#000000",onChange:r?c=>s(c.target.value):void 0})]});const u=gG[n]??"text";return I.jsx("input",{type:u,style:r?Sm:ah,value:e,readOnly:!r,placeholder:`Enter ${t}…`,onChange:r?c=>s(c.target.value):void 0})}function EG({componentName:t,props:e,hasExpressions:n,slotContent:r,definition:i,media:s,mediaContext:o,onRemove:u,onSlotContentChange:c,onPropsChange:h}){const m=i?.slots?.includes("default")??!!c,g=Object.entries(e),[y,b]=le.useState(null),v=le.useMemo(()=>{const T=new Map;for(const M of i?.props??[])T.set(M.name,M);return T},[i]),N=(T,M)=>{h&&h({...e,[T]:M})};return I.jsxs("div",{style:xG,"data-cms-ui":"",contentEditable:!1,children:[I.jsxs("div",{style:bG,children:[I.jsxs("span",{style:SG,children:[`<${t} />`,n?I.jsx("span",{style:lT,children:"expr · read-only"}):null]}),I.jsx("button",{type:"button",style:vG,title:"Remove block","data-mdx-action":"remove",onClick:u,children:"×"})]}),I.jsxs("div",{style:kG,children:[m?I.jsxs("div",{"data-mdx-action":"children",children:[I.jsx("div",{style:oT,children:"Content"}),c?I.jsx(mG,{value:r,onChange:c}):I.jsx("div",{style:{...ah,whiteSpace:"pre-wrap",minHeight:40},children:r})]}):null,g.length===0&&!m?I.jsx("div",{style:{color:"#a1a1aa",fontSize:12},children:"No props"}):null,g.map(([T,M])=>{const j=M.startsWith(zh),P=!!h&&!j,J=v.get(T),L=(J?.type??"").toLowerCase();return I.jsxs("div",{style:{display:"block"},"data-mdx-action":"props",children:[I.jsxs("div",{style:oT,children:[T,J?.required?I.jsx("span",{style:{color:"#dc2626"},children:"*"}):null,j?I.jsx("span",{style:lT,children:"expression"}):null]}),j?I.jsx("input",{style:ah,value:`{${M.slice(zh.length)}}`,readOnly:!0}):I.jsx(wG,{name:T,value:M,propType:L,editable:P,hasMedia:!!s,onChange:C=>N(T,C),onBrowse:()=>b(T)})]},T)})]}),y!==null&&s?I.jsx(pI,{media:s,context:o,field:y,accept:"image/*",onSelect:T=>{N(y,T),b(null)},onClose:()=>b(null)}):null]})}var Sx={exports:{}},Qc={},kx={exports:{}},vx={};var uT;function NG(){return uT||(uT=1,(function(t){function e(X,oe){var ke=X.length;X.push(oe);e:for(;0<ke;){var ze=ke-1>>>1,D=X[ze];if(0<i(D,oe))X[ze]=oe,X[ke]=D,ke=ze;else break e}}function n(X){return X.length===0?null:X[0]}function r(X){if(X.length===0)return null;var oe=X[0],ke=X.pop();if(ke!==oe){X[0]=ke;e:for(var ze=0,D=X.length,F=D>>>1;ze<F;){var Q=2*(ze+1)-1,V=X[Q],xe=Q+1,Oe=X[xe];if(0>i(V,ke))xe<D&&0>i(Oe,V)?(X[ze]=Oe,X[xe]=ke,ze=xe):(X[ze]=V,X[Q]=ke,ze=Q);else if(xe<D&&0>i(Oe,ke))X[ze]=Oe,X[xe]=ke,ze=xe;else break e}}return oe}function i(X,oe){var ke=X.sortIndex-oe.sortIndex;return ke!==0?ke:X.id-oe.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,u=o.now();t.unstable_now=function(){return o.now()-u}}var c=[],h=[],m=1,g=null,y=3,b=!1,v=!1,N=!1,T=!1,M=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;function J(X){for(var oe=n(h);oe!==null;){if(oe.callback===null)r(h);else if(oe.startTime<=X)r(h),oe.sortIndex=oe.expirationTime,e(c,oe);else break;oe=n(h)}}function L(X){if(N=!1,J(X),!v)if(n(c)!==null)v=!0,C||(C=!0,fe());else{var oe=n(h);oe!==null&&Re(L,oe.startTime-X)}}var C=!1,z=-1,q=5,ie=-1;function K(){return T?!0:!(t.unstable_now()-ie<q)}function pe(){if(T=!1,C){var X=t.unstable_now();ie=X;var oe=!0;try{e:{v=!1,N&&(N=!1,j(z),z=-1),b=!0;var ke=y;try{t:{for(J(X),g=n(c);g!==null&&!(g.expirationTime>X&&K());){var ze=g.callback;if(typeof ze=="function"){g.callback=null,y=g.priorityLevel;var D=ze(g.expirationTime<=X);if(X=t.unstable_now(),typeof D=="function"){g.callback=D,J(X),oe=!0;break t}g===n(c)&&r(c),J(X)}else r(c);g=n(c)}if(g!==null)oe=!0;else{var F=n(h);F!==null&&Re(L,F.startTime-X),oe=!1}}break e}finally{g=null,y=ke,b=!1}oe=void 0}}finally{oe?fe():C=!1}}}var fe;if(typeof P=="function")fe=function(){P(pe)};else if(typeof MessageChannel<"u"){var Se=new MessageChannel,_e=Se.port2;Se.port1.onmessage=pe,fe=function(){_e.postMessage(null)}}else fe=function(){M(pe,0)};function Re(X,oe){z=M(function(){X(t.unstable_now())},oe)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(X){X.callback=null},t.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<X?Math.floor(1e3/X):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(X){switch(y){case 1:case 2:case 3:var oe=3;break;default:oe=y}var ke=y;y=oe;try{return X()}finally{y=ke}},t.unstable_requestPaint=function(){T=!0},t.unstable_runWithPriority=function(X,oe){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var ke=y;y=X;try{return oe()}finally{y=ke}},t.unstable_scheduleCallback=function(X,oe,ke){var ze=t.unstable_now();switch(typeof ke=="object"&&ke!==null?(ke=ke.delay,ke=typeof ke=="number"&&0<ke?ze+ke:ze):ke=ze,X){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=ke+D,X={id:m++,callback:oe,priorityLevel:X,startTime:ke,expirationTime:D,sortIndex:-1},ke>ze?(X.sortIndex=ke,e(h,X),n(c)===null&&X===n(h)&&(N?(j(z),z=-1):N=!0,Re(L,ke-ze))):(X.sortIndex=D,e(c,X),v||b||(v=!0,C||(C=!0,fe()))),X},t.unstable_shouldYield=K,t.unstable_wrapCallback=function(X){var oe=y;return function(){var ke=y;y=oe;try{return X.apply(this,arguments)}finally{y=ke}}}})(vx)),vx}var cT;function AG(){return cT||(cT=1,kx.exports=NG()),kx.exports}var Cx={exports:{}},yn={};var fT;function TG(){if(fT)return yn;fT=1;var t=Qb();function e(c){var h="https://react.dev/errors/"+c;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)h+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+c+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(c,h,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:c,containerInfo:h,implementation:m}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(c,h){if(c==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return yn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,yn.createPortal=function(c,h){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(e(299));return s(c,h,null,m)},yn.flushSync=function(c){var h=o.T,m=r.p;try{if(o.T=null,r.p=2,c)return c()}finally{o.T=h,r.p=m,r.d.f()}},yn.preconnect=function(c,h){typeof c=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(c,h))},yn.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},yn.preinit=function(c,h){if(typeof c=="string"&&h&&typeof h.as=="string"){var m=h.as,g=u(m,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;m==="style"?r.d.S(c,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:b}):m==="script"&&r.d.X(c,{crossOrigin:g,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},yn.preinitModule=function(c,h){if(typeof c=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var m=u(h.as,h.crossOrigin);r.d.M(c,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(c)},yn.preload=function(c,h){if(typeof c=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var m=h.as,g=u(m,h.crossOrigin);r.d.L(c,m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},yn.preloadModule=function(c,h){if(typeof c=="string")if(h){var m=u(h.as,h.crossOrigin);r.d.m(c,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(c)},yn.requestFormReset=function(c){r.d.r(c)},yn.unstable_batchedUpdates=function(c,h){return c(h)},yn.useFormState=function(c,h,m){return o.H.useFormState(c,h,m)},yn.useFormStatus=function(){return o.H.useHostTransitionStatus()},yn.version="19.2.7",yn}var hT;function MG(){if(hT)return Cx.exports;hT=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Cx.exports=TG(),Cx.exports}var pT;function OG(){if(pT)return Qc;pT=1;var t=AG(),e=Qb(),n=MG();function r(a){var l="https://react.dev/errors/"+a;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)l+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+a+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function s(a){var l=a,f=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(f=l.return),a=l.return;while(a)}return l.tag===3?f:null}function o(a){if(a.tag===13){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function u(a){if(a.tag===31){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function c(a){if(s(a)!==a)throw Error(r(188))}function h(a){var l=a.alternate;if(!l){if(l=s(a),l===null)throw Error(r(188));return l!==a?null:a}for(var f=a,d=l;;){var x=f.return;if(x===null)break;var k=x.alternate;if(k===null){if(d=x.return,d!==null){f=d;continue}break}if(x.child===k.child){for(k=x.child;k;){if(k===f)return c(x),a;if(k===d)return c(x),l;k=k.sibling}throw Error(r(188))}if(f.return!==d.return)f=x,d=k;else{for(var E=!1,R=x.child;R;){if(R===f){E=!0,f=x,d=k;break}if(R===d){E=!0,d=x,f=k;break}R=R.sibling}if(!E){for(R=k.child;R;){if(R===f){E=!0,f=k,d=x;break}if(R===d){E=!0,d=k,f=x;break}R=R.sibling}if(!E)throw Error(r(189))}}if(f.alternate!==d)throw Error(r(190))}if(f.tag!==3)throw Error(r(188));return f.stateNode.current===f?a:l}function m(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a;for(a=a.child;a!==null;){if(l=m(a),l!==null)return l;a=a.sibling}return null}var g=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),P=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),pe=Symbol.iterator;function fe(a){return a===null||typeof a!="object"?null:(a=pe&&a[pe]||a["@@iterator"],typeof a=="function"?a:null)}var Se=Symbol.for("react.client.reference");function _e(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===Se?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case N:return"Fragment";case M:return"Profiler";case T:return"StrictMode";case L:return"Suspense";case C:return"SuspenseList";case ie:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case v:return"Portal";case P:return a.displayName||"Context";case j:return(a._context.displayName||"Context")+".Consumer";case J:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case z:return l=a.displayName||null,l!==null?l:_e(a.type)||"Memo";case q:l=a._payload,a=a._init;try{return _e(a(l))}catch{}}return null}var Re=Array.isArray,X=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ke={pending:!1,data:null,method:null,action:null},ze=[],D=-1;function F(a){return{current:a}}function Q(a){0>D||(a.current=ze[D],ze[D]=null,D--)}function V(a,l){D++,ze[D]=a.current,a.current=l}var xe=F(null),Oe=F(null),Te=F(null),We=F(null);function Ct(a,l){switch(V(Te,l),V(Oe,a),V(xe,null),l.nodeType){case 9:case 11:a=(a=l.documentElement)&&(a=a.namespaceURI)?l2(a):0;break;default:if(a=l.tagName,l=l.namespaceURI)l=l2(l),a=u2(l,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}Q(xe),V(xe,a)}function Xe(){Q(xe),Q(Oe),Q(Te)}function zt(a){a.memoizedState!==null&&V(We,a);var l=xe.current,f=u2(l,a.type);l!==f&&(V(Oe,a),V(xe,f))}function Lt(a){Oe.current===a&&(Q(xe),Q(Oe)),We.current===a&&(Q(We),$c._currentValue=ke)}var Ti,ui;function Wn(a){if(Ti===void 0)try{throw Error()}catch(f){var l=f.stack.trim().match(/\n( *(at )?)/);Ti=l&&l[1]||"",ui=-1<f.stack.indexOf(`
93
+ at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
94
+ `+Ti+a+ui}var dr=!1;function Or(a,l){if(!a||dr)return"";dr=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(l){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(re){var ne=re}Reflect.construct(a,[],he)}else{try{he.call()}catch(re){ne=re}a.call(he.prototype)}}else{try{throw Error()}catch(re){ne=re}(he=a())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(re){if(re&&ne&&typeof re.stack=="string")return[re.stack,ne.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=d.DetermineComponentFrameRoot(),E=k[0],R=k[1];if(E&&R){var $=E.split(`
95
+ `),te=R.split(`
96
+ `);for(x=d=0;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;for(;x<te.length&&!te[x].includes("DetermineComponentFrameRoot");)x++;if(d===$.length||x===te.length)for(d=$.length-1,x=te.length-1;1<=d&&0<=x&&$[d]!==te[x];)x--;for(;1<=d&&0<=x;d--,x--)if($[d]!==te[x]){if(d!==1||x!==1)do if(d--,x--,0>x||$[d]!==te[x]){var se=`
97
+ `+$[d].replace(" at new "," at ");return a.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",a.displayName)),se}while(1<=d&&0<=x);break}}}finally{dr=!1,Error.prepareStackTrace=f}return(f=a?a.displayName||a.name:"")?Wn(f):""}function Xn(a,l){switch(a.tag){case 26:case 27:case 5:return Wn(a.type);case 16:return Wn("Lazy");case 13:return a.child!==l&&l!==null?Wn("Suspense Fallback"):Wn("Suspense");case 19:return Wn("SuspenseList");case 0:case 15:return Or(a.type,!1);case 11:return Or(a.type.render,!1);case 1:return Or(a.type,!0);case 31:return Wn("Activity");default:return""}}function mr(a){try{var l="",f=null;do l+=Xn(a,f),f=a,a=a.return;while(a);return l}catch(d){return`
98
+ Error generating stack: `+d.message+`
99
+ `+d.stack}}var ci=Object.prototype.hasOwnProperty,On=t.unstable_scheduleCallback,Rr=t.unstable_cancelCallback,Mi=t.unstable_shouldYield,Dr=t.unstable_requestPaint,$e=t.unstable_now,Qi=t.unstable_getCurrentPriorityLevel,ae=t.unstable_ImmediatePriority,de=t.unstable_UserBlockingPriority,_=t.unstable_NormalPriority,De=t.unstable_LowPriority,Pe=t.unstable_IdlePriority,tn=t.log,Qn=t.unstable_setDisableYieldValue,be=null,_t=null;function gn(a){if(typeof tn=="function"&&Qn(a),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(be,a)}catch{}}var St=Math.clz32?Math.clz32:dp,Zn=Math.log,Rn=Math.LN2;function dp(a){return a>>>=0,a===0?32:31-(Zn(a)/Rn|0)|0}var kl=256,Zi=262144,an=4194304;function Jt(a){var l=a&42;if(l!==0)return l;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function gt(a,l,f){var d=a.pendingLanes;if(d===0)return 0;var x=0,k=a.suspendedLanes,E=a.pingedLanes;a=a.warmLanes;var R=d&134217727;return R!==0?(d=R&~k,d!==0?x=Jt(d):(E&=R,E!==0?x=Jt(E):f||(f=R&~a,f!==0&&(x=Jt(f))))):(R=d&~k,R!==0?x=Jt(R):E!==0?x=Jt(E):f||(f=d&~a,f!==0&&(x=Jt(f)))),x===0?0:l!==0&&l!==x&&(l&k)===0&&(k=x&-x,f=l&-l,k>=f||k===32&&(f&4194048)!==0)?l:x}function Ir(a,l){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&l)===0}function je(a,l){switch(a){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qu(){var a=an;return an<<=1,(an&62914560)===0&&(an=4194304),a}function no(a){for(var l=[],f=0;31>f;f++)l.push(a);return l}function ro(a,l){a.pendingLanes|=l,l!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function vl(a,l,f,d,x,k){var E=a.pendingLanes;a.pendingLanes=f,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=f,a.entangledLanes&=f,a.errorRecoveryDisabledLanes&=f,a.shellSuspendCounter=0;var R=a.entanglements,$=a.expirationTimes,te=a.hiddenUpdates;for(f=E&~f;0<f;){var se=31-St(f),he=1<<se;R[se]=0,$[se]=-1;var ne=te[se];if(ne!==null)for(te[se]=null,se=0;se<ne.length;se++){var re=ne[se];re!==null&&(re.lane&=-536870913)}f&=~he}d!==0&&fi(a,d,0),k!==0&&x===0&&a.tag!==0&&(a.suspendedLanes|=k&~(E&~l))}function fi(a,l,f){a.pendingLanes|=l,a.suspendedLanes&=~l;var d=31-St(l);a.entangledLanes|=l,a.entanglements[d]=a.entanglements[d]|1073741824|f&261930}function mp(a,l){var f=a.entangledLanes|=l;for(a=a.entanglements;f;){var d=31-St(f),x=1<<d;x&l|a[d]&l&&(a[d]|=l),f&=~x}}function qs(a,l){var f=l&-l;return f=(f&42)!==0?1:es(f),(f&(a.suspendedLanes|l))!==0?0:f}function es(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function Cl(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function gp(){var a=oe.p;return a!==0?a:(a=window.event,a===void 0?32:D2(a.type))}function Zu(a,l){var f=oe.p;try{return oe.p=a,l()}finally{oe.p=f}}var hi=Math.random().toString(36).slice(2),Ht="__reactFiber$"+hi,on="__reactProps$"+hi,ts="__reactContainer$"+hi,ec="__reactEvents$"+hi,Xg="__reactListeners$"+hi,Qg="__reactHandles$"+hi,yp="__reactResources$"+hi,Ks="__reactMarker$"+hi;function wl(a){delete a[Ht],delete a[on],delete a[ec],delete a[Xg],delete a[Qg]}function ns(a){var l=a[Ht];if(l)return l;for(var f=a.parentNode;f;){if(l=f[ts]||f[Ht]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(a=g2(a);a!==null;){if(f=a[Ht])return f;a=g2(a)}return l}a=f,f=a.parentNode}return null}function rs(a){if(a=a[Ht]||a[ts]){var l=a.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return a}return null}function Gs(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a.stateNode;throw Error(r(33))}function is(a){var l=a[yp];return l||(l=a[yp]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function qt(a){a[Ks]=!0}var xp=new Set,tc={};function ss(a,l){Oi(a,l),Oi(a+"Capture",l)}function Oi(a,l){for(tc[a]=l,a=0;a<l.length;a++)xp.add(l[a])}var bp=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Sp={},ve={};function El(a){return ci.call(ve,a)?!0:ci.call(Sp,a)?!1:bp.test(a)?ve[a]=!0:(Sp[a]=!0,!1)}function Dn(a,l,f){if(El(l))if(f===null)a.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":a.removeAttribute(l);return;case"boolean":var d=l.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){a.removeAttribute(l);return}}a.setAttribute(l,""+f)}}function Nl(a,l,f){if(f===null)a.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(l);return}a.setAttribute(l,""+f)}}function pi(a,l,f,d){if(d===null)a.removeAttribute(f);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(f);return}a.setAttributeNS(l,f,""+d)}}function In(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function kp(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Zg(a,l,f){var d=Object.getOwnPropertyDescriptor(a.constructor.prototype,l);if(!a.hasOwnProperty(l)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var x=d.get,k=d.set;return Object.defineProperty(a,l,{configurable:!0,get:function(){return x.call(this)},set:function(E){f=""+E,k.call(this,E)}}),Object.defineProperty(a,l,{enumerable:d.enumerable}),{getValue:function(){return f},setValue:function(E){f=""+E},stopTracking:function(){a._valueTracker=null,delete a[l]}}}}function Al(a){if(!a._valueTracker){var l=kp(a)?"checked":"value";a._valueTracker=Zg(a,l,""+a[l])}}function vp(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var f=l.getValue(),d="";return a&&(d=kp(a)?a.checked?"true":"false":a.value),a=d,a!==f?(l.setValue(a),!0):!1}function io(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var di=/[\n"\\]/g;function Tt(a){return a.replace(di,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function nc(a,l,f,d,x,k,E,R){a.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?a.type=E:a.removeAttribute("type"),l!=null?E==="number"?(l===0&&a.value===""||a.value!=l)&&(a.value=""+In(l)):a.value!==""+In(l)&&(a.value=""+In(l)):E!=="submit"&&E!=="reset"||a.removeAttribute("value"),l!=null?ic(a,E,In(l)):f!=null?ic(a,E,In(f)):d!=null&&a.removeAttribute("value"),x==null&&k!=null&&(a.defaultChecked=!!k),x!=null&&(a.checked=x&&typeof x!="function"&&typeof x!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?a.name=""+In(R):a.removeAttribute("name")}function rc(a,l,f,d,x,k,E,R){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(a.type=k),l!=null||f!=null){if(!(k!=="submit"&&k!=="reset"||l!=null)){Al(a);return}f=f!=null?""+In(f):"",l=l!=null?""+In(l):f,R||l===a.value||(a.value=l),a.defaultValue=l}d=d??x,d=typeof d!="function"&&typeof d!="symbol"&&!!d,a.checked=R?a.checked:!!d,a.defaultChecked=!!d,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(a.name=E),Al(a)}function ic(a,l,f){l==="number"&&io(a.ownerDocument)===a||a.defaultValue===""+f||(a.defaultValue=""+f)}function Ys(a,l,f,d){if(a=a.options,l){l={};for(var x=0;x<f.length;x++)l["$"+f[x]]=!0;for(f=0;f<a.length;f++)x=l.hasOwnProperty("$"+a[f].value),a[f].selected!==x&&(a[f].selected=x),x&&d&&(a[f].defaultSelected=!0)}else{for(f=""+In(f),l=null,x=0;x<a.length;x++){if(a[x].value===f){a[x].selected=!0,d&&(a[x].defaultSelected=!0);return}l!==null||a[x].disabled||(l=a[x])}l!==null&&(l.selected=!0)}}function Cp(a,l,f){if(l!=null&&(l=""+In(l),l!==a.value&&(a.value=l),f==null)){a.defaultValue!==l&&(a.defaultValue=l);return}a.defaultValue=f!=null?""+In(f):""}function wp(a,l,f,d){if(l==null){if(d!=null){if(f!=null)throw Error(r(92));if(Re(d)){if(1<d.length)throw Error(r(93));d=d[0]}f=d}f==null&&(f=""),l=f}f=In(l),a.defaultValue=f,d=a.textContent,d===f&&d!==""&&d!==null&&(a.value=d),Al(a)}function mi(a,l){if(l){var f=a.firstChild;if(f&&f===a.lastChild&&f.nodeType===3){f.nodeValue=l;return}}a.textContent=l}var Ep=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function sc(a,l,f){var d=l.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?d?a.setProperty(l,""):l==="float"?a.cssFloat="":a[l]="":d?a.setProperty(l,f):typeof f!="number"||f===0||Ep.has(l)?l==="float"?a.cssFloat=f:a[l]=(""+f).trim():a[l]=f+"px"}function ac(a,l,f){if(l!=null&&typeof l!="object")throw Error(r(62));if(a=a.style,f!=null){for(var d in f)!f.hasOwnProperty(d)||l!=null&&l.hasOwnProperty(d)||(d.indexOf("--")===0?a.setProperty(d,""):d==="float"?a.cssFloat="":a[d]="");for(var x in l)d=l[x],l.hasOwnProperty(x)&&f[x]!==d&&sc(a,x,d)}else for(var k in l)l.hasOwnProperty(k)&&sc(a,k,l[k])}function Ws(a){if(a.indexOf("-")===-1)return!1;switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Qe=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),e0=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function so(a){return e0.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function _r(){}var Tl=null;function oc(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Xs=null,Qs=null;function p(a){var l=rs(a);if(l&&(a=l.stateNode)){var f=a[on]||null;e:switch(a=l.stateNode,l.type){case"input":if(nc(a,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name),l=f.name,f.type==="radio"&&l!=null){for(f=a;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll('input[name="'+Tt(""+l)+'"][type="radio"]'),l=0;l<f.length;l++){var d=f[l];if(d!==a&&d.form===a.form){var x=d[on]||null;if(!x)throw Error(r(90));nc(d,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(l=0;l<f.length;l++)d=f[l],d.form===a.form&&vp(d)}break e;case"textarea":Cp(a,f.value,f.defaultValue);break e;case"select":l=f.value,l!=null&&Ys(a,!!f.multiple,l,!1)}}}var S=!1;function w(a,l,f){if(S)return a(l,f);S=!0;try{var d=a(l);return d}finally{if(S=!1,(Xs!==null||Qs!==null)&&(ld(),Xs&&(l=Xs,a=Qs,Qs=Xs=null,p(l),a)))for(l=0;l<a.length;l++)p(a[l])}}function A(a,l){var f=a.stateNode;if(f===null)return null;var d=f[on]||null;if(d===null)return null;f=d[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(a=a.type,d=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!d;break e;default:a=!1}if(a)return null;if(f&&typeof f!="function")throw Error(r(231,l,typeof f));return f}var B=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),W=!1;if(B)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){W=!0}}),window.addEventListener("test",ee,ee),window.removeEventListener("test",ee,ee)}catch{W=!1}var me=null,ye=null,Le=null;function qe(){if(Le)return Le;var a,l=ye,f=l.length,d,x="value"in me?me.value:me.textContent,k=x.length;for(a=0;a<f&&l[a]===x[a];a++);var E=f-a;for(d=1;d<=E&&l[f-d]===x[k-d];d++);return Le=x.slice(a,1<d?1-d:void 0)}function yt(a){var l=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&l===13&&(a=13)):a=l,a===10&&(a=13),32<=a||a===13?a:0}function Ft(){return!0}function Zs(){return!1}function Pt(a){function l(f,d,x,k,E){this._reactName=f,this._targetInst=x,this.type=d,this.nativeEvent=k,this.target=E,this.currentTarget=null;for(var R in a)a.hasOwnProperty(R)&&(f=a[R],this[R]=f?f(k):k[R]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Ft:Zs,this.isPropagationStopped=Zs,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=Ft)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=Ft)},persist:function(){},isPersistent:Ft}),l}var zr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gi=Pt(zr),Lr=g({},zr,{view:0,detail:0}),S_=Pt(Lr),t0,n0,lc,Np=g({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:i0,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==lc&&(lc&&a.type==="mousemove"?(t0=a.screenX-lc.screenX,n0=a.screenY-lc.screenY):n0=t0=0,lc=a),t0)},movementY:function(a){return"movementY"in a?a.movementY:n0}}),fv=Pt(Np),k_=g({},Np,{dataTransfer:0}),v_=Pt(k_),C_=g({},Lr,{relatedTarget:0}),r0=Pt(C_),w_=g({},zr,{animationName:0,elapsedTime:0,pseudoElement:0}),E_=Pt(w_),N_=g({},zr,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),A_=Pt(N_),T_=g({},zr,{data:0}),hv=Pt(T_),M_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},O_={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},R_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function D_(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=R_[a])?!!l[a]:!1}function i0(){return D_}var I_=g({},Lr,{key:function(a){if(a.key){var l=M_[a.key]||a.key;if(l!=="Unidentified")return l}return a.type==="keypress"?(a=yt(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?O_[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:i0,charCode:function(a){return a.type==="keypress"?yt(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?yt(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),__=Pt(I_),z_=g({},Np,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),pv=Pt(z_),L_=g({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:i0}),B_=Pt(L_),V_=g({},zr,{propertyName:0,elapsedTime:0,pseudoElement:0}),F_=Pt(V_),P_=g({},Np,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),j_=Pt(P_),$_=g({},zr,{newState:0,oldState:0}),U_=Pt($_),J_=[9,13,27,32],s0=B&&"CompositionEvent"in window,uc=null;B&&"documentMode"in document&&(uc=document.documentMode);var H_=B&&"TextEvent"in window&&!uc,dv=B&&(!s0||uc&&8<uc&&11>=uc),mv=" ",gv=!1;function yv(a,l){switch(a){case"keyup":return J_.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xv(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ml=!1;function q_(a,l){switch(a){case"compositionend":return xv(l);case"keypress":return l.which!==32?null:(gv=!0,mv);case"textInput":return a=l.data,a===mv&&gv?null:a;default:return null}}function K_(a,l){if(Ml)return a==="compositionend"||!s0&&yv(a,l)?(a=qe(),Le=ye=me=null,Ml=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return dv&&l.locale!=="ko"?null:l.data;default:return null}}var G_={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function bv(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!G_[a.type]:l==="textarea"}function Sv(a,l,f,d){Xs?Qs?Qs.push(d):Qs=[d]:Xs=d,l=md(l,"onChange"),0<l.length&&(f=new gi("onChange","change",null,f,d),a.push({event:f,listeners:l}))}var cc=null,fc=null;function Y_(a){n2(a,0)}function Ap(a){var l=Gs(a);if(vp(l))return a}function kv(a,l){if(a==="change")return l}var vv=!1;if(B){var a0;if(B){var o0="oninput"in document;if(!o0){var Cv=document.createElement("div");Cv.setAttribute("oninput","return;"),o0=typeof Cv.oninput=="function"}a0=o0}else a0=!1;vv=a0&&(!document.documentMode||9<document.documentMode)}function wv(){cc&&(cc.detachEvent("onpropertychange",Ev),fc=cc=null)}function Ev(a){if(a.propertyName==="value"&&Ap(fc)){var l=[];Sv(l,fc,a,oc(a)),w(Y_,l)}}function W_(a,l,f){a==="focusin"?(wv(),cc=l,fc=f,cc.attachEvent("onpropertychange",Ev)):a==="focusout"&&wv()}function X_(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return Ap(fc)}function Q_(a,l){if(a==="click")return Ap(l)}function Z_(a,l){if(a==="input"||a==="change")return Ap(l)}function e6(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var gr=typeof Object.is=="function"?Object.is:e6;function hc(a,l){if(gr(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var f=Object.keys(a),d=Object.keys(l);if(f.length!==d.length)return!1;for(d=0;d<f.length;d++){var x=f[d];if(!ci.call(l,x)||!gr(a[x],l[x]))return!1}return!0}function Nv(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Av(a,l){var f=Nv(a);a=0;for(var d;f;){if(f.nodeType===3){if(d=a+f.textContent.length,a<=l&&d>=l)return{node:f,offset:l-a};a=d}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=Nv(f)}}function Tv(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?Tv(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function Mv(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var l=io(a.document);l instanceof a.HTMLIFrameElement;){try{var f=typeof l.contentWindow.location.href=="string"}catch{f=!1}if(f)a=l.contentWindow;else break;l=io(a.document)}return l}function l0(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l&&(l==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||l==="textarea"||a.contentEditable==="true")}var t6=B&&"documentMode"in document&&11>=document.documentMode,Ol=null,u0=null,pc=null,c0=!1;function Ov(a,l,f){var d=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;c0||Ol==null||Ol!==io(d)||(d=Ol,"selectionStart"in d&&l0(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),pc&&hc(pc,d)||(pc=d,d=md(u0,"onSelect"),0<d.length&&(l=new gi("onSelect","select",null,l,f),a.push({event:l,listeners:d}),l.target=Ol)))}function ao(a,l){var f={};return f[a.toLowerCase()]=l.toLowerCase(),f["Webkit"+a]="webkit"+l,f["Moz"+a]="moz"+l,f}var Rl={animationend:ao("Animation","AnimationEnd"),animationiteration:ao("Animation","AnimationIteration"),animationstart:ao("Animation","AnimationStart"),transitionrun:ao("Transition","TransitionRun"),transitionstart:ao("Transition","TransitionStart"),transitioncancel:ao("Transition","TransitionCancel"),transitionend:ao("Transition","TransitionEnd")},f0={},Rv={};B&&(Rv=document.createElement("div").style,"AnimationEvent"in window||(delete Rl.animationend.animation,delete Rl.animationiteration.animation,delete Rl.animationstart.animation),"TransitionEvent"in window||delete Rl.transitionend.transition);function oo(a){if(f0[a])return f0[a];if(!Rl[a])return a;var l=Rl[a],f;for(f in l)if(l.hasOwnProperty(f)&&f in Rv)return f0[a]=l[f];return a}var Dv=oo("animationend"),Iv=oo("animationiteration"),_v=oo("animationstart"),n6=oo("transitionrun"),r6=oo("transitionstart"),i6=oo("transitioncancel"),zv=oo("transitionend"),Lv=new Map,h0="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");h0.push("scrollEnd");function yi(a,l){Lv.set(a,l),ss(l,[a])}var Tp=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},Br=[],Dl=0,p0=0;function Mp(){for(var a=Dl,l=p0=Dl=0;l<a;){var f=Br[l];Br[l++]=null;var d=Br[l];Br[l++]=null;var x=Br[l];Br[l++]=null;var k=Br[l];if(Br[l++]=null,d!==null&&x!==null){var E=d.pending;E===null?x.next=x:(x.next=E.next,E.next=x),d.pending=x}k!==0&&Bv(f,x,k)}}function Op(a,l,f,d){Br[Dl++]=a,Br[Dl++]=l,Br[Dl++]=f,Br[Dl++]=d,p0|=d,a.lanes|=d,a=a.alternate,a!==null&&(a.lanes|=d)}function d0(a,l,f,d){return Op(a,l,f,d),Rp(a)}function lo(a,l){return Op(a,null,null,l),Rp(a)}function Bv(a,l,f){a.lanes|=f;var d=a.alternate;d!==null&&(d.lanes|=f);for(var x=!1,k=a.return;k!==null;)k.childLanes|=f,d=k.alternate,d!==null&&(d.childLanes|=f),k.tag===22&&(a=k.stateNode,a===null||a._visibility&1||(x=!0)),a=k,k=k.return;return a.tag===3?(k=a.stateNode,x&&l!==null&&(x=31-St(f),a=k.hiddenUpdates,d=a[x],d===null?a[x]=[l]:d.push(l),l.lane=f|536870912),k):null}function Rp(a){if(50<zc)throw zc=0,Cy=null,Error(r(185));for(var l=a.return;l!==null;)a=l,l=a.return;return a.tag===3?a.stateNode:null}var Il={};function s6(a,l,f,d){this.tag=a,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yr(a,l,f,d){return new s6(a,l,f,d)}function m0(a){return a=a.prototype,!(!a||!a.isReactComponent)}function as(a,l){var f=a.alternate;return f===null?(f=yr(a.tag,l,a.key,a.mode),f.elementType=a.elementType,f.type=a.type,f.stateNode=a.stateNode,f.alternate=a,a.alternate=f):(f.pendingProps=l,f.type=a.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=a.flags&65011712,f.childLanes=a.childLanes,f.lanes=a.lanes,f.child=a.child,f.memoizedProps=a.memoizedProps,f.memoizedState=a.memoizedState,f.updateQueue=a.updateQueue,l=a.dependencies,f.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},f.sibling=a.sibling,f.index=a.index,f.ref=a.ref,f.refCleanup=a.refCleanup,f}function Vv(a,l){a.flags&=65011714;var f=a.alternate;return f===null?(a.childLanes=0,a.lanes=l,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=f.childLanes,a.lanes=f.lanes,a.child=f.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=f.memoizedProps,a.memoizedState=f.memoizedState,a.updateQueue=f.updateQueue,a.type=f.type,l=f.dependencies,a.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),a}function Dp(a,l,f,d,x,k){var E=0;if(d=a,typeof a=="function")m0(a)&&(E=1);else if(typeof a=="string")E=c4(a,f,xe.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case ie:return a=yr(31,f,l,x),a.elementType=ie,a.lanes=k,a;case N:return uo(f.children,x,k,l);case T:E=8,x|=24;break;case M:return a=yr(12,f,l,x|2),a.elementType=M,a.lanes=k,a;case L:return a=yr(13,f,l,x),a.elementType=L,a.lanes=k,a;case C:return a=yr(19,f,l,x),a.elementType=C,a.lanes=k,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case P:E=10;break e;case j:E=9;break e;case J:E=11;break e;case z:E=14;break e;case q:E=16,d=null;break e}E=29,f=Error(r(130,a===null?"null":typeof a,"")),d=null}return l=yr(E,f,l,x),l.elementType=a,l.type=d,l.lanes=k,l}function uo(a,l,f,d){return a=yr(7,a,d,l),a.lanes=f,a}function g0(a,l,f){return a=yr(6,a,null,l),a.lanes=f,a}function Fv(a){var l=yr(18,null,null,0);return l.stateNode=a,l}function y0(a,l,f){return l=yr(4,a.children!==null?a.children:[],a.key,l),l.lanes=f,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}var Pv=new WeakMap;function Vr(a,l){if(typeof a=="object"&&a!==null){var f=Pv.get(a);return f!==void 0?f:(l={value:a,source:l,stack:mr(l)},Pv.set(a,l),l)}return{value:a,source:l,stack:mr(l)}}var _l=[],zl=0,Ip=null,dc=0,Fr=[],Pr=0,ea=null,Ri=1,Di="";function ls(a,l){_l[zl++]=dc,_l[zl++]=Ip,Ip=a,dc=l}function jv(a,l,f){Fr[Pr++]=Ri,Fr[Pr++]=Di,Fr[Pr++]=ea,ea=a;var d=Ri;a=Di;var x=32-St(d)-1;d&=~(1<<x),f+=1;var k=32-St(l)+x;if(30<k){var E=x-x%5;k=(d&(1<<E)-1).toString(32),d>>=E,x-=E,Ri=1<<32-St(l)+x|f<<x|d,Di=k+a}else Ri=1<<k|f<<x|d,Di=a}function x0(a){a.return!==null&&(ls(a,1),jv(a,1,0))}function b0(a){for(;a===Ip;)Ip=_l[--zl],_l[zl]=null,dc=_l[--zl],_l[zl]=null;for(;a===ea;)ea=Fr[--Pr],Fr[Pr]=null,Di=Fr[--Pr],Fr[Pr]=null,Ri=Fr[--Pr],Fr[Pr]=null}function $v(a,l){Fr[Pr++]=Ri,Fr[Pr++]=Di,Fr[Pr++]=ea,Ri=l.id,Di=l.overflow,ea=a}var ln=null,Mt=null,ot=!1,ta=null,jr=!1,S0=Error(r(519));function na(a){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw mc(Vr(l,a)),S0}function Uv(a){var l=a.stateNode,f=a.type,d=a.memoizedProps;switch(l[Ht]=a,l[on]=d,f){case"dialog":tt("cancel",l),tt("close",l);break;case"iframe":case"object":case"embed":tt("load",l);break;case"video":case"audio":for(f=0;f<Bc.length;f++)tt(Bc[f],l);break;case"source":tt("error",l);break;case"img":case"image":case"link":tt("error",l),tt("load",l);break;case"details":tt("toggle",l);break;case"input":tt("invalid",l),rc(l,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":tt("invalid",l);break;case"textarea":tt("invalid",l),wp(l,d.value,d.defaultValue,d.children)}f=d.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||l.textContent===""+f||d.suppressHydrationWarning===!0||a2(l.textContent,f)?(d.popover!=null&&(tt("beforetoggle",l),tt("toggle",l)),d.onScroll!=null&&tt("scroll",l),d.onScrollEnd!=null&&tt("scrollend",l),d.onClick!=null&&(l.onclick=_r),l=!0):l=!1,l||na(a,!0)}function Jv(a){for(ln=a.return;ln;)switch(ln.tag){case 5:case 31:case 13:jr=!1;return;case 27:case 3:jr=!0;return;default:ln=ln.return}}function Ll(a){if(a!==ln)return!1;if(!ot)return Jv(a),ot=!0,!1;var l=a.tag,f;if((f=l!==3&&l!==27)&&((f=l===5)&&(f=a.type,f=!(f!=="form"&&f!=="button")||Vy(a.type,a.memoizedProps)),f=!f),f&&Mt&&na(a),Jv(a),l===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Mt=m2(a)}else if(l===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Mt=m2(a)}else l===27?(l=Mt,ga(a.type)?(a=Uy,Uy=null,Mt=a):Mt=l):Mt=ln?Ur(a.stateNode.nextSibling):null;return!0}function co(){Mt=ln=null,ot=!1}function k0(){var a=ta;return a!==null&&(rr===null?rr=a:rr.push.apply(rr,a),ta=null),a}function mc(a){ta===null?ta=[a]:ta.push(a)}var v0=F(null),fo=null,us=null;function ra(a,l,f){V(v0,l._currentValue),l._currentValue=f}function cs(a){a._currentValue=v0.current,Q(v0)}function C0(a,l,f){for(;a!==null;){var d=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,d!==null&&(d.childLanes|=l)):d!==null&&(d.childLanes&l)!==l&&(d.childLanes|=l),a===f)break;a=a.return}}function w0(a,l,f,d){var x=a.child;for(x!==null&&(x.return=a);x!==null;){var k=x.dependencies;if(k!==null){var E=x.child;k=k.firstContext;e:for(;k!==null;){var R=k;k=x;for(var $=0;$<l.length;$++)if(R.context===l[$]){k.lanes|=f,R=k.alternate,R!==null&&(R.lanes|=f),C0(k.return,f,a),d||(E=null);break e}k=R.next}}else if(x.tag===18){if(E=x.return,E===null)throw Error(r(341));E.lanes|=f,k=E.alternate,k!==null&&(k.lanes|=f),C0(E,f,a),E=null}else E=x.child;if(E!==null)E.return=x;else for(E=x;E!==null;){if(E===a){E=null;break}if(x=E.sibling,x!==null){x.return=E.return,E=x;break}E=E.return}x=E}}function Bl(a,l,f,d){a=null;for(var x=l,k=!1;x!==null;){if(!k){if((x.flags&524288)!==0)k=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var E=x.alternate;if(E===null)throw Error(r(387));if(E=E.memoizedProps,E!==null){var R=x.type;gr(x.pendingProps.value,E.value)||(a!==null?a.push(R):a=[R])}}else if(x===We.current){if(E=x.alternate,E===null)throw Error(r(387));E.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(a!==null?a.push($c):a=[$c])}x=x.return}a!==null&&w0(l,a,f,d),l.flags|=262144}function _p(a){for(a=a.firstContext;a!==null;){if(!gr(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function ho(a){fo=a,us=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function un(a){return Hv(fo,a)}function zp(a,l){return fo===null&&ho(a),Hv(a,l)}function Hv(a,l){var f=l._currentValue;if(l={context:l,memoizedValue:f,next:null},us===null){if(a===null)throw Error(r(308));us=l,a.dependencies={lanes:0,firstContext:l},a.flags|=524288}else us=us.next=l;return f}var a6=typeof AbortController<"u"?AbortController:function(){var a=[],l=this.signal={aborted:!1,addEventListener:function(f,d){a.push(d)}};this.abort=function(){l.aborted=!0,a.forEach(function(f){return f()})}},o6=t.unstable_scheduleCallback,l6=t.unstable_NormalPriority,Kt={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function E0(){return{controller:new a6,data:new Map,refCount:0}}function gc(a){a.refCount--,a.refCount===0&&o6(l6,function(){a.controller.abort()})}var yc=null,N0=0,Vl=0,Fl=null;function u6(a,l){if(yc===null){var f=yc=[];N0=0,Vl=My(),Fl={status:"pending",value:void 0,then:function(d){f.push(d)}}}return N0++,l.then(qv,qv),l}function qv(){if(--N0===0&&yc!==null){Fl!==null&&(Fl.status="fulfilled");var a=yc;yc=null,Vl=0,Fl=null;for(var l=0;l<a.length;l++)(0,a[l])()}}function c6(a,l){var f=[],d={status:"pending",value:null,reason:null,then:function(x){f.push(x)}};return a.then(function(){d.status="fulfilled",d.value=l;for(var x=0;x<f.length;x++)(0,f[x])(l)},function(x){for(d.status="rejected",d.reason=x,x=0;x<f.length;x++)(0,f[x])(void 0)}),d}var Kv=X.S;X.S=function(a,l){Ow=$e(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&u6(a,l),Kv!==null&&Kv(a,l)};var po=F(null);function A0(){var a=po.current;return a!==null?a:At.pooledCache}function Lp(a,l){l===null?V(po,po.current):V(po,l.pool)}function Gv(){var a=A0();return a===null?null:{parent:Kt._currentValue,pool:a}}var Pl=Error(r(460)),T0=Error(r(474)),Bp=Error(r(542)),Vp={then:function(){}};function Yv(a){return a=a.status,a==="fulfilled"||a==="rejected"}function Wv(a,l,f){switch(f=a[f],f===void 0?a.push(l):f!==l&&(l.then(_r,_r),l=f),l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,Qv(a),a;default:if(typeof l.status=="string")l.then(_r,_r);else{if(a=At,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=l,a.status="pending",a.then(function(d){if(l.status==="pending"){var x=l;x.status="fulfilled",x.value=d}},function(d){if(l.status==="pending"){var x=l;x.status="rejected",x.reason=d}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,Qv(a),a}throw go=l,Pl}}function mo(a){try{var l=a._init;return l(a._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(go=f,Pl):f}}var go=null;function Xv(){if(go===null)throw Error(r(459));var a=go;return go=null,a}function Qv(a){if(a===Pl||a===Bp)throw Error(r(483))}var jl=null,xc=0;function Fp(a){var l=xc;return xc+=1,jl===null&&(jl=[]),Wv(jl,a,l)}function bc(a,l){l=l.props.ref,a.ref=l!==void 0?l:null}function Pp(a,l){throw l.$$typeof===y?Error(r(525)):(a=Object.prototype.toString.call(l),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a)))}function Zv(a){function l(Y,U){if(a){var Z=Y.deletions;Z===null?(Y.deletions=[U],Y.flags|=16):Z.push(U)}}function f(Y,U){if(!a)return null;for(;U!==null;)l(Y,U),U=U.sibling;return null}function d(Y){for(var U=new Map;Y!==null;)Y.key!==null?U.set(Y.key,Y):U.set(Y.index,Y),Y=Y.sibling;return U}function x(Y,U){return Y=as(Y,U),Y.index=0,Y.sibling=null,Y}function k(Y,U,Z){return Y.index=Z,a?(Z=Y.alternate,Z!==null?(Z=Z.index,Z<U?(Y.flags|=67108866,U):Z):(Y.flags|=67108866,U)):(Y.flags|=1048576,U)}function E(Y){return a&&Y.alternate===null&&(Y.flags|=67108866),Y}function R(Y,U,Z,ue){return U===null||U.tag!==6?(U=g0(Z,Y.mode,ue),U.return=Y,U):(U=x(U,Z),U.return=Y,U)}function $(Y,U,Z,ue){var Ie=Z.type;return Ie===N?se(Y,U,Z.props.children,ue,Z.key):U!==null&&(U.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===q&&mo(Ie)===U.type)?(U=x(U,Z.props),bc(U,Z),U.return=Y,U):(U=Dp(Z.type,Z.key,Z.props,null,Y.mode,ue),bc(U,Z),U.return=Y,U)}function te(Y,U,Z,ue){return U===null||U.tag!==4||U.stateNode.containerInfo!==Z.containerInfo||U.stateNode.implementation!==Z.implementation?(U=y0(Z,Y.mode,ue),U.return=Y,U):(U=x(U,Z.children||[]),U.return=Y,U)}function se(Y,U,Z,ue,Ie){return U===null||U.tag!==7?(U=uo(Z,Y.mode,ue,Ie),U.return=Y,U):(U=x(U,Z),U.return=Y,U)}function he(Y,U,Z){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=g0(""+U,Y.mode,Z),U.return=Y,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case b:return Z=Dp(U.type,U.key,U.props,null,Y.mode,Z),bc(Z,U),Z.return=Y,Z;case v:return U=y0(U,Y.mode,Z),U.return=Y,U;case q:return U=mo(U),he(Y,U,Z)}if(Re(U)||fe(U))return U=uo(U,Y.mode,Z,null),U.return=Y,U;if(typeof U.then=="function")return he(Y,Fp(U),Z);if(U.$$typeof===P)return he(Y,zp(Y,U),Z);Pp(Y,U)}return null}function ne(Y,U,Z,ue){var Ie=U!==null?U.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Ie!==null?null:R(Y,U,""+Z,ue);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case b:return Z.key===Ie?$(Y,U,Z,ue):null;case v:return Z.key===Ie?te(Y,U,Z,ue):null;case q:return Z=mo(Z),ne(Y,U,Z,ue)}if(Re(Z)||fe(Z))return Ie!==null?null:se(Y,U,Z,ue,null);if(typeof Z.then=="function")return ne(Y,U,Fp(Z),ue);if(Z.$$typeof===P)return ne(Y,U,zp(Y,Z),ue);Pp(Y,Z)}return null}function re(Y,U,Z,ue,Ie){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return Y=Y.get(Z)||null,R(U,Y,""+ue,Ie);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case b:return Y=Y.get(ue.key===null?Z:ue.key)||null,$(U,Y,ue,Ie);case v:return Y=Y.get(ue.key===null?Z:ue.key)||null,te(U,Y,ue,Ie);case q:return ue=mo(ue),re(Y,U,Z,ue,Ie)}if(Re(ue)||fe(ue))return Y=Y.get(Z)||null,se(U,Y,ue,Ie,null);if(typeof ue.then=="function")return re(Y,U,Z,Fp(ue),Ie);if(ue.$$typeof===P)return re(Y,U,Z,zp(U,ue),Ie);Pp(U,ue)}return null}function Ce(Y,U,Z,ue){for(var Ie=null,ht=null,Me=U,Ye=U=0,it=null;Me!==null&&Ye<Z.length;Ye++){Me.index>Ye?(it=Me,Me=null):it=Me.sibling;var pt=ne(Y,Me,Z[Ye],ue);if(pt===null){Me===null&&(Me=it);break}a&&Me&&pt.alternate===null&&l(Y,Me),U=k(pt,U,Ye),ht===null?Ie=pt:ht.sibling=pt,ht=pt,Me=it}if(Ye===Z.length)return f(Y,Me),ot&&ls(Y,Ye),Ie;if(Me===null){for(;Ye<Z.length;Ye++)Me=he(Y,Z[Ye],ue),Me!==null&&(U=k(Me,U,Ye),ht===null?Ie=Me:ht.sibling=Me,ht=Me);return ot&&ls(Y,Ye),Ie}for(Me=d(Me);Ye<Z.length;Ye++)it=re(Me,Y,Ye,Z[Ye],ue),it!==null&&(a&&it.alternate!==null&&Me.delete(it.key===null?Ye:it.key),U=k(it,U,Ye),ht===null?Ie=it:ht.sibling=it,ht=it);return a&&Me.forEach(function(ka){return l(Y,ka)}),ot&&ls(Y,Ye),Ie}function Be(Y,U,Z,ue){if(Z==null)throw Error(r(151));for(var Ie=null,ht=null,Me=U,Ye=U=0,it=null,pt=Z.next();Me!==null&&!pt.done;Ye++,pt=Z.next()){Me.index>Ye?(it=Me,Me=null):it=Me.sibling;var ka=ne(Y,Me,pt.value,ue);if(ka===null){Me===null&&(Me=it);break}a&&Me&&ka.alternate===null&&l(Y,Me),U=k(ka,U,Ye),ht===null?Ie=ka:ht.sibling=ka,ht=ka,Me=it}if(pt.done)return f(Y,Me),ot&&ls(Y,Ye),Ie;if(Me===null){for(;!pt.done;Ye++,pt=Z.next())pt=he(Y,pt.value,ue),pt!==null&&(U=k(pt,U,Ye),ht===null?Ie=pt:ht.sibling=pt,ht=pt);return ot&&ls(Y,Ye),Ie}for(Me=d(Me);!pt.done;Ye++,pt=Z.next())pt=re(Me,Y,Ye,pt.value,ue),pt!==null&&(a&&pt.alternate!==null&&Me.delete(pt.key===null?Ye:pt.key),U=k(pt,U,Ye),ht===null?Ie=pt:ht.sibling=pt,ht=pt);return a&&Me.forEach(function(k4){return l(Y,k4)}),ot&&ls(Y,Ye),Ie}function Nt(Y,U,Z,ue){if(typeof Z=="object"&&Z!==null&&Z.type===N&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case b:e:{for(var Ie=Z.key;U!==null;){if(U.key===Ie){if(Ie=Z.type,Ie===N){if(U.tag===7){f(Y,U.sibling),ue=x(U,Z.props.children),ue.return=Y,Y=ue;break e}}else if(U.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===q&&mo(Ie)===U.type){f(Y,U.sibling),ue=x(U,Z.props),bc(ue,Z),ue.return=Y,Y=ue;break e}f(Y,U);break}else l(Y,U);U=U.sibling}Z.type===N?(ue=uo(Z.props.children,Y.mode,ue,Z.key),ue.return=Y,Y=ue):(ue=Dp(Z.type,Z.key,Z.props,null,Y.mode,ue),bc(ue,Z),ue.return=Y,Y=ue)}return E(Y);case v:e:{for(Ie=Z.key;U!==null;){if(U.key===Ie)if(U.tag===4&&U.stateNode.containerInfo===Z.containerInfo&&U.stateNode.implementation===Z.implementation){f(Y,U.sibling),ue=x(U,Z.children||[]),ue.return=Y,Y=ue;break e}else{f(Y,U);break}else l(Y,U);U=U.sibling}ue=y0(Z,Y.mode,ue),ue.return=Y,Y=ue}return E(Y);case q:return Z=mo(Z),Nt(Y,U,Z,ue)}if(Re(Z))return Ce(Y,U,Z,ue);if(fe(Z)){if(Ie=fe(Z),typeof Ie!="function")throw Error(r(150));return Z=Ie.call(Z),Be(Y,U,Z,ue)}if(typeof Z.then=="function")return Nt(Y,U,Fp(Z),ue);if(Z.$$typeof===P)return Nt(Y,U,zp(Y,Z),ue);Pp(Y,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,U!==null&&U.tag===6?(f(Y,U.sibling),ue=x(U,Z),ue.return=Y,Y=ue):(f(Y,U),ue=g0(Z,Y.mode,ue),ue.return=Y,Y=ue),E(Y)):f(Y,U)}return function(Y,U,Z,ue){try{xc=0;var Ie=Nt(Y,U,Z,ue);return jl=null,Ie}catch(Me){if(Me===Pl||Me===Bp)throw Me;var ht=yr(29,Me,null,Y.mode);return ht.lanes=ue,ht.return=Y,ht}}}var yo=Zv(!0),eC=Zv(!1),ia=!1;function M0(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function O0(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function sa(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function aa(a,l,f){var d=a.updateQueue;if(d===null)return null;if(d=d.shared,(dt&2)!==0){var x=d.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),d.pending=l,l=Rp(a),Bv(a,null,f),l}return Op(a,d,l,f),Rp(a)}function Sc(a,l,f){if(l=l.updateQueue,l!==null&&(l=l.shared,(f&4194048)!==0)){var d=l.lanes;d&=a.pendingLanes,f|=d,l.lanes=f,mp(a,f)}}function R0(a,l){var f=a.updateQueue,d=a.alternate;if(d!==null&&(d=d.updateQueue,f===d)){var x=null,k=null;if(f=f.firstBaseUpdate,f!==null){do{var E={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};k===null?x=k=E:k=k.next=E,f=f.next}while(f!==null);k===null?x=k=l:k=k.next=l}else x=k=l;f={baseState:d.baseState,firstBaseUpdate:x,lastBaseUpdate:k,shared:d.shared,callbacks:d.callbacks},a.updateQueue=f;return}a=f.lastBaseUpdate,a===null?f.firstBaseUpdate=l:a.next=l,f.lastBaseUpdate=l}var D0=!1;function kc(){if(D0){var a=Fl;if(a!==null)throw a}}function vc(a,l,f,d){D0=!1;var x=a.updateQueue;ia=!1;var k=x.firstBaseUpdate,E=x.lastBaseUpdate,R=x.shared.pending;if(R!==null){x.shared.pending=null;var $=R,te=$.next;$.next=null,E===null?k=te:E.next=te,E=$;var se=a.alternate;se!==null&&(se=se.updateQueue,R=se.lastBaseUpdate,R!==E&&(R===null?se.firstBaseUpdate=te:R.next=te,se.lastBaseUpdate=$))}if(k!==null){var he=x.baseState;E=0,se=te=$=null,R=k;do{var ne=R.lane&-536870913,re=ne!==R.lane;if(re?(rt&ne)===ne:(d&ne)===ne){ne!==0&&ne===Vl&&(D0=!0),se!==null&&(se=se.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var Ce=a,Be=R;ne=l;var Nt=f;switch(Be.tag){case 1:if(Ce=Be.payload,typeof Ce=="function"){he=Ce.call(Nt,he,ne);break e}he=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=Be.payload,ne=typeof Ce=="function"?Ce.call(Nt,he,ne):Ce,ne==null)break e;he=g({},he,ne);break e;case 2:ia=!0}}ne=R.callback,ne!==null&&(a.flags|=64,re&&(a.flags|=8192),re=x.callbacks,re===null?x.callbacks=[ne]:re.push(ne))}else re={lane:ne,tag:R.tag,payload:R.payload,callback:R.callback,next:null},se===null?(te=se=re,$=he):se=se.next=re,E|=ne;if(R=R.next,R===null){if(R=x.shared.pending,R===null)break;re=R,R=re.next,re.next=null,x.lastBaseUpdate=re,x.shared.pending=null}}while(!0);se===null&&($=he),x.baseState=$,x.firstBaseUpdate=te,x.lastBaseUpdate=se,k===null&&(x.shared.lanes=0),fa|=E,a.lanes=E,a.memoizedState=he}}function tC(a,l){if(typeof a!="function")throw Error(r(191,a));a.call(l)}function nC(a,l){var f=a.callbacks;if(f!==null)for(a.callbacks=null,a=0;a<f.length;a++)tC(f[a],l)}var $l=F(null),jp=F(0);function rC(a,l){a=bs,V(jp,a),V($l,l),bs=a|l.baseLanes}function I0(){V(jp,bs),V($l,$l.current)}function _0(){bs=jp.current,Q($l),Q(jp)}var xr=F(null),$r=null;function oa(a){var l=a.alternate;V(jt,jt.current&1),V(xr,a),$r===null&&(l===null||$l.current!==null||l.memoizedState!==null)&&($r=a)}function z0(a){V(jt,jt.current),V(xr,a),$r===null&&($r=a)}function iC(a){a.tag===22?(V(jt,jt.current),V(xr,a),$r===null&&($r=a)):la()}function la(){V(jt,jt.current),V(xr,xr.current)}function br(a){Q(xr),$r===a&&($r=null),Q(jt)}var jt=F(0);function $p(a){for(var l=a;l!==null;){if(l.tag===13){var f=l.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||jy(f)||$y(f)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var fs=0,Ke=null,wt=null,Gt=null,Up=!1,Ul=!1,xo=!1,Jp=0,Cc=0,Jl=null,f6=0;function Bt(){throw Error(r(321))}function L0(a,l){if(l===null)return!1;for(var f=0;f<l.length&&f<a.length;f++)if(!gr(a[f],l[f]))return!1;return!0}function B0(a,l,f,d,x,k){return fs=k,Ke=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,X.H=a===null||a.memoizedState===null?jC:Q0,xo=!1,k=f(d,x),xo=!1,Ul&&(k=aC(l,f,d,x)),sC(a),k}function sC(a){X.H=Nc;var l=wt!==null&&wt.next!==null;if(fs=0,Gt=wt=Ke=null,Up=!1,Cc=0,Jl=null,l)throw Error(r(300));a===null||Yt||(a=a.dependencies,a!==null&&_p(a)&&(Yt=!0))}function aC(a,l,f,d){Ke=a;var x=0;do{if(Ul&&(Jl=null),Cc=0,Ul=!1,25<=x)throw Error(r(301));if(x+=1,Gt=wt=null,a.updateQueue!=null){var k=a.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}X.H=$C,k=l(f,d)}while(Ul);return k}function h6(){var a=X.H,l=a.useState()[0];return l=typeof l.then=="function"?wc(l):l,a=a.useState()[0],(wt!==null?wt.memoizedState:null)!==a&&(Ke.flags|=1024),l}function V0(){var a=Jp!==0;return Jp=0,a}function F0(a,l,f){l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~f}function P0(a){if(Up){for(a=a.memoizedState;a!==null;){var l=a.queue;l!==null&&(l.pending=null),a=a.next}Up=!1}fs=0,Gt=wt=Ke=null,Ul=!1,Cc=Jp=0,Jl=null}function _n(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?Ke.memoizedState=Gt=a:Gt=Gt.next=a,Gt}function $t(){if(wt===null){var a=Ke.alternate;a=a!==null?a.memoizedState:null}else a=wt.next;var l=Gt===null?Ke.memoizedState:Gt.next;if(l!==null)Gt=l,wt=a;else{if(a===null)throw Ke.alternate===null?Error(r(467)):Error(r(310));wt=a,a={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},Gt===null?Ke.memoizedState=Gt=a:Gt=Gt.next=a}return Gt}function Hp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wc(a){var l=Cc;return Cc+=1,Jl===null&&(Jl=[]),a=Wv(Jl,a,l),l=Ke,(Gt===null?l.memoizedState:Gt.next)===null&&(l=l.alternate,X.H=l===null||l.memoizedState===null?jC:Q0),a}function qp(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return wc(a);if(a.$$typeof===P)return un(a)}throw Error(r(438,String(a)))}function j0(a){var l=null,f=Ke.updateQueue;if(f!==null&&(l=f.memoCache),l==null){var d=Ke.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(l={data:d.data.map(function(x){return x.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),f===null&&(f=Hp(),Ke.updateQueue=f),f.memoCache=l,f=l.data[l.index],f===void 0)for(f=l.data[l.index]=Array(a),d=0;d<a;d++)f[d]=K;return l.index++,f}function hs(a,l){return typeof l=="function"?l(a):l}function Kp(a){var l=$t();return $0(l,wt,a)}function $0(a,l,f){var d=a.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=f;var x=a.baseQueue,k=d.pending;if(k!==null){if(x!==null){var E=x.next;x.next=k.next,k.next=E}l.baseQueue=x=k,d.pending=null}if(k=a.baseState,x===null)a.memoizedState=k;else{l=x.next;var R=E=null,$=null,te=l,se=!1;do{var he=te.lane&-536870913;if(he!==te.lane?(rt&he)===he:(fs&he)===he){var ne=te.revertLane;if(ne===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),he===Vl&&(se=!0);else if((fs&ne)===ne){te=te.next,ne===Vl&&(se=!0);continue}else he={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},$===null?(R=$=he,E=k):$=$.next=he,Ke.lanes|=ne,fa|=ne;he=te.action,xo&&f(k,he),k=te.hasEagerState?te.eagerState:f(k,he)}else ne={lane:he,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},$===null?(R=$=ne,E=k):$=$.next=ne,Ke.lanes|=he,fa|=he;te=te.next}while(te!==null&&te!==l);if($===null?E=k:$.next=R,!gr(k,a.memoizedState)&&(Yt=!0,se&&(f=Fl,f!==null)))throw f;a.memoizedState=k,a.baseState=E,a.baseQueue=$,d.lastRenderedState=k}return x===null&&(d.lanes=0),[a.memoizedState,d.dispatch]}function U0(a){var l=$t(),f=l.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=a;var d=f.dispatch,x=f.pending,k=l.memoizedState;if(x!==null){f.pending=null;var E=x=x.next;do k=a(k,E.action),E=E.next;while(E!==x);gr(k,l.memoizedState)||(Yt=!0),l.memoizedState=k,l.baseQueue===null&&(l.baseState=k),f.lastRenderedState=k}return[k,d]}function oC(a,l,f){var d=Ke,x=$t(),k=ot;if(k){if(f===void 0)throw Error(r(407));f=f()}else f=l();var E=!gr((wt||x).memoizedState,f);if(E&&(x.memoizedState=f,Yt=!0),x=x.queue,q0(cC.bind(null,d,x,a),[a]),x.getSnapshot!==l||E||Gt!==null&&Gt.memoizedState.tag&1){if(d.flags|=2048,Hl(9,{destroy:void 0},uC.bind(null,d,x,f,l),null),At===null)throw Error(r(349));k||(fs&127)!==0||lC(d,l,f)}return f}function lC(a,l,f){a.flags|=16384,a={getSnapshot:l,value:f},l=Ke.updateQueue,l===null?(l=Hp(),Ke.updateQueue=l,l.stores=[a]):(f=l.stores,f===null?l.stores=[a]:f.push(a))}function uC(a,l,f,d){l.value=f,l.getSnapshot=d,fC(l)&&hC(a)}function cC(a,l,f){return f(function(){fC(l)&&hC(a)})}function fC(a){var l=a.getSnapshot;a=a.value;try{var f=l();return!gr(a,f)}catch{return!0}}function hC(a){var l=lo(a,2);l!==null&&ir(l,a,2)}function J0(a){var l=_n();if(typeof a=="function"){var f=a;if(a=f(),xo){gn(!0);try{f()}finally{gn(!1)}}}return l.memoizedState=l.baseState=a,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:a},l}function pC(a,l,f,d){return a.baseState=f,$0(a,wt,typeof d=="function"?d:hs)}function p6(a,l,f,d,x){if(Wp(a))throw Error(r(485));if(a=l.action,a!==null){var k={payload:x,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){k.listeners.push(E)}};X.T!==null?f(!0):k.isTransition=!1,d(k),f=l.pending,f===null?(k.next=l.pending=k,dC(l,k)):(k.next=f.next,l.pending=f.next=k)}}function dC(a,l){var f=l.action,d=l.payload,x=a.state;if(l.isTransition){var k=X.T,E={};X.T=E;try{var R=f(x,d),$=X.S;$!==null&&$(E,R),mC(a,l,R)}catch(te){H0(a,l,te)}finally{k!==null&&E.types!==null&&(k.types=E.types),X.T=k}}else try{k=f(x,d),mC(a,l,k)}catch(te){H0(a,l,te)}}function mC(a,l,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(d){gC(a,l,d)},function(d){return H0(a,l,d)}):gC(a,l,f)}function gC(a,l,f){l.status="fulfilled",l.value=f,yC(l),a.state=f,l=a.pending,l!==null&&(f=l.next,f===l?a.pending=null:(f=f.next,l.next=f,dC(a,f)))}function H0(a,l,f){var d=a.pending;if(a.pending=null,d!==null){d=d.next;do l.status="rejected",l.reason=f,yC(l),l=l.next;while(l!==d)}a.action=null}function yC(a){a=a.listeners;for(var l=0;l<a.length;l++)(0,a[l])()}function xC(a,l){return l}function bC(a,l){if(ot){var f=At.formState;if(f!==null){e:{var d=Ke;if(ot){if(Mt){t:{for(var x=Mt,k=jr;x.nodeType!==8;){if(!k){x=null;break t}if(x=Ur(x.nextSibling),x===null){x=null;break t}}k=x.data,x=k==="F!"||k==="F"?x:null}if(x){Mt=Ur(x.nextSibling),d=x.data==="F!";break e}}na(d)}d=!1}d&&(l=f[0])}}return f=_n(),f.memoizedState=f.baseState=l,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xC,lastRenderedState:l},f.queue=d,f=VC.bind(null,Ke,d),d.dispatch=f,d=J0(!1),k=X0.bind(null,Ke,!1,d.queue),d=_n(),x={state:l,dispatch:null,action:a,pending:null},d.queue=x,f=p6.bind(null,Ke,x,k,f),x.dispatch=f,d.memoizedState=a,[l,f,!1]}function SC(a){var l=$t();return kC(l,wt,a)}function kC(a,l,f){if(l=$0(a,l,xC)[0],a=Kp(hs)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var d=wc(l)}catch(E){throw E===Pl?Bp:E}else d=l;l=$t();var x=l.queue,k=x.dispatch;return f!==l.memoizedState&&(Ke.flags|=2048,Hl(9,{destroy:void 0},d6.bind(null,x,f),null)),[d,k,a]}function d6(a,l){a.action=l}function vC(a){var l=$t(),f=wt;if(f!==null)return kC(l,f,a);$t(),l=l.memoizedState,f=$t();var d=f.queue.dispatch;return f.memoizedState=a,[l,d,!1]}function Hl(a,l,f,d){return a={tag:a,create:f,deps:d,inst:l,next:null},l=Ke.updateQueue,l===null&&(l=Hp(),Ke.updateQueue=l),f=l.lastEffect,f===null?l.lastEffect=a.next=a:(d=f.next,f.next=a,a.next=d,l.lastEffect=a),a}function CC(){return $t().memoizedState}function Gp(a,l,f,d){var x=_n();Ke.flags|=a,x.memoizedState=Hl(1|l,{destroy:void 0},f,d===void 0?null:d)}function Yp(a,l,f,d){var x=$t();d=d===void 0?null:d;var k=x.memoizedState.inst;wt!==null&&d!==null&&L0(d,wt.memoizedState.deps)?x.memoizedState=Hl(l,k,f,d):(Ke.flags|=a,x.memoizedState=Hl(1|l,k,f,d))}function wC(a,l){Gp(8390656,8,a,l)}function q0(a,l){Yp(2048,8,a,l)}function m6(a){Ke.flags|=4;var l=Ke.updateQueue;if(l===null)l=Hp(),Ke.updateQueue=l,l.events=[a];else{var f=l.events;f===null?l.events=[a]:f.push(a)}}function EC(a){var l=$t().memoizedState;return m6({ref:l,nextImpl:a}),function(){if((dt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function NC(a,l){return Yp(4,2,a,l)}function AC(a,l){return Yp(4,4,a,l)}function TC(a,l){if(typeof l=="function"){a=a();var f=l(a);return function(){typeof f=="function"?f():l(null)}}if(l!=null)return a=a(),l.current=a,function(){l.current=null}}function MC(a,l,f){f=f!=null?f.concat([a]):null,Yp(4,4,TC.bind(null,l,a),f)}function K0(){}function OC(a,l){var f=$t();l=l===void 0?null:l;var d=f.memoizedState;return l!==null&&L0(l,d[1])?d[0]:(f.memoizedState=[a,l],a)}function RC(a,l){var f=$t();l=l===void 0?null:l;var d=f.memoizedState;if(l!==null&&L0(l,d[1]))return d[0];if(d=a(),xo){gn(!0);try{a()}finally{gn(!1)}}return f.memoizedState=[d,l],d}function G0(a,l,f){return f===void 0||(fs&1073741824)!==0&&(rt&261930)===0?a.memoizedState=l:(a.memoizedState=f,a=Dw(),Ke.lanes|=a,fa|=a,f)}function DC(a,l,f,d){return gr(f,l)?f:$l.current!==null?(a=G0(a,f,d),gr(a,l)||(Yt=!0),a):(fs&42)===0||(fs&1073741824)!==0&&(rt&261930)===0?(Yt=!0,a.memoizedState=f):(a=Dw(),Ke.lanes|=a,fa|=a,l)}function IC(a,l,f,d,x){var k=oe.p;oe.p=k!==0&&8>k?k:8;var E=X.T,R={};X.T=R,X0(a,!1,l,f);try{var $=x(),te=X.S;if(te!==null&&te(R,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var se=c6($,d);Ec(a,l,se,vr(a))}else Ec(a,l,d,vr(a))}catch(he){Ec(a,l,{then:function(){},status:"rejected",reason:he},vr())}finally{oe.p=k,E!==null&&R.types!==null&&(E.types=R.types),X.T=E}}function g6(){}function Y0(a,l,f,d){if(a.tag!==5)throw Error(r(476));var x=_C(a).queue;IC(a,x,l,ke,f===null?g6:function(){return zC(a),f(d)})}function _C(a){var l=a.memoizedState;if(l!==null)return l;l={memoizedState:ke,baseState:ke,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:ke},next:null};var f={};return l.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:f},next:null},a.memoizedState=l,a=a.alternate,a!==null&&(a.memoizedState=l),l}function zC(a){var l=_C(a);l.next===null&&(l=a.alternate.memoizedState),Ec(a,l.next.queue,{},vr())}function W0(){return un($c)}function LC(){return $t().memoizedState}function BC(){return $t().memoizedState}function y6(a){for(var l=a.return;l!==null;){switch(l.tag){case 24:case 3:var f=vr();a=sa(f);var d=aa(l,a,f);d!==null&&(ir(d,l,f),Sc(d,l,f)),l={cache:E0()},a.payload=l;return}l=l.return}}function x6(a,l,f){var d=vr();f={lane:d,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Wp(a)?FC(l,f):(f=d0(a,l,f,d),f!==null&&(ir(f,a,d),PC(f,l,d)))}function VC(a,l,f){var d=vr();Ec(a,l,f,d)}function Ec(a,l,f,d){var x={lane:d,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(Wp(a))FC(l,x);else{var k=a.alternate;if(a.lanes===0&&(k===null||k.lanes===0)&&(k=l.lastRenderedReducer,k!==null))try{var E=l.lastRenderedState,R=k(E,f);if(x.hasEagerState=!0,x.eagerState=R,gr(R,E))return Op(a,l,x,0),At===null&&Mp(),!1}catch{}if(f=d0(a,l,x,d),f!==null)return ir(f,a,d),PC(f,l,d),!0}return!1}function X0(a,l,f,d){if(d={lane:2,revertLane:My(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Wp(a)){if(l)throw Error(r(479))}else l=d0(a,f,d,2),l!==null&&ir(l,a,2)}function Wp(a){var l=a.alternate;return a===Ke||l!==null&&l===Ke}function FC(a,l){Ul=Up=!0;var f=a.pending;f===null?l.next=l:(l.next=f.next,f.next=l),a.pending=l}function PC(a,l,f){if((f&4194048)!==0){var d=l.lanes;d&=a.pendingLanes,f|=d,l.lanes=f,mp(a,f)}}var Nc={readContext:un,use:qp,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useLayoutEffect:Bt,useInsertionEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useSyncExternalStore:Bt,useId:Bt,useHostTransitionStatus:Bt,useFormState:Bt,useActionState:Bt,useOptimistic:Bt,useMemoCache:Bt,useCacheRefresh:Bt};Nc.useEffectEvent=Bt;var jC={readContext:un,use:qp,useCallback:function(a,l){return _n().memoizedState=[a,l===void 0?null:l],a},useContext:un,useEffect:wC,useImperativeHandle:function(a,l,f){f=f!=null?f.concat([a]):null,Gp(4194308,4,TC.bind(null,l,a),f)},useLayoutEffect:function(a,l){return Gp(4194308,4,a,l)},useInsertionEffect:function(a,l){Gp(4,2,a,l)},useMemo:function(a,l){var f=_n();l=l===void 0?null:l;var d=a();if(xo){gn(!0);try{a()}finally{gn(!1)}}return f.memoizedState=[d,l],d},useReducer:function(a,l,f){var d=_n();if(f!==void 0){var x=f(l);if(xo){gn(!0);try{f(l)}finally{gn(!1)}}}else x=l;return d.memoizedState=d.baseState=x,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:x},d.queue=a,a=a.dispatch=x6.bind(null,Ke,a),[d.memoizedState,a]},useRef:function(a){var l=_n();return a={current:a},l.memoizedState=a},useState:function(a){a=J0(a);var l=a.queue,f=VC.bind(null,Ke,l);return l.dispatch=f,[a.memoizedState,f]},useDebugValue:K0,useDeferredValue:function(a,l){var f=_n();return G0(f,a,l)},useTransition:function(){var a=J0(!1);return a=IC.bind(null,Ke,a.queue,!0,!1),_n().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,l,f){var d=Ke,x=_n();if(ot){if(f===void 0)throw Error(r(407));f=f()}else{if(f=l(),At===null)throw Error(r(349));(rt&127)!==0||lC(d,l,f)}x.memoizedState=f;var k={value:f,getSnapshot:l};return x.queue=k,wC(cC.bind(null,d,k,a),[a]),d.flags|=2048,Hl(9,{destroy:void 0},uC.bind(null,d,k,f,l),null),f},useId:function(){var a=_n(),l=At.identifierPrefix;if(ot){var f=Di,d=Ri;f=(d&~(1<<32-St(d)-1)).toString(32)+f,l="_"+l+"R_"+f,f=Jp++,0<f&&(l+="H"+f.toString(32)),l+="_"}else f=f6++,l="_"+l+"r_"+f.toString(32)+"_";return a.memoizedState=l},useHostTransitionStatus:W0,useFormState:bC,useActionState:bC,useOptimistic:function(a){var l=_n();l.memoizedState=l.baseState=a;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=f,l=X0.bind(null,Ke,!0,f),f.dispatch=l,[a,l]},useMemoCache:j0,useCacheRefresh:function(){return _n().memoizedState=y6.bind(null,Ke)},useEffectEvent:function(a){var l=_n(),f={impl:a};return l.memoizedState=f,function(){if((dt&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}},Q0={readContext:un,use:qp,useCallback:OC,useContext:un,useEffect:q0,useImperativeHandle:MC,useInsertionEffect:NC,useLayoutEffect:AC,useMemo:RC,useReducer:Kp,useRef:CC,useState:function(){return Kp(hs)},useDebugValue:K0,useDeferredValue:function(a,l){var f=$t();return DC(f,wt.memoizedState,a,l)},useTransition:function(){var a=Kp(hs)[0],l=$t().memoizedState;return[typeof a=="boolean"?a:wc(a),l]},useSyncExternalStore:oC,useId:LC,useHostTransitionStatus:W0,useFormState:SC,useActionState:SC,useOptimistic:function(a,l){var f=$t();return pC(f,wt,a,l)},useMemoCache:j0,useCacheRefresh:BC};Q0.useEffectEvent=EC;var $C={readContext:un,use:qp,useCallback:OC,useContext:un,useEffect:q0,useImperativeHandle:MC,useInsertionEffect:NC,useLayoutEffect:AC,useMemo:RC,useReducer:U0,useRef:CC,useState:function(){return U0(hs)},useDebugValue:K0,useDeferredValue:function(a,l){var f=$t();return wt===null?G0(f,a,l):DC(f,wt.memoizedState,a,l)},useTransition:function(){var a=U0(hs)[0],l=$t().memoizedState;return[typeof a=="boolean"?a:wc(a),l]},useSyncExternalStore:oC,useId:LC,useHostTransitionStatus:W0,useFormState:vC,useActionState:vC,useOptimistic:function(a,l){var f=$t();return wt!==null?pC(f,wt,a,l):(f.baseState=a,[a,f.queue.dispatch])},useMemoCache:j0,useCacheRefresh:BC};$C.useEffectEvent=EC;function Z0(a,l,f,d){l=a.memoizedState,f=f(d,l),f=f==null?l:g({},l,f),a.memoizedState=f,a.lanes===0&&(a.updateQueue.baseState=f)}var ey={enqueueSetState:function(a,l,f){a=a._reactInternals;var d=vr(),x=sa(d);x.payload=l,f!=null&&(x.callback=f),l=aa(a,x,d),l!==null&&(ir(l,a,d),Sc(l,a,d))},enqueueReplaceState:function(a,l,f){a=a._reactInternals;var d=vr(),x=sa(d);x.tag=1,x.payload=l,f!=null&&(x.callback=f),l=aa(a,x,d),l!==null&&(ir(l,a,d),Sc(l,a,d))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var f=vr(),d=sa(f);d.tag=2,l!=null&&(d.callback=l),l=aa(a,d,f),l!==null&&(ir(l,a,f),Sc(l,a,f))}};function UC(a,l,f,d,x,k,E){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(d,k,E):l.prototype&&l.prototype.isPureReactComponent?!hc(f,d)||!hc(x,k):!0}function JC(a,l,f,d){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(f,d),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(f,d),l.state!==a&&ey.enqueueReplaceState(l,l.state,null)}function bo(a,l){var f=l;if("ref"in l){f={};for(var d in l)d!=="ref"&&(f[d]=l[d])}if(a=a.defaultProps){f===l&&(f=g({},f));for(var x in a)f[x]===void 0&&(f[x]=a[x])}return f}function HC(a){Tp(a)}function qC(a){console.error(a)}function KC(a){Tp(a)}function Xp(a,l){try{var f=a.onUncaughtError;f(l.value,{componentStack:l.stack})}catch(d){setTimeout(function(){throw d})}}function GC(a,l,f){try{var d=a.onCaughtError;d(f.value,{componentStack:f.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function ty(a,l,f){return f=sa(f),f.tag=3,f.payload={element:null},f.callback=function(){Xp(a,l)},f}function YC(a){return a=sa(a),a.tag=3,a}function WC(a,l,f,d){var x=f.type.getDerivedStateFromError;if(typeof x=="function"){var k=d.value;a.payload=function(){return x(k)},a.callback=function(){GC(l,f,d)}}var E=f.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(a.callback=function(){GC(l,f,d),typeof x!="function"&&(ha===null?ha=new Set([this]):ha.add(this));var R=d.stack;this.componentDidCatch(d.value,{componentStack:R!==null?R:""})})}function b6(a,l,f,d,x){if(f.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(l=f.alternate,l!==null&&Bl(l,f,x,!0),f=xr.current,f!==null){switch(f.tag){case 31:case 13:return $r===null?ud():f.alternate===null&&Vt===0&&(Vt=3),f.flags&=-257,f.flags|=65536,f.lanes=x,d===Vp?f.flags|=16384:(l=f.updateQueue,l===null?f.updateQueue=new Set([d]):l.add(d),Ny(a,d,x)),!1;case 22:return f.flags|=65536,d===Vp?f.flags|=16384:(l=f.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([d])},f.updateQueue=l):(f=l.retryQueue,f===null?l.retryQueue=new Set([d]):f.add(d)),Ny(a,d,x)),!1}throw Error(r(435,f.tag))}return Ny(a,d,x),ud(),!1}if(ot)return l=xr.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=x,d!==S0&&(a=Error(r(422),{cause:d}),mc(Vr(a,f)))):(d!==S0&&(l=Error(r(423),{cause:d}),mc(Vr(l,f))),a=a.current.alternate,a.flags|=65536,x&=-x,a.lanes|=x,d=Vr(d,f),x=ty(a.stateNode,d,x),R0(a,x),Vt!==4&&(Vt=2)),!1;var k=Error(r(520),{cause:d});if(k=Vr(k,f),_c===null?_c=[k]:_c.push(k),Vt!==4&&(Vt=2),l===null)return!0;d=Vr(d,f),f=l;do{switch(f.tag){case 3:return f.flags|=65536,a=x&-x,f.lanes|=a,a=ty(f.stateNode,d,a),R0(f,a),!1;case 1:if(l=f.type,k=f.stateNode,(f.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(ha===null||!ha.has(k))))return f.flags|=65536,x&=-x,f.lanes|=x,x=YC(x),WC(x,a,f,d),R0(f,x),!1}f=f.return}while(f!==null);return!1}var ny=Error(r(461)),Yt=!1;function cn(a,l,f,d){l.child=a===null?eC(l,null,f,d):yo(l,a.child,f,d)}function XC(a,l,f,d,x){f=f.render;var k=l.ref;if("ref"in d){var E={};for(var R in d)R!=="ref"&&(E[R]=d[R])}else E=d;return ho(l),d=B0(a,l,f,E,k,x),R=V0(),a!==null&&!Yt?(F0(a,l,x),ps(a,l,x)):(ot&&R&&x0(l),l.flags|=1,cn(a,l,d,x),l.child)}function QC(a,l,f,d,x){if(a===null){var k=f.type;return typeof k=="function"&&!m0(k)&&k.defaultProps===void 0&&f.compare===null?(l.tag=15,l.type=k,ZC(a,l,k,d,x)):(a=Dp(f.type,null,d,l,l.mode,x),a.ref=l.ref,a.return=l,l.child=a)}if(k=a.child,!cy(a,x)){var E=k.memoizedProps;if(f=f.compare,f=f!==null?f:hc,f(E,d)&&a.ref===l.ref)return ps(a,l,x)}return l.flags|=1,a=as(k,d),a.ref=l.ref,a.return=l,l.child=a}function ZC(a,l,f,d,x){if(a!==null){var k=a.memoizedProps;if(hc(k,d)&&a.ref===l.ref)if(Yt=!1,l.pendingProps=d=k,cy(a,x))(a.flags&131072)!==0&&(Yt=!0);else return l.lanes=a.lanes,ps(a,l,x)}return ry(a,l,f,d,x)}function ew(a,l,f,d){var x=d.children,k=a!==null?a.memoizedState:null;if(a===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((l.flags&128)!==0){if(k=k!==null?k.baseLanes|f:f,a!==null){for(d=l.child=a.child,x=0;d!==null;)x=x|d.lanes|d.childLanes,d=d.sibling;d=x&~k}else d=0,l.child=null;return tw(a,l,k,f,d)}if((f&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},a!==null&&Lp(l,k!==null?k.cachePool:null),k!==null?rC(l,k):I0(),iC(l);else return d=l.lanes=536870912,tw(a,l,k!==null?k.baseLanes|f:f,f,d)}else k!==null?(Lp(l,k.cachePool),rC(l,k),la(),l.memoizedState=null):(a!==null&&Lp(l,null),I0(),la());return cn(a,l,x,f),l.child}function Ac(a,l){return a!==null&&a.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function tw(a,l,f,d,x){var k=A0();return k=k===null?null:{parent:Kt._currentValue,pool:k},l.memoizedState={baseLanes:f,cachePool:k},a!==null&&Lp(l,null),I0(),iC(l),a!==null&&Bl(a,l,d,!0),l.childLanes=x,null}function Qp(a,l){return l=ed({mode:l.mode,children:l.children},a.mode),l.ref=a.ref,a.child=l,l.return=a,l}function nw(a,l,f){return yo(l,a.child,null,f),a=Qp(l,l.pendingProps),a.flags|=2,br(l),l.memoizedState=null,a}function S6(a,l,f){var d=l.pendingProps,x=(l.flags&128)!==0;if(l.flags&=-129,a===null){if(ot){if(d.mode==="hidden")return a=Qp(l,d),l.lanes=536870912,Ac(null,a);if(z0(l),(a=Mt)?(a=d2(a,jr),a=a!==null&&a.data==="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:ea!==null?{id:Ri,overflow:Di}:null,retryLane:536870912,hydrationErrors:null},f=Fv(a),f.return=l,l.child=f,ln=l,Mt=null)):a=null,a===null)throw na(l);return l.lanes=536870912,null}return Qp(l,d)}var k=a.memoizedState;if(k!==null){var E=k.dehydrated;if(z0(l),x)if(l.flags&256)l.flags&=-257,l=nw(a,l,f);else if(l.memoizedState!==null)l.child=a.child,l.flags|=128,l=null;else throw Error(r(558));else if(Yt||Bl(a,l,f,!1),x=(f&a.childLanes)!==0,Yt||x){if(d=At,d!==null&&(E=qs(d,f),E!==0&&E!==k.retryLane))throw k.retryLane=E,lo(a,E),ir(d,a,E),ny;ud(),l=nw(a,l,f)}else a=k.treeContext,Mt=Ur(E.nextSibling),ln=l,ot=!0,ta=null,jr=!1,a!==null&&$v(l,a),l=Qp(l,d),l.flags|=4096;return l}return a=as(a.child,{mode:d.mode,children:d.children}),a.ref=l.ref,l.child=a,a.return=l,a}function Zp(a,l){var f=l.ref;if(f===null)a!==null&&a.ref!==null&&(l.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(r(284));(a===null||a.ref!==f)&&(l.flags|=4194816)}}function ry(a,l,f,d,x){return ho(l),f=B0(a,l,f,d,void 0,x),d=V0(),a!==null&&!Yt?(F0(a,l,x),ps(a,l,x)):(ot&&d&&x0(l),l.flags|=1,cn(a,l,f,x),l.child)}function rw(a,l,f,d,x,k){return ho(l),l.updateQueue=null,f=aC(l,d,f,x),sC(a),d=V0(),a!==null&&!Yt?(F0(a,l,k),ps(a,l,k)):(ot&&d&&x0(l),l.flags|=1,cn(a,l,f,k),l.child)}function iw(a,l,f,d,x){if(ho(l),l.stateNode===null){var k=Il,E=f.contextType;typeof E=="object"&&E!==null&&(k=un(E)),k=new f(d,k),l.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=ey,l.stateNode=k,k._reactInternals=l,k=l.stateNode,k.props=d,k.state=l.memoizedState,k.refs={},M0(l),E=f.contextType,k.context=typeof E=="object"&&E!==null?un(E):Il,k.state=l.memoizedState,E=f.getDerivedStateFromProps,typeof E=="function"&&(Z0(l,f,E,d),k.state=l.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(E=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),E!==k.state&&ey.enqueueReplaceState(k,k.state,null),vc(l,d,k,x),kc(),k.state=l.memoizedState),typeof k.componentDidMount=="function"&&(l.flags|=4194308),d=!0}else if(a===null){k=l.stateNode;var R=l.memoizedProps,$=bo(f,R);k.props=$;var te=k.context,se=f.contextType;E=Il,typeof se=="object"&&se!==null&&(E=un(se));var he=f.getDerivedStateFromProps;se=typeof he=="function"||typeof k.getSnapshotBeforeUpdate=="function",R=l.pendingProps!==R,se||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(R||te!==E)&&JC(l,k,d,E),ia=!1;var ne=l.memoizedState;k.state=ne,vc(l,d,k,x),kc(),te=l.memoizedState,R||ne!==te||ia?(typeof he=="function"&&(Z0(l,f,he,d),te=l.memoizedState),($=ia||UC(l,f,$,d,ne,te,E))?(se||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(l.flags|=4194308)):(typeof k.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=d,l.memoizedState=te),k.props=d,k.state=te,k.context=E,d=$):(typeof k.componentDidMount=="function"&&(l.flags|=4194308),d=!1)}else{k=l.stateNode,O0(a,l),E=l.memoizedProps,se=bo(f,E),k.props=se,he=l.pendingProps,ne=k.context,te=f.contextType,$=Il,typeof te=="object"&&te!==null&&($=un(te)),R=f.getDerivedStateFromProps,(te=typeof R=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(E!==he||ne!==$)&&JC(l,k,d,$),ia=!1,ne=l.memoizedState,k.state=ne,vc(l,d,k,x),kc();var re=l.memoizedState;E!==he||ne!==re||ia||a!==null&&a.dependencies!==null&&_p(a.dependencies)?(typeof R=="function"&&(Z0(l,f,R,d),re=l.memoizedState),(se=ia||UC(l,f,se,d,ne,re,$)||a!==null&&a.dependencies!==null&&_p(a.dependencies))?(te||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(d,re,$),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(d,re,$)),typeof k.componentDidUpdate=="function"&&(l.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof k.componentDidUpdate!="function"||E===a.memoizedProps&&ne===a.memoizedState||(l.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||E===a.memoizedProps&&ne===a.memoizedState||(l.flags|=1024),l.memoizedProps=d,l.memoizedState=re),k.props=d,k.state=re,k.context=$,d=se):(typeof k.componentDidUpdate!="function"||E===a.memoizedProps&&ne===a.memoizedState||(l.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||E===a.memoizedProps&&ne===a.memoizedState||(l.flags|=1024),d=!1)}return k=d,Zp(a,l),d=(l.flags&128)!==0,k||d?(k=l.stateNode,f=d&&typeof f.getDerivedStateFromError!="function"?null:k.render(),l.flags|=1,a!==null&&d?(l.child=yo(l,a.child,null,x),l.child=yo(l,null,f,x)):cn(a,l,f,x),l.memoizedState=k.state,a=l.child):a=ps(a,l,x),a}function sw(a,l,f,d){return co(),l.flags|=256,cn(a,l,f,d),l.child}var iy={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sy(a){return{baseLanes:a,cachePool:Gv()}}function ay(a,l,f){return a=a!==null?a.childLanes&~f:0,l&&(a|=kr),a}function aw(a,l,f){var d=l.pendingProps,x=!1,k=(l.flags&128)!==0,E;if((E=k)||(E=a!==null&&a.memoizedState===null?!1:(jt.current&2)!==0),E&&(x=!0,l.flags&=-129),E=(l.flags&32)!==0,l.flags&=-33,a===null){if(ot){if(x?oa(l):la(),(a=Mt)?(a=d2(a,jr),a=a!==null&&a.data!=="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:ea!==null?{id:Ri,overflow:Di}:null,retryLane:536870912,hydrationErrors:null},f=Fv(a),f.return=l,l.child=f,ln=l,Mt=null)):a=null,a===null)throw na(l);return $y(a)?l.lanes=32:l.lanes=536870912,null}var R=d.children;return d=d.fallback,x?(la(),x=l.mode,R=ed({mode:"hidden",children:R},x),d=uo(d,x,f,null),R.return=l,d.return=l,R.sibling=d,l.child=R,d=l.child,d.memoizedState=sy(f),d.childLanes=ay(a,E,f),l.memoizedState=iy,Ac(null,d)):(oa(l),oy(l,R))}var $=a.memoizedState;if($!==null&&(R=$.dehydrated,R!==null)){if(k)l.flags&256?(oa(l),l.flags&=-257,l=ly(a,l,f)):l.memoizedState!==null?(la(),l.child=a.child,l.flags|=128,l=null):(la(),R=d.fallback,x=l.mode,d=ed({mode:"visible",children:d.children},x),R=uo(R,x,f,null),R.flags|=2,d.return=l,R.return=l,d.sibling=R,l.child=d,yo(l,a.child,null,f),d=l.child,d.memoizedState=sy(f),d.childLanes=ay(a,E,f),l.memoizedState=iy,l=Ac(null,d));else if(oa(l),$y(R)){if(E=R.nextSibling&&R.nextSibling.dataset,E)var te=E.dgst;E=te,d=Error(r(419)),d.stack="",d.digest=E,mc({value:d,source:null,stack:null}),l=ly(a,l,f)}else if(Yt||Bl(a,l,f,!1),E=(f&a.childLanes)!==0,Yt||E){if(E=At,E!==null&&(d=qs(E,f),d!==0&&d!==$.retryLane))throw $.retryLane=d,lo(a,d),ir(E,a,d),ny;jy(R)||ud(),l=ly(a,l,f)}else jy(R)?(l.flags|=192,l.child=a.child,l=null):(a=$.treeContext,Mt=Ur(R.nextSibling),ln=l,ot=!0,ta=null,jr=!1,a!==null&&$v(l,a),l=oy(l,d.children),l.flags|=4096);return l}return x?(la(),R=d.fallback,x=l.mode,$=a.child,te=$.sibling,d=as($,{mode:"hidden",children:d.children}),d.subtreeFlags=$.subtreeFlags&65011712,te!==null?R=as(te,R):(R=uo(R,x,f,null),R.flags|=2),R.return=l,d.return=l,d.sibling=R,l.child=d,Ac(null,d),d=l.child,R=a.child.memoizedState,R===null?R=sy(f):(x=R.cachePool,x!==null?($=Kt._currentValue,x=x.parent!==$?{parent:$,pool:$}:x):x=Gv(),R={baseLanes:R.baseLanes|f,cachePool:x}),d.memoizedState=R,d.childLanes=ay(a,E,f),l.memoizedState=iy,Ac(a.child,d)):(oa(l),f=a.child,a=f.sibling,f=as(f,{mode:"visible",children:d.children}),f.return=l,f.sibling=null,a!==null&&(E=l.deletions,E===null?(l.deletions=[a],l.flags|=16):E.push(a)),l.child=f,l.memoizedState=null,f)}function oy(a,l){return l=ed({mode:"visible",children:l},a.mode),l.return=a,a.child=l}function ed(a,l){return a=yr(22,a,null,l),a.lanes=0,a}function ly(a,l,f){return yo(l,a.child,null,f),a=oy(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function ow(a,l,f){a.lanes|=l;var d=a.alternate;d!==null&&(d.lanes|=l),C0(a.return,l,f)}function uy(a,l,f,d,x,k){var E=a.memoizedState;E===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:d,tail:f,tailMode:x,treeForkCount:k}:(E.isBackwards=l,E.rendering=null,E.renderingStartTime=0,E.last=d,E.tail=f,E.tailMode=x,E.treeForkCount=k)}function lw(a,l,f){var d=l.pendingProps,x=d.revealOrder,k=d.tail;d=d.children;var E=jt.current,R=(E&2)!==0;if(R?(E=E&1|2,l.flags|=128):E&=1,V(jt,E),cn(a,l,d,f),d=ot?dc:0,!R&&a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&ow(a,f,l);else if(a.tag===19)ow(a,f,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(x){case"forwards":for(f=l.child,x=null;f!==null;)a=f.alternate,a!==null&&$p(a)===null&&(x=f),f=f.sibling;f=x,f===null?(x=l.child,l.child=null):(x=f.sibling,f.sibling=null),uy(l,!1,x,f,k,d);break;case"backwards":case"unstable_legacy-backwards":for(f=null,x=l.child,l.child=null;x!==null;){if(a=x.alternate,a!==null&&$p(a)===null){l.child=x;break}a=x.sibling,x.sibling=f,f=x,x=a}uy(l,!0,f,null,k,d);break;case"together":uy(l,!1,null,null,void 0,d);break;default:l.memoizedState=null}return l.child}function ps(a,l,f){if(a!==null&&(l.dependencies=a.dependencies),fa|=l.lanes,(f&l.childLanes)===0)if(a!==null){if(Bl(a,l,f,!1),(f&l.childLanes)===0)return null}else return null;if(a!==null&&l.child!==a.child)throw Error(r(153));if(l.child!==null){for(a=l.child,f=as(a,a.pendingProps),l.child=f,f.return=l;a.sibling!==null;)a=a.sibling,f=f.sibling=as(a,a.pendingProps),f.return=l;f.sibling=null}return l.child}function cy(a,l){return(a.lanes&l)!==0?!0:(a=a.dependencies,!!(a!==null&&_p(a)))}function k6(a,l,f){switch(l.tag){case 3:Ct(l,l.stateNode.containerInfo),ra(l,Kt,a.memoizedState.cache),co();break;case 27:case 5:zt(l);break;case 4:Ct(l,l.stateNode.containerInfo);break;case 10:ra(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,z0(l),null;break;case 13:var d=l.memoizedState;if(d!==null)return d.dehydrated!==null?(oa(l),l.flags|=128,null):(f&l.child.childLanes)!==0?aw(a,l,f):(oa(l),a=ps(a,l,f),a!==null?a.sibling:null);oa(l);break;case 19:var x=(a.flags&128)!==0;if(d=(f&l.childLanes)!==0,d||(Bl(a,l,f,!1),d=(f&l.childLanes)!==0),x){if(d)return lw(a,l,f);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),V(jt,jt.current),d)break;return null;case 22:return l.lanes=0,ew(a,l,f,l.pendingProps);case 24:ra(l,Kt,a.memoizedState.cache)}return ps(a,l,f)}function uw(a,l,f){if(a!==null)if(a.memoizedProps!==l.pendingProps)Yt=!0;else{if(!cy(a,f)&&(l.flags&128)===0)return Yt=!1,k6(a,l,f);Yt=(a.flags&131072)!==0}else Yt=!1,ot&&(l.flags&1048576)!==0&&jv(l,dc,l.index);switch(l.lanes=0,l.tag){case 16:e:{var d=l.pendingProps;if(a=mo(l.elementType),l.type=a,typeof a=="function")m0(a)?(d=bo(a,d),l.tag=1,l=iw(null,l,a,d,f)):(l.tag=0,l=ry(null,l,a,d,f));else{if(a!=null){var x=a.$$typeof;if(x===J){l.tag=11,l=XC(null,l,a,d,f);break e}else if(x===z){l.tag=14,l=QC(null,l,a,d,f);break e}}throw l=_e(a)||a,Error(r(306,l,""))}}return l;case 0:return ry(a,l,l.type,l.pendingProps,f);case 1:return d=l.type,x=bo(d,l.pendingProps),iw(a,l,d,x,f);case 3:e:{if(Ct(l,l.stateNode.containerInfo),a===null)throw Error(r(387));d=l.pendingProps;var k=l.memoizedState;x=k.element,O0(a,l),vc(l,d,null,f);var E=l.memoizedState;if(d=E.cache,ra(l,Kt,d),d!==k.cache&&w0(l,[Kt],f,!0),kc(),d=E.element,k.isDehydrated)if(k={element:d,isDehydrated:!1,cache:E.cache},l.updateQueue.baseState=k,l.memoizedState=k,l.flags&256){l=sw(a,l,d,f);break e}else if(d!==x){x=Vr(Error(r(424)),l),mc(x),l=sw(a,l,d,f);break e}else for(a=l.stateNode.containerInfo,a.nodeType===9?a=a.body:a=a.nodeName==="HTML"?a.ownerDocument.body:a,Mt=Ur(a.firstChild),ln=l,ot=!0,ta=null,jr=!0,f=eC(l,null,d,f),l.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(co(),d===x){l=ps(a,l,f);break e}cn(a,l,d,f)}l=l.child}return l;case 26:return Zp(a,l),a===null?(f=S2(l.type,null,l.pendingProps,null))?l.memoizedState=f:ot||(f=l.type,a=l.pendingProps,d=gd(Te.current).createElement(f),d[Ht]=l,d[on]=a,fn(d,f,a),qt(d),l.stateNode=d):l.memoizedState=S2(l.type,a.memoizedProps,l.pendingProps,a.memoizedState),null;case 27:return zt(l),a===null&&ot&&(d=l.stateNode=y2(l.type,l.pendingProps,Te.current),ln=l,jr=!0,x=Mt,ga(l.type)?(Uy=x,Mt=Ur(d.firstChild)):Mt=x),cn(a,l,l.pendingProps.children,f),Zp(a,l),a===null&&(l.flags|=4194304),l.child;case 5:return a===null&&ot&&((x=d=Mt)&&(d=X6(d,l.type,l.pendingProps,jr),d!==null?(l.stateNode=d,ln=l,Mt=Ur(d.firstChild),jr=!1,x=!0):x=!1),x||na(l)),zt(l),x=l.type,k=l.pendingProps,E=a!==null?a.memoizedProps:null,d=k.children,Vy(x,k)?d=null:E!==null&&Vy(x,E)&&(l.flags|=32),l.memoizedState!==null&&(x=B0(a,l,h6,null,null,f),$c._currentValue=x),Zp(a,l),cn(a,l,d,f),l.child;case 6:return a===null&&ot&&((a=f=Mt)&&(f=Q6(f,l.pendingProps,jr),f!==null?(l.stateNode=f,ln=l,Mt=null,a=!0):a=!1),a||na(l)),null;case 13:return aw(a,l,f);case 4:return Ct(l,l.stateNode.containerInfo),d=l.pendingProps,a===null?l.child=yo(l,null,d,f):cn(a,l,d,f),l.child;case 11:return XC(a,l,l.type,l.pendingProps,f);case 7:return cn(a,l,l.pendingProps,f),l.child;case 8:return cn(a,l,l.pendingProps.children,f),l.child;case 12:return cn(a,l,l.pendingProps.children,f),l.child;case 10:return d=l.pendingProps,ra(l,l.type,d.value),cn(a,l,d.children,f),l.child;case 9:return x=l.type._context,d=l.pendingProps.children,ho(l),x=un(x),d=d(x),l.flags|=1,cn(a,l,d,f),l.child;case 14:return QC(a,l,l.type,l.pendingProps,f);case 15:return ZC(a,l,l.type,l.pendingProps,f);case 19:return lw(a,l,f);case 31:return S6(a,l,f);case 22:return ew(a,l,f,l.pendingProps);case 24:return ho(l),d=un(Kt),a===null?(x=A0(),x===null&&(x=At,k=E0(),x.pooledCache=k,k.refCount++,k!==null&&(x.pooledCacheLanes|=f),x=k),l.memoizedState={parent:d,cache:x},M0(l),ra(l,Kt,x)):((a.lanes&f)!==0&&(O0(a,l),vc(l,null,null,f),kc()),x=a.memoizedState,k=l.memoizedState,x.parent!==d?(x={parent:d,cache:d},l.memoizedState=x,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=x),ra(l,Kt,d)):(d=k.cache,ra(l,Kt,d),d!==x.cache&&w0(l,[Kt],f,!0))),cn(a,l,l.pendingProps.children,f),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function ds(a){a.flags|=4}function fy(a,l,f,d,x){if((l=(a.mode&32)!==0)&&(l=!1),l){if(a.flags|=16777216,(x&335544128)===x)if(a.stateNode.complete)a.flags|=8192;else if(Lw())a.flags|=8192;else throw go=Vp,T0}else a.flags&=-16777217}function cw(a,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!E2(l))if(Lw())a.flags|=8192;else throw go=Vp,T0}function td(a,l){l!==null&&(a.flags|=4),a.flags&16384&&(l=a.tag!==22?Qu():536870912,a.lanes|=l,Yl|=l)}function Tc(a,l){if(!ot)switch(a.tailMode){case"hidden":l=a.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?a.tail=null:f.sibling=null;break;case"collapsed":f=a.tail;for(var d=null;f!==null;)f.alternate!==null&&(d=f),f=f.sibling;d===null?l||a.tail===null?a.tail=null:a.tail.sibling=null:d.sibling=null}}function Ot(a){var l=a.alternate!==null&&a.alternate.child===a.child,f=0,d=0;if(l)for(var x=a.child;x!==null;)f|=x.lanes|x.childLanes,d|=x.subtreeFlags&65011712,d|=x.flags&65011712,x.return=a,x=x.sibling;else for(x=a.child;x!==null;)f|=x.lanes|x.childLanes,d|=x.subtreeFlags,d|=x.flags,x.return=a,x=x.sibling;return a.subtreeFlags|=d,a.childLanes=f,l}function v6(a,l,f){var d=l.pendingProps;switch(b0(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(l),null;case 1:return Ot(l),null;case 3:return f=l.stateNode,d=null,a!==null&&(d=a.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),cs(Kt),Xe(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(a===null||a.child===null)&&(Ll(l)?ds(l):a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,k0())),Ot(l),null;case 26:var x=l.type,k=l.memoizedState;return a===null?(ds(l),k!==null?(Ot(l),cw(l,k)):(Ot(l),fy(l,x,null,d,f))):k?k!==a.memoizedState?(ds(l),Ot(l),cw(l,k)):(Ot(l),l.flags&=-16777217):(a=a.memoizedProps,a!==d&&ds(l),Ot(l),fy(l,x,a,d,f)),null;case 27:if(Lt(l),f=Te.current,x=l.type,a!==null&&l.stateNode!=null)a.memoizedProps!==d&&ds(l);else{if(!d){if(l.stateNode===null)throw Error(r(166));return Ot(l),null}a=xe.current,Ll(l)?Uv(l):(a=y2(x,d,f),l.stateNode=a,ds(l))}return Ot(l),null;case 5:if(Lt(l),x=l.type,a!==null&&l.stateNode!=null)a.memoizedProps!==d&&ds(l);else{if(!d){if(l.stateNode===null)throw Error(r(166));return Ot(l),null}if(k=xe.current,Ll(l))Uv(l);else{var E=gd(Te.current);switch(k){case 1:k=E.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:k=E.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":k=E.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":k=E.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":k=E.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof d.is=="string"?E.createElement("select",{is:d.is}):E.createElement("select"),d.multiple?k.multiple=!0:d.size&&(k.size=d.size);break;default:k=typeof d.is=="string"?E.createElement(x,{is:d.is}):E.createElement(x)}}k[Ht]=l,k[on]=d;e:for(E=l.child;E!==null;){if(E.tag===5||E.tag===6)k.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===l)break e;for(;E.sibling===null;){if(E.return===null||E.return===l)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}l.stateNode=k;e:switch(fn(k,x,d),x){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&ds(l)}}return Ot(l),fy(l,l.type,a===null?null:a.memoizedProps,l.pendingProps,f),null;case 6:if(a&&l.stateNode!=null)a.memoizedProps!==d&&ds(l);else{if(typeof d!="string"&&l.stateNode===null)throw Error(r(166));if(a=Te.current,Ll(l)){if(a=l.stateNode,f=l.memoizedProps,d=null,x=ln,x!==null)switch(x.tag){case 27:case 5:d=x.memoizedProps}a[Ht]=l,a=!!(a.nodeValue===f||d!==null&&d.suppressHydrationWarning===!0||a2(a.nodeValue,f)),a||na(l,!0)}else a=gd(a).createTextNode(d),a[Ht]=l,l.stateNode=a}return Ot(l),null;case 31:if(f=l.memoizedState,a===null||a.memoizedState!==null){if(d=Ll(l),f!==null){if(a===null){if(!d)throw Error(r(318));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[Ht]=l}else co(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ot(l),a=!1}else f=k0(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=f),a=!0;if(!a)return l.flags&256?(br(l),l):(br(l),null);if((l.flags&128)!==0)throw Error(r(558))}return Ot(l),null;case 13:if(d=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(x=Ll(l),d!==null&&d.dehydrated!==null){if(a===null){if(!x)throw Error(r(318));if(x=l.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[Ht]=l}else co(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ot(l),x=!1}else x=k0(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=x),x=!0;if(!x)return l.flags&256?(br(l),l):(br(l),null)}return br(l),(l.flags&128)!==0?(l.lanes=f,l):(f=d!==null,a=a!==null&&a.memoizedState!==null,f&&(d=l.child,x=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(x=d.alternate.memoizedState.cachePool.pool),k=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(k=d.memoizedState.cachePool.pool),k!==x&&(d.flags|=2048)),f!==a&&f&&(l.child.flags|=8192),td(l,l.updateQueue),Ot(l),null);case 4:return Xe(),a===null&&Iy(l.stateNode.containerInfo),Ot(l),null;case 10:return cs(l.type),Ot(l),null;case 19:if(Q(jt),d=l.memoizedState,d===null)return Ot(l),null;if(x=(l.flags&128)!==0,k=d.rendering,k===null)if(x)Tc(d,!1);else{if(Vt!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(k=$p(a),k!==null){for(l.flags|=128,Tc(d,!1),a=k.updateQueue,l.updateQueue=a,td(l,a),l.subtreeFlags=0,a=f,f=l.child;f!==null;)Vv(f,a),f=f.sibling;return V(jt,jt.current&1|2),ot&&ls(l,d.treeForkCount),l.child}a=a.sibling}d.tail!==null&&$e()>ad&&(l.flags|=128,x=!0,Tc(d,!1),l.lanes=4194304)}else{if(!x)if(a=$p(k),a!==null){if(l.flags|=128,x=!0,a=a.updateQueue,l.updateQueue=a,td(l,a),Tc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!k.alternate&&!ot)return Ot(l),null}else 2*$e()-d.renderingStartTime>ad&&f!==536870912&&(l.flags|=128,x=!0,Tc(d,!1),l.lanes=4194304);d.isBackwards?(k.sibling=l.child,l.child=k):(a=d.last,a!==null?a.sibling=k:l.child=k,d.last=k)}return d.tail!==null?(a=d.tail,d.rendering=a,d.tail=a.sibling,d.renderingStartTime=$e(),a.sibling=null,f=jt.current,V(jt,x?f&1|2:f&1),ot&&ls(l,d.treeForkCount),a):(Ot(l),null);case 22:case 23:return br(l),_0(),d=l.memoizedState!==null,a!==null?a.memoizedState!==null!==d&&(l.flags|=8192):d&&(l.flags|=8192),d?(f&536870912)!==0&&(l.flags&128)===0&&(Ot(l),l.subtreeFlags&6&&(l.flags|=8192)):Ot(l),f=l.updateQueue,f!==null&&td(l,f.retryQueue),f=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),d=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==f&&(l.flags|=2048),a!==null&&Q(po),null;case 24:return f=null,a!==null&&(f=a.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),cs(Kt),Ot(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function C6(a,l){switch(b0(l),l.tag){case 1:return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return cs(Kt),Xe(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 26:case 27:case 5:return Lt(l),null;case 31:if(l.memoizedState!==null){if(br(l),l.alternate===null)throw Error(r(340));co()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 13:if(br(l),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(r(340));co()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return Q(jt),null;case 4:return Xe(),null;case 10:return cs(l.type),null;case 22:case 23:return br(l),_0(),a!==null&&Q(po),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 24:return cs(Kt),null;case 25:return null;default:return null}}function fw(a,l){switch(b0(l),l.tag){case 3:cs(Kt),Xe();break;case 26:case 27:case 5:Lt(l);break;case 4:Xe();break;case 31:l.memoizedState!==null&&br(l);break;case 13:br(l);break;case 19:Q(jt);break;case 10:cs(l.type);break;case 22:case 23:br(l),_0(),a!==null&&Q(po);break;case 24:cs(Kt)}}function Mc(a,l){try{var f=l.updateQueue,d=f!==null?f.lastEffect:null;if(d!==null){var x=d.next;f=x;do{if((f.tag&a)===a){d=void 0;var k=f.create,E=f.inst;d=k(),E.destroy=d}f=f.next}while(f!==x)}}catch(R){vt(l,l.return,R)}}function ua(a,l,f){try{var d=l.updateQueue,x=d!==null?d.lastEffect:null;if(x!==null){var k=x.next;d=k;do{if((d.tag&a)===a){var E=d.inst,R=E.destroy;if(R!==void 0){E.destroy=void 0,x=l;var $=f,te=R;try{te()}catch(se){vt(x,$,se)}}}d=d.next}while(d!==k)}}catch(se){vt(l,l.return,se)}}function hw(a){var l=a.updateQueue;if(l!==null){var f=a.stateNode;try{nC(l,f)}catch(d){vt(a,a.return,d)}}}function pw(a,l,f){f.props=bo(a.type,a.memoizedProps),f.state=a.memoizedState;try{f.componentWillUnmount()}catch(d){vt(a,l,d)}}function Oc(a,l){try{var f=a.ref;if(f!==null){switch(a.tag){case 26:case 27:case 5:var d=a.stateNode;break;case 30:d=a.stateNode;break;default:d=a.stateNode}typeof f=="function"?a.refCleanup=f(d):f.current=d}}catch(x){vt(a,l,x)}}function Ii(a,l){var f=a.ref,d=a.refCleanup;if(f!==null)if(typeof d=="function")try{d()}catch(x){vt(a,l,x)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(x){vt(a,l,x)}else f.current=null}function dw(a){var l=a.type,f=a.memoizedProps,d=a.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":f.autoFocus&&d.focus();break e;case"img":f.src?d.src=f.src:f.srcSet&&(d.srcset=f.srcSet)}}catch(x){vt(a,a.return,x)}}function hy(a,l,f){try{var d=a.stateNode;H6(d,a.type,f,l),d[on]=l}catch(x){vt(a,a.return,x)}}function mw(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&ga(a.type)||a.tag===4}function py(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||mw(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&ga(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function dy(a,l,f){var d=a.tag;if(d===5||d===6)a=a.stateNode,l?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(a,l):(l=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,l.appendChild(a),f=f._reactRootContainer,f!=null||l.onclick!==null||(l.onclick=_r));else if(d!==4&&(d===27&&ga(a.type)&&(f=a.stateNode,l=null),a=a.child,a!==null))for(dy(a,l,f),a=a.sibling;a!==null;)dy(a,l,f),a=a.sibling}function nd(a,l,f){var d=a.tag;if(d===5||d===6)a=a.stateNode,l?f.insertBefore(a,l):f.appendChild(a);else if(d!==4&&(d===27&&ga(a.type)&&(f=a.stateNode),a=a.child,a!==null))for(nd(a,l,f),a=a.sibling;a!==null;)nd(a,l,f),a=a.sibling}function gw(a){var l=a.stateNode,f=a.memoizedProps;try{for(var d=a.type,x=l.attributes;x.length;)l.removeAttributeNode(x[0]);fn(l,d,f),l[Ht]=a,l[on]=f}catch(k){vt(a,a.return,k)}}var ms=!1,Wt=!1,my=!1,yw=typeof WeakSet=="function"?WeakSet:Set,nn=null;function w6(a,l){if(a=a.containerInfo,Ly=Cd,a=Mv(a),l0(a)){if("selectionStart"in a)var f={start:a.selectionStart,end:a.selectionEnd};else e:{f=(f=a.ownerDocument)&&f.defaultView||window;var d=f.getSelection&&f.getSelection();if(d&&d.rangeCount!==0){f=d.anchorNode;var x=d.anchorOffset,k=d.focusNode;d=d.focusOffset;try{f.nodeType,k.nodeType}catch{f=null;break e}var E=0,R=-1,$=-1,te=0,se=0,he=a,ne=null;t:for(;;){for(var re;he!==f||x!==0&&he.nodeType!==3||(R=E+x),he!==k||d!==0&&he.nodeType!==3||($=E+d),he.nodeType===3&&(E+=he.nodeValue.length),(re=he.firstChild)!==null;)ne=he,he=re;for(;;){if(he===a)break t;if(ne===f&&++te===x&&(R=E),ne===k&&++se===d&&($=E),(re=he.nextSibling)!==null)break;he=ne,ne=he.parentNode}he=re}f=R===-1||$===-1?null:{start:R,end:$}}else f=null}f=f||{start:0,end:0}}else f=null;for(By={focusedElem:a,selectionRange:f},Cd=!1,nn=l;nn!==null;)if(l=nn,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,nn=a;else for(;nn!==null;){switch(l=nn,k=l.alternate,a=l.flags,l.tag){case 0:if((a&4)!==0&&(a=l.updateQueue,a=a!==null?a.events:null,a!==null))for(f=0;f<a.length;f++)x=a[f],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&k!==null){a=void 0,f=l,x=k.memoizedProps,k=k.memoizedState,d=f.stateNode;try{var Ce=bo(f.type,x);a=d.getSnapshotBeforeUpdate(Ce,k),d.__reactInternalSnapshotBeforeUpdate=a}catch(Be){vt(f,f.return,Be)}}break;case 3:if((a&1024)!==0){if(a=l.stateNode.containerInfo,f=a.nodeType,f===9)Py(a);else if(f===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":Py(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(r(163))}if(a=l.sibling,a!==null){a.return=l.return,nn=a;break}nn=l.return}}function xw(a,l,f){var d=f.flags;switch(f.tag){case 0:case 11:case 15:ys(a,f),d&4&&Mc(5,f);break;case 1:if(ys(a,f),d&4)if(a=f.stateNode,l===null)try{a.componentDidMount()}catch(E){vt(f,f.return,E)}else{var x=bo(f.type,l.memoizedProps);l=l.memoizedState;try{a.componentDidUpdate(x,l,a.__reactInternalSnapshotBeforeUpdate)}catch(E){vt(f,f.return,E)}}d&64&&hw(f),d&512&&Oc(f,f.return);break;case 3:if(ys(a,f),d&64&&(a=f.updateQueue,a!==null)){if(l=null,f.child!==null)switch(f.child.tag){case 27:case 5:l=f.child.stateNode;break;case 1:l=f.child.stateNode}try{nC(a,l)}catch(E){vt(f,f.return,E)}}break;case 27:l===null&&d&4&&gw(f);case 26:case 5:ys(a,f),l===null&&d&4&&dw(f),d&512&&Oc(f,f.return);break;case 12:ys(a,f);break;case 31:ys(a,f),d&4&&kw(a,f);break;case 13:ys(a,f),d&4&&vw(a,f),d&64&&(a=f.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(f=I6.bind(null,f),Z6(a,f))));break;case 22:if(d=f.memoizedState!==null||ms,!d){l=l!==null&&l.memoizedState!==null||Wt,x=ms;var k=Wt;ms=d,(Wt=l)&&!k?xs(a,f,(f.subtreeFlags&8772)!==0):ys(a,f),ms=x,Wt=k}break;case 30:break;default:ys(a,f)}}function bw(a){var l=a.alternate;l!==null&&(a.alternate=null,bw(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&wl(l)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var Dt=null,er=!1;function gs(a,l,f){for(f=f.child;f!==null;)Sw(a,l,f),f=f.sibling}function Sw(a,l,f){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(be,f)}catch{}switch(f.tag){case 26:Wt||Ii(f,l),gs(a,l,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:Wt||Ii(f,l);var d=Dt,x=er;ga(f.type)&&(Dt=f.stateNode,er=!1),gs(a,l,f),Fc(f.stateNode),Dt=d,er=x;break;case 5:Wt||Ii(f,l);case 6:if(d=Dt,x=er,Dt=null,gs(a,l,f),Dt=d,er=x,Dt!==null)if(er)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(f.stateNode)}catch(k){vt(f,l,k)}else try{Dt.removeChild(f.stateNode)}catch(k){vt(f,l,k)}break;case 18:Dt!==null&&(er?(a=Dt,h2(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,f.stateNode),ru(a)):h2(Dt,f.stateNode));break;case 4:d=Dt,x=er,Dt=f.stateNode.containerInfo,er=!0,gs(a,l,f),Dt=d,er=x;break;case 0:case 11:case 14:case 15:ua(2,f,l),Wt||ua(4,f,l),gs(a,l,f);break;case 1:Wt||(Ii(f,l),d=f.stateNode,typeof d.componentWillUnmount=="function"&&pw(f,l,d)),gs(a,l,f);break;case 21:gs(a,l,f);break;case 22:Wt=(d=Wt)||f.memoizedState!==null,gs(a,l,f),Wt=d;break;default:gs(a,l,f)}}function kw(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{ru(a)}catch(f){vt(l,l.return,f)}}}function vw(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{ru(a)}catch(f){vt(l,l.return,f)}}function E6(a){switch(a.tag){case 31:case 13:case 19:var l=a.stateNode;return l===null&&(l=a.stateNode=new yw),l;case 22:return a=a.stateNode,l=a._retryCache,l===null&&(l=a._retryCache=new yw),l;default:throw Error(r(435,a.tag))}}function rd(a,l){var f=E6(a);l.forEach(function(d){if(!f.has(d)){f.add(d);var x=_6.bind(null,a,d);d.then(x,x)}})}function tr(a,l){var f=l.deletions;if(f!==null)for(var d=0;d<f.length;d++){var x=f[d],k=a,E=l,R=E;e:for(;R!==null;){switch(R.tag){case 27:if(ga(R.type)){Dt=R.stateNode,er=!1;break e}break;case 5:Dt=R.stateNode,er=!1;break e;case 3:case 4:Dt=R.stateNode.containerInfo,er=!0;break e}R=R.return}if(Dt===null)throw Error(r(160));Sw(k,E,x),Dt=null,er=!1,k=x.alternate,k!==null&&(k.return=null),x.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)Cw(l,a),l=l.sibling}var xi=null;function Cw(a,l){var f=a.alternate,d=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:tr(l,a),nr(a),d&4&&(ua(3,a,a.return),Mc(3,a),ua(5,a,a.return));break;case 1:tr(l,a),nr(a),d&512&&(Wt||f===null||Ii(f,f.return)),d&64&&ms&&(a=a.updateQueue,a!==null&&(d=a.callbacks,d!==null&&(f=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=f===null?d:f.concat(d))));break;case 26:var x=xi;if(tr(l,a),nr(a),d&512&&(Wt||f===null||Ii(f,f.return)),d&4){var k=f!==null?f.memoizedState:null;if(d=a.memoizedState,f===null)if(d===null)if(a.stateNode===null){e:{d=a.type,f=a.memoizedProps,x=x.ownerDocument||x;t:switch(d){case"title":k=x.getElementsByTagName("title")[0],(!k||k[Ks]||k[Ht]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=x.createElement(d),x.head.insertBefore(k,x.querySelector("head > title"))),fn(k,d,f),k[Ht]=a,qt(k),d=k;break e;case"link":var E=C2("link","href",x).get(d+(f.href||""));if(E){for(var R=0;R<E.length;R++)if(k=E[R],k.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&k.getAttribute("rel")===(f.rel==null?null:f.rel)&&k.getAttribute("title")===(f.title==null?null:f.title)&&k.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){E.splice(R,1);break t}}k=x.createElement(d),fn(k,d,f),x.head.appendChild(k);break;case"meta":if(E=C2("meta","content",x).get(d+(f.content||""))){for(R=0;R<E.length;R++)if(k=E[R],k.getAttribute("content")===(f.content==null?null:""+f.content)&&k.getAttribute("name")===(f.name==null?null:f.name)&&k.getAttribute("property")===(f.property==null?null:f.property)&&k.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&k.getAttribute("charset")===(f.charSet==null?null:f.charSet)){E.splice(R,1);break t}}k=x.createElement(d),fn(k,d,f),x.head.appendChild(k);break;default:throw Error(r(468,d))}k[Ht]=a,qt(k),d=k}a.stateNode=d}else w2(x,a.type,a.stateNode);else a.stateNode=v2(x,d,a.memoizedProps);else k!==d?(k===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):k.count--,d===null?w2(x,a.type,a.stateNode):v2(x,d,a.memoizedProps)):d===null&&a.stateNode!==null&&hy(a,a.memoizedProps,f.memoizedProps)}break;case 27:tr(l,a),nr(a),d&512&&(Wt||f===null||Ii(f,f.return)),f!==null&&d&4&&hy(a,a.memoizedProps,f.memoizedProps);break;case 5:if(tr(l,a),nr(a),d&512&&(Wt||f===null||Ii(f,f.return)),a.flags&32){x=a.stateNode;try{mi(x,"")}catch(Ce){vt(a,a.return,Ce)}}d&4&&a.stateNode!=null&&(x=a.memoizedProps,hy(a,x,f!==null?f.memoizedProps:x)),d&1024&&(my=!0);break;case 6:if(tr(l,a),nr(a),d&4){if(a.stateNode===null)throw Error(r(162));d=a.memoizedProps,f=a.stateNode;try{f.nodeValue=d}catch(Ce){vt(a,a.return,Ce)}}break;case 3:if(bd=null,x=xi,xi=yd(l.containerInfo),tr(l,a),xi=x,nr(a),d&4&&f!==null&&f.memoizedState.isDehydrated)try{ru(l.containerInfo)}catch(Ce){vt(a,a.return,Ce)}my&&(my=!1,ww(a));break;case 4:d=xi,xi=yd(a.stateNode.containerInfo),tr(l,a),nr(a),xi=d;break;case 12:tr(l,a),nr(a);break;case 31:tr(l,a),nr(a),d&4&&(d=a.updateQueue,d!==null&&(a.updateQueue=null,rd(a,d)));break;case 13:tr(l,a),nr(a),a.child.flags&8192&&a.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(sd=$e()),d&4&&(d=a.updateQueue,d!==null&&(a.updateQueue=null,rd(a,d)));break;case 22:x=a.memoizedState!==null;var $=f!==null&&f.memoizedState!==null,te=ms,se=Wt;if(ms=te||x,Wt=se||$,tr(l,a),Wt=se,ms=te,nr(a),d&8192)e:for(l=a.stateNode,l._visibility=x?l._visibility&-2:l._visibility|1,x&&(f===null||$||ms||Wt||So(a)),f=null,l=a;;){if(l.tag===5||l.tag===26){if(f===null){$=f=l;try{if(k=$.stateNode,x)E=k.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{R=$.stateNode;var he=$.memoizedProps.style,ne=he!=null&&he.hasOwnProperty("display")?he.display:null;R.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ce){vt($,$.return,Ce)}}}else if(l.tag===6){if(f===null){$=l;try{$.stateNode.nodeValue=x?"":$.memoizedProps}catch(Ce){vt($,$.return,Ce)}}}else if(l.tag===18){if(f===null){$=l;try{var re=$.stateNode;x?p2(re,!0):p2($.stateNode,!1)}catch(Ce){vt($,$.return,Ce)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===a)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break e;for(;l.sibling===null;){if(l.return===null||l.return===a)break e;f===l&&(f=null),l=l.return}f===l&&(f=null),l.sibling.return=l.return,l=l.sibling}d&4&&(d=a.updateQueue,d!==null&&(f=d.retryQueue,f!==null&&(d.retryQueue=null,rd(a,f))));break;case 19:tr(l,a),nr(a),d&4&&(d=a.updateQueue,d!==null&&(a.updateQueue=null,rd(a,d)));break;case 30:break;case 21:break;default:tr(l,a),nr(a)}}function nr(a){var l=a.flags;if(l&2){try{for(var f,d=a.return;d!==null;){if(mw(d)){f=d;break}d=d.return}if(f==null)throw Error(r(160));switch(f.tag){case 27:var x=f.stateNode,k=py(a);nd(a,k,x);break;case 5:var E=f.stateNode;f.flags&32&&(mi(E,""),f.flags&=-33);var R=py(a);nd(a,R,E);break;case 3:case 4:var $=f.stateNode.containerInfo,te=py(a);dy(a,te,$);break;default:throw Error(r(161))}}catch(se){vt(a,a.return,se)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function ww(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var l=a;ww(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),a=a.sibling}}function ys(a,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)xw(a,l.alternate,l),l=l.sibling}function So(a){for(a=a.child;a!==null;){var l=a;switch(l.tag){case 0:case 11:case 14:case 15:ua(4,l,l.return),So(l);break;case 1:Ii(l,l.return);var f=l.stateNode;typeof f.componentWillUnmount=="function"&&pw(l,l.return,f),So(l);break;case 27:Fc(l.stateNode);case 26:case 5:Ii(l,l.return),So(l);break;case 22:l.memoizedState===null&&So(l);break;case 30:So(l);break;default:So(l)}a=a.sibling}}function xs(a,l,f){for(f=f&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var d=l.alternate,x=a,k=l,E=k.flags;switch(k.tag){case 0:case 11:case 15:xs(x,k,f),Mc(4,k);break;case 1:if(xs(x,k,f),d=k,x=d.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(te){vt(d,d.return,te)}if(d=k,x=d.updateQueue,x!==null){var R=d.stateNode;try{var $=x.shared.hiddenCallbacks;if($!==null)for(x.shared.hiddenCallbacks=null,x=0;x<$.length;x++)tC($[x],R)}catch(te){vt(d,d.return,te)}}f&&E&64&&hw(k),Oc(k,k.return);break;case 27:gw(k);case 26:case 5:xs(x,k,f),f&&d===null&&E&4&&dw(k),Oc(k,k.return);break;case 12:xs(x,k,f);break;case 31:xs(x,k,f),f&&E&4&&kw(x,k);break;case 13:xs(x,k,f),f&&E&4&&vw(x,k);break;case 22:k.memoizedState===null&&xs(x,k,f),Oc(k,k.return);break;case 30:break;default:xs(x,k,f)}l=l.sibling}}function gy(a,l){var f=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),a=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),a!==f&&(a!=null&&a.refCount++,f!=null&&gc(f))}function yy(a,l){a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&gc(a))}function bi(a,l,f,d){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Ew(a,l,f,d),l=l.sibling}function Ew(a,l,f,d){var x=l.flags;switch(l.tag){case 0:case 11:case 15:bi(a,l,f,d),x&2048&&Mc(9,l);break;case 1:bi(a,l,f,d);break;case 3:bi(a,l,f,d),x&2048&&(a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&gc(a)));break;case 12:if(x&2048){bi(a,l,f,d),a=l.stateNode;try{var k=l.memoizedProps,E=k.id,R=k.onPostCommit;typeof R=="function"&&R(E,l.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch($){vt(l,l.return,$)}}else bi(a,l,f,d);break;case 31:bi(a,l,f,d);break;case 13:bi(a,l,f,d);break;case 23:break;case 22:k=l.stateNode,E=l.alternate,l.memoizedState!==null?k._visibility&2?bi(a,l,f,d):Rc(a,l):k._visibility&2?bi(a,l,f,d):(k._visibility|=2,ql(a,l,f,d,(l.subtreeFlags&10256)!==0||!1)),x&2048&&gy(E,l);break;case 24:bi(a,l,f,d),x&2048&&yy(l.alternate,l);break;default:bi(a,l,f,d)}}function ql(a,l,f,d,x){for(x=x&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var k=a,E=l,R=f,$=d,te=E.flags;switch(E.tag){case 0:case 11:case 15:ql(k,E,R,$,x),Mc(8,E);break;case 23:break;case 22:var se=E.stateNode;E.memoizedState!==null?se._visibility&2?ql(k,E,R,$,x):Rc(k,E):(se._visibility|=2,ql(k,E,R,$,x)),x&&te&2048&&gy(E.alternate,E);break;case 24:ql(k,E,R,$,x),x&&te&2048&&yy(E.alternate,E);break;default:ql(k,E,R,$,x)}l=l.sibling}}function Rc(a,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var f=a,d=l,x=d.flags;switch(d.tag){case 22:Rc(f,d),x&2048&&gy(d.alternate,d);break;case 24:Rc(f,d),x&2048&&yy(d.alternate,d);break;default:Rc(f,d)}l=l.sibling}}var Dc=8192;function Kl(a,l,f){if(a.subtreeFlags&Dc)for(a=a.child;a!==null;)Nw(a,l,f),a=a.sibling}function Nw(a,l,f){switch(a.tag){case 26:Kl(a,l,f),a.flags&Dc&&a.memoizedState!==null&&f4(f,xi,a.memoizedState,a.memoizedProps);break;case 5:Kl(a,l,f);break;case 3:case 4:var d=xi;xi=yd(a.stateNode.containerInfo),Kl(a,l,f),xi=d;break;case 22:a.memoizedState===null&&(d=a.alternate,d!==null&&d.memoizedState!==null?(d=Dc,Dc=16777216,Kl(a,l,f),Dc=d):Kl(a,l,f));break;default:Kl(a,l,f)}}function Aw(a){var l=a.alternate;if(l!==null&&(a=l.child,a!==null)){l.child=null;do l=a.sibling,a.sibling=null,a=l;while(a!==null)}}function Ic(a){var l=a.deletions;if((a.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var d=l[f];nn=d,Mw(d,a)}Aw(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Tw(a),a=a.sibling}function Tw(a){switch(a.tag){case 0:case 11:case 15:Ic(a),a.flags&2048&&ua(9,a,a.return);break;case 3:Ic(a);break;case 12:Ic(a);break;case 22:var l=a.stateNode;a.memoizedState!==null&&l._visibility&2&&(a.return===null||a.return.tag!==13)?(l._visibility&=-3,id(a)):Ic(a);break;default:Ic(a)}}function id(a){var l=a.deletions;if((a.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var d=l[f];nn=d,Mw(d,a)}Aw(a)}for(a=a.child;a!==null;){switch(l=a,l.tag){case 0:case 11:case 15:ua(8,l,l.return),id(l);break;case 22:f=l.stateNode,f._visibility&2&&(f._visibility&=-3,id(l));break;default:id(l)}a=a.sibling}}function Mw(a,l){for(;nn!==null;){var f=nn;switch(f.tag){case 0:case 11:case 15:ua(8,f,l);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var d=f.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:gc(f.memoizedState.cache)}if(d=f.child,d!==null)d.return=f,nn=d;else e:for(f=a;nn!==null;){d=nn;var x=d.sibling,k=d.return;if(bw(d),d===f){nn=null;break e}if(x!==null){x.return=k,nn=x;break e}nn=k}}}var N6={getCacheForType:function(a){var l=un(Kt),f=l.data.get(a);return f===void 0&&(f=a(),l.data.set(a,f)),f},cacheSignal:function(){return un(Kt).controller.signal}},A6=typeof WeakMap=="function"?WeakMap:Map,dt=0,At=null,et=null,rt=0,kt=0,Sr=null,ca=!1,Gl=!1,xy=!1,bs=0,Vt=0,fa=0,ko=0,by=0,kr=0,Yl=0,_c=null,rr=null,Sy=!1,sd=0,Ow=0,ad=1/0,od=null,ha=null,Qt=0,pa=null,Wl=null,Ss=0,ky=0,vy=null,Rw=null,zc=0,Cy=null;function vr(){return(dt&2)!==0&&rt!==0?rt&-rt:X.T!==null?My():gp()}function Dw(){if(kr===0)if((rt&536870912)===0||ot){var a=Zi;Zi<<=1,(Zi&3932160)===0&&(Zi=262144),kr=a}else kr=536870912;return a=xr.current,a!==null&&(a.flags|=32),kr}function ir(a,l,f){(a===At&&(kt===2||kt===9)||a.cancelPendingCommit!==null)&&(Xl(a,0),da(a,rt,kr,!1)),ro(a,f),((dt&2)===0||a!==At)&&(a===At&&((dt&2)===0&&(ko|=f),Vt===4&&da(a,rt,kr,!1)),_i(a))}function Iw(a,l,f){if((dt&6)!==0)throw Error(r(327));var d=!f&&(l&127)===0&&(l&a.expiredLanes)===0||Ir(a,l),x=d?O6(a,l):Ey(a,l,!0),k=d;do{if(x===0){Gl&&!d&&da(a,l,0,!1);break}else{if(f=a.current.alternate,k&&!T6(f)){x=Ey(a,l,!1),k=!1;continue}if(x===2){if(k=l,a.errorRecoveryDisabledLanes&k)var E=0;else E=a.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){l=E;e:{var R=a;x=_c;var $=R.current.memoizedState.isDehydrated;if($&&(Xl(R,E).flags|=256),E=Ey(R,E,!1),E!==2){if(xy&&!$){R.errorRecoveryDisabledLanes|=k,ko|=k,x=4;break e}k=rr,rr=x,k!==null&&(rr===null?rr=k:rr.push.apply(rr,k))}x=E}if(k=!1,x!==2)continue}}if(x===1){Xl(a,0),da(a,l,0,!0);break}e:{switch(d=a,k=x,k){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:da(d,l,kr,!ca);break e;case 2:rr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(x=sd+300-$e(),10<x)){if(da(d,l,kr,!ca),gt(d,0,!0)!==0)break e;Ss=l,d.timeoutHandle=c2(_w.bind(null,d,f,rr,od,Sy,l,kr,ko,Yl,ca,k,"Throttled",-0,0),x);break e}_w(d,f,rr,od,Sy,l,kr,ko,Yl,ca,k,null,-0,0)}}break}while(!0);_i(a)}function _w(a,l,f,d,x,k,E,R,$,te,se,he,ne,re){if(a.timeoutHandle=-1,he=l.subtreeFlags,he&8192||(he&16785408)===16785408){he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_r},Nw(l,k,he);var Ce=(k&62914560)===k?sd-$e():(k&4194048)===k?Ow-$e():0;if(Ce=h4(he,Ce),Ce!==null){Ss=k,a.cancelPendingCommit=Ce($w.bind(null,a,l,k,f,d,x,E,R,$,se,he,null,ne,re)),da(a,k,E,!te);return}}$w(a,l,k,f,d,x,E,R,$)}function T6(a){for(var l=a;;){var f=l.tag;if((f===0||f===11||f===15)&&l.flags&16384&&(f=l.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var d=0;d<f.length;d++){var x=f[d],k=x.getSnapshot;x=x.value;try{if(!gr(k(),x))return!1}catch{return!1}}if(f=l.child,l.subtreeFlags&16384&&f!==null)f.return=l,l=f;else{if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function da(a,l,f,d){l&=~by,l&=~ko,a.suspendedLanes|=l,a.pingedLanes&=~l,d&&(a.warmLanes|=l),d=a.expirationTimes;for(var x=l;0<x;){var k=31-St(x),E=1<<k;d[k]=-1,x&=~E}f!==0&&fi(a,f,l)}function ld(){return(dt&6)===0?(Lc(0),!1):!0}function wy(){if(et!==null){if(kt===0)var a=et.return;else a=et,us=fo=null,P0(a),jl=null,xc=0,a=et;for(;a!==null;)fw(a.alternate,a),a=a.return;et=null}}function Xl(a,l){var f=a.timeoutHandle;f!==-1&&(a.timeoutHandle=-1,G6(f)),f=a.cancelPendingCommit,f!==null&&(a.cancelPendingCommit=null,f()),Ss=0,wy(),At=a,et=f=as(a.current,null),rt=l,kt=0,Sr=null,ca=!1,Gl=Ir(a,l),xy=!1,Yl=kr=by=ko=fa=Vt=0,rr=_c=null,Sy=!1,(l&8)!==0&&(l|=l&32);var d=a.entangledLanes;if(d!==0)for(a=a.entanglements,d&=l;0<d;){var x=31-St(d),k=1<<x;l|=a[x],d&=~k}return bs=l,Mp(),f}function zw(a,l){Ke=null,X.H=Nc,l===Pl||l===Bp?(l=Xv(),kt=3):l===T0?(l=Xv(),kt=4):kt=l===ny?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Sr=l,et===null&&(Vt=1,Xp(a,Vr(l,a.current)))}function Lw(){var a=xr.current;return a===null?!0:(rt&4194048)===rt?$r===null:(rt&62914560)===rt||(rt&536870912)!==0?a===$r:!1}function Bw(){var a=X.H;return X.H=Nc,a===null?Nc:a}function Vw(){var a=X.A;return X.A=N6,a}function ud(){Vt=4,ca||(rt&4194048)!==rt&&xr.current!==null||(Gl=!0),(fa&134217727)===0&&(ko&134217727)===0||At===null||da(At,rt,kr,!1)}function Ey(a,l,f){var d=dt;dt|=2;var x=Bw(),k=Vw();(At!==a||rt!==l)&&(od=null,Xl(a,l)),l=!1;var E=Vt;e:do try{if(kt!==0&&et!==null){var R=et,$=Sr;switch(kt){case 8:wy(),E=6;break e;case 3:case 2:case 9:case 6:xr.current===null&&(l=!0);var te=kt;if(kt=0,Sr=null,Ql(a,R,$,te),f&&Gl){E=0;break e}break;default:te=kt,kt=0,Sr=null,Ql(a,R,$,te)}}M6(),E=Vt;break}catch(se){zw(a,se)}while(!0);return l&&a.shellSuspendCounter++,us=fo=null,dt=d,X.H=x,X.A=k,et===null&&(At=null,rt=0,Mp()),E}function M6(){for(;et!==null;)Fw(et)}function O6(a,l){var f=dt;dt|=2;var d=Bw(),x=Vw();At!==a||rt!==l?(od=null,ad=$e()+500,Xl(a,l)):Gl=Ir(a,l);e:do try{if(kt!==0&&et!==null){l=et;var k=Sr;t:switch(kt){case 1:kt=0,Sr=null,Ql(a,l,k,1);break;case 2:case 9:if(Yv(k)){kt=0,Sr=null,Pw(l);break}l=function(){kt!==2&&kt!==9||At!==a||(kt=7),_i(a)},k.then(l,l);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:Yv(k)?(kt=0,Sr=null,Pw(l)):(kt=0,Sr=null,Ql(a,l,k,7));break;case 5:var E=null;switch(et.tag){case 26:E=et.memoizedState;case 5:case 27:var R=et;if(E?E2(E):R.stateNode.complete){kt=0,Sr=null;var $=R.sibling;if($!==null)et=$;else{var te=R.return;te!==null?(et=te,cd(te)):et=null}break t}}kt=0,Sr=null,Ql(a,l,k,5);break;case 6:kt=0,Sr=null,Ql(a,l,k,6);break;case 8:wy(),Vt=6;break e;default:throw Error(r(462))}}R6();break}catch(se){zw(a,se)}while(!0);return us=fo=null,X.H=d,X.A=x,dt=f,et!==null?0:(At=null,rt=0,Mp(),Vt)}function R6(){for(;et!==null&&!Mi();)Fw(et)}function Fw(a){var l=uw(a.alternate,a,bs);a.memoizedProps=a.pendingProps,l===null?cd(a):et=l}function Pw(a){var l=a,f=l.alternate;switch(l.tag){case 15:case 0:l=rw(f,l,l.pendingProps,l.type,void 0,rt);break;case 11:l=rw(f,l,l.pendingProps,l.type.render,l.ref,rt);break;case 5:P0(l);default:fw(f,l),l=et=Vv(l,bs),l=uw(f,l,bs)}a.memoizedProps=a.pendingProps,l===null?cd(a):et=l}function Ql(a,l,f,d){us=fo=null,P0(l),jl=null,xc=0;var x=l.return;try{if(b6(a,x,l,f,rt)){Vt=1,Xp(a,Vr(f,a.current)),et=null;return}}catch(k){if(x!==null)throw et=x,k;Vt=1,Xp(a,Vr(f,a.current)),et=null;return}l.flags&32768?(ot||d===1?a=!0:Gl||(rt&536870912)!==0?a=!1:(ca=a=!0,(d===2||d===9||d===3||d===6)&&(d=xr.current,d!==null&&d.tag===13&&(d.flags|=16384))),jw(l,a)):cd(l)}function cd(a){var l=a;do{if((l.flags&32768)!==0){jw(l,ca);return}a=l.return;var f=v6(l.alternate,l,bs);if(f!==null){et=f;return}if(l=l.sibling,l!==null){et=l;return}et=l=a}while(l!==null);Vt===0&&(Vt=5)}function jw(a,l){do{var f=C6(a.alternate,a);if(f!==null){f.flags&=32767,et=f;return}if(f=a.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!l&&(a=a.sibling,a!==null)){et=a;return}et=a=f}while(a!==null);Vt=6,et=null}function $w(a,l,f,d,x,k,E,R,$){a.cancelPendingCommit=null;do fd();while(Qt!==0);if((dt&6)!==0)throw Error(r(327));if(l!==null){if(l===a.current)throw Error(r(177));if(k=l.lanes|l.childLanes,k|=p0,vl(a,f,k,E,R,$),a===At&&(et=At=null,rt=0),Wl=l,pa=a,Ss=f,ky=k,vy=x,Rw=d,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,z6(_,function(){return Kw(),null})):(a.callbackNode=null,a.callbackPriority=0),d=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||d){d=X.T,X.T=null,x=oe.p,oe.p=2,E=dt,dt|=4;try{w6(a,l,f)}finally{dt=E,oe.p=x,X.T=d}}Qt=1,Uw(),Jw(),Hw()}}function Uw(){if(Qt===1){Qt=0;var a=pa,l=Wl,f=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||f){f=X.T,X.T=null;var d=oe.p;oe.p=2;var x=dt;dt|=4;try{Cw(l,a);var k=By,E=Mv(a.containerInfo),R=k.focusedElem,$=k.selectionRange;if(E!==R&&R&&R.ownerDocument&&Tv(R.ownerDocument.documentElement,R)){if($!==null&&l0(R)){var te=$.start,se=$.end;if(se===void 0&&(se=te),"selectionStart"in R)R.selectionStart=te,R.selectionEnd=Math.min(se,R.value.length);else{var he=R.ownerDocument||document,ne=he&&he.defaultView||window;if(ne.getSelection){var re=ne.getSelection(),Ce=R.textContent.length,Be=Math.min($.start,Ce),Nt=$.end===void 0?Be:Math.min($.end,Ce);!re.extend&&Be>Nt&&(E=Nt,Nt=Be,Be=E);var Y=Av(R,Be),U=Av(R,Nt);if(Y&&U&&(re.rangeCount!==1||re.anchorNode!==Y.node||re.anchorOffset!==Y.offset||re.focusNode!==U.node||re.focusOffset!==U.offset)){var Z=he.createRange();Z.setStart(Y.node,Y.offset),re.removeAllRanges(),Be>Nt?(re.addRange(Z),re.extend(U.node,U.offset)):(Z.setEnd(U.node,U.offset),re.addRange(Z))}}}}for(he=[],re=R;re=re.parentNode;)re.nodeType===1&&he.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<he.length;R++){var ue=he[R];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}Cd=!!Ly,By=Ly=null}finally{dt=x,oe.p=d,X.T=f}}a.current=l,Qt=2}}function Jw(){if(Qt===2){Qt=0;var a=pa,l=Wl,f=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||f){f=X.T,X.T=null;var d=oe.p;oe.p=2;var x=dt;dt|=4;try{xw(a,l.alternate,l)}finally{dt=x,oe.p=d,X.T=f}}Qt=3}}function Hw(){if(Qt===4||Qt===3){Qt=0,Dr();var a=pa,l=Wl,f=Ss,d=Rw;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Qt=5:(Qt=0,Wl=pa=null,qw(a,a.pendingLanes));var x=a.pendingLanes;if(x===0&&(ha=null),Cl(f),l=l.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(be,l,void 0,(l.current.flags&128)===128)}catch{}if(d!==null){l=X.T,x=oe.p,oe.p=2,X.T=null;try{for(var k=a.onRecoverableError,E=0;E<d.length;E++){var R=d[E];k(R.value,{componentStack:R.stack})}}finally{X.T=l,oe.p=x}}(Ss&3)!==0&&fd(),_i(a),x=a.pendingLanes,(f&261930)!==0&&(x&42)!==0?a===Cy?zc++:(zc=0,Cy=a):zc=0,Lc(0)}}function qw(a,l){(a.pooledCacheLanes&=l)===0&&(l=a.pooledCache,l!=null&&(a.pooledCache=null,gc(l)))}function fd(){return Uw(),Jw(),Hw(),Kw()}function Kw(){if(Qt!==5)return!1;var a=pa,l=ky;ky=0;var f=Cl(Ss),d=X.T,x=oe.p;try{oe.p=32>f?32:f,X.T=null,f=vy,vy=null;var k=pa,E=Ss;if(Qt=0,Wl=pa=null,Ss=0,(dt&6)!==0)throw Error(r(331));var R=dt;if(dt|=4,Tw(k.current),Ew(k,k.current,E,f),dt=R,Lc(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(be,k)}catch{}return!0}finally{oe.p=x,X.T=d,qw(a,l)}}function Gw(a,l,f){l=Vr(f,l),l=ty(a.stateNode,l,2),a=aa(a,l,2),a!==null&&(ro(a,2),_i(a))}function vt(a,l,f){if(a.tag===3)Gw(a,a,f);else for(;l!==null;){if(l.tag===3){Gw(l,a,f);break}else if(l.tag===1){var d=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ha===null||!ha.has(d))){a=Vr(f,a),f=YC(2),d=aa(l,f,2),d!==null&&(WC(f,d,l,a),ro(d,2),_i(d));break}}l=l.return}}function Ny(a,l,f){var d=a.pingCache;if(d===null){d=a.pingCache=new A6;var x=new Set;d.set(l,x)}else x=d.get(l),x===void 0&&(x=new Set,d.set(l,x));x.has(f)||(xy=!0,x.add(f),a=D6.bind(null,a,l,f),l.then(a,a))}function D6(a,l,f){var d=a.pingCache;d!==null&&d.delete(l),a.pingedLanes|=a.suspendedLanes&f,a.warmLanes&=~f,At===a&&(rt&f)===f&&(Vt===4||Vt===3&&(rt&62914560)===rt&&300>$e()-sd?(dt&2)===0&&Xl(a,0):by|=f,Yl===rt&&(Yl=0)),_i(a)}function Yw(a,l){l===0&&(l=Qu()),a=lo(a,l),a!==null&&(ro(a,l),_i(a))}function I6(a){var l=a.memoizedState,f=0;l!==null&&(f=l.retryLane),Yw(a,f)}function _6(a,l){var f=0;switch(a.tag){case 31:case 13:var d=a.stateNode,x=a.memoizedState;x!==null&&(f=x.retryLane);break;case 19:d=a.stateNode;break;case 22:d=a.stateNode._retryCache;break;default:throw Error(r(314))}d!==null&&d.delete(l),Yw(a,f)}function z6(a,l){return On(a,l)}var hd=null,Zl=null,Ay=!1,pd=!1,Ty=!1,ma=0;function _i(a){a!==Zl&&a.next===null&&(Zl===null?hd=Zl=a:Zl=Zl.next=a),pd=!0,Ay||(Ay=!0,B6())}function Lc(a,l){if(!Ty&&pd){Ty=!0;do for(var f=!1,d=hd;d!==null;){if(a!==0){var x=d.pendingLanes;if(x===0)var k=0;else{var E=d.suspendedLanes,R=d.pingedLanes;k=(1<<31-St(42|a)+1)-1,k&=x&~(E&~R),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(f=!0,Zw(d,k))}else k=rt,k=gt(d,d===At?k:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(k&3)===0||Ir(d,k)||(f=!0,Zw(d,k));d=d.next}while(f);Ty=!1}}function L6(){Ww()}function Ww(){pd=Ay=!1;var a=0;ma!==0&&K6()&&(a=ma);for(var l=$e(),f=null,d=hd;d!==null;){var x=d.next,k=Xw(d,l);k===0?(d.next=null,f===null?hd=x:f.next=x,x===null&&(Zl=f)):(f=d,(a!==0||(k&3)!==0)&&(pd=!0)),d=x}Qt!==0&&Qt!==5||Lc(a),ma!==0&&(ma=0)}function Xw(a,l){for(var f=a.suspendedLanes,d=a.pingedLanes,x=a.expirationTimes,k=a.pendingLanes&-62914561;0<k;){var E=31-St(k),R=1<<E,$=x[E];$===-1?((R&f)===0||(R&d)!==0)&&(x[E]=je(R,l)):$<=l&&(a.expiredLanes|=R),k&=~R}if(l=At,f=rt,f=gt(a,a===l?f:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),d=a.callbackNode,f===0||a===l&&(kt===2||kt===9)||a.cancelPendingCommit!==null)return d!==null&&d!==null&&Rr(d),a.callbackNode=null,a.callbackPriority=0;if((f&3)===0||Ir(a,f)){if(l=f&-f,l===a.callbackPriority)return l;switch(d!==null&&Rr(d),Cl(f)){case 2:case 8:f=de;break;case 32:f=_;break;case 268435456:f=Pe;break;default:f=_}return d=Qw.bind(null,a),f=On(f,d),a.callbackPriority=l,a.callbackNode=f,l}return d!==null&&d!==null&&Rr(d),a.callbackPriority=2,a.callbackNode=null,2}function Qw(a,l){if(Qt!==0&&Qt!==5)return a.callbackNode=null,a.callbackPriority=0,null;var f=a.callbackNode;if(fd()&&a.callbackNode!==f)return null;var d=rt;return d=gt(a,a===At?d:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),d===0?null:(Iw(a,d,l),Xw(a,$e()),a.callbackNode!=null&&a.callbackNode===f?Qw.bind(null,a):null)}function Zw(a,l){if(fd())return null;Iw(a,l,!0)}function B6(){Y6(function(){(dt&6)!==0?On(ae,L6):Ww()})}function My(){if(ma===0){var a=Vl;a===0&&(a=kl,kl<<=1,(kl&261888)===0&&(kl=256)),ma=a}return ma}function e2(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:so(""+a)}function t2(a,l){var f=l.ownerDocument.createElement("input");return f.name=l.name,f.value=l.value,a.id&&f.setAttribute("form",a.id),l.parentNode.insertBefore(f,l),a=new FormData(a),f.parentNode.removeChild(f),a}function V6(a,l,f,d,x){if(l==="submit"&&f&&f.stateNode===x){var k=e2((x[on]||null).action),E=d.submitter;E&&(l=(l=E[on]||null)?e2(l.formAction):E.getAttribute("formAction"),l!==null&&(k=l,E=null));var R=new gi("action","action",null,d,x);a.push({event:R,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(ma!==0){var $=E?t2(x,E):new FormData(x);Y0(f,{pending:!0,data:$,method:x.method,action:k},null,$)}}else typeof k=="function"&&(R.preventDefault(),$=E?t2(x,E):new FormData(x),Y0(f,{pending:!0,data:$,method:x.method,action:k},k,$))},currentTarget:x}]})}}for(var Oy=0;Oy<h0.length;Oy++){var Ry=h0[Oy],F6=Ry.toLowerCase(),P6=Ry[0].toUpperCase()+Ry.slice(1);yi(F6,"on"+P6)}yi(Dv,"onAnimationEnd"),yi(Iv,"onAnimationIteration"),yi(_v,"onAnimationStart"),yi("dblclick","onDoubleClick"),yi("focusin","onFocus"),yi("focusout","onBlur"),yi(n6,"onTransitionRun"),yi(r6,"onTransitionStart"),yi(i6,"onTransitionCancel"),yi(zv,"onTransitionEnd"),Oi("onMouseEnter",["mouseout","mouseover"]),Oi("onMouseLeave",["mouseout","mouseover"]),Oi("onPointerEnter",["pointerout","pointerover"]),Oi("onPointerLeave",["pointerout","pointerover"]),ss("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ss("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ss("onBeforeInput",["compositionend","keypress","textInput","paste"]),ss("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ss("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ss("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Bc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),j6=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Bc));function n2(a,l){l=(l&4)!==0;for(var f=0;f<a.length;f++){var d=a[f],x=d.event;d=d.listeners;e:{var k=void 0;if(l)for(var E=d.length-1;0<=E;E--){var R=d[E],$=R.instance,te=R.currentTarget;if(R=R.listener,$!==k&&x.isPropagationStopped())break e;k=R,x.currentTarget=te;try{k(x)}catch(se){Tp(se)}x.currentTarget=null,k=$}else for(E=0;E<d.length;E++){if(R=d[E],$=R.instance,te=R.currentTarget,R=R.listener,$!==k&&x.isPropagationStopped())break e;k=R,x.currentTarget=te;try{k(x)}catch(se){Tp(se)}x.currentTarget=null,k=$}}}}function tt(a,l){var f=l[ec];f===void 0&&(f=l[ec]=new Set);var d=a+"__bubble";f.has(d)||(r2(l,a,2,!1),f.add(d))}function Dy(a,l,f){var d=0;l&&(d|=4),r2(f,a,d,l)}var dd="_reactListening"+Math.random().toString(36).slice(2);function Iy(a){if(!a[dd]){a[dd]=!0,xp.forEach(function(f){f!=="selectionchange"&&(j6.has(f)||Dy(f,!1,a),Dy(f,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[dd]||(l[dd]=!0,Dy("selectionchange",!1,l))}}function r2(a,l,f,d){switch(D2(l)){case 2:var x=m4;break;case 8:x=g4;break;default:x=Gy}f=x.bind(null,l,f,a),x=void 0,!W||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(x=!0),d?x!==void 0?a.addEventListener(l,f,{capture:!0,passive:x}):a.addEventListener(l,f,!0):x!==void 0?a.addEventListener(l,f,{passive:x}):a.addEventListener(l,f,!1)}function _y(a,l,f,d,x){var k=d;if((l&1)===0&&(l&2)===0&&d!==null)e:for(;;){if(d===null)return;var E=d.tag;if(E===3||E===4){var R=d.stateNode.containerInfo;if(R===x)break;if(E===4)for(E=d.return;E!==null;){var $=E.tag;if(($===3||$===4)&&E.stateNode.containerInfo===x)return;E=E.return}for(;R!==null;){if(E=ns(R),E===null)return;if($=E.tag,$===5||$===6||$===26||$===27){d=k=E;continue e}R=R.parentNode}}d=d.return}w(function(){var te=k,se=oc(f),he=[];e:{var ne=Lv.get(a);if(ne!==void 0){var re=gi,Ce=a;switch(a){case"keypress":if(yt(f)===0)break e;case"keydown":case"keyup":re=__;break;case"focusin":Ce="focus",re=r0;break;case"focusout":Ce="blur",re=r0;break;case"beforeblur":case"afterblur":re=r0;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=fv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=v_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=B_;break;case Dv:case Iv:case _v:re=E_;break;case zv:re=F_;break;case"scroll":case"scrollend":re=S_;break;case"wheel":re=j_;break;case"copy":case"cut":case"paste":re=A_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=pv;break;case"toggle":case"beforetoggle":re=U_}var Be=(l&4)!==0,Nt=!Be&&(a==="scroll"||a==="scrollend"),Y=Be?ne!==null?ne+"Capture":null:ne;Be=[];for(var U=te,Z;U!==null;){var ue=U;if(Z=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||Z===null||Y===null||(ue=A(U,Y),ue!=null&&Be.push(Vc(U,ue,Z))),Nt)break;U=U.return}0<Be.length&&(ne=new re(ne,Ce,null,f,se),he.push({event:ne,listeners:Be}))}}if((l&7)===0){e:{if(ne=a==="mouseover"||a==="pointerover",re=a==="mouseout"||a==="pointerout",ne&&f!==Tl&&(Ce=f.relatedTarget||f.fromElement)&&(ns(Ce)||Ce[ts]))break e;if((re||ne)&&(ne=se.window===se?se:(ne=se.ownerDocument)?ne.defaultView||ne.parentWindow:window,re?(Ce=f.relatedTarget||f.toElement,re=te,Ce=Ce?ns(Ce):null,Ce!==null&&(Nt=s(Ce),Be=Ce.tag,Ce!==Nt||Be!==5&&Be!==27&&Be!==6)&&(Ce=null)):(re=null,Ce=te),re!==Ce)){if(Be=fv,ue="onMouseLeave",Y="onMouseEnter",U="mouse",(a==="pointerout"||a==="pointerover")&&(Be=pv,ue="onPointerLeave",Y="onPointerEnter",U="pointer"),Nt=re==null?ne:Gs(re),Z=Ce==null?ne:Gs(Ce),ne=new Be(ue,U+"leave",re,f,se),ne.target=Nt,ne.relatedTarget=Z,ue=null,ns(se)===te&&(Be=new Be(Y,U+"enter",Ce,f,se),Be.target=Z,Be.relatedTarget=Nt,ue=Be),Nt=ue,re&&Ce)t:{for(Be=$6,Y=re,U=Ce,Z=0,ue=Y;ue;ue=Be(ue))Z++;ue=0;for(var Ie=U;Ie;Ie=Be(Ie))ue++;for(;0<Z-ue;)Y=Be(Y),Z--;for(;0<ue-Z;)U=Be(U),ue--;for(;Z--;){if(Y===U||U!==null&&Y===U.alternate){Be=Y;break t}Y=Be(Y),U=Be(U)}Be=null}else Be=null;re!==null&&i2(he,ne,re,Be,!1),Ce!==null&&Nt!==null&&i2(he,Nt,Ce,Be,!0)}}e:{if(ne=te?Gs(te):window,re=ne.nodeName&&ne.nodeName.toLowerCase(),re==="select"||re==="input"&&ne.type==="file")var ht=kv;else if(bv(ne))if(vv)ht=Z_;else{ht=X_;var Me=W_}else re=ne.nodeName,!re||re.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Ws(te.elementType)&&(ht=kv):ht=Q_;if(ht&&(ht=ht(a,te))){Sv(he,ht,f,se);break e}Me&&Me(a,ne,te),a==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&ic(ne,"number",ne.value)}switch(Me=te?Gs(te):window,a){case"focusin":(bv(Me)||Me.contentEditable==="true")&&(Ol=Me,u0=te,pc=null);break;case"focusout":pc=u0=Ol=null;break;case"mousedown":c0=!0;break;case"contextmenu":case"mouseup":case"dragend":c0=!1,Ov(he,f,se);break;case"selectionchange":if(t6)break;case"keydown":case"keyup":Ov(he,f,se)}var Ye;if(s0)e:{switch(a){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else Ml?yv(a,f)&&(it="onCompositionEnd"):a==="keydown"&&f.keyCode===229&&(it="onCompositionStart");it&&(dv&&f.locale!=="ko"&&(Ml||it!=="onCompositionStart"?it==="onCompositionEnd"&&Ml&&(Ye=qe()):(me=se,ye="value"in me?me.value:me.textContent,Ml=!0)),Me=md(te,it),0<Me.length&&(it=new hv(it,a,null,f,se),he.push({event:it,listeners:Me}),Ye?it.data=Ye:(Ye=xv(f),Ye!==null&&(it.data=Ye)))),(Ye=H_?q_(a,f):K_(a,f))&&(it=md(te,"onBeforeInput"),0<it.length&&(Me=new hv("onBeforeInput","beforeinput",null,f,se),he.push({event:Me,listeners:it}),Me.data=Ye)),V6(he,a,te,f,se)}n2(he,l)})}function Vc(a,l,f){return{instance:a,listener:l,currentTarget:f}}function md(a,l){for(var f=l+"Capture",d=[];a!==null;){var x=a,k=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||k===null||(x=A(a,f),x!=null&&d.unshift(Vc(a,x,k)),x=A(a,l),x!=null&&d.push(Vc(a,x,k))),a.tag===3)return d;a=a.return}return[]}function $6(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function i2(a,l,f,d,x){for(var k=l._reactName,E=[];f!==null&&f!==d;){var R=f,$=R.alternate,te=R.stateNode;if(R=R.tag,$!==null&&$===d)break;R!==5&&R!==26&&R!==27||te===null||($=te,x?(te=A(f,k),te!=null&&E.unshift(Vc(f,te,$))):x||(te=A(f,k),te!=null&&E.push(Vc(f,te,$)))),f=f.return}E.length!==0&&a.push({event:l,listeners:E})}var U6=/\r\n?/g,J6=/\u0000|\uFFFD/g;function s2(a){return(typeof a=="string"?a:""+a).replace(U6,`
100
+ `).replace(J6,"")}function a2(a,l){return l=s2(l),s2(a)===l}function Et(a,l,f,d,x,k){switch(f){case"children":typeof d=="string"?l==="body"||l==="textarea"&&d===""||mi(a,d):(typeof d=="number"||typeof d=="bigint")&&l!=="body"&&mi(a,""+d);break;case"className":Nl(a,"class",d);break;case"tabIndex":Nl(a,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Nl(a,f,d);break;case"style":ac(a,d,k);break;case"data":if(l!=="object"){Nl(a,"data",d);break}case"src":case"href":if(d===""&&(l!=="a"||f!=="href")){a.removeAttribute(f);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){a.removeAttribute(f);break}d=so(""+d),a.setAttribute(f,d);break;case"action":case"formAction":if(typeof d=="function"){a.setAttribute(f,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof k=="function"&&(f==="formAction"?(l!=="input"&&Et(a,l,"name",x.name,x,null),Et(a,l,"formEncType",x.formEncType,x,null),Et(a,l,"formMethod",x.formMethod,x,null),Et(a,l,"formTarget",x.formTarget,x,null)):(Et(a,l,"encType",x.encType,x,null),Et(a,l,"method",x.method,x,null),Et(a,l,"target",x.target,x,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){a.removeAttribute(f);break}d=so(""+d),a.setAttribute(f,d);break;case"onClick":d!=null&&(a.onclick=_r);break;case"onScroll":d!=null&&tt("scroll",a);break;case"onScrollEnd":d!=null&&tt("scrollend",a);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(f=d.__html,f!=null){if(x.children!=null)throw Error(r(60));a.innerHTML=f}}break;case"multiple":a.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":a.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){a.removeAttribute("xlink:href");break}f=so(""+d),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?a.setAttribute(f,""+d):a.removeAttribute(f);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?a.setAttribute(f,""):a.removeAttribute(f);break;case"capture":case"download":d===!0?a.setAttribute(f,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?a.setAttribute(f,d):a.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?a.setAttribute(f,d):a.removeAttribute(f);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?a.removeAttribute(f):a.setAttribute(f,d);break;case"popover":tt("beforetoggle",a),tt("toggle",a),Dn(a,"popover",d);break;case"xlinkActuate":pi(a,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":pi(a,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":pi(a,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":pi(a,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":pi(a,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":pi(a,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":pi(a,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":pi(a,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":pi(a,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Dn(a,"is",d);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=Qe.get(f)||f,Dn(a,f,d))}}function zy(a,l,f,d,x,k){switch(f){case"style":ac(a,d,k);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(f=d.__html,f!=null){if(x.children!=null)throw Error(r(60));a.innerHTML=f}}break;case"children":typeof d=="string"?mi(a,d):(typeof d=="number"||typeof d=="bigint")&&mi(a,""+d);break;case"onScroll":d!=null&&tt("scroll",a);break;case"onScrollEnd":d!=null&&tt("scrollend",a);break;case"onClick":d!=null&&(a.onclick=_r);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tc.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(x=f.endsWith("Capture"),l=f.slice(2,x?f.length-7:void 0),k=a[on]||null,k=k!=null?k[f]:null,typeof k=="function"&&a.removeEventListener(l,k,x),typeof d=="function")){typeof k!="function"&&k!==null&&(f in a?a[f]=null:a.hasAttribute(f)&&a.removeAttribute(f)),a.addEventListener(l,d,x);break e}f in a?a[f]=d:d===!0?a.setAttribute(f,""):Dn(a,f,d)}}}function fn(a,l,f){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",a),tt("load",a);var d=!1,x=!1,k;for(k in f)if(f.hasOwnProperty(k)){var E=f[k];if(E!=null)switch(k){case"src":d=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Et(a,l,k,E,f,null)}}x&&Et(a,l,"srcSet",f.srcSet,f,null),d&&Et(a,l,"src",f.src,f,null);return;case"input":tt("invalid",a);var R=k=E=x=null,$=null,te=null;for(d in f)if(f.hasOwnProperty(d)){var se=f[d];if(se!=null)switch(d){case"name":x=se;break;case"type":E=se;break;case"checked":$=se;break;case"defaultChecked":te=se;break;case"value":k=se;break;case"defaultValue":R=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,l));break;default:Et(a,l,d,se,f,null)}}rc(a,k,R,$,te,E,x,!1);return;case"select":tt("invalid",a),d=E=k=null;for(x in f)if(f.hasOwnProperty(x)&&(R=f[x],R!=null))switch(x){case"value":k=R;break;case"defaultValue":E=R;break;case"multiple":d=R;default:Et(a,l,x,R,f,null)}l=k,f=E,a.multiple=!!d,l!=null?Ys(a,!!d,l,!1):f!=null&&Ys(a,!!d,f,!0);return;case"textarea":tt("invalid",a),k=x=d=null;for(E in f)if(f.hasOwnProperty(E)&&(R=f[E],R!=null))switch(E){case"value":d=R;break;case"defaultValue":x=R;break;case"children":k=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(r(91));break;default:Et(a,l,E,R,f,null)}wp(a,d,x,k);return;case"option":for($ in f)f.hasOwnProperty($)&&(d=f[$],d!=null)&&($==="selected"?a.selected=d&&typeof d!="function"&&typeof d!="symbol":Et(a,l,$,d,f,null));return;case"dialog":tt("beforetoggle",a),tt("toggle",a),tt("cancel",a),tt("close",a);break;case"iframe":case"object":tt("load",a);break;case"video":case"audio":for(d=0;d<Bc.length;d++)tt(Bc[d],a);break;case"image":tt("error",a),tt("load",a);break;case"details":tt("toggle",a);break;case"embed":case"source":case"link":tt("error",a),tt("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in f)if(f.hasOwnProperty(te)&&(d=f[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Et(a,l,te,d,f,null)}return;default:if(Ws(l)){for(se in f)f.hasOwnProperty(se)&&(d=f[se],d!==void 0&&zy(a,l,se,d,f,void 0));return}}for(R in f)f.hasOwnProperty(R)&&(d=f[R],d!=null&&Et(a,l,R,d,f,null))}function H6(a,l,f,d){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,k=null,E=null,R=null,$=null,te=null,se=null;for(re in f){var he=f[re];if(f.hasOwnProperty(re)&&he!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":$=he;default:d.hasOwnProperty(re)||Et(a,l,re,null,d,he)}}for(var ne in d){var re=d[ne];if(he=f[ne],d.hasOwnProperty(ne)&&(re!=null||he!=null))switch(ne){case"type":k=re;break;case"name":x=re;break;case"checked":te=re;break;case"defaultChecked":se=re;break;case"value":E=re;break;case"defaultValue":R=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,l));break;default:re!==he&&Et(a,l,ne,re,d,he)}}nc(a,E,R,$,te,se,k,x);return;case"select":re=E=R=ne=null;for(k in f)if($=f[k],f.hasOwnProperty(k)&&$!=null)switch(k){case"value":break;case"multiple":re=$;default:d.hasOwnProperty(k)||Et(a,l,k,null,d,$)}for(x in d)if(k=d[x],$=f[x],d.hasOwnProperty(x)&&(k!=null||$!=null))switch(x){case"value":ne=k;break;case"defaultValue":R=k;break;case"multiple":E=k;default:k!==$&&Et(a,l,x,k,d,$)}l=R,f=E,d=re,ne!=null?Ys(a,!!f,ne,!1):!!d!=!!f&&(l!=null?Ys(a,!!f,l,!0):Ys(a,!!f,f?[]:"",!1));return;case"textarea":re=ne=null;for(R in f)if(x=f[R],f.hasOwnProperty(R)&&x!=null&&!d.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:Et(a,l,R,null,d,x)}for(E in d)if(x=d[E],k=f[E],d.hasOwnProperty(E)&&(x!=null||k!=null))switch(E){case"value":ne=x;break;case"defaultValue":re=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==k&&Et(a,l,E,x,d,k)}Cp(a,ne,re);return;case"option":for(var Ce in f)ne=f[Ce],f.hasOwnProperty(Ce)&&ne!=null&&!d.hasOwnProperty(Ce)&&(Ce==="selected"?a.selected=!1:Et(a,l,Ce,null,d,ne));for($ in d)ne=d[$],re=f[$],d.hasOwnProperty($)&&ne!==re&&(ne!=null||re!=null)&&($==="selected"?a.selected=ne&&typeof ne!="function"&&typeof ne!="symbol":Et(a,l,$,ne,d,re));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Be in f)ne=f[Be],f.hasOwnProperty(Be)&&ne!=null&&!d.hasOwnProperty(Be)&&Et(a,l,Be,null,d,ne);for(te in d)if(ne=d[te],re=f[te],d.hasOwnProperty(te)&&ne!==re&&(ne!=null||re!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,l));break;default:Et(a,l,te,ne,d,re)}return;default:if(Ws(l)){for(var Nt in f)ne=f[Nt],f.hasOwnProperty(Nt)&&ne!==void 0&&!d.hasOwnProperty(Nt)&&zy(a,l,Nt,void 0,d,ne);for(se in d)ne=d[se],re=f[se],!d.hasOwnProperty(se)||ne===re||ne===void 0&&re===void 0||zy(a,l,se,ne,d,re);return}}for(var Y in f)ne=f[Y],f.hasOwnProperty(Y)&&ne!=null&&!d.hasOwnProperty(Y)&&Et(a,l,Y,null,d,ne);for(he in d)ne=d[he],re=f[he],!d.hasOwnProperty(he)||ne===re||ne==null&&re==null||Et(a,l,he,ne,d,re)}function o2(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function q6(){if(typeof performance.getEntriesByType=="function"){for(var a=0,l=0,f=performance.getEntriesByType("resource"),d=0;d<f.length;d++){var x=f[d],k=x.transferSize,E=x.initiatorType,R=x.duration;if(k&&R&&o2(E)){for(E=0,R=x.responseEnd,d+=1;d<f.length;d++){var $=f[d],te=$.startTime;if(te>R)break;var se=$.transferSize,he=$.initiatorType;se&&o2(he)&&($=$.responseEnd,E+=se*($<R?1:(R-te)/($-te)))}if(--d,l+=8*(k+E)/(x.duration/1e3),a++,10<a)break}}if(0<a)return l/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var Ly=null,By=null;function gd(a){return a.nodeType===9?a:a.ownerDocument}function l2(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function u2(a,l){if(a===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&l==="foreignObject"?0:a}function Vy(a,l){return a==="textarea"||a==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Fy=null;function K6(){var a=window.event;return a&&a.type==="popstate"?a===Fy?!1:(Fy=a,!0):(Fy=null,!1)}var c2=typeof setTimeout=="function"?setTimeout:void 0,G6=typeof clearTimeout=="function"?clearTimeout:void 0,f2=typeof Promise=="function"?Promise:void 0,Y6=typeof queueMicrotask=="function"?queueMicrotask:typeof f2<"u"?function(a){return f2.resolve(null).then(a).catch(W6)}:c2;function W6(a){setTimeout(function(){throw a})}function ga(a){return a==="head"}function h2(a,l){var f=l,d=0;do{var x=f.nextSibling;if(a.removeChild(f),x&&x.nodeType===8)if(f=x.data,f==="/$"||f==="/&"){if(d===0){a.removeChild(x),ru(l);return}d--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")d++;else if(f==="html")Fc(a.ownerDocument.documentElement);else if(f==="head"){f=a.ownerDocument.head,Fc(f);for(var k=f.firstChild;k;){var E=k.nextSibling,R=k.nodeName;k[Ks]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&k.rel.toLowerCase()==="stylesheet"||f.removeChild(k),k=E}}else f==="body"&&Fc(a.ownerDocument.body);f=x}while(f);ru(l)}function p2(a,l){var f=a;a=0;do{var d=f.nextSibling;if(f.nodeType===1?l?(f._stashedDisplay=f.style.display,f.style.display="none"):(f.style.display=f._stashedDisplay||"",f.getAttribute("style")===""&&f.removeAttribute("style")):f.nodeType===3&&(l?(f._stashedText=f.nodeValue,f.nodeValue=""):f.nodeValue=f._stashedText||""),d&&d.nodeType===8)if(f=d.data,f==="/$"){if(a===0)break;a--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||a++;f=d}while(f)}function Py(a){var l=a.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var f=l;switch(l=l.nextSibling,f.nodeName){case"HTML":case"HEAD":case"BODY":Py(f),wl(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}a.removeChild(f)}}function X6(a,l,f,d){for(;a.nodeType===1;){var x=f;if(a.nodeName.toLowerCase()!==l.toLowerCase()){if(!d&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(d){if(!a[Ks])switch(l){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(k=a.getAttribute("rel"),k==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(k!==x.rel||a.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||a.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||a.getAttribute("title")!==(x.title==null?null:x.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(k=a.getAttribute("src"),(k!==(x.src==null?null:x.src)||a.getAttribute("type")!==(x.type==null?null:x.type)||a.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&k&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(l==="input"&&a.type==="hidden"){var k=x.name==null?null:""+x.name;if(x.type==="hidden"&&a.getAttribute("name")===k)return a}else return a;if(a=Ur(a.nextSibling),a===null)break}return null}function Q6(a,l,f){if(l==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!f||(a=Ur(a.nextSibling),a===null))return null;return a}function d2(a,l){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!l||(a=Ur(a.nextSibling),a===null))return null;return a}function jy(a){return a.data==="$?"||a.data==="$~"}function $y(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function Z6(a,l){var f=a.ownerDocument;if(a.data==="$~")a._reactRetry=l;else if(a.data!=="$?"||f.readyState!=="loading")l();else{var d=function(){l(),f.removeEventListener("DOMContentLoaded",d)};f.addEventListener("DOMContentLoaded",d),a._reactRetry=d}}function Ur(a){for(;a!=null;a=a.nextSibling){var l=a.nodeType;if(l===1||l===3)break;if(l===8){if(l=a.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return a}var Uy=null;function m2(a){a=a.nextSibling;for(var l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"||f==="/&"){if(l===0)return Ur(a.nextSibling);l--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||l++}a=a.nextSibling}return null}function g2(a){a=a.previousSibling;for(var l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"){if(l===0)return a;l--}else f!=="/$"&&f!=="/&"||l++}a=a.previousSibling}return null}function y2(a,l,f){switch(l=gd(f),a){case"html":if(a=l.documentElement,!a)throw Error(r(452));return a;case"head":if(a=l.head,!a)throw Error(r(453));return a;case"body":if(a=l.body,!a)throw Error(r(454));return a;default:throw Error(r(451))}}function Fc(a){for(var l=a.attributes;l.length;)a.removeAttributeNode(l[0]);wl(a)}var Jr=new Map,x2=new Set;function yd(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var ks=oe.d;oe.d={f:e4,r:t4,D:n4,C:r4,L:i4,m:s4,X:o4,S:a4,M:l4};function e4(){var a=ks.f(),l=ld();return a||l}function t4(a){var l=rs(a);l!==null&&l.tag===5&&l.type==="form"?zC(l):ks.r(a)}var eu=typeof document>"u"?null:document;function b2(a,l,f){var d=eu;if(d&&typeof l=="string"&&l){var x=Tt(l);x='link[rel="'+a+'"][href="'+x+'"]',typeof f=="string"&&(x+='[crossorigin="'+f+'"]'),x2.has(x)||(x2.add(x),a={rel:a,crossOrigin:f,href:l},d.querySelector(x)===null&&(l=d.createElement("link"),fn(l,"link",a),qt(l),d.head.appendChild(l)))}}function n4(a){ks.D(a),b2("dns-prefetch",a,null)}function r4(a,l){ks.C(a,l),b2("preconnect",a,l)}function i4(a,l,f){ks.L(a,l,f);var d=eu;if(d&&a&&l){var x='link[rel="preload"][as="'+Tt(l)+'"]';l==="image"&&f&&f.imageSrcSet?(x+='[imagesrcset="'+Tt(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(x+='[imagesizes="'+Tt(f.imageSizes)+'"]')):x+='[href="'+Tt(a)+'"]';var k=x;switch(l){case"style":k=tu(a);break;case"script":k=nu(a)}Jr.has(k)||(a=g({rel:"preload",href:l==="image"&&f&&f.imageSrcSet?void 0:a,as:l},f),Jr.set(k,a),d.querySelector(x)!==null||l==="style"&&d.querySelector(Pc(k))||l==="script"&&d.querySelector(jc(k))||(l=d.createElement("link"),fn(l,"link",a),qt(l),d.head.appendChild(l)))}}function s4(a,l){ks.m(a,l);var f=eu;if(f&&a){var d=l&&typeof l.as=="string"?l.as:"script",x='link[rel="modulepreload"][as="'+Tt(d)+'"][href="'+Tt(a)+'"]',k=x;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=nu(a)}if(!Jr.has(k)&&(a=g({rel:"modulepreload",href:a},l),Jr.set(k,a),f.querySelector(x)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(jc(k)))return}d=f.createElement("link"),fn(d,"link",a),qt(d),f.head.appendChild(d)}}}function a4(a,l,f){ks.S(a,l,f);var d=eu;if(d&&a){var x=is(d).hoistableStyles,k=tu(a);l=l||"default";var E=x.get(k);if(!E){var R={loading:0,preload:null};if(E=d.querySelector(Pc(k)))R.loading=5;else{a=g({rel:"stylesheet",href:a,"data-precedence":l},f),(f=Jr.get(k))&&Jy(a,f);var $=E=d.createElement("link");qt($),fn($,"link",a),$._p=new Promise(function(te,se){$.onload=te,$.onerror=se}),$.addEventListener("load",function(){R.loading|=1}),$.addEventListener("error",function(){R.loading|=2}),R.loading|=4,xd(E,l,d)}E={type:"stylesheet",instance:E,count:1,state:R},x.set(k,E)}}}function o4(a,l){ks.X(a,l);var f=eu;if(f&&a){var d=is(f).hoistableScripts,x=nu(a),k=d.get(x);k||(k=f.querySelector(jc(x)),k||(a=g({src:a,async:!0},l),(l=Jr.get(x))&&Hy(a,l),k=f.createElement("script"),qt(k),fn(k,"link",a),f.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},d.set(x,k))}}function l4(a,l){ks.M(a,l);var f=eu;if(f&&a){var d=is(f).hoistableScripts,x=nu(a),k=d.get(x);k||(k=f.querySelector(jc(x)),k||(a=g({src:a,async:!0,type:"module"},l),(l=Jr.get(x))&&Hy(a,l),k=f.createElement("script"),qt(k),fn(k,"link",a),f.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},d.set(x,k))}}function S2(a,l,f,d){var x=(x=Te.current)?yd(x):null;if(!x)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(l=tu(f.href),f=is(x).hoistableStyles,d=f.get(l),d||(d={type:"style",instance:null,count:0,state:null},f.set(l,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){a=tu(f.href);var k=is(x).hoistableStyles,E=k.get(a);if(E||(x=x.ownerDocument||x,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(a,E),(k=x.querySelector(Pc(a)))&&!k._p&&(E.instance=k,E.state.loading=5),Jr.has(a)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},Jr.set(a,f),k||u4(x,a,f,E.state))),l&&d===null)throw Error(r(528,""));return E}if(l&&d!==null)throw Error(r(529,""));return null;case"script":return l=f.async,f=f.src,typeof f=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=nu(f),f=is(x).hoistableScripts,d=f.get(l),d||(d={type:"script",instance:null,count:0,state:null},f.set(l,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function tu(a){return'href="'+Tt(a)+'"'}function Pc(a){return'link[rel="stylesheet"]['+a+"]"}function k2(a){return g({},a,{"data-precedence":a.precedence,precedence:null})}function u4(a,l,f,d){a.querySelector('link[rel="preload"][as="style"]['+l+"]")?d.loading=1:(l=a.createElement("link"),d.preload=l,l.addEventListener("load",function(){return d.loading|=1}),l.addEventListener("error",function(){return d.loading|=2}),fn(l,"link",f),qt(l),a.head.appendChild(l))}function nu(a){return'[src="'+Tt(a)+'"]'}function jc(a){return"script[async]"+a}function v2(a,l,f){if(l.count++,l.instance===null)switch(l.type){case"style":var d=a.querySelector('style[data-href~="'+Tt(f.href)+'"]');if(d)return l.instance=d,qt(d),d;var x=g({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return d=(a.ownerDocument||a).createElement("style"),qt(d),fn(d,"style",x),xd(d,f.precedence,a),l.instance=d;case"stylesheet":x=tu(f.href);var k=a.querySelector(Pc(x));if(k)return l.state.loading|=4,l.instance=k,qt(k),k;d=k2(f),(x=Jr.get(x))&&Jy(d,x),k=(a.ownerDocument||a).createElement("link"),qt(k);var E=k;return E._p=new Promise(function(R,$){E.onload=R,E.onerror=$}),fn(k,"link",d),l.state.loading|=4,xd(k,f.precedence,a),l.instance=k;case"script":return k=nu(f.src),(x=a.querySelector(jc(k)))?(l.instance=x,qt(x),x):(d=f,(x=Jr.get(k))&&(d=g({},f),Hy(d,x)),a=a.ownerDocument||a,x=a.createElement("script"),qt(x),fn(x,"link",d),a.head.appendChild(x),l.instance=x);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(d=l.instance,l.state.loading|=4,xd(d,f.precedence,a));return l.instance}function xd(a,l,f){for(var d=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=d.length?d[d.length-1]:null,k=x,E=0;E<d.length;E++){var R=d[E];if(R.dataset.precedence===l)k=R;else if(k!==x)break}k?k.parentNode.insertBefore(a,k.nextSibling):(l=f.nodeType===9?f.head:f,l.insertBefore(a,l.firstChild))}function Jy(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.title==null&&(a.title=l.title)}function Hy(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.integrity==null&&(a.integrity=l.integrity)}var bd=null;function C2(a,l,f){if(bd===null){var d=new Map,x=bd=new Map;x.set(f,d)}else x=bd,d=x.get(f),d||(d=new Map,x.set(f,d));if(d.has(a))return d;for(d.set(a,null),f=f.getElementsByTagName(a),x=0;x<f.length;x++){var k=f[x];if(!(k[Ks]||k[Ht]||a==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var E=k.getAttribute(l)||"";E=a+E;var R=d.get(E);R?R.push(k):d.set(E,[k])}}return d}function w2(a,l,f){a=a.ownerDocument||a,a.head.insertBefore(f,l==="title"?a.querySelector("head > title"):null)}function c4(a,l,f){if(f===1||l.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(a=l.disabled,typeof l.precedence=="string"&&a==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function E2(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function f4(a,l,f,d){if(f.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var x=tu(d.href),k=l.querySelector(Pc(x));if(k){l=k._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(a.count++,a=Sd.bind(a),l.then(a,a)),f.state.loading|=4,f.instance=k,qt(k);return}k=l.ownerDocument||l,d=k2(d),(x=Jr.get(x))&&Jy(d,x),k=k.createElement("link"),qt(k);var E=k;E._p=new Promise(function(R,$){E.onload=R,E.onerror=$}),fn(k,"link",d),f.instance=k}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(f,l),(l=f.state.preload)&&(f.state.loading&3)===0&&(a.count++,f=Sd.bind(a),l.addEventListener("load",f),l.addEventListener("error",f))}}var qy=0;function h4(a,l){return a.stylesheets&&a.count===0&&vd(a,a.stylesheets),0<a.count||0<a.imgCount?function(f){var d=setTimeout(function(){if(a.stylesheets&&vd(a,a.stylesheets),a.unsuspend){var k=a.unsuspend;a.unsuspend=null,k()}},6e4+l);0<a.imgBytes&&qy===0&&(qy=62500*q6());var x=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&vd(a,a.stylesheets),a.unsuspend)){var k=a.unsuspend;a.unsuspend=null,k()}},(a.imgBytes>qy?50:800)+l);return a.unsuspend=f,function(){a.unsuspend=null,clearTimeout(d),clearTimeout(x)}}:null}function Sd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vd(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var kd=null;function vd(a,l){a.stylesheets=null,a.unsuspend!==null&&(a.count++,kd=new Map,l.forEach(p4,a),kd=null,Sd.call(a))}function p4(a,l){if(!(l.state.loading&4)){var f=kd.get(a);if(f)var d=f.get(null);else{f=new Map,kd.set(a,f);for(var x=a.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<x.length;k++){var E=x[k];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(f.set(E.dataset.precedence,E),d=E)}d&&f.set(null,d)}x=l.instance,E=x.getAttribute("data-precedence"),k=f.get(E)||d,k===d&&f.set(null,x),f.set(E,x),this.count++,d=Sd.bind(this),x.addEventListener("load",d),x.addEventListener("error",d),k?k.parentNode.insertBefore(x,k.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(x,a.firstChild)),l.state.loading|=4}}var $c={$$typeof:P,Provider:null,Consumer:null,_currentValue:ke,_currentValue2:ke,_threadCount:0};function d4(a,l,f,d,x,k,E,R,$){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=no(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=no(0),this.hiddenUpdates=no(null),this.identifierPrefix=d,this.onUncaughtError=x,this.onCaughtError=k,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function N2(a,l,f,d,x,k,E,R,$,te,se,he){return a=new d4(a,l,f,E,$,te,se,he,R),l=1,k===!0&&(l|=24),k=yr(3,null,null,l),a.current=k,k.stateNode=a,l=E0(),l.refCount++,a.pooledCache=l,l.refCount++,k.memoizedState={element:d,isDehydrated:f,cache:l},M0(k),a}function A2(a){return a?(a=Il,a):Il}function T2(a,l,f,d,x,k){x=A2(x),d.context===null?d.context=x:d.pendingContext=x,d=sa(l),d.payload={element:f},k=k===void 0?null:k,k!==null&&(d.callback=k),f=aa(a,d,l),f!==null&&(ir(f,a,l),Sc(f,a,l))}function M2(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<l?f:l}}function Ky(a,l){M2(a,l),(a=a.alternate)&&M2(a,l)}function O2(a){if(a.tag===13||a.tag===31){var l=lo(a,67108864);l!==null&&ir(l,a,67108864),Ky(a,67108864)}}function R2(a){if(a.tag===13||a.tag===31){var l=vr();l=es(l);var f=lo(a,l);f!==null&&ir(f,a,l),Ky(a,l)}}var Cd=!0;function m4(a,l,f,d){var x=X.T;X.T=null;var k=oe.p;try{oe.p=2,Gy(a,l,f,d)}finally{oe.p=k,X.T=x}}function g4(a,l,f,d){var x=X.T;X.T=null;var k=oe.p;try{oe.p=8,Gy(a,l,f,d)}finally{oe.p=k,X.T=x}}function Gy(a,l,f,d){if(Cd){var x=Yy(d);if(x===null)_y(a,l,d,wd,f),I2(a,d);else if(x4(x,a,l,f,d))d.stopPropagation();else if(I2(a,d),l&4&&-1<y4.indexOf(a)){for(;x!==null;){var k=rs(x);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var E=Jt(k.pendingLanes);if(E!==0){var R=k;for(R.pendingLanes|=2,R.entangledLanes|=2;E;){var $=1<<31-St(E);R.entanglements[1]|=$,E&=~$}_i(k),(dt&6)===0&&(ad=$e()+500,Lc(0))}}break;case 31:case 13:R=lo(k,2),R!==null&&ir(R,k,2),ld(),Ky(k,2)}if(k=Yy(d),k===null&&_y(a,l,d,wd,f),k===x)break;x=k}x!==null&&d.stopPropagation()}else _y(a,l,d,null,f)}}function Yy(a){return a=oc(a),Wy(a)}var wd=null;function Wy(a){if(wd=null,a=ns(a),a!==null){var l=s(a);if(l===null)a=null;else{var f=l.tag;if(f===13){if(a=o(l),a!==null)return a;a=null}else if(f===31){if(a=u(l),a!==null)return a;a=null}else if(f===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;a=null}else l!==a&&(a=null)}}return wd=a,null}function D2(a){switch(a){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Qi()){case ae:return 2;case de:return 8;case _:case De:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var Xy=!1,ya=null,xa=null,ba=null,Uc=new Map,Jc=new Map,Sa=[],y4="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function I2(a,l){switch(a){case"focusin":case"focusout":ya=null;break;case"dragenter":case"dragleave":xa=null;break;case"mouseover":case"mouseout":ba=null;break;case"pointerover":case"pointerout":Uc.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Jc.delete(l.pointerId)}}function Hc(a,l,f,d,x,k){return a===null||a.nativeEvent!==k?(a={blockedOn:l,domEventName:f,eventSystemFlags:d,nativeEvent:k,targetContainers:[x]},l!==null&&(l=rs(l),l!==null&&O2(l)),a):(a.eventSystemFlags|=d,l=a.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),a)}function x4(a,l,f,d,x){switch(l){case"focusin":return ya=Hc(ya,a,l,f,d,x),!0;case"dragenter":return xa=Hc(xa,a,l,f,d,x),!0;case"mouseover":return ba=Hc(ba,a,l,f,d,x),!0;case"pointerover":var k=x.pointerId;return Uc.set(k,Hc(Uc.get(k)||null,a,l,f,d,x)),!0;case"gotpointercapture":return k=x.pointerId,Jc.set(k,Hc(Jc.get(k)||null,a,l,f,d,x)),!0}return!1}function _2(a){var l=ns(a.target);if(l!==null){var f=s(l);if(f!==null){if(l=f.tag,l===13){if(l=o(f),l!==null){a.blockedOn=l,Zu(a.priority,function(){R2(f)});return}}else if(l===31){if(l=u(f),l!==null){a.blockedOn=l,Zu(a.priority,function(){R2(f)});return}}else if(l===3&&f.stateNode.current.memoizedState.isDehydrated){a.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}a.blockedOn=null}function Ed(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var f=Yy(a.nativeEvent);if(f===null){f=a.nativeEvent;var d=new f.constructor(f.type,f);Tl=d,f.target.dispatchEvent(d),Tl=null}else return l=rs(f),l!==null&&O2(l),a.blockedOn=f,!1;l.shift()}return!0}function z2(a,l,f){Ed(a)&&f.delete(l)}function b4(){Xy=!1,ya!==null&&Ed(ya)&&(ya=null),xa!==null&&Ed(xa)&&(xa=null),ba!==null&&Ed(ba)&&(ba=null),Uc.forEach(z2),Jc.forEach(z2)}function Nd(a,l){a.blockedOn===l&&(a.blockedOn=null,Xy||(Xy=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,b4)))}var Ad=null;function L2(a){Ad!==a&&(Ad=a,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ad===a&&(Ad=null);for(var l=0;l<a.length;l+=3){var f=a[l],d=a[l+1],x=a[l+2];if(typeof d!="function"){if(Wy(d||f)===null)continue;break}var k=rs(f);k!==null&&(a.splice(l,3),l-=3,Y0(k,{pending:!0,data:x,method:f.method,action:d},d,x))}}))}function ru(a){function l($){return Nd($,a)}ya!==null&&Nd(ya,a),xa!==null&&Nd(xa,a),ba!==null&&Nd(ba,a),Uc.forEach(l),Jc.forEach(l);for(var f=0;f<Sa.length;f++){var d=Sa[f];d.blockedOn===a&&(d.blockedOn=null)}for(;0<Sa.length&&(f=Sa[0],f.blockedOn===null);)_2(f),f.blockedOn===null&&Sa.shift();if(f=(a.ownerDocument||a).$$reactFormReplay,f!=null)for(d=0;d<f.length;d+=3){var x=f[d],k=f[d+1],E=x[on]||null;if(typeof k=="function")E||L2(f);else if(E){var R=null;if(k&&k.hasAttribute("formAction")){if(x=k,E=k[on]||null)R=E.formAction;else if(Wy(x)!==null)continue}else R=E.action;typeof R=="function"?f[d+1]=R:(f.splice(d,3),d-=3),L2(f)}}}function B2(){function a(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(E){return x=E})},focusReset:"manual",scroll:"manual"})}function l(){x!==null&&(x(),x=null),d||setTimeout(f,20)}function f(){if(!d&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,x=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(f,100),function(){d=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),x!==null&&(x(),x=null)}}}function Qy(a){this._internalRoot=a}Td.prototype.render=Qy.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(r(409));var f=l.current,d=vr();T2(f,d,a,l,null,null)},Td.prototype.unmount=Qy.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var l=a.containerInfo;T2(a.current,2,null,a,null,null),ld(),l[ts]=null}};function Td(a){this._internalRoot=a}Td.prototype.unstable_scheduleHydration=function(a){if(a){var l=gp();a={blockedOn:null,target:a,priority:l};for(var f=0;f<Sa.length&&l!==0&&l<Sa[f].priority;f++);Sa.splice(f,0,a),f===0&&_2(a)}};var V2=e.version;if(V2!=="19.2.7")throw Error(r(527,V2,"19.2.7"));oe.findDOMNode=function(a){var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=h(l),a=a!==null?m(a):null,a=a===null?null:a.stateNode,a};var S4={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:X,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Md=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Md.isDisabled&&Md.supportsFiber)try{be=Md.inject(S4),_t=Md}catch{}}return Qc.createRoot=function(a,l){if(!i(a))throw Error(r(299));var f=!1,d="",x=HC,k=qC,E=KC;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(k=l.onCaughtError),l.onRecoverableError!==void 0&&(E=l.onRecoverableError)),l=N2(a,1,!1,null,null,f,d,null,x,k,E,B2),a[ts]=l.current,Iy(a),new Qy(l)},Qc.hydrateRoot=function(a,l,f){if(!i(a))throw Error(r(299));var d=!1,x="",k=HC,E=qC,R=KC,$=null;return f!=null&&(f.unstable_strictMode===!0&&(d=!0),f.identifierPrefix!==void 0&&(x=f.identifierPrefix),f.onUncaughtError!==void 0&&(k=f.onUncaughtError),f.onCaughtError!==void 0&&(E=f.onCaughtError),f.onRecoverableError!==void 0&&(R=f.onRecoverableError),f.formState!==void 0&&($=f.formState)),l=N2(a,1,!0,l,f??null,d,x,$,k,E,R,B2),l.context=A2(null),f=l.current,d=vr(),d=es(d),x=sa(d),x.callback=null,aa(f,x,d),f=d,l.current.lanes=f,ro(l,f),_i(l),a[ts]=l.current,Iy(a),new Td(l)},Qc.version="19.2.7",Qc}var dT;function RG(){if(dT)return Sx.exports;dT=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Sx.exports=OG(),Sx.exports}var m_=RG();function DG(t,e,n){return KV(f_,()=>(r,i,s)=>{const o=document.createElement("div");o.className="mdx-block-card-wrapper",o.setAttribute("data-cms-ui",""),o.contentEditable="false";const u=m_.createRoot(o);let c=null;const h=y=>{const b=typeof s=="function"?s():null;if(b==null)return;const v=i.state.doc.nodeAt(b);if(!v)return;const N=i.state.tr.setNodeMarkup(b,void 0,{...v.attrs,...y});i.dispatch(N)},m=()=>{const y=typeof s=="function"?s():null;if(y==null)return;const b=i.state.doc.nodeAt(y);b&&i.dispatch(i.state.tr.delete(y,y+b.nodeSize))},g=y=>{const b=y.attrs.componentName,v=y.attrs.props,N=y.attrs.hasExpressions,T=y.attrs.children||"";o.setAttribute("data-mdx-component",b),o.setAttribute("data-mdx-props",v),o.setAttribute("data-mdx-children",T);const M=JSON.parse(v),j=t(b),P=(j?.slots?.includes("default")??!1)||T.trim()!=="";c={componentName:b,props:v,hasExpressions:N,children:T},u.render(le.createElement(EG,{componentName:b,props:M,hasExpressions:N,slotContent:T,definition:j,media:e,mediaContext:n,onRemove:m,onSlotContentChange:P?J=>h({children:J}):void 0,onPropsChange:N?void 0:J=>h({props:JSON.stringify(J)})}))};return g(r),{dom:o,stopEvent:y=>{const b=y.target;return!!(b.tagName==="TEXTAREA"||b.tagName==="INPUT"||b.isContentEditable||b.closest("[contenteditable]")||b.closest("[data-mdx-action]")||(y.type==="mousedown"||y.type==="click")&&(b.closest("button")||b.closest("[data-mdx-action]")))},ignoreMutation:()=>!0,update:y=>{if(y.type.name!=="mdx_component")return!1;const b=y.attrs;return c&&b.componentName===c.componentName&&b.props===c.props&&b.hasExpressions===c.hasExpressions&&b.children===c.children||g(y),!0},destroy:()=>{queueMicrotask(()=>u.unmount())}}})}const IG={border:"1px solid #d4d4d8",borderRadius:6,background:"#fff"},_G={padding:"8px 12px",minHeight:240,outline:"none"},mT="nua-mdx-editor-styles",zG=`
101
+ .nua-mdx-editor .ProseMirror { line-height: 1.6; color: #18181b; }
102
+ .nua-mdx-editor .ProseMirror:focus { outline: none; }
103
+ .nua-mdx-editor .ProseMirror h1 { font-size: 1.6em; font-weight: 700; line-height: 1.25; margin: 0.7em 0 0.35em; }
104
+ .nua-mdx-editor .ProseMirror h2 { font-size: 1.35em; font-weight: 700; line-height: 1.3; margin: 0.7em 0 0.35em; }
105
+ .nua-mdx-editor .ProseMirror h3 { font-size: 1.15em; font-weight: 600; line-height: 1.35; margin: 0.6em 0 0.3em; }
106
+ .nua-mdx-editor .ProseMirror h4 { font-size: 1em; font-weight: 600; margin: 0.6em 0 0.3em; }
107
+ .nua-mdx-editor .ProseMirror p { margin: 0.5em 0; }
108
+ .nua-mdx-editor .ProseMirror ul { list-style: disc; padding-left: 1.5em; margin: 0.5em 0; }
109
+ .nua-mdx-editor .ProseMirror ol { list-style: decimal; padding-left: 1.5em; margin: 0.5em 0; }
110
+ .nua-mdx-editor .ProseMirror li { margin: 0.2em 0; }
111
+ .nua-mdx-editor .ProseMirror li > p { margin: 0.1em 0; }
112
+ .nua-mdx-editor .ProseMirror blockquote { border-left: 3px solid #d4d4d8; padding-left: 0.8em; margin: 0.6em 0; color: #52525b; }
113
+ .nua-mdx-editor .ProseMirror strong { font-weight: 700; }
114
+ .nua-mdx-editor .ProseMirror em { font-style: italic; }
115
+ .nua-mdx-editor .ProseMirror a { color: #2563eb; text-decoration: underline; }
116
+ .nua-mdx-editor .ProseMirror code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: #f4f4f5; padding: 0.1em 0.3em; border-radius: 3px; }
117
+ .nua-mdx-editor .ProseMirror pre { background: #f4f4f5; padding: 0.7em 0.9em; border-radius: 6px; overflow-x: auto; }
118
+ .nua-mdx-editor .ProseMirror pre code { background: none; padding: 0; }
119
+ .nua-mdx-editor .ProseMirror img { max-width: 100%; height: auto; border-radius: 4px; }
120
+ .nua-mdx-editor .ProseMirror hr { border: none; border-top: 1px solid #e4e4e7; margin: 1em 0; }
121
+ `;function LG(){le.useEffect(()=>{if(typeof document>"u"||document.getElementById(mT))return;const t=document.createElement("style");t.id=mT,t.textContent=zG,document.head.appendChild(t)},[])}function g_({value:t,onChange:e,components:n,listStyles:r,media:i,mediaContext:s,allowComponents:o=!0}){LG();const u=le.useRef(null),c=le.useRef(null),h=le.useRef(t),m=le.useRef(!1),g=le.useRef(!1),y=le.useRef(e);y.current=e;const b=le.useRef(new Map);le.useEffect(()=>{b.current=new Map((n??[]).map(L=>[L.name,L]))},[n]);const v=le.useRef(i);v.current=i;const N=le.useRef(s);N.current=s;const[T,M]=le.useState(!1),[j,P]=le.useState(null);le.useEffect(()=>{const L=u.current;if(!L)return;let C=!1;const z=ie=>b.current.get(ie);return(async()=>{const ie=await x3.make().config(K=>{K.set(Zf,L),K.set(Qf,h.current),K.get(sg).markdownUpdated((pe,fe)=>{h.current=fe,m.current&&!g.current&&y.current(fe)})}).use(sR).use(CH).use(hI).use(cv).use(LK).use(FK).use(f_).use(DG(z,v.current,N.current)).use(rT).create();if(C){ie.destroy();return}c.current=ie,P(ie),queueMicrotask(()=>{m.current=!0})})(),()=>{C=!0,m.current=!1,c.current?.destroy(),c.current=null,P(null)}},[]),le.useEffect(()=>{!c.current||!m.current||t!==h.current&&(g.current=!0,c.current.action(S3(t)),h.current=t,queueMicrotask(()=>{g.current=!1}))},[t]);const J=(L,C,z)=>{c.current?.action(Bi(rT.key,{componentName:L,props:C,children:z}))};return I.jsxs("div",{className:"nua-mdx-editor",style:IG,children:[I.jsx(vI,{editor:j,listStyles:r,media:i,mediaContext:s,field:"body",onInsertComponent:o?()=>M(!0):void 0}),I.jsx("div",{ref:u,style:_G}),o?I.jsx(U4,{open:T,components:n??[],onInsert:J,onClose:()=>M(!1)}):null]})}function BG({client:t,value:e,collection:n,entry:r,field:i,accept:s,onChange:o}){const[u,c]=le.useState({kind:"probing"}),h=le.useRef(null);le.useEffect(()=>{let N=!0;return t.listMedia({limit:1}).then(()=>{N&&c({kind:"ready"})},T=>{N&&c(J2(T)?{kind:"unavailable"}:{kind:"ready"})}),()=>{N=!1}},[t]);const m=async N=>{c({kind:"uploading"});try{const T=await t.uploadMedia(N,{collection:n,entry:r,field:i});T.success&&T.url?(o(T.url),c({kind:"ready"})):c({kind:"error",message:T.error??"Upload failed"})}catch(T){if(J2(T)){c({kind:"unavailable"});return}c({kind:"error",message:T instanceof Error?T.message:"Upload failed"})}},g=u.kind==="ready"||u.kind==="error",y=e!==""&&/^(https?:\/\/|data:|\/)/.test(e),b=e===""?"":y?e:r!==void 0?t.mediaFileUrl(n,r,e):"",v=b!==""&&(e.startsWith("data:image/")||/\.(png|jpe?g|gif|webp|avif|svg|ico|bmp)(\?|#|$)/i.test(e));return I.jsxs("div",{className:"nua-cadmin-media",children:[v?I.jsx("img",{className:"nua-cadmin-img",src:b,alt:""}):null,I.jsxs("div",{className:"nua-cadmin-media-row",children:[I.jsx("input",{type:"text",className:"nua-cadmin-input",value:e,placeholder:"Image URL or path",onChange:N=>o(N.target.value)}),e!==""?I.jsx("button",{type:"button",className:"nua-cadmin-icon-btn","aria-label":"Clear",onClick:()=>o(""),children:"×"}):null]}),u.kind==="uploading"?I.jsx("div",{className:"nua-cadmin-field-loading",children:"Uploading…"}):null,u.kind==="unavailable"?I.jsx("div",{className:"nua-cadmin-media-hint",children:"Media uploads unavailable — paste a URL or path instead."}):null,u.kind==="error"?I.jsx("div",{className:"nua-cadmin-media-error",children:u.message}):null,g||u.kind==="probing"?I.jsxs(I.Fragment,{children:[I.jsx("input",{ref:h,type:"file",accept:s,className:"nua-cadmin-file-input",disabled:!g,onChange:N=>{const T=N.target.files?.[0];T&&m(T),N.target.value=""}}),I.jsx("button",{type:"button",className:"nua-cadmin-add-btn",disabled:!g,onClick:()=>h.current?.click(),children:"Upload file"})]}):null]})}const VG=[],FG={url:"url",email:"email",tel:"tel"},PG={date:"date",datetime:"datetime-local",time:"time",month:"month"};function jG({field:t,value:e,onChange:n}){const r=t.hints;return I.jsx("input",{type:FG[t.type]??"text",className:"nua-cadmin-input",value:Bs(e),placeholder:r?.placeholder,maxLength:r?.maxLength,minLength:r?.minLength,onChange:i=>n(Xb(t.type,i.target.value))})}function $G({value:t,rows:e,placeholder:n,maxLength:r,onChange:i}){const s=le.useRef(null);return le.useEffect(()=>{const o=s.current;o&&(o.style.height="auto",o.style.height=`${o.scrollHeight}px`)},[t]),I.jsx("textarea",{ref:s,className:"nua-cadmin-textarea nua-cadmin-textarea-autosize",value:t,rows:e,placeholder:n,maxLength:r,onChange:o=>i(o.target.value)})}function UG({field:t,value:e,onChange:n}){return I.jsx($G,{value:Bs(e),rows:t.hints?.rows??4,placeholder:t.hints?.placeholder,maxLength:t.hints?.maxLength,onChange:n})}function JG({value:t,onChange:e,ctx:n}){const r=le.useMemo(()=>({collection:n.collection,entry:n.slug}),[n.collection,n.slug]),[i,s]=le.useState([]);return le.useEffect(()=>{let o=!0;return n.client.getConfig().then(u=>{o&&s(u.listStyles??[])},()=>{o&&s([])}),()=>{o=!1}},[n.client]),I.jsx(g_,{value:Bs(t),onChange:e,components:VG,listStyles:i,media:n.client,mediaContext:r})}function HG({field:t,value:e,onChange:n}){return I.jsx("input",{type:"number",className:"nua-cadmin-input",value:Bs(e),min:t.hints?.min,max:t.hints?.max,step:t.hints?.step,placeholder:t.hints?.placeholder,onChange:r=>n(Xb("number",r.target.value))})}function qG({value:t,onChange:e}){return I.jsx("input",{type:"number",className:"nua-cadmin-input",value:Bs(t),min:1e3,max:9999,step:1,onChange:n=>e(Xb("year",n.target.value))})}function KG({field:t,value:e,onChange:n}){return I.jsx("input",{type:PG[t.type]??"date",className:"nua-cadmin-input",value:Bs(e),onChange:r=>n(r.target.value)})}function GG({field:t,value:e,onChange:n}){const r=_4(e),i=t.role==="publish-toggle";return I.jsxs("button",{type:"button",className:`nua-cadmin-toggle${r?" nua-cadmin-toggle-on":""}${i?" nua-cadmin-toggle-publish":""}`,role:"switch","aria-checked":r,onClick:()=>n(!r),children:[I.jsx("span",{className:"nua-cadmin-toggle-knob"}),I.jsx("span",{className:"nua-cadmin-toggle-label",children:r?"On":"Off"})]})}function YG({field:t,value:e,onChange:n}){const r=t.options??[],i=Bs(e);return I.jsxs("select",{className:"nua-cadmin-input",value:i,onChange:s=>n(s.target.value),children:[t.required?null:I.jsx("option",{value:"",children:"— none —"}),r.map(s=>I.jsx("option",{value:s,children:s},s)),i!==""&&!r.includes(i)?I.jsxs("option",{value:i,children:[i," (current)"]}):null]})}function WG({field:t,value:e,onChange:n,ctx:r}){const i=t.collection,[s,o]=le.useState(null),[u,c]=le.useState(!1),h=Bs(e);return le.useEffect(()=>{if(!i)return;let m=!0;return r.client.getEntries(i,{fields:"slug,title",draft:"all",limit:200}).then(g=>{m&&o(g.entries.map(y=>y.slug))},()=>{m&&c(!0)}),()=>{m=!1}},[r.client,i]),!i||u?I.jsx("input",{type:"text",className:"nua-cadmin-input",value:h,placeholder:"entry slug",onChange:m=>n(m.target.value)}):s===null?I.jsxs("div",{className:"nua-cadmin-field-loading",children:["Loading ",i,"…"]}):I.jsxs("select",{className:"nua-cadmin-input",value:h,onChange:m=>n(m.target.value),children:[I.jsx("option",{value:"",children:"— none —"}),s.map(m=>I.jsx("option",{value:m,children:m},m)),h!==""&&!s.includes(h)?I.jsxs("option",{value:h,children:[h," (current)"]}):null]})}function XG({field:t,value:e,onChange:n,ctx:r}){const i=z4(e),s=t.itemType??"text",o={name:t.name,type:s,required:!1,fields:t.fields,options:t.options,collection:t.collection},u=le.useCallback((m,g)=>{const y=i.slice();y[m]=g,n(y)},[i,n]),c=le.useCallback(m=>{n(i.filter((g,y)=>y!==m))},[i,n]),h=le.useCallback(()=>{n([...i,ST(s)])},[i,s,n]);return I.jsxs("div",{className:"nua-cadmin-array",children:[i.length===0?I.jsx("div",{className:"nua-cadmin-field-empty",children:"No items."}):null,i.map((m,g)=>I.jsxs("div",{className:"nua-cadmin-array-item",children:[I.jsx("div",{className:"nua-cadmin-array-item-body",children:I.jsx(Wg,{field:o,value:m,onChange:y=>u(g,y),ctx:r})}),I.jsx("button",{type:"button",className:"nua-cadmin-icon-btn","aria-label":"Remove item",onClick:()=>c(g),children:"×"})]},g)),I.jsx("button",{type:"button",className:"nua-cadmin-add-btn",onClick:h,children:"+ Add item"})]})}function QG({field:t,value:e,onChange:n,ctx:r}){const i=L4(e),s=t.fields??[],o=le.useCallback((u,c)=>{n({...i,[u]:c})},[i,n]);return s.length===0?I.jsx("div",{className:"nua-cadmin-field-empty",children:"No nested fields."}):I.jsx("div",{className:"nua-cadmin-object",children:s.map(u=>I.jsxs("div",{className:"nua-cadmin-object-field",children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:u.name}),I.jsx("span",{className:"nua-cadmin-field-type",children:u.type})]}),I.jsx(Wg,{field:u,value:i[u.name],onChange:c=>o(u.name,c),ctx:r})]},u.name))})}function Wg({field:t,value:e,onChange:n,ctx:r}){switch(t.type){case"text":case"url":case"email":case"tel":case"color":return I.jsx(jG,{field:t,value:e,onChange:n});case"textarea":return I.jsx(UG,{field:t,value:e,onChange:n});case"markdown":return I.jsx(JG,{value:e,onChange:n,ctx:r});case"number":return I.jsx(HG,{field:t,value:e,onChange:n});case"year":return I.jsx(qG,{value:e,onChange:n});case"date":case"datetime":case"time":case"month":return I.jsx(KG,{field:t,value:e,onChange:n});case"boolean":return I.jsx(GG,{field:t,value:e,onChange:n});case"select":return I.jsx(YG,{field:t,value:e,onChange:n});case"image":case"file":return I.jsx(BG,{client:r.client,value:Bs(e),collection:r.collection,entry:r.slug,field:t.name,accept:t.hints?.accept,onChange:i=>n(i)});case"reference":return I.jsx(WG,{field:t,value:e,onChange:n,ctx:r});case"array":return I.jsx(XG,{field:t,value:e,onChange:n,ctx:r});case"object":return I.jsx(QG,{field:t,value:e,onChange:n,ctx:r})}}function ZG(t){return t.filter(e=>!e.hidden)}function eY({client:t,definition:e,collection:n,onCreated:r,onCancel:i}){const s=le.useMemo(()=>e?.fields??[],[e]),[o,u]=le.useState(""),[c,h]=le.useState(()=>D4(s)),[m,g]=le.useState(!1),[y,b]=le.useState(null),v=le.useMemo(()=>({client:t,collection:n}),[t,n]),N=le.useCallback((j,P)=>{h(J=>kT(J,j,P))},[]),T=le.useCallback(async()=>{const j=o.trim();if(j===""){b("A slug is required.");return}g(!0),b(null);try{const P=await t.createEntry(n,{slug:j,frontmatter:c.frontmatter,body:c.body,fileExtension:e?.fileExtension});P.success?r(j):b(P.error??"Could not create the entry.")}catch(P){b(P instanceof vi?P.message:"Could not create the entry.")}finally{g(!1)}},[t,n,e,c,o,r]),M=e?.type==="data";return I.jsxs("div",{className:"nua-cadmin-editor",children:[I.jsxs("div",{className:"nua-cadmin-field",children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:"slug"}),I.jsx("span",{className:"nua-cadmin-field-type",children:"text · required"})]}),I.jsx("input",{type:"text",className:"nua-cadmin-input",value:o,placeholder:"my-new-entry",onChange:j=>u(j.target.value)})]}),ZG(s).map(j=>I.jsxs("div",{className:`nua-cadmin-field${j.role?` nua-cadmin-field-${j.role}`:""}`,children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:j.name}),I.jsxs("span",{className:"nua-cadmin-field-type",children:[j.type,j.required?" · required":""]})]}),I.jsx(Wg,{field:j,value:c.frontmatter[j.name],onChange:P=>N(j.name,P),ctx:v})]},j.name)),M?null:I.jsxs("div",{className:"nua-cadmin-field",children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:"Body"}),I.jsx("span",{className:"nua-cadmin-field-type",children:"markdown"})]}),I.jsx("textarea",{className:"nua-cadmin-body-editor",value:c.body,rows:10,onChange:j=>h(P=>({...P,body:j.target.value}))})]}),y?I.jsx("div",{className:"nua-cadmin-media-error",children:y}):null,I.jsxs("div",{className:"nua-cadmin-editor-toolbar",children:[I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",disabled:m,onClick:i,children:"Cancel"}),I.jsx("span",{className:"nua-cadmin-spacer"}),I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",disabled:m,onClick:()=>{T()},children:m?"Creating…":"Create entry"})]})]})}const tY=700,nY=4,rY=t=>t.label??t.name,iY=t=>{const e=t.replace(/[_-]+/g," ").trim();return e.charAt(0).toUpperCase()+e.slice(1)},gT=t=>t.role==="publish-toggle"?0:t.role==="publish-date"?1:2;function sY(t){return t.map((e,n)=>[e,n]).sort((e,n)=>(e[0].order??0)-(n[0].order??0)||e[1]-n[1]).map(([e])=>e)}function aY(t){const e=[],n=new Map,r=[];for(const i of t)if(i.type==="object"||i.type==="array")r.push({title:i.label??iY(i.name),fields:[i],collapsed:!0});else{const s=i.group??"";let o=n.get(s);o||(o={title:i.group,fields:[]},n.set(s,o),e.push(o)),o.fields.push(i)}return[...e,...r]}function oY(t,e){const n=sY(e.filter(g=>!g.hidden)),r=n.filter(g=>g.position==="header"),i=new Map(n.map(g=>[g.name,g])),s=t?.layout,o=[],u=new Set;for(const g of s?.sidebar??[]){const y=i.get(g);y&&y.position!=="header"&&!u.has(g)&&(o.push(y),u.add(g))}for(const g of n)g.position==="header"||u.has(g.name)||(g.position==="sidebar"||g.role)&&(o.push(g),u.add(g.name));o.sort((g,y)=>gT(g)-gT(y));const c=n.filter(g=>g.position!=="header"&&!u.has(g.name));let h;if(s?.sections&&s.sections.length>0){const g=new Set;h=s.sections.map(b=>{const v=b.fields.map(N=>i.get(N)).filter(N=>N!==void 0&&c.includes(N));for(const N of v)g.add(N.name);return{title:b.title,fields:v,collapsed:b.collapsed}}).filter(b=>b.fields.length>0);const y=c.filter(b=>!g.has(b.name));y.length>0&&h.push({title:"Other",fields:y})}else h=aY(c);const m=s?.display??(h.length>nY?"tabs":"sections");return{header:r,sidebar:o,sections:h,display:m}}function lY({field:t,draft:e,onField:n,ctx:r}){return I.jsxs("div",{className:`nua-cadmin-field${t.width==="half"?" nua-cadmin-field-half":""}${t.role?` nua-cadmin-field-${t.role}`:""}`,children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:rY(t)}),I.jsxs("span",{className:"nua-cadmin-field-type",children:[t.type,t.required?" · required":""]})]}),t.help?I.jsx("div",{className:"nua-cadmin-field-help",children:t.help}):null,I.jsx(Wg,{field:t,value:e.frontmatter[t.name],onChange:i=>n(t.name,i),ctx:r})]})}function oh({fields:t,draft:e,onField:n,ctx:r}){return I.jsx("div",{className:"nua-cadmin-field-grid",children:t.map(i=>I.jsx(lY,{field:i,draft:e,onField:n,ctx:r},i.name))})}function uY({sections:t,display:e,draft:n,onField:r,ctx:i}){const[s,o]=le.useState(0);if(e==="tabs"){const u=t[Math.min(s,t.length-1)];return I.jsxs("div",{className:"nua-cadmin-tabs",children:[I.jsx("div",{className:"nua-cadmin-tabbar",role:"tablist",children:t.map((c,h)=>I.jsx("button",{type:"button",role:"tab","aria-selected":h===s,className:`nua-cadmin-tab${h===s?" is-active":""}`,onClick:()=>o(h),children:c.title??"General"},c.title??`section-${h}`))}),u?I.jsx(oh,{fields:u.fields,draft:n,onField:r,ctx:i}):null]})}return I.jsx(I.Fragment,{children:t.map((u,c)=>u.title===void 0?I.jsx(oh,{fields:u.fields,draft:n,onField:r,ctx:i},`section-${c}`):I.jsxs("details",{className:"nua-cadmin-section",open:!u.collapsed,children:[I.jsx("summary",{className:"nua-cadmin-section-summary",children:u.title}),I.jsx("div",{className:"nua-cadmin-section-body",children:I.jsx(oh,{fields:u.fields,draft:n,onField:r,ctx:i})})]},u.title))})}function cY({onUseServer:t,onUseOurs:e,onDismiss:n}){return I.jsx("div",{className:"nua-cadmin-dialog-backdrop",role:"dialog","aria-modal":"true","aria-label":"Edit conflict",children:I.jsxs("div",{className:"nua-cadmin-dialog",children:[I.jsx("div",{className:"nua-cadmin-dialog-title",children:"This entry changed elsewhere"}),I.jsx("div",{className:"nua-cadmin-dialog-body",children:"Someone (or the agent) edited this entry after you opened it. Choose which version to keep."}),I.jsxs("div",{className:"nua-cadmin-dialog-actions",children:[I.jsx("button",{type:"button",className:"nua-cadmin-btn",onClick:t,children:"Use server version"}),I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",onClick:e,children:"Keep my changes"}),I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",onClick:n,children:"Keep editing"})]})]})})}function fY({status:t}){switch(t.kind){case"saving":return I.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-saving",children:"Saving…"});case"saved":return I.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-saved",children:"Saved"});case"conflict":return I.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-conflict",children:"Conflict"});case"error":return I.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-error",children:t.message});default:return null}}function hY({client:t,definition:e,collection:n,slug:r,onDeleted:i,onRenamed:s}){const o=le.useMemo(()=>e?.fields??[],[e]),u=e?.fileExtension==="mdx",[c,h]=le.useState(null),[m,g]=le.useState(null),[y,b]=le.useState({kind:"idle"}),[v,N]=le.useState([]),[T,M]=le.useState([]),j=le.useRef(void 0),P=le.useRef(null);P.current=c;const J=le.useRef(null),L=le.useMemo(()=>({client:t,collection:n,slug:r}),[t,n,r]),C=le.useMemo(()=>({collection:n,entry:r}),[n,r]);le.useEffect(()=>{let D=!0;return j.current=void 0,h(null),g(null),b({kind:"idle"}),t.getEntry(n,r).then(F=>{D&&h(R4(F,o))},F=>{D&&g(F instanceof Error?F:new Error(String(F)))}),()=>{D=!1,J.current&&clearTimeout(J.current)}},[t,n,r,o]),le.useEffect(()=>{if(!u)return;let D=!0;return t.getComponents().then(F=>{D&&N(F)},()=>{D&&N([])}),()=>{D=!1}},[t,u]),le.useEffect(()=>{if(!u)return;let D=!0;return t.getConfig().then(F=>{D&&M(F.listStyles??[])},()=>{D&&M([])}),()=>{D=!1}},[t,u]);const z=le.useCallback(async(D,F)=>{b({kind:"saving"});try{const Q=await t.updateEntry(n,r,{frontmatter:D.frontmatter,body:D.body,baseHash:F});if(Q.status==="conflict"){b({kind:"conflict",conflict:Q.conflict});return}Q.result.sourceHash!==void 0&&(j.current=Q.result.sourceHash),b({kind:"saved"})}catch(Q){b({kind:"error",message:Q instanceof vi?Q.message:"Save failed"})}},[t,n,r]),q=le.useCallback(D=>{J.current&&clearTimeout(J.current),J.current=setTimeout(()=>{z(D,j.current)},tY)},[z]),ie=le.useCallback((D,F)=>{h(Q=>{if(!Q)return Q;const V=kT(Q,D,F);return q(V),V})},[q]),K=le.useCallback(D=>{h(F=>{if(!F)return F;const Q={...F,body:D};return q(Q),Q})},[q]),pe=le.useCallback(()=>{if(y.kind!=="conflict")return;const D=I4(y.conflict.serverFrontmatter,y.conflict.serverBody,o);j.current=y.conflict.serverHash,h(D),b({kind:"saved"})},[y,o]),fe=le.useCallback(()=>{if(y.kind!=="conflict")return;const D=P.current;D&&z(D,y.conflict.serverHash)},[y,z]),Se=le.useCallback(()=>{y.kind==="conflict"&&b({kind:"idle"})},[y]),_e=le.useCallback(async()=>{if(!(typeof window<"u"&&!window.confirm(`Delete entry "${r}"? This cannot be undone.`)))try{await t.deleteEntry(n,r),i()}catch(D){b({kind:"error",message:D instanceof vi?D.message:"Delete failed"})}},[t,n,r,i]),Re=le.useCallback(async()=>{if(typeof window>"u")return;const D=window.prompt("Rename entry to (new slug):",r);if(!(D===null||D.trim()===""||D===r))try{await t.renameEntry(n,r,D.trim()),s(D.trim())}catch(F){b({kind:"error",message:F instanceof vi?F.message:"Rename failed"})}},[t,n,r,s]);if(m)return I.jsxs("div",{className:"nua-cadmin-error",children:[I.jsx("div",{className:"nua-cadmin-error-title",children:"Could not load entry"}),I.jsx("div",{children:m.message})]});if(!c)return I.jsxs("div",{className:"nua-cadmin-state",children:[I.jsx("div",{className:"nua-cadmin-spinner"}),I.jsx("div",{children:"Loading entry…"})]});const{header:X,sidebar:oe,sections:ke,display:ze}=oY(e,o);return I.jsxs("div",{className:"nua-cadmin-editor",children:[I.jsxs("div",{className:"nua-cadmin-editor-toolbar",children:[I.jsx(fY,{status:y}),I.jsx("span",{className:"nua-cadmin-spacer"}),I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",onClick:()=>{Re()},children:"Rename"}),I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-danger",onClick:()=>{_e()},children:"Delete"})]}),X.length>0?I.jsx("div",{className:"nua-cadmin-editor-header-fields",children:I.jsx(oh,{fields:X,draft:c,onField:ie,ctx:L})}):null,I.jsxs("div",{className:"nua-cadmin-editor-grid",children:[I.jsxs("div",{className:"nua-cadmin-editor-main",children:[I.jsx(uY,{sections:ke,display:ze,draft:c,onField:ie,ctx:L}),e?.type!=="data"?I.jsxs("div",{className:"nua-cadmin-field",children:[I.jsxs("div",{className:"nua-cadmin-field-label",children:[I.jsx("span",{children:"Body"}),I.jsx("span",{className:"nua-cadmin-field-type",children:u?"mdx":"markdown"})]}),u?I.jsx(g_,{value:c.body,onChange:K,components:v,listStyles:T,media:t,mediaContext:C}):I.jsx("textarea",{className:"nua-cadmin-body-editor",value:c.body,rows:16,onChange:D=>K(D.target.value)})]}):null]}),oe.length>0?I.jsx("div",{className:"nua-cadmin-editor-sidebar",children:I.jsx(oh,{fields:oe,draft:c,onField:ie,ctx:L})}):null]}),y.kind==="conflict"?I.jsx(cY,{onUseServer:pe,onUseOurs:fe,onDismiss:Se}):null]})}function yT(t){const e=t.replace(/^#\/?/,"").split("/").filter(Boolean);if(e[0]!=="c"||e[1]===void 0)return{view:"list"};const n=decodeURIComponent(e[1]);return e[2]==="new"?{view:"create",collection:n}:e[2]==="e"&&e[3]!==void 0?{view:"detail",collection:n,slug:decodeURIComponent(e[3])}:{view:"entries",collection:n}}function pY(t){switch(t.view){case"list":return"#/";case"entries":return`#/c/${encodeURIComponent(t.collection)}`;case"create":return`#/c/${encodeURIComponent(t.collection)}/new`;case"detail":return`#/c/${encodeURIComponent(t.collection)}/e/${encodeURIComponent(t.slug)}`}}function dY(t,e){const[n,r]=le.useState({data:null,error:null,loading:!0}),[i,s]=le.useState(0),o=le.useRef(t);o.current=t;const u=[...e,i];le.useEffect(()=>{let h=!0;return r({data:null,error:null,loading:!0}),o.current().then(m=>{h&&r({data:m,error:null,loading:!1})},m=>{h&&r({data:null,error:m instanceof Error?m:new Error(String(m)),loading:!1})}),()=>{h=!1}},u);const c=le.useCallback(()=>s(h=>h+1),[]);return{...n,reload:c}}function mY({label:t}){return I.jsxs("div",{className:"nua-cadmin-state",children:[I.jsx("div",{className:"nua-cadmin-spinner"}),I.jsx("div",{children:t})]})}function y_({error:t,onRetry:e}){const n=t instanceof vi&&t.isUnauthorized?"Session expired":t instanceof vi&&t.isForbidden?"No access":"Something went wrong";return I.jsxs("div",{className:"nua-cadmin-error",children:[I.jsx("div",{className:"nua-cadmin-error-title",children:n}),I.jsx("div",{children:t.message}),e?I.jsx("button",{type:"button",className:"nua-cadmin-retry",onClick:e,children:"Try again"}):null]})}function x_({label:t}){return I.jsx("div",{className:"nua-cadmin-state",children:t})}function gY({collections:t,loading:e,error:n,activeCollection:r,onSelect:i,onReload:s,onClose:o}){const u=new Map;for(const m of t){if(!m.parentCollection)continue;const g=u.get(m.parentCollection)??[];g.push(m),u.set(m.parentCollection,g)}const c=t.filter(m=>!m.parentCollection),h=(m,g)=>I.jsxs("button",{type:"button",className:`nua-cadmin-nav-item${m.name===r?" is-active":""}`,style:g>0?{paddingLeft:12+g*14}:void 0,onClick:()=>i(m.name),title:m.name,children:[I.jsx("span",{className:"nua-cadmin-nav-label",children:m.label||m.name}),I.jsx("span",{className:"nua-cadmin-nav-count",children:m.entryCount})]},m.name);return I.jsxs("aside",{className:"nua-cadmin-sidebar",children:[I.jsxs("div",{className:"nua-cadmin-sidebar-head",children:[I.jsx("span",{className:"nua-cadmin-brand",children:"Collections"}),o?I.jsx("button",{type:"button",className:"nua-cadmin-close","aria-label":"Close",onClick:o,children:"×"}):null]}),I.jsxs("nav",{className:"nua-cadmin-nav",children:[e?I.jsx("div",{className:"nua-cadmin-nav-state",children:"Loading…"}):null,n?I.jsx("button",{type:"button",className:"nua-cadmin-nav-state nua-cadmin-nav-error",onClick:s,children:"Failed to load — retry"}):null,!e&&!n&&t.length===0?I.jsx("div",{className:"nua-cadmin-nav-state",children:"No content types"}):null,!e&&!n?c.flatMap(m=>[h(m,0),...(u.get(m.name)??[]).map(g=>h(g,1))]):null]})]})}const yY=50,xY="slug,title,draft,pathname";function bY({client:t,collection:e,onOpen:n,onCreate:r}){const[i,s]=le.useState([]),[o,u]=le.useState(void 0),[c,h]=le.useState(!1),[m,g]=le.useState(null),[y,b]=le.useState(!0),[v,N]=le.useState(!1),T=le.useCallback(async(j,P)=>{P?N(!0):b(!0),g(null);try{const J=await t.getEntries(e,{fields:xY,draft:"all",limit:yY,cursor:j});s(L=>P?[...L,...J.entries]:J.entries),u(J.cursor),h(J.hasMore)}catch(J){g(J instanceof Error?J:new Error(String(J)))}finally{b(!1),N(!1)}},[t,e]);if(le.useEffect(()=>{s([]),u(void 0),h(!1),T(void 0,!1)},[T]),y)return I.jsx(mY,{label:"Loading entries…"});if(m)return I.jsx(y_,{error:m,onRetry:()=>{T(void 0,!1)}});const M=I.jsx("div",{className:"nua-cadmin-entries-toolbar",children:I.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",onClick:r,children:"+ New entry"})});return i.length===0?I.jsxs("div",{children:[M,I.jsx(x_,{label:"This collection has no entries."})]}):I.jsxs("div",{children:[M,I.jsxs("table",{className:"nua-cadmin-table",children:[I.jsx("thead",{children:I.jsxs("tr",{children:[I.jsx("th",{children:"Slug"}),I.jsx("th",{children:"Title"}),I.jsx("th",{children:"Draft"}),I.jsx("th",{children:"Pathname"})]})}),I.jsx("tbody",{children:i.map(j=>I.jsxs("tr",{className:"nua-cadmin-row",onClick:()=>n(j.slug),children:[I.jsx("td",{className:"nua-cadmin-cell-mono",children:j.slug}),I.jsx("td",{children:j.title??I.jsx("span",{className:"nua-cadmin-field-empty",children:"—"})}),I.jsx("td",{children:j.draft?I.jsx("span",{className:"nua-cadmin-badge nua-cadmin-badge-draft",children:"draft"}):""}),I.jsx("td",{className:"nua-cadmin-cell-mono",children:j.pathname??"—"})]},j.slug))})]}),c?I.jsx("button",{type:"button",className:"nua-cadmin-load-more",disabled:v,onClick:()=>{T(o,!0)},children:v?"Loading…":"Load more"}):null]})}function SY({apiBase:t,onClose:e}){const n=le.useMemo(()=>T4(t),[t]),[r,i]=le.useState(()=>typeof window<"u"?yT(window.location.hash):{view:"list"});le.useEffect(()=>{const v=()=>i(yT(window.location.hash));return window.addEventListener("hashchange",v),v(),()=>window.removeEventListener("hashchange",v)},[]);const s=le.useCallback(v=>{const N=pY(v);typeof window<"u"&&window.location.hash!==N?window.location.hash=N:i(v)},[]),o=dY(()=>n.getCollections(),[n]),u=o.data??[],c=r.view!=="list"?r.collection:void 0,h=c?u.find(v=>v.name===c):void 0,m=h?h.label||h.name:c??"",g=le.useCallback(v=>s({view:"entries",collection:v}),[s]),y=le.useCallback((v,N)=>s({view:"detail",collection:v,slug:N}),[s]),b=le.useCallback(v=>s({view:"create",collection:v}),[s]);return I.jsxs("div",{className:"nua-cadmin",children:[I.jsx(gY,{collections:u,loading:o.loading,error:o.error,activeCollection:c,onSelect:g,onReload:o.reload,onClose:e}),I.jsxs("main",{className:"nua-cadmin-main",children:[I.jsxs("div",{className:"nua-cadmin-header",children:[r.view==="detail"||r.view==="create"?I.jsxs("button",{type:"button",className:"nua-cadmin-back",onClick:()=>g(r.collection),children:["← ",m]}):null,I.jsxs("h2",{className:"nua-cadmin-title",children:[r.view==="list"?"Content":m,r.view==="detail"?I.jsxs("span",{className:"nua-cadmin-crumb",children:["/ ",r.slug]}):null,r.view==="create"?I.jsx("span",{className:"nua-cadmin-crumb",children:"/ new entry"}):null]}),I.jsx("span",{className:"nua-cadmin-spacer"})]}),I.jsxs("div",{className:"nua-cadmin-body",children:[r.view==="list"?o.error?I.jsx(y_,{error:o.error,onRetry:o.reload}):I.jsx(x_,{label:"Pick a content type from the left to browse its entries."}):null,r.view==="entries"?I.jsx(bY,{client:n,collection:r.collection,onOpen:v=>y(r.collection,v),onCreate:()=>b(r.collection)}):null,r.view==="detail"?I.jsx(hY,{client:n,definition:h,collection:r.collection,slug:r.slug,onDeleted:()=>g(r.collection),onRenamed:v=>y(r.collection,v)},`${r.collection}/${r.slug}`):null,r.view==="create"?I.jsx(eY,{client:n,definition:h,collection:r.collection,onCreated:v=>y(r.collection,v),onCancel:()=>g(r.collection)}):null]})]})]})}const b_=document.getElementById("nua-studio-root");if(!b_)throw new Error("[cms-studio] #nua-studio-root container is missing");m_.createRoot(b_).render(I.jsx(le.StrictMode,{children:I.jsx(SY,{apiBase:"/cms/v1"})}));