@nuasite/cms-studio 0.62.0 → 0.63.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,130 @@
1
+ var FE=t=>{throw TypeError(t)};var VE=(t,e,n)=>e.has(t)||FE("Cannot "+n);var rt=(t,e,n)=>(VE(t,e,"read from private field"),n?n.call(t):e.get(t)),Gt=(t,e,n)=>e.has(t)?FE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),gu=(t,e,n,r)=>(VE(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 a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).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 DM(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nx={exports:{}},of={};var PE;function lL(){if(PE)return of;PE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var a=null;if(s!==void 0&&(a=""+s),i.key!==void 0&&(a=""+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:a,ref:i!==void 0?i:null,props:s}}return of.Fragment=e,of.jsx=n,of.jsxs=n,of}var jE;function uL(){return jE||(jE=1,Nx.exports=lL()),Nx.exports}var O=uL();function cL(t){return t==null||t===""}function fL(t,e=()=>new Date){if(t.defaultValue!==void 0)return t.defaultValue;switch(t.type){case"boolean":return!1;case"number":return 0;case"array":return[];case"date":return e().toISOString().split("T")[0];default:return""}}function IM(t){if(t.defaultValue!==void 0)return t.defaultValue;switch(t.type){case"boolean":return!1;case"array":return[];case"object":return{};case"date":case"datetime":case"time":case"month":case"number":case"year":case"select":case"reference":return;default:return""}}function hL(t,e){const n={};for(const r of t)!r.required||r.hidden||(n[r.name]=fL(r,e));return n}function pL(t){return t.derivedDeclared===!0||t.layout?.derivedFrom!==void 0}const dL="slug",mL=new Set(["array","object","reference","image","file","video","boolean","number","date","datetime"]);function gL(t){return t.name===dL&&(t.type===void 0||!mL.has(t.type))}function yL(t,e,n){if(n==="")return e;const r=t.find(gL);return!r||pL(r)||!cL(e[r.name])?e:{...e,[r.name]:n}}const xL="en";function bL(t){let e=[];try{t!==void 0&&(e=Intl.Collator.supportedLocalesOf(t))}catch{}return new Intl.Collator(e.length>0?e:xL,{numeric:!0})}function SL(t,e){const n=bL(e.locale),r=t.filter(g=>!g.hidden).sort((g,y)=>{const x=g.order??Number.POSITIVE_INFINITY,k=y.order??Number.POSITIVE_INFINITY;return x!==k?x<k?-1:1:n.compare(g.label,y.label)||(g.name<y.name?-1:g.name>y.name?1:0)}),i=new Map(r.map(g=>[g.name,g])),s=g=>g.parentCollection===void 0?void 0:i.get(g.parentCollection),a=new Map,u=[],c=new Map,h=[];for(const g of r){const y=s(g);if(y&&!s(y)){h.push([y,g]);continue}const x={collection:g,children:[]};if(a.set(g.name,x),!g.group){u.push(x);continue}const k=c.get(g.group);k?k.push(x):c.set(g.group,[x])}for(const[g,y]of h)a.get(g.name)?.children.push(y);const d=u.length>0?[{items:u}]:[];for(const[g,y]of c)d.push({group:g,items:y});return d}function vL(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^\w\s\-/]/g,"").replace(/[\s_]+/g,"-").replace(/^[-/]+|[-/]+$/g,"")}const $E=new Set(["image/svg+xml","image/x-icon","image/vnd.microsoft.icon"]);function kL(t){const e=t.indexOf(";");return(e===-1?t:t.slice(0,e)).trim().toLowerCase()}function CL(t,e){if(e==="all")return!0;const n=kL(t);return e==="photo"?n.startsWith("image/")&&!$E.has(n):e==="graphic"?$E.has(n):e==="video"?n.startsWith("video/"):n==="application/pdf"}function wL(t,e){return e==="all"?t:t.filter(n=>CL(n.contentType,e))}const _M="video/mp4,video/webm",EL=409;class Di 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 JE(t){return Nh(t)&&typeof t.error=="string"&&typeof t.code=="string"}function Nh(t){return typeof t=="object"&&t!==null}function AL(t){return Nh(t)?t.code==="conflict"&&typeof t.serverHash=="string"&&Nh(t.serverFrontmatter):!1}const NL=["not_found","conflict","validation","parse_error","io_error","unsupported","unauthorized"];function TL(t){return NL.includes(t)}function UE(t){return t instanceof Di&&(t.status===501||t.code==="unsupported")}function ML(t){const e=t.endsWith("/")?t.slice(0,-1):t;async function n(h){const d=await fetch(`${e}${h}`,{method:"GET",credentials:"include",headers:{accept:"application/json"}});if(!d.ok)throw await r(d);return await d.json()}async function r(h){const d=await h.json().catch(()=>null);return s(h.status,d)}function i(h,d){if(JE(h))return h.error;if(Nh(h)){const g=h.error;if(Nh(g)&&typeof g.message=="string")return g.message}return d}function s(h,d){return h===403?new Di(403,"forbidden",i(d,"You do not have access to this project.")):JE(d)&&TL(d.code)?new Di(h,d.code,d.error):h===401?new Di(401,"unauthorized","Your session has expired. Please reload."):new Di(h,"unknown",i(d,`Request failed (${h})`))}function a(h,d){const g={method:h,credentials:"include",headers:{accept:"application/json"}};return d!==void 0&&(g.body=JSON.stringify(d),g.headers={accept:"application/json","content-type":"application/json"}),g}async function u(h,d,g){const y=await fetch(`${e}${h}`,a(d,g));if(!y.ok)throw await r(y);return await y.json()}function c(h,d){return`/collections/${encodeURIComponent(h)}/entries/${encodeURIComponent(d)}`}return{getProject(){return n("/project")},getConfig(){return n("/config")},getCollections(){return n("/collections")},getComponents(){return n("/components")},getEntries(h,d={}){const g=new URLSearchParams;d.fields!==void 0&&g.set("fields",d.fields),d.draft!==void 0&&g.set("draft",d.draft),d.cursor!==void 0&&g.set("cursor",d.cursor),d.limit!==void 0&&g.set("limit",String(d.limit));const y=g.toString(),x=y===""?"":`?${y}`;return n(`/collections/${encodeURIComponent(h)}/entries${x}`)},getEntry(h,d){return n(c(h,d))},async updateEntry(h,d,g){const y=await fetch(`${e}${c(h,d)}`,a("PATCH",g));if(y.status===EL){const k=await y.json().catch(()=>null);if(AL(k))return{status:"conflict",conflict:k};throw s(y.status,k)}if(!y.ok)throw await r(y);return{status:"ok",result:await y.json()}},createEntry(h,d){return u(`/collections/${encodeURIComponent(h)}/entries`,"POST",d)},deleteEntry(h,d){return u(c(h,d),"DELETE")},renameEntry(h,d,g){return u(`${c(h,d)}/rename`,"POST",{to:g})},addArrayItem(h,d,g,y,x){const k=x===void 0?{field:g,value:y}:{field:g,value:y,index:x};return u(`${c(h,d)}/array`,"POST",k)},removeArrayItem(h,d,g,y){return u(`${c(h,d)}/array`,"DELETE",{field:g,index:y})},listMedia(h={}){const d=new URLSearchParams;h.folder!==void 0&&d.set("folder",h.folder),h.cursor!==void 0&&d.set("cursor",h.cursor),h.limit!==void 0&&d.set("limit",String(h.limit)),h.type!==void 0&&h.type!=="all"&&d.set("type",h.type),h.includeProjectImages&&d.set("includeProjectImages","true");const g=d.toString();return n(`/media${g===""?"":`?${g}`}`)},async uploadMedia(h,d={}){const g=new URLSearchParams;d.collection!==void 0&&g.set("collection",d.collection),d.entry!==void 0&&g.set("entry",d.entry),d.field!==void 0&&g.set("field",d.field),d.folder!==void 0&&g.set("folder",d.folder);const y=g.toString(),x=new FormData;x.append("file",h);const k=await fetch(`${e}/media${y===""?"":`?${y}`}`,{method:"POST",credentials:"include",headers:{accept:"application/json"},body:x});if(!k.ok)throw await r(k);return await k.json()},mediaFileUrl(h,d,g){return`${e}${c(h,d)}/asset?path=${encodeURIComponent(g)}`},mediaAssetUrl(h){return`${e}/asset?path=${encodeURIComponent(h)}`},deleteMedia(h){return u(`/media/${encodeURIComponent(h)}`,"DELETE")},createFolder(h){return u("/media","POST",{folder:h})},updateMediaAnnotation(h,d){return u(`/media/${encodeURIComponent(h)}`,"PATCH",{annotation:d})}}}const OL=1e3;async function RL(t,e,n,r,i){const s=[];let a,u=!0;for(;u;){const c=await t.getEntries(e,{fields:n,draft:"all",limit:OL,cursor:a});u=c.hasMore;const h=Math.max(0,r-s.length),d=c.entries.length<=h?c.entries:c.entries.slice(0,h);s.push(...d);const g=s.length>=r;if(i?.(d,u&&!g),g)return{entries:s,truncated:u||c.entries.length>d.length};if(u){if(c.cursor===void 0)throw new Error("The CMS entries response is missing a pagination cursor.");a=c.cursor}}return{entries:s,truncated:!1}}function DL(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function zM(t,e){switch(t){case"boolean":return e==="true"||e==="1"||e.toLowerCase()==="yes";case"number":case"year":case"month":{const n=Number(e);return e.trim()===""||Number.isNaN(n)?e:n}case"date":case"datetime":case"time":return HE(e);case"array":case"object":return HE(e);default:return e}}function HE(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 IL(t,e){const n=new Map(e.map(i=>[i.name,i])),r={};for(const[i,s]of Object.entries(t.frontmatter)){const a=n.get(i);r[i]=a?zM(a.type,s.value):s.value}return{frontmatter:r,body:t.body}}function _L(t){const e={};for(const n of t)n.hidden||(e[n.name]=IM(n));return{frontmatter:e,body:""}}function zL(t){return IM({type:t})}function LL(t,e,n){const r=new Map(n.map(s=>[s.name,s])),i={};for(const[s,a]of Object.entries(t)){const u=r.get(s);i[s]=u&&typeof a=="string"?zM(u.type,a):a}return{frontmatter:i,body:e??""}}function cl(t,e){switch(t){case"boolean":return e==="true";case"number":{if(e.trim()==="")return;const n=Number(e);return Number.isNaN(n)?e:n}case"year":case"month":{if(e.trim()==="")return;const n=Number(e);return Number.isNaN(n)?e:n}case"date":case"datetime":case"time":return e.trim()===""?void 0:e;case"select":case"reference":return e===""?void 0:e;default:return e}}function to(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function BL(t,e){if(t==null||t==="")return"";if(typeof t=="string"){const h=t.trim().match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/);if(h){const[,d,g,y,x,k]=h;switch(e){case"datetime":return`${d}-${g}-${y}T${x??"00"}:${k??"00"}`;case"time":return x?`${x}:${k}`:"";case"month":return`${d}-${g}`;default:return`${d}-${g}-${y}`}}if(e==="time"){const d=t.trim().match(/^(\d{2}):(\d{2})/);if(d)return`${d[1]}:${d[2]}`}}const n=t instanceof Date?t:new Date(String(t));if(Number.isNaN(n.getTime()))return"";const r=h=>String(h).padStart(2,"0"),i=n.getFullYear(),s=r(n.getMonth()+1),a=r(n.getDate()),u=r(n.getHours()),c=r(n.getMinutes());switch(e){case"datetime":return`${i}-${s}-${a}T${u}:${c}`;case"time":return`${u}:${c}`;case"month":return`${i}-${s}`;default:return`${i}-${s}-${a}`}}function FL(t){return typeof t=="boolean"?t:typeof t=="string"?t==="true"||t==="1"||t.toLowerCase()==="yes":!!t}function VL(t){return Array.isArray(t)?t:[]}function PL(t){return DL(t)?t:{}}function LM(t,e,n){return{...t,frontmatter:{...t.frontmatter,[e]:n}}}function jL(t){return t==null||t===""}function BM(t,e){return t.filter(n=>n.required&&!n.hidden&&!n.derivedDeclared&&jL(e[n.name])).map(n=>n.name)}function FM(t){return t.length===1?`“${t[0]}” is required.`:`Required fields are empty: ${t.join(", ")}.`}function $L(t,e,n){let r;async function i(s,a){try{const u=await t.updateEntry(e,n,{frontmatter:s.frontmatter,body:s.body,baseHash:a});return u.status==="conflict"?{status:"conflict",conflict:u.conflict}:(u.result.sourceHash!==void 0&&(r=u.result.sourceHash),{status:"saved",result:u.result})}catch(u){return{status:"error",message:u instanceof Di?u.message:"Save failed",cause:u}}}return{get baseHash(){return r},save:s=>i(s,r),overwrite:(s,a)=>i(s,a.serverHash),adoptServer:(s,a)=>(r=s.serverHash,LL(s.serverFrontmatter,s.serverBody,a)),reset:()=>{r=void 0}}}const JL=4,UL=["title","name","heading","headline"];function HL(t){return t.toLowerCase().replace(/[_-]/g,"")}function qL(t){const e=t.filter(n=>n.type==="text"||n.type==="textarea");for(const n of UL){const r=e.find(i=>HL(i.name)===n);if(r)return r}}function VM(t){return t.label??t.name}function KL(t){const e=t.replace(/[_-]+/g," ").trim();return e.charAt(0).toUpperCase()+e.slice(1)}function qE(t){return t.role==="publish-toggle"?0:t.role==="publish-date"?1:2}function GL(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 YL(t){const e=[],n=new Map,r=[];for(const i of t)if(i.type==="object"||i.type==="array")r.push({title:i.label??KL(i.name),fields:[i],collapsed:!0});else{const s=i.group??"";let a=n.get(s);a||(a={title:i.group,fields:[]},n.set(s,a),e.push(a)),a.fields.push(i)}return[...e,...r]}function WL(t){const e=new Set;for(const n of t?.sections??[])for(const r of n.fields)e.add(r);return e}function XL(t,e){return new Set([...t?.sidebar??[],...e])}function PM(t,e){const n=GL(t.filter(k=>!k.hidden)),r=new Map(n.map(k=>[k.name,k])),i=WL(e),s=XL(e,i),a=qL(n),u=a&&!s.has(a.name)&&!a.positionDeclared&&a.position!=="header"?a:void 0,c=n.filter(k=>k!==u&&k.position==="header"),h=[],d=new Set;for(const k of e?.sidebar??[]){const w=r.get(k);w&&w!==u&&w.position!=="header"&&!d.has(k)&&(h.push(w),d.add(k))}for(const k of n)k===u||k.position==="header"||d.has(k.name)||i.has(k.name)||(k.position==="sidebar"||k.role!==void 0)&&(h.push(k),d.add(k.name));h.sort((k,w)=>qE(k)-qE(w));const g=n.filter(k=>k!==u&&k.position!=="header"&&!d.has(k.name));let y;if(e?.sections&&e.sections.length>0){const k=new Set;y=e.sections.map(N=>{const T=QL(N.fields,r,g,k);return{title:N.title,fields:T,collapsed:N.collapsed}}).filter(N=>N.fields.length>0);const w=g.filter(N=>!k.has(N.name));w.length>0&&y.push({title:"Other",fields:w})}else y=YL(g);const x=e?.display??(y.length>JL?"tabs":"sections");return{title:u,header:c,sidebar:h,sections:y,display:x}}function QL(t,e,n,r){const i=[];for(const s of t){const a=e.get(s);!a||r.has(s)||!n.includes(a)||(r.add(s),i.push(a))}return i}const ZL=/^(https?:)?\/\/|^data:/i,e5=/\.(png|jpe?g|gif|webp|avif|svg|ico|bmp)(\?|#|$)/i,t5=/\.(mp4|webm)(\?|#|$)/i;function n5(t,e,n,r){return e===""?"":ZL.test(e)?e:e.startsWith("/")?t.mediaAssetUrl(e):r===void 0?"":t.mediaFileUrl(n,r,e)}function r5(t){return t.startsWith("data:image/")||e5.test(t)}function i5(t){return t.startsWith("data:video/")||t5.test(t)}var Tx={exports:{}},Xe={};var KE;function s5(){if(KE)return Xe;KE=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"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function x(P){return P===null||typeof P!="object"?null:(P=y&&P[y]||P["@@iterator"],typeof P=="function"?P:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,N={};function T(P,te,z){this.props=P,this.context=te,this.refs=N,this.updater=z||k}T.prototype.isReactComponent={},T.prototype.setState=function(P,te){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,te,"setState")},T.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function V(){}V.prototype=T.prototype;function F(P,te,z){this.props=P,this.context=te,this.refs=N,this.updater=z||k}var K=F.prototype=new V;K.constructor=F,w(K,T.prototype),K.isPureReactComponent=!0;var L=Array.isArray;function C(){}var _={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function $(P,te,z){var xe=z.ref;return{$$typeof:t,type:P,key:te,ref:xe!==void 0?xe:null,props:z}}function H(P,te){return $(P.type,te,P.props)}function ue(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function ae(P){var te={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(z){return te[z]})}var Se=/\/+/g;function Ee(P,te){return typeof P=="object"&&P!==null&&P.key!=null?ae(""+P.key):te.toString(36)}function Y(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(C,C):(P.status="pending",P.then(function(te){P.status==="pending"&&(P.status="fulfilled",P.value=te)},function(te){P.status==="pending"&&(P.status="rejected",P.reason=te)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function X(P,te,z,xe,Te){var Ae=typeof P;(Ae==="undefined"||Ae==="boolean")&&(P=null);var qe=!1;if(P===null)qe=!0;else switch(Ae){case"bigint":case"string":case"number":qe=!0;break;case"object":switch(P.$$typeof){case t:case e:qe=!0;break;case d:return qe=P._init,X(qe(P._payload),te,z,xe,Te)}}if(qe)return Te=Te(P),qe=xe===""?"."+Ee(P,0):xe,L(Te)?(z="",qe!=null&&(z=qe.replace(Se,"$&/")+"/"),X(Te,te,z,"",function(Pt){return Pt})):Te!=null&&(ue(Te)&&(Te=H(Te,z+(Te.key==null||P&&P.key===Te.key?"":(""+Te.key).replace(Se,"$&/")+"/")+qe)),te.push(Te)),1;qe=0;var pt=xe===""?".":xe+":";if(L(P))for(var Ke=0;Ke<P.length;Ke++)xe=P[Ke],Ae=pt+Ee(xe,Ke),qe+=X(xe,te,z,Ae,Te);else if(Ke=x(P),typeof Ke=="function")for(P=Ke.call(P),Ke=0;!(xe=P.next()).done;)xe=xe.value,Ae=pt+Ee(xe,Ke++),qe+=X(xe,te,z,Ae,Te);else if(Ae==="object"){if(typeof P.then=="function")return X(Y(P),te,z,xe,Te);throw te=String(P),Error("Objects are not valid as a React child (found: "+(te==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":te)+"). If you meant to render a collection of children, use an array instead.")}return qe}function le(P,te,z){if(P==null)return P;var xe=[],Te=0;return X(P,xe,"","",function(Ae){return te.call(z,Ae,Te++)}),xe}function Ce(P){if(P._status===-1){var te=P._result;te=te(),te.then(function(z){(P._status===0||P._status===-1)&&(P._status=1,P._result=z)},function(z){(P._status===0||P._status===-1)&&(P._status=2,P._result=z)}),P._status===-1&&(P._status=0,P._result=te)}if(P._status===1)return P._result.default;throw P._result}var _e=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var te=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(te))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},j={map:le,forEach:function(P,te,z){le(P,function(){te.apply(this,arguments)},z)},count:function(P){var te=0;return le(P,function(){te++}),te},toArray:function(P){return le(P,function(te){return te})||[]},only:function(P){if(!ue(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Xe.Activity=g,Xe.Children=j,Xe.Component=T,Xe.Fragment=n,Xe.Profiler=i,Xe.PureComponent=F,Xe.StrictMode=r,Xe.Suspense=c,Xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_,Xe.__COMPILER_RUNTIME={__proto__:null,c:function(P){return _.H.useMemoCache(P)}},Xe.cache=function(P){return function(){return P.apply(null,arguments)}},Xe.cacheSignal=function(){return null},Xe.cloneElement=function(P,te,z){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var xe=w({},P.props),Te=P.key;if(te!=null)for(Ae in te.key!==void 0&&(Te=""+te.key),te)!J.call(te,Ae)||Ae==="key"||Ae==="__self"||Ae==="__source"||Ae==="ref"&&te.ref===void 0||(xe[Ae]=te[Ae]);var Ae=arguments.length-2;if(Ae===1)xe.children=z;else if(1<Ae){for(var qe=Array(Ae),pt=0;pt<Ae;pt++)qe[pt]=arguments[pt+2];xe.children=qe}return $(P.type,Te,xe)},Xe.createContext=function(P){return P={$$typeof:a,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:s,_context:P},P},Xe.createElement=function(P,te,z){var xe,Te={},Ae=null;if(te!=null)for(xe in te.key!==void 0&&(Ae=""+te.key),te)J.call(te,xe)&&xe!=="key"&&xe!=="__self"&&xe!=="__source"&&(Te[xe]=te[xe]);var qe=arguments.length-2;if(qe===1)Te.children=z;else if(1<qe){for(var pt=Array(qe),Ke=0;Ke<qe;Ke++)pt[Ke]=arguments[Ke+2];Te.children=pt}if(P&&P.defaultProps)for(xe in qe=P.defaultProps,qe)Te[xe]===void 0&&(Te[xe]=qe[xe]);return $(P,Ae,Te)},Xe.createRef=function(){return{current:null}},Xe.forwardRef=function(P){return{$$typeof:u,render:P}},Xe.isValidElement=ue,Xe.lazy=function(P){return{$$typeof:d,_payload:{_status:-1,_result:P},_init:Ce}},Xe.memo=function(P,te){return{$$typeof:h,type:P,compare:te===void 0?null:te}},Xe.startTransition=function(P){var te=_.T,z={};_.T=z;try{var xe=P(),Te=_.S;Te!==null&&Te(z,xe),typeof xe=="object"&&xe!==null&&typeof xe.then=="function"&&xe.then(C,_e)}catch(Ae){_e(Ae)}finally{te!==null&&z.types!==null&&(te.types=z.types),_.T=te}},Xe.unstable_useCacheRefresh=function(){return _.H.useCacheRefresh()},Xe.use=function(P){return _.H.use(P)},Xe.useActionState=function(P,te,z){return _.H.useActionState(P,te,z)},Xe.useCallback=function(P,te){return _.H.useCallback(P,te)},Xe.useContext=function(P){return _.H.useContext(P)},Xe.useDebugValue=function(){},Xe.useDeferredValue=function(P,te){return _.H.useDeferredValue(P,te)},Xe.useEffect=function(P,te){return _.H.useEffect(P,te)},Xe.useEffectEvent=function(P){return _.H.useEffectEvent(P)},Xe.useId=function(){return _.H.useId()},Xe.useImperativeHandle=function(P,te,z){return _.H.useImperativeHandle(P,te,z)},Xe.useInsertionEffect=function(P,te){return _.H.useInsertionEffect(P,te)},Xe.useLayoutEffect=function(P,te){return _.H.useLayoutEffect(P,te)},Xe.useMemo=function(P,te){return _.H.useMemo(P,te)},Xe.useOptimistic=function(P,te){return _.H.useOptimistic(P,te)},Xe.useReducer=function(P,te,z){return _.H.useReducer(P,te,z)},Xe.useRef=function(P){return _.H.useRef(P)},Xe.useState=function(P){return _.H.useState(P)},Xe.useSyncExternalStore=function(P,te,z){return _.H.useSyncExternalStore(P,te,z)},Xe.useTransition=function(){return _.H.useTransition()},Xe.version="19.2.7",Xe}var GE;function JS(){return GE||(GE=1,Tx.exports=s5()),Tx.exports}var ee=JS();function a5(t){const e={};for(const n of t.props)e[n.name]=n.defaultValue??"";return e}const o5={position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh",zIndex:1e3},l5={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},u5={border:"none",borderBottom:"1px solid #ececed",padding:"10px 12px",font:"inherit",outline:"none"},c5={textAlign:"left",border:"none",background:"transparent",padding:"8px 12px",cursor:"pointer",borderRadius:0};function f5({open:t,components:e,onInsert:n,onClose:r}){const[i,s]=ee.useState(""),a=ee.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?O.jsx("div",{style:o5,onMouseDown:r,children:O.jsxs("div",{style:l5,onMouseDown:u=>u.stopPropagation(),children:[O.jsx("input",{style:u5,placeholder:"Search components…",autoFocus:!0,value:i,onChange:u=>s(u.target.value)}),O.jsxs("div",{style:{overflowY:"auto"},children:[a.length===0?O.jsx("div",{style:{padding:12,color:"#a1a1aa"},children:"No components"}):null,a.map(u=>O.jsxs("button",{type:"button",style:c5,onClick:()=>{n(u.name,a5(u)),r()},children:[O.jsx("div",{style:{fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},children:u.name}),u.description?O.jsx("div",{style:{color:"#71717a",fontSize:12},children:u.description}):null]},u.name))]})]})}):null}var di=(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})({}),mi=class extends Error{constructor(t,e){super(e),this.name="MilkdownError",this.code=t}},h5=(t,e)=>typeof e=="function"?"[Function]":e,$g=t=>JSON.stringify(t,h5);function p5(t){return new mi(di.docTypeError,`Doc type error, unsupported type: ${$g(t)}`)}function d5(t){return new mi(di.contextNotFound,`Context "${t}" not found, do you forget to inject it?`)}function m5(t){return new mi(di.timerNotFound,`Timer "${t}" not found, do you forget to record it?`)}function Jg(){return new mi(di.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function g5(t,e,n){const r=`Cannot create node for ${"name"in t?t.name:t}`,i=a=>{if(a==null)return"null";if(Array.isArray(a))return`[${a.map(i).join(", ")}]`;if(typeof a=="object")return"toJSON"in a&&typeof a.toJSON=="function"?JSON.stringify(a.toJSON()):"spec"in a?JSON.stringify(a.spec):JSON.stringify(a);if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return JSON.stringify(a);if(typeof a=="function")return`[Function: ${a.name||"anonymous"}]`;try{return String(a)}catch{return"[Unserializable]"}},s=[["[Description]",r],["[Attributes]",e],["[Content]",(n??[]).map(a=>a?typeof a=="object"&&"type"in a?`${a}`:i(a):"null")]].reduce((a,[u,c])=>{const h=`${u}: ${i(c)}.`;return a.concat(h)},[]);return new mi(di.createNodeInParserFail,s.join(`
2
+ `))}function jM(){return new mi(di.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function y5(t){return new mi(di.parserMatchError,`Cannot match target parser for node: ${$g(t)}.`)}function x5(t){return new mi(di.serializerMatchError,`Cannot match target serializer for node: ${$g(t)}.`)}function ts(t){return new mi(di.expectDomTypeError,`Expect to be a dom, but get: ${$g(t)}.`)}function Mx(){return new mi(di.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 b5(t){return new mi(di.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${t}" in schema.`)}function S5(t){return new mi(di.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${t}" in schema.`)}var $M=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 d5(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)}},v5=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=[]}},k5=class{constructor(t,e){this.id=Symbol(`Context-${e}`),this.name=e,this._defaultValue=t,this._typeInfo=()=>{throw Jg()}}create(t,e=this._defaultValue){return new v5(t,e,this)}},lt=(t,e)=>new k5(t,e),C5=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},w5=class JM{#t;#e;#r;#n;constructor(e,n,r){this.produce=i=>i&&Object.keys(i).length?new JM(this.#t,this.#e,{...i}):this,this.inject=(i,s)=>{const a=i.create(this.#t.sliceMap);return s!=null&&a.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 C5(e,n,r))}get meta(){return this.#r}get inspector(){return this.#n}},E5=class{constructor(){this.store=new Map,this.get=t=>{const e=this.store.get(t.id);if(!e)throw m5(t.name);return e},this.remove=t=>{this.store.delete(t.id)},this.has=t=>this.store.has(t.id)}},A5=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)}},N5=class{constructor(t,e=3e3){this.create=n=>new A5(n,this),this.id=Symbol(`Timer-${t}`),this.name=t,this.timeout=e}},ns=(t,e=3e3)=>new N5(t,e);const T5={};function US(t,e){const n=T5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return UM(t,r,i)}function UM(t,e,n){if(M5(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 YE(t.children,e,n)}return Array.isArray(t)?YE(t,e,n):""}function YE(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=UM(t[i],e,n);return r.join("")}function M5(t){return!!(t&&typeof t=="object")}const WE=document.createElement("i");function Th(t){const e="&"+t+";";WE.innerHTML=e;const n=WE.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Lr(t,e,n,r){const i=t.length;let s=0,a;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(e,0),t.splice(...a),s+=1e4,e+=1e4}function si(t,e){return t.length>0?(Lr(t,t.length,0,e),t):e}const XE={}.hasOwnProperty;function HS(t){const e={};let n=-1;for(;++n<t.length;)O5(e,t[n]);return e}function O5(t,e){let n;for(n in e){const i=(XE.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let a;if(s)for(a in s){XE.call(i,a)||(i[a]=[]);const u=s[a];R5(i[a],Array.isArray(u)?u:u?[u]:[])}}}function R5(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Lr(t,0,0,r)}function HM(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 Ii(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cn=no(/[A-Za-z]/),Dn=no(/[\dA-Za-z]/),D5=no(/[#-'*+\--9=?A-Z^-~]/);function Hm(t){return t!==null&&(t<32||t===127)}const lb=no(/\d/),I5=no(/[\dA-Fa-f]/),_5=no(/[!-/:-@[-`{-~]/);function we(t){return t!==null&&t<-2}function tt(t){return t!==null&&(t<0||t===32)}function Ye(t){return t===-2||t===-1||t===32}const Ug=no(new RegExp("\\p{P}|\\p{S}","u")),Wn=no(/\s/);function no(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function We(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(c){return Ye(c)?(t.enter(n),u(c)):e(c)}function u(c){return Ye(c)&&s++<i?(t.consume(c),u):(t.exit(n),e(c))}}const z5={tokenize:L5};function L5(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"),We(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,a(u)}function a(u){if(u===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(u);return}return we(u)?(t.consume(u),t.exit("chunkText"),s):(t.consume(u),a)}}const B5={tokenize:F5},QE={tokenize:V5};function F5(t){const e=this,n=[];let r=0,i,s,a;return u;function u(F){if(r<n.length){const K=n[r];return e.containerState=K[1],t.attempt(K[0].continuation,c,h)(F)}return h(F)}function c(F){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&V();const K=e.events.length;let L=K,C;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){C=e.events[L][1].end;break}T(r);let _=K;for(;_<e.events.length;)e.events[_][1].end={...C},_++;return Lr(e.events,L+1,0,e.events.slice(K)),e.events.length=_,h(F)}return u(F)}function h(F){if(r===n.length){if(!i)return y(F);if(i.currentConstruct&&i.currentConstruct.concrete)return k(F);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(QE,d,g)(F)}function d(F){return i&&V(),T(r),y(F)}function g(F){return e.parser.lazy[e.now().line]=r!==n.length,a=e.now().offset,k(F)}function y(F){return e.containerState={},t.attempt(QE,x,k)(F)}function x(F){return r++,n.push([e.currentConstruct,e.containerState]),y(F)}function k(F){if(F===null){i&&V(),T(0),t.consume(F);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),w(F)}function w(F){if(F===null){N(t.exit("chunkFlow"),!0),T(0),t.consume(F);return}return we(F)?(t.consume(F),N(t.exit("chunkFlow")),r=0,e.interrupt=void 0,u):(t.consume(F),w)}function N(F,K){const L=e.sliceStream(F);if(K&&L.push(null),F.previous=s,s&&(s.next=F),s=F,i.defineSkip(F.start),i.write(L),e.parser.lazy[F.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<a&&(!i.events[C][1].end||i.events[C][1].end.offset>a))return;const _=e.events.length;let J=_,$,H;for(;J--;)if(e.events[J][0]==="exit"&&e.events[J][1].type==="chunkFlow"){if($){H=e.events[J][1].end;break}$=!0}for(T(r),C=_;C<e.events.length;)e.events[C][1].end={...H},C++;Lr(e.events,J+1,0,e.events.slice(_)),e.events.length=C}}function T(F){let K=n.length;for(;K-- >F;){const L=n[K];e.containerState=L[1],L[0].exit.call(e,t)}n.length=F}function V(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function V5(t,e,n){return We(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Hu(t){if(t===null||tt(t)||Wn(t))return 1;if(Ug(t))return 2}function Hg(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 ub={name:"attention",resolveAll:P5,tokenize:j5};function P5(t,e){let n=-1,r,i,s,a,u,c,h,d;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;c=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const g={...t[r][1].end},y={...t[n][1].start};ZE(g,-c),ZE(y,c),a={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:{...a.start},end:{...u.end}},t[r][1].end={...a.start},t[n][1].start={...u.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=si(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=si(h,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",s,e]]),h=si(h,Hg(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=si(h,[["exit",s,e],["enter",u,e],["exit",u,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(d=2,h=si(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,Lr(t,r-1,n-r+3,h),n=r+h.length-d-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function j5(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Hu(r);let s;return a;function a(c){return s=c,t.enter("attentionSequence"),u(c)}function u(c){if(c===s)return t.consume(c),u;const h=t.exit("attentionSequence"),d=Hu(c),g=!d||d===2&&i||n.includes(c),y=!i||i===2&&d||n.includes(r);return h._open=!!(s===42?g:g&&(i||!y)),h._close=!!(s===42?y:y&&(d||!g)),e(c)}}function ZE(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const $5={name:"autolink",tokenize:J5};function J5(t,e,n){let r=0;return i;function i(x){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(x){return cn(x)?(t.consume(x),a):x===64?n(x):h(x)}function a(x){return x===43||x===45||x===46||Dn(x)?(r=1,u(x)):h(x)}function u(x){return x===58?(t.consume(x),r=0,c):(x===43||x===45||x===46||Dn(x))&&r++<32?(t.consume(x),u):(r=0,h(x))}function c(x){return x===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),e):x===null||x===32||x===60||Hm(x)?n(x):(t.consume(x),c)}function h(x){return x===64?(t.consume(x),d):D5(x)?(t.consume(x),h):n(x)}function d(x){return Dn(x)?g(x):n(x)}function g(x){return x===46?(t.consume(x),r=0,d):x===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),e):y(x)}function y(x){if((x===45||Dn(x))&&r++<63){const k=x===45?y:g;return t.consume(x),k}return n(x)}}const Zu={partial:!0,tokenize:U5};function U5(t,e,n){return r;function r(s){return Ye(s)?We(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||we(s)?e(s):n(s)}}const qM={continuation:{tokenize:q5},exit:K5,name:"blockQuote",tokenize:H5};function H5(t,e,n){const r=this;return i;function i(a){if(a===62){const u=r.containerState;return u.open||(t.enter("blockQuote",{_container:!0}),u.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),s}return n(a)}function s(a){return Ye(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function q5(t,e,n){const r=this;return i;function i(a){return Ye(a)?We(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return t.attempt(qM,e,n)(a)}}function K5(t){t.exit("blockQuote")}const KM={name:"characterEscape",tokenize:G5};function G5(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 _5(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const GM={name:"characterReference",tokenize:Y5};function Y5(t,e,n){const r=this;let i=0,s,a;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,a=Dn,d(g))}function h(g){return g===88||g===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(g),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,a=I5,d):(t.enter("characterReferenceValue"),s=7,a=lb,d(g))}function d(g){if(g===59&&i){const y=t.exit("characterReferenceValue");return a===Dn&&!Th(r.sliceSerialize(y))?n(g):(t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(g)&&i++<s?(t.consume(g),d):n(g)}}const eA={partial:!0,tokenize:X5},tA={concrete:!0,name:"codeFenced",tokenize:W5};function W5(t,e,n){const r=this,i={partial:!0,tokenize:L};let s=0,a=0,u;return c;function c(C){return h(C)}function h(C){const _=r.events[r.events.length-1];return s=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,u=C,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===u?(a++,t.consume(C),d):a<3?n(C):(t.exit("codeFencedFenceSequence"),Ye(C)?We(t,g,"whitespace")(C):g(C))}function g(C){return C===null||we(C)?(t.exit("codeFencedFence"),r.interrupt?e(C):t.check(eA,w,K)(C)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||we(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),g(C)):Ye(C)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),We(t,x,"whitespace")(C)):C===96&&C===u?n(C):(t.consume(C),y)}function x(C){return C===null||we(C)?g(C):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),k(C))}function k(C){return C===null||we(C)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),g(C)):C===96&&C===u?n(C):(t.consume(C),k)}function w(C){return t.attempt(i,K,N)(C)}function N(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),T}function T(C){return s>0&&Ye(C)?We(t,V,"linePrefix",s+1)(C):V(C)}function V(C){return C===null||we(C)?t.check(eA,w,K)(C):(t.enter("codeFlowValue"),F(C))}function F(C){return C===null||we(C)?(t.exit("codeFlowValue"),V(C)):(t.consume(C),F)}function K(C){return t.exit("codeFenced"),e(C)}function L(C,_,J){let $=0;return H;function H(Y){return C.enter("lineEnding"),C.consume(Y),C.exit("lineEnding"),ue}function ue(Y){return C.enter("codeFencedFence"),Ye(Y)?We(C,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):ae(Y)}function ae(Y){return Y===u?(C.enter("codeFencedFenceSequence"),Se(Y)):J(Y)}function Se(Y){return Y===u?($++,C.consume(Y),Se):$>=a?(C.exit("codeFencedFenceSequence"),Ye(Y)?We(C,Ee,"whitespace")(Y):Ee(Y)):J(Y)}function Ee(Y){return Y===null||we(Y)?(C.exit("codeFencedFence"),_(Y)):J(Y)}}}function X5(t,e,n){const r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const Ox={name:"codeIndented",tokenize:Z5},Q5={partial:!0,tokenize:e9};function Z5(t,e,n){const r=this;return i;function i(h){return t.enter("codeIndented"),We(t,s,"linePrefix",5)(h)}function s(h){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(h):n(h)}function a(h){return h===null?c(h):we(h)?t.attempt(Q5,a,c)(h):(t.enter("codeFlowValue"),u(h))}function u(h){return h===null||we(h)?(t.exit("codeFlowValue"),a(h)):(t.consume(h),u)}function c(h){return t.exit("codeIndented"),e(h)}}function e9(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):we(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):We(t,s,"linePrefix",5)(a)}function s(a){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(a):we(a)?i(a):n(a)}}const t9={name:"codeText",previous:r9,resolve:n9,tokenize:i9};function n9(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 r9(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function i9(t,e,n){let r=0,i,s;return a;function a(g){return t.enter("codeText"),t.enter("codeTextSequence"),u(g)}function u(g){return g===96?(t.consume(g),r++,u):(t.exit("codeTextSequence"),c(g))}function c(g){return g===null?n(g):g===32?(t.enter("space"),t.consume(g),t.exit("space"),c):g===96?(s=t.enter("codeTextSequence"),i=0,d(g)):we(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||we(g)?(t.exit("codeTextData"),c(g)):(t.consume(g),h)}function d(g){return g===96?(t.consume(g),i++,d):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(g)):(s.type="codeTextData",h(g))}}class s9{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&&lf(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),lf(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),lf(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);lf(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);lf(this.left,n.reverse())}}}function lf(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 YM(t){const e={};let n=-1,r,i,s,a,u,c,h;const d=new s9(t);for(;++n<d.length;){for(;n in e;)n=e[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,a9(d,n)),n=e[n],h=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=d.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},u=d.slice(i,n),u.unshift(r),d.splice(i,n-i+1,u))}}return Lr(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!h}function a9(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const u=a.events,c=[],h={};let d,g,y=-1,x=n,k=0,w=0;const N=[w];for(;x;){for(;t.get(++i)[1]!==x;);s.push(i),x._tokenizer||(d=r.sliceStream(x),x.next||d.push(null),g&&a.defineSkip(x.start),x._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),x._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=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&&(w=y+1,N.push(w),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(a.events=[],x?(x._tokenizer=void 0,x.previous=void 0):N.pop(),y=N.length;y--;){const T=u.slice(N[y],N[y+1]),V=s.pop();c.push([V,V+T.length-1]),t.splice(V,2,T)}for(c.reverse(),y=-1;++y<c.length;)h[k+c[y][0]]=k+c[y][1],k+=c[y][1]-c[y][0]-1;return h}const o9={resolve:u9,tokenize:c9},l9={partial:!0,tokenize:f9};function u9(t){return YM(t),t}function c9(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):we(u)?t.check(l9,a,s)(u):(t.consume(u),i)}function s(u){return t.exit("chunkContent"),t.exit("content"),e(u)}function a(u){return t.consume(u),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function f9(t,e,n){const r=this;return i;function i(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),We(t,s,"linePrefix")}function s(a){if(a===null||we(a))return n(a);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(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function WM(t,e,n,r,i,s,a,u,c){const h=c||Number.POSITIVE_INFINITY;let d=0;return g;function g(T){return T===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(T),t.exit(s),y):T===null||T===32||T===41||Hm(T)?n(T):(t.enter(r),t.enter(a),t.enter(u),t.enter("chunkString",{contentType:"string"}),w(T))}function y(T){return T===62?(t.enter(s),t.consume(T),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(u),t.enter("chunkString",{contentType:"string"}),x(T))}function x(T){return T===62?(t.exit("chunkString"),t.exit(u),y(T)):T===null||T===60||we(T)?n(T):(t.consume(T),T===92?k:x)}function k(T){return T===60||T===62||T===92?(t.consume(T),x):x(T)}function w(T){return!d&&(T===null||T===41||tt(T))?(t.exit("chunkString"),t.exit(u),t.exit(a),t.exit(r),e(T)):d<h&&T===40?(t.consume(T),d++,w):T===41?(t.consume(T),d--,w):T===null||T===32||T===40||Hm(T)?n(T):(t.consume(T),T===92?N:w)}function N(T){return T===40||T===41||T===92?(t.consume(T),w):w(T)}}function XM(t,e,n,r,i,s){const a=this;let u=0,c;return h;function h(x){return t.enter(r),t.enter(i),t.consume(x),t.exit(i),t.enter(s),d}function d(x){return u>999||x===null||x===91||x===93&&!c||x===94&&!u&&"_hiddenFootnoteSupport"in a.parser.constructs?n(x):x===93?(t.exit(s),t.enter(i),t.consume(x),t.exit(i),t.exit(r),e):we(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||we(x)||u++>999?(t.exit("chunkString"),d(x)):(t.consume(x),c||(c=!Ye(x)),x===92?y:g)}function y(x){return x===91||x===92||x===93?(t.consume(x),u++,g):g(x)}}function QM(t,e,n,r,i,s){let a;return u;function u(y){return y===34||y===39||y===40?(t.enter(r),t.enter(i),t.consume(y),t.exit(i),a=y===40?41:y,c):n(y)}function c(y){return y===a?(t.enter(i),t.consume(y),t.exit(i),t.exit(r),e):(t.enter(s),h(y))}function h(y){return y===a?(t.exit(s),c(a)):y===null?n(y):we(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),We(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===a||y===null||we(y)?(t.exit("chunkString"),h(y)):(t.consume(y),y===92?g:d)}function g(y){return y===a||y===92?(t.consume(y),d):d(y)}}function zs(t,e){let n;return r;function r(i){return we(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ye(i)?We(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const h9={name:"definition",tokenize:d9},p9={partial:!0,tokenize:m9};function d9(t,e,n){const r=this;let i;return s;function s(x){return t.enter("definition"),a(x)}function a(x){return XM.call(r,t,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function u(x){return i=Ii(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),c):n(x)}function c(x){return tt(x)?zs(t,h)(x):h(x)}function h(x){return WM(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function d(x){return t.attempt(p9,g,g)(x)}function g(x){return Ye(x)?We(t,y,"whitespace")(x):y(x)}function y(x){return x===null||we(x)?(t.exit("definition"),r.parser.defined.push(i),e(x)):n(x)}}function m9(t,e,n){return r;function r(u){return tt(u)?zs(t,i)(u):n(u)}function i(u){return QM(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function s(u){return Ye(u)?We(t,a,"whitespace")(u):a(u)}function a(u){return u===null||we(u)?e(u):n(u)}}const g9={name:"hardBreakEscape",tokenize:y9};function y9(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return we(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const x9={name:"headingAtx",resolve:b9,tokenize:S9};function b9(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"},Lr(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function S9(t,e,n){let r=0;return i;function i(d){return t.enter("atxHeading"),s(d)}function s(d){return t.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(t.consume(d),a):d===null||tt(d)?(t.exit("atxHeadingSequence"),u(d)):n(d)}function u(d){return d===35?(t.enter("atxHeadingSequence"),c(d)):d===null||we(d)?(t.exit("atxHeading"),e(d)):Ye(d)?We(t,u,"whitespace")(d):(t.enter("atxHeadingText"),h(d))}function c(d){return d===35?(t.consume(d),c):(t.exit("atxHeadingSequence"),u(d))}function h(d){return d===null||d===35||tt(d)?(t.exit("atxHeadingText"),u(d)):(t.consume(d),h)}}const v9=["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"],nA=["pre","script","style","textarea"],k9={concrete:!0,name:"htmlFlow",resolveTo:E9,tokenize:A9},C9={partial:!0,tokenize:T9},w9={partial:!0,tokenize:N9};function E9(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 A9(t,e,n){const r=this;let i,s,a,u,c;return h;function h(z){return d(z)}function d(z){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(z),g}function g(z){return z===33?(t.consume(z),y):z===47?(t.consume(z),s=!0,w):z===63?(t.consume(z),i=3,r.interrupt?e:j):cn(z)?(t.consume(z),a=String.fromCharCode(z),N):n(z)}function y(z){return z===45?(t.consume(z),i=2,x):z===91?(t.consume(z),i=5,u=0,k):cn(z)?(t.consume(z),i=4,r.interrupt?e:j):n(z)}function x(z){return z===45?(t.consume(z),r.interrupt?e:j):n(z)}function k(z){const xe="CDATA[";return z===xe.charCodeAt(u++)?(t.consume(z),u===xe.length?r.interrupt?e:ae:k):n(z)}function w(z){return cn(z)?(t.consume(z),a=String.fromCharCode(z),N):n(z)}function N(z){if(z===null||z===47||z===62||tt(z)){const xe=z===47,Te=a.toLowerCase();return!xe&&!s&&nA.includes(Te)?(i=1,r.interrupt?e(z):ae(z)):v9.includes(a.toLowerCase())?(i=6,xe?(t.consume(z),T):r.interrupt?e(z):ae(z)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(z):s?V(z):F(z))}return z===45||Dn(z)?(t.consume(z),a+=String.fromCharCode(z),N):n(z)}function T(z){return z===62?(t.consume(z),r.interrupt?e:ae):n(z)}function V(z){return Ye(z)?(t.consume(z),V):H(z)}function F(z){return z===47?(t.consume(z),H):z===58||z===95||cn(z)?(t.consume(z),K):Ye(z)?(t.consume(z),F):H(z)}function K(z){return z===45||z===46||z===58||z===95||Dn(z)?(t.consume(z),K):L(z)}function L(z){return z===61?(t.consume(z),C):Ye(z)?(t.consume(z),L):F(z)}function C(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(t.consume(z),c=z,_):Ye(z)?(t.consume(z),C):J(z)}function _(z){return z===c?(t.consume(z),c=null,$):z===null||we(z)?n(z):(t.consume(z),_)}function J(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||tt(z)?L(z):(t.consume(z),J)}function $(z){return z===47||z===62||Ye(z)?F(z):n(z)}function H(z){return z===62?(t.consume(z),ue):n(z)}function ue(z){return z===null||we(z)?ae(z):Ye(z)?(t.consume(z),ue):n(z)}function ae(z){return z===45&&i===2?(t.consume(z),X):z===60&&i===1?(t.consume(z),le):z===62&&i===4?(t.consume(z),P):z===63&&i===3?(t.consume(z),j):z===93&&i===5?(t.consume(z),_e):we(z)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(C9,te,Se)(z)):z===null||we(z)?(t.exit("htmlFlowData"),Se(z)):(t.consume(z),ae)}function Se(z){return t.check(w9,Ee,te)(z)}function Ee(z){return t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),Y}function Y(z){return z===null||we(z)?Se(z):(t.enter("htmlFlowData"),ae(z))}function X(z){return z===45?(t.consume(z),j):ae(z)}function le(z){return z===47?(t.consume(z),a="",Ce):ae(z)}function Ce(z){if(z===62){const xe=a.toLowerCase();return nA.includes(xe)?(t.consume(z),P):ae(z)}return cn(z)&&a.length<8?(t.consume(z),a+=String.fromCharCode(z),Ce):ae(z)}function _e(z){return z===93?(t.consume(z),j):ae(z)}function j(z){return z===62?(t.consume(z),P):z===45&&i===2?(t.consume(z),j):ae(z)}function P(z){return z===null||we(z)?(t.exit("htmlFlowData"),te(z)):(t.consume(z),P)}function te(z){return t.exit("htmlFlow"),e(z)}}function N9(t,e,n){const r=this;return i;function i(a){return we(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function T9(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Zu,e,n)}}const M9={name:"htmlText",tokenize:O9};function O9(t,e,n){const r=this;let i,s,a;return u;function u(j){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(j),c}function c(j){return j===33?(t.consume(j),h):j===47?(t.consume(j),L):j===63?(t.consume(j),F):cn(j)?(t.consume(j),J):n(j)}function h(j){return j===45?(t.consume(j),d):j===91?(t.consume(j),s=0,k):cn(j)?(t.consume(j),V):n(j)}function d(j){return j===45?(t.consume(j),x):n(j)}function g(j){return j===null?n(j):j===45?(t.consume(j),y):we(j)?(a=g,le(j)):(t.consume(j),g)}function y(j){return j===45?(t.consume(j),x):g(j)}function x(j){return j===62?X(j):j===45?y(j):g(j)}function k(j){const P="CDATA[";return j===P.charCodeAt(s++)?(t.consume(j),s===P.length?w:k):n(j)}function w(j){return j===null?n(j):j===93?(t.consume(j),N):we(j)?(a=w,le(j)):(t.consume(j),w)}function N(j){return j===93?(t.consume(j),T):w(j)}function T(j){return j===62?X(j):j===93?(t.consume(j),T):w(j)}function V(j){return j===null||j===62?X(j):we(j)?(a=V,le(j)):(t.consume(j),V)}function F(j){return j===null?n(j):j===63?(t.consume(j),K):we(j)?(a=F,le(j)):(t.consume(j),F)}function K(j){return j===62?X(j):F(j)}function L(j){return cn(j)?(t.consume(j),C):n(j)}function C(j){return j===45||Dn(j)?(t.consume(j),C):_(j)}function _(j){return we(j)?(a=_,le(j)):Ye(j)?(t.consume(j),_):X(j)}function J(j){return j===45||Dn(j)?(t.consume(j),J):j===47||j===62||tt(j)?$(j):n(j)}function $(j){return j===47?(t.consume(j),X):j===58||j===95||cn(j)?(t.consume(j),H):we(j)?(a=$,le(j)):Ye(j)?(t.consume(j),$):X(j)}function H(j){return j===45||j===46||j===58||j===95||Dn(j)?(t.consume(j),H):ue(j)}function ue(j){return j===61?(t.consume(j),ae):we(j)?(a=ue,le(j)):Ye(j)?(t.consume(j),ue):$(j)}function ae(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(t.consume(j),i=j,Se):we(j)?(a=ae,le(j)):Ye(j)?(t.consume(j),ae):(t.consume(j),Ee)}function Se(j){return j===i?(t.consume(j),i=void 0,Y):j===null?n(j):we(j)?(a=Se,le(j)):(t.consume(j),Se)}function Ee(j){return j===null||j===34||j===39||j===60||j===61||j===96?n(j):j===47||j===62||tt(j)?$(j):(t.consume(j),Ee)}function Y(j){return j===47||j===62||tt(j)?$(j):n(j)}function X(j){return j===62?(t.consume(j),t.exit("htmlTextData"),t.exit("htmlText"),e):n(j)}function le(j){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),Ce}function Ce(j){return Ye(j)?We(t,_e,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):_e(j)}function _e(j){return t.enter("htmlTextData"),a(j)}}const qS={name:"labelEnd",resolveAll:_9,resolveTo:z9,tokenize:L9},R9={tokenize:B9},D9={tokenize:F9},I9={tokenize:V9};function _9(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&&Lr(t,0,t.length,n),t}function z9(t,e){let n=t.length,r=0,i,s,a,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(a){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"&&(a=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[a][1].end}},d={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[a-2][1].start}};return u=[["enter",c,e],["enter",h,e]],u=si(u,t.slice(s+1,s+r+3)),u=si(u,[["enter",d,e]]),u=si(u,Hg(e.parser.constructs.insideSpan.null,t.slice(s+r+4,a-3),e)),u=si(u,[["exit",d,e],t[a-2],t[a-1],["exit",h,e]]),u=si(u,t.slice(a+1)),u=si(u,[["exit",c,e]]),Lr(t,s,t.length,u),t}function L9(t,e,n){const r=this;let i=r.events.length,s,a;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):(a=r.parser.defined.includes(Ii(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(R9,d,a?d:g)(y):y===91?t.attempt(D9,d,a?h:g)(y):a?d(y):g(y)}function h(y){return t.attempt(I9,d,g)(y)}function d(y){return e(y)}function g(y){return s._balanced=!0,n(y)}}function B9(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 tt(g)?zs(t,s)(g):s(g)}function s(g){return g===41?d(g):WM(t,a,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function a(g){return tt(g)?zs(t,c)(g):d(g)}function u(g){return n(g)}function c(g){return g===34||g===39||g===40?QM(t,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):d(g)}function h(g){return tt(g)?zs(t,d)(g):d(g)}function d(g){return g===41?(t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),t.exit("resource"),e):n(g)}}function F9(t,e,n){const r=this;return i;function i(u){return XM.call(r,t,s,a,"reference","referenceMarker","referenceString")(u)}function s(u){return r.parser.defined.includes(Ii(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(u):n(u)}function a(u){return n(u)}}function V9(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 P9={name:"labelStartImage",resolveAll:qS.resolveAll,tokenize:j9};function j9(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"),a):n(u)}function a(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):e(u)}}const $9={name:"labelStartLink",resolveAll:qS.resolveAll,tokenize:J9};function J9(t,e,n){const r=this;return i;function i(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const Rx={name:"lineEnding",tokenize:U9};function U9(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),We(t,e,"linePrefix")}}const im={name:"thematicBreak",tokenize:H9};function H9(t,e,n){let r=0,i;return s;function s(h){return t.enter("thematicBreak"),a(h)}function a(h){return i=h,u(h)}function u(h){return h===i?(t.enter("thematicBreakSequence"),c(h)):r>=3&&(h===null||we(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===i?(t.consume(h),r++,c):(t.exit("thematicBreakSequence"),Ye(h)?We(t,u,"whitespace")(h):u(h))}}const Cr={continuation:{tokenize:Y9},exit:X9,name:"list",tokenize:G9},q9={partial:!0,tokenize:Q9},K9={partial:!0,tokenize:W9};function G9(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,a=0;return u;function u(x){const k=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:lb(x)){if(r.containerState.type||(r.containerState.type=k,t.enter(k,{_container:!0})),k==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(im,n,h)(x):h(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(x)}return n(x)}function c(x){return lb(x)&&++a<10?(t.consume(x),c):(!r.interrupt||a<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),h(x)):n(x)}function h(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check(Zu,r.interrupt?n:d,t.attempt(q9,y,g))}function d(x){return r.containerState.initialBlankLine=!0,s++,y(x)}function g(x){return Ye(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),y):n(x)}function y(x){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(x)}}function Y9(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Zu,i,s);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,We(t,e,"listItemIndent",r.containerState.size+1)(u)}function s(u){return r.containerState.furtherBlankLines||!Ye(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(K9,e,a)(u))}function a(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,We(t,t.attempt(Cr,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function W9(t,e,n){const r=this;return We(t,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(s):n(s)}}function X9(t){t.exit(this.containerState.type)}function Q9(t,e,n){const r=this;return We(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!Ye(s)&&a&&a[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const rA={name:"setextUnderline",resolveTo:Z9,tokenize:e8};function Z9(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 a={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",a,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function e8(t,e,n){const r=this;let i;return s;function s(h){let d=r.events.length,g;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){g=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(t.enter("setextHeadingLine"),i=h,a(h)):n(h)}function a(h){return t.enter("setextHeadingLineSequence"),u(h)}function u(h){return h===i?(t.consume(h),u):(t.exit("setextHeadingLineSequence"),Ye(h)?We(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||we(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const t8={tokenize:n8};function n8(t){const e=this,n=t.attempt(Zu,r,t.attempt(this.parser.constructs.flowInitial,i,We(t,t.attempt(this.parser.constructs.flow,i,t.attempt(o9,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 r8={resolveAll:eO()},i8=ZM("string"),s8=ZM("text");function ZM(t){return{resolveAll:eO(t==="text"?a8:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,a,u);return a;function a(d){return h(d)?s(d):u(d)}function u(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return h(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function h(d){if(d===null)return!0;const g=i[d];let y=-1;if(g)for(;++y<g.length;){const x=g[y];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function eO(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 a8(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,a=-1,u=0,c;for(;s--;){const h=i[s];if(typeof h=="string"){for(a=h.length;h.charCodeAt(a-1)===32;)u++,a--;if(a)break;a=-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?a:r.start._bufferIndex+a,_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 o8={42:Cr,43:Cr,45:Cr,48:Cr,49:Cr,50:Cr,51:Cr,52:Cr,53:Cr,54:Cr,55:Cr,56:Cr,57:Cr,62:qM},l8={91:h9},u8={[-2]:Ox,[-1]:Ox,32:Ox},c8={35:x9,42:im,45:[rA,im],60:k9,61:rA,95:im,96:tA,126:tA},f8={38:GM,92:KM},h8={[-5]:Rx,[-4]:Rx,[-3]:Rx,33:P9,38:GM,42:ub,60:[$5,M9],91:$9,92:[g9,KM],93:qS,95:ub,96:t9},p8={null:[ub,r8]},d8={null:[42,95]},m8={null:[]},g8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:d8,contentInitial:l8,disable:m8,document:o8,flow:c8,flowInitial:u8,insideSpan:p8,string:f8,text:h8},Symbol.toStringTag,{value:"Module"}));function y8(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 a=[],u=[];const c={attempt:_(L),check:_(C),consume:V,enter:F,exit:K,interrupt:_(C,{interrupt:!0})},h={code:null,containerState:{},defineSkip:w,events:[],now:k,parser:t,previous:null,sliceSerialize:y,sliceStream:x,write:g};let d=e.tokenize.call(h,c);return e.resolveAll&&s.push(e),h;function g(ue){return a=si(a,ue),N(),a[a.length-1]!==null?[]:(J(e,0),h.events=Hg(s,h.events,h),h.events)}function y(ue,ae){return b8(x(ue),ae)}function x(ue){return x8(a,ue)}function k(){const{_bufferIndex:ue,_index:ae,line:Se,column:Ee,offset:Y}=r;return{_bufferIndex:ue,_index:ae,line:Se,column:Ee,offset:Y}}function w(ue){i[ue.line]=ue.column,H()}function N(){let ue;for(;r._index<a.length;){const ae=a[r._index];if(typeof ae=="string")for(ue=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===ue&&r._bufferIndex<ae.length;)T(ae.charCodeAt(r._bufferIndex));else T(ae)}}function T(ue){d=d(ue)}function V(ue){we(ue)?(r.line++,r.column=1,r.offset+=ue===-3?2:1,H()):ue!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=ue}function F(ue,ae){const Se=ae||{};return Se.type=ue,Se.start=k(),h.events.push(["enter",Se,h]),u.push(Se),Se}function K(ue){const ae=u.pop();return ae.end=k(),h.events.push(["exit",ae,h]),ae}function L(ue,ae){J(ue,ae.from)}function C(ue,ae){ae.restore()}function _(ue,ae){return Se;function Se(Ee,Y,X){let le,Ce,_e,j;return Array.isArray(Ee)?te(Ee):"tokenize"in Ee?te([Ee]):P(Ee);function P(Ae){return qe;function qe(pt){const Ke=pt!==null&&Ae[pt],Pt=pt!==null&&Ae.null,Ot=[...Array.isArray(Ke)?Ke:Ke?[Ke]:[],...Array.isArray(Pt)?Pt:Pt?[Pt]:[]];return te(Ot)(pt)}}function te(Ae){return le=Ae,Ce=0,Ae.length===0?X:z(Ae[Ce])}function z(Ae){return qe;function qe(pt){return j=$(),_e=Ae,Ae.partial||(h.currentConstruct=Ae),Ae.name&&h.parser.constructs.disable.null.includes(Ae.name)?Te():Ae.tokenize.call(ae?Object.assign(Object.create(h),ae):h,c,xe,Te)(pt)}}function xe(Ae){return ue(_e,j),Y}function Te(Ae){return j.restore(),++Ce<le.length?z(le[Ce]):X}}}function J(ue,ae){ue.resolveAll&&!s.includes(ue)&&s.push(ue),ue.resolve&&Lr(h.events,ae,h.events.length-ae,ue.resolve(h.events.slice(ae),h)),ue.resolveTo&&(h.events=ue.resolveTo(h.events,h))}function $(){const ue=k(),ae=h.previous,Se=h.currentConstruct,Ee=h.events.length,Y=Array.from(u);return{from:Ee,restore:X};function X(){r=ue,h.previous=ae,h.currentConstruct=Se,h.events.length=Ee,u=Y,H()}}function H(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function x8(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let a;if(n===i)a=[t[n].slice(r,s)];else{if(a=t.slice(n,i),r>-1){const u=a[0];typeof u=="string"?a[0]=u.slice(r):a.shift()}s>0&&a.push(t[i].slice(0,s))}return a}function b8(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=`
3
+ `;break}case-3:{a=`\r
4
+ `;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function S8(t){const r={constructs:HS([g8,...(t||{}).extensions||[]]),content:i(z5),defined:[],document:i(B5),flow:i(t8),lazy:{},string:i(i8),text:i(s8)};return r;function i(s){return a;function a(u){return y8(r,s,u)}}}function v8(t){for(;!YM(t););return t}const iA=/[\0\t\n\r]/g;function k8(){let t=1,e="",n=!0,r;return i;function i(s,a,u){const c=[];let h,d,g,y,x;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),g=0,e="",n&&(s.charCodeAt(0)===65279&&g++,n=void 0);g<s.length;){if(iA.lastIndex=g,h=iA.exec(s),y=h&&h.index!==void 0?h.index:s.length,x=s.charCodeAt(y),!h){e=s.slice(g);break}if(x===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),x){case 0:{c.push(65533),t++;break}case 9:{for(d=Math.ceil(t/4)*4,c.push(-2);t++<d;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:r=!0,t=1}g=y+1}return u&&(r&&c.push(-5),e&&c.push(e),c.push(null)),c}}const C8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tO(t){return t.replace(C8,w8)}function w8(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return HM(n.slice(s?2:1),s?16:10)}return Th(n)||t}function Ls(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?sA(t.position):"start"in t||"end"in t?sA(t):"line"in t||"column"in t?cb(t):""}function cb(t){return aA(t&&t.line)+":"+aA(t&&t.column)}function sA(t){return cb(t&&t.start)+"-"+cb(t&&t.end)}function aA(t){return t&&typeof t=="number"?t:1}const nO={}.hasOwnProperty;function E8(t,e,n){return typeof e!="string"&&(n=e,e=void 0),A8(n)(v8(S8(n).document().write(k8()(t,e,!0))))}function A8(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(dr),autolinkProtocol:$,autolinkEmail:$,atxHeading:s(pn),blockQuote:s(Pt),characterEscape:$,characterReference:$,codeFenced:s(Ot),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(Ot,a),codeText:s(fr,a),codeTextData:$,data:$,codeFlowValue:$,definition:s(hr),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(hn),hardBreakEscape:s(pr),hardBreakTrailing:s(pr),htmlFlow:s(dn,a),htmlFlowData:$,htmlText:s(dn,a),htmlTextData:$,image:s(mn),label:a,link:s(dr),listItem:s(je),listItemValue:y,listOrdered:s(he,g),listUnordered:s(he),paragraph:s(Dt),reference:z,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(pn),strong:s(mt),thematicBreak:s(gn)},exit:{atxHeading:c(),atxHeadingSequence:L,autolink:c(),autolinkEmail:Ke,autolinkProtocol:pt,blockQuote:c(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:Te,characterReferenceMarkerNumeric:Te,characterReferenceValue:Ae,characterReference:qe,codeFenced:c(N),codeFencedFence:w,codeFencedFenceInfo:x,codeFencedFenceMeta:k,codeFlowValue:H,codeIndented:c(T),codeText:c(Y),codeTextData:H,data:H,definition:c(),definitionDestinationString:K,definitionLabelString:V,definitionTitleString:F,emphasis:c(),hardBreakEscape:c(ae),hardBreakTrailing:c(ae),htmlFlow:c(Se),htmlFlowData:H,htmlText:c(Ee),htmlTextData:H,image:c(le),label:_e,labelText:Ce,lineEnding:ue,link:c(X),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:xe,resourceDestinationString:j,resourceTitleString:P,resource:te,setextHeading:c(J),setextHeadingLineSequence:_,setextHeadingText:C,strong:c(),thematicBreak:c()}};rO(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(fe){let ge={type:"root",children:[]};const I={stack:[ge],tokenStack:[],config:e,enter:u,exit:h,buffer:a,resume:d,data:n},ze=[];let Je=-1;for(;++Je<fe.length;)if(fe[Je][1].type==="listOrdered"||fe[Je][1].type==="listUnordered")if(fe[Je][0]==="enter")ze.push(Je);else{const on=ze.pop();Je=i(fe,on,Je)}for(Je=-1;++Je<fe.length;){const on=e[fe[Je][0]];nO.call(on,fe[Je][1].type)&&on[fe[Je][1].type].call(Object.assign({sliceSerialize:fe[Je][2].sliceSerialize},I),fe[Je][1])}if(I.tokenStack.length>0){const on=I.tokenStack[I.tokenStack.length-1];(on[1]||oA).call(I,void 0,on[0])}for(ge.position={start:Ta(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Ta(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},Je=-1;++Je<e.transforms.length;)ge=e.transforms[Je](ge)||ge;return ge}function i(fe,ge,I){let ze=ge-1,Je=-1,on=!1,mr,ke,jt,Tn;for(;++ze<=I;){const wt=fe[ze];switch(wt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{wt[0]==="enter"?Je++:Je--,Tn=void 0;break}case"lineEndingBlank":{wt[0]==="enter"&&(mr&&!Tn&&!Je&&!jt&&(jt=ze),Tn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Tn=void 0}if(!Je&&wt[0]==="enter"&&wt[1].type==="listItemPrefix"||Je===-1&&wt[0]==="exit"&&(wt[1].type==="listUnordered"||wt[1].type==="listOrdered")){if(mr){let gr=ze;for(ke=void 0;gr--;){const Un=fe[gr];if(Un[1].type==="lineEnding"||Un[1].type==="lineEndingBlank"){if(Un[0]==="exit")continue;ke&&(fe[ke][1].type="lineEndingBlank",on=!0),Un[1].type="lineEnding",ke=gr}else if(!(Un[1].type==="linePrefix"||Un[1].type==="blockQuotePrefix"||Un[1].type==="blockQuotePrefixWhitespace"||Un[1].type==="blockQuoteMarker"||Un[1].type==="listItemIndent"))break}jt&&(!ke||jt<ke)&&(mr._spread=!0),mr.end=Object.assign({},ke?fe[ke][1].start:wt[1].end),fe.splice(ke||ze,0,["exit",mr,wt[2]]),ze++,I++}if(wt[1].type==="listItemPrefix"){const gr={type:"listItem",_spread:!1,start:Object.assign({},wt[1].start),end:void 0};mr=gr,fe.splice(ze,0,["enter",gr,wt[2]]),ze++,I++,jt=void 0,Tn=!0}}}return fe[ge][1]._spread=on,I}function s(fe,ge){return I;function I(ze){u.call(this,fe(ze),ze),ge&&ge.call(this,ze)}}function a(){this.stack.push({type:"fragment",children:[]})}function u(fe,ge,I){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([ge,I||void 0]),fe.position={start:Ta(ge.start),end:void 0}}function c(fe){return ge;function ge(I){fe&&fe.call(this,I),h.call(this,I)}}function h(fe,ge){const I=this.stack.pop(),ze=this.tokenStack.pop();if(ze)ze[0].type!==fe.type&&(ge?ge.call(this,fe,ze[0]):(ze[1]||oA).call(this,fe,ze[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Ls({start:fe.start,end:fe.end})+"): it’s not open");I.position.end=Ta(fe.end)}function d(){return US(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(fe){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function x(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=fe}function k(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=fe}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe.replace(/(\r?\n|\r)$/g,"")}function V(fe){const ge=this.resume(),I=this.stack[this.stack.length-1];I.label=ge,I.identifier=Ii(this.sliceSerialize(fe)).toLowerCase()}function F(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=fe}function K(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=fe}function L(fe){const ge=this.stack[this.stack.length-1];if(!ge.depth){const I=this.sliceSerialize(fe).length;ge.depth=I}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function _(fe){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function J(){this.data.setextHeadingSlurpLineEnding=void 0}function $(fe){const I=this.stack[this.stack.length-1].children;let ze=I[I.length-1];(!ze||ze.type!=="text")&&(ze=Be(),ze.position={start:Ta(fe.start),end:void 0},I.push(ze)),this.stack.push(ze)}function H(fe){const ge=this.stack.pop();ge.value+=this.sliceSerialize(fe),ge.position.end=Ta(fe.end)}function ue(fe){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const I=ge.children[ge.children.length-1];I.position.end=Ta(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(ge.type)&&($.call(this,fe),H.call(this,fe))}function ae(){this.data.atHardBreak=!0}function Se(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe}function Ee(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe}function Y(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe}function X(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ge,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function le(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ge,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function Ce(fe){const ge=this.sliceSerialize(fe),I=this.stack[this.stack.length-2];I.label=tO(ge),I.identifier=Ii(ge).toLowerCase()}function _e(){const fe=this.stack[this.stack.length-1],ge=this.resume(),I=this.stack[this.stack.length-1];if(this.data.inReference=!0,I.type==="link"){const ze=fe.children;I.children=ze}else I.alt=ge}function j(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=fe}function P(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=fe}function te(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function xe(fe){const ge=this.resume(),I=this.stack[this.stack.length-1];I.label=ge,I.identifier=Ii(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function Te(fe){this.data.characterReferenceType=fe.type}function Ae(fe){const ge=this.sliceSerialize(fe),I=this.data.characterReferenceType;let ze;I?(ze=HM(ge,I==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ze=Th(ge);const Je=this.stack[this.stack.length-1];Je.value+=ze}function qe(fe){const ge=this.stack.pop();ge.position.end=Ta(fe.end)}function pt(fe){H.call(this,fe);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(fe)}function Ke(fe){H.call(this,fe);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(fe)}function Pt(){return{type:"blockquote",children:[]}}function Ot(){return{type:"code",lang:null,meta:null,value:""}}function fr(){return{type:"inlineCode",value:""}}function hr(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function hn(){return{type:"emphasis",children:[]}}function pn(){return{type:"heading",depth:0,children:[]}}function pr(){return{type:"break"}}function dn(){return{type:"html",value:""}}function mn(){return{type:"image",title:null,url:"",alt:null}}function dr(){return{type:"link",title:null,url:"",children:[]}}function he(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function je(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function Dt(){return{type:"paragraph",children:[]}}function mt(){return{type:"strong",children:[]}}function Be(){return{type:"text",value:""}}function gn(){return{type:"thematicBreak"}}}function Ta(t){return{line:t.line,column:t.column,offset:t.offset}}function rO(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?rO(t,r):N8(t,r)}}function N8(t,e){let n;for(n in e)if(nO.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 oA(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Ls({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Ls({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Ls({start:e.start,end:e.end})+") is still open")}function qm(t){const e=this;e.parser=n;function n(r){return E8(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}const lA={}.hasOwnProperty;function T8(t,e){const n=e||{};function r(i,...s){let a=r.invalid;const u=r.handlers;if(i&&lA.call(i,t)){const c=String(i[t]);a=lA.call(u,c)?u[c]:r.unknown}if(a)return a.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const M8={}.hasOwnProperty;function iO(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)iO(t,e.extensions[n]);for(r in e)if(M8.call(e,r))switch(r){case"extensions":break;case"unsafe":{uA(t[r],e[r]);break}case"join":{uA(t[r],e[r]);break}case"handlers":{O8(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function uA(t,e){e&&t.push(...e)}function O8(t,e){e&&Object.assign(t,e)}function R8(t,e,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const a=n.indentLines(n.containerFlow(t,s.current()),D8);return i(),a}function D8(t,e,n){return">"+(n?"":" ")+t}function sO(t,e){return cA(t,e.inConstruct,!0)&&!cA(t,e.notInConstruct,!1)}function cA(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 fA(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
5
+ `&&sO(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
6
+ `}function I8(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,a=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>a&&(a=s):s=1,i=r+e.length,r=n.indexOf(e,i);return a}function fb(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 _8(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 z8(t,e,n,r){const i=_8(n),s=t.value||"",a=i==="`"?"GraveAccent":"Tilde";if(fb(t,n)){const g=n.enter("codeIndented"),y=n.indentLines(s,L8);return g(),y}const u=n.createTracker(r),c=i.repeat(Math.max(I8(s,i)+1,3)),h=n.enter("codeFenced");let d=u.move(c);if(t.lang){const g=n.enter(`codeFencedLang${a}`);d+=u.move(n.safe(t.lang,{before:d,after:" ",encode:["`"],...u.current()})),g()}if(t.lang&&t.meta){const g=n.enter(`codeFencedMeta${a}`);d+=u.move(" "),d+=u.move(n.safe(t.meta,{before:d,after:`
7
+ `,encode:["`"],...u.current()})),g()}return d+=u.move(`
8
+ `),s&&(d+=u.move(s+`
9
+ `)),d+=u.move(c),h(),d}function L8(t,e,n){return(n?"":" ")+t}function KS(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 B8(t,e,n,r){const i=KS(n),s=i==='"'?"Quote":"Apostrophe",a=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()),a(),h}function F8(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 Ga(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Km(t,e,n){const r=Hu(t),i=Hu(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}}aO.peek=V8;function aO(t,e,n,r){const i=F8(n),s=n.enter("emphasis"),a=n.createTracker(r),u=a.move(i);let c=a.move(n.containerPhrasing(t,{after:i,before:u,...a.current()}));const h=c.charCodeAt(0),d=Km(r.before.charCodeAt(r.before.length-1),h,i);d.inside&&(c=Ga(h)+c.slice(1));const g=c.charCodeAt(c.length-1),y=Km(r.after.charCodeAt(0),g,i);y.inside&&(c=c.slice(0,-1)+Ga(g));const x=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:d.outside},u+c+x}function V8(t,e,n){return n.options.emphasis||"*"}const qg=(function(t){if(t==null)return J8;if(typeof t=="function")return Kg(t);if(typeof t=="object")return Array.isArray(t)?P8(t):j8(t);if(typeof t=="string")return $8(t);throw new Error("Expected function, string, or object as test")});function P8(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=qg(t[n]);return Kg(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function j8(t){const e=t;return Kg(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function $8(t){return Kg(e);function e(n){return n&&n.type===t}}function Kg(t){return e;function e(n,r,i){return!!(U8(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function J8(){return!0}function U8(t){return t!==null&&typeof t=="object"&&"type"in t}const oO=[],H8=!0,hb=!1,pb="skip";function ec(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=qg(i),a=r?-1:1;u(t,void 0,[])();function u(c,h,d){const g=c&&typeof c=="object"?c:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(c.type+(x?"<"+x+">":""))+")"})}return y;function y(){let x=oO,k,w,N;if((!e||s(c,h,d[d.length-1]||void 0))&&(x=q8(n(c,d)),x[0]===hb))return x;if("children"in c&&c.children){const T=c;if(T.children&&x[0]!==pb)for(w=(r?T.children.length:-1)+a,N=d.concat(T);w>-1&&w<T.children.length;){const V=T.children[w];if(k=u(V,w,N)(),k[0]===hb)return k;w=typeof k[1]=="number"?k[1]:w+a}}return x}}}function q8(t){return Array.isArray(t)?t:typeof t=="number"?[H8,t]:t==null?oO:[t]}function K8(t,e,n,r){let i,s,a;typeof e=="function"&&typeof n!="function"?(s=void 0,a=e,i=n):(s=e,a=n,i=r),ec(t,s,u,i);function u(c,h){const d=h[h.length-1],g=d?d.children.indexOf(c):void 0;return a(c,g,d)}}function lO(t,e){let n=!1;return K8(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,hb}),!!((!t.depth||t.depth<3)&&US(t)&&(e.options.setext||n))}function G8(t,e,n,r){const i=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(r);if(lO(t,n)){const d=n.enter("headingSetext"),g=n.enter("phrasing"),y=n.containerPhrasing(t,{...s.current(),before:`
11
+ `,after:`
12
+ `});return g(),d(),y+`
13
+ `+(i===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
14
+ `))+1))}const a="#".repeat(i),u=n.enter("headingAtx"),c=n.enter("phrasing");s.move(a+" ");let h=n.containerPhrasing(t,{before:"# ",after:`
15
+ `,...s.current()});return/^[\t ]/.test(h)&&(h=Ga(h.charCodeAt(0))+h.slice(1)),h=h?a+" "+h:a,n.options.closeAtx&&(h+=" "+a),c(),u(),h}uO.peek=Y8;function uO(t){return t.value||""}function Y8(){return"<"}cO.peek=W8;function cO(t,e,n,r){const i=KS(n),s=i==='"'?"Quote":"Apostrophe",a=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(")"),a(),h}function W8(){return"!"}fO.peek=X8;function fO(t,e,n,r){const i=t.referenceType,s=n.enter("imageReference");let a=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+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const g=n.safe(n.associationId(t),{before:c,after:"]",...u.current()});return a(),n.stack=d,s(),i==="full"||!h||h!==g?c+=u.move(g+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function X8(){return"!"}hO.peek=Q8;function hO(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 a=n.unsafe[s],u=n.compilePattern(a);let c;if(a.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 Q8(){return"`"}function pO(t,e){const n=US(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))}dO.peek=Z8;function dO(t,e,n,r){const i=KS(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,c;if(pO(t,n)){const d=n.stack;n.stack=[],u=n.enter("autolink");let g=a.move("<");return g+=a.move(n.containerPhrasing(t,{before:g,after:">",...a.current()})),g+=a.move(">"),u(),n.stack=d,g}u=n.enter("link"),c=n.enter("label");let h=a.move("[");return h+=a.move(n.containerPhrasing(t,{before:h,after:"](",...a.current()})),h+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=a.move("<"),h+=a.move(n.safe(t.url,{before:h,after:">",...a.current()})),h+=a.move(">")):(c=n.enter("destinationRaw"),h+=a.move(n.safe(t.url,{before:h,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${s}`),h+=a.move(" "+i),h+=a.move(n.safe(t.title,{before:h,after:i,...a.current()})),h+=a.move(i),c()),h+=a.move(")"),u(),h}function Z8(t,e,n){return pO(t,n)?"<":"["}mO.peek=eB;function mO(t,e,n,r){const i=t.referenceType,s=n.enter("linkReference");let a=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+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const g=n.safe(n.associationId(t),{before:c,after:"]",...u.current()});return a(),n.stack=d,s(),i==="full"||!h||h!==g?c+=u.move(g+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function eB(){return"["}function GS(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 tB(t){const e=GS(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 nB(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 gO(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 rB(t,e,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=t.ordered?nB(n):GS(n);const u=t.ordered?a==="."?")":".":tB(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const d=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.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),gO(n)===a&&d){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&&(a=u),n.bulletCurrent=a;const h=n.containerFlow(t,r);return n.bulletLastUsed=a,n.bulletCurrent=s,i(),h}function iB(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 sB(t,e,n,r){const i=iB(n);let s=n.bulletCurrent||GS(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 a=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const u=n.createTracker(r);u.move(s+" ".repeat(a-s.length)),u.shift(a);const c=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,u.current()),d);return c(),h;function d(g,y,x){return y?(x?"":" ".repeat(a))+g:(x?s:s+" ".repeat(a-s.length))+g}}function aB(t,e,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(t,r);return s(),i(),a}const oB=qg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function lB(t,e,n,r){return(t.children.some(function(a){return oB(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function uB(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}yO.peek=cB;function yO(t,e,n,r){const i=uB(n),s=n.enter("strong"),a=n.createTracker(r),u=a.move(i+i);let c=a.move(n.containerPhrasing(t,{after:i,before:u,...a.current()}));const h=c.charCodeAt(0),d=Km(r.before.charCodeAt(r.before.length-1),h,i);d.inside&&(c=Ga(h)+c.slice(1));const g=c.charCodeAt(c.length-1),y=Km(r.after.charCodeAt(0),g,i);y.inside&&(c=c.slice(0,-1)+Ga(g));const x=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:y.outside,before:d.outside},u+c+x}function cB(t,e,n){return n.options.strong||"*"}function fB(t,e,n,r){return n.safe(t.value,r)}function hB(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 pB(t,e,n){const r=(gO(n)+(n.options.ruleSpaces?" ":"")).repeat(hB(n));return n.options.ruleSpaces?r.slice(0,-1):r}const YS={blockquote:R8,break:fA,code:z8,definition:B8,emphasis:aO,hardBreak:fA,heading:G8,html:uO,image:cO,imageReference:fO,inlineCode:hO,link:dO,linkReference:mO,list:rB,listItem:sB,paragraph:aB,root:lB,strong:yO,text:fB,thematicBreak:pB},dB=[mB];function mB(t,e,n,r){if(e.type==="code"&&fb(e,r)&&(t.type==="list"||t.type===e.type&&fb(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"&&lO(e,r))?void 0:n.spread?1:0}const Oo=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],gB=[{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:Oo},{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:Oo},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
18
+ *])`},{character:"*",inConstruct:"phrasing",notInConstruct:Oo},{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:Oo},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:Oo},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:Oo},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:Oo},{atBreak:!0,character:"~"}];function yB(t){return t.label||!t.identifier?t.label||"":tO(t.identifier)}function xB(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 bB(t,e,n){const r=e.indexStack,i=t.children||[],s=[];let a=-1,u=n.before,c;r.push(-1);let h=e.createTracker(n);for(;++a<i.length;){const d=i[a];let g;if(r[r.length-1]=a,a+1<i.length){let k=e.handle.handlers[i[a+1].type];k&&k.peek&&(k=k.peek),g=k?k(i[a+1],t,e,{before:"",after:"",...h.current()}).charAt(0):""}else g=n.after;s.length>0&&(u==="\r"||u===`
22
+ `)&&d.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(d,t,e,{...h.current(),after:g,before:u});c&&c===y.slice(0,1)&&(y=Ga(c.charCodeAt(0))+y.slice(1));const x=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,c=void 0,x&&(s.length>0&&x.before&&u===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+Ga(u.charCodeAt(0))),x.after&&(c=g)),h.move(y),s.push(y),u=y.slice(-1)}return r.pop(),s.join("")}function SB(t,e,n){const r=e.indexStack,i=t.children||[],s=e.createTracker(n),a=[];let u=-1;for(r.push(-1);++u<i.length;){const c=i[u];r[r.length-1]=u,a.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&&a.push(s.move(vB(c,i[u+1],t,e)))}return r.pop(),a.join("")}function vB(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 kB=/\r?\n|\r/g;function CB(t,e){const n=[];let r=0,i=0,s;for(;s=kB.exec(t);)a(t.slice(r,s.index)),n.push(s[0]),r=s.index+s[0].length,i++;return a(t.slice(r)),n.join("");function a(u){n.push(e(u,i,!u))}}function wB(t,e,n){const r=(n.before||"")+(e||"")+(n.after||""),i=[],s=[],a={};let u=-1;for(;++u<t.unsafe.length;){const d=t.unsafe[u];if(!sO(t.stack,d))continue;const g=t.compilePattern(d);let y;for(;y=g.exec(r);){const x="before"in d||!!d.atBreak,k="after"in d,w=y.index+(x?y[1].length:0);i.includes(w)?(a[w].before&&!x&&(a[w].before=!1),a[w].after&&!k&&(a[w].after=!1)):(i.push(w),a[w]={before:x,after:k})}}i.sort(EB);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 d=i[u];d<c||d>=h||d+1<h&&i[u+1]===d+1&&a[d].after&&!a[d+1].before&&!a[d+1].after||i[u-1]===d-1&&a[d].before&&!a[d-1].before&&!a[d-1].after||(c!==d&&s.push(hA(r.slice(c,d),"\\")),c=d,/[!-/:-@[-`{-~]/.test(r.charAt(d))&&(!n.encode||!n.encode.includes(r.charAt(d)))?s.push("\\"):(s.push(Ga(r.charCodeAt(d))),c++))}return s.push(hA(r.slice(c,h),n.after)),s.join("")}function EB(t,e){return t-e}function hA(t,e){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],s=t+e;let a=-1,u=0,c;for(;c=n.exec(s);)r.push(c.index);for(;++a<r.length;)u!==r[a]&&i.push(t.slice(u,r[a])),i.push("\\"),u=r[a];return i.push(t.slice(u)),i.join("")}function AB(t){const e=t||{},n=e.now||{};let r=e.lineShift||0,i=n.line||1,s=n.column||1;return{move:c,current:a,shift:u};function a(){return{now:{line:i,column:s},lineShift:r}}function u(h){r+=h}function c(h){const d=h||"",g=d.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,d}}function NB(t,e){const n=e||{},r={associationId:yB,containerPhrasing:RB,containerFlow:DB,createTracker:AB,compilePattern:xB,enter:s,handlers:{...YS},handle:void 0,indentLines:CB,indexStack:[],join:[...dB],options:{},safe:IB,stack:[],unsafe:[...gB]};iO(r,n),r.options.tightDefinitions&&r.join.push(OB),r.handle=T8("type",{invalid:TB,unknown:MB,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(a){return r.stack.push(a),u;function u(){r.stack.pop()}}}function TB(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function MB(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function OB(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function RB(t,e){return bB(t,this,e)}function DB(t,e){return SB(t,this,e)}function IB(t,e){return wB(this,t,e)}function db(t){const e=this;e.compiler=n;function n(r){return NB(r,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}function pA(t){if(t)throw t}var Dx,dA;function _B(){if(dA)return Dx;dA=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 d=t.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!d&&!g)return!1;var y;for(y in h);return typeof y>"u"||t.call(h,y)},a=function(h,d){n&&d.name==="__proto__"?n(h,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):h[d.name]=d.newValue},u=function(h,d){if(d==="__proto__")if(t.call(h,d)){if(r)return r(h,d).value}else return;return h[d]};return Dx=function c(){var h,d,g,y,x,k,w=arguments[0],N=1,T=arguments.length,V=!1;for(typeof w=="boolean"&&(V=w,w=arguments[1]||{},N=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});N<T;++N)if(h=arguments[N],h!=null)for(d in h)g=u(w,d),y=u(h,d),w!==y&&(V&&y&&(s(y)||(x=i(y)))?(x?(x=!1,k=g&&i(g)?g:[]):k=g&&s(g)?g:{},a(w,{name:d,newValue:c(V,k,y)})):typeof y<"u"&&a(w,{name:d,newValue:y}));return w},Dx}var zB=_B();const Ix=DM(zB);function mb(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 LB(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);u(null,...i);function u(c,...h){const d=t[++s];let g=-1;if(c){a(c);return}for(;++g<i.length;)(h[g]===null||h[g]===void 0)&&(h[g]=i[g]);i=h,d?BB(d,u)(...h):a(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 BB(t,e){let n;return r;function r(...a){const u=t.length>a.length;let c;u&&a.push(i);try{c=t.apply(this,a)}catch(h){const d=h;if(u&&n)throw d;return i(d)}u||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(a,...u){n||(n=!0,e(a,...u))}function s(a){i(null,a)}}class bt extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!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&&(a=!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=Ls(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=a&&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}}bt.prototype.file="";bt.prototype.name="";bt.prototype.reason="";bt.prototype.message="";bt.prototype.stack="";bt.prototype.column=void 0;bt.prototype.line=void 0;bt.prototype.ancestors=void 0;bt.prototype.cause=void 0;bt.prototype.fatal=void 0;bt.prototype.place=void 0;bt.prototype.ruleId=void 0;bt.prototype.source=void 0;const Ji={basename:FB,dirname:VB,extname:PB,join:jB,sep:"/"};function FB(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');lp(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 a=-1,u=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),u>-1&&(t.codePointAt(i)===e.codePointAt(u--)?u<0&&(r=i):(u=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function VB(t){if(lp(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 PB(t){lp(t);let e=t.length,n=-1,r=0,i=-1,s=0,a;for(;e--;){const u=t.codePointAt(e);if(u===47){if(a){r=e+1;break}continue}n<0&&(a=!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 jB(...t){let e=-1,n;for(;++e<t.length;)lp(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":$B(n)}function $B(t){lp(t);const e=t.codePointAt(0)===47;let n=JB(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function JB(t,e){let n="",r=0,i=-1,s=0,a=-1,u,c;for(;++a<=t.length;){if(a<t.length)u=t.codePointAt(a);else{if(u===47)break;u=47}if(u===47){if(!(i===a-1||s===1))if(i!==a-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=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,s=0}else u===46&&s>-1?s++:s=-1}return n}function lp(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const UB={cwd:HB};function HB(){return"/"}function gb(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function qB(t){if(typeof t=="string")t=new URL(t);else if(!gb(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 KB(t)}function KB(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 _x=["history","path","basename","stem","extname","dirname"];class GB{constructor(e){let n;e?gb(e)?n={path:e}:typeof e=="string"||YB(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":UB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<_x.length;){const s=_x[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)_x.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ji.basename(this.path):void 0}set basename(e){Lx(e,"basename"),zx(e,"basename"),this.path=Ji.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Ji.dirname(this.path):void 0}set dirname(e){mA(this.basename,"dirname"),this.path=Ji.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Ji.extname(this.path):void 0}set extname(e){if(zx(e,"extname"),mA(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=Ji.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){gb(e)&&(e=qB(e)),Lx(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Ji.basename(this.path,this.extname):void 0}set stem(e){Lx(e,"stem"),zx(e,"stem"),this.path=Ji.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 bt(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 zx(t,e){if(t&&t.includes(Ji.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Ji.sep+"`")}function Lx(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function mA(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function YB(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const WB=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),XB={}.hasOwnProperty;class WS extends WB{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=LB()}copy(){const e=new WS;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(Ix(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Vx("data",this.frozen),this.namespace[e]=n,this):XB.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Vx("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=Gd(e),r=this.parser||this.Parser;return Bx("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Bx("process",this.parser||this.Parser),Fx("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const u=Gd(e),c=r.parse(u);r.run(c,u,function(d,g,y){if(d||!g||!y)return h(d);const x=g,k=r.stringify(x,y);ZB(k)?y.value=k:y.result=k,h(d,y)});function h(d,g){d||!g?a(d):s?s(g):n(void 0,g)}}}processSync(e){let n=!1,r;return this.freeze(),Bx("processSync",this.parser||this.Parser),Fx("processSync",this.compiler||this.Compiler),this.process(e,i),yA("processSync","process",n),r;function i(s,a){n=!0,pA(s),r=a}}run(e,n,r){gA(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(a,u){const c=Gd(n);i.run(e,c,h);function h(d,g,y){const x=g||e;d?u(d):a?a(x):r(void 0,x,y)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),yA("runSync","run",r),i;function s(a,u){pA(a),i=u,r=!0}}stringify(e,n){this.freeze();const r=Gd(n),i=this.compiler||this.Compiler;return Fx("stringify",i),gA(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(Vx("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?u(e):a(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[d,...g]=h;c(d,g)}else a(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function a(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=Ix(!0,i.settings,h.settings))}function u(h){let d=-1;if(h!=null)if(Array.isArray(h))for(;++d<h.length;){const g=h[d];s(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function c(h,d){let g=-1,y=-1;for(;++g<r.length;)if(r[g][0]===h){y=g;break}if(y===-1)r.push([h,...d]);else if(d.length>0){let[x,...k]=d;const w=r[y][1];mb(w)&&mb(x)&&(x=Ix(!0,w,x)),r[y]=[h,x,...k]}}}}const Gm=new WS().freeze();function Bx(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Fx(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Vx(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 gA(t){if(!mb(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function yA(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Gd(t){return QB(t)?t:new GB(t)}function QB(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ZB(t){return typeof t=="string"||eF(t)}function eF(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function wn(t){this.content=t}wn.prototype={constructor:wn,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 wn(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 wn(n)},addToStart:function(t,e){return new wn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new wn(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 wn(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=wn.from(t),t.size?new wn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=wn.from(t),t.size?new wn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=wn.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}};wn.from=function(t){if(t instanceof wn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new wn(e)};function xO(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 a=0;i.text[a]==s.text[a];a++)n++;return n}if(i.content.size||s.content.size){let a=xO(i.content,s.content,n+1);if(a!=null)return a}n+=i.nodeSize}}function bO(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 a=t.child(--i),u=e.child(--s),c=a.nodeSize;if(a==u){n-=c,r-=c;continue}if(!a.sameMarkup(u))return{a:n,b:r};if(a.isText&&a.text!=u.text){let h=0,d=Math.min(a.text.length,u.text.length);for(;h<d&&a.text[a.text.length-h-1]==u.text[u.text.length-h-1];)h++,n--,r--;return{a:n,b:r}}if(a.content.size||u.content.size){let h=bO(a.content,u.content,n-1,r-1);if(h)return h}n-=c,r-=c}}class W{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 a=0,u=0;u<n;a++){let c=this.content[a],h=u+c.nodeSize;if(h>e&&r(c,i+u,s||null,a)!==!1&&c.content.size){let d=u+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,n-d),r,i+d)}u=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",a=!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&&(a?a=!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 W(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,a=0;a<n;s++){let u=this.content[s],c=a+u.nodeSize;c>e&&((a<e||c>n)&&(u.isText?u=u.cut(Math.max(0,e-a),Math.min(u.text.length,n-a)):u=u.cut(Math.max(0,e-a-1),Math.min(u.content.size,n-a-1))),r.push(u),i+=u.nodeSize),a=c}return new W(r,i)}cutByIndex(e,n){return e==n?W.empty:e==0&&n==this.content.length?this:new W(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 W(i,s)}addToStart(e){return new W([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new W(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 xO(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return bO(this,e,n,r)}findIndex(e){if(e==0)return Yd(0,e);if(e==this.size)return Yd(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?Yd(n+1,s):Yd(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 W.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new W(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return W.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 W(n||e,r)}static from(e){if(!e)return W.empty;if(e instanceof W)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new W([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}W.empty=new W([],0);const Px={index:0,offset:0};function Yd(t,e){return Px.index=t,Px.offset=e,Px}function Ym(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(!Ym(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ym(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class ht{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&&Ym(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 ht.none;if(e instanceof ht)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}}ht.none=[];class hi extends Error{}class q{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=vO(this.content,e+this.openStart,n);return r&&new q(r,this.openStart,this.openEnd)}removeBetween(e,n){return new q(SO(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 q.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 q(W.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 q(e,r,i)}}q.empty=new q(W.empty,0,0);function SO(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:a,offset:u}=t.findIndex(n);if(i==e||s.isText){if(u!=n&&!t.child(a).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=a)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(SO(s.content,e-i-1,n-i-1)))}function vO(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),a=t.maybeChild(i);if(s==e||a.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=vO(a.content,e-s-1,n,a);return u&&t.replaceChild(i,a.copy(u))}function tF(t,e,n){if(n.openStart>t.depth)throw new hi("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new hi("Inconsistent open depths");return kO(t,e,n,0)}function kO(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let a=kO(t,e,n,r+1);return s.copy(s.content.replaceChild(i,a))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let a=t.parent,u=a.content;return Wo(a,u.cut(0,t.parentOffset).append(n.content).append(u.cut(e.parentOffset)))}else{let{start:a,end:u}=nF(n,t);return Wo(s,wO(t,a,u,e,r))}else return Wo(s,Wm(t,e,r))}function CO(t,e){if(!e.type.compatibleContent(t.type))throw new hi("Cannot join "+e.type.name+" onto "+t.type.name)}function yb(t,e,n){let r=t.node(n);return CO(r,e.node(n)),r}function Yo(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 ih(t,e,n,r){let i=(e||t).node(n),s=0,a=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Yo(t.nodeAfter,r),s++));for(let u=s;u<a;u++)Yo(i.child(u),r);e&&e.depth==n&&e.textOffset&&Yo(e.nodeBefore,r)}function Wo(t,e){return t.type.checkContent(e),t.copy(e)}function wO(t,e,n,r,i){let s=t.depth>i&&yb(t,e,i+1),a=r.depth>i&&yb(n,r,i+1),u=[];return ih(null,t,i,u),s&&a&&e.index(i)==n.index(i)?(CO(s,a),Yo(Wo(s,wO(t,e,n,r,i+1)),u)):(s&&Yo(Wo(s,Wm(t,e,i+1)),u),ih(e,n,i,u),a&&Yo(Wo(a,Wm(n,r,i+1)),u)),ih(r,null,i,u),new W(u)}function Wm(t,e,n){let r=[];if(ih(null,t,n,r),t.depth>n){let i=yb(t,e,n+1);Yo(Wo(i,Wm(t,e,n+1)),r)}return ih(e,null,n,r),new W(r)}function nF(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(W.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Mh{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 ht.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 a=0;a<s.length;a++)s[a].type.spec.inclusive===!1&&(!i||!s[a].isInSet(i.marks))&&(s=s[a--].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 EO(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 a=e;;){let{index:u,offset:c}=a.content.findIndex(s),h=s-c;if(r.push(a,u,i+c),!h||(a=a.child(u),a.isText))break;s=h-1,i+=c+1}return new Mh(n,r,s)}static resolveCached(e,n){let r=xA.get(e);if(r)for(let s=0;s<r.elts.length;s++){let a=r.elts[s];if(a.pos==n)return a}else xA.set(e,r=new rF);let i=r.elts[r.i]=Mh.resolve(e,n);return r.i=(r.i+1)%iF,i}}class rF{constructor(){this.elts=[],this.i=0}}const iF=12,xA=new WeakMap;class EO{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 sF=Object.create(null);let Fs=class xb{constructor(e,n,r,i=ht.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||W.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&&Ym(this.attrs,n||e.defaultAttrs||sF)&&ht.sameSet(this.marks,r||ht.none)}copy(e=null){return e==this.content?this:new xb(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new xb(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 q.empty;let i=this.resolve(e),s=this.resolve(n),a=r?0:i.sharedDepth(n),u=i.start(a),h=i.node(a).content.cut(i.pos-u,s.pos-u);return new q(h,i.depth-a,s.depth-a)}replace(e,n,r){return tF(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 Mh.resolveCached(this,e)}resolveNoCache(e){return Mh.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()+")"),AO(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=W.empty,i=0,s=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,s),u=a&&a.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),a=s&&s.matchFragment(this.content,n);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ht.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(!ht.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=W.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Fs.prototype.text=void 0;class Xm extends Fs{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):AO(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 Xm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xm(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 AO(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class fl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new aF(e,n);if(r.next==null)return fl.empty;let i=NO(r);r.next&&r.err("Unexpected trailing text");let s=pF(hF(i));return dF(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(a,u){let c=a.matchFragment(e,r);if(c&&(!n||c.validEnd))return W.from(u.map(h=>h.createAndFill()));for(let h=0;h<a.next.length;h++){let{type:d,next:g}=a.next[h];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(g)==-1){i.push(g);let y=s(g,u.concat(d));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 a=[];for(let u=i;u.type;u=u.via)a.push(u.type);return a.reverse()}for(let a=0;a<s.next.length;a++){let{type:u,next:c}=s.next[a];!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 a=0;a<r.next.length;a++)s+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return s}).join(`
35
+ `)}}fl.empty=new fl(!0);class aF{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 NO(t){let e=[];do e.push(oF(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function oF(t){let e=[];do e.push(lF(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function lF(t){let e=fF(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=uF(t,e);else break;return e}function bA(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function uF(t,e){let n=bA(t),r=n;return t.eat(",")&&(t.next!="}"?r=bA(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function cF(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let a=n[s];a.isInGroup(e)&&i.push(a)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function fF(t){if(t.eat("(")){let e=NO(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=cF(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 hF(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(a,u,c){let h={term:c,to:u};return e[a].push(h),h}function i(a,u){a.forEach(c=>c.to=u)}function s(a,u){if(a.type=="choice")return a.exprs.reduce((c,h)=>c.concat(s(h,u)),[]);if(a.type=="seq")for(let c=0;;c++){let h=s(a.exprs[c],u);if(c==a.exprs.length-1)return h;i(h,u=n())}else if(a.type=="star"){let c=n();return r(u,c),i(s(a.expr,c),c),[r(c)]}else if(a.type=="plus"){let c=n();return i(s(a.expr,u),c),i(s(a.expr,c),c),[r(c)]}else{if(a.type=="opt")return[r(u)].concat(s(a.expr,u));if(a.type=="range"){let c=u;for(let h=0;h<a.min;h++){let d=n();i(s(a.expr,c),d),c=d}if(a.max==-1)i(s(a.expr,c),c);else for(let h=a.min;h<a.max;h++){let d=n();r(c,d),i(s(a.expr,c),d),c=d}return[r(c)]}else{if(a.type=="name")return[r(u,void 0,a.value)];throw new Error("Unknown expr type")}}}}function TO(t,e){return e-t}function SA(t,e){let n=[];return r(e),n.sort(TO);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let a=0;a<s.length;a++){let{term:u,to:c}=s[a];!u&&n.indexOf(c)==-1&&r(c)}}}function pF(t){let e=Object.create(null);return n(SA(t,0));function n(r){let i=[];r.forEach(a=>{t[a].forEach(({term:u,to:c})=>{if(!u)return;let h;for(let d=0;d<i.length;d++)i[d][0]==u&&(h=i[d][1]);SA(t,c).forEach(d=>{h||i.push([u,h=[]]),h.indexOf(d)==-1&&h.push(d)})})});let s=e[r.join(",")]=new fl(r.indexOf(t.length-1)>-1);for(let a=0;a<i.length;a++){let u=i[a][1].sort(TO);s.next.push({type:i[a][0],next:e[u.join(",")]||n(u)})}return s}}function dF(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,a=[];for(let u=0;u<i.next.length;u++){let{type:c,next:h}=i.next[u];a.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(h)==-1&&r.push(h)}s&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function MO(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 OO(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 RO(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 DO(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new gF(t,r,e[r]);return n}let Qm=class IO{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=DO(e,r.attrs),this.defaultAttrs=MO(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==fl.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:OO(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Fs(this,this.computeAttrs(e),W.from(n),ht.setFrom(r))}createChecked(e=null,n,r){return n=W.from(n),this.checkContent(n),new Fs(this,this.computeAttrs(e),n,ht.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=W.from(n),n.size){let a=this.contentMatch.fillBefore(n);if(!a)return null;n=a.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(W.empty,!0);return s?new Fs(this,e,n.append(s),ht.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){RO(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:ht.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,a)=>r[s]=new IO(s,n,a));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 mF(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 gF{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?mF(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class up{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=DO(e,i.attrs),this.excluded=null;let s=MO(this.attrs);this.instance=s?new ht(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ht(this,OO(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,a)=>r[s]=new up(s,i++,n,a)),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){RO(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class yF{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=wn.from(e.nodes),n.marks=wn.from(e.marks||{}),this.nodes=Qm.compile(this.spec.nodes,this),this.marks=up.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],a=s.spec.content||"",u=s.spec.marks;if(s.contentMatch=r[a]||(r[a]=fl.parse(a,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?vA(this,u.split(" ")):u==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],a=s.spec.excludes;s.excluded=a==null?[s]:a==""?[]:vA(this,a.split(" "))}this.nodeFromJSON=i=>Fs.fromJSON(this,i),this.markFromJSON=i=>ht.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 Qm){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 Xm(r,r.defaultAttrs,e,ht.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 vA(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],a=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(a=c)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function xF(t){return t.tag!=null}function bF(t){return t.style!=null}class Ya{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(xF(i))this.tags.push(i);else if(bF(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 CA(this,n,!1);return r.addAll(e,ht.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new CA(this,n,!0);return r.addAll(e,ht.none,n.from,n.to),q.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(kF(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let a=s.getAttrs(e);if(a===!1)continue;s.attrs=a||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 a=this.styles[s],u=a.style;if(!(u.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||u.length>e.length&&(u.charCodeAt(e.length)!=61||u.slice(e.length+1)!=n))){if(a.getAttrs){let c=a.getAttrs(n);if(c===!1)continue;a.attrs=c||void 0}return a}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,a=0;for(;a<n.length;a++){let u=n[a];if((u.priority==null?50:u.priority)<s)break}n.splice(a,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(a=>{r(a=wA(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(a=>{r(a=wA(a)),a.node||a.ignore||a.mark||(a.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ya(e,Ya.schemaRules(e)))}}const _O={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},SF={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},zO={ol:!0,ul:!0},Oh=1,bb=2,sh=4;function kA(t,e,n){return e!=null?(e?Oh:0)|(e==="full"?bb:0):t&&t.whitespace=="pre"?Oh|bb:n&~sh}class Wd{constructor(e,n,r,i,s,a){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=ht.none,this.match=s||(a&sh?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(W.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&Oh)){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=W.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(W.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&&!_O.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class CA{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,a=kA(null,n.preserveWhitespace,0)|(r?sh:0);i?s=new Wd(i.type,i.attrs,ht.none,!0,n.topMatch||i.type.contentMatch,a):r?s=new Wd(null,null,ht.none,!0,null,a):s=new Wd(e.schema.topNodeType,null,ht.none,!0,null,a),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&bb?"full":this.localPreserveWS||(i.options&Oh)>0,{schema:a}=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(a.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(a.linebreakReplacement.create())){let u=r.split(/\r?\n|\r/);for(let c=0;c<u.length;c++)c&&this.insertNode(a.linebreakReplacement.create(),n,!0),u[c]&&this.insertNode(a.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(a.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 a=e.nodeName.toLowerCase(),u;zO.hasOwnProperty(a)&&this.parser.normalizeLists&&vF(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,r));e:if(c?c.ignore:SF.hasOwnProperty(a))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,d=this.needsBlock;if(_O.hasOwnProperty(a))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=d}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],a=r.getPropertyValue(s);if(a)for(let u=void 0;;){let c=this.parser.matchStyle(s,a,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,a;if(n.node)if(a=this.parser.schema.nodes[n.node],a.isLeaf)this.insertNode(a.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(a,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(a&&a.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 a=r?e.childNodes[r]:e.firstChild,u=i==null?null:e.childNodes[i];a!=u;a=a.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(a,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let a=this.open,u=0;a>=0;a--){let c=this.nodes[a],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 a=0;a<i.length;a++)n=this.enterInner(i[a],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 a=ht.none;for(let u of i.concat(e.marks))(s.type?s.type.allowsMarkType(u.type):EA(u.type,e.type))&&(a=u.addToSet(a));return s.content.push(e.mark(a)),!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 a=this.top;a.match=a.match&&a.match.matchType(e);let u=kA(e,s,a.options);a.options&sh&&a.content.length==0&&(u|=sh);let c=ht.none;return r=r.filter(h=>(a.type?a.type.allowsMarkType(h.type):EA(h.type,e))?(c=h.addToSet(c),!1):!0),this.nodes.push(new Wd(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|=Oh)}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),a=(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(a(u-1,c))return!0;return!1}else{let d=c>0||c==0&&i?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!d||d.name!=h&&!d.isInGroup(h))return!1;c--}}return!0};return a(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 vF(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&zO.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function kF(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function wA(t){let e={};for(let n in t)e[n]=t[n];return e}function EA(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],a=u=>{s.push(u);for(let c=0;c<u.edgeCount;c++){let{type:h,next:d}=u.edge(c);if(h==e||s.indexOf(d)<0&&a(d))return!0}};if(a(i.contentMatch))return!0}}class rs{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=jx(n).createDocumentFragment());let i=r,s=[];return e.forEach(a=>{if(s.length||a.marks.length){let u=0,c=0;for(;u<s.length&&c<a.marks.length;){let h=a.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<a.marks.length;){let h=a.marks[c++],d=this.serializeMark(h,a.isInline,n);d&&(s.push([h,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(a,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=sm(jx(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&&sm(jx(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return sm(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new rs(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=AA(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return AA(e.marks)}}function AA(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function jx(t){return t.document||window.document}const NA=new WeakMap;function CF(t){let e=NA.get(t);return e===void 0&&NA.set(t,e=wF(t)),e}function wF(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 sm(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=CF(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 a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let u,c=n?t.createElementNS(n,i):t.createElement(i),h=e[1],d=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){d=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=d;g<e.length;g++){let y=e[g];if(y===0){if(g<e.length-1||g>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:x,contentDOM:k}=sm(t,y,n,r);if(c.appendChild(x),k){if(u)throw new RangeError("Multiple content holes");u=k}}}return{dom:c,contentDOM:u}}const LO=65535,BO=Math.pow(2,16);function EF(t,e){return t+e*BO}function TA(t){return t&LO}function AF(t){return(t-(t&LO))/BO}const FO=1,VO=2,am=4,PO=8;let MA=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&PO)>0}get deletedBefore(){return(this.delInfo&(FO|am))>0}get deletedAfter(){return(this.delInfo&(VO|am))>0}get deletedAcross(){return(this.delInfo&am)>0}},hl=class vu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&vu.empty)return vu.empty}recover(e){let n=0,r=TA(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+AF(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,a=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],d=this.ranges[u+a],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,x=c+i+(y<0?0:d);if(r)return x;let k=e==(n<0?c:g)?null:EF(u/3,e-c),w=e==c?VO:e==g?FO:am;return(n<0?e!=c:e!=g)&&(w|=PO),new MA(x,w,k)}i+=d-h}return r?e+i:new MA(e+i,0,null)}touches(e,n){let r=0,i=TA(n),s=this.inverted?2:1,a=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],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+a]-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 a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new vu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?vu.empty:new vu(e<0?[0,-e,0]:[0,0,e])}};hl.empty=new hl([]);const $x=Object.create(null);let _n=class{getMap(){return hl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=$x[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 $x)throw new RangeError("Duplicate use of step JSON ID "+e);return $x[e]=n,n.prototype.jsonID=e,n}},Xn=class mf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new mf(e,null)}static fail(e){return new mf(null,e)}static fromReplace(e,n,r,i){try{return mf.ok(e.replace(n,r,i))}catch(s){if(s instanceof hi)return mf.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 W.fromArray(r)}let jO=class gf extends _n{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 q(XS(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return Xn.fromReplace(e,this.from,this.to,s)}invert(){return new $O(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 gf(n.pos,r.pos,this.mark)}merge(e){return e instanceof gf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gf(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 gf(n.from,n.to,e.markFromJSON(n.mark))}};_n.jsonID("addMark",jO);let $O=class yf extends _n{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 q(XS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Xn.fromReplace(e,this.from,this.to,r)}invert(){return new jO(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 yf(n.pos,r.pos,this.mark)}merge(e){return e instanceof yf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yf(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 yf(n.from,n.to,e.markFromJSON(n.mark))}};_n.jsonID("removeMark",$O);let JO=class xf extends _n{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Xn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Xn.fromReplace(e,this.pos,this.pos+1,new q(W.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 xf(this.pos,n.marks[i]);return new xf(this.pos,this.mark)}}return new UO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new xf(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 xf(n.pos,e.markFromJSON(n.mark))}};_n.jsonID("addNodeMark",JO);let UO=class Sb extends _n{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Xn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Xn.fromReplace(e,this.pos,this.pos+1,new q(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new JO(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Sb(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 Sb(n.pos,e.markFromJSON(n.mark))}};_n.jsonID("removeNodeMark",UO);let Gg=class Do extends _n{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&vb(e,this.from,this.to)?Xn.fail("Structure replace would overwrite content"):Xn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new hl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Do(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 Do(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Do)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Do(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Do(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 Do(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}};_n.jsonID("replace",Gg);let Zm=class om extends _n{constructor(e,n,r,i,s,a,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(vb(e,this.from,this.gapFrom)||vb(e,this.gapTo,this.to)))return Xn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Xn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Xn.fromReplace(e,this.from,this.to,r):Xn.fail("Content does not fit in gap")}getMap(){return new hl([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,q.fromJSON(e,n.slice),n.insert,!!n.structure)}};_n.jsonID("replaceAround",Zm);function vb(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 a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function NF(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function QS(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let a=t.$from.node(r),u=t.$from.index(r)+i,c=t.$to.indexAfter(r)-s;if(r<t.depth&&a.canReplace(u,c,n))return r;if(r==0||a.type.spec.isolating||!NF(a,u,c))break;u&&(i=1),c<a.childCount&&(s=1)}return null}function TF(t,e,n=null,r=t){let i=MF(t,e),s=i&&OF(r,e);return s?i.map(OA).concat({type:e,attrs:n}).concat(s.map(OA)):null}function OA(t){return{type:t,attrs:null}}function MF(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let a=s.length?s[0]:e;return n.canReplaceWith(r,i,a)?s:null}function OF(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),a=e.contentMatch.findWrapping(s.type);if(!a)return null;let c=(a.length?a[a.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:a}function lm(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,a=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,d=n-2;h>s;h--,d--){let g=i.node(h),y=i.index(h);if(g.type.spec.isolating)return!1;let x=g.content.cutByIndex(y,g.childCount),k=r&&r[d+1];k&&(x=x.replaceChild(0,k.type.create(k.attrs)));let w=r&&r[d]||g;if(!g.canReplace(y+1,g.childCount)||!w.type.validContent(x))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 HO(t,e){let n=t.resolve(e),r=n.index();return DF(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function RF(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),a=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(a),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function DF(t,e){return!!(t&&e&&!t.isLeaf&&RF(t,e))}function ZS(t,e,n=e,r=q.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return IF(i,s,r)?new Gg(e,n,r):new _F(i,s,r).fit()}function IF(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let _F=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=W.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=W.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,a=r.depth,u=i.depth;for(;a&&u&&s.childCount==1;)s=s.firstChild.content,a--,u--;let c=new q(s,a,u);return e>-1?new Zm(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Gg(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=Jx(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let a=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],d,g=null;if(n==1&&(a?h.matchType(a.type)||(g=h.fillBefore(W.from(a),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:g};if(n==2&&a&&(d=h.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:d};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Jx(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new q(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=Jx(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new q(bf(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new q(bf(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 w=0;w<s.length;w++)this.openFrontierNode(s[w]);let a=this.unplaced,u=r?r.content:a.content,c=a.openStart-e,h=0,d=[],{match:g,type:y}=this.frontier[n];if(i){for(let w=0;w<i.childCount;w++)d.push(i.child(w));g=g.matchFragment(i)}let x=u.size+e-(a.content.size-a.openEnd);for(;h<u.childCount;){let w=u.child(h),N=g.matchType(w.type);if(!N)break;h++,(h>1||c==0||w.content.size)&&(g=N,d.push(qO(w.mark(y.allowedMarks(w.marks)),h==1?c:0,h==u.childCount?x:-1)))}let k=h==u.childCount;k||(x=-1),this.placed=Sf(this.placed,n,W.from(d)),this.frontier[n].match=g,k&&x<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,N=u;w<x;w++){let T=N.lastChild;this.frontier.push({type:T.type,match:T.contentMatchAt(T.childCount)}),N=T.content}this.unplaced=k?e==0?q.empty:new q(bf(a.content,e-1,1),e-1,x<0?a.openEnd:e-1):new q(bf(a.content,e,h),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ux(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)),a=Ux(e,n,i,r,s);if(a){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],d=Ux(e,u,h,c,!0);if(!d||d.childCount)continue e}return{depth:n,fit:a,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,W.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(W.empty,!0);n.childCount&&(this.placed=Sf(this.placed,this.frontier.length,n))}};function bf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(bf(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 Jx(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function qO(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,qO(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(W.empty,!0)))),t.copy(r)}function Ux(t,e,n,r,i){let s=t.node(e),a=i?t.indexAfter(e):t.index(e);if(a==s.childCount&&!n.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,a);return u&&!zF(n,s.content,a)?u:null}function zF(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}let LF=class um extends _n{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 Xn.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 Xn.fromReplace(e,this.pos,this.pos+1,new q(W.from(i),0,n.isLeaf?0:1))}getMap(){return hl.empty}invert(e){return new um(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 um(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 um(n.pos,n.attr,n.value)}};_n.jsonID("attr",LF);let BF=class kb extends _n{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 Xn.ok(r)}getMap(){return hl.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)}};_n.jsonID("docAttr",BF);let Rh=class extends Error{};Rh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Rh.prototype=Object.create(Error.prototype);Rh.prototype.constructor=Rh;Rh.prototype.name="TransformError";const KO=65535,GO=Math.pow(2,16);function FF(t,e){return t+e*GO}function RA(t){return t&KO}function VF(t){return(t-(t&KO))/GO}const YO=1,WO=2,cm=4,XO=8;let Cb=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&XO)>0}get deletedBefore(){return(this.delInfo&(YO|cm))>0}get deletedAfter(){return(this.delInfo&(WO|cm))>0}get deletedAcross(){return(this.delInfo&cm)>0}},pl=class ku{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ku.empty)return ku.empty}recover(e){let n=0,r=RA(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+VF(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,a=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],d=this.ranges[u+a],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,x=c+i+(y<0?0:d);if(r)return x;let k=e==(n<0?c:g)?null:FF(u/3,e-c),w=e==c?WO:e==g?YO:cm;return(n<0?e!=c:e!=g)&&(w|=XO),new Cb(x,w,k)}i+=d-h}return r?e+i:new Cb(e+i,0,null)}touches(e,n){let r=0,i=RA(n),s=this.inverted?2:1,a=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],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+a]-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 a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new ku(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ku.empty:new ku(e<0?[0,-e,0]:[0,0,e])}};pl.empty=new pl([]);let PF=class wb{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 wb(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 wb;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 a=this._maps[s],u=a.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 Cb(e,i,null)}};const Hx=Object.create(null);let zn=class{getMap(){return pl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Hx[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 Hx)throw new RangeError("Duplicate use of step JSON ID "+e);return Hx[e]=n,n.prototype.jsonID=e,n}},Qn=class vf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new vf(e,null)}static fail(e){return new vf(null,e)}static fromReplace(e,n,r,i){try{return vf.ok(e.replace(n,r,i))}catch(s){if(s instanceof hi)return vf.fail(s.message);throw s}}};function ev(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(ev(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let tv=class kf extends zn{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 q(ev(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return Qn.fromReplace(e,this.from,this.to,s)}invert(){return new cp(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 kf(n.pos,r.pos,this.mark)}merge(e){return e instanceof kf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kf(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 kf(n.from,n.to,e.markFromJSON(n.mark))}};zn.jsonID("addMark",tv);let cp=class Cf extends zn{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 q(ev(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Qn.fromReplace(e,this.from,this.to,r)}invert(){return new tv(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 Cf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Cf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Cf(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 Cf(n.from,n.to,e.markFromJSON(n.mark))}};zn.jsonID("removeMark",cp);let nv=class wf extends zn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Qn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Qn.fromReplace(e,this.pos,this.pos+1,new q(W.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 wf(this.pos,n.marks[i]);return new wf(this.pos,this.mark)}}return new eg(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new wf(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 wf(n.pos,e.markFromJSON(n.mark))}};zn.jsonID("addNodeMark",nv);let eg=class Eb extends zn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Qn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Qn.fromReplace(e,this.pos,this.pos+1,new q(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new nv(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Eb(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 Eb(n.pos,e.markFromJSON(n.mark))}};zn.jsonID("removeNodeMark",eg);let $s=class Io extends zn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Ab(e,this.from,this.to)?Qn.fail("Structure replace would overwrite content"):Qn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new pl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Io(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 Io(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Io)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Io(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Io(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 Io(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}};zn.jsonID("replace",$s);let wl=class fm extends zn{constructor(e,n,r,i,s,a,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(Ab(e,this.from,this.gapFrom)||Ab(e,this.gapTo,this.to)))return Qn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Qn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Qn.fromReplace(e,this.from,this.to,r):Qn.fail("Content does not fit in gap")}getMap(){return new pl([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 fm(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 fm(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 fm(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}};zn.jsonID("replaceAround",wl);function Ab(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 a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function jF(t,e,n,r){let i=[],s=[],a,u;t.doc.nodesBetween(e,n,(c,h,d)=>{if(!c.isInline)return;let g=c.marks;if(!r.isInSet(g)&&d.type.allowsMarkType(r.type)){let y=Math.max(h,e),x=Math.min(h+c.nodeSize,n),k=r.addToSet(g);for(let w=0;w<g.length;w++)g[w].isInSet(k)||(a&&a.to==y&&a.mark.eq(g[w])?a.to=x:i.push(a=new cp(y,x,g[w])));u&&u.to==y?u.to=x:s.push(u=new tv(y,x,r))}}),i.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function $F(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(a,u)=>{if(!a.isInline)return;s++;let c=null;if(r instanceof up){let h=a.marks,d;for(;d=r.isInSet(h);)(c||(c=[])).push(d),h=d.removeFromSet(h)}else r?r.isInSet(a.marks)&&(c=[r]):c=a.marks;if(c&&c.length){let h=Math.min(u+a.nodeSize,n);for(let d=0;d<c.length;d++){let g=c[d],y;for(let x=0;x<i.length;x++){let k=i[x];k.step==s-1&&g.eq(i[x].style)&&(y=k)}y?(y.to=h,y.step=s):i.push({style:g,from:Math.max(u,e),to:h,step:s})}}}),i.forEach(a=>t.step(new cp(a.from,a.to,a.style)))}function rv(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),a=[],u=e+1;for(let c=0;c<s.childCount;c++){let h=s.child(c),d=u+h.nodeSize,g=r.matchType(h.type);if(!g)a.push(new $s(u,d,q.empty));else{r=g;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new cp(u,d,h.marks[y]));if(i&&h.isText&&n.whitespace!="pre"){let y,x=/\r?\n|\r/g,k;for(;y=x.exec(h.text);)k||(k=new q(W.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),a.push(new $s(u+y.index,u+y.index+y[0].length,k))}}u=d}if(!r.validEnd){let c=r.fillBefore(W.empty,!0);t.replace(u,u,new q(c,0,0))}for(let c=a.length-1;c>=0;c--)t.step(a[c])}function JF(t,e,n){let{$from:r,$to:i,depth:s}=e,a=r.before(s+1),u=i.after(s+1),c=a,h=u,d=W.empty,g=0;for(let k=s,w=!1;k>n;k--)w||r.index(k)>0?(w=!0,d=W.from(r.node(k).copy(d)),g++):c--;let y=W.empty,x=0;for(let k=s,w=!1;k>n;k--)w||i.after(k+1)<i.end(k)?(w=!0,y=W.from(i.node(k).copy(y)),x++):h++;t.step(new wl(c,h,a,u,new q(d.append(y),g,x),d.size-g,!0))}function UF(t,e,n){let r=W.empty;for(let a=n.length-1;a>=0;a--){if(r.size){let u=n[a].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=W.from(n[a].type.create(n[a].attrs,r))}let i=e.start,s=e.end;t.step(new wl(i,s,i,s,new q(r,0,0),n.length,!0))}function HF(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,(a,u)=>{let c=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,c)&&qF(t.doc,t.mapping.slice(s).map(u),r)){let h=null;if(r.schema.linebreakReplacement){let x=r.whitespace=="pre",k=!!r.contentMatch.matchType(r.schema.linebreakReplacement);x&&!k?h=!1:!x&&k&&(h=!0)}h===!1&&ZO(t,a,u,s),rv(t,t.mapping.slice(s).map(u,1),r,void 0,h===null);let d=t.mapping.slice(s),g=d.map(u,1),y=d.map(u+a.nodeSize,1);return t.step(new wl(g,y,g+1,y-1,new q(W.from(r.create(c,null,a.marks)),0,0),1,!0)),h===!0&&QO(t,a,u,s),!1}})}function QO(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let a,u=/\r?\n|\r/g;for(;a=u.exec(i.text);){let c=t.mapping.slice(r).map(n+1+s+a.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function ZO(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let a=t.mapping.slice(r).map(n+1+s);t.replaceWith(a,a+1,e.type.schema.text(`
38
+ `))}})}function qF(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function KF(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 a=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new wl(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new q(W.from(a),0,0),1,!0))}function GF(t,e,n=1,r){let i=t.doc.resolve(e),s=W.empty,a=W.empty;for(let u=i.depth,c=i.depth-n,h=n-1;u>c;u--,h--){s=W.from(i.node(u).copy(s));let d=r&&r[h];a=W.from(d?d.type.create(d.attrs,a):i.node(u).copy(a))}t.step(new $s(e,e,new q(s.append(a),n,n),!0))}function YF(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),a=s.node().type;if(i&&a.inlineContent){let d=a.whitespace=="pre",g=!!a.contentMatch.matchType(i);d&&!g?r=!1:!d&&g&&(r=!0)}let u=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);ZO(t,d.node(),d.before(),u)}a.inlineContent&&rv(t,e+n-1,a,s.node().contentMatchAt(s.index()),r==null);let c=t.mapping.slice(u),h=c.map(e-n);if(t.step(new $s(h,c.map(e+n,-1),q.empty,!0)),r===!0){let d=t.doc.resolve(h);QO(t,d.node(),d.before(),t.steps.length)}return t}function WF(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 XF(t,e,n=e,r=q.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return e3(i,s,r)?new $s(e,n,r):new QF(i,s,r).fit()}function e3(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let QF=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=W.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=W.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,a=r.depth,u=i.depth;for(;a&&u&&s.childCount==1;)s=s.firstChild.content,a--,u--;let c=new q(s,a,u);return e>-1?new wl(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new $s(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=qx(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let a=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],d,g=null;if(n==1&&(a?h.matchType(a.type)||(g=h.fillBefore(W.from(a),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:g};if(n==2&&a&&(d=h.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:d};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=qx(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new q(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=qx(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new q(Ef(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new q(Ef(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 w=0;w<s.length;w++)this.openFrontierNode(s[w]);let a=this.unplaced,u=r?r.content:a.content,c=a.openStart-e,h=0,d=[],{match:g,type:y}=this.frontier[n];if(i){for(let w=0;w<i.childCount;w++)d.push(i.child(w));g=g.matchFragment(i)}let x=u.size+e-(a.content.size-a.openEnd);for(;h<u.childCount;){let w=u.child(h),N=g.matchType(w.type);if(!N)break;h++,(h>1||c==0||w.content.size)&&(g=N,d.push(t3(w.mark(y.allowedMarks(w.marks)),h==1?c:0,h==u.childCount?x:-1)))}let k=h==u.childCount;k||(x=-1),this.placed=Af(this.placed,n,W.from(d)),this.frontier[n].match=g,k&&x<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,N=u;w<x;w++){let T=N.lastChild;this.frontier.push({type:T.type,match:T.contentMatchAt(T.childCount)}),N=T.content}this.unplaced=k?e==0?q.empty:new q(Ef(a.content,e-1,1),e-1,x<0?a.openEnd:e-1):new q(Ef(a.content,e,h),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Kx(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)),a=Kx(e,n,i,r,s);if(a){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],d=Kx(e,u,h,c,!0);if(!d||d.childCount)continue e}return{depth:n,fit:a,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=Af(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=Af(this.placed,this.depth,W.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(W.empty,!0);n.childCount&&(this.placed=Af(this.placed,this.frontier.length,n))}};function Ef(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ef(t.firstChild.content,e-1,n)))}function Af(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Af(t.lastChild.content,e-1,n)))}function qx(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function t3(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,t3(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(W.empty,!0)))),t.copy(r)}function Kx(t,e,n,r,i){let s=t.node(e),a=i?t.indexAfter(e):t.index(e);if(a==s.childCount&&!n.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,a);return u&&!ZF(n,s.content,a)?u:null}function ZF(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function e7(t){return t.spec.defining||t.spec.definingForContent}function t7(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(e3(i,s,r))return t.step(new $s(e,n,r));let a=r3(i,s);a[a.length-1]==0&&a.pop();let u=-(i.depth+1);a.unshift(u);for(let y=i.depth,x=i.pos-1;y>0;y--,x--){let k=i.node(y).type.spec;if(k.defining||k.definingAsContext||k.isolating)break;a.indexOf(y)>-1?u=y:i.before(y)==x&&a.splice(1,0,-y)}let c=a.indexOf(u),h=[],d=r.openStart;for(let y=r.content,x=0;;x++){let k=y.firstChild;if(h.push(k),x==r.openStart)break;y=k.content}for(let y=d-1;y>=0;y--){let x=h[y],k=e7(x.type);if(k&&!x.sameMarkup(i.node(Math.abs(u)-1)))d=y;else if(k||!x.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let x=(y+d+1)%(r.openStart+1),k=h[x];if(k)for(let w=0;w<a.length;w++){let N=a[(w+c)%a.length],T=!0;N<0&&(T=!1,N=-N);let V=i.node(N-1),F=i.index(N-1);if(V.canReplaceWith(F,F,k.type,k.marks))return t.replace(i.before(N),T?s.after(N):n,new q(n3(r.content,0,r.openStart,x),x,r.openEnd))}}let g=t.steps.length;for(let y=a.length-1;y>=0&&(t.replace(e,n,r),!(t.steps.length>g));y--){let x=a[y];x<0||(e=i.before(x),n=s.after(x))}}function n3(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(n3(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(W.empty,!0))}return t}function n7(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=WF(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new q(W.from(r),0,0))}function r7(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=r3(r,i);for(let a=0;a<s.length;a++){let u=s[a],c=a==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 a=1;a<=r.depth&&a<=i.depth;a++)if(e-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return t.delete(r.before(a),n);t.delete(e,n)}function r3(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 i3=class hm extends zn{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 Qn.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 Qn.fromReplace(e,this.pos,this.pos+1,new q(W.from(i),0,n.isLeaf?0:1))}getMap(){return pl.empty}invert(e){return new hm(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 hm(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 hm(n.pos,n.attr,n.value)}};zn.jsonID("attr",i3);let s3=class Nb extends zn{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 Qn.ok(r)}getMap(){return pl.empty}invert(e){return new Nb(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 Nb(n.attr,n.value)}};zn.jsonID("docAttr",s3);let qu=class extends Error{};qu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};qu.prototype=Object.create(Error.prototype);qu.prototype.constructor=qu;qu.prototype.name="TransformError";let i7=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new PF}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new qu(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,a,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=q.empty){let i=XF(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new q(W.from(r),0,0))}delete(e,n){return this.replace(e,n,q.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return t7(this,e,n,r),this}replaceRangeWith(e,n,r){return n7(this,e,n,r),this}deleteRange(e,n){return r7(this,e,n),this}lift(e,n){return JF(this,e,n),this}join(e,n=1){return YF(this,e,n),this}wrap(e,n){return UF(this,e,n),this}setBlockType(e,n=e,r,i=null){return HF(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return KF(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new i3(e,n,r)),this}setDocAttribute(e,n){return this.step(new s3(e,n)),this}addNodeMark(e,n){return this.step(new nv(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 ht)n.isInSet(r.marks)&&this.step(new eg(e,n));else{let i=r.marks,s,a=[];for(;s=n.isInSet(i);)a.push(new eg(e,s)),i=s.removeFromSet(i);for(let u=a.length-1;u>=0;u--)this.step(a[u])}return this}split(e,n=1,r){return GF(this,e,n,r),this}addMark(e,n,r){return jF(this,e,n,r),this}removeMark(e,n,r){return $F(this,e,n,r),this}clearIncompatible(e,n,r){return rv(this,e,n,r),this}};const Gx=Object.create(null);class Pe{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new a3(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=q.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,a=this.ranges;for(let u=0;u<a.length;u++){let{$from:c,$to:h}=a[u],d=e.mapping.slice(s);e.replaceRange(d.map(c.pos),d.map(h.pos),u?q.empty:n),u==0&&_A(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:a,$to:u}=i[s],c=e.mapping.slice(r),h=c.map(a.pos),d=c.map(u.pos);s?e.deleteRange(h,d):(e.replaceRangeWith(h,d,n),_A(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Oe(e):Cu(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 a=n<0?Cu(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Cu(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(a)return a}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new sr(e.node(0))}static atStart(e){return Cu(e,e,0,0,1)||new sr(e)}static atEnd(e){return Cu(e,e,e.content.size,e.childCount,-1)||new sr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Gx[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 Gx)throw new RangeError("Duplicate use of selection JSON ID "+e);return Gx[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Pe.prototype.visible=!0;class a3{constructor(e,n){this.$from=e,this.$to=n}}let DA=!1;function IA(t){!DA&&!t.parent.inlineContent&&(DA=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends Pe{constructor(e,n=e){IA(e),IA(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 Pe.near(r);let i=e.resolve(n.map(this.anchor));return new Oe(i.parent.inlineContent?i:r,r)}replace(e,n=q.empty){if(super.replace(e,n),n==q.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Yg(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 Oe(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=Pe.findFrom(n,r,!0)||Pe.findFrom(n,-r,!0);if(s)n=s.$head;else return Pe.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Pe.findFrom(e,-r,!0)||Pe.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Oe(e,n)}}Pe.jsonID("text",Oe);class Yg{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Yg(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class be extends Pe{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?Pe.near(s):new be(s)}content(){return new q(W.from(this.node),0,0)}eq(e){return e instanceof be&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new iv(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new be(e.resolve(n.anchor))}static create(e,n){return new be(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}be.prototype.visible=!1;Pe.jsonID("node",be);class iv{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Yg(r,r):new iv(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&be.isSelectable(r)?new be(n):Pe.near(n)}}class sr extends Pe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=q.empty){if(n==q.empty){e.delete(0,e.doc.content.size);let r=Pe.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new sr(e)}map(e){return new sr(e)}eq(e){return e instanceof sr}getBookmark(){return s7}}Pe.jsonID("all",sr);const s7={map(){return this},resolve(t){return new sr(t)}};function Cu(t,e,n,r,i,s=!1){if(e.inlineContent)return Oe.create(t,n);for(let a=r-(i>0?0:1);i>0?a<e.childCount:a>=0;a+=i){let u=e.child(a);if(u.isAtom){if(!s&&be.isSelectable(u))return be.create(t,n-(i<0?u.nodeSize:0))}else{let c=Cu(t,u,n+i,i<0?u.childCount:0,i,s);if(c)return c}n+=u.nodeSize*i}return null}function _A(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof $s||i instanceof wl))return;let s=t.mapping.maps[r],a;s.forEach((u,c,h,d)=>{a==null&&(a=d)}),t.setSelection(Pe.near(t.doc.resolve(a),n))}const zA=1,Xd=2,LA=4;class a7 extends i7{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|zA)&~Xd,this.storedMarks=null,this}get selectionSet(){return(this.updated&zA)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Xd,this}ensureMarks(e){return ht.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&Xd)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Xd,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)||ht.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 a=this.doc.resolve(n);s=r==n?a.marks():a.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(Pe.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|=LA,this}get scrolledIntoView(){return(this.updated&LA)>0}}function BA(t,e){return!e||!t?t:t.bind(e)}class Nf{constructor(e,n,r){this.name=e,this.init=BA(n.init,r),this.apply=BA(n.apply,r)}}const o7=[new Nf("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Nf("selection",{init(t,e){return t.selection||Pe.atStart(e.doc)},apply(t){return t.selection}}),new Nf("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Nf("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Yx{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=o7.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 Nf(r.key,r.spec.state,r))})}}class $o{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 a=0;a<this.config.plugins.length;a++){let u=this.config.plugins[a];if(u.spec.appendTransaction){let c=i?i[a].n:0,h=i?i[a].state:this,d=c<n.length&&u.spec.appendTransaction.call(u,c?n.slice(c):n,h,r);if(d&&r.filterTransaction(d,a)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let g=0;g<this.config.plugins.length;g++)i.push(g<a?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),s=!0}i&&(i[a]={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 $o(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 a7(this)}static create(e){let n=new Yx(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new $o(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 Yx(this.schema,e.plugins),r=n.fields,i=new $o(n);for(let s=0;s<r.length;s++){let a=r[s].name;i[a]=this.hasOwnProperty(a)?this[a]: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 Yx(e.schema,e.plugins),s=new $o(i);return i.fields.forEach(a=>{if(a.name=="doc")s.doc=Fs.fromJSON(e.schema,n.doc);else if(a.name=="selection")s.selection=Pe.fromJSON(s.doc,n.selection);else if(a.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==a.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,u)){s[a.name]=h.fromJSON.call(c,e,n[u],s);return}}s[a.name]=a.init(e,s)}}),s}}function o3(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=o3(i,e,{})),n[r]=i}return n}class ur{constructor(e){this.spec=e,this.props={},e.props&&o3(e.props,this,this.props),this.key=e.key?e.key.key:l3("plugin")}getState(e){return e[this.key]}}const Wx=Object.create(null);function l3(t){return t in Wx?t+"$"+ ++Wx[t]:(Wx[t]=0,t+"$")}class Ln{constructor(e="key"){this.key=l3(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const sv=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function u3(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const c3=(t,e,n)=>{let r=u3(t,n);if(!r)return!1;let i=av(r);if(!i){let a=r.blockRange(),u=a&&QS(a);return u==null?!1:(e&&e(t.tr.lift(a,u).scrollIntoView()),!0)}let s=i.nodeBefore;if(p3(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ku(s,"end")||be.isSelectable(s)))for(let a=r.depth;;a--){let u=ZS(t.doc,r.before(a),r.after(a),q.empty);if(u&&u.slice.size<u.to-u.from){if(e){let c=t.tr.step(u);c.setSelection(Ku(s,"end")?Pe.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):be.create(c.doc,i.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(a==1||r.node(a-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},l7=(t,e,n)=>{let r=u3(t,n);if(!r)return!1;let i=av(r);return i?u7(t,i,e):!1};function u7(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 d=i.lastChild;if(!d)return!1;i=d}let a=e.nodeAfter,u=a,c=e.pos+1;for(;!u.isTextblock;c++){if(u.type.spec.isolating)return!1;let d=u.firstChild;if(!d)return!1;u=d}let h=ZS(t.doc,s,c,q.empty);if(!h||h.from!=s||h instanceof Gg&&h.slice.size>=c-s)return!1;if(n){let d=t.tr.step(h);d.setSelection(Oe.create(d.doc,s)),n(d.scrollIntoView())}return!0}function Ku(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 f3=(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=av(r)}let a=s&&s.nodeBefore;return!a||!be.isSelectable(a)?!1:(e&&e(t.tr.setSelection(be.create(t.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)};function av(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 c7(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const f7=(t,e,n)=>{let r=c7(t,n);if(!r)return!1;let i=h3(r);if(!i)return!1;let s=i.nodeAfter;if(p3(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ku(s,"start")||be.isSelectable(s))){let a=ZS(t.doc,r.before(),r.after(),q.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=t.tr.step(a);u.setSelection(Ku(s,"start")?Pe.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):be.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},h7=(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=h3(r)}let a=s&&s.nodeAfter;return!a||!be.isSelectable(a)?!1:(e&&e(t.tr.setSelection(be.create(t.doc,s.pos)).scrollIntoView()),!0)};function h3(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 p7=(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 ov(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 d7=(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),a=ov(i.contentMatchAt(s));if(!a||!i.canReplaceWith(s,s,a))return!1;if(e){let u=n.after(),c=t.tr.replaceWith(u,u,a.createAndFill());c.setSelection(Pe.near(c.doc.resolve(u),1)),e(c.scrollIntoView())}return!0},m7=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof sr||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=ov(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=t.tr.insert(a,s.createAndFill());u.setSelection(Oe.create(u.doc,a+1)),e(u.scrollIntoView())}return!0},g7=(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(lm(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&QS(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function y7(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof be&&e.selection.node.isBlock)return!r.parentOffset||!lm(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],a,u,c=!1,h=!1;for(let x=r.depth;;x--)if(r.node(x).isBlock){c=r.end(x)==r.pos+(r.depth-x),h=r.start(x)==r.pos-(r.depth-x),u=ov(r.node(x-1).contentMatchAt(r.indexAfter(x-1))),s.unshift(c&&u?{type:u}:null),a=x;break}else{if(x==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof Oe||e.selection instanceof sr)&&d.deleteSelection();let g=d.mapping.map(r.pos),y=lm(d.doc,g,s.length,s);if(y||(s[0]=u?{type:u}:null,y=lm(d.doc,g,s.length,s)),!y)return!1;if(d.split(g,s.length,s),!c&&h&&r.node(a).type!=u){let x=d.mapping.map(r.before(a)),k=d.doc.resolve(x);u&&r.node(a-1).canReplaceWith(k.index(),k.index()+1,u)&&d.setNodeMarkup(d.mapping.map(r.before(a)),u)}return n&&n(d.scrollIntoView()),!0}}const x7=y7(),b7=(t,e)=>(e&&e(t.tr.setSelection(new sr(t.doc))),!0);function S7(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||HO(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function p3(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,a,u,c=i.type.spec.isolating||s.type.spec.isolating;if(!c&&S7(t,e,n))return!0;let h=!c&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(a=(u=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&u.matchType(a[0]||s.type).validEnd){if(n){let x=e.pos+s.nodeSize,k=W.empty;for(let T=a.length-1;T>=0;T--)k=W.from(a[T].create(null,k));k=W.from(i.copy(k));let w=t.tr.step(new Zm(e.pos-1,x,e.pos,x,new q(k,1,0),a.length,!0)),N=w.doc.resolve(x+2*a.length);N.nodeAfter&&N.nodeAfter.type==i.type&&HO(w.doc,N.pos)&&w.join(N.pos),n(w.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&c?null:Pe.findFrom(e,1),g=d&&d.$from.blockRange(d.$to),y=g&&QS(g);if(y!=null&&y>=e.depth)return n&&n(t.tr.lift(g,y).scrollIntoView()),!0;if(h&&Ku(s,"start",!0)&&Ku(i,"end")){let x=i,k=[];for(;k.push(x),!x.isTextblock;)x=x.lastChild;let w=s,N=1;for(;!w.isTextblock;w=w.firstChild)N++;if(x.canReplace(x.childCount,x.childCount,w.content)){if(n){let T=W.empty;for(let F=k.length-1;F>=0;F--)T=W.from(k[F].copy(T));let V=t.tr.step(new Zm(e.pos-k.length,e.pos+s.nodeSize,e.pos+N,e.pos+s.nodeSize-N,new q(T,k.length,0),0,!0));n(V.scrollIntoView())}return!0}}return!1}function d3(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(Oe.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const v7=d3(-1),k7=d3(1);function lv(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,a=i.blockRange(s),u=a&&TF(a,t,e);return u?(r&&r(n.tr.wrap(a,u).scrollIntoView()),!0):!1}}function Dh(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:a},$to:{pos:u}}=n.selection.ranges[s];n.doc.nodesBetween(a,u,(c,h)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)i=!0;else{let d=n.doc.resolve(h),g=d.index();i=d.parent.canReplaceWith(g,g+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let a=0;a<n.selection.ranges.length;a++){let{$from:{pos:u},$to:{pos:c}}=n.selection.ranges[a];s.setBlockType(u,c,t,e)}r(s.scrollIntoView())}return!0}}function C7(t,e,n,r){for(let i=0;i<e.length;i++){let{$from:s,$to:a}=e[i],u=s.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(s.pos,a.pos,(c,h)=>{if(u)return!1;u=c.inlineContent&&c.type.allowsMarkType(n)}),u)return!0}return!1}function Wg(t,e=null,n){return function(r,i){let{empty:s,$cursor:a,ranges:u}=r.selection;if(s&&!a||!C7(r.doc,u,t))return!1;if(i)if(a)t.isInSet(r.storedMarks||a.marks())?i(r.tr.removeStoredMark(t)):i(r.tr.addStoredMark(t.create(e)));else{let c,h=r.tr;c=!u.some(d=>r.doc.rangeHasMark(d.$from.pos,d.$to.pos,t));for(let d=0;d<u.length;d++){let{$from:g,$to:y}=u[d];if(!c)h.removeMark(g.pos,y.pos,t);else{let x=g.pos,k=y.pos,w=g.nodeAfter,N=y.nodeBefore,T=w&&w.isText?/^\s*/.exec(w.text)[0].length:0,V=N&&N.isText?/\s*$/.exec(N.text)[0].length:0;x+T<k&&(x+=T,k-=V),h.addMark(x,k,t.create(e))}}i(h.scrollIntoView())}return!0}}function tc(...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 Xx=tc(sv,c3,f3),FA=tc(sv,f7,h7);const Is={Enter:tc(p7,m7,g7,x7),"Mod-Enter":d7,Backspace:Xx,"Mod-Backspace":Xx,"Shift-Backspace":Xx,Delete:FA,"Mod-Delete":FA,"Mod-a":b7},m3={"Ctrl-h":Is.Backspace,"Alt-Backspace":Is["Mod-Backspace"],"Ctrl-d":Is.Delete,"Ctrl-Alt-Backspace":Is["Mod-Delete"],"Alt-Delete":Is["Mod-Delete"],"Alt-d":Is["Mod-Delete"],"Ctrl-a":v7,"Ctrl-e":k7};for(let t in Is)m3[t]=Is[t];const w7=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,E7=w7?m3:Is,g3=65535,y3=Math.pow(2,16);function A7(t,e){return t+e*y3}function VA(t){return t&g3}function N7(t){return(t-(t&g3))/y3}const x3=1,b3=2,pm=4,S3=8;let PA=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&S3)>0}get deletedBefore(){return(this.delInfo&(x3|pm))>0}get deletedAfter(){return(this.delInfo&(b3|pm))>0}get deletedAcross(){return(this.delInfo&pm)>0}},dl=class wu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&wu.empty)return wu.empty}recover(e){let n=0,r=VA(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+N7(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,a=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],d=this.ranges[u+a],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,x=c+i+(y<0?0:d);if(r)return x;let k=e==(n<0?c:g)?null:A7(u/3,e-c),w=e==c?b3:e==g?x3:pm;return(n<0?e!=c:e!=g)&&(w|=S3),new PA(x,w,k)}i+=d-h}return r?e+i:new PA(e+i,0,null)}touches(e,n){let r=0,i=VA(n),s=this.inverted?2:1,a=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],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+a]-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 a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new wu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?wu.empty:new wu(e<0?[0,-e,0]:[0,0,e])}};dl.empty=new dl([]);const Qx=Object.create(null);let Bn=class{getMap(){return dl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Qx[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 Qx)throw new RangeError("Duplicate use of step JSON ID "+e);return Qx[e]=n,n.prototype.jsonID=e,n}},Zn=class Tf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Tf(e,null)}static fail(e){return new Tf(null,e)}static fromReplace(e,n,r,i){try{return Tf.ok(e.replace(n,r,i))}catch(s){if(s instanceof hi)return Tf.fail(s.message);throw s}}};function uv(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(uv(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let v3=class Mf extends Bn{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 q(uv(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return Zn.fromReplace(e,this.from,this.to,s)}invert(){return new k3(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:"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 Mf(n.from,n.to,e.markFromJSON(n.mark))}};Bn.jsonID("addMark",v3);let k3=class Of extends Bn{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 q(uv(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Zn.fromReplace(e,this.from,this.to,r)}invert(){return new v3(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:"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 Of(n.from,n.to,e.markFromJSON(n.mark))}};Bn.jsonID("removeMark",k3);let C3=class Rf extends Bn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Zn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Zn.fromReplace(e,this.pos,this.pos+1,new q(W.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 Rf(this.pos,n.marks[i]);return new Rf(this.pos,this.mark)}}return new w3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Rf(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 Rf(n.pos,e.markFromJSON(n.mark))}};Bn.jsonID("addNodeMark",C3);let w3=class Tb extends Bn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Zn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Zn.fromReplace(e,this.pos,this.pos+1,new q(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new C3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Tb(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 Tb(n.pos,e.markFromJSON(n.mark))}};Bn.jsonID("removeNodeMark",w3);let T7=class _o extends Bn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Mb(e,this.from,this.to)?Zn.fail("Structure replace would overwrite content"):Zn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new dl([this.from,this.to-this.from,this.slice.size])}invert(e){return new _o(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 _o(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof _o)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new _o(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new _o(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 _o(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}};Bn.jsonID("replace",T7);let M7=class dm extends Bn{constructor(e,n,r,i,s,a,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(Mb(e,this.from,this.gapFrom)||Mb(e,this.gapTo,this.to)))return Zn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Zn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Zn.fromReplace(e,this.from,this.to,r):Zn.fail("Content does not fit in gap")}getMap(){return new dl([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 dm(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 dm(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 dm(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}};Bn.jsonID("replaceAround",M7);function Mb(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 a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function O7(t,e,n=null,r=t){let i=R7(t,e),s=i&&D7(r,e);return s?i.map(jA).concat({type:e,attrs:n}).concat(s.map(jA)):null}function jA(t){return{type:t,attrs:null}}function R7(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let a=s.length?s[0]:e;return n.canReplaceWith(r,i,a)?s:null}function D7(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),a=e.contentMatch.findWrapping(s.type);if(!a)return null;let c=(a.length?a[a.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:a}function I7(t,e){let n=t.resolve(e),r=n.index();return z7(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function _7(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),a=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(a),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function z7(t,e){return!!(t&&e&&!t.isLeaf&&_7(t,e))}let L7=class mm extends Bn{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 Zn.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 Zn.fromReplace(e,this.pos,this.pos+1,new q(W.from(i),0,n.isLeaf?0:1))}getMap(){return dl.empty}invert(e){return new mm(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 mm(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 mm(n.pos,n.attr,n.value)}};Bn.jsonID("attr",L7);let B7=class Ob extends Bn{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 Zn.ok(r)}getMap(){return dl.empty}invert(e){return new Ob(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 Ob(n.attr,n.value)}};Bn.jsonID("docAttr",B7);let Ih=class extends Error{};Ih=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ih.prototype=Object.create(Error.prototype);Ih.prototype.constructor=Ih;Ih.prototype.name="TransformError";class Vr{constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?F7(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function F7(t){return function(e,n,r,i){let s=t;if(n[1]){let a=n[0].lastIndexOf(n[1]);s+=n[0].slice(a+n[1].length),r+=a;let u=r-i;u>0&&(s=n[0].slice(a-u,a)+s,r=i)}return e.tr.insertText(s,r,i)}}const V7=(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 a=t.tr,u=s.transform;for(let c=u.steps.length-1;c>=0;c--)a.step(u.steps[c].invert(u.docs[c]));if(s.text){let c=a.doc.resolve(s.from).marks();a.replaceWith(s.from,s.to,t.schema.text(s.text,c))}else a.delete(s.from,s.to);e(a)}return!0}}return!1};new Vr(/--$/,"—",{inCodeMark:!1});new Vr(/\.\.\.$/,"…",{inCodeMark:!1});new Vr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Vr(/"$/,"”",{inCodeMark:!1});new Vr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Vr(/'$/,"’",{inCodeMark:!1});function cv(t,e,n=null,r){return new Vr(t,(i,s,a,u)=>{let c=n instanceof Function?n(s):n,h=i.tr.delete(a,u),d=h.doc.resolve(a),g=d.blockRange(),y=g&&O7(g,e,c);if(!y)return null;h.wrap(g,y);let x=h.doc.resolve(a-1).nodeBefore;return x&&x.type==e&&I7(h.doc,a-1)&&(!r||r(s,x))&&h.join(a-1),h})}function E3(t,e,n=null){return new Vr(t,(r,i,s,a)=>{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,a).setBlockType(s,s,e,c):null})}const Wa=typeof navigator<"u"?navigator:null,$A=typeof document<"u"?document:null,ro=Wa&&Wa.userAgent||"",Rb=/Edge\/(\d+)/.exec(ro),A3=/MSIE \d/.exec(ro),Db=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ro),fv=!!(A3||Db||Rb);A3?document.documentMode:Db?+Db[1]:Rb&&+Rb[1];const P7=!fv&&/gecko\/(\d+)/i.test(ro);P7&&+(/Firefox\/(\d+)/.exec(ro)||[0,0])[1];const Ib=!fv&&/Chrome\/(\d+)/.exec(ro),j7=!!Ib;Ib&&+Ib[1];const $7=!fv&&!!Wa&&/Apple Computer/.test(Wa.vendor),J7=$7&&(/Mobile\/\w+/.test(ro)||!!Wa&&Wa.maxTouchPoints>2);J7||Wa&&/Mac/.test(Wa.platform);const U7=/Android \d/.test(ro),H7=!!$A&&"webkitFontSmoothing"in $A.documentElement.style;H7&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];function Zx(t,e,n,r,i,s){if(t.composing)return!1;const a=t.state,u=a.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 d=h,g=d.match.exec(c),y=g&&g[0]&&d.handler(a,g,e-(g[0].length-r.length),n);if(y)return d.undoable!==!1&&y.setMeta(s,{transform:y,from:e,to:n,text:r}),t.dispatch(y),!0}return!1}const q7=new Ln("MILKDOWN_CUSTOM_INPUTRULES");function K7({rules:t}){const e=new ur({key:q7,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 Zx(n,r,i,s,t,e)},handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:r}=n.state.selection;r&&Zx(n,r.pos,r.pos,"",t,e)}),!1),keydown:(n,r)=>!(U7&&j7&&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?Zx(n,i.pos,i.pos,`
40
+ `,t,e):!1}}});return e}function fp(t,e,n={}){return new Vr(t,(r,i,s,a)=>{var u,c,h,d;const{tr:g}=r,y=i.length;let x=i[y-1],k=i[0],w=[],N;const T={group:x,fullMatch:k,start:s,end:a},V=(u=n.updateCaptured)==null?void 0:u.call(n,T);if(Object.assign(T,V),{group:x,fullMatch:k,start:s,end:a}=T,k===null||x?.trim()==="")return null;if(x){const F=k.search(/\S/),K=s+k.indexOf(x),L=K+x.length;w=(c=g.storedMarks)!=null?c:[],L<a&&g.delete(L,a),K>s&&g.delete(s+F,K),N=s+F+x.length;const C=(h=n.getAttr)==null?void 0:h.call(n,i);g.addMark(s,N,e.create(C)),g.setStoredMarks(w),(d=n.beforeDispatch)==null||d.call(n,{match:i,start:s,end:a,tr:g})}return g})}function N3(t){return Object.assign(Object.create(t),t).setTime(Date.now())}function G7(t,e){return Array.isArray(t)&&t.includes(e.type)||e.type===t}function Y7(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 W7(t,e){return Y7(n=>n.type===e)(t)}function X7(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 Q7(t,e){if(!(t instanceof be))return;const{node:n,$from:r}=t;if(G7(e,n))return{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}}const Z7=(t,e)=>{const{selection:n,doc:r}=t;if(n instanceof be)return{hasNode:n.node.type===e,pos:n.from,target:n.node};const{from:i,to:s}=n;let a=!1,u=-1,c=null;return r.nodesBetween(i,s,(h,d)=>c?!1:h.type===e?(a=!0,u=d,c=h,!1):!0),{hasNode:a,pos:u,target:c}};var Xa={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:"'"},tg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},eV=typeof navigator<"u"&&/Mac/.test(navigator.platform),tV=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var En=0;En<10;En++)Xa[48+En]=Xa[96+En]=String(En);for(var En=1;En<=24;En++)Xa[En+111]="F"+En;for(var En=65;En<=90;En++)Xa[En]=String.fromCharCode(En+32),tg[En]=String.fromCharCode(En);for(var e1 in Xa)tg.hasOwnProperty(e1)||(tg[e1]=Xa[e1]);function nV(t){var e=eV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||tV&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?tg:Xa)[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 rV=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),iV=typeof navigator<"u"&&/Win/.test(navigator.platform);function sV(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,a;for(let u=0;u<e.length-1;u++){let c=e[u];if(/^(cmd|meta|m)$/i.test(c))a=!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))rV?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),a&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function aV(t){let e=Object.create(null);for(let n in t)e[sV(n)]=t[n];return e}function t1(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 T3(t){return new ur({props:{handleKeyDown:M3(t)}})}function M3(t){let e=aV(t);return function(n,r){let i=nV(r),s,a=e[t1(i,r)];if(a&&a(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=e[t1(i,r,!1)];if(u&&u(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(iV&&r.ctrlKey&&r.altKey)&&(s=Xa[r.keyCode])&&s!=i){let u=e[t1(s,r)];if(u&&u(n.state,n.dispatch,n))return!0}}return!1}}var O3=class{},R3=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 jM();return t}}},oV=class D3 extends O3{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 D3(e,n,r)}},Hi,tp,Ig,_g,zg,np,rp,ol,lV=(ol=class extends R3{constructor(n){super();Gt(this,Hi,ht.none);Gt(this,tp,n=>n.isText);Gt(this,Ig,(n,r)=>{if(rt(this,tp).call(this,n)&&rt(this,tp).call(this,r)&&ht.sameSet(n.marks,r.marks))return this.schema.text(n.text+r.text,n.marks)});Gt(this,_g,n=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.parseMarkdown.match(n));if(!r)throw y5(n);return r});Gt(this,zg,n=>{const r=rt(this,_g).call(this,n);r.spec.parseMarkdown.runner(this,n,r)});Gt(this,np,()=>{gu(this,Hi,ht.none);const n=this.close();return rt(this,rp).call(this,n.type,n.attrs,n.content)});Gt(this,rp,(n,r,i)=>{const s=n.createAndFill(r,i,rt(this,Hi));if(!s)throw g5(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(oV.create(r,[],i)),this),this.closeNode=()=>{try{rt(this,np).call(this)}catch(r){console.error(r)}return this},this.addNode=(r,i,s)=>{try{rt(this,rp).call(this,r,i,s)}catch(a){console.error(a)}return this},this.openMark=(r,i)=>(gu(this,Hi,r.create(i).addToSet(rt(this,Hi))),this),this.closeMark=r=>(gu(this,Hi,r.removeFromSet(rt(this,Hi))),this),this.addText=r=>{try{const i=this.top();if(!i)throw jM();const s=i.pop(),a=this.schema.text(r,rt(this,Hi));if(!s)return i.push(a),this;const u=rt(this,Ig).call(this,s,a);return u?(i.push(u),this):(i.push(s,a),this)}catch(i){return console.error(i),this}},this.build=()=>{let r;do r=rt(this,np).call(this);while(this.size());return r},this.next=(r=[])=>([r].flat().forEach(i=>rt(this,zg).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}},Hi=new WeakMap,tp=new WeakMap,Ig=new WeakMap,_g=new WeakMap,zg=new WeakMap,np=new WeakMap,rp=new WeakMap,ol.create=(n,r)=>{const i=new ol(n);return s=>(i.run(r,s),i.toDoc())},ol),ll,JA=(ll=class extends O3{constructor(e,n,r,i={}){super(),this.type=e,this.children=n,this.value=r,this.props=i,this.push=(s,...a)=>{this.children||(this.children=[]),this.children.push(s,...a)},this.pop=()=>this.children?.pop()}},ll.create=(e,n,r,i={})=>new ll(e,n,r,i),ll),uV=t=>Object.prototype.hasOwnProperty.call(t,"size"),_s,ip,Lg,Bg,sp,Fg,ap,Vg,Pg,Uu,Go,jg,op,ul,cV=(ul=class extends R3{constructor(n){super();Gt(this,_s,ht.none);Gt(this,ip,n=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.toMarkdown.match(n));if(!r)throw x5(n.type);return r});Gt(this,Lg,n=>rt(this,ip).call(this,n).spec.toMarkdown.runner(this,n));Gt(this,Bg,(n,r)=>rt(this,ip).call(this,n).spec.toMarkdown.runner(this,n,r));Gt(this,sp,n=>{const{marks:r}=n,i=s=>s.type.spec.priority??50;[...r].sort((s,a)=>i(s)-i(a)).every(s=>!rt(this,Bg).call(this,s,n))&&rt(this,Lg).call(this,n),r.forEach(s=>rt(this,op).call(this,s))});Gt(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 a=s.children?[...s.children]:void 0,u={...n,children:a};return u.children=a,s.children=[u],s});Gt(this,ap,n=>{const{children:r}=n;return r&&(n.children=r.reduce((i,s,a)=>{if(a===0)return[s];const u=i.at(-1);if(u&&u.isMark&&s.isMark){s=rt(this,Fg).call(this,s,u.type);const{children:c,...h}=s,{children:d,...g}=u;if(s.type===u.type&&c&&d&&JSON.stringify(h)===JSON.stringify(g)){const y={...g,children:[...d,...c]};return i.slice(0,-1).concat(rt(this,ap).call(this,y))}}return i.concat(s)},[])),n});Gt(this,Vg,n=>{const r={...n.props,type:n.type};return n.children&&(r.children=n.children),n.value&&(r.value=n.value),r});Gt(this,Pg,(n,r)=>{let i="",s="";const a=n.children;let u=-1,c=-1;const h=g=>{g&&g.forEach((y,x)=>{y.type==="text"&&y.value&&(u<0&&(u=x),c=x)})};if(a){h(a);const g=a?.[c],y=a?.[u];if(g&&g.value.endsWith(" ")){const x=g.value,k=x.trimEnd();s=x.slice(k.length),g.value=k}if(y&&y.value.startsWith(" ")){const x=y.value,k=x.trimStart();i=x.slice(0,x.length-k.length),y.value=k}}i.length&&rt(this,Go).call(this,"text",void 0,i);const d=r();return s.length&&rt(this,Go).call(this,"text",void 0,s),d});Gt(this,Uu,(n=!1)=>{const r=this.close(),i=()=>rt(this,Go).call(this,r.type,r.children,r.value,r.props);return n?rt(this,Pg).call(this,r,i):i()});Gt(this,Go,(n,r,i,s)=>{const a=JA.create(n,r,i,s),u=rt(this,ap).call(this,rt(this,Vg).call(this,a));return this.push(u),u});Gt(this,jg,(n,r,i,s)=>n.isInSet(rt(this,_s))?this:(gu(this,_s,n.addToSet(rt(this,_s))),this.openNode(r,i,{...s,isMark:!0})));Gt(this,op,n=>{n.isInSet(rt(this,_s))&&(gu(this,_s,n.type.removeFromSet(rt(this,_s))),rt(this,Uu).call(this,!0))});this.openNode=(r,i,s)=>(this.open(JA.create(r,void 0,i,s)),this),this.closeNode=()=>(rt(this,Uu).call(this),this),this.addNode=(r,i,s,a)=>(rt(this,Go).call(this,r,i,s,a),this),this.withMark=(r,i,s,a)=>(rt(this,jg).call(this,r,i,s,a),this),this.closeMark=r=>(rt(this,op).call(this,r),this),this.build=()=>{let r=null;do r=rt(this,Uu).call(this);while(this.size());return r},this.next=r=>uV(r)?(r.forEach(i=>{rt(this,sp).call(this,i)}),this):(rt(this,sp).call(this,r),this),this.toString=r=>r.stringify(this.build()),this.run=r=>(this.next(r),this),this.schema=n}},_s=new WeakMap,ip=new WeakMap,Lg=new WeakMap,Bg=new WeakMap,sp=new WeakMap,Fg=new WeakMap,ap=new WeakMap,Vg=new WeakMap,Pg=new WeakMap,Uu=new WeakMap,Go=new WeakMap,jg=new WeakMap,op=new WeakMap,ul.create=(n,r)=>{const i=new ul(n);return s=>(i.run(s),i.toString(r))},ul);const I3=65535,_3=Math.pow(2,16);function fV(t,e){return t+e*_3}function UA(t){return t&I3}function hV(t){return(t-(t&I3))/_3}const z3=1,L3=2,gm=4,B3=8;let HA=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&B3)>0}get deletedBefore(){return(this.delInfo&(z3|gm))>0}get deletedAfter(){return(this.delInfo&(L3|gm))>0}get deletedAcross(){return(this.delInfo&gm)>0}},ml=class Eu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Eu.empty)return Eu.empty}recover(e){let n=0,r=UA(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+hV(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,a=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],d=this.ranges[u+a],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,x=c+i+(y<0?0:d);if(r)return x;let k=e==(n<0?c:g)?null:fV(u/3,e-c),w=e==c?L3:e==g?z3:gm;return(n<0?e!=c:e!=g)&&(w|=B3),new HA(x,w,k)}i+=d-h}return r?e+i:new HA(e+i,0,null)}touches(e,n){let r=0,i=UA(n),s=this.inverted?2:1,a=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],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+a]-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 a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new Eu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Eu.empty:new Eu(e<0?[0,-e,0]:[0,0,e])}};ml.empty=new ml([]);const n1=Object.create(null);let Fn=class{getMap(){return ml.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=n1[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 n1)throw new RangeError("Duplicate use of step JSON ID "+e);return n1[e]=n,n.prototype.jsonID=e,n}},er=class Df{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Df(e,null)}static fail(e){return new Df(null,e)}static fromReplace(e,n,r,i){try{return Df.ok(e.replace(n,r,i))}catch(s){if(s instanceof hi)return Df.fail(s.message);throw s}}};function hv(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(hv(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let F3=class If extends Fn{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 q(hv(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return er.fromReplace(e,this.from,this.to,s)}invert(){return new V3(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:"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 If(n.from,n.to,e.markFromJSON(n.mark))}};Fn.jsonID("addMark",F3);let V3=class _f extends Fn{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 q(hv(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return er.fromReplace(e,this.from,this.to,r)}invert(){return new F3(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 _f(n.pos,r.pos,this.mark)}merge(e){return e instanceof _f&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _f(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 _f(n.from,n.to,e.markFromJSON(n.mark))}};Fn.jsonID("removeMark",V3);let P3=class zf extends Fn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return er.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return er.fromReplace(e,this.pos,this.pos+1,new q(W.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 zf(this.pos,n.marks[i]);return new zf(this.pos,this.mark)}}return new j3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new zf(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 zf(n.pos,e.markFromJSON(n.mark))}};Fn.jsonID("addNodeMark",P3);let j3=class _b extends Fn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return er.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return er.fromReplace(e,this.pos,this.pos+1,new q(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new P3(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new _b(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 _b(n.pos,e.markFromJSON(n.mark))}};Fn.jsonID("removeNodeMark",j3);let pV=class zo extends Fn{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)?er.fail("Structure replace would overwrite content"):er.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ml([this.from,this.to-this.from,this.slice.size])}invert(e){return new zo(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 zo(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof zo)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new zo(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new zo(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 zo(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}};Fn.jsonID("replace",pV);let dV=class ym extends Fn{constructor(e,n,r,i,s,a,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(zb(e,this.from,this.gapFrom)||zb(e,this.gapTo,this.to)))return er.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return er.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?er.fromReplace(e,this.from,this.to,r):er.fail("Content does not fit in gap")}getMap(){return new ml([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 ym(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 ym(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 ym(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}};Fn.jsonID("replaceAround",dV);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 a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function mV(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 a=r.depth;a>=0;a--){let u=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,c=r.index(a)+(u>0?1:0),h=r.node(a),d=!1;if(s==1)d=h.canReplace(c,c,i);else{let g=h.contentMatchAt(c).findWrapping(i.firstChild.type);d=g&&h.canReplaceWith(c,c,g[0])}if(d)return u==0?r.pos:u<0?r.before(a+1):r.after(a+1)}return null}let gV=class xm extends Fn{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 er.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 er.fromReplace(e,this.pos,this.pos+1,new q(W.from(i),0,n.isLeaf?0:1))}getMap(){return ml.empty}invert(e){return new xm(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 xm(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 xm(n.pos,n.attr,n.value)}};Fn.jsonID("attr",gV);let yV=class Lb extends Fn{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 er.ok(r)}getMap(){return ml.empty}invert(e){return new Lb(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 Lb(n.attr,n.value)}};Fn.jsonID("docAttr",yV);let _h=class extends Error{};_h=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};_h.prototype=Object.create(Error.prototype);_h.prototype.constructor=_h;_h.prototype.name="TransformError";const An=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Gu=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Bb=null;const Ds=function(t,e,n){let r=Bb||(Bb=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},xV=function(){Bb=null},gl=function(t,e,n,r){return n&&(qA(t,e,n,r,-1)||qA(t,e,n,r,1))},bV=/^(img|br|input|textarea|hr)$/i;function qA(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:ai(t))){let a=t.parentNode;if(!a||a.nodeType!=1||hp(t)||bV.test(t.nodeName)||t.contentEditable=="false")return!1;e=An(t)+(i<0?0:1),t=a}else if(t.nodeType==1){let a=t.childNodes[e+(i<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((s=a.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=a,e=i<0?ai(t):0}else return!1}}function ai(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function SV(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=ai(t)}else if(t.parentNode&&!hp(t))e=An(t),t=t.parentNode;else return null}}function vV(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&&!hp(t))e=An(t)+1,t=t.parentNode;else return null}}function kV(t,e,n){for(let r=e==0,i=e==ai(t);r||i;){if(t==n)return!0;let s=An(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==ai(t)}}function hp(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 Xg=function(t){return t.focusNode&&gl(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Po(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function CV(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function wV(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(ai(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(ai(r.startContainer),r.startOffset)}}}const Yi=typeof navigator<"u"?navigator:null,KA=typeof document<"u"?document:null,io=Yi&&Yi.userAgent||"",Fb=/Edge\/(\d+)/.exec(io),$3=/MSIE \d/.exec(io),Vb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(io),wr=!!($3||Vb||Fb),Ha=$3?document.documentMode:Vb?+Vb[1]:Fb?+Fb[1]:0,li=!wr&&/gecko\/(\d+)/i.test(io);li&&+(/Firefox\/(\d+)/.exec(io)||[0,0])[1];const Pb=!wr&&/Chrome\/(\d+)/.exec(io),Nn=!!Pb,J3=Pb?+Pb[1]:0,In=!wr&&!!Yi&&/Apple Computer/.test(Yi.vendor),Yu=In&&(/Mobile\/\w+/.test(io)||!!Yi&&Yi.maxTouchPoints>2),ni=Yu||(Yi?/Mac/.test(Yi.platform):!1),U3=Yi?/Win/.test(Yi.platform):!1,Bs=/Android \d/.test(io),pp=!!KA&&"webkitFontSmoothing"in KA.documentElement.style,EV=pp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function AV(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 Os(t,e){return typeof t=="number"?t:t[e]}function NV(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 GA(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let a=n||t.dom;a;){if(a.nodeType!=1){a=Gu(a);continue}let u=a,c=u==s.body,h=c?AV(s):NV(u),d=0,g=0;if(e.top<h.top+Os(r,"top")?g=-(h.top-e.top+Os(i,"top")):e.bottom>h.bottom-Os(r,"bottom")&&(g=e.bottom-e.top>h.bottom-h.top?e.top+Os(i,"top")-h.top:e.bottom-h.bottom+Os(i,"bottom")),e.left<h.left+Os(r,"left")?d=-(h.left-e.left+Os(i,"left")):e.right>h.right-Os(r,"right")&&(d=e.right-h.right+Os(i,"right")),d||g)if(c)s.defaultView.scrollBy(d,g);else{let x=u.scrollLeft,k=u.scrollTop;g&&(u.scrollTop+=g),d&&(u.scrollLeft+=d);let w=u.scrollLeft-x,N=u.scrollTop-k;e={left:e.left-w,top:e.top-N,right:e.right-w,bottom:e.bottom-N}}let y=c?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(y))break;a=y=="absolute"?a.offsetParent:Gu(a)}}function TV(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,a=n+1;a<Math.min(innerHeight,e.bottom);a+=5){let u=t.root.elementFromPoint(s,a);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:H3(t.dom)}}function H3(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Gu(r));return e}function MV({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;q3(n,r==0?0:r-e)}function q3(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 yu=null;function OV(t){if(t.setActive)return t.setActive();if(yu)return t.focus(yu);let e=H3(t);t.focus(yu==null?{get preventScroll(){return yu={preventScroll:!0},!0}}:void 0),yu||(yu=!1,q3(e,0))}function K3(t,e){let n,r=2e8,i,s=0,a=e.top,u=e.top,c,h;for(let d=t.firstChild,g=0;d;d=d.nextSibling,g++){let y;if(d.nodeType==1)y=d.getClientRects();else if(d.nodeType==3)y=Ds(d).getClientRects();else continue;for(let x=0;x<y.length;x++){let k=y[x];if(k.top<=a&&k.bottom>=u){a=Math.max(k.bottom,a),u=Math.min(k.top,u);let w=k.left>e.left?k.left-e.left:k.right<e.left?e.left-k.right:0;if(w<r){n=d,r=w,i=w&&n.nodeType==3?{left:k.right<e.left?k.right:k.left,top:e.top}:e,d.nodeType==1&&w&&(s=g+(e.left>=(k.left+k.right)/2?1:0));continue}}else k.top>e.top&&!c&&k.left<=e.left&&k.right>=e.left&&(c=d,h={left:Math.max(k.left,Math.min(k.right,e.left)),top:k.top});!n&&(e.left>=k.right&&e.top>=k.top||e.left>=k.left&&e.top>=k.bottom)&&(s=g+1)}}return!n&&c&&(n=c,i=h,r=0),n&&n.nodeType==3?RV(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:K3(n,i)}function RV(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 a=Ma(r,1);if(a.top!=a.bottom&&pv(e,a)){i={node:t,offset:s+(e.left>=(a.left+a.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function pv(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function DV(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function IV(t,e,n){let{node:r,offset:i}=K3(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let a=r.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function _V(t,e,n,r){let i=-1;for(let s=e,a=!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)&&(!a&&c.left>r.left||c.top>r.top?i=u.posBefore:(!a&&c.right<r.left||c.bottom<r.top)&&(i=u.posAfter),a=!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 G3(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 a=t.childNodes[s];if(a.nodeType==1){let u=a.getClientRects();for(let c=0;c<u.length;c++){let h=u[c];if(pv(e,h))return G3(a,e,h)}}if((s=(s+1)%r)==i)break}return t}function zV(t,e){let n=t.dom.ownerDocument,r,i=0,s=wV(n,e.left,e.top);s&&({node:r,offset:i}=s);let a=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),u;if(!a||!t.dom.contains(a.nodeType!=1?a.parentNode:a)){let h=t.dom.getBoundingClientRect();if(!pv(e,h)||(a=G3(t.dom,e,h),!a))return null}if(In)for(let h=a;r&&h;h=Gu(h))h.draggable&&(r=void 0);if(a=DV(a,e),r){if(li&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],g;d.nodeName=="IMG"&&(g=d.getBoundingClientRect()).right<=e.left&&g.bottom>e.top&&i++}let h;pp&&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=_V(t,r,i,e))}u==null&&(u=IV(t,a,e));let c=t.docView.nearestDesc(a,!0);return{pos:u,inside:c?c.posAtStart-c.border:-1}}function YA(t){return t.top<t.bottom||t.left<t.right}function Ma(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(YA(r))return r}return Array.prototype.find.call(n,YA)||t.getBoundingClientRect()}const LV=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Y3(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),a=pp||li;if(r.nodeType==3)if(a&&(LV.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let c=Ma(Ds(r,i,i),n);if(li&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let h=Ma(Ds(r,i-1,i-1),-1);if(h.top==c.top){let d=Ma(Ds(r,i,i+1),-1);if(d.top!=c.top)return uf(d,d.left<h.left)}}return c}else{let c=i,h=i,d=n<0?1:-1;return n<0&&!i?(h++,d=-1):n>=0&&i==r.nodeValue.length?(c--,d=1):n<0?c--:h++,uf(Ma(Ds(r,c,h),d),d<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==ai(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return r1(c.getBoundingClientRect(),!1)}if(s==null&&i<ai(r)){let c=r.childNodes[i];if(c.nodeType==1)return r1(c.getBoundingClientRect(),!0)}return r1(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==ai(r))){let c=r.childNodes[i-1],h=c.nodeType==3?Ds(c,ai(c)-(a?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(h)return uf(Ma(h,1),!1)}if(s==null&&i<ai(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let h=c?c.nodeType==3?Ds(c,0,a?0:1):c.nodeType==1?c:null:null;if(h)return uf(Ma(h,-1),!0)}return uf(Ma(r.nodeType==3?Ds(r):r,-n),n>=0)}function uf(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 r1(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 W3(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 BV(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return W3(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 a=Y3(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=Ds(u,0,u.nodeValue.length).getClientRects();else continue;for(let h=0;h<c.length;h++){let d=c[h];if(d.bottom>d.top+1&&(n=="up"?a.top-d.top>(d.bottom-a.top)*2:d.bottom-a.bottom>(a.bottom-d.top)*2))return!1}}return!0})}const FV=/[\u0590-\u08ac]/;function VV(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,a=i==r.parent.content.size,u=t.domSelection();return u?!FV.test(r.parent.textContent)||!u.modify?n=="left"||n=="backward"?s:a:W3(t,e,()=>{let{focusNode:c,focusOffset:h,anchorNode:d,anchorOffset:g}=t.domSelectionRange(),y=u.caretBidiLevel;u.modify("move",n,"character");let x=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:k,focusOffset:w}=t.domSelectionRange(),N=k&&!x.contains(k.nodeType==1?k:k.parentNode)||c==k&&h==w;try{u.collapse(d,g),c&&(c!=d||h!=g)&&u.extend&&u.extend(c,h)}catch{}return y!=null&&(u.caretBidiLevel=y),N}):r.pos==r.start()||r.pos==r.end()}let WA=null,XA=null,QA=!1;function PV(t,e,n){return WA==e&&XA==n?QA:(WA=e,XA=n,QA=n=="up"||n=="down"?BV(t,e,n):VV(t,e,n))}const ui=0,ZA=1,Jo=2,Wi=3;class dp{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=ui,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,a;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(a)+a.size:this.posAtStart}else{let s,a;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(a):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>An(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),a;if(s&&(!n||s.node))if(r&&(a=s.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==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 a=0;a<i.children.length;a++){let u=i.children[a];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 a=this.children[r],u=s+a.size;if(u>e||a instanceof Q3){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 X3&&s.side>=0;r--);if(n<=0){let s,a=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,a=!1);return s&&n&&a&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?An(s.dom)+1:0}}else{let s,a=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,a=!1);return s&&a&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?An(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 a=r,u=0;;u++){let c=this.children[u],h=a+c.size;if(i==-1&&e<=h){let d=a+c.border;if(e>=d&&n<=h-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,d);e=a;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=An(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 d=u+1;d<this.children.length;d++){let g=this.children[d];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(-1)){s=An(g.dom);break}n+=g.size}s==-1&&(s=this.contentDOM.childNodes.length);break}a=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),a=Math.max(e,n);for(let x=0,k=0;x<this.children.length;x++){let w=this.children[x],N=k+w.size;if(s>k&&a<N)return w.setSelection(e-k-w.border,n-k-w.border,r,i);k=N}let u=this.domFromPos(e,e?-1:1),c=n==e?u:this.domFromPos(n,n?-1:1),h=r.root.getSelection(),d=r.domSelectionRange(),g=!1;if((li||In)&&e==n){let{node:x,offset:k}=u;if(x.nodeType==3){if(g=!!(k&&x.nodeValue[k-1]==`
41
+ `),g&&k==x.nodeValue.length)for(let w=x,N;w;w=w.parentNode){if(N=w.nextSibling){N.nodeName=="BR"&&(u=c={node:N.parentNode,offset:An(N)+1});break}let T=w.pmViewDesc;if(T&&T.node&&T.node.isBlock)break}}else{let w=x.childNodes[k-1];g=w&&(w.nodeName=="BR"||w.contentEditable=="false")}}if(li&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let x=d.focusNode.childNodes[d.focusOffset];x&&x.contentEditable=="false"&&(i=!0)}if(!(i||g&&In)&&gl(u.node,u.offset,d.anchorNode,d.anchorOffset)&&gl(c.node,c.offset,d.focusNode,d.focusOffset))return;let y=!1;if((h.extend||e==n)&&!(g&&li)){h.collapse(u.node,u.offset);try{e!=n&&h.extend(c.node,c.offset),y=!0}catch{}}if(!y){if(e>n){let k=u;u=c,c=k}let x=document.createRange();x.setEnd(c.node,c.offset),x.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(x)}}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],a=r+s.size;if(r==a?e<=a&&n>=r:e<a&&n>r){let u=r+s.border,c=a-s.border;if(e>=u&&n<=c){this.dirty=e==r||n==a?Jo:ZA,e==u&&n==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Wi:s.markDirty(e-u,n-u);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Jo:Wi}r=a}this.dirty=Jo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Jo:ZA;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class X3 extends dp{constructor(e,n,r,i){let s,a=n.type.toDOM;if(typeof a=="function"&&(a=a(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(a.nodeType!=1){let u=document.createElement("span");u.appendChild(a),a=u}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==ui&&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 jV extends dp{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 yl extends dp{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],a=s&&s(n,i,r);return(!a||!a.dom)&&(a=rs.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new yl(e,n,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&Wi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Wi&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=ui){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ui}}slice(e,n,r){let i=yl.create(this.parent,this.mark,!0,r),s=this.children,a=this.size;n<a&&(s=$b(s,n,a,r)),e>0&&(s=$b(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 qa extends dp{constructor(e,n,r,i,s,a,u,c,h){super(e,[],s,a),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=u}static create(e,n,r,i,s,a){let u=s.nodeViews[n.type.name],c,h=u&&u(n,s,()=>{if(!c)return a;if(c.parent)return c.parent.posBeforeChild(c)},r,i),d=h&&h.dom,g=h&&h.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:g}=rs.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!g&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let y=d;return d=tR(d,r,n),h?c=new $V(e,n,r,i,d,g||null,y,h,s,a+1):n.isText?new Qg(e,n,r,i,d,y,s):new qa(e,n,r,i,d,g||null,y,s,a+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=()=>W.empty)}return e}matchesNode(e,n,r){return this.dirty==ui&&e.eq(this.node)&&ng(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,a=s&&s.pos>-1?s:null,u=s&&s.pos<0,c=new UV(this,a&&a.node,e);KV(this.node,this.innerDeco,(h,d,g)=>{h.spec.marks?c.syncToMarks(h.spec.marks,r,e,d):h.type.side>=0&&!g&&c.syncToMarks(d==this.node.childCount?ht.none:this.node.child(d).marks,r,e,d),c.placeWidget(h,e,i)},(h,d,g,y)=>{c.syncToMarks(h.marks,r,e,y);let x;c.findNodeMatch(h,d,g,y)||u&&e.state.selection.from>i&&e.state.selection.to<i+h.nodeSize&&(x=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(h,d,g,x,e)||c.updateNextNode(h,d,g,e,y,i)||c.addNode(h,d,g,e,i),i+=h.nodeSize}),c.syncToMarks([],r,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Jo)&&(a&&this.protectLocalComposition(e,a),Z3(this.contentDOM,this.children,e),Yu&&GV(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Oe)||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 a=s.nodeValue,u=YV(this.node.content,a,r-n,i-n);return u<0?null:{node:s,pos:u,text:a}}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 a=new jV(this,s,n,i);e.input.compositionNodes.push(a),this.children=$b(this.children,r,r+i.length,e,a)}update(e,n,r,i){return this.dirty==Wi||!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=ui}updateOuterDeco(e){if(ng(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=eR(this.dom,this.nodeDOM,jb(this.outerDeco,this.node,n),jb(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 eN(t,e,n,r,i){tR(r,e,t);let s=new qa(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Qg extends qa{constructor(e,n,r,i,s,a,u){super(e,n,r,i,s,null,a,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==Wi||this.dirty!=ui&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=ui||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=ui,!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 Qg(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=Wi)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Q3 extends dp{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ui&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class $V extends qa{constructor(e,n,r,i,s,a,u,c,h,d){super(e,n,r,i,s,a,u,h,d),this.spec=c}update(e,n,r,i){if(this.dirty==Wi)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 Z3(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let a=e[s],u=a.dom;if(u.parentNode==t){for(;u!=r;)r=tN(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(u,r);if(a instanceof yl){let c=r?r.previousSibling:t.lastChild;Z3(a.contentDOM,a.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=tN(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const ah=function(t){t&&(this.nodeName=t)};ah.prototype=Object.create(null);const Uo=[new ah];function jb(t,e,n){if(t.length==0)return Uo;let r=n?Uo[0]:new ah,i=[r];for(let s=0;s<t.length;s++){let a=t[s].type.attrs;if(a){a.nodeName&&i.push(r=new ah(a.nodeName));for(let u in a){let c=a[u];c!=null&&(n&&i.length==1&&i.push(r=new ah(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 eR(t,e,n,r){if(n==Uo&&r==Uo)return e;let i=e;for(let s=0;s<r.length;s++){let a=r[s],u=n[s];if(s){let c;u&&u.nodeName==a.nodeName&&i!=t&&(c=i.parentNode)&&c.nodeName.toLowerCase()==a.nodeName||(c=document.createElement(a.nodeName),c.pmIsDeco=!0,c.appendChild(i),u=Uo[0]),i=c}JV(i,u||Uo[0],a)}return i}function JV(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 tR(t,e,n){return eR(t,t,Uo,jb(e,n,t.nodeType!=1))}function ng(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 tN(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class UV{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=HV(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,a=this.stack.length>>1,u=Math.min(a,e.length);for(;s<u&&(s==a-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<a;)this.destroyRest(),this.top.dirty=ui,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<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 d=this.index;d<h;d++){let g=this.top.children[d];if(g.matchesMark(e[a])&&!this.isLocked(g.dom)){c=d;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let d=yl.create(this.top,e[a],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,a++}}findNodeMatch(e,n,r,i){let s=-1,a;if(i>=this.preMatch.index&&(a=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&a.matchesNode(e,n,r))s=this.top.children.indexOf(a,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 a=this.top.children[i];return a.dirty==Wi&&a.dom==a.contentDOM&&(a.dirty=Jo),a.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,a){for(let u=this.index;u<this.top.children.length;u++){let c=this.top.children[u];if(c instanceof qa){let h=this.preMatch.matched.get(c);if(h!=null&&h!=s)return!1;let d=c.dom,g,y=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=Wi&&ng(n,c.outerDeco));if(!y&&c.update(e,n,r,i))return this.destroyBetween(this.index,u),c.dom!=d&&(this.changed=!0),this.index++,!0;if(!y&&(g=this.recreateWrapper(c,e,n,r,i,a)))return this.destroyBetween(this.index,u),this.top.children[this.index]=g,g.contentDOM&&(g.dirty=Jo,g.updateChildren(i,a+1),g.dirty=ui),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,a){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!ng(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let u=qa.create(this.top,n,r,i,s,a);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 a=qa.create(this.top,e,n,r,i,s);a.contentDOM&&a.updateChildren(i,s+1),this.top.children.splice(this.index++,0,a),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 X3(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 yl;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Qg)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((In||Nn)&&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 Q3(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 HV(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,a=[];e:for(;i>0;){let u;for(;;)if(r){let h=n.children[r-1];if(h instanceof yl)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),a.push(u)}}return{index:i,matched:s,matches:a.reverse()}}function qV(t,e){return t.type.side-e.type.side}function KV(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let h=0;h<t.childCount;h++){let d=t.child(h);r(d,i,e.forChild(s,d),h),s+=d.nodeSize}return}let a=0,u=[],c=null;for(let h=0;;){let d,g;for(;a<i.length&&i[a].to==s;){let N=i[a++];N.widget&&(d?(g||(g=[d])).push(N):d=N)}if(d)if(g){g.sort(qV);for(let N=0;N<g.length;N++)n(g[N],h,!!c)}else n(d,h,!!c);let y,x;if(c)x=-1,y=c,c=null;else if(h<t.childCount)x=h,y=t.child(h++);else break;for(let N=0;N<u.length;N++)u[N].to<=s&&u.splice(N--,1);for(;a<i.length&&i[a].from<=s&&i[a].to>s;)u.push(i[a++]);let k=s+y.nodeSize;if(y.isText){let N=k;a<i.length&&i[a].from<N&&(N=i[a].from);for(let T=0;T<u.length;T++)u[T].to<N&&(N=u[T].to);N<k&&(c=y.cut(N-s),y=y.cut(0,N-s),k=N,x=-1)}else for(;a<i.length&&i[a].to<k;)a++;let w=y.isInline&&!y.isLeaf?u.filter(N=>!N.inline):u.slice();r(y,w,e.forChild(s,y),x),s=k}}function GV(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 YV(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let a=t.child(i++),u=s;if(s+=a.nodeSize,!a.isText)continue;let c=a.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 $b(t,e,n,r,i){let s=[];for(let a=0,u=0;a<t.length;a++){let c=t[a],h=u,d=u+=c.size;h>=n||d<=e?s.push(c):(h<e&&s.push(c.slice(0,e-h,r)),i&&(s.push(i),i=void 0),d>n&&s.push(c.slice(n-h,c.size,r)))}return s}function dv(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,a=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let u=r.resolve(a),c,h;if(Xg(n)){for(c=a;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&be.isSelectable(g)&&i.parent&&!(g.isInline&&kV(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new be(a==y?u:r.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=a,y=a;for(let x=0;x<n.rangeCount;x++){let k=n.getRangeAt(x);g=Math.min(g,t.docView.posFromDOM(k.startContainer,k.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(k.endContainer,k.endOffset,-1))}if(g<0)return null;[c,a]=y==t.state.selection.anchor?[y,g]:[g,y],u=r.resolve(a)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=mv(t,d,u,g)}return h}function nR(t){return t.editable?t.hasFocus():iR(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Vs(t,e=!1){let n=t.state.selection;if(rR(t,n),!!nR(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Nn){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&gl(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)XV(t);else{let{anchor:r,head:i}=n,s,a;nN&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(s=rN(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=rN(t,n.to))),t.docView.setSelection(r,i,t,e),nN&&(s&&iN(s),a&&iN(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&WV(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const nN=In||Nn&&J3<63;function rN(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(In&&i&&i.contentEditable=="false")return i1(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return i1(i);if(s)return i1(s)}}function i1(t){return t.contentEditable="true",In&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function iN(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function WV(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 XV(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,An(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&wr&&Ha<=11&&(n.disabled=!0,n.disabled=!1)}function rR(t,e){if(e instanceof be){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(sN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else sN(t)}function sN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function mv(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Oe.between(e,n,r)}function aN(t){return t.editable&&!t.hasFocus()?!1:iR(t)}function iR(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 QV(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return gl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Jb(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&&Pe.findFrom(s,e)}function Ia(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function oN(t,e,n){let r=t.state.selection;if(r instanceof Oe)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 a=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ia(t,new Oe(r.$anchor,a))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Jb(t.state,e);return i&&i instanceof be?Ia(t,i):!1}else if(!(ni&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(a=t.docView.descAt(u))&&!a.contentDOM?be.isSelectable(s)?Ia(t,new be(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):pp?Ia(t,new Oe(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof be&&r.node.isInline)return Ia(t,new Oe(e>0?r.$to:r.$from));{let i=Jb(t.state,e);return i?Ia(t,i):!1}}}function rg(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function oh(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function xu(t,e){return e<0?ZV(t):eP(t)}function ZV(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,a=!1;for(li&&n.nodeType==1&&r<rg(n)&&oh(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(oh(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(sR(n))break;{let u=n.previousSibling;for(;u&&oh(u,-1);)i=n.parentNode,s=An(u),u=u.previousSibling;if(u)n=u,r=rg(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}a?Ub(t,n,r):i&&Ub(t,i,s)}function eP(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=rg(n),s,a;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(oh(u,1))s=n,a=++r;else break}else{if(sR(n))break;{let u=n.nextSibling;for(;u&&oh(u,1);)s=u.parentNode,a=An(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=rg(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Ub(t,s,a)}function sR(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function tP(t,e){for(;t&&e==t.childNodes.length&&!hp(t);)e=An(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 nP(t,e){for(;t&&!e&&!hp(t);)e=An(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 Ub(t,e,n){if(e.nodeType!=3){let s,a;(a=tP(e,n))?(e=a,n=0):(s=nP(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Xg(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&&Vs(t)},50)}function lN(t,e){let n=t.state.doc.resolve(e);if(!(Nn||U3)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),a=(s.top+s.bottom)/2;if(a>i.top&&a<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),a=(s.top+s.bottom)/2;if(a>i.top&&a<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 uN(t,e,n){let r=t.state.selection;if(r instanceof Oe&&!r.empty||n.indexOf("s")>-1||ni&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let a=Jb(t.state,e);if(a&&a instanceof be)return Ia(t,a)}if(!i.parent.inlineContent){let a=e<0?i:s,u=r instanceof sr?Pe.near(a,e):Pe.findFrom(a,e);return u?Ia(t,u):!1}return!1}function cN(t,e){if(!(t.state.selection instanceof Oe))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 a=t.state.tr;return e<0?a.delete(n.pos-s.nodeSize,n.pos):a.delete(n.pos,n.pos+s.nodeSize),t.dispatch(a),!0}return!1}function fN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function rP(t){if(!In||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;fN(t,r,"true"),setTimeout(()=>fN(t,r,"false"),20)}return!1}function iP(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function sP(t,e){let n=e.keyCode,r=iP(e);if(n==8||ni&&n==72&&r=="c")return cN(t,-1)||xu(t,-1);if(n==46&&!e.shiftKey||ni&&n==68&&r=="c")return cN(t,1)||xu(t,1);if(n==13||n==27)return!0;if(n==37||ni&&n==66&&r=="c"){let i=n==37?lN(t,t.state.selection.from)=="ltr"?-1:1:-1;return oN(t,i,r)||xu(t,i)}else if(n==39||ni&&n==70&&r=="c"){let i=n==39?lN(t,t.state.selection.from)=="ltr"?1:-1:1;return oN(t,i,r)||xu(t,i)}else{if(n==38||ni&&n==80&&r=="c")return uN(t,-1,r)||xu(t,-1);if(n==40||ni&&n==78&&r=="c")return rP(t)||uN(t,1,r)||xu(t,1);if(r==(ni?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function gv(t,e){t.someProp("transformCopied",x=>{e=x(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 x=r.firstChild;n.push(x.type.name,x.attrs!=x.type.defaultAttrs?x.attrs:null),r=x.content}let a=t.someProp("clipboardSerializer")||rs.fromSchema(t.state.schema),u=fR(),c=u.createElement("div");c.appendChild(a.serializeFragment(r,{document:u}));let h=c.firstChild,d,g=0;for(;h&&h.nodeType==1&&(d=cR[h.nodeName.toLowerCase()]);){for(let x=d.length-1;x>=0;x--){let k=u.createElement(d[x]);for(;c.firstChild;)k.appendChild(c.firstChild);c.appendChild(k),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",x=>x(e,t))||e.content.textBetween(0,e.content.size,`
42
+
43
+ `);return{dom:c,text:y,slice:e}}function aR(t,e,n,r,i){let s=i.parent.type.spec.code,a,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 q(W.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:x}=t.state,k=rs.fromSchema(x);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=a.appendChild(document.createElement("p"));w&&N.appendChild(k.serializeNode(x.text(w,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),a=uP(n),pp&&cP(a);let h=a&&a.querySelector("[data-pm-slice]"),d=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let g=+d[3];g>0;g--){let y=a.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;a=y}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||Ya.fromSchema(t.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!aP.test(y.parentNode.nodeName)?{ignore:!0}:null}})),d)u=fP(hN(u,+d[1],+d[2]),d[4]);else if(u=q.maxOpen(oP(u.content,i),!0),u.openStart||u.openEnd){let g=0,y=0;for(let x=u.content.firstChild;g<u.openStart&&!x.type.spec.isolating;g++,x=x.firstChild);for(let x=u.content.lastChild;y<u.openEnd&&!x.type.spec.isolating;y++,x=x.lastChild);u=hN(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const aP=/^(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 oP(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,a=[];if(t.forEach(u=>{if(!a)return;let c=i.findWrapping(u.type),h;if(!c)return a=null;if(h=a.length&&s.length&&lR(c,s,u,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=uR(a[a.length-1],s.length));let d=oR(u,c);a.push(d),i=i.matchType(d.type),s=c}}),a)return W.from(a)}return t}function oR(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,W.from(t));return t}function lR(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=lR(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(W.from(oR(n,t,i+1))))}}function uR(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,uR(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(W.empty,!0);return t.copy(n.append(r))}function Hb(t,e,n,r,i,s){let a=e<0?t.firstChild:t.lastChild,u=a.content;return t.childCount>1&&(s=0),i<r-1&&(u=Hb(u,e,n,r,i+1,s)),i>=n&&(u=e<0?a.contentMatchAt(0).fillBefore(u,s<=i).append(u):u.append(a.contentMatchAt(a.childCount).fillBefore(W.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(u))}function hN(t,e,n){return e<t.openStart&&(t=new q(Hb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new q(Hb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const cR={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 pN=null;function fR(){return pN||(pN=document.implementation.createHTMLDocument("title"))}let s1=null;function lP(t){let e=window.trustedTypes;return e?(s1||(s1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),s1.createHTML(t)):t}function uP(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=fR().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&cR[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=lP(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function cP(t){let e=t.querySelectorAll(Nn?"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 fP(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:a}=t;for(let u=r.length-2;u>=0;u-=2){let c=n.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=W.from(c.create(r[u+1],i)),s++,a++}return new q(i,s,a)}const or={},lr={},hP={touchstart:!0,touchmove:!0};class pP{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 dP(t){for(let e in or){let n=or[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{gP(t,r)&&!yv(t,r)&&(t.editable||!(r.type in lr))&&n(t,r)},hP[e]?{passive:!0}:void 0)}In&&t.dom.addEventListener("input",()=>null),qb(t)}function Pa(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function mP(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 qb(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>yv(t,r))})}function yv(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function gP(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 yP(t,e){!yv(t,e)&&or[e.type]&&(t.editable||!(e.type in lr))&&or[e.type](t,e)}lr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!pR(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Bs&&Nn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Yu&&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,Po(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||sP(t,n)?n.preventDefault():Pa(t,"key")};lr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};lr.keypress=(t,e)=>{let n=e;if(pR(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ni&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Oe)||!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",a=>a(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Zg(t){return{left:t.clientX,top:t.clientY}}function xP(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function xv(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let a=s.depth+1;a>0;a--)if(t.someProp(e,u=>a>s.depth?u(t,n,s.nodeAfter,s.before(a),i,!0):u(t,n,s.node(a),s.before(a),i,!1)))return!0;return!1}function Vu(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 bP(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&be.isSelectable(r)?(Vu(t,new be(n)),!0):!1}function SP(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof be&&(r=n.node);let s=t.state.doc.resolve(e);for(let a=s.depth+1;a>0;a--){let u=a>s.depth?s.nodeAfter:s.node(a);if(be.isSelectable(u)){r&&n.$from.depth>0&&a>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(a);break}}return i!=null?(Vu(t,be.create(t.state.doc,i)),!0):!1}function vP(t,e,n,r,i){return xv(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?SP(t,n):bP(t,n))}function kP(t,e,n,r){return xv(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function CP(t,e,n,r){return xv(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||wP(t,n,r)}function wP(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Vu(t,Oe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(a.inlineContent)Vu(t,Oe.create(r,u+1,u+1+a.content.size));else if(be.isSelectable(a))Vu(t,be.create(r,u));else continue;return!0}}function bv(t){return ig(t)}const hR=ni?"metaKey":"ctrlKey";or.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=bv(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&xP(n,t.input.lastClick)&&!n[hR]&&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 a=t.posAtCoords(Zg(n));a&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new EP(t,a,n,!!r)):(s=="doubleClick"?kP:CP)(t,a.pos,a.inside,n)?n.preventDefault():Pa(t,"pointer"))};let EP=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[hR],this.allowDefault=r.shiftKey;let s,a;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),a=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,a=d.depth?d.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 be&&h.from<=a&&h.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&li&&!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)),Pa(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(()=>Vs(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(Zg(e))),this.updateAllowDefault(e),this.allowDefault||!n?Pa(this.view,"pointer"):vP(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||In&&this.mightDrag&&!this.mightDrag.node.isAtom||Nn&&!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)?(Vu(this.view,Pe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Pa(this.view,"pointer")}move(e){this.updateAllowDefault(e),Pa(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)}};or.touchstart=t=>{t.input.lastTouch=Date.now(),bv(t),Pa(t,"pointer")};or.touchmove=t=>{t.input.lastTouch=Date.now(),Pa(t,"pointer")};or.contextmenu=t=>bv(t);function pR(t,e){return t.composing?!0:In&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const AP=Bs?5e3:-1;lr.compositionstart=lr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Nn&&U3&&NP(t)))t.markCursor=t.state.storedMarks||n.marks(),ig(t,!0),t.markCursor=null;else if(ig(t,!e.selection.empty),li&&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 a=s<0?i.lastChild:i.childNodes[s-1];if(!a)break;if(a.nodeType==3){let u=t.domSelection();u&&u.collapse(a,a.nodeValue.length);break}else i=a,s=-1}}t.input.composing=!0}dR(t,AP)};function NP(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"}lr.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++,dR(t,20))};function dR(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ig(t),e))}function mR(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=MP());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function TP(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=SV(e.focusNode,e.focusOffset),r=vV(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 a=n.pmViewDesc;if(!(!a||!a.isText(n.nodeValue)))return r}}return n||r}function MP(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ig(t,e=!1){if(!(Bs&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),mR(t),e||t.docView&&t.docView.dirty){let n=dv(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 OP(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 zh=wr&&Ha<15||Yu&&EV<604;or.copy=lr.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=zh?null:n.clipboardData,a=r.content(),{dom:u,text:c}=gv(t,a);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):OP(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function RP(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function DP(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?Lh(t,r.value,null,i,e):Lh(t,r.textContent,r.innerHTML,i,e)},50)}function Lh(t,e,n,r,i){let s=aR(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||q.empty)))return!0;if(!s)return!1;let a=RP(s),u=a?t.state.tr.replaceSelectionWith(a,r):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function gR(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," "):""}lr.paste=(t,e)=>{let n=e;if(t.composing&&!Bs)return;let r=zh?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Lh(t,gR(r),r.getData("text/html"),i,n)?n.preventDefault():DP(t,n)};let yR=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const IP=ni?"altKey":"ctrlKey";function xR(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[IP]}or.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(Zg(n)),a;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof be?i.to-1:i.to))){if(r&&r.mightDrag)a=be.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&&(a=be.create(t.state.doc,g.posBefore))}}let u=(a||t.state.selection).content(),{dom:c,text:h,slice:d}=gv(t,u);(!n.dataTransfer.files.length||!Nn||J3>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(zh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",zh||n.dataTransfer.setData("text/plain",h),t.dragging=new yR(d,xR(t,n),a)};or.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};lr.dragover=lr.dragenter=(t,e)=>e.preventDefault();lr.drop=(t,e)=>{try{_P(t,e,t.dragging)}finally{t.dragging=null}};function _P(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Zg(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",x=>{s=x(s,t,!1)}):s=aR(t,gR(e.dataTransfer),zh?null:e.dataTransfer.getData("text/html"),!1,i);let a=!!(n&&xR(t,e));if(t.someProp("handleDrop",x=>x(t,e,s||q.empty,a))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?mV(t.state.doc,i.pos,s):i.pos;u==null&&(u=i.pos);let c=t.state.tr;if(a){let{node:x}=n;x?x.replace(c):c.deleteSelection()}let h=c.mapping.map(u),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(d?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(d&&be.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new be(y));else{let x=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((k,w,N,T)=>x=T),c.setSelection(mv(t,y,c.doc.resolve(x)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}or.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())&&Vs(t)},20))};or.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)};or.beforeinput=(t,e)=>{if(Nn&&Bs&&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,Po(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 lr)or[t]=lr[t];function Bh(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 dN=class bR{constructor(e,n){this.toDOM=e,this.spec=n||Xo,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:a}=e.mapResult(n.from+i,this.side<0?-1:1);return a?null:new Qa(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof bR&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Bh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},lh=class Kb{constructor(e,n){this.attrs=e,this.spec=n||Xo}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=a?null:new Qa(s,a,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Kb&&Bh(this.attrs,e.attrs)&&Bh(this.spec,e.spec)}static is(e){return e.type instanceof Kb}destroy(){}},zP=class SR{constructor(e,n){this.attrs=e,this.spec=n||Xo}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let a=e.mapResult(n.to+i,-1);return a.deleted||a.pos<=s.pos?null:new Qa(s.pos-r,a.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 SR&&Bh(this.attrs,e.attrs)&&Bh(this.spec,e.spec)}destroy(){}},Qa=class Lf{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Lf(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 Lf(e,e,new dN(n,r))}static inline(e,n,r,i){return new Lf(e,n,new lh(r,i))}static node(e,n,r,i){return new Lf(e,n,new zP(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof lh}get widget(){return this.type instanceof dN}};const Au=[],Xo={};let ci=class Oa{constructor(e,n){this.local=e.length?e:Au,this.children=n.length?n:Au}static create(e,n){return n.length?sg(n,e,0,Xo):On}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 a=0;a<this.local.length;a++){let u=this.local[a];u.from<=n&&u.to>=e&&(!s||s(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>e){let u=this.children[a]+1;this.children[a+2].findInner(e-u,n-u,r,i+u,s)}}map(e,n,r){return this==On||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Xo)}mapInner(e,n,r,i,s){let a;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(n,c)?(a||(a=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?LP(this.children,a||[],e,n,r,i,s):a?new Oa(a.sort(Qo),Au):On}add(e,n){return n.length?this==On?Oa.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,d;if(d=CR(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,d,h+1):i.splice(s,0,c,c+u.nodeSize,sg(d,u,h+1,Xo)),s+=3}});let a=kR(s?wR(n):n,-r);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||a.splice(u--,1);return new Oa(a.length?this.local.concat(a).sort(Qo):this.local,i||this.children)}remove(e){return e.length==0||this==On?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 a,u=r[s]+n,c=r[s+1]+n;for(let d=0,g;d<e.length;d++)(g=e[d])&&g.from>u&&g.to<c&&(e[d]=null,(a||(a=[])).push(g));if(!a)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(a,u+1);h!=On?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,a;s<e.length;s++)if(a=e[s])for(let u=0;u<i.length;u++)i[u].eq(a,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 Oa(i,r):On}forChild(e,n){if(this==On)return this;if(n.isLeaf)return Oa.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,a=s+n.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<a&&c.to>s&&c.type instanceof lh){let h=Math.max(s,c.from)-s,d=Math.min(a,c.to)-s;h<d&&(i||(i=[])).push(c.copy(h,d))}}if(i){let u=new Oa(i.sort(Qo),Au);return r?new vR([u,r]):u}return r||On}eq(e){if(this==e)return!0;if(!(e instanceof Oa)||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 Sv(this.localsInner(e))}localsInner(e){if(this==On)return Au;if(e.inlineContent||!this.local.some(lh.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof lh||n.push(this.local[r]);return n}forEachSet(e){e(this)}};ci.empty=new ci([],[]);ci.removeOverlap=Sv;const On=ci.empty;let vR=class Nu{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Xo));return Nu.from(r)}forChild(e,n){if(n.isLeaf)return ci.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=On&&(s instanceof Nu?r=r.concat(s.members):r.push(s))}return Nu.from(r)}eq(e){if(!(e instanceof Nu)||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 a=0;a<s.length;a++)n.push(s[a])}}return n?Sv(r?n:n.sort(Qo)):Au}static from(e){switch(e.length){case 0:return On;case 1:return e[0];default:return new Nu(e.every(n=>n instanceof ci)?e:e.reduce((n,r)=>n.concat(r instanceof ci?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function LP(t,e,n,r,i,s,a){let u=t.slice();for(let h=0,d=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,x,k,w)=>{let N=w-k-(x-y);for(let T=0;T<u.length;T+=3){let V=u[T+1];if(V<0||y>V+d-g)continue;let F=u[T]+d-g;x>=F?u[T+1]=y<=F?-2:-1:y>=d&&N&&(u[T]+=N,u[T+1]+=N)}g+=N}),d=n.maps[h].map(d,-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 d=n.map(t[h]+s),g=d-i;if(g<0||g>=r.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),x=y-i,{index:k,offset:w}=r.content.findIndex(g),N=r.maybeChild(k);if(N&&w==g&&w+N.nodeSize==x){let T=u[h+2].mapInner(n,N,d+1,t[h]+s+1,a);T!=On?(u[h]=g,u[h+1]=x,u[h+2]=T):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=BP(u,t,e,n,i,s,a),d=sg(h,r,0,a);e=d.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<d.children.length;g+=3){let x=d.children[g];for(;y<u.length&&u[y]<x;)y+=3;u.splice(y,0,d.children[g],d.children[g+1],d.children[g+2])}}return new ci(e.sort(Qo),u)}function kR(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 Qa(i.from+e,i.to+e,i.type))}return n}function BP(t,e,n,r,i,s,a){function u(c,h){for(let d=0;d<c.local.length;d++){let g=c.local[d].map(r,i,h);g?n.push(g):a.onRemove&&a.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)u(c.children[d+2],c.children[d]+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 CR(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,a;s<t.length;s++)(a=t[s])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),t[s]=null);return i}function wR(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function sg(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=CR(t,u,c+n);if(h){s=!0;let d=sg(h,u,n+c+1,r);d!=On&&i.push(c,c+u.nodeSize,d)}});let a=kR(s?wR(t):t,-n).sort(Qo);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||(r.onRemove&&r.onRemove(a[u].spec),a.splice(u--,1));return a.length||i.length?new ci(a,i):On}function Qo(t,e){return t.from-e.from||t.to-e.to}function Sv(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),mN(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),mN(e,i,r.copy(s.from,r.to)));break}}}return e}function mN(t,e,n){for(;e<t.length&&Qo(n,t[e])>0;)e++;t.splice(e,0,n)}function a1(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=On&&e.push(r)}),t.cursorWrapper&&e.push(ci.create(t.state.doc,[t.cursorWrapper.deco])),vR.from(e)}const FP={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},VP=wr&&Ha<=11;class PP{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 jP{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new PP,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]);wr&&Ha<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():In&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),VP&&(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,FP)),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(aN(this.view)){if(this.suppressingSelectionUpdates)return Vs(this.view);if(wr&&Ha<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&gl(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=Gu(s))n.add(s);for(let s=e.anchorNode;s;s=Gu(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)&&aN(e)&&!this.ignoreSelectionChange(r),s=-1,a=-1,u=!1,c=[];if(e.editable)for(let d=0;d<n.length;d++){let g=this.registerMutation(n[d],c);g&&(s=s<0?g.from:Math.min(g.from,s),a=a<0?g.to:Math.max(g.to,a),g.typeOver&&(u=!0))}if(c.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of c)if(d.nodeName=="BR"&&d.parentNode){let g=d.nextSibling;for(;g&&g.nodeType==1;){if(g.contentEditable=="false"){d.parentNode.removeChild(d);break}g=g.firstChild}}}else if(li&&c.length){let d=c.filter(g=>g.nodeName=="BR");if(d.length==2){let[g,y]=d;g.parentNode&&g.parentNode.parentNode==y.parentNode?y.remove():g.remove()}else{let{focusNode:g}=this.currentSelection;for(let y of d){let x=y.parentNode;x&&x.nodeName=="LI"&&(!g||UP(e,g)!=x)&&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&&Xg(r)&&(h=dv(e))&&h.eq(Pe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Vs(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,a),$P(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,HP(e,c)),this.handleDOMChange(s,a,u,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Vs(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 d=0;d<e.addedNodes.length;d++){let g=e.addedNodes[d];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(wr&&Ha<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:g,nextSibling:y}=e.addedNodes[d];(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(i=g),(!y||Array.prototype.indexOf.call(e.addedNodes,y)<0)&&(s=y)}let a=i&&i.parentNode==e.target?An(i)+1:0,u=r.localPosFromDOM(e.target,a,-1),c=s&&s.parentNode==e.target?An(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 gN=new WeakMap,yN=!1;function $P(t){if(!gN.has(t)&&(gN.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=li,yN)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."),yN=!0}}function xN(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,a=t.domAtPos(t.state.selection.anchor);return gl(a.node,a.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function JP(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return xN(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?xN(t,n):null}function UP(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 HP(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 a=s.nextSibling;for(;a&&a.nodeName!="TD"&&a.nodeName!="TH";)a=a.nextSibling;if(a){let u=a;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 qP(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:a,to:u}=t.docView.parseRange(e,n),c=t.domSelectionRange(),h,d=c.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(h=[{node:d,offset:c.anchorOffset}],Xg(c)||h.push({node:c.focusNode,offset:c.focusOffset})),Nn&&t.input.lastKeyCode===8)for(let N=s;N>i;N--){let T=r.childNodes[N-1],V=T.pmViewDesc;if(T.nodeName=="BR"&&!V){s=N;break}if(!V||V.size)break}let g=t.state.doc,y=t.someProp("domParser")||Ya.fromSchema(t.state.schema),x=g.resolve(a),k=null,w=y.parse(r,{topNode:x.parent,topMatch:x.parent.contentMatchAt(x.index()),topOpen:!0,from:i,to:s,preserveWhitespace:x.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:KP,context:x});if(h&&h[0].pos!=null){let N=h[0].pos,T=h[1]&&h[1].pos;T==null&&(T=N),k={anchor:N+a,head:T+a}}return{doc:w,sel:k,from:a,to:u}}function KP(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(In&&/^(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||In&&/^(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 GP=/^(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 YP(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let _=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,J=dv(t,_);if(J&&!t.state.selection.eq(J)){if(Nn&&Bs&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",H=>H(t,Po(13,"Enter"))))return;let $=t.state.tr.setSelection(J);_=="pointer"?$.setMeta("pointer",!0):_=="key"&&$.scrollIntoView(),s&&$.setMeta("composition",s),t.dispatch($)}return}let a=t.state.doc.resolve(e),u=a.sharedDepth(n);e=a.before(u+1),n=t.state.doc.resolve(n).after(u+1);let c=t.state.selection,h=qP(t,e,n),d=t.state.doc,g=d.slice(h.from,h.to),y,x;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(y=t.state.selection.to,x="end"):(y=t.state.selection.from,x="start"),t.input.lastKeyCode=null;let k=QP(g.content,h.doc.content,h.from,y,x);if(k&&t.input.domChangeCount++,(Yu&&t.input.lastIOSEnter>Date.now()-225||Bs)&&i.some(_=>_.nodeType==1&&!GP.test(_.nodeName))&&(!k||k.endA>=k.endB)&&t.someProp("handleKeyDown",_=>_(t,Po(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!k)if(r&&c instanceof Oe&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))k={start:c.from,endA:c.to,endB:c.to};else{if(h.sel){let _=bN(t,t.state.doc,h.sel);if(_&&!_.eq(t.state.selection)){let J=t.state.tr.setSelection(_);s&&J.setMeta("composition",s),t.dispatch(J)}}return}t.state.selection.from<t.state.selection.to&&k.start==k.endB&&t.state.selection instanceof Oe&&(k.start>t.state.selection.from&&k.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?k.start=t.state.selection.from:k.endA<t.state.selection.to&&k.endA>=t.state.selection.to-2&&t.state.selection.to<=h.to&&(k.endB+=t.state.selection.to-k.endA,k.endA=t.state.selection.to)),wr&&Ha<=11&&k.endB==k.start+1&&k.endA==k.start&&k.start>h.from&&h.doc.textBetween(k.start-h.from-1,k.start-h.from+1)=="  "&&(k.start--,k.endA--,k.endB--);let w=h.doc.resolveNoCache(k.start-h.from),N=h.doc.resolveNoCache(k.endB-h.from),T=d.resolve(k.start),V=w.sameParent(N)&&w.parent.inlineContent&&T.end()>=k.endA;if((Yu&&t.input.lastIOSEnter>Date.now()-225&&(!V||i.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!V&&w.pos<h.doc.content.size&&(!w.sameParent(N)||!w.parent.inlineContent)&&w.pos<N.pos&&!/\S/.test(h.doc.textBetween(w.pos,N.pos,"","")))&&t.someProp("handleKeyDown",_=>_(t,Po(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>k.start&&XP(d,k.start,k.endA,w,N)&&t.someProp("handleKeyDown",_=>_(t,Po(8,"Backspace")))){Bs&&Nn&&t.domObserver.suppressSelectionUpdates();return}Nn&&k.endB==k.start&&(t.input.lastChromeDelete=Date.now()),Bs&&!V&&w.start()!=N.start()&&N.parentOffset==0&&w.depth==N.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==k.endA&&(k.endB-=2,N=h.doc.resolveNoCache(k.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(_){return _(t,Po(13,"Enter"))})},20));let F=k.start,K=k.endA,L=_=>{let J=_||t.state.tr.replace(F,K,h.doc.slice(k.start-h.from,k.endB-h.from));if(h.sel){let $=bN(t,J.doc,h.sel);$&&!(Nn&&t.composing&&$.empty&&(k.start!=k.endB||t.input.lastChromeDelete<Date.now()-100)&&($.head==F||$.head==J.mapping.map(K)-1)||wr&&$.empty&&$.head==F)&&J.setSelection($)}return s&&J.setMeta("composition",s),J.scrollIntoView()},C;if(V)if(w.pos==N.pos){wr&&Ha<=11&&w.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Vs(t),20));let _=L(t.state.tr.delete(F,K)),J=d.resolve(k.start).marksAcross(d.resolve(k.endA));J&&_.ensureMarks(J),t.dispatch(_)}else if(k.endA==k.endB&&(C=WP(w.parent.content.cut(w.parentOffset,N.parentOffset),T.parent.content.cut(T.parentOffset,k.endA-T.start())))){let _=L(t.state.tr);C.type=="add"?_.addMark(F,K,C.mark):_.removeMark(F,K,C.mark),t.dispatch(_)}else if(w.parent.child(w.index()).isText&&w.index()==N.index()-(N.textOffset?0:1)){let _=w.parent.textBetween(w.parentOffset,N.parentOffset),J=()=>L(t.state.tr.insertText(_,F,K));t.someProp("handleTextInput",$=>$(t,F,K,_,J))||t.dispatch(J())}else t.dispatch(L());else t.dispatch(L())}function bN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:mv(t,e.resolve(n.anchor),e.resolve(n.head))}function WP(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,a,u,c;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<n.length;d++)s=n[d].removeFromSet(s);if(i.length==1&&s.length==0)u=i[0],a="add",c=d=>d.mark(u.addToSet(d.marks));else if(i.length==0&&s.length==1)u=s[0],a="remove",c=d=>d.mark(u.removeFromSet(d.marks));else return null;let h=[];for(let d=0;d<e.childCount;d++)h.push(c(e.child(d)));if(W.from(h).eq(t))return{mark:u,type:a}}function XP(t,e,n,r,i){if(n-e<=i.pos-r.pos||o1(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 a=t.resolve(o1(s,!0,!0));return!a.parent.isTextblock||a.pos>n||o1(a,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(a.parent.content)}function o1(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 QP(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a,b:u}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let c=Math.max(0,s-Math.min(a,u));r-=a+c-s}if(a<s&&t.size<e.size){let c=r<=s&&r>=a?s-r:0;s-=c,s&&s<e.size&&SN(e.textBetween(s-1,s+1))&&(s+=c?1:-1),u=s+(u-a),a=s}else if(u<s){let c=r<=s&&r>=u?s-r:0;s-=c,s&&s<t.size&&SN(t.textBetween(s-1,s+1))&&(s+=c?1:-1),a=s+(a-u),u=s}return{start:s,endA:a,endB:u}}function SN(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 ER{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 pP,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(EN),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=CN(this),kN(this),this.nodeViews=wN(this),this.docView=eN(this.state.doc,vN(this),a1(this),this.dom,this),this.domObserver=new jP(this,(r,i,s,a)=>YP(this,r,i,s,a)),this.domObserver.start(),dP(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&&qb(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(EN),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,a=!1;e.storedMarks&&this.composing&&(mR(this),a=!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 x=wN(this);ej(x,this.nodeViews)&&(this.nodeViews=x,s=!0)}(u||n.handleDOMEvents!=this._props.handleDOMEvents)&&qb(this),this.editable=CN(this),kN(this);let c=a1(this),h=vN(this),d=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))&&(a=!0);let y=d=="preserve"&&a&&this.dom.style.overflowAnchor==null&&TV(this);if(a){this.domObserver.stop();let x=g&&(wr||Nn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ZP(i.selection,e.selection);if(g){let k=Nn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=TP(this)),(s||!this.docView.update(e.doc,h,c,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=eN(e.doc,h,c,this.dom,this)),k&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(x=!0)}x||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&QV(this))?Vs(this,x):(rR(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),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():y&&MV(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 be){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&GA(this,n.getBoundingClientRect(),e)}else GA(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 yR(e.slice,e.move,i<0?void 0:be.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 a=0;a<this.directPlugins.length;a++){let u=this.directPlugins[a].props[e];if(u!=null&&(i=n?n(u):u))return i}let s=this.state.plugins;if(s)for(let a=0;a<s.length;a++){let u=s[a].props[e];if(u!=null&&(i=n?n(u):u))return i}}hasFocus(){if(wr){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&&OV(this.dom),Vs(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 zV(this,e)}coordsAtPos(e,n=1){return Y3(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 PV(this,n||this.state,e)}pasteHTML(e,n){return Lh(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Lh(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return gv(this,e)}destroy(){this.docView&&(mP(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],a1(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,xV())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return yP(this,e)}domSelectionRange(){let e=this.domSelection();return e?In&&this.root.nodeType===11&&CV(this.dom.ownerDocument)==this.dom&&JP(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}ER.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function vN(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"),[Qa.node(0,t.state.doc.content.size,e)]}function kN(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:Qa.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function CN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function ZP(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 wN(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 ej(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 EN(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 qs(t,e){return t.meta={package:"@milkdown/core",group:"System",...e},t}var AR={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"),a=n.createTracker(r);let u=a.move(i+i);return u+=a.move(n.containerPhrasing(t,{before:u,after:i,...a.current()})),u+=a.move(i+i),s(),u},emphasis:(t,e,n,r)=>{const i=t.marker||n.options.emphasis||"*",s=n.enter("emphasis"),a=n.createTracker(r);let u=a.move(i);return u+=a.move(n.containerPhrasing(t,{before:u,after:i,...a.current()})),u+=a.move(i),s(),u}},Vt=lt({},"editorView"),Bf=lt({},"editorState"),l1=lt([],"initTimer"),AN=lt({},"editor"),Fh=lt([],"inputRules"),Js=lt([],"prosePlugins"),Vh=lt([],"remarkPlugins"),Ph=lt([],"nodeView"),jh=lt([],"markView"),Zo=lt(Gm().use(qm).use(db),"remark"),uh=lt({handlers:AR,encode:[]},"remarkStringifyOptions"),bm=ns("ConfigReady");function tj(t){const e=n=>(n.record(bm),async()=>(await t(n),n.done(bm),()=>{n.clearTimer(bm)}));return qs(e,{displayName:"Config"}),e}var el=ns("InitReady");function nj(t){const e=n=>(n.inject(AN,t).inject(Js,[]).inject(Vh,[]).inject(Fh,[]).inject(Ph,[]).inject(jh,[]).inject(uh,{handlers:AR,encode:[]}).inject(Zo,Gm().use(qm).use(db)).inject(l1,[bm]).record(el),async()=>{await n.waitTimers(l1);const r=n.get(uh);return n.set(Zo,Gm().use(qm).use(db,r)),n.done(el),()=>{n.remove(AN).remove(Js).remove(Vh).remove(Fh).remove(Ph).remove(jh).remove(uh).remove(Zo).remove(l1).clearTimer(el)}});return qs(e,{displayName:"Init"}),e}var ar=ns("SchemaReady"),u1=lt([],"schemaTimer"),Ki=lt({},"schema"),ch=lt([],"nodes"),fh=lt([],"marks");function NN(t){return{...t,parseDOM:t.parseDOM?.map(e=>({priority:t.priority,...e}))}}var NR=t=>(t.inject(Ki,{}).inject(ch,[]).inject(fh,[]).inject(u1,[el]).record(ar),async()=>{await t.waitTimers(u1);const e=t.get(Zo),n=t.get(Vh).reduce((i,s)=>i.use(s.plugin,s.options),e);t.set(Zo,n);const r=new yF({nodes:Object.fromEntries(t.get(ch).map(([i,s])=>[i,NN(s)])),marks:Object.fromEntries(t.get(fh).map(([i,s])=>[i,NN(s)]))});return t.set(Ki,r),t.done(ar),()=>{t.remove(Ki).remove(ch).remove(fh).remove(u1).clearTimer(ar)}});qs(NR,{displayName:"Schema"});var TR=class{constructor(){this.setCtx=t=>{this.#e=t},this.chain=()=>{if(this.#e==null)throw Mx();const t=this.#e,e=[],n=this.get.bind(this),r={run:()=>{const s=tc(...e),a=t.get(Vt);return s(a.state,a.dispatch,a)},inline:s=>(e.push(s),r),pipe:i.bind(this)};function i(s,a){const u=n(s);return e.push(u(a)),r}return r}}#t=new $M;#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 Mx();const n=this.get(t)(e),r=this.#e.get(Vt);return n(r.state,r.dispatch,r)}inline(t){if(this.#e==null)throw Mx();const e=this.#e.get(Vt);return t(e.state,e.dispatch,e)}};function rj(t="cmdKey"){return lt((()=>()=>!1),t)}var kt=lt(new TR,"commands"),c1=lt([ar],"commandsTimer"),hh=ns("CommandsReady"),MR=t=>{const e=new TR;return e.setCtx(t),t.inject(kt,e).inject(c1,[ar]).record(hh),async()=>(await t.waitTimers(c1),t.done(hh),()=>{t.remove(kt).remove(c1).clearTimer(hh)})};qs(MR,{displayName:"Commands"});function ij(t){return t.Backspace=tc(V7,sv,l7,f3),t}var OR=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=ij(E7);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,a)=>(a.priority??50)-(s.priority??50));return[e,(s,a,u)=>{const c=this.#t;if(c==null)throw Jg();return tc(...r.map(h=>h.onRun(c)))(s,a,u)}]}))}}#t=null;#e=[];get ctx(){return this.#t}},ag=lt(new OR,"keymap"),f1=lt([ar],"keymapTimer"),ph=ns("KeymapReady"),sj=t=>{const e=new OR;return e.setCtx(t),t.inject(ag,e).inject(f1,[ar]).record(ph),async()=>(await t.waitTimers(f1),t.done(ph),()=>{t.remove(ag).remove(f1).clearTimer(ph)})},Sm=ns("ParserReady"),RR=(()=>{throw Jg()}),dh=lt(RR,"parser"),h1=lt([],"parserTimer"),DR=t=>(t.inject(dh,RR).inject(h1,[ar]).record(Sm),async()=>{await t.waitTimers(h1);const e=t.get(Zo),n=t.get(Ki);return t.set(dh,lV.create(n,e)),t.done(Sm),()=>{t.remove(dh).remove(h1).clearTimer(Sm)}});qs(DR,{displayName:"Parser"});var mh=ns("SerializerReady"),p1=lt([],"serializerTimer"),IR=(()=>{throw Jg()}),gh=lt(IR,"serializer"),_R=t=>(t.inject(gh,IR).inject(p1,[ar]).record(mh),async()=>{await t.waitTimers(p1);const e=t.get(Zo),n=t.get(Ki);return t.set(gh,cV.create(n,e)),t.done(mh),()=>{t.remove(gh).remove(p1).clearTimer(mh)}});qs(_R,{displayName:"Serializer"});var yh=lt("","defaultValue"),vm=lt(t=>t,"stateOptions"),d1=lt([],"editorStateTimer"),km=ns("EditorStateReady");function aj(t,e,n){if(typeof t=="string")return e(t);if(t.type==="html")return Ya.fromSchema(n).parse(t.dom);if(t.type==="json")return Fs.fromJSON(n,t.value);throw p5(t)}var oj=new Ln("MILKDOWN_STATE_TRACKER"),zR=t=>(t.inject(yh,"").inject(Bf,{}).inject(vm,e=>e).inject(d1,[Sm,mh,hh,ph]).record(km),async()=>{await t.waitTimers(d1);const e=t.get(Ki),n=t.get(dh),r=t.get(Fh),i=t.get(vm),s=t.get(Js),a=aj(t.get(yh),n,e),u=t.get(ag),c=u.addBaseKeymap(),h=[...s,new ur({key:oj,state:{init:()=>{},apply:(y,x,k,w)=>{t.set(Bf,w)}}}),K7({rules:r}),T3(u.build())];t.set(Js,h);const d=i({schema:e,doc:a,plugins:h}),g=$o.create(d);return t.set(Bf,g),t.done(km),()=>{c(),t.remove(yh).remove(Bf).remove(vm).remove(d1).clearTimer(km)}});qs(zR,{displayName:"EditorState"});var $h=lt([],"pasteRule"),m1=lt([ar],"pasteRuleTimer"),Cm=ns("PasteRuleReady"),LR=t=>(t.inject($h,[]).inject(m1,[ar]).record(Cm),async()=>(await t.waitTimers(m1),t.done(Cm),()=>{t.remove($h).remove(m1).clearTimer(Cm)}));qs(LR,{displayName:"PasteRule"});var wm=ns("EditorViewReady"),g1=lt([],"editorViewTimer"),y1=lt({},"editorViewOptions"),xh=lt(null,"root"),Gb=lt(null,"rootDOM"),Yb=lt({},"rootAttrs");function lj(t,e){const n=document.createElement("div");n.className="milkdown",t.appendChild(n),e.set(Gb,n);const r=e.get(Yb);return Object.entries(r).forEach(([i,s])=>n.setAttribute(i,s)),n}function uj(t){t.classList.add("editor"),t.setAttribute("role","textbox")}var cj=new Ln("MILKDOWN_VIEW_CLEAR"),BR=t=>(t.inject(xh,document.body).inject(Vt,{}).inject(y1,{}).inject(Gb,null).inject(Yb,{}).inject(g1,[km,Cm]).record(wm),async()=>{await t.wait(el);const e=t.get(xh)||document.body,n=typeof e=="string"?document.querySelector(e):e;t.update(Js,a=>[new ur({key:cj,view:u=>{const c=n?lj(n,t):void 0;return(()=>{if(c&&n){const d=u.dom;n.replaceChild(c,d),c.appendChild(d)}})(),{destroy:()=>{c?.parentNode&&c?.parentNode.replaceChild(u.dom,c),c?.remove()}}}}),...a]),await t.waitTimers(g1);const r=t.get(Bf),i=t.get(y1),s=new ER(n,{state:r,nodeViews:Object.fromEntries(t.get(Ph)),markViews:Object.fromEntries(t.get(jh)),transformPasted:(a,u,c)=>(t.get($h).sort((h,d)=>(d.priority??50)-(h.priority??50)).map(h=>h.run).forEach(h=>{a=h(a,u,c)}),a),...i});return uj(s.dom),t.set(Vt,s),t.done(wm),()=>{s?.destroy(),t.remove(xh).remove(Vt).remove(y1).remove(Gb).remove(Yb).remove(g1).clearTimer(wm)}});qs(BR,{displayName:"EditorView"});var Zr=(function(t){return t.Idle="Idle",t.OnCreate="OnCreate",t.Created="Created",t.OnDestroy="OnDestroy",t.Destroyed="Destroyed",t})({}),FR=class VR{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===Zr.Created&&this.#c(n,this.#i),this},this.remove=async e=>this.#e===Zr.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===Zr.OnCreate?this:(this.#e===Zr.Created&&await this.destroy(),this.#u(Zr.OnCreate),this.#p(),this.#c([...this.#i.keys()],this.#i),await Promise.all([this.#h(this.#a),this.#h(this.#i)].flat()),this.#u(Zr.Created),this),this.destroy=async(e=!1)=>this.#e===Zr.Destroyed||this.#e===Zr.OnDestroy?this:this.#e===Zr.OnCreate?new Promise(n=>{setTimeout(()=>{n(this.destroy(e))},50)}):(e&&(this.#r=[]),this.#u(Zr.OnDestroy),await this.#f([...this.#i.keys()],e),await this.#d(),this.#u(Zr.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 VR}#t=!1;#e=Zr.Idle;#r=[];#n=()=>{};#o=new $M;#s=new E5;#i=new Map;#a=new Map;#l=new w5(this.#o,this.#s);#p=()=>{const e=tj(async r=>{await Promise.all(this.#r.map(i=>Promise.resolve(i(r))))}),n=[NR,DR,_R,MR,sj,LR,zR,BR,nj(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 a=await s();e.set(n,{ctx:i,handler:s,cleanup:a})});get ctx(){return this.#l}get status(){return this.#e}};function He(t,e){const n=rj(t),r=i=>async()=>{r.key=n,await i.wait(hh);const s=e(i);return i.get(kt).create(n,s),r.run=a=>i.get(kt).call(t,a),()=>{i.get(kt).remove(n)}};return r}function Ar(t){const e=n=>async()=>{await n.wait(ar);const r=t(n);return n.update(Fh,i=>[...i,r]),e.inputRule=r,()=>{n.update(Fh,i=>i.filter(s=>s!==r))}};return e}function fj(t){const e=n=>async()=>{await n.wait(ar);const r=t(n);return n.update($h,i=>[...i,r]),e.pasteRule=r,()=>{n.update($h,i=>i.filter(s=>s!==r))}};return e}function hj(t,e){const n=r=>async()=>{const i=e(r);return r.update(fh,s=>[...s.filter(a=>a[0]!==t),[t,i]]),n.id=t,n.schema=i,()=>{r.update(fh,s=>s.filter(([a])=>a!==t))}};return n.type=r=>{const i=r.get(Ki).marks[t];if(!i)throw S5(t);return i},n}function nc(t,e){const n=r=>async()=>{const i=e(r);return r.update(ch,s=>[...s.filter(a=>a[0]!==t),[t,i]]),n.id=t,n.schema=i,()=>{r.update(ch,s=>s.filter(([a])=>a!==t))}};return n.type=r=>{const i=r.get(Ki).nodes[t];if(!i)throw b5(t);return i},n}function _i(t){let e;const n=r=>async()=>(await r.wait(ar),e=t(r),r.update(Js,i=>[...i,e]),()=>{r.update(Js,i=>i.filter(s=>s!==e))});return n.plugin=()=>e,n.key=()=>e.spec.key,n}function pj(t){const e=n=>async()=>{await n.wait(ph);const r=n.get(ag),i=t(n),s=r.addObjectKeymap(i);return e.keymap=i,()=>{s()}};return e}function PR(t,e){const n=r=>async()=>{await r.wait(ar);const i=e(r);return t.type(r)instanceof Qm?r.update(Ph,s=>[...s,[t.id,i]]):r.update(jh,s=>[...s,[t.id,i]]),n.view=i,n.type=t,()=>{t.type(r)instanceof Qm?r.update(Ph,s=>s.filter(a=>a[0]!==t.id)):r.update(jh,s=>s.filter(a=>a[0]!==t.id))}};return n}function so(t,e){const n=lt(t,e),r=i=>(i.inject(n),()=>()=>{i.remove(n)});return r.key=n,r}function an(t,e){const n=so(e,t),r=nc(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=>an(t,s(e)),i}function rc(t,e){const n=so(e,t),r=hj(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=>rc(t,s(e)),i}function Pr(t,e){const n=so(Object.fromEntries(Object.entries(e).map(([s,{shortcuts:a,priority:u}])=>[s,{shortcuts:a,priority:u}])),`${t}Keymap`),r=pj(s=>{const a=s.get(n.key),u=Object.entries(e).flatMap(([c,{command:h}])=>{const d=a[c],g=[d.shortcuts].flat(),y=d.priority;return g.map(x=>[x,{key:x,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 zi=(t,e=()=>({}))=>so(e,`${t}Attr`),mp=(t,e=()=>({}))=>so(e,`${t}Attr`);function gi(t,e,n){const r=so({},t),i=a=>async()=>{await a.wait(el);const u={plugin:e(a),options:a.get(r.key)};return a.update(Vh,c=>[...c,u]),()=>{a.update(Vh,c=>c.filter(h=>h!==u))}},s=[r,i];return s.id=t,s.plugin=i,s.options=r,s}function Oi(t,e){return n=>n.get(kt).call(t,e)}function dj(t){return e=>{const n=e.get(Vt);return e.get(Ki),e.get(gh)(n.state.doc)}}function jR(t,e=!1){return n=>{const r=n.get(Vt),i=n.get(dh)(t);if(!i)return;if(!e){const{state:c}=r;return r.dispatch(c.tr.replace(0,c.doc.content.size,new q(i.content,0,0)))}const s=n.get(Ki),a=n.get(vm)({schema:s,doc:i,plugins:n.get(Js)}),u=$o.create(a);r.updateState(u)}}const $R=65535,JR=Math.pow(2,16);function mj(t,e){return t+e*JR}function TN(t){return t&$R}function gj(t){return(t-(t&$R))/JR}const UR=1,HR=2,Em=4,qR=8;let MN=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&qR)>0}get deletedBefore(){return(this.delInfo&(UR|Em))>0}get deletedAfter(){return(this.delInfo&(HR|Em))>0}get deletedAcross(){return(this.delInfo&Em)>0}},xl=class Tu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Tu.empty)return Tu.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+gj(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,a=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],d=this.ranges[u+a],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,x=c+i+(y<0?0:d);if(r)return x;let k=e==(n<0?c:g)?null:mj(u/3,e-c),w=e==c?HR:e==g?UR:Em;return(n<0?e!=c:e!=g)&&(w|=qR),new MN(x,w,k)}i+=d-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,a=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],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+a]-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 a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new Tu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Tu.empty:new Tu(e<0?[0,-e,0]:[0,0,e])}};xl.empty=new xl([]);const x1=Object.create(null);let Vn=class{getMap(){return xl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=x1[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 x1)throw new RangeError("Duplicate use of step JSON ID "+e);return x1[e]=n,n.prototype.jsonID=e,n}},tr=class Ff{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ff(e,null)}static fail(e){return new Ff(null,e)}static fromReplace(e,n,r,i){try{return Ff.ok(e.replace(n,r,i))}catch(s){if(s instanceof hi)return Ff.fail(s.message);throw s}}};function vv(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(vv(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let KR=class Vf 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 q(vv(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return tr.fromReplace(e,this.from,this.to,s)}invert(){return new GR(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 Vf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Vf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Vf(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 Vf(n.from,n.to,e.markFromJSON(n.mark))}};Vn.jsonID("addMark",KR);let GR=class Pf 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 q(vv(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return tr.fromReplace(e,this.from,this.to,r)}invert(){return new KR(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 Pf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Pf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pf(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 Pf(n.from,n.to,e.markFromJSON(n.mark))}};Vn.jsonID("removeMark",GR);let YR=class jf extends Vn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return tr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return tr.fromReplace(e,this.pos,this.pos+1,new q(W.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 jf(this.pos,n.marks[i]);return new jf(this.pos,this.mark)}}return new WR(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new jf(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 jf(n.pos,e.markFromJSON(n.mark))}};Vn.jsonID("addNodeMark",YR);let WR=class Wb extends Vn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return tr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return tr.fromReplace(e,this.pos,this.pos+1,new q(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new YR(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Wb(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 Wb(n.pos,e.markFromJSON(n.mark))}};Vn.jsonID("removeNodeMark",WR);let yj=class Lo 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&&Xb(e,this.from,this.to)?tr.fail("Structure replace would overwrite content"):tr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new xl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Lo(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 Lo(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Lo)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Lo(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Lo(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 Lo(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}};Vn.jsonID("replace",yj);let e0=class Am extends Vn{constructor(e,n,r,i,s,a,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(Xb(e,this.from,this.gapFrom)||Xb(e,this.gapTo,this.to)))return tr.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return tr.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?tr.fromReplace(e,this.from,this.to,r):tr.fail("Content does not fit in gap")}getMap(){return new xl([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 Am(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 Am(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 Am(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}};Vn.jsonID("replaceAround",e0);function Xb(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 a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function xj(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function bj(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let a=t.$from.node(r),u=t.$from.index(r)+i,c=t.$to.indexAfter(r)-s;if(r<t.depth&&a.canReplace(u,c,n))return r;if(r==0||a.type.spec.isolating||!xj(a,u,c))break;u&&(i=1),c<a.childCount&&(s=1)}return null}function Sj(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,a=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,d=n-2;h>s;h--,d--){let g=i.node(h),y=i.index(h);if(g.type.spec.isolating)return!1;let x=g.content.cutByIndex(y,g.childCount),k=r&&r[d+1];k&&(x=x.replaceChild(0,k.type.create(k.attrs)));let w=r&&r[d]||g;if(!g.canReplace(y+1,g.childCount)||!w.type.validContent(x))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 vj(t,e){let n=t.resolve(e),r=n.index();return Cj(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function kj(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),a=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(a),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Cj(t,e){return!!(t&&e&&!t.isLeaf&&kj(t,e))}let wj=class Nm 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 tr.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 tr.fromReplace(e,this.pos,this.pos+1,new q(W.from(i),0,n.isLeaf?0:1))}getMap(){return xl.empty}invert(e){return new Nm(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 Nm(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 Nm(n.pos,n.attr,n.value)}};Vn.jsonID("attr",wj);let Ej=class Qb 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 tr.ok(r)}getMap(){return xl.empty}invert(e){return new Qb(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 Qb(n.attr,n.value)}};Vn.jsonID("docAttr",Ej);let Jh=class extends Error{};Jh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Jh.prototype=Object.create(Error.prototype);Jh.prototype.constructor=Jh;Jh.prototype.name="TransformError";function Aj(t,e){return function(n,r){let{$from:i,$to:s,node:a}=n.selection;if(a&&a.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=W.empty,y=i.index(-1)?1:i.index(-2)?2:3;for(let T=i.depth-y;T>=i.depth-3;T--)g=W.from(i.node(T).copy(g));let x=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;g=g.append(W.from(t.createAndFill()));let k=i.before(i.depth-(y-1)),w=n.tr.replace(k,i.after(-x),new q(g,4-y,0)),N=-1;w.doc.nodesBetween(k,w.doc.content.size,(T,V)=>{if(N>-1)return!1;T.isTextblock&&T.content.size==0&&(N=V+1)}),N>-1&&w.setSelection(Pe.near(w.doc.resolve(N))),r(w.scrollIntoView())}return!0}let c=s.pos==i.end()?u.contentMatchAt(0).defaultType:null,h=n.tr.delete(i.pos,s.pos),d=c?[null,{type:c}]:void 0;return Sj(h.doc,i.pos,2,d)?(r&&r(h.split(i.pos,2,d).scrollIntoView()),!0):!1}}function Nj(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?Tj(e,n,t,s):Mj(e,n,s):!0:!1}}function Tj(t,e,n,r){let i=t.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(i.step(new e0(s-1,a,s,a,new q(W.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new EO(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const u=bj(r);if(u==null)return!1;i.lift(r,u);let c=i.doc.resolve(i.mapping.map(s,-1)-1);return vj(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),e(i.scrollIntoView()),!0}function Mj(t,e,n){let r=t.tr,i=n.parent;for(let x=n.end,k=n.endIndex-1,w=n.startIndex;k>w;k--)x-=i.child(k).nodeSize,r.delete(x-1,x+1);let s=r.doc.resolve(n.start),a=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),d=s.index(-1);if(!h.canReplace(d+(u?0:1),d+1,a.content.append(c?W.empty:W.from(i))))return!1;let g=s.pos,y=g+a.nodeSize;return r.step(new e0(g-(u?1:0),y+(c?1:0),g+1,y-1,new q((u?W.empty:W.from(i.copy(W.empty))).append(c?W.empty:W.from(i.copy(W.empty))),u?0:1,c?0:1),u?0:1)),e(r.scrollIntoView()),!0}function Oj(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 a=s.startIndex;if(a==0)return!1;let u=s.parent,c=u.child(a-1);if(c.type!=t)return!1;if(n){let h=c.lastChild&&c.lastChild.type==u.type,d=W.from(h?t.create():null),g=new q(W.from(t.create(null,W.from(u.type.create(null,d)))),h?3:1,0),y=s.start,x=s.end;n(e.tr.step(new e0(y-(h?3:1),x,y,x,g,1,!0)).scrollIntoView())}return!0}}const XR=65535,QR=Math.pow(2,16);function Rj(t,e){return t+e*QR}function ON(t){return t&XR}function Dj(t){return(t-(t&XR))/QR}const ZR=1,eD=2,Tm=4,tD=8;let RN=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&tD)>0}get deletedBefore(){return(this.delInfo&(ZR|Tm))>0}get deletedAfter(){return(this.delInfo&(eD|Tm))>0}get deletedAcross(){return(this.delInfo&Tm)>0}},bl=class Mu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Mu.empty)return Mu.empty}recover(e){let n=0,r=ON(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+Dj(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,a=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],d=this.ranges[u+a],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,x=c+i+(y<0?0:d);if(r)return x;let k=e==(n<0?c:g)?null:Rj(u/3,e-c),w=e==c?eD:e==g?ZR:Tm;return(n<0?e!=c:e!=g)&&(w|=tD),new RN(x,w,k)}i+=d-h}return r?e+i:new RN(e+i,0,null)}touches(e,n){let r=0,i=ON(n),s=this.inverted?2:1,a=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],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+a]-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 a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new Mu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Mu.empty:new Mu(e<0?[0,-e,0]:[0,0,e])}};bl.empty=new bl([]);const b1=Object.create(null);let Pn=class{getMap(){return bl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=b1[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 b1)throw new RangeError("Duplicate use of step JSON ID "+e);return b1[e]=n,n.prototype.jsonID=e,n}},nr=class $f{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new $f(e,null)}static fail(e){return new $f(null,e)}static fromReplace(e,n,r,i){try{return $f.ok(e.replace(n,r,i))}catch(s){if(s instanceof hi)return $f.fail(s.message);throw s}}};function kv(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(kv(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let Cv=class Jf extends Pn{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 q(kv(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return nr.fromReplace(e,this.from,this.to,s)}invert(){return new nD(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 Jf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Jf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jf(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 Jf(n.from,n.to,e.markFromJSON(n.mark))}};Pn.jsonID("addMark",Cv);let nD=class Uf extends Pn{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 q(kv(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return nr.fromReplace(e,this.from,this.to,r)}invert(){return new Cv(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 Uf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Uf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Uf(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 Uf(n.from,n.to,e.markFromJSON(n.mark))}};Pn.jsonID("removeMark",nD);let rD=class Hf extends Pn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return nr.fromReplace(e,this.pos,this.pos+1,new q(W.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 Hf(this.pos,n.marks[i]);return new Hf(this.pos,this.mark)}}return new iD(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Hf(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 Hf(n.pos,e.markFromJSON(n.mark))}};Pn.jsonID("addNodeMark",rD);let iD=class Zb extends Pn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return nr.fromReplace(e,this.pos,this.pos+1,new q(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new rD(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Zb(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 Zb(n.pos,e.markFromJSON(n.mark))}};Pn.jsonID("removeNodeMark",iD);let wv=class Ra extends Pn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&eS(e,this.from,this.to)?nr.fail("Structure replace would overwrite content"):nr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new bl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ra(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&&Ra.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Ra(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ra)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ra(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ra(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 Ra(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}};wv.MAP_BIAS=1;Pn.jsonID("replace",wv);let Ij=class Mm extends Pn{constructor(e,n,r,i,s,a,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(eS(e,this.from,this.gapFrom)||eS(e,this.gapTo,this.to)))return nr.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return nr.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?nr.fromReplace(e,this.from,this.to,r):nr.fail("Content does not fit in gap")}getMap(){return new bl([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 Mm(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 Mm(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 Mm(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}};Pn.jsonID("replaceAround",Ij);function eS(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 a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function _j(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function zj(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let a=t.$from.node(r),u=t.$from.index(r)+i,c=t.$to.indexAfter(r)-s;if(r<t.depth&&a.canReplace(u,c,n))return r;if(r==0||a.type.spec.isolating||!_j(a,u,c))break;u&&(i=1),c<a.childCount&&(s=1)}return null}function Lj(t,e,n=null,r=t){let i=Bj(t,e),s=i&&Fj(r,e);return s?i.map(DN).concat({type:e,attrs:n}).concat(s.map(DN)):null}function DN(t){return{type:t,attrs:null}}function Bj(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let a=s.length?s[0]:e;return n.canReplaceWith(r,i,a)?s:null}function Fj(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),a=e.contentMatch.findWrapping(s.type);if(!a)return null;let c=(a.length?a[a.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(n.child(h).type);return!c||!c.validEnd?null:a}let Vj=class Om extends Pn{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 nr.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 nr.fromReplace(e,this.pos,this.pos+1,new q(W.from(i),0,n.isLeaf?0:1))}getMap(){return bl.empty}invert(e){return new Om(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 Om(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 Om(n.pos,n.attr,n.value)}};Pn.jsonID("attr",Vj);let Pj=class tS extends Pn{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 nr.ok(r)}getMap(){return bl.empty}invert(e){return new tS(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 tS(n.attr,n.value)}};Pn.jsonID("docAttr",Pj);let Uh=class extends Error{};Uh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Uh.prototype=Object.create(Error.prototype);Uh.prototype.constructor=Uh;Uh.prototype.name="TransformError";function Ev(t,e,n,r){let i,s,a;typeof e=="function"&&typeof n!="function"?(s=void 0,a=e,i=n):(s=e,a=n,i=r),ec(t,s,u,i);function u(c,h){const d=h[h.length-1],g=d?d.children.indexOf(c):void 0;return a(c,g,d)}}function jj(t,e,n,r){let i,s,a;s=e,a=n,i=r,ec(t,s,u,i);function u(c,h){const d=h[h.length-1],g=d?d.children.indexOf(c):void 0;return a(c,g,d)}}function $j(t){const e=new Map;if(!t||!t.type)throw new Error("mdast-util-definitions expected node");return jj(t,"definition",function(r){const i=IN(r.identifier);i&&!e.get(i)&&e.set(i,r)}),n;function n(r){const i=IN(r);return e.get(i)}}function IN(t){return String(t||"").toUpperCase()}function Jj(t,e,n,r){let i,s,a;typeof e=="function"&&typeof n!="function"?(s=void 0,a=e,i=n):(s=e,a=n,i=r),ec(t,s,u,i);function u(c,h){const d=h[h.length-1],g=d?d.children.indexOf(c):void 0;return a(c,g,d)}}function Uj(){return function(t){const e=$j(t);Jj(t,function(n,r,i){if(n.type==="definition"&&i!==void 0&&typeof r=="number")return i.children.splice(r,1),[pb,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},[pb,r]}})}}function sD(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(W.fromArray(n))}function de(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-commonmark",...e}}),t}var Av=mp("emphasis");de(Av,{displayName:"Attr<emphasis>",group:"Emphasis"});var ic=rc("emphasis",t=>({attrs:{marker:{default:t.get(uh).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",t.get(Av.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})}}}));de(ic.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});de(ic.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var t0=He("ToggleEmphasis",t=>()=>Wg(ic.type(t)));de(t0,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var aD=Ar(t=>fp(/(?:^|[^*])\*([^*]+)\*$/,ic.type(t),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:n+1}}));de(aD,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var oD=Ar(t=>fp(/\b_(?![_\s])(.*?[^_\s])_\b/,ic.type(t),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:n+1}}));de(oD,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var Nv=Pr("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:t=>{const e=t.get(kt);return()=>e.call(t0.key)}}});de(Nv.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});de(Nv.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var Tv=mp("strong");de(Tv,{displayName:"Attr<strong>",group:"Strong"});var gp=rc("strong",t=>({attrs:{marker:{default:t.get(uh).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(Tv.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})}}}));de(gp.mark,{displayName:"MarkSchema<strong>",group:"Strong"});de(gp.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var n0=He("ToggleStrong",t=>()=>Wg(gp.type(t)));de(n0,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var lD=Ar(t=>fp(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),gp.type(t),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));de(lD,{displayName:"InputRule<strong>",group:"Strong"});var Mv=Pr("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:t=>{const e=t.get(kt);return()=>e.call(n0.key)}}});de(Mv.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});de(Mv.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var Ov=mp("inlineCode");de(Ov,{displayName:"Attr<inlineCode>",group:"InlineCode"});var ja=rc("inlineCode",t=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:e=>["code",t.get(Ov.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)}}));de(ja.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});de(ja.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var Rv=He("ToggleInlineCode",t=>()=>(e,n)=>{const{selection:r,tr:i}=e;if(r.empty)return!1;const{from:s,to:a}=r;return e.doc.rangeHasMark(s,a,ja.type(t))?(n?.(i.removeMark(s,a,ja.type(t))),!0):(Object.keys(e.schema.marks).filter(u=>u!==ja.type.name).map(u=>e.schema.marks[u]).forEach(u=>{i.removeMark(s,a,u)}),n?.(i.addMark(s,a,ja.type(t).create())),!0)});de(Rv,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var uD=Ar(t=>fp(/(?:`)([^`]+)(?:`)$/,ja.type(t)));de(uD,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var Dv=Pr("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:t=>{const e=t.get(kt);return()=>e.call(Rv.key)}}});de(Dv.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});de(Dv.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var Iv=mp("link");de(Iv,{displayName:"Attr<link>",group:"Link"});var Pu=rc("link",t=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw ts(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...t.get(Iv.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})}}}));de(Pu.mark,{displayName:"MarkSchema<link>",group:"Link"});var _v=He("ToggleLink",t=>(e={})=>Wg(Pu.type(t),e));de(_v,{displayName:"Command<toggleLinkCommand>",group:"Link"});var zv=He("UpdateLink",t=>(e={})=>(n,r)=>{if(!r)return!1;let i,s=-1;const{selection:a}=n,{from:u,to:c}=a;if(n.doc.nodesBetween(u,u===c?c+1:c,(k,w)=>{if(Pu.type(t).isInSet(k.marks))return i=k,s=w,!1}),!i)return!1;const h=i.marks.find(({type:k})=>k===Pu.type(t));if(!h)return!1;const d=s,g=s+i.nodeSize,{tr:y}=n,x=Pu.type(t).create({...h.attrs,...e});return x?(r(y.removeMark(d,g,h).addMark(d,g,x).setSelection(new Oe(y.selection.$anchor)).scrollIntoView()),!0):!1});de(zv,{displayName:"Command<updateLinkCommand>",group:"Link"});var cD=nc("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)}}}));de(cD,{displayName:"NodeSchema<doc>",group:"Doc"});function Hj(t){return ec(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 r0=gi("remark-preserve-empty-line",()=>()=>Hj);de(r0.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});de(r0.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var Lv=zi("paragraph");de(Lv,{displayName:"Attr<paragraph>",group:"Paragraph"});var Xi=an("paragraph",t=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",t.get(Lv.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(Vt).state?.doc.lastChild;e.openNode("paragraph"),(!n.content||n.content.size===0)&&n!==r&&qj(t)?e.addNode("html",void 0,"<br />"):sD(e,n),e.closeNode()}}}));function qj(t){let e=!1;try{t.get(r0.id),e=!0}catch{e=!1}return e}de(Xi.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});de(Xi.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var Bv=He("TurnIntoText",t=>()=>Dh(Xi.type(t)));de(Bv,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var Fv=Pr("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:t=>{const e=t.get(kt);return()=>e.call(Bv.key)}}});de(Fv.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});de(Fv.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var Kj=Array(6).fill(0).map((t,e)=>e+1);function Gj(t){return t.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var i0=so(Gj,"headingIdGenerator");de(i0,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var Vv=zi("heading");de(Vv,{displayName:"Attr<heading>",group:"Heading"});var El=an("heading",t=>{const e=t.get(i0.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:Kj.map(n=>({tag:`h${n}`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw ts(r);return{level:n,id:r.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...t.get(Vv.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}),sD(n,r),n.closeNode()}}}});de(El.node,{displayName:"NodeSchema<heading>",group:"Heading"});de(El.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var fD=Ar(t=>E3(/^(?<hashes>#+)\s$/,El.type(t),e=>{const n=e.groups?.hashes?.length||0,{$from:r}=t.get(Vt).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}}));de(fD,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var _a=He("WrapInHeading",t=>e=>(e??=1,e<1?Dh(Xi.type(t)):Dh(El.type(t),{level:e})));de(_a,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var Pv=He("DowngradeHeading",t=>()=>(e,n,r)=>{const{$from:i}=e.selection,s=i.node();if(s.type!==El.type(t)||!e.selection.empty||i.parentOffset!==0)return!1;const a=s.attrs.level-1;return a?(n?.(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...s.attrs,level:a})),!0):Dh(Xi.type(t))(e,n,r)});de(Pv,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var jv=Pr("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:t=>{const e=t.get(kt);return()=>e.call(_a.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:t=>{const e=t.get(kt);return()=>e.call(_a.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:t=>{const e=t.get(kt);return()=>e.call(_a.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:t=>{const e=t.get(kt);return()=>e.call(_a.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:t=>{const e=t.get(kt);return()=>e.call(_a.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:t=>{const e=t.get(kt);return()=>e.call(_a.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:t=>{const e=t.get(kt);return()=>e.call(Pv.key)}}});de(jv.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});de(jv.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var $v=zi("blockquote");de($v,{displayName:"Attr<blockquote>",group:"Blockquote"});var yp=an("blockquote",t=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",t.get($v.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()}}}));de(yp.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});de(yp.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var hD=Ar(t=>cv(/^\s*>\s$/,yp.type(t)));de(hD,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var s0=He("WrapInBlockquote",t=>()=>lv(yp.type(t)));de(s0,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var Jv=Pr("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:t=>{const e=t.get(kt);return()=>e.call(s0.key)}}});de(Jv.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});de(Jv.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var Uv=zi("codeBlock",()=>({pre:{},code:{}}));de(Uv,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var xp=an("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 ts(e);return{language:e.dataset.language}}}],toDOM:e=>{const n=t.get(Uv.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})}}}));de(xp.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});de(xp.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var pD=Ar(t=>E3(/^```(?<language>[a-z]*)?[\s\n]$/,xp.type(t),e=>({language:e.groups?.language??""})));de(pD,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var Hv=He("CreateCodeBlock",t=>(e="")=>Dh(xp.type(t),{language:e}));de(Hv,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var Yj=He("UpdateCodeBlockLanguage",()=>({pos:t,language:e}={pos:-1,language:""})=>(n,r)=>t>=0?(r?.(n.tr.setNodeAttribute(t,"language",e)),!0):!1);de(Yj,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var qv=Pr("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:t=>{const e=t.get(kt);return()=>e.call(Hv.key)}}});de(qv.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});de(qv.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var Kv=zi("image");de(Kv,{displayName:"Attr<image>",group:"Image"});var sc=an("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 ts(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...t.get(Kv.key)(e),...e.attrs}],parseMarkdown:{match:({type:e})=>e==="image",runner:(e,n,r)=>{const i=n.url,s=n.alt,a=n.title;e.addNode(r,{src:i,alt:s,title:a})}},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})}}}));de(sc.node,{displayName:"NodeSchema<image>",group:"Image"});de(sc.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var dD=He("InsertImage",t=>(e={})=>(n,r)=>{if(!r)return!0;const{src:i="",alt:s="",title:a=""}=e,u=sc.type(t).create({src:i,alt:s,title:a});return u&&r(n.tr.replaceSelectionWith(u).scrollIntoView()),!0});de(dD,{displayName:"Command<insertImageCommand>",group:"Image"});var mD=He("UpdateImage",t=>(e={})=>(n,r)=>{const i=Q7(n.selection,sc.type(t));if(!i)return!1;const{node:s,pos:a}=i,u={...s.attrs},{src:c,alt:h,title:d}=e;return c!==void 0&&(u.src=c),h!==void 0&&(u.alt=h),d!==void 0&&(u.title=d),r?.(n.tr.setNodeMarkup(a,void 0,u).scrollIntoView()),!0});de(mD,{displayName:"Command<updateImageCommand>",group:"Image"});var Wj=Ar(t=>new Vr(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,n,r,i)=>{const[s,a,u="",c]=n;return s?e.tr.replaceWith(r,i,sc.type(t).create({src:u,alt:a,title:c})):null}));de(Wj,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var og=zi("hardbreak",t=>({"data-type":"hardbreak","data-is-inline":t.attrs.isInline}));de(og,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var tl=an("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(og.key)(e)," "]:["br",t.get(og.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")}}}));de(tl.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});de(tl.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var Gv=He("InsertHardbreak",t=>()=>(e,n)=>{const{selection:r,tr:i}=e;if(!(r instanceof Oe))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(Pe.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(tl.type(t).create()).scrollIntoView()),!0});de(Gv,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var Yv=Pr("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:t=>{const e=t.get(kt);return()=>e.call(Gv.key)}}});de(Yv.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});de(Yv.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var Wv=zi("hr");de(Wv,{displayName:"Attr<hr>",group:"Hr"});var bp=an("hr",t=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:e=>["hr",t.get(Wv.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")}}}));de(bp.node,{displayName:"NodeSchema<hr>",group:"Hr"});de(bp.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var gD=Ar(t=>new Vr(/^(?:---|___\s|\*\*\*\s)$/,(e,n,r,i)=>{const{tr:s}=e;return n[0]&&s.replaceWith(r-1,i,bp.type(t).create()),s}));de(gD,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var yD=He("InsertHr",t=>()=>(e,n)=>{if(!n)return!0;const r=Xi.node.type(t).create(),{tr:i,selection:s}=e,{from:a}=s,u=bp.type(t).create();if(!u)return!0;const c=i.replaceSelectionWith(u).insert(a,r),h=Pe.findFrom(c.doc.resolve(a),1,!0);return h&&n(c.setSelection(h).scrollIntoView()),!0});de(yD,{displayName:"Command<insertHrCommand>",group:"Hr"});var a0=zi("bulletList");de(a0,{displayName:"Attr<bulletList>",group:"BulletList"});var Al=an("bullet_list",t=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw ts(e);return{spread:e.dataset.spread==="true"}}}],toDOM:e=>["ul",{...t.get(a0.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()}}}));de(Al.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});de(Al.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var xD=Ar(t=>cv(/^\s*([-+*])\s$/,Al.type(t)));de(xD,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var o0=He("WrapInBulletList",t=>()=>lv(Al.type(t)));de(o0,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var Xv=Pr("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:t=>{const e=t.get(kt);return()=>e.call(o0.key)}}});de(Xv.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});de(Xv.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var l0=zi("orderedList");de(l0,{displayName:"Attr<orderedList>",group:"OrderedList"});var Nl=an("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 ts(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:e=>["ol",{...t.get(l0.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()}}}));de(Nl.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});de(Nl.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var bD=Ar(t=>cv(/^\s*(\d+)\.\s$/,Nl.type(t),e=>({order:Number(e[1])}),(e,n)=>n.childCount+n.attrs.order===Number(e[1])));de(bD,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var u0=He("WrapInOrderedList",t=>()=>lv(Nl.type(t)));de(u0,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var Qv=Pr("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:t=>{const e=t.get(kt);return()=>e.call(u0.key)}}});de(Qv.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});de(Qv.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var Zv=zi("listItem");de(Zv,{displayName:"Attr<listItem>",group:"ListItem"});var Ks=an("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 ts(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread==="true"}}}],toDOM:e=>["li",{...t.get(Zv.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",a=n.spread!=null?`${n.spread}`:"true";e.openNode(r,{label:i,listType:s,spread:a}),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()}}}));de(Ks.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});de(Ks.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var ek=He("SinkListItem",t=>()=>Oj(Ks.type(t)));de(ek,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var c0=He("LiftListItem",t=>()=>Nj(Ks.type(t)));de(c0,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var tk=He("SplitListItem",t=>()=>Aj(Ks.type(t)));de(tk,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function Xj(t){return(e,n,r)=>{const{selection:i}=e;if(!(i instanceof Oe))return!1;const{empty:s,$from:a}=i;return!s||a.parentOffset!==0||a.node(-1).type!==Ks.type(t)?!1:c3(e,n,r)}}var nk=He("LiftFirstListItem",t=>()=>Xj(t));de(nk,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var rk=Pr("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:t=>{const e=t.get(kt);return()=>e.call(tk.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:t=>{const e=t.get(kt);return()=>e.call(ek.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:t=>{const e=t.get(kt);return()=>e.call(c0.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:t=>{const e=t.get(kt);return()=>e.call(nk.key)}}});de(rk.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});de(rk.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var SD=nc("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)}}}));de(SD,{displayName:"NodeSchema<text>",group:"Text"});var ik=zi("html");de(ik,{displayName:"Attr<html>",group:"Html"});var sk=an("html",t=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:e=>{const n=document.createElement("span"),r={...t.get(ik.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)}}}));de(sk.node,{displayName:"NodeSchema<html>",group:"Html"});de(sk.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var Qj=[cD,Lv,Xi,i0,Vv,El,og,tl,$v,yp,Uv,xp,Wv,bp,Kv,sc,a0,Al,l0,Nl,Zv,Ks,Av,ic,Tv,gp,Ov,ja,Iv,Pu,ik,sk,SD].flat(),Zj=[hD,xD,bD,pD,gD,fD].flat(),e$=[aD,oD,uD,lD],t$=He("IsMarkSelected",()=>t=>e=>{if(!t)return!1;const{doc:n,selection:r}=e;return n.rangeHasMark(r.from,r.to,t)}),n$=He("IsNoteSelected",()=>t=>e=>t?Z7(e,t).hasNode:!1),r$=He("ClearTextInCurrentBlock",()=>()=>(t,e)=>{let n=t.tr;const{$from:r,$to:i}=n.selection,{pos:s}=r,{pos:a}=i,u=s-r.node().content.size;return u<0?!1:(n=n.deleteRange(u,a),e?.(n),!0)}),i$=He("SetBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;const s=e.tr,{from:a,to:u}=s.selection;try{s.setBlockType(a,u,r,i)}catch{return!1}return n?.(s),!0}),s$=He("WrapInBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;let s=e.tr;try{const{$from:a,$to:u}=s.selection,c=a.blockRange(u),h=c&&Lj(c,r,i);if(!h)return!1;s=s.wrap(c,h)}catch{return!1}return n?.(s),!0}),a$=He("AddBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;const s=e.tr;try{const a=r instanceof Fs?r:r.createAndFill(i);if(!a)return!1;s.replaceSelectionWith(a)}catch{return!1}return n?.(s),!0}),o$=He("SelectTextNearPos",()=>t=>(e,n)=>{const{pos:r}=t??{};if(r==null)return!1;const i=(a,u,c)=>Math.min(Math.max(a,u),c),s=e.tr;try{const a=e.doc.resolve(i(r,0,e.doc.content.size));s.setSelection(Oe.near(a))}catch{return!1}return n?.(s.scrollIntoView()),!0}),l$=[Bv,s0,_a,Pv,Hv,Gv,yD,dD,mD,u0,o0,ek,tk,c0,nk,t0,Rv,n0,_v,zv,t$,n$,r$,i$,s$,a$,o$],u$=[Jv,qv,Yv,jv,rk,Qv,Xv,Fv,Nv,Dv,Mv].flat(),ak=gi("remarkAddOrderInList",()=>()=>t=>{Ev(t,"list",e=>{if(e.ordered){const n=e.start??1;e.children.forEach((r,i)=>{r.label=i+n})}})});de(ak.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});de(ak.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var ok=gi("remarkLineBreak",()=>()=>t=>{const e=/[\t ]*(?:\r?\n|\r)/g;Ev(t,"text",(n,r,i)=>{if(!n.value||typeof n.value!="string")return;const s=[];let a=0;e.lastIndex=0;let u=e.exec(n.value);for(;u;){const c=u.index;a!==c&&s.push({type:"text",value:n.value.slice(a,c)}),s.push({type:"break",data:{isInline:!0}}),a=c+u[0].length,u=e.exec(n.value)}if(s.length>0&&i&&typeof r=="number")return a<n.value.length&&s.push({type:"text",value:n.value.slice(a)}),i.children.splice(r,1,...s),r+s.length})});de(ok.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});de(ok.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var lk=gi("remarkInlineLink",()=>Uj);de(lk.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});de(lk.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var c$=t=>!!t.children,f$=t=>t.type==="html";function h$(t,e){return n(t,0,null)[0];function n(r,i,s){if(c$(r)){const a=[];for(let u=0,c=r.children.length;u<c;u++){const h=r.children[u];if(h){const d=n(h,u,r);if(d)for(let g=0,y=d.length;g<y;g++){const x=d[g];x&&a.push(x)}}}r.children=a}return e(r,i,s)}}var p$=["root","blockquote","listItem"],uk=gi("remarkHTMLTransformer",()=>()=>t=>{h$(t,(e,n,r)=>f$(e)?(r&&p$.includes(r.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])});de(uk.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});de(uk.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var ck=gi("remarkMarker",()=>()=>(t,e)=>{const n=r=>e.value.charAt(r.position.start.offset);Ev(t,r=>["strong","emphasis"].includes(r.type),r=>{r.marker=n(r)})});de(ck.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});de(ck.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var vD=_i(()=>{let t=!1;const e=new ur({key:new Ln("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=Qa.widget(r,i,{side:-1}),a=document.createElement("span"),u=Qa.widget(r,a);return setTimeout(()=>{i.contentEditable="true",a.contentEditable="true"}),ci.create(n.doc,[s,u])}return ci.empty}}});return e});de(vD,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var kD=_i(t=>new ur({key:new Ln("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 wv))return;const{from:a}=s;return r.tr.setNodeMarkup(a,tl.type(t),void 0,[])}if(s instanceof Cv){let a=r.tr;const{from:u,to:c}=s;return r.doc.nodesBetween(u,c,(h,d)=>{h.type===tl.type(t)&&(a=a.setNodeMarkup(d,tl.type(t),void 0,[]))}),a}}}));de(kD,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var fk=so(["table","code_block"],"hardbreakFilterNodes");de(fk,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var CD=_i(t=>{const e=t.get(fk.key);return new ur({key:new Ln("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(n,r)=>{const i=n.getMeta("hardbreak"),[s]=n.steps;if(i&&s){const{from:a}=s,u=r.doc.resolve(a);let c=u.depth,h=!0;for(;c>0;)e.includes(u.node(c).type.name)&&(h=!1),c--;return h}return!0}})});de(CD,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var wD=_i(t=>{const e=new Ln("MILKDOWN_HEADING_ID"),n=r=>{if(r.composing)return;const i=t.get(i0.key),s=r.state.tr.setMeta("addToHistory",!1);let a=!1;const u={};r.state.doc.descendants((c,h)=>{if(c.type===El.type(t)){if(c.textContent.trim().length===0)return;const d=c.attrs;let g=i(c);u[g]?(u[g]+=1,g+=`-#${u[g]}`):u[g]=1,d.id!==g&&(a=!0,s.setMeta(e,!0).setNodeMarkup(h,void 0,{...d,id:g}))}}),a&&r.dispatch(s)};return new ur({key:e,view:r=>(n(r),{update:(i,s)=>{i.state.doc.eq(s.doc)||n(i)}})})});de(wD,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var ED=_i(t=>{const e=(n,r,i)=>{if(!i.selection||n.some(g=>g.getMeta("addToHistory")===!1||!g.isGeneric))return null;const s=Nl.type(t),a=Al.type(t),u=Ks.type(t),c=(g,y,x=1)=>{let k=!1;const w=`${y+x}.`;return g.label!==w&&(g.label=w,k=!0),k};let h=i.tr,d=!1;return i.doc.descendants((g,y,x,k)=>{if(g.type===a){const w=g.maybeChild(0);w?.type===u&&w.attrs.listType==="ordered"&&(d=!0,h.setNodeMarkup(y,s,{spread:"true"}),g.descendants((N,T,V,F)=>{if(N.type===u){const K={...N.attrs};c(K,F)&&(h=h.setNodeMarkup(T,void 0,K))}return!1}))}else if(g.type===u&&x?.type===s){const w={...g.attrs};let N=!1;w.listType!=="ordered"&&(w.listType="ordered",N=!0),x?.maybeChild(0)&&(N=c(w,k,x?.attrs.order??1)),N&&(h=h.setNodeMarkup(y,void 0,w),d=!0)}}),d?h.setMeta("addToHistory",!1):null};return new ur({key:new Ln("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:e})});de(ED,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var d$=[kD,fk,CD,vD,ak,lk,ok,uk,ck,r0,wD,ED].flat(),AD=[Qj,Zj,e$,l$,u$,d$].flat();const ND=65535,TD=Math.pow(2,16);function m$(t,e){return t+e*TD}function _N(t){return t&ND}function g$(t){return(t-(t&ND))/TD}const MD=1,OD=2,Rm=4,RD=8;let nS=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&RD)>0}get deletedBefore(){return(this.delInfo&(MD|Rm))>0}get deletedAfter(){return(this.delInfo&(OD|Rm))>0}get deletedAcross(){return(this.delInfo&Rm)>0}},Sl=class Ou{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ou.empty)return Ou.empty}recover(e){let n=0,r=_N(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+g$(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,a=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],d=this.ranges[u+a],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,x=c+i+(y<0?0:d);if(r)return x;let k=e==(n<0?c:g)?null:m$(u/3,e-c),w=e==c?OD:e==g?MD:Rm;return(n<0?e!=c:e!=g)&&(w|=RD),new nS(x,w,k)}i+=d-h}return r?e+i:new nS(e+i,0,null)}touches(e,n){let r=0,i=_N(n),s=this.inverted?2:1,a=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],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+a]-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 a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new Ou(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ou.empty:new Ou(e<0?[0,-e,0]:[0,0,e])}};Sl.empty=new Sl([]);let y$=class rS{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 rS(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 rS;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 a=this._maps[s],u=a.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 nS(e,i,null)}};const S1=Object.create(null);let jn=class{getMap(){return Sl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=S1[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 S1)throw new RangeError("Duplicate use of step JSON ID "+e);return S1[e]=n,n.prototype.jsonID=e,n}},rr=class qf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new qf(e,null)}static fail(e){return new qf(null,e)}static fromReplace(e,n,r,i){try{return qf.ok(e.replace(n,r,i))}catch(s){if(s instanceof hi)return qf.fail(s.message);throw s}}};function hk(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(hk(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let pk=class Kf extends jn{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 q(hk(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return rr.fromReplace(e,this.from,this.to,s)}invert(){return new Sp(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 Kf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Kf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kf(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 Kf(n.from,n.to,e.markFromJSON(n.mark))}};jn.jsonID("addMark",pk);let Sp=class Gf extends jn{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 q(hk(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return rr.fromReplace(e,this.from,this.to,r)}invert(){return new pk(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 Gf(n.pos,r.pos,this.mark)}merge(e){return e instanceof Gf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gf(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 Gf(n.from,n.to,e.markFromJSON(n.mark))}};jn.jsonID("removeMark",Sp);let dk=class Yf extends jn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return rr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return rr.fromReplace(e,this.pos,this.pos+1,new q(W.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 Yf(this.pos,n.marks[i]);return new Yf(this.pos,this.mark)}}return new lg(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yf(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 Yf(n.pos,e.markFromJSON(n.mark))}};jn.jsonID("addNodeMark",dk);let lg=class iS extends jn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return rr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return rr.fromReplace(e,this.pos,this.pos+1,new q(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new dk(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new iS(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 iS(n.pos,e.markFromJSON(n.mark))}};jn.jsonID("removeNodeMark",lg);let Za=class Bo extends jn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&sS(e,this.from,this.to)?rr.fail("Structure replace would overwrite content"):rr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Sl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Bo(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 Bo(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Bo)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Bo(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Bo(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 Bo(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}};jn.jsonID("replace",Za);let ac=class Dm extends jn{constructor(e,n,r,i,s,a,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(sS(e,this.from,this.gapFrom)||sS(e,this.gapTo,this.to)))return rr.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return rr.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?rr.fromReplace(e,this.from,this.to,r):rr.fail("Content does not fit in gap")}getMap(){return new Sl([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 Dm(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 Dm(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 Dm(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}};jn.jsonID("replaceAround",ac);function sS(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 a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function x$(t,e,n,r){let i=[],s=[],a,u;t.doc.nodesBetween(e,n,(c,h,d)=>{if(!c.isInline)return;let g=c.marks;if(!r.isInSet(g)&&d.type.allowsMarkType(r.type)){let y=Math.max(h,e),x=Math.min(h+c.nodeSize,n),k=r.addToSet(g);for(let w=0;w<g.length;w++)g[w].isInSet(k)||(a&&a.to==y&&a.mark.eq(g[w])?a.to=x:i.push(a=new Sp(y,x,g[w])));u&&u.to==y?u.to=x:s.push(u=new pk(y,x,r))}}),i.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function b$(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(a,u)=>{if(!a.isInline)return;s++;let c=null;if(r instanceof up){let h=a.marks,d;for(;d=r.isInSet(h);)(c||(c=[])).push(d),h=d.removeFromSet(h)}else r?r.isInSet(a.marks)&&(c=[r]):c=a.marks;if(c&&c.length){let h=Math.min(u+a.nodeSize,n);for(let d=0;d<c.length;d++){let g=c[d],y;for(let x=0;x<i.length;x++){let k=i[x];k.step==s-1&&g.eq(i[x].style)&&(y=k)}y?(y.to=h,y.step=s):i.push({style:g,from:Math.max(u,e),to:h,step:s})}}}),i.forEach(a=>t.step(new Sp(a.from,a.to,a.style)))}function mk(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),a=[],u=e+1;for(let c=0;c<s.childCount;c++){let h=s.child(c),d=u+h.nodeSize,g=r.matchType(h.type);if(!g)a.push(new Za(u,d,q.empty));else{r=g;for(let y=0;y<h.marks.length;y++)n.allowsMarkType(h.marks[y].type)||t.step(new Sp(u,d,h.marks[y]));if(i&&h.isText&&n.whitespace!="pre"){let y,x=/\r?\n|\r/g,k;for(;y=x.exec(h.text);)k||(k=new q(W.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),a.push(new Za(u+y.index,u+y.index+y[0].length,k))}}u=d}if(!r.validEnd){let c=r.fillBefore(W.empty,!0);t.replace(u,u,new q(c,0,0))}for(let c=a.length-1;c>=0;c--)t.step(a[c])}function S$(t,e,n){let{$from:r,$to:i,depth:s}=e,a=r.before(s+1),u=i.after(s+1),c=a,h=u,d=W.empty,g=0;for(let k=s,w=!1;k>n;k--)w||r.index(k)>0?(w=!0,d=W.from(r.node(k).copy(d)),g++):c--;let y=W.empty,x=0;for(let k=s,w=!1;k>n;k--)w||i.after(k+1)<i.end(k)?(w=!0,y=W.from(i.node(k).copy(y)),x++):h++;t.step(new ac(c,h,a,u,new q(d.append(y),g,x),d.size-g,!0))}function v$(t,e,n){let r=W.empty;for(let a=n.length-1;a>=0;a--){if(r.size){let u=n[a].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=W.from(n[a].type.create(n[a].attrs,r))}let i=e.start,s=e.end;t.step(new ac(i,s,i,s,new q(r,0,0),n.length,!0))}function k$(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,(a,u)=>{let c=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,c)&&C$(t.doc,t.mapping.slice(s).map(u),r)){let h=null;if(r.schema.linebreakReplacement){let x=r.whitespace=="pre",k=!!r.contentMatch.matchType(r.schema.linebreakReplacement);x&&!k?h=!1:!x&&k&&(h=!0)}h===!1&&ID(t,a,u,s),mk(t,t.mapping.slice(s).map(u,1),r,void 0,h===null);let d=t.mapping.slice(s),g=d.map(u,1),y=d.map(u+a.nodeSize,1);return t.step(new ac(g,y,g+1,y-1,new q(W.from(r.create(c,null,a.marks)),0,0),1,!0)),h===!0&&DD(t,a,u,s),!1}})}function DD(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let a,u=/\r?\n|\r/g;for(;a=u.exec(i.text);){let c=t.mapping.slice(r).map(n+1+s+a.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function ID(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let a=t.mapping.slice(r).map(n+1+s);t.replaceWith(a,a+1,e.type.schema.text(`
47
+ `))}})}function C$(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function w$(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 a=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ac(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new q(W.from(a),0,0),1,!0))}function E$(t,e,n=1,r){let i=t.doc.resolve(e),s=W.empty,a=W.empty;for(let u=i.depth,c=i.depth-n,h=n-1;u>c;u--,h--){s=W.from(i.node(u).copy(s));let d=r&&r[h];a=W.from(d?d.type.create(d.attrs,a):i.node(u).copy(a))}t.step(new Za(e,e,new q(s.append(a),n,n),!0))}function A$(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),a=s.node().type;if(i&&a.inlineContent){let d=a.whitespace=="pre",g=!!a.contentMatch.matchType(i);d&&!g?r=!1:!d&&g&&(r=!0)}let u=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);ID(t,d.node(),d.before(),u)}a.inlineContent&&mk(t,e+n-1,a,s.node().contentMatchAt(s.index()),r==null);let c=t.mapping.slice(u),h=c.map(e-n);if(t.step(new Za(h,c.map(e+n,-1),q.empty,!0)),r===!0){let d=t.doc.resolve(h);DD(t,d.node(),d.before(),t.steps.length)}return t}function N$(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 T$(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 a=r.depth;a>=0;a--){let u=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,c=r.index(a)+(u>0?1:0),h=r.node(a),d=!1;if(s==1)d=h.canReplace(c,c,i);else{let g=h.contentMatchAt(c).findWrapping(i.firstChild.type);d=g&&h.canReplaceWith(c,c,g[0])}if(d)return u==0?r.pos:u<0?r.before(a+1):r.after(a+1)}return null}function M$(t,e,n=e,r=q.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return _D(i,s,r)?new Za(e,n,r):new O$(i,s,r).fit()}function _D(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class O${constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=W.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=W.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,a=r.depth,u=i.depth;for(;a&&u&&s.childCount==1;)s=s.firstChild.content,a--,u--;let c=new q(s,a,u);return e>-1?new ac(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Za(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=v1(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let a=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],d,g=null;if(n==1&&(a?h.matchType(a.type)||(g=h.fillBefore(W.from(a),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:g};if(n==2&&a&&(d=h.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:d};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=v1(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new q(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=v1(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new q(Wf(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new q(Wf(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 w=0;w<s.length;w++)this.openFrontierNode(s[w]);let a=this.unplaced,u=r?r.content:a.content,c=a.openStart-e,h=0,d=[],{match:g,type:y}=this.frontier[n];if(i){for(let w=0;w<i.childCount;w++)d.push(i.child(w));g=g.matchFragment(i)}let x=u.size+e-(a.content.size-a.openEnd);for(;h<u.childCount;){let w=u.child(h),N=g.matchType(w.type);if(!N)break;h++,(h>1||c==0||w.content.size)&&(g=N,d.push(zD(w.mark(y.allowedMarks(w.marks)),h==1?c:0,h==u.childCount?x:-1)))}let k=h==u.childCount;k||(x=-1),this.placed=Xf(this.placed,n,W.from(d)),this.frontier[n].match=g,k&&x<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,N=u;w<x;w++){let T=N.lastChild;this.frontier.push({type:T.type,match:T.contentMatchAt(T.childCount)}),N=T.content}this.unplaced=k?e==0?q.empty:new q(Wf(a.content,e-1,1),e-1,x<0?a.openEnd:e-1):new q(Wf(a.content,e,h),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!k1(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)),a=k1(e,n,i,r,s);if(a){for(let u=n-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],d=k1(e,u,h,c,!0);if(!d||d.childCount)continue e}return{depth:n,fit:a,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=Xf(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=Xf(this.placed,this.depth,W.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(W.empty,!0);n.childCount&&(this.placed=Xf(this.placed,this.frontier.length,n))}}function Wf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Wf(t.firstChild.content,e-1,n)))}function Xf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Xf(t.lastChild.content,e-1,n)))}function v1(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function zD(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,zD(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(W.empty,!0)))),t.copy(r)}function k1(t,e,n,r,i){let s=t.node(e),a=i?t.indexAfter(e):t.index(e);if(a==s.childCount&&!n.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,a);return u&&!R$(n,s.content,a)?u:null}function R$(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function D$(t){return t.spec.defining||t.spec.definingForContent}function I$(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(_D(i,s,r))return t.step(new Za(e,n,r));let a=BD(i,s);a[a.length-1]==0&&a.pop();let u=-(i.depth+1);a.unshift(u);for(let y=i.depth,x=i.pos-1;y>0;y--,x--){let k=i.node(y).type.spec;if(k.defining||k.definingAsContext||k.isolating)break;a.indexOf(y)>-1?u=y:i.before(y)==x&&a.splice(1,0,-y)}let c=a.indexOf(u),h=[],d=r.openStart;for(let y=r.content,x=0;;x++){let k=y.firstChild;if(h.push(k),x==r.openStart)break;y=k.content}for(let y=d-1;y>=0;y--){let x=h[y],k=D$(x.type);if(k&&!x.sameMarkup(i.node(Math.abs(u)-1)))d=y;else if(k||!x.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let x=(y+d+1)%(r.openStart+1),k=h[x];if(k)for(let w=0;w<a.length;w++){let N=a[(w+c)%a.length],T=!0;N<0&&(T=!1,N=-N);let V=i.node(N-1),F=i.index(N-1);if(V.canReplaceWith(F,F,k.type,k.marks))return t.replace(i.before(N),T?s.after(N):n,new q(LD(r.content,0,r.openStart,x),x,r.openEnd))}}let g=t.steps.length;for(let y=a.length-1;y>=0&&(t.replace(e,n,r),!(t.steps.length>g));y--){let x=a[y];x<0||(e=i.before(x),n=s.after(x))}}function LD(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(LD(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(W.empty,!0))}return t}function _$(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=N$(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new q(W.from(r),0,0))}function z$(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=BD(r,i);for(let a=0;a<s.length;a++){let u=s[a],c=a==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 a=1;a<=r.depth&&a<=i.depth;a++)if(e-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return t.delete(r.before(a),n);t.delete(e,n)}function BD(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 FD=class Im extends jn{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 rr.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 rr.fromReplace(e,this.pos,this.pos+1,new q(W.from(i),0,n.isLeaf?0:1))}getMap(){return Sl.empty}invert(e){return new Im(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 Im(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 Im(n.pos,n.attr,n.value)}};jn.jsonID("attr",FD);let VD=class aS extends jn{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 rr.ok(r)}getMap(){return Sl.empty}invert(e){return new aS(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 aS(n.attr,n.value)}};jn.jsonID("docAttr",VD);let Wu=class extends Error{};Wu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Wu.prototype=Object.create(Error.prototype);Wu.prototype.constructor=Wu;Wu.prototype.name="TransformError";class L${constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new y$}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Wu(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,a,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=q.empty){let i=M$(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new q(W.from(r),0,0))}delete(e,n){return this.replace(e,n,q.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return I$(this,e,n,r),this}replaceRangeWith(e,n,r){return _$(this,e,n,r),this}deleteRange(e,n){return z$(this,e,n),this}lift(e,n){return S$(this,e,n),this}join(e,n=1){return A$(this,e,n),this}wrap(e,n){return v$(this,e,n),this}setBlockType(e,n=e,r,i=null){return k$(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return w$(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new FD(e,n,r)),this}setDocAttribute(e,n){return this.step(new VD(e,n)),this}addNodeMark(e,n){return this.step(new dk(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 ht)n.isInSet(r.marks)&&this.step(new lg(e,n));else{let i=r.marks,s,a=[];for(;s=n.isInSet(i);)a.push(new lg(e,s)),i=s.removeFromSet(i);for(let u=a.length-1;u>=0;u--)this.step(a[u])}return this}split(e,n=1,r){return E$(this,e,n,r),this}addMark(e,n,r){return x$(this,e,n,r),this}removeMark(e,n,r){return b$(this,e,n,r),this}clearIncompatible(e,n,r){return mk(this,e,n,r),this}}const Tl=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},PD=function(t,e,n,r){return n&&(zN(t,e,n,r,-1)||zN(t,e,n,r,1))},B$=/^(img|br|input|textarea|hr)$/i;function zN(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:ug(t))){let a=t.parentNode;if(!a||a.nodeType!=1||gk(t)||B$.test(t.nodeName)||t.contentEditable=="false")return!1;e=Tl(t)+(i<0?0:1),t=a}else if(t.nodeType==1){let a=t.childNodes[e+(i<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((s=a.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=a,e=i<0?ug(t):0}else return!1}}function ug(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function F$(t,e,n){for(let r=e==0,i=e==ug(t);r||i;){if(t==n)return!0;let s=Tl(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==ug(t)}}function gk(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 jD=function(t){return t.focusNode&&PD(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function $D(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Qi=typeof navigator<"u"?navigator:null,LN=typeof document<"u"?document:null,ao=Qi&&Qi.userAgent||"",oS=/Edge\/(\d+)/.exec(ao),JD=/MSIE \d/.exec(ao),lS=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ao),vp=!!(JD||lS||oS),UD=JD?document.documentMode:lS?+lS[1]:oS?+oS[1]:0,f0=!vp&&/gecko\/(\d+)/i.test(ao);f0&&+(/Firefox\/(\d+)/.exec(ao)||[0,0])[1];const uS=!vp&&/Chrome\/(\d+)/.exec(ao),Gs=!!uS,HD=uS?+uS[1]:0,Ml=!vp&&!!Qi&&/Apple Computer/.test(Qi.vendor),yk=Ml&&(/Mobile\/\w+/.test(ao)||!!Qi&&Qi.maxTouchPoints>2),ri=yk||(Qi?/Mac/.test(Qi.platform):!1),qD=Qi?/Win/.test(Qi.platform):!1,kp=/Android \d/.test(ao),xk=!!LN&&"webkitFontSmoothing"in LN.documentElement.style,V$=xk?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function P$(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,a=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let u=r.resolve(a),c,h;if(jD(n)){for(c=a;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&be.isSelectable(g)&&i.parent&&!(g.isInline&&F$(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new be(a==y?u:r.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=a,y=a;for(let x=0;x<n.rangeCount;x++){let k=n.getRangeAt(x);g=Math.min(g,t.docView.posFromDOM(k.startContainer,k.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(k.endContainer,k.endOffset,-1))}if(g<0)return null;[c,a]=y==t.state.selection.anchor?[y,g]:[g,y],u=r.resolve(a)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=GD(t,d,u,g)}return h}function KD(t){return t.editable?t.hasFocus():U$(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function bk(t,e=!1){let n=t.state.selection;if(J$(t,n),!!KD(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Gs){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&PD(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)$$(t);else{let{anchor:r,head:i}=n,s,a;BN&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(s=FN(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=FN(t,n.to))),t.docView.setSelection(r,i,t,e),BN&&(s&&VN(s),a&&VN(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&j$(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const BN=Ml||Gs&&HD<63;function FN(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(Ml&&i&&i.contentEditable=="false")return C1(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return C1(i);if(s)return C1(s)}}function C1(t){return t.contentEditable="true",Ml&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function VN(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function j$(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(()=>{(!KD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function $$(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Tl(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&vp&&UD<=11&&(n.disabled=!0,n.disabled=!1)}function J$(t,e){if(e instanceof be){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(PN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else PN(t)}function PN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function GD(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Oe.between(e,n,r)}function U$(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 cS(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&&Pe.findFrom(s,e)}function za(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function jN(t,e,n){let r=t.state.selection;if(r instanceof Oe)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 a=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return za(t,new Oe(r.$anchor,a))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=cS(t.state,e);return i&&i instanceof be?za(t,i):!1}else if(!(ri&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(a=t.docView.descAt(u))&&!a.contentDOM?be.isSelectable(s)?za(t,new be(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):xk?za(t,new Oe(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof be&&r.node.isInline)return za(t,new Oe(e>0?r.$to:r.$from));{let i=cS(t.state,e);return i?za(t,i):!1}}}function cg(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function bh(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function bu(t,e){return e<0?H$(t):q$(t)}function H$(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,a=!1;for(f0&&n.nodeType==1&&r<cg(n)&&bh(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(bh(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(YD(n))break;{let u=n.previousSibling;for(;u&&bh(u,-1);)i=n.parentNode,s=Tl(u),u=u.previousSibling;if(u)n=u,r=cg(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}a?fS(t,n,r):i&&fS(t,i,s)}function q$(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=cg(n),s,a;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(bh(u,1))s=n,a=++r;else break}else{if(YD(n))break;{let u=n.nextSibling;for(;u&&bh(u,1);)s=u.parentNode,a=Tl(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=cg(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&fS(t,s,a)}function YD(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function K$(t,e){for(;t&&e==t.childNodes.length&&!gk(t);)e=Tl(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 G$(t,e){for(;t&&!e&&!gk(t);)e=Tl(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 fS(t,e,n){if(e.nodeType!=3){let s,a;(a=K$(e,n))?(e=a,n=0):(s=G$(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(jD(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&&bk(t)},50)}function $N(t,e){let n=t.state.doc.resolve(e);if(!(Gs||qD)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),a=(s.top+s.bottom)/2;if(a>i.top&&a<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),a=(s.top+s.bottom)/2;if(a>i.top&&a<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 Oe&&!r.empty||n.indexOf("s")>-1||ri&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let a=cS(t.state,e);if(a&&a instanceof be)return za(t,a)}if(!i.parent.inlineContent){let a=e<0?i:s,u=r instanceof sr?Pe.near(a,e):Pe.findFrom(a,e);return u?za(t,u):!1}return!1}function UN(t,e){if(!(t.state.selection instanceof Oe))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 a=t.state.tr;return e<0?a.delete(n.pos-s.nodeSize,n.pos):a.delete(n.pos,n.pos+s.nodeSize),t.dispatch(a),!0}return!1}function HN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Y$(t){if(!Ml||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;HN(t,r,"true"),setTimeout(()=>HN(t,r,"false"),20)}return!1}function W$(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function X$(t,e){let n=e.keyCode,r=W$(e);if(n==8||ri&&n==72&&r=="c")return UN(t,-1)||bu(t,-1);if(n==46&&!e.shiftKey||ri&&n==68&&r=="c")return UN(t,1)||bu(t,1);if(n==13||n==27)return!0;if(n==37||ri&&n==66&&r=="c"){let i=n==37?$N(t,t.state.selection.from)=="ltr"?-1:1:-1;return jN(t,i,r)||bu(t,i)}else if(n==39||ri&&n==70&&r=="c"){let i=n==39?$N(t,t.state.selection.from)=="ltr"?1:-1:1;return jN(t,i,r)||bu(t,i)}else{if(n==38||ri&&n==80&&r=="c")return JN(t,-1,r)||bu(t,-1);if(n==40||ri&&n==78&&r=="c")return Y$(t)||JN(t,1,r)||bu(t,1);if(r==(ri?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function WD(t,e){t.someProp("transformCopied",x=>{e=x(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 x=r.firstChild;n.push(x.type.name,x.attrs!=x.type.defaultAttrs?x.attrs:null),r=x.content}let a=t.someProp("clipboardSerializer")||rs.fromSchema(t.state.schema),u=nI(),c=u.createElement("div");c.appendChild(a.serializeFragment(r,{document:u}));let h=c.firstChild,d,g=0;for(;h&&h.nodeType==1&&(d=tI[h.nodeName.toLowerCase()]);){for(let x=d.length-1;x>=0;x--){let k=u.createElement(d[x]);for(;c.firstChild;)k.appendChild(c.firstChild);c.appendChild(k),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",x=>x(e,t))||e.content.textBetween(0,e.content.size,`
48
+
49
+ `);return{dom:c,text:y,slice:e}}function XD(t,e,n,r,i){let s=i.parent.type.spec.code,a,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 q(W.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:x}=t.state,k=rs.fromSchema(x);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=a.appendChild(document.createElement("p"));w&&N.appendChild(k.serializeNode(x.text(w,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),a=tJ(n),xk&&nJ(a);let h=a&&a.querySelector("[data-pm-slice]"),d=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let g=+d[3];g>0;g--){let y=a.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;a=y}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||Ya.fromSchema(t.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!Q$.test(y.parentNode.nodeName)?{ignore:!0}:null}})),d)u=rJ(qN(u,+d[1],+d[2]),d[4]);else if(u=q.maxOpen(Z$(u.content,i),!0),u.openStart||u.openEnd){let g=0,y=0;for(let x=u.content.firstChild;g<u.openStart&&!x.type.spec.isolating;g++,x=x.firstChild);for(let x=u.content.lastChild;y<u.openEnd&&!x.type.spec.isolating;y++,x=x.lastChild);u=qN(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const Q$=/^(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 Z$(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,a=[];if(t.forEach(u=>{if(!a)return;let c=i.findWrapping(u.type),h;if(!c)return a=null;if(h=a.length&&s.length&&ZD(c,s,u,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=eI(a[a.length-1],s.length));let d=QD(u,c);a.push(d),i=i.matchType(d.type),s=c}}),a)return W.from(a)}return t}function QD(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,W.from(t));return t}function ZD(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=ZD(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(W.from(QD(n,t,i+1))))}}function eI(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,eI(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(W.empty,!0);return t.copy(n.append(r))}function hS(t,e,n,r,i,s){let a=e<0?t.firstChild:t.lastChild,u=a.content;return t.childCount>1&&(s=0),i<r-1&&(u=hS(u,e,n,r,i+1,s)),i>=n&&(u=e<0?a.contentMatchAt(0).fillBefore(u,s<=i).append(u):u.append(a.contentMatchAt(a.childCount).fillBefore(W.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(u))}function qN(t,e,n){return e<t.openStart&&(t=new q(hS(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new q(hS(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const tI={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 KN=null;function nI(){return KN||(KN=document.implementation.createHTMLDocument("title"))}let w1=null;function eJ(t){let e=window.trustedTypes;return e?(w1||(w1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),w1.createHTML(t)):t}function tJ(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=nI().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&tI[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=eJ(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function nJ(t){let e=t.querySelectorAll(Gs?"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 rJ(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:a}=t;for(let u=r.length-2;u>=0;u-=2){let c=n.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=W.from(c.create(r[u+1],i)),s++,a++}return new q(i,s,a)}const Li={},Br={};function $a(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Br.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!iI(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(kp&&Gs&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),yk&&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,$D(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||X$(t,n)?n.preventDefault():$a(t,"key")};Br.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Br.keypress=(t,e)=>{let n=e;if(iI(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ri&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Oe)||!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",a=>a(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function h0(t){return{left:t.clientX,top:t.clientY}}function iJ(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Sk(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let a=s.depth+1;a>0;a--)if(t.someProp(e,u=>a>s.depth?u(t,n,s.nodeAfter,s.before(a),i,!0):u(t,n,s.node(a),s.before(a),i,!1)))return!0;return!1}function ju(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 sJ(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&be.isSelectable(r)?(ju(t,new be(n)),!0):!1}function aJ(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof be&&(r=n.node);let s=t.state.doc.resolve(e);for(let a=s.depth+1;a>0;a--){let u=a>s.depth?s.nodeAfter:s.node(a);if(be.isSelectable(u)){r&&n.$from.depth>0&&a>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(a);break}}return i!=null?(ju(t,be.create(t.state.doc,i)),!0):!1}function oJ(t,e,n,r,i){return Sk(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?aJ(t,n):sJ(t,n))}function lJ(t,e,n,r){return Sk(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function uJ(t,e,n,r){return Sk(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||cJ(t,n,r)}function cJ(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ju(t,Oe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(a.inlineContent)ju(t,Oe.create(r,u+1,u+1+a.content.size));else if(be.isSelectable(a))ju(t,be.create(r,u));else continue;return!0}}function vk(t){return fg(t)}const rI=ri?"metaKey":"ctrlKey";Li.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=vk(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&iJ(n,t.input.lastClick)&&!n[rI]&&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 a=t.posAtCoords(h0(n));a&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new fJ(t,a,n,!!r)):(s=="doubleClick"?lJ:uJ)(t,a.pos,a.inside,n)?n.preventDefault():$a(t,"pointer"))};let fJ=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[rI],this.allowDefault=r.shiftKey;let s,a;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),a=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,a=d.depth?d.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 be&&h.from<=a&&h.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&f0&&!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)),$a(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(()=>bk(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(h0(e))),this.updateAllowDefault(e),this.allowDefault||!n?$a(this.view,"pointer"):oJ(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ml&&this.mightDrag&&!this.mightDrag.node.isAtom||Gs&&!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)?(ju(this.view,Pe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):$a(this.view,"pointer")}move(e){this.updateAllowDefault(e),$a(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)}};Li.touchstart=t=>{t.input.lastTouch=Date.now(),vk(t),$a(t,"pointer")};Li.touchmove=t=>{t.input.lastTouch=Date.now(),$a(t,"pointer")};Li.contextmenu=t=>vk(t);function iI(t,e){return t.composing?!0:Ml&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const hJ=kp?5e3:-1;Br.compositionstart=Br.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Gs&&qD&&pJ(t)))t.markCursor=t.state.storedMarks||n.marks(),fg(t,!0),t.markCursor=null;else if(fg(t,!e.selection.empty),f0&&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 a=s<0?i.lastChild:i.childNodes[s-1];if(!a)break;if(a.nodeType==3){let u=t.domSelection();u&&u.collapse(a,a.nodeValue.length);break}else i=a,s=-1}}t.input.composing=!0}sI(t,hJ)};function pJ(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"}Br.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++,sI(t,20))};function sI(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>fg(t),e))}function dJ(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=mJ());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function mJ(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function fg(t,e=!1){if(!(kp&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),dJ(t),e||t.docView&&t.docView.dirty){let n=P$(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 gJ(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 Hh=vp&&UD<15||yk&&V$<604;Li.copy=Br.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Hh?null:n.clipboardData,a=r.content(),{dom:u,text:c}=WD(t,a);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):gJ(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yJ(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function xJ(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?pS(t,r.value,null,i,e):pS(t,r.textContent,r.innerHTML,i,e)},50)}function pS(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||q.empty)))return!0;if(!s)return!1;let a=yJ(s),u=a?t.state.tr.replaceSelectionWith(a,r):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function aI(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," "):""}Br.paste=(t,e)=>{let n=e;if(t.composing&&!kp)return;let r=Hh?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&pS(t,aI(r),r.getData("text/html"),i,n)?n.preventDefault():xJ(t,n)};let bJ=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const SJ=ri?"altKey":"ctrlKey";function oI(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[SJ]}Li.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(h0(n)),a;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof be?i.to-1:i.to))){if(r&&r.mightDrag)a=be.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&&(a=be.create(t.state.doc,g.posBefore))}}let u=(a||t.state.selection).content(),{dom:c,text:h,slice:d}=WD(t,u);(!n.dataTransfer.files.length||!Gs||HD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Hh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Hh||n.dataTransfer.setData("text/plain",h),t.dragging=new bJ(d,oI(t,n),a)};Li.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Br.dragover=Br.dragenter=(t,e)=>e.preventDefault();Br.drop=(t,e)=>{try{vJ(t,e,t.dragging)}finally{t.dragging=null}};function vJ(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(h0(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",x=>{s=x(s,t,!1)}):s=XD(t,aI(e.dataTransfer),Hh?null:e.dataTransfer.getData("text/html"),!1,i);let a=!!(n&&oI(t,e));if(t.someProp("handleDrop",x=>x(t,e,s||q.empty,a))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?T$(t.state.doc,i.pos,s):i.pos;u==null&&(u=i.pos);let c=t.state.tr;if(a){let{node:x}=n;x?x.replace(c):c.deleteSelection()}let h=c.mapping.map(u),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(d?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(d&&be.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new be(y));else{let x=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((k,w,N,T)=>x=T),c.setSelection(GD(t,y,c.doc.resolve(x)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Li.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())&&bk(t)},20))};Li.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)};Li.beforeinput=(t,e)=>{if(Gs&&kp&&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,$D(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 Br)Li[t]=Br[t];function qh(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 GN=class lI{constructor(e,n){this.toDOM=e,this.spec=n||nl,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:a}=e.mapResult(n.from+i,this.side<0?-1:1);return a?null:new vl(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof lI&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&qh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Sh=class dS{constructor(e,n){this.attrs=e,this.spec=n||nl}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=a?null:new vl(s,a,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof dS&&qh(this.attrs,e.attrs)&&qh(this.spec,e.spec)}static is(e){return e.type instanceof dS}destroy(){}},kJ=class uI{constructor(e,n){this.attrs=e,this.spec=n||nl}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let a=e.mapResult(n.to+i,-1);return a.deleted||a.pos<=s.pos?null:new vl(s.pos-r,a.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 uI&&qh(this.attrs,e.attrs)&&qh(this.spec,e.spec)}destroy(){}},vl=class Qf{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Qf(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 Qf(e,e,new GN(n,r))}static inline(e,n,r,i){return new Qf(e,n,new Sh(r,i))}static node(e,n,r,i){return new Qf(e,n,new kJ(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Sh}get widget(){return this.type instanceof GN}};const Ru=[],nl={};let fi=class Da{constructor(e,n){this.local=e.length?e:Ru,this.children=n.length?n:Ru}static create(e,n){return n.length?hg(n,e,0,nl):Gn}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 a=0;a<this.local.length;a++){let u=this.local[a];u.from<=n&&u.to>=e&&(!s||s(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>e){let u=this.children[a]+1;this.children[a+2].findInner(e-u,n-u,r,i+u,s)}}map(e,n,r){return this==Gn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||nl)}mapInner(e,n,r,i,s){let a;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(n,c)?(a||(a=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?wJ(this.children,a||[],e,n,r,i,s):a?new Da(a.sort(rl),Ru):Gn}add(e,n){return n.length?this==Gn?Da.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,d;if(d=fI(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,d,h+1):i.splice(s,0,c,c+u.nodeSize,hg(d,u,h+1,nl)),s+=3}});let a=cI(s?hI(n):n,-r);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||a.splice(u--,1);return new Da(a.length?this.local.concat(a).sort(rl):this.local,i||this.children)}remove(e){return e.length==0||this==Gn?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 a,u=r[s]+n,c=r[s+1]+n;for(let d=0,g;d<e.length;d++)(g=e[d])&&g.from>u&&g.to<c&&(e[d]=null,(a||(a=[])).push(g));if(!a)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(a,u+1);h!=Gn?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,a;s<e.length;s++)if(a=e[s])for(let u=0;u<i.length;u++)i[u].eq(a,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 Da(i,r):Gn}forChild(e,n){if(this==Gn)return this;if(n.isLeaf)return Da.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,a=s+n.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<a&&c.to>s&&c.type instanceof Sh){let h=Math.max(s,c.from)-s,d=Math.min(a,c.to)-s;h<d&&(i||(i=[])).push(c.copy(h,d))}}if(i){let u=new Da(i.sort(rl),Ru);return r?new CJ([u,r]):u}return r||Gn}eq(e){if(this==e)return!0;if(!(e instanceof Da)||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 kk(this.localsInner(e))}localsInner(e){if(this==Gn)return Ru;if(e.inlineContent||!this.local.some(Sh.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Sh||n.push(this.local[r]);return n}forEachSet(e){e(this)}};fi.empty=new fi([],[]);fi.removeOverlap=kk;const Gn=fi.empty;let CJ=class Du{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,nl));return Du.from(r)}forChild(e,n){if(n.isLeaf)return fi.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Gn&&(s instanceof Du?r=r.concat(s.members):r.push(s))}return Du.from(r)}eq(e){if(!(e instanceof Du)||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 a=0;a<s.length;a++)n.push(s[a])}}return n?kk(r?n:n.sort(rl)):Ru}static from(e){switch(e.length){case 0:return Gn;case 1:return e[0];default:return new Du(e.every(n=>n instanceof fi)?e:e.reduce((n,r)=>n.concat(r instanceof fi?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function wJ(t,e,n,r,i,s,a){let u=t.slice();for(let h=0,d=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,x,k,w)=>{let N=w-k-(x-y);for(let T=0;T<u.length;T+=3){let V=u[T+1];if(V<0||y>V+d-g)continue;let F=u[T]+d-g;x>=F?u[T+1]=y<=F?-2:-1:y>=d&&N&&(u[T]+=N,u[T+1]+=N)}g+=N}),d=n.maps[h].map(d,-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 d=n.map(t[h]+s),g=d-i;if(g<0||g>=r.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),x=y-i,{index:k,offset:w}=r.content.findIndex(g),N=r.maybeChild(k);if(N&&w==g&&w+N.nodeSize==x){let T=u[h+2].mapInner(n,N,d+1,t[h]+s+1,a);T!=Gn?(u[h]=g,u[h+1]=x,u[h+2]=T):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=EJ(u,t,e,n,i,s,a),d=hg(h,r,0,a);e=d.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<d.children.length;g+=3){let x=d.children[g];for(;y<u.length&&u[y]<x;)y+=3;u.splice(y,0,d.children[g],d.children[g+1],d.children[g+2])}}return new fi(e.sort(rl),u)}function cI(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 vl(i.from+e,i.to+e,i.type))}return n}function EJ(t,e,n,r,i,s,a){function u(c,h){for(let d=0;d<c.local.length;d++){let g=c.local[d].map(r,i,h);g?n.push(g):a.onRemove&&a.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)u(c.children[d+2],c.children[d]+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 fI(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,a;s<t.length;s++)(a=t[s])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),t[s]=null);return i}function hI(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function hg(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=fI(t,u,c+n);if(h){s=!0;let d=hg(h,u,n+c+1,r);d!=Gn&&i.push(c,c+u.nodeSize,d)}});let a=cI(s?hI(t):t,-n).sort(rl);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||(r.onRemove&&r.onRemove(a[u].spec),a.splice(u--,1));return a.length||i.length?new fi(a,i):Gn}function rl(t,e){return t.from-e.from||t.to-e.to}function kk(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),YN(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),YN(e,i,r.copy(s.from,r.to)));break}}}return e}function YN(t,e,n){for(;e<t.length&&rl(n,t[e])>0;)e++;t.splice(e,0,n)}let mS,gS;if(typeof WeakMap<"u"){let t=new WeakMap;mS=e=>t.get(e),gS=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;mS=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},gS=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Ct=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,a=i+1;for(let u=1;s<this.width&&this.map[e+u]==n;u++)s++;for(let u=1;a<this.height&&this.map[e+this.width*u]==n;u++)a++;return{left:r,top:i,right:s,bottom:a}}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:a}=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:a==this.height)?null:this.map[r+this.width*(n<0?s-1:a)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:a,right:u,top:c,bottom:h}=this.findCell(e);return{left:Math.min(n,a),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,a=this.map[s];n[a]||(n[a]=!0,!(i==t.left&&i&&this.map[s-1]==a||r==t.top&&r&&this.map[s-this.width]==a)&&e.push(a))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let a=e+t*this.width;const u=(t+1)*this.width;for(;a<u&&this.map[a]<i;)a++;return a==u?s-1:this.map[a]}i=s}}static get(t){return mS(t)||gS(t,AJ(t))}};function AJ(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=NJ(t),n=t.childCount,r=[];let i=0,s=null;const a=[];for(let h=0,d=e*n;h<d;h++)r[h]=0;for(let h=0,d=0;h<n;h++){const g=t.child(h);d++;for(let k=0;;k++){for(;i<r.length&&r[i]!=0;)i++;if(k==g.childCount)break;const w=g.child(k),{colspan:N,rowspan:T,colwidth:V}=w.attrs;for(let F=0;F<T;F++){if(F+h>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:T-F});break}const K=i+F*e;for(let L=0;L<N;L++){r[K+L]==0?r[K+L]=d:(s||(s=[])).push({type:"collision",row:h,pos:d,n:N-L});const C=V&&V[L];if(C){const _=(K+L)%e*2,J=a[_];J==null||J!=C&&a[_+1]==1?(a[_]=C,a[_+1]=1):J==C&&a[_+1]++}}}i+=N,d+=w.nodeSize}const y=(h+1)*e;let x=0;for(;i<y;)r[i++]==0&&x++;x&&(s||(s=[])).push({type:"missing",row:h,n:x}),d++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const u=new Ct(e,n,r,s);let c=!1;for(let h=0;!c&&h<a.length;h+=2)a[h]!=null&&a[h+1]<n&&(c=!0);return c&&TJ(u,a,t),u}function NJ(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 a=0;a<r;a++){const u=t.child(a);for(let c=0;c<u.childCount;c++){const h=u.child(c);a+h.attrs.rowspan>r&&(s+=h.attrs.colspan)}}for(let a=0;a<i.childCount;a++){const u=i.child(a);s+=u.attrs.colspan,u.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function TJ(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 a=n.nodeAt(s);if(!a)throw new RangeError(`No cell with offset ${s} found`);let u=null;const c=a.attrs;for(let h=0;h<c.colspan;h++){const d=e[(i+h)%t.width*2];d!=null&&(!c.colwidth||c.colwidth[h]!=d)&&((u||(u=MJ(c)))[h]=d)}u&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:u})}}function MJ(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function WN(t,e){if(typeof t=="string")return{};const n=t.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(a=>Number(a)):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 a in e){const u=e[a].getFromDOM,c=u&&u(t);c!=null&&(s[a]=c)}return s}function XN(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 OJ(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 RJ(t){const e=t.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:OJ}};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=>WN(r,e)}],toDOM(r){return["td",XN(r,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>WN(r,e)}],toDOM(r){return["th",XN(r,e),0]}}}}function pi(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 Va=new Ln("selectingCells");function Xu(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 yi(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 p0(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=Xu(e.$head)||DJ(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function DJ(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 yS(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function IJ(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Ck(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function pI(t,e,n){const r=t.node(-1),i=Ct.get(r),s=t.start(-1),a=i.nextCell(t.pos-s,e,n);return a==null?null:t.node(0).resolve(s+a)}function kl(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 _J(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 zJ(t,e,n){const r=pi(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 Lt=class Rs extends Pe{constructor(e,n=e){const r=e.node(-1),i=Ct.get(r),s=e.start(-1),a=i.rectBetween(e.pos-s,n.pos-s),u=e.node(0),c=i.cellsInRect(a).filter(d=>d!=n.pos-s);c.unshift(n.pos-s);const h=c.map(d=>{const g=r.nodeAt(d);if(!g)throw new RangeError(`No cell with offset ${d} found`);const y=s+d+1;return new a3(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(yS(r)&&yS(i)&&Ck(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Rs.rowSelection(r,i):s&&this.isColSelection()?Rs.colSelection(r,i):new Rs(r,i)}return Oe.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Ct.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},a=[];for(let c=i.top;c<i.bottom;c++){const h=[];for(let d=c*n.width+i.left,g=i.left;g<i.right;g++,d++){const y=n.map[d];if(s[y])continue;s[y]=!0;const x=n.findCell(y);let k=e.nodeAt(y);if(!k)throw new RangeError(`No cell with offset ${y} found`);const w=i.left-x.left,N=x.right-i.right;if(w>0||N>0){let T=k.attrs;if(w>0&&(T=kl(T,0,w)),N>0&&(T=kl(T,T.colspan-N,N)),x.left<i.left){if(k=k.type.createAndFill(T),!k)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(T)}`)}else k=k.type.create(T,k.content)}if(x.top<i.top||x.bottom>i.bottom){const T={...k.attrs,rowspan:Math.min(x.bottom,i.bottom)-Math.max(x.top,i.top)};x.top<i.top?k=k.type.createAndFill(T):k=k.type.create(T,k.content)}h.push(k)}a.push(e.child(c).copy(W.from(h)))}const u=this.isColSelection()&&this.isRowSelection()?e:a;return new q(W.from(u),1,1)}replace(e,n=q.empty){const r=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){const{$from:u,$to:c}=i[a],h=e.mapping.slice(r);e.replace(h.map(u.pos),h.map(c.pos),a?q.empty:n)}const s=Pe.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new q(W.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Ct.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let a=0;a<s.length;a++)e(n.nodeAt(s[a]),i+s[a])}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=Ct.get(r),s=e.start(-1),a=i.findCell(e.pos-s),u=i.findCell(n.pos-s),c=e.node(0);return a.top<=u.top?(a.top>0&&(e=c.resolve(s+i.map[a.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])),a.bottom<i.height&&(e=c.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))),new Rs(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Ct.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 a=i+this.$anchorCell.nodeAfter.attrs.colspan,u=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,u)==n.width}eq(e){return e instanceof Rs&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Ct.get(r),s=e.start(-1),a=i.findCell(e.pos-s),u=i.findCell(n.pos-s),c=e.node(0);return a.left<=u.left?(a.left>0&&(e=c.resolve(s+i.map[a.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])),a.right<i.width&&(e=c.resolve(s+i.map[i.width*(a.top+1)-1]))),new Rs(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Rs(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Rs(e.resolve(n),e.resolve(r))}getBookmark(){return new LJ(this.$anchorCell.pos,this.$headCell.pos)}};Lt.prototype.visible=!1;Pe.jsonID("cell",Lt);var LJ=class dI{constructor(e,n){this.anchor=e,this.head=n}map(e){return new dI(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&&Ck(n,r)?new Lt(n,r):Pe.near(r,1)}};function BJ(t){if(!(t.selection instanceof Lt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(vl.node(r,r+n.nodeSize,{class:"selectedCell"}))}),fi.create(t.doc,e)}function FJ({$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 VJ({$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 PJ(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,a;if(r instanceof be&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")s=Lt.create(i,r.from);else if(a=="row"){const u=i.resolve(r.from+1);s=Lt.rowSelection(u,u)}else if(!n){const u=Ct.get(r.node),c=r.from+1,h=c+u.map[u.width*u.height-1];s=Lt.create(i,c+1,h)}}else r instanceof Oe&&FJ(r)?s=Oe.create(i,r.from):r instanceof Oe&&VJ(r)&&(s=Oe.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const jJ=new Ln("fix-tables");function mI(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let a=0,u=0;a<s;a++){const c=e.child(a);for(let h=u,d=Math.min(i,a+3);h<d;h++)if(t.child(h)==c){u=h+1,n+=c.nodeSize;continue e}r(c,n),u<i&&t.child(u).sameMarkup(c)?mI(t.child(u),c,n+1,r):c.nodesBetween(0,c.content.size,r,n+1),n+=c.nodeSize}}function $J(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=JJ(t,i,s,n))};return e?e.doc!=t.doc&&mI(e.doc,t.doc,0,r):t.doc.descendants(r),n}function JJ(t,e,n,r){const i=Ct.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 d=e.nodeAt(h.pos);if(!d)continue;const g=d.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,kl(g,g.colspan-h.n,h.n))}else if(h.type=="missing")s[h.row]+=h.n;else if(h.type=="overlong_rowspan"){const d=e.nodeAt(h.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+h.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-h.n})}else if(h.type=="colwidth mismatch"){const d=e.nodeAt(h.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+h.pos),null,{...d.attrs,colwidth:h.colwidth})}else if(h.type=="zero_sized"){const d=r.mapping.map(n);r.delete(d,d+e.nodeSize)}}let a,u;for(let c=0;c<s.length;c++)s[c]&&(a==null&&(a=c),u=c);for(let c=0,h=n+1;c<i.height;c++){const d=e.child(c),g=h+d.nodeSize,y=s[c];if(y>0){let x="cell";d.firstChild&&(x=d.firstChild.type.spec.tableRole);const k=[];for(let N=0;N<y;N++){const T=pi(t.schema)[x].createAndFill();T&&k.push(T)}const w=(c==0||a==c-1)&&u==c?h+1:g-1;r.insert(r.mapping.map(w),k)}h=g}return r.setMeta(jJ,{fixTables:!0})}function gI(t){const e=Ct.get(t),n=[],r=e.height,i=e.width;for(let s=0;s<r;s++){const a=[];for(let u=0;u<i;u++){const c=s*i+u,h=e.map[c];if(s>0){const d=c-i;if(h===e.map[d]){a.push(null);continue}}if(u>0){const d=c-1;if(h===e.map[d]){a.push(null);continue}}a.push(t.nodeAt(h))}n.push(a)}return n}function yI(t,e){const n=[],r=Ct.get(t),i=r.height,s=r.width;for(let a=0;a<i;a++){const u=t.child(a),c=[];for(let d=0;d<s;d++){const g=e[a][d];if(!g)continue;const y=r.map[a*r.width+d],x=t.nodeAt(y);if(!x)continue;const k=x.type.createChecked(g.attrs,g.content,g.marks);c.push(k)}const h=u.type.createChecked(u.attrs,c,u.marks);n.push(h)}return t.type.createChecked(t.attrs,n,t.marks)}function xI(t,e,n,r){const i=e[0]>n[0]?-1:1,s=t.splice(e[0],e.length),a=s.length%2===0?1:0;let u;return u=i===-1?n[0]:n[n.length-1]-a,t.splice(u,0,...s),t}function Cp(t){return UJ(e=>e.type.spec.tableRole==="table",t)}function UJ(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 Iu(t,e){const n=Cp(e.$from);if(!n)return;const r=Ct.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),a=i+n.start;return{pos:a,start:a+1,node:s,depth:n.depth+2}})}function _u(t,e){const n=Cp(e.$from);if(!n)return;const r=Ct.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),a=i+n.start;return{pos:a,start:a+1,node:s,depth:n.depth+2}})}function QN(t,e,n=e){let r=e,i=n;for(let d=e;d>=0;d--){const g=Iu(d,t.selection);g&&g.forEach(y=>{const x=y.node.attrs.colspan+d-1;x>=r&&(r=d),x>i&&(i=x)})}for(let d=e;d<=i;d++){const g=Iu(d,t.selection);g&&g.forEach(y=>{const x=y.node.attrs.colspan+d-1;y.node.attrs.colspan>1&&x>i&&(i=x)})}const s=[];for(let d=r;d<=i;d++){const g=Iu(d,t.selection);g&&g.length>0&&s.push(d)}r=s[0],i=s[s.length-1];const a=Iu(r,t.selection),u=_u(0,t.selection);if(!a||!u)return;const c=t.doc.resolve(a[a.length-1].pos);let h;for(let d=i;d>=r;d--){const g=Iu(d,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 ZN(t,e,n=e){let r=e,i=n;for(let d=e;d>=0;d--){const g=_u(d,t.selection);g&&g.forEach(y=>{const x=y.node.attrs.rowspan+d-1;x>=r&&(r=d),x>i&&(i=x)})}for(let d=e;d<=i;d++){const g=_u(d,t.selection);g&&g.forEach(y=>{const x=y.node.attrs.rowspan+d-1;y.node.attrs.rowspan>1&&x>i&&(i=x)})}const s=[];for(let d=r;d<=i;d++){const g=_u(d,t.selection);g&&g.length>0&&s.push(d)}r=s[0],i=s[s.length-1];const a=_u(r,t.selection),u=Iu(0,t.selection);if(!a||!u)return;const c=t.doc.resolve(a[a.length-1].pos);let h;for(let d=i;d>=r;d--){const g=_u(d,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 eT(t){return t[0].map((e,n)=>t.map(r=>r[n]))}function HJ(t){var e,n;const{tr:r,originIndex:i,targetIndex:s,select:a,pos:u}=t,c=Cp(r.doc.resolve(u));if(!c)return!1;const h=(e=QN(r,i))===null||e===void 0?void 0:e.indexes,d=(n=QN(r,s))===null||n===void 0?void 0:n.indexes;if(!h||!d||h.includes(s))return!1;const g=qJ(c.node,h,d);if(r.replaceWith(c.pos,c.pos+c.node.nodeSize,g),!a)return!0;const y=Ct.get(g),x=c.start,k=s,w=y.positionAt(y.height-1,k,g),N=r.doc.resolve(x+w),T=y.positionAt(0,k,g),V=r.doc.resolve(x+T);return r.setSelection(Lt.colSelection(N,V)),!0}function qJ(t,e,n,r){let i=eT(gI(t));return i=xI(i,e,n),i=eT(i),yI(t,i)}function KJ(t){var e,n;const{tr:r,originIndex:i,targetIndex:s,select:a,pos:u}=t,c=Cp(r.doc.resolve(u));if(!c)return!1;const h=(e=ZN(r,i))===null||e===void 0?void 0:e.indexes,d=(n=ZN(r,s))===null||n===void 0?void 0:n.indexes;if(!h||!d||h.includes(s))return!1;const g=GJ(c.node,h,d);if(r.replaceWith(c.pos,c.pos+c.node.nodeSize,g),!a)return!0;const y=Ct.get(g),x=c.start,k=s,w=y.positionAt(k,y.width-1,g),N=r.doc.resolve(x+w),T=y.positionAt(k,0,g),V=r.doc.resolve(x+T);return r.setSelection(Lt.rowSelection(N,V)),!0}function GJ(t,e,n,r){let i=gI(t);return i=xI(i,e,n),yI(t,i)}function oo(t){const e=t.selection,n=p0(t),r=n.node(-1),i=n.start(-1),s=Ct.get(r);return{...e instanceof Lt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function bI(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;zJ(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let a=0;a<e.height;a++){const u=a*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,_J(h.attrs,i-e.colCount(c))),a+=h.attrs.rowspan-1}else{const c=s==null?pi(r.type.schema).cell:r.nodeAt(e.map[u+s]).type,h=e.positionAt(a,i,r);t.insert(t.mapping.map(n+h),c.createAndFill())}}return t}function YJ(t,e){if(!yi(t))return!1;if(e){const n=oo(t);e(bI(t.tr,n,n.left))}return!0}function WJ(t,e){if(!yi(t))return!1;if(e){const n=oo(t);e(bI(t.tr,n,n.right))}return!0}function XJ(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let a=0;a<e.height;){const u=a*e.width+i,c=e.map[u],h=n.nodeAt(c),d=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,kl(d,i-e.colCount(c)));else{const g=t.mapping.slice(s).map(r+c);t.delete(g,g+h.nodeSize)}a+=d.rowspan}}function QJ(t,e){if(!yi(t))return!1;if(e){const n=oo(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;XJ(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=Ct.get(s)}e(r)}return!0}function ZJ(t,{map:e,table:n,tableStart:r},i){let s=0;for(let h=0;h<i;h++)s+=n.child(h).nodeSize;const a=s+n.child(i).nodeSize,u=t.mapping.maps.length;t.delete(s+r,a+r);const c=new Set;for(let h=0,d=i*e.width;h<e.width;h++,d++){const g=e.map[d];if(!c.has(g)){if(c.add(g),i>0&&g==e.map[d-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[d+e.width]){const y=n.nodeAt(g),x=y.attrs,k=y.type.create({...x,rowspan:y.attrs.rowspan-1},y.content),w=e.positionAt(i+1,h,n);t.insert(t.mapping.slice(u).map(r+w),k),h+=x.colspan-1}}}}function eU(t,e){if(!yi(t))return!1;if(e){const n=oo(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;ZJ(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=Ct.get(n.table)}e(r)}return!0}function tU(t,e){return function(n,r){if(!yi(n))return!1;const i=p0(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Lt?n.selection.forEachCell((a,u)=>{a.attrs[t]!==e&&s.setNodeMarkup(u,null,{...a.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function nU(t){return function(e,n){if(!yi(e))return!1;if(n){const r=pi(e.schema),i=oo(e),s=e.tr,a=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=a.map(c=>i.table.nodeAt(c));for(let c=0;c<a.length;c++)u[c].type==r.header_cell&&s.setNodeMarkup(i.tableStart+a[c],r.cell,u[c].attrs);if(s.steps.length===0)for(let c=0;c<a.length;c++)s.setNodeMarkup(i.tableStart+a[c],r.header_cell,u[c].attrs);n(s)}return!0}}function tT(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 wk(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?nU(t):function(n,r){if(!yi(n))return!1;if(r){const i=pi(n.schema),s=oo(n),a=n.tr,u=tT("row",s,i),c=tT("column",s,i),h=(t==="column"?u:t==="row"&&c)?1:0,d=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(d).forEach(y=>{const x=y+s.tableStart,k=a.doc.nodeAt(x);k&&a.setNodeMarkup(x,g,k.attrs)}),r(a)}return!0}}wk("row",{useDeprecatedLogic:!0});wk("column",{useDeprecatedLogic:!0});wk("cell",{useDeprecatedLogic:!0});function rU(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),a=s.lastChild;if(a)return i-1-a.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 SI(t){return function(e,n){if(!yi(e))return!1;const r=rU(p0(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Oe.between(i,IJ(i))).scrollIntoView())}return!0}}function iU(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 Qd(t,e){const n=t.selection;if(!(n instanceof Lt))return!1;if(e){const r=t.tr,i=pi(t.schema).cell.createAndFill().content;n.forEachCell((s,a)=>{s.content.eq(i)||r.replace(r.mapping.map(a+1),r.mapping.map(a+s.nodeSize-1),new q(i,0,0))}),r.docChanged&&e(r)}return!0}function sU(t){return(e,n)=>{const{from:r,to:i,select:s=!0,pos:a=e.selection.from}=t,u=e.tr;return KJ({tr:u,originIndex:r,targetIndex:i,select:s,pos:a})?(n?.(u),!0):!1}}function aU(t){return(e,n)=>{const{from:r,to:i,select:s=!0,pos:a=e.selection.from}=t,u=e.tr;return HJ({tr:u,originIndex:r,targetIndex:i,select:s,pos:a})?(n?.(u),!0):!1}}function oU(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,a=i.type.schema,u=[];if(s=="row")for(let c=0;c<e.childCount;c++){let h=e.child(c).content;const d=c?0:Math.max(0,n-1),g=c<e.childCount-1?0:Math.max(0,r-1);(d||g)&&(h=xS(pi(a).row,new q(h,d,g)).content),u.push(h)}else if(s=="cell"||s=="header_cell")u.push(n||r?xS(pi(a).row,new q(e,n,r)).content:e);else return null;return lU(a,u)}function lU(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let a=s.childCount-1;a>=0;a--){const{rowspan:u,colspan:c}=s.child(a).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(W.empty),n[i]<r){const s=pi(t).cell.createAndFill(),a=[];for(let u=n[i];u<r;u++)a.push(s);e[i]=e[i].append(W.from(a))}return{height:e.length,width:r,rows:e}}function xS(t,e){const n=t.createAndFill();return new L$(n).replace(0,n.content.size,e).doc}function uU({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],a=[];for(let u=0;u<n.length;u++){const c=n[u],h=[];for(let d=s[u]||0,g=0;d<r;g++){let y=c.child(g%c.childCount);d+y.attrs.colspan>r&&(y=y.type.createChecked(kl(y.attrs,y.attrs.colspan,d+y.attrs.colspan-r),y.content)),h.push(y),d+=y.attrs.colspan;for(let x=1;x<y.attrs.rowspan;x++)s[u+x]=(s[u+x]||0)+y.attrs.colspan}a.push(W.from(h))}n=a,t=r}if(e!=i){const s=[];for(let a=0,u=0;a<i;a++,u++){const c=[],h=n[u%e];for(let d=0;d<h.childCount;d++){let g=h.child(d);a+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(W.from(c))}n=s,e=i}return{width:t,height:e,rows:n}}function cU(t,e,n,r,i,s,a){const u=t.doc.type.schema,c=pi(u);let h,d;if(i>e.width)for(let g=0,y=0;g<e.height;g++){const x=n.child(g);y+=x.nodeSize;const k=[];let w;x.lastChild==null||x.lastChild.type==c.cell?w=h||(h=c.cell.createAndFill()):w=d||(d=c.header_cell.createAndFill());for(let N=e.width;N<i;N++)k.push(w);t.insert(t.mapping.slice(a).map(y-1+r),k)}if(s>e.height){const g=[];for(let k=0,w=(e.height-1)*e.width;k<Math.max(e.width,i);k++){const N=k>=e.width?!1:n.nodeAt(e.map[w+k]).type==c.header_cell;g.push(N?d||(d=c.header_cell.createAndFill()):h||(h=c.cell.createAndFill()))}const y=c.row.create(null,W.from(g)),x=[];for(let k=e.height;k<s;k++)x.push(y);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),x)}return!!(h||d)}function nT(t,e,n,r,i,s,a,u){if(a==0||a==e.height)return!1;let c=!1;for(let h=i;h<s;h++){const d=a*e.width+h,g=e.map[d];if(e.map[d-e.width]==g){c=!0;const y=n.nodeAt(g),{top:x,left:k}=e.findCell(g);t.setNodeMarkup(t.mapping.slice(u).map(g+r),null,{...y.attrs,rowspan:a-x}),t.insert(t.mapping.slice(u).map(e.positionAt(a,k,n)),y.type.createAndFill({...y.attrs,rowspan:x+y.attrs.rowspan-a})),h+=y.attrs.colspan-1}}return c}function rT(t,e,n,r,i,s,a,u){if(a==0||a==e.width)return!1;let c=!1;for(let h=i;h<s;h++){const d=h*e.width+a,g=e.map[d];if(e.map[d-1]==g){c=!0;const y=n.nodeAt(g),x=e.colCount(g),k=t.mapping.slice(u).map(g+r);t.setNodeMarkup(k,null,kl(y.attrs,a-x,y.attrs.colspan-(a-x))),t.insert(k+y.nodeSize,y.type.createAndFill(kl(y.attrs,0,a-x))),h+=y.attrs.rowspan-1}}return c}function iT(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let a=Ct.get(s);const{top:u,left:c}=r,h=c+i.width,d=u+i.height,g=t.tr;let y=0;function x(){if(s=n?g.doc.nodeAt(n-1):g.doc,!s)throw new Error("No table found");a=Ct.get(s),y=g.mapping.maps.length}cU(g,a,s,n,h,d,y)&&x(),nT(g,a,s,n,c,h,u,y)&&x(),nT(g,a,s,n,c,h,d,y)&&x(),rT(g,a,s,n,u,d,c,y)&&x(),rT(g,a,s,n,u,d,h,y)&&x();for(let k=u;k<d;k++){const w=a.positionAt(k,c,s),N=a.positionAt(k,h,s);g.replace(g.mapping.slice(y).map(w+n),g.mapping.slice(y).map(N+n),new q(i.rows[k-u],0,0))}x(),g.setSelection(new Lt(g.doc.resolve(n+a.positionAt(u,c,s)),g.doc.resolve(n+a.positionAt(d-1,h-1,s)))),e(g)}const fU=M3({ArrowLeft:Zd("horiz",-1),ArrowRight:Zd("horiz",1),ArrowUp:Zd("vert",-1),ArrowDown:Zd("vert",1),"Shift-ArrowLeft":em("horiz",-1),"Shift-ArrowRight":em("horiz",1),"Shift-ArrowUp":em("vert",-1),"Shift-ArrowDown":em("vert",1),Backspace:Qd,"Mod-Backspace":Qd,Delete:Qd,"Mod-Delete":Qd});function _m(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 Lt)return _m(n,r,Pe.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=vI(i,t,e);if(a==null)return!1;if(t=="horiz")return _m(n,r,Pe.near(n.doc.resolve(s.head+e),e));{const u=n.doc.resolve(a),c=pI(u,t,e);let h;return c?h=Pe.near(c,1):e<0?h=Pe.near(n.doc.resolve(u.before(-1)),-1):h=Pe.near(n.doc.resolve(u.after(-1)),1),_m(n,r,h)}}}function em(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let a;if(s instanceof Lt)a=s;else{const c=vI(i,t,e);if(c==null)return!1;a=new Lt(n.doc.resolve(c))}const u=pI(a.$headCell,t,e);return u?_m(n,r,new Lt(a.$anchorCell,u)):!1}}function hU(t,e){const n=t.state.doc,r=Xu(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Lt(r))),!0):!1}function pU(t,e,n){if(!yi(t.state))return!1;let r=oU(n);const i=t.state.selection;if(i instanceof Lt){r||(r={width:1,height:1,rows:[W.from(xS(pi(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),u=Ct.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=uU(r,u.right-u.left,u.bottom-u.top),iT(t.state,t.dispatch,a,u,r),!0}else if(r){const s=p0(t.state),a=s.start(-1);return iT(t.state,t.dispatch,a,Ct.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function dU(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=sT(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Lt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Xu(t.state.selection.$anchor))!=null&&((n=E1(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 d=E1(t,h);const g=Va.getState(t.state)==null;if(!d||!Ck(c,d))if(g)d=c;else return;const y=new Lt(c,d);if(g||!t.state.selection.eq(y)){const x=t.state.tr.setSelection(y);g&&x.setMeta(Va,c.pos),t.dispatch(x)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",u),Va.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Va,-1))}function u(c){const h=c,d=Va.getState(t.state);let g;if(d!=null)g=t.state.doc.resolve(d);else if(sT(t,h.target)!=r&&(g=E1(t,e),!g))return a();g&&s(g,h)}t.root.addEventListener("mouseup",a),t.root.addEventListener("dragstart",a),t.root.addEventListener("mousemove",u)}function vI(t,e,n){if(!(t.state.selection instanceof Oe))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 a=r.before(i),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?a:null}}return null}function sT(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function E1(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&&Xu(t.state.doc.resolve(r))||Xu(t.state.doc.resolve(i))}var mU=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")),bS(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,bS(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function bS(t,e,n,r,i,s){let a=0,u=!0,c=e.firstChild;const h=t.firstChild;if(h){for(let g=0,y=0;g<h.childCount;g++){const{colspan:x,colwidth:k}=h.child(g).attrs;for(let w=0;w<x;w++,y++){const N=i==y?s:k&&k[w],T=N?N+"px":"";if(a+=N||r,N||(u=!1),c)c.style.width!=T&&(c.style.width=T),c=c.nextSibling;else{const V=document.createElement("col");V.style.width=T,e.appendChild(V)}}}for(;c;){var d;const g=c.nextSibling;(d=c.parentNode)===null||d===void 0||d.removeChild(c),c=g}u?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}const _r=new Ln("tableColumnResizing");function gU({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=mU,lastColumnResizable:i=!0}={}){const s=new ur({key:_r,state:{init(a,u){var c;const h=(c=s.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,d=pi(u.schema).table.name;return r&&h&&(h[d]=(g,y)=>new r(g,n,y)),new yU(-1,!1)},apply(a,u){return u.apply(a)}},props:{attributes:a=>{const u=_r.getState(a);return u&&u.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,u)=>{xU(a,u,t,i)},mouseleave:a=>{bU(a)},mousedown:(a,u)=>{SU(a,u,e,n)}},decorations:a=>{const u=_r.getState(a);if(u&&u.activeHandle>-1)return EU(a,u.activeHandle)},nodeViews:{}}});return s}var yU=class zm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(_r);if(r&&r.setHandle!=null)return new zm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new zm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return yS(e.doc.resolve(i))||(i=-1),new zm(i,n.dragging)}return n}};function xU(t,e,n,r){if(!t.editable)return;const i=_r.getState(t.state);if(i&&!i.dragging){const s=kU(e.target);let a=-1;if(s){const{left:u,right:c}=s.getBoundingClientRect();e.clientX-u<=n?a=aT(t,e,"left",n):c-e.clientX<=n&&(a=aT(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const u=t.state.doc.resolve(a),c=u.node(-1),h=Ct.get(c),d=u.start(-1);if(h.colCount(u.pos-d)+u.nodeAfter.attrs.colspan-1==h.width-1)return}kI(t,a)}}}function bU(t){if(!t.editable)return;const e=_r.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&kI(t,-1)}function SU(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,a=_r.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const u=t.state.doc.nodeAt(a.activeHandle),c=vU(t,a.activeHandle,u.attrs);t.dispatch(t.state.tr.setMeta(_r,{setDragging:{startX:e.clientX,startWidth:c}}));function h(g){s.removeEventListener("mouseup",h),s.removeEventListener("mousemove",d);const y=_r.getState(t.state);y?.dragging&&(CU(t,y.activeHandle,oT(y.dragging,g,n)),t.dispatch(t.state.tr.setMeta(_r,{setDragging:null})))}function d(g){if(!g.which)return h(g);const y=_r.getState(t.state);if(y&&y.dragging){const x=oT(y.dragging,g,n);lT(t,y.activeHandle,x,r)}}return lT(t,a.activeHandle,c,r),s.addEventListener("mouseup",h),s.addEventListener("mousemove",d),e.preventDefault(),!0}function vU(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let a=s.node.childNodes[s.offset].offsetWidth,u=n;if(r)for(let c=0;c<n;c++)r[c]&&(a-=r[c],u--);return a/u}function kU(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function aT(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:a}=s,u=Xu(t.state.doc.resolve(a));if(!u)return-1;if(n=="right")return u.pos;const c=Ct.get(u.node(-1)),h=u.start(-1),d=c.map.indexOf(u.pos-h);return d%c.width==0?-1:h+c.map[d-1]}function oT(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function kI(t,e){t.dispatch(t.state.tr.setMeta(_r,{setHandle:e}))}function CU(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Ct.get(i),a=r.start(-1),u=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let h=0;h<s.height;h++){const d=h*s.width+u;if(h&&s.map[d]==s.map[d-s.width])continue;const g=s.map[d],y=i.nodeAt(g).attrs,x=y.colspan==1?0:u-s.colCount(g);if(y.colwidth&&y.colwidth[x]==n)continue;const k=y.colwidth?y.colwidth.slice():wU(y.colspan);k[x]=n,c.setNodeMarkup(a+g,null,{...y,colwidth:k})}c.docChanged&&t.dispatch(c)}function lT(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),u=Ct.get(s).colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;let c=t.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&bS(s,c.firstChild,c,r,u,n)}function wU(t){return Array(t).fill(0)}function EU(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return fi.empty;const s=Ct.get(i),a=r.start(-1),u=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1;for(let h=0;h<s.height;h++){const d=u+h*s.width;if((u==s.width-1||s.map[d]!=s.map[d+1])&&(h==0||s.map[d]!=s.map[d-s.width])){var c;const g=s.map[d],y=a+g+i.nodeAt(g).nodeSize-1,x=document.createElement("div");x.className="column-resize-handle",!((c=_r.getState(t))===null||c===void 0)&&c.dragging&&n.push(vl.node(a+g,a+g+i.nodeAt(g).nodeSize,{class:"column-resize-dragging"})),n.push(vl.widget(y,x))}}return fi.create(t.doc,n)}function AU({allowTableNodeSelection:t=!1}={}){return new ur({key:Va,state:{init(){return null},apply(e,n){const r=e.getMeta(Va);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:BJ,handleDOMEvents:{mousedown:dU},createSelectionBetween(e){return Va.getState(e.state)!=null?e.state.selection:null},handleTripleClick:hU,handleKeyDown:fU,handlePaste:pU},appendTransaction(e,n,r){return PJ(r,$J(r,n),t)}})}const CI=65535,wI=Math.pow(2,16);function NU(t,e){return t+e*wI}function uT(t){return t&CI}function TU(t){return(t-(t&CI))/wI}const EI=1,AI=2,Lm=4,NI=8;let cT=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&NI)>0}get deletedBefore(){return(this.delInfo&(EI|Lm))>0}get deletedAfter(){return(this.delInfo&(AI|Lm))>0}get deletedAcross(){return(this.delInfo&Lm)>0}},Cl=class zu{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&zu.empty)return zu.empty}recover(e){let n=0,r=uT(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+TU(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,a=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],d=this.ranges[u+a],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,x=c+i+(y<0?0:d);if(r)return x;let k=e==(n<0?c:g)?null:NU(u/3,e-c),w=e==c?AI:e==g?EI:Lm;return(n<0?e!=c:e!=g)&&(w|=NI),new cT(x,w,k)}i+=d-h}return r?e+i:new cT(e+i,0,null)}touches(e,n){let r=0,i=uT(n),s=this.inverted?2:1,a=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],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+a]-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 a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new zu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?zu.empty:new zu(e<0?[0,-e,0]:[0,0,e])}};Cl.empty=new Cl([]);const A1=Object.create(null);let $n=class{getMap(){return Cl.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=A1[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 A1)throw new RangeError("Duplicate use of step JSON ID "+e);return A1[e]=n,n.prototype.jsonID=e,n}},ir=class Zf{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Zf(e,null)}static fail(e){return new Zf(null,e)}static fromReplace(e,n,r,i){try{return Zf.ok(e.replace(n,r,i))}catch(s){if(s instanceof hi)return Zf.fail(s.message);throw s}}};function Ek(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Ek(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return W.fromArray(r)}let TI=class eh extends $n{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 q(Ek(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return ir.fromReplace(e,this.from,this.to,s)}invert(){return new MI(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 eh(n.pos,r.pos,this.mark)}merge(e){return e instanceof eh&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eh(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 eh(n.from,n.to,e.markFromJSON(n.mark))}};$n.jsonID("addMark",TI);let MI=class th extends $n{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 q(Ek(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return ir.fromReplace(e,this.from,this.to,r)}invert(){return new TI(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 th(n.pos,r.pos,this.mark)}merge(e){return e instanceof th&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new th(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 th(n.from,n.to,e.markFromJSON(n.mark))}};$n.jsonID("removeMark",MI);let OI=class nh extends $n{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ir.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ir.fromReplace(e,this.pos,this.pos+1,new q(W.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 nh(this.pos,n.marks[i]);return new nh(this.pos,this.mark)}}return new RI(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new nh(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 nh(n.pos,e.markFromJSON(n.mark))}};$n.jsonID("addNodeMark",OI);let RI=class SS extends $n{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ir.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ir.fromReplace(e,this.pos,this.pos+1,new q(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new OI(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new SS(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 SS(n.pos,e.markFromJSON(n.mark))}};$n.jsonID("removeNodeMark",RI);let MU=class Fo extends $n{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&vS(e,this.from,this.to)?ir.fail("Structure replace would overwrite content"):ir.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Cl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Fo(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 Fo(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Fo)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Fo(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Fo(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 Fo(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}};$n.jsonID("replace",MU);let OU=class Bm extends $n{constructor(e,n,r,i,s,a,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(vS(e,this.from,this.gapFrom)||vS(e,this.gapTo,this.to)))return ir.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ir.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?ir.fromReplace(e,this.from,this.to,r):ir.fail("Content does not fit in gap")}getMap(){return new Cl([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 Bm(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 Bm(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 Bm(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}};$n.jsonID("replaceAround",OU);function vS(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 a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function RU(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 a=r.depth;a>=0;a--){let u=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,c=r.index(a)+(u>0?1:0),h=r.node(a),d=!1;if(s==1)d=h.canReplace(c,c,i);else{let g=h.contentMatchAt(c).findWrapping(i.firstChild.type);d=g&&h.canReplaceWith(c,c,g[0])}if(d)return u==0?r.pos:u<0?r.before(a+1):r.after(a+1)}return null}let DU=class Fm extends $n{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 ir.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 ir.fromReplace(e,this.pos,this.pos+1,new q(W.from(i),0,n.isLeaf?0:1))}getMap(){return Cl.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)}};$n.jsonID("attr",DU);let IU=class kS extends $n{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 ir.ok(r)}getMap(){return Cl.empty}invert(e){return new kS(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 kS(n.attr,n.value)}};$n.jsonID("docAttr",IU);let Kh=class extends Error{};Kh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Kh.prototype=Object.create(Error.prototype);Kh.prototype.constructor=Kh;Kh.prototype.name="TransformError";const Ol=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},DI=function(t,e,n,r){return n&&(fT(t,e,n,r,-1)||fT(t,e,n,r,1))},_U=/^(img|br|input|textarea|hr)$/i;function fT(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:pg(t))){let a=t.parentNode;if(!a||a.nodeType!=1||Ak(t)||_U.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ol(t)+(i<0?0:1),t=a}else if(t.nodeType==1){let a=t.childNodes[e+(i<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((s=a.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=a,e=i<0?pg(t):0}else return!1}}function pg(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function zU(t,e,n){for(let r=e==0,i=e==pg(t);r||i;){if(t==n)return!0;let s=Ol(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==pg(t)}}function Ak(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 II=function(t){return t.focusNode&&DI(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function _I(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Zi=typeof navigator<"u"?navigator:null,hT=typeof document<"u"?document:null,lo=Zi&&Zi.userAgent||"",CS=/Edge\/(\d+)/.exec(lo),zI=/MSIE \d/.exec(lo),wS=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(lo),wp=!!(zI||wS||CS),LI=zI?document.documentMode:wS?+wS[1]:CS?+CS[1]:0,d0=!wp&&/gecko\/(\d+)/i.test(lo);d0&&+(/Firefox\/(\d+)/.exec(lo)||[0,0])[1];const ES=!wp&&/Chrome\/(\d+)/.exec(lo),Ys=!!ES,BI=ES?+ES[1]:0,Rl=!wp&&!!Zi&&/Apple Computer/.test(Zi.vendor),Nk=Rl&&(/Mobile\/\w+/.test(lo)||!!Zi&&Zi.maxTouchPoints>2),ii=Nk||(Zi?/Mac/.test(Zi.platform):!1),FI=Zi?/Win/.test(Zi.platform):!1,Ep=/Android \d/.test(lo),Tk=!!hT&&"webkitFontSmoothing"in hT.documentElement.style,LU=Tk?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function BU(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,a=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let u=r.resolve(a),c,h;if(II(n)){for(c=a;i&&!i.node;)i=i.parent;let g=i.node;if(i&&g.isAtom&&be.isSelectable(g)&&i.parent&&!(g.isInline&&zU(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;h=new be(a==y?u:r.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let g=a,y=a;for(let x=0;x<n.rangeCount;x++){let k=n.getRangeAt(x);g=Math.min(g,t.docView.posFromDOM(k.startContainer,k.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(k.endContainer,k.endOffset,-1))}if(g<0)return null;[c,a]=y==t.state.selection.anchor?[y,g]:[g,y],u=r.resolve(a)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!h){let g=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;h=PI(t,d,u,g)}return h}function VI(t){return t.editable?t.hasFocus():jU(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Mk(t,e=!1){let n=t.state.selection;if(PU(t,n),!!VI(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ys){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&DI(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)VU(t);else{let{anchor:r,head:i}=n,s,a;pT&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(s=dT(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=dT(t,n.to))),t.docView.setSelection(r,i,t,e),pT&&(s&&mT(s),a&&mT(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&FU(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const pT=Rl||Ys&&BI<63;function dT(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(Rl&&i&&i.contentEditable=="false")return N1(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return N1(i);if(s)return N1(s)}}function N1(t){return t.contentEditable="true",Rl&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function mT(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function FU(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(()=>{(!VI(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function VU(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ol(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&wp&&LI<=11&&(n.disabled=!0,n.disabled=!1)}function PU(t,e){if(e instanceof be){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(gT(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else gT(t)}function gT(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function PI(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Oe.between(e,n,r)}function jU(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 AS(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&&Pe.findFrom(s,e)}function La(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function yT(t,e,n){let r=t.state.selection;if(r instanceof Oe)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 a=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return La(t,new Oe(r.$anchor,a))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=AS(t.state,e);return i&&i instanceof be?La(t,i):!1}else if(!(ii&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(a=t.docView.descAt(u))&&!a.contentDOM?be.isSelectable(s)?La(t,new be(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Tk?La(t,new Oe(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof be&&r.node.isInline)return La(t,new Oe(e>0?r.$to:r.$from));{let i=AS(t.state,e);return i?La(t,i):!1}}}function dg(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function vh(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Su(t,e){return e<0?$U(t):JU(t)}function $U(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,a=!1;for(d0&&n.nodeType==1&&r<dg(n)&&vh(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(vh(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(jI(n))break;{let u=n.previousSibling;for(;u&&vh(u,-1);)i=n.parentNode,s=Ol(u),u=u.previousSibling;if(u)n=u,r=dg(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}a?NS(t,n,r):i&&NS(t,i,s)}function JU(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=dg(n),s,a;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(vh(u,1))s=n,a=++r;else break}else{if(jI(n))break;{let u=n.nextSibling;for(;u&&vh(u,1);)s=u.parentNode,a=Ol(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=dg(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&NS(t,s,a)}function jI(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function UU(t,e){for(;t&&e==t.childNodes.length&&!Ak(t);)e=Ol(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 HU(t,e){for(;t&&!e&&!Ak(t);)e=Ol(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 NS(t,e,n){if(e.nodeType!=3){let s,a;(a=UU(e,n))?(e=a,n=0):(s=HU(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(II(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&&Mk(t)},50)}function xT(t,e){let n=t.state.doc.resolve(e);if(!(Ys||FI)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),a=(s.top+s.bottom)/2;if(a>i.top&&a<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),a=(s.top+s.bottom)/2;if(a>i.top&&a<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 bT(t,e,n){let r=t.state.selection;if(r instanceof Oe&&!r.empty||n.indexOf("s")>-1||ii&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let a=AS(t.state,e);if(a&&a instanceof be)return La(t,a)}if(!i.parent.inlineContent){let a=e<0?i:s,u=r instanceof sr?Pe.near(a,e):Pe.findFrom(a,e);return u?La(t,u):!1}return!1}function ST(t,e){if(!(t.state.selection instanceof Oe))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 a=t.state.tr;return e<0?a.delete(n.pos-s.nodeSize,n.pos):a.delete(n.pos,n.pos+s.nodeSize),t.dispatch(a),!0}return!1}function vT(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function qU(t){if(!Rl||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;vT(t,r,"true"),setTimeout(()=>vT(t,r,"false"),20)}return!1}function KU(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function GU(t,e){let n=e.keyCode,r=KU(e);if(n==8||ii&&n==72&&r=="c")return ST(t,-1)||Su(t,-1);if(n==46&&!e.shiftKey||ii&&n==68&&r=="c")return ST(t,1)||Su(t,1);if(n==13||n==27)return!0;if(n==37||ii&&n==66&&r=="c"){let i=n==37?xT(t,t.state.selection.from)=="ltr"?-1:1:-1;return yT(t,i,r)||Su(t,i)}else if(n==39||ii&&n==70&&r=="c"){let i=n==39?xT(t,t.state.selection.from)=="ltr"?1:-1:1;return yT(t,i,r)||Su(t,i)}else{if(n==38||ii&&n==80&&r=="c")return bT(t,-1,r)||Su(t,-1);if(n==40||ii&&n==78&&r=="c")return qU(t)||bT(t,1,r)||Su(t,1);if(r==(ii?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function $I(t,e){t.someProp("transformCopied",x=>{e=x(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 x=r.firstChild;n.push(x.type.name,x.attrs!=x.type.defaultAttrs?x.attrs:null),r=x.content}let a=t.someProp("clipboardSerializer")||rs.fromSchema(t.state.schema),u=GI(),c=u.createElement("div");c.appendChild(a.serializeFragment(r,{document:u}));let h=c.firstChild,d,g=0;for(;h&&h.nodeType==1&&(d=KI[h.nodeName.toLowerCase()]);){for(let x=d.length-1;x>=0;x--){let k=u.createElement(d[x]);for(;c.firstChild;)k.appendChild(c.firstChild);c.appendChild(k),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",x=>x(e,t))||e.content.textBetween(0,e.content.size,`
51
+
52
+ `);return{dom:c,text:y,slice:e}}function JI(t,e,n,r,i){let s=i.parent.type.spec.code,a,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 q(W.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:x}=t.state,k=rs.fromSchema(x);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=a.appendChild(document.createElement("p"));w&&N.appendChild(k.serializeNode(x.text(w,y)))})}}else t.someProp("transformPastedHTML",g=>{n=g(n,t)}),a=QU(n),Tk&&ZU(a);let h=a&&a.querySelector("[data-pm-slice]"),d=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let g=+d[3];g>0;g--){let y=a.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;a=y}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||Ya.fromSchema(t.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||d),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!YU.test(y.parentNode.nodeName)?{ignore:!0}:null}})),d)u=eH(kT(u,+d[1],+d[2]),d[4]);else if(u=q.maxOpen(WU(u.content,i),!0),u.openStart||u.openEnd){let g=0,y=0;for(let x=u.content.firstChild;g<u.openStart&&!x.type.spec.isolating;g++,x=x.firstChild);for(let x=u.content.lastChild;y<u.openEnd&&!x.type.spec.isolating;y++,x=x.lastChild);u=kT(u,g,y)}return t.someProp("transformPasted",g=>{u=g(u,t,c)}),u}const YU=/^(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 WU(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,a=[];if(t.forEach(u=>{if(!a)return;let c=i.findWrapping(u.type),h;if(!c)return a=null;if(h=a.length&&s.length&&HI(c,s,u,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=qI(a[a.length-1],s.length));let d=UI(u,c);a.push(d),i=i.matchType(d.type),s=c}}),a)return W.from(a)}return t}function UI(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,W.from(t));return t}function HI(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=HI(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(W.from(UI(n,t,i+1))))}}function qI(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,qI(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(W.empty,!0);return t.copy(n.append(r))}function TS(t,e,n,r,i,s){let a=e<0?t.firstChild:t.lastChild,u=a.content;return t.childCount>1&&(s=0),i<r-1&&(u=TS(u,e,n,r,i+1,s)),i>=n&&(u=e<0?a.contentMatchAt(0).fillBefore(u,s<=i).append(u):u.append(a.contentMatchAt(a.childCount).fillBefore(W.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(u))}function kT(t,e,n){return e<t.openStart&&(t=new q(TS(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new q(TS(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const KI={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 CT=null;function GI(){return CT||(CT=document.implementation.createHTMLDocument("title"))}let T1=null;function XU(t){let e=window.trustedTypes;return e?(T1||(T1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),T1.createHTML(t)):t}function QU(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=GI().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&KI[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=XU(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function ZU(t){let e=t.querySelectorAll(Ys?"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 eH(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:a}=t;for(let u=r.length-2;u>=0;u-=2){let c=n.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=W.from(c.create(r[u+1],i)),s++,a++}return new q(i,s,a)}const Bi={},Fr={};function Ja(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}Fr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!WI(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ep&&Ys&&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,_I(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||GU(t,n)?n.preventDefault():Ja(t,"key")};Fr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Fr.keypress=(t,e)=>{let n=e;if(WI(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ii&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Oe)||!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",a=>a(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function m0(t){return{left:t.clientX,top:t.clientY}}function tH(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Ok(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let a=s.depth+1;a>0;a--)if(t.someProp(e,u=>a>s.depth?u(t,n,s.nodeAfter,s.before(a),i,!0):u(t,n,s.node(a),s.before(a),i,!1)))return!0;return!1}function $u(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 nH(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&be.isSelectable(r)?($u(t,new be(n)),!0):!1}function rH(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof be&&(r=n.node);let s=t.state.doc.resolve(e);for(let a=s.depth+1;a>0;a--){let u=a>s.depth?s.nodeAfter:s.node(a);if(be.isSelectable(u)){r&&n.$from.depth>0&&a>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(a);break}}return i!=null?($u(t,be.create(t.state.doc,i)),!0):!1}function iH(t,e,n,r,i){return Ok(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?rH(t,n):nH(t,n))}function sH(t,e,n,r){return Ok(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function aH(t,e,n,r){return Ok(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||oH(t,n,r)}function oH(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?($u(t,Oe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(a.inlineContent)$u(t,Oe.create(r,u+1,u+1+a.content.size));else if(be.isSelectable(a))$u(t,be.create(r,u));else continue;return!0}}function Rk(t){return mg(t)}const YI=ii?"metaKey":"ctrlKey";Bi.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Rk(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&tH(n,t.input.lastClick)&&!n[YI]&&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 a=t.posAtCoords(m0(n));a&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new lH(t,a,n,!!r)):(s=="doubleClick"?sH:aH)(t,a.pos,a.inside,n)?n.preventDefault():Ja(t,"pointer"))};class lH{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[YI],this.allowDefault=r.shiftKey;let s,a;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),a=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,a=d.depth?d.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 be&&h.from<=a&&h.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&d0&&!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)),Ja(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(()=>Mk(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(m0(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ja(this.view,"pointer"):iH(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Rl&&this.mightDrag&&!this.mightDrag.node.isAtom||Ys&&!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)?($u(this.view,Pe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ja(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ja(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)}}Bi.touchstart=t=>{t.input.lastTouch=Date.now(),Rk(t),Ja(t,"pointer")};Bi.touchmove=t=>{t.input.lastTouch=Date.now(),Ja(t,"pointer")};Bi.contextmenu=t=>Rk(t);function WI(t,e){return t.composing?!0:Rl&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const uH=Ep?5e3:-1;Fr.compositionstart=Fr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ys&&FI&&cH(t)))t.markCursor=t.state.storedMarks||n.marks(),mg(t,!0),t.markCursor=null;else if(mg(t,!e.selection.empty),d0&&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 a=s<0?i.lastChild:i.childNodes[s-1];if(!a)break;if(a.nodeType==3){let u=t.domSelection();u&&u.collapse(a,a.nodeValue.length);break}else i=a,s=-1}}t.input.composing=!0}XI(t,uH)};function cH(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"}Fr.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++,XI(t,20))};function XI(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>mg(t),e))}function fH(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=hH());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function hH(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function mg(t,e=!1){if(!(Ep&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),fH(t),e||t.docView&&t.docView.dirty){let n=BU(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 pH(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=wp&&LI<15||Nk&&LU<604;Bi.copy=Fr.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Gh?null:n.clipboardData,a=r.content(),{dom:u,text:c}=$I(t,a);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):pH(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function dH(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function mH(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?MS(t,r.value,null,i,e):MS(t,r.textContent,r.innerHTML,i,e)},50)}function MS(t,e,n,r,i){let s=JI(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,s||q.empty)))return!0;if(!s)return!1;let a=dH(s),u=a?t.state.tr.replaceSelectionWith(a,r):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function QI(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," "):""}Fr.paste=(t,e)=>{let n=e;if(t.composing&&!Ep)return;let r=Gh?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&MS(t,QI(r),r.getData("text/html"),i,n)?n.preventDefault():mH(t,n)};class gH{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const yH=ii?"altKey":"ctrlKey";function ZI(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[yH]}Bi.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(m0(n)),a;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof be?i.to-1:i.to))){if(r&&r.mightDrag)a=be.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&&(a=be.create(t.state.doc,g.posBefore))}}let u=(a||t.state.selection).content(),{dom:c,text:h,slice:d}=$I(t,u);(!n.dataTransfer.files.length||!Ys||BI>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 gH(d,ZI(t,n),a)};Bi.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Fr.dragover=Fr.dragenter=(t,e)=>e.preventDefault();Fr.drop=(t,e)=>{try{xH(t,e,t.dragging)}finally{t.dragging=null}};function xH(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(m0(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",x=>{s=x(s,t,!1)}):s=JI(t,QI(e.dataTransfer),Gh?null:e.dataTransfer.getData("text/html"),!1,i);let a=!!(n&&ZI(t,e));if(t.someProp("handleDrop",x=>x(t,e,s||q.empty,a))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?RU(t.state.doc,i.pos,s):i.pos;u==null&&(u=i.pos);let c=t.state.tr;if(a){let{node:x}=n;x?x.replace(c):c.deleteSelection()}let h=c.mapping.map(u),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,g=c.doc;if(d?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(g))return;let y=c.doc.resolve(h);if(d&&be.isSelectable(s.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new be(y));else{let x=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((k,w,N,T)=>x=T),c.setSelection(PI(t,y,c.doc.resolve(x)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Bi.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())&&Mk(t)},20))};Bi.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)};Bi.beforeinput=(t,e)=>{if(Ys&&Ep&&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,_I(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 Fr)Bi[t]=Fr[t];function Yh(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 gg{constructor(e,n){this.toDOM=e,this.spec=n||il,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:a}=e.mapResult(n.from+i,this.side<0?-1:1);return a?null:new qi(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof gg&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Yh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ka{constructor(e,n){this.attrs=e,this.spec=n||il}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=a?null:new qi(s,a,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Ka&&Yh(this.attrs,e.attrs)&&Yh(this.spec,e.spec)}static is(e){return e.type instanceof Ka}destroy(){}}class Dk{constructor(e,n){this.attrs=e,this.spec=n||il}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let a=e.mapResult(n.to+i,-1);return a.deleted||a.pos<=s.pos?null:new qi(s.pos-r,a.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 Dk&&Yh(this.attrs,e.attrs)&&Yh(this.spec,e.spec)}destroy(){}}class qi{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new qi(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 qi(e,e,new gg(n,r))}static inline(e,n,r,i){return new qi(e,n,new Ka(r,i))}static node(e,n,r,i){return new qi(e,n,new Dk(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ka}get widget(){return this.type instanceof gg}}const Lu=[],il={};class un{constructor(e,n){this.local=e.length?e:Lu,this.children=n.length?n:Lu}static create(e,n){return n.length?yg(n,e,0,il):Yn}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 a=0;a<this.local.length;a++){let u=this.local[a];u.from<=n&&u.to>=e&&(!s||s(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>e){let u=this.children[a]+1;this.children[a+2].findInner(e-u,n-u,r,i+u,s)}}map(e,n,r){return this==Yn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||il)}mapInner(e,n,r,i,s){let a;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(n,c)?(a||(a=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?bH(this.children,a||[],e,n,r,i,s):a?new un(a.sort(sl),Lu):Yn}add(e,n){return n.length?this==Yn?un.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,d;if(d=t_(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,d,h+1):i.splice(s,0,c,c+u.nodeSize,yg(d,u,h+1,il)),s+=3}});let a=e_(s?n_(n):n,-r);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||a.splice(u--,1);return new un(a.length?this.local.concat(a).sort(sl):this.local,i||this.children)}remove(e){return e.length==0||this==Yn?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 a,u=r[s]+n,c=r[s+1]+n;for(let d=0,g;d<e.length;d++)(g=e[d])&&g.from>u&&g.to<c&&(e[d]=null,(a||(a=[])).push(g));if(!a)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(a,u+1);h!=Yn?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,a;s<e.length;s++)if(a=e[s])for(let u=0;u<i.length;u++)i[u].eq(a,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 un(i,r):Yn}forChild(e,n){if(this==Yn)return this;if(n.isLeaf)return un.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,a=s+n.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<a&&c.to>s&&c.type instanceof Ka){let h=Math.max(s,c.from)-s,d=Math.min(a,c.to)-s;h<d&&(i||(i=[])).push(c.copy(h,d))}}if(i){let u=new un(i.sort(sl),Lu);return r?new jo([u,r]):u}return r||Yn}eq(e){if(this==e)return!0;if(!(e instanceof un)||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 Ik(this.localsInner(e))}localsInner(e){if(this==Yn)return Lu;if(e.inlineContent||!this.local.some(Ka.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ka||n.push(this.local[r]);return n}forEachSet(e){e(this)}}un.empty=new un([],[]);un.removeOverlap=Ik;const Yn=un.empty;class jo{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,il));return jo.from(r)}forChild(e,n){if(n.isLeaf)return un.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Yn&&(s instanceof jo?r=r.concat(s.members):r.push(s))}return jo.from(r)}eq(e){if(!(e instanceof jo)||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 a=0;a<s.length;a++)n.push(s[a])}}return n?Ik(r?n:n.sort(sl)):Lu}static from(e){switch(e.length){case 0:return Yn;case 1:return e[0];default:return new jo(e.every(n=>n instanceof un)?e:e.reduce((n,r)=>n.concat(r instanceof un?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function bH(t,e,n,r,i,s,a){let u=t.slice();for(let h=0,d=s;h<n.maps.length;h++){let g=0;n.maps[h].forEach((y,x,k,w)=>{let N=w-k-(x-y);for(let T=0;T<u.length;T+=3){let V=u[T+1];if(V<0||y>V+d-g)continue;let F=u[T]+d-g;x>=F?u[T+1]=y<=F?-2:-1:y>=d&&N&&(u[T]+=N,u[T+1]+=N)}g+=N}),d=n.maps[h].map(d,-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 d=n.map(t[h]+s),g=d-i;if(g<0||g>=r.content.size){c=!0;continue}let y=n.map(t[h+1]+s,-1),x=y-i,{index:k,offset:w}=r.content.findIndex(g),N=r.maybeChild(k);if(N&&w==g&&w+N.nodeSize==x){let T=u[h+2].mapInner(n,N,d+1,t[h]+s+1,a);T!=Yn?(u[h]=g,u[h+1]=x,u[h+2]=T):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=SH(u,t,e,n,i,s,a),d=yg(h,r,0,a);e=d.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<d.children.length;g+=3){let x=d.children[g];for(;y<u.length&&u[y]<x;)y+=3;u.splice(y,0,d.children[g],d.children[g+1],d.children[g+2])}}return new un(e.sort(sl),u)}function e_(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 qi(i.from+e,i.to+e,i.type))}return n}function SH(t,e,n,r,i,s,a){function u(c,h){for(let d=0;d<c.local.length;d++){let g=c.local[d].map(r,i,h);g?n.push(g):a.onRemove&&a.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)u(c.children[d+2],c.children[d]+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 t_(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,a;s<t.length;s++)(a=t[s])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),t[s]=null);return i}function n_(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function yg(t,e,n,r){let i=[],s=!1;e.forEach((u,c)=>{let h=t_(t,u,c+n);if(h){s=!0;let d=yg(h,u,n+c+1,r);d!=Yn&&i.push(c,c+u.nodeSize,d)}});let a=e_(s?n_(t):t,-n).sort(sl);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||(r.onRemove&&r.onRemove(a[u].spec),a.splice(u--,1));return a.length||i.length?new un(a,i):Yn}function sl(t,e){return t.from-e.from||t.to-e.to}function Ik(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),wT(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),wT(e,i,r.copy(s.from,r.to)));break}}}return e}function wT(t,e,n){for(;e<t.length&&sl(n,t[e])>0;)e++;t.splice(e,0,n)}var xg=typeof navigator<"u"?navigator:null,_k=xg&&xg.userAgent||"",vH=/Edge\/(\d+)/.exec(_k),kH=/MSIE \d/.exec(_k),CH=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(_k),wH=!!(kH||CH||vH),EH=!wH&&!!xg&&/Apple Computer/.test(xg.vendor),r_=new Ln("safari-ime-span"),OS=!1,AH={key:r_,props:{decorations:NH,handleDOMEvents:{compositionstart:()=>{OS=!0},compositionend:()=>{OS=!1}}}};function NH(t){const{$from:e,$to:n,to:r}=t.selection;if(OS&&e.sameParent(n)){const i=qi.widget(r,TH,{ignoreSelection:!0,key:"safari-ime-span"});return un.create(t.doc,[i])}}function TH(t){const e=t.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var MH=new ur(EH?AH:{key:r_});function bg(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 OH(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function RH(t,e,n){const i=qg((n||{}).ignore||[]),s=DH(e);let a=-1;for(;++a<s.length;)ec(t,"text",u);function u(h,d){let g=-1,y;for(;++g<d.length;){const x=d[g],k=y?y.children:void 0;if(i(x,k?k.indexOf(x):void 0,y))return;y=x}if(y)return c(h,d)}function c(h,d){const g=d[d.length-1],y=s[a][0],x=s[a][1];let k=0;const N=g.children.indexOf(h);let T=!1,V=[];y.lastIndex=0;let F=y.exec(h.value);for(;F;){const K=F.index,L={index:F.index,input:F.input,stack:[...d,h]};let C=x(...F,L);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?y.lastIndex=K+1:(k!==K&&V.push({type:"text",value:h.value.slice(k,K)}),Array.isArray(C)?V.push(...C):C&&V.push(C),k=K+F[0].length,T=!0),!y.global)break;F=y.exec(h.value)}return T?(k<h.value.length&&V.push({type:"text",value:h.value.slice(k)}),g.children.splice(N,1,...V)):V=[h],N+V.length}}function DH(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([IH(i[0]),_H(i[1])])}return e}function IH(t){return typeof t=="string"?new RegExp(OH(t),"g"):t}function _H(t){return typeof t=="function"?t:function(){return t}}const M1="phrasing",O1=["autolink","link","image","label"];function zH(){return{transforms:[$H],enter:{literalAutolink:BH,literalAutolinkEmail:R1,literalAutolinkHttp:R1,literalAutolinkWww:R1},exit:{literalAutolink:jH,literalAutolinkEmail:PH,literalAutolinkHttp:FH,literalAutolinkWww:VH}}}function LH(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:M1,notInConstruct:O1},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:M1,notInConstruct:O1},{character:":",before:"[ps]",after:"\\/",inConstruct:M1,notInConstruct:O1}]}}function BH(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function R1(t){this.config.enter.autolinkProtocol.call(this,t)}function FH(t){this.config.exit.autolinkProtocol.call(this,t)}function VH(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 PH(t){this.config.exit.autolinkEmail.call(this,t)}function jH(t){this.exit(t)}function $H(t){RH(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,JH],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),UH]],{ignore:["link","linkReference"]})}function JH(t,e,n,r,i){let s="";if(!i_(i)||(/^w/i.test(e)&&(n=e+n,e="",s="http://"),!HH(n)))return!1;const a=qH(n+r);if(!a[0])return!1;const u={type:"link",title:null,url:s+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[u,{type:"text",value:a[1]}]:u}function UH(t,e,n,r){return!i_(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function HH(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 qH(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=bg(t,"(");let s=bg(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 i_(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Wn(n)||Ug(n))&&(!e||n!==47)}s_.peek=tq;function KH(){this.buffer()}function GH(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function YH(){this.buffer()}function WH(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function XH(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ii(this.sliceSerialize(t)).toLowerCase(),n.label=e}function QH(t){this.exit(t)}function ZH(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ii(this.sliceSerialize(t)).toLowerCase(),n.label=e}function eq(t){this.exit(t)}function tq(){return"["}function s_(t,e,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),u=n.enter("reference");return s+=i.move(n.safe(n.associationId(t),{after:"]",before:s})),u(),a(),s+=i.move("]"),s}function nq(){return{enter:{gfmFootnoteCallString:KH,gfmFootnoteCall:GH,gfmFootnoteDefinitionLabelString:YH,gfmFootnoteDefinition:WH},exit:{gfmFootnoteCallString:XH,gfmFootnoteCall:QH,gfmFootnoteDefinitionLabelString:ZH,gfmFootnoteDefinition:eq}}}function rq(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:s_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const u=s.createTracker(a);let c=u.move("[^");const h=s.enter("footnoteDefinition"),d=s.enter("label");return c+=u.move(s.safe(s.associationId(r),{before:c,after:"]"})),d(),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?a_:iq))),h(),c}}function iq(t,e,n){return e===0?t:a_(t,e,n)}function a_(t,e,n){return(n?"":" ")+t}const sq=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];o_.peek=cq;function aq(){return{canContainEols:["delete"],enter:{strikethrough:lq},exit:{strikethrough:uq}}}function oq(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:sq}],handlers:{delete:o_}}}function lq(t){this.enter({type:"delete",children:[]},t)}function uq(t){this.exit(t)}function o_(t,e,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(t,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),s(),a}function cq(){return"~"}function fq(t){return t.length}function hq(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||fq,s=[],a=[],u=[],c=[];let h=0,d=-1;for(;++d<t.length;){const w=[],N=[];let T=-1;for(t[d].length>h&&(h=t[d].length);++T<t[d].length;){const V=pq(t[d][T]);if(n.alignDelimiters!==!1){const F=i(V);N[T]=F,(c[T]===void 0||F>c[T])&&(c[T]=F)}w.push(V)}a[d]=w,u[d]=N}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<h;)s[g]=ET(r[g]);else{const w=ET(r);for(;++g<h;)s[g]=w}g=-1;const y=[],x=[];for(;++g<h;){const w=s[g];let N="",T="";w===99?(N=":",T=":"):w===108?N=":":w===114&&(T=":");let V=n.alignDelimiters===!1?1:Math.max(1,c[g]-N.length-T.length);const F=N+"-".repeat(V)+T;n.alignDelimiters!==!1&&(V=N.length+V+T.length,V>c[g]&&(c[g]=V),x[g]=V),y[g]=F}a.splice(1,0,y),u.splice(1,0,x),d=-1;const k=[];for(;++d<a.length;){const w=a[d],N=u[d];g=-1;const T=[];for(;++g<h;){const V=w[g]||"";let F="",K="";if(n.alignDelimiters!==!1){const L=c[g]-(N[g]||0),C=s[g];C===114?F=" ".repeat(L):C===99?L%2?(F=" ".repeat(L/2+.5),K=" ".repeat(L/2-.5)):(F=" ".repeat(L/2),K=F):K=" ".repeat(L)}n.delimiterStart!==!1&&!g&&T.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&V==="")&&(n.delimiterStart!==!1||g)&&T.push(" "),n.alignDelimiters!==!1&&T.push(F),T.push(V),n.alignDelimiters!==!1&&T.push(K),n.padding!==!1&&T.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&T.push("|")}k.push(n.delimiterEnd===!1?T.join("").replace(/ +$/,""):T.join(""))}return k.join(`
55
+ `)}function pq(t){return t==null?"":String(t)}function ET(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 dq(){return{enter:{table:mq,tableData:AT,tableHeader:AT,tableRow:yq},exit:{codeText:xq,table:gq,tableData:D1,tableHeader:D1,tableRow:D1}}}function mq(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 gq(t){this.exit(t),this.data.inTable=void 0}function yq(t){this.enter({type:"tableRow",children:[]},t)}function D1(t){this.exit(t)}function AT(t){this.enter({type:"tableCell",children:[]},t)}function xq(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,bq));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function bq(t,e){return e==="|"?e:t}function Sq(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:a,tableCell:c,tableRow:u}};function a(x,k,w,N){return h(d(x,w,N),x.align)}function u(x,k,w,N){const T=g(x,w,N),V=h([T]);return V.slice(0,V.indexOf(`
57
+ `))}function c(x,k,w,N){const T=w.enter("tableCell"),V=w.enter("phrasing"),F=w.containerPhrasing(x,{...N,before:s,after:s});return V(),T(),F}function h(x,k){return hq(x,{align:k,alignDelimiters:r,padding:n,stringLength:i})}function d(x,k,w){const N=x.children;let T=-1;const V=[],F=k.enter("table");for(;++T<N.length;)V[T]=g(N[T],k,w);return F(),V}function g(x,k,w){const N=x.children;let T=-1;const V=[],F=k.enter("tableRow");for(;++T<N.length;)V[T]=c(N[T],x,k,w);return F(),V}function y(x,k,w){let N=YS.inlineCode(x,k,w);return w.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function vq(){return{exit:{taskListCheckValueChecked:NT,taskListCheckValueUnchecked:NT,paragraph:Cq}}}function kq(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:wq}}}function NT(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function Cq(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,a;for(;++s<i.length;){const u=i[s];if(u.type==="paragraph"){a=u;break}}a===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 wq(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);s&&u.move(a);let c=YS.listItem(t,e,n,{...r,...u.current()});return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),c;function h(d){return d+a}}function Eq(){return[zH(),nq(),aq(),dq(),vq()]}function Aq(t){return{extensions:[LH(),rq(t),oq(),Sq(t),kq()]}}const Nq={tokenize:Iq,partial:!0},l_={tokenize:_q,partial:!0},u_={tokenize:zq,partial:!0},c_={tokenize:Lq,partial:!0},Tq={tokenize:Bq,partial:!0},f_={name:"wwwAutolink",tokenize:Rq,previous:p_},h_={name:"protocolAutolink",tokenize:Dq,previous:d_},Ws={name:"emailAutolink",tokenize:Oq,previous:m_},is={};function Mq(){return{text:is}}let Ro=48;for(;Ro<123;)is[Ro]=Ws,Ro++,Ro===58?Ro=65:Ro===91&&(Ro=97);is[43]=Ws;is[45]=Ws;is[46]=Ws;is[95]=Ws;is[72]=[Ws,h_];is[104]=[Ws,h_];is[87]=[Ws,f_];is[119]=[Ws,f_];function Oq(t,e,n){const r=this;let i,s;return a;function a(g){return!RS(g)||!m_.call(r,r.previous)||zk(r.events)?n(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(g))}function u(g){return RS(g)?(t.consume(g),u):g===64?(t.consume(g),c):n(g)}function c(g){return g===46?t.check(Tq,d,h)(g):g===45||g===95||Dn(g)?(s=!0,t.consume(g),c):d(g)}function h(g){return t.consume(g),i=!0,c}function d(g){return s&&i&&cn(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(g)):n(g)}}function Rq(t,e,n){const r=this;return i;function i(a){return a!==87&&a!==119||!p_.call(r,r.previous)||zk(r.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Nq,t.attempt(l_,t.attempt(u_,s),n),n)(a))}function s(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function Dq(t,e,n){const r=this;let i="",s=!1;return a;function a(g){return(g===72||g===104)&&d_.call(r,r.previous)&&!zk(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(g),t.consume(g),u):n(g)}function u(g){if(cn(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||Hm(g)||tt(g)||Wn(g)||Ug(g)?n(g):t.attempt(l_,t.attempt(u_,d),n)(g)}function d(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(g)}}function Iq(t,e,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,t.consume(a),i):a===46&&r===3?(t.consume(a),s):n(a)}function s(a){return a===null?n(a):e(a)}}function _q(t,e,n){let r,i,s;return a;function a(h){return h===46||h===95?t.check(c_,c,u)(h):h===null||tt(h)||Wn(h)||h!==45&&Ug(h)?c(h):(s=!0,t.consume(h),a)}function u(h){return h===95?r=!0:(i=r,r=void 0),t.consume(h),a}function c(h){return i||r||!s?n(h):e(h)}}function zq(t,e){let n=0,r=0;return i;function i(a){return a===40?(n++,t.consume(a),i):a===41&&r<n?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(c_,e,s)(a):a===null||tt(a)||Wn(a)?e(a):(t.consume(a),i)}function s(a){return a===41&&r++,t.consume(a),i}}function Lq(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||tt(u)||Wn(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||tt(u)||Wn(u)?e(u):r(u)}function s(u){return cn(u)?a(u):n(u)}function a(u){return u===59?(t.consume(u),r):cn(u)?(t.consume(u),a):n(u)}}function Bq(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return Dn(s)?n(s):e(s)}}function p_(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||tt(t)}function d_(t){return!cn(t)}function m_(t){return!(t===47||RS(t))}function RS(t){return t===43||t===45||t===46||t===95||Dn(t)}function zk(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 Fq={tokenize:qq,partial:!0};function Vq(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Jq,continuation:{tokenize:Uq},exit:Hq}},text:{91:{name:"gfmFootnoteCall",tokenize:$q},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Pq,resolveTo:jq}}}}function Pq(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){a=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(!a||!a._balanced)return n(c);const h=Ii(r.sliceSerialize({start:a.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 jq(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)},a={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",a,e],["exit",a,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 $q(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;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&&!a||g===null||g===91||tt(g))return n(g);if(g===93){t.exit("chunkString");const y=t.exit("gfmFootnoteCallString");return i.includes(Ii(r.sliceSerialize(y)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(g)}return tt(g)||(a=!0),s++,t.consume(g),g===92?d:h}function d(g){return g===91||g===92||g===93?(t.consume(g),s++,h):h(g)}}function Jq(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,u;return c;function c(k){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",d):n(k)}function d(k){if(a>999||k===93&&!u||k===null||k===91||tt(k))return n(k);if(k===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return s=Ii(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),y}return tt(k)||(u=!0),a++,t.consume(k),k===92?g:d}function g(k){return k===91||k===92||k===93?(t.consume(k),a++,d):d(k)}function y(k){return k===58?(t.enter("definitionMarker"),t.consume(k),t.exit("definitionMarker"),i.includes(s)||i.push(s),We(t,x,"gfmFootnoteDefinitionWhitespace")):n(k)}function x(k){return e(k)}}function Uq(t,e,n){return t.check(Zu,e,t.attempt(Fq,e,n))}function Hq(t){t.exit("gfmFootnoteDefinition")}function qq(t,e,n){const r=this;return We(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(s):n(s)}}function Kq(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(a,u){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let h=c;for(;h--;)if(a[h][0]==="exit"&&a[h][1].type==="strikethroughSequenceTemporary"&&a[h][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[h][1].end.offset-a[h][1].start.offset){a[c][1].type="strikethroughSequence",a[h][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},a[h][1].start),end:Object.assign({},a[c][1].end)},g={type:"strikethroughText",start:Object.assign({},a[h][1].end),end:Object.assign({},a[c][1].start)},y=[["enter",d,u],["enter",a[h][1],u],["exit",a[h][1],u],["enter",g,u]],x=u.parser.constructs.insideSpan.null;x&&Lr(y,y.length,0,Hg(x,a.slice(h+1,c),u)),Lr(y,y.length,0,[["exit",g,u],["enter",a[c][1],u],["exit",a[c][1],u],["exit",d,u]]),Lr(a,h-1,c-h+3,y),c=h+y.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function s(a,u,c){const h=this.previous,d=this.events;let g=0;return y;function y(k){return h===126&&d[d.length-1][1].type!=="characterEscape"?c(k):(a.enter("strikethroughSequenceTemporary"),x(k))}function x(k){const w=Hu(h);if(k===126)return g>1?c(k):(a.consume(k),g++,x);if(g<2&&!n)return c(k);const N=a.exit("strikethroughSequenceTemporary"),T=Hu(k);return N._open=!T||T===2&&!!w,N._close=!w||w===2&&!!T,u(k)}}}class Gq{constructor(){this.map=[]}add(e,n,r){Yq(this,e,n,r)}consume(e){if(this.map.sort(function(s,a){return s[0]-a[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 Yq(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 Wq(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 Xq(){return{flow:{null:{name:"table",tokenize:Qq,resolveAll:Zq}}}}function Qq(t,e,n){const r=this;let i=0,s=0,a;return u;function u(H){let ue=r.events.length-1;for(;ue>-1;){const Ee=r.events[ue][1].type;if(Ee==="lineEnding"||Ee==="linePrefix")ue--;else break}const ae=ue>-1?r.events[ue][1].type:null,Se=ae==="tableHead"||ae==="tableRow"?C:c;return Se===C&&r.parser.lazy[r.now().line]?n(H):Se(H)}function c(H){return t.enter("tableHead"),t.enter("tableRow"),h(H)}function h(H){return H===124||(a=!0,s+=1),d(H)}function d(H){return H===null?n(H):we(H)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),x):n(H):Ye(H)?We(t,d,"whitespace")(H):(s+=1,a&&(a=!1,i+=1),H===124?(t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),a=!0,d):(t.enter("data"),g(H)))}function g(H){return H===null||H===124||tt(H)?(t.exit("data"),d(H)):(t.consume(H),H===92?y:g)}function y(H){return H===92||H===124?(t.consume(H),g):g(H)}function x(H){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(H):(t.enter("tableDelimiterRow"),a=!1,Ye(H)?We(t,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):k(H))}function k(H){return H===45||H===58?N(H):H===124?(a=!0,t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),w):L(H)}function w(H){return Ye(H)?We(t,N,"whitespace")(H):N(H)}function N(H){return H===58?(s+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(H),t.exit("tableDelimiterMarker"),T):H===45?(s+=1,T(H)):H===null||we(H)?K(H):L(H)}function T(H){return H===45?(t.enter("tableDelimiterFiller"),V(H)):L(H)}function V(H){return H===45?(t.consume(H),V):H===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(H),t.exit("tableDelimiterMarker"),F):(t.exit("tableDelimiterFiller"),F(H))}function F(H){return Ye(H)?We(t,K,"whitespace")(H):K(H)}function K(H){return H===124?k(H):H===null||we(H)?!a||i!==s?L(H):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(H)):L(H)}function L(H){return n(H)}function C(H){return t.enter("tableRow"),_(H)}function _(H){return H===124?(t.enter("tableCellDivider"),t.consume(H),t.exit("tableCellDivider"),_):H===null||we(H)?(t.exit("tableRow"),e(H)):Ye(H)?We(t,_,"whitespace")(H):(t.enter("data"),J(H))}function J(H){return H===null||H===124||tt(H)?(t.exit("data"),_(H)):(t.consume(H),H===92?$:J)}function $(H){return H===92||H===124?(t.consume(H),J):J(H)}}function Zq(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],u=!1,c=0,h,d,g;const y=new Gq;for(;++n<t.length;){const x=t[n],k=x[1];x[0]==="enter"?k.type==="tableHead"?(u=!1,c!==0&&(TT(y,e,c,h,d),d=void 0,c=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",h,e]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(r=!0,g=void 0,s=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,d={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",d,e]])),i=k.type==="tableDelimiterRow"?2:d?3:1):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],g=tm(y,e,s,i,void 0,g),s=[0,0,0,0]),a[2]=n)):k.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],g=tm(y,e,s,i,void 0,g)),s=a,a=[s[1],n,0,0])):k.type==="tableHead"?(u=!0,c=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(c=n,s[1]!==0?(a[0]=a[1],g=tm(y,e,s,i,n,g)):a[1]!==0&&(g=tm(y,e,a,i,n,g)),i=0):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&TT(y,e,c,h,d),y.consume(e.events),n=-1;++n<e.events.length;){const x=e.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=Wq(e.events,n))}return t}function tm(t,e,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},Bu(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const c=Bu(e.events,n[1]);if(s={type:a,start:Object.assign({},c),end:Object.assign({},c)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const h=Bu(e.events,n[2]),d=Bu(e.events,n[3]),g={type:u,start:Object.assign({},h),end:Object.assign({},d)};if(t.add(n[2],0,[["enter",g,e]]),r!==2){const y=e.events[n[2]],x=e.events[n[3]];if(y[1].end=Object.assign({},x[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,w=n[3]-n[2]-1;t.add(k,w,[])}}t.add(n[3]+1,0,[["exit",g,e]])}return i!==void 0&&(s.end=Object.assign({},Bu(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function TT(t,e,n,r,i){const s=[],a=Bu(e.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,e])),r.end=Object.assign({},a),s.push(["exit",r,e]),t.add(n+1,0,s)}function Bu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const eK={name:"tasklistCheck",tokenize:nK};function tK(){return{text:{91:eK}}}function nK(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 tt(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(c)}function u(c){return we(c)?e(c):Ye(c)?t.check({tokenize:rK},e,n)(c):n(c)}}function rK(t,e,n){return We(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function iK(t){return HS([Mq(),Vq(),Kq(t),Xq(),tK()])}const sK={};function aK(t){const e=this,n=t||sK,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(iK(n)),s.push(Eq()),a.push(Aq(n))}function $e(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-gfm",...e}}),t}var Lk=mp("strike_through");$e(Lk,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var Ap=rc("strike_through",t=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",t.get(Lk.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")}}}));$e(Ap.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});$e(Ap.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var g0=He("ToggleStrikeThrough",t=>()=>Wg(Ap.type(t)));$e(g0,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var g_=Ar(t=>fp(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),Ap.type(t)));$e(g_,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var Bk=Pr("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:t=>{const e=t.get(kt);return()=>e.call(g0.key)}}});$e(Bk.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});$e(Bk.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var Np=RJ({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:t=>t.style.textAlign||"left",setDOMAttr:(t,e)=>{e.style=`text-align: ${t||"left"}`}}}}),Ps=an("table",()=>({...Np.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,a)=>({...s,align:r,isHeader:a===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()}}}));$e(Ps.node,{displayName:"NodeSchema<table>",group:"Table"});$e(Ps.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var Tp=an("table_header_row",()=>({...Np.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,a)=>({...s,align:r[a],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())}}}));$e(Tp.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});$e(Tp.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var oc=an("table_row",()=>({...Np.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,a)=>({...s,align:r[a]}));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())}}}));$e(oc.node,{displayName:"NodeSchema<tableRow>",group:"Table"});$e(oc.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var Mp=an("table_cell",()=>({...Np.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()}}}));$e(Mp.node,{displayName:"NodeSchema<tableCell>",group:"Table"});$e(Mp.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Qu=an("table_header",()=>({...Np.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()}}}));$e(Qu.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});$e(Qu.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function y_(t,e=3,n=3){const r=Array(n).fill(0).map(()=>Mp.type(t).createAndFill()),i=Array(n).fill(0).map(()=>Qu.type(t).createAndFill()),s=Array(e).fill(0).map((a,u)=>u===0?Tp.type(t).create(null,i):oc.type(t).create(null,r));return Ps.type(t).create(null,s)}function x_(t){return(e,n)=>r=>{n=n??r.selection.from;const i=r.doc.resolve(n),s=X7(c=>c.type.name==="table")(i),a=s?{node:s.node,from:s.start}:void 0,u=t==="row";if(a){const c=Ct.get(a.node);if(e>=0&&e<(u?c.height:c.width)){const h=c.positionAt(u?e:c.height-1,u?c.width-1:e,a.node),d=r.doc.resolve(a.from+h),g=u?Lt.rowSelection:Lt.colSelection,y=c.positionAt(u?e:0,u?0:e,a.node),x=r.doc.resolve(a.from+y);return N3(r.setSelection(g(d,x)))}}return r}}var oK=x_("row"),lK=x_("col");function b_(t,e,{map:n,tableStart:r,table:i},s){const a=Array(s).fill(0).reduce((c,h,d)=>c+i.child(d).nodeSize,r),u=Array(n.width).fill(0).map((c,h)=>{const d=i.nodeAt(n.map[h]);return Mp.type(t).createAndFill({alignment:d?.attrs.alignment})});return e.insert(a,oc.type(t).create(null,u)),e}function uK(t){const e=Cp(t.$from);if(!e)return;const n=Ct.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 cK(t){const e=uK(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 N3(t.setSelection(new Lt(i,n)))}}return t}var Fk=He("GoToPrevTableCell",()=>()=>SI(-1));$e(Fk,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var Vk=He("GoToNextTableCell",()=>()=>SI(1));$e(Vk,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var Pk=He("ExitTable",t=>()=>(e,n)=>{if(!yi(e))return!1;const{$head:r}=e.selection,i=W7(r,Ps.type(t));if(!i)return!1;const{to:s}=i,a=e.tr.replaceWith(s,s,Xi.type(t).createAndFill());return a.setSelection(Pe.near(a.doc.resolve(s),1)).scrollIntoView(),n?.(a),!0});$e(Pk,{displayName:"Command<breakTableCommand>",group:"Table"});var jk=He("InsertTable",t=>({row:e,col:n}={})=>(r,i)=>{const{selection:s,tr:a}=r,{from:u}=s,c=y_(t,e,n),h=a.replaceSelectionWith(c),d=Pe.findFrom(h.doc.resolve(u),1,!0);return d&&h.setSelection(d),i?.(h),!0});$e(jk,{displayName:"Command<insertTableCommand>",group:"Table"});var S_=He("MoveRow",()=>({from:t,to:e,pos:n}={})=>sU({from:t??0,to:e??0,pos:n}));$e(S_,{displayName:"Command<moveRowCommand>",group:"Table"});var v_=He("MoveCol",()=>({from:t,to:e,pos:n}={})=>aU({from:t??0,to:e??0,pos:n}));$e(v_,{displayName:"Command<moveColCommand>",group:"Table"});var k_=He("SelectRow",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(oK(t.index,t.pos)(r))});$e(k_,{displayName:"Command<selectRowCommand>",group:"Table"});var C_=He("SelectCol",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!n?.(lK(t.index,t.pos)(r))});$e(C_,{displayName:"Command<selectColCommand>",group:"Table"});var w_=He("SelectTable",()=>()=>(t,e)=>{const{tr:n}=t;return!!e?.(cK(n))});$e(w_,{displayName:"Command<selectTableCommand>",group:"Table"});var E_=He("DeleteSelectedCells",()=>()=>(t,e)=>{const{selection:n}=t;if(!(n instanceof Lt))return!1;const r=n.isRowSelection(),i=n.isColSelection();return r&&i?iU(t,e):i?QJ(t,e):eU(t,e)});$e(E_,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var A_=He("AddColBefore",()=>()=>YJ);$e(A_,{displayName:"Command<addColBeforeCommand>",group:"Table"});var N_=He("AddColAfter",()=>()=>WJ);$e(N_,{displayName:"Command<addColAfterCommand>",group:"Table"});var T_=He("AddRowBefore",t=>()=>(e,n)=>{if(!yi(e))return!1;if(n){const r=oo(e);n(b_(t,e.tr,r,r.top))}return!0});$e(T_,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var M_=He("AddRowAfter",t=>()=>(e,n)=>{if(!yi(e))return!1;if(n){const r=oo(e);n(b_(t,e.tr,r,r.bottom))}return!0});$e(M_,{displayName:"Command<addRowAfterCommand>",group:"Table"});var O_=He("SetAlign",()=>(t="left")=>tU("alignment",t));$e(O_,{displayName:"Command<setAlignCommand>",group:"Table"});var R_=Ar(t=>new Vr(/^\|(?<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),Ps.type(t)))return null;const a=y_(t,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),u=e.tr.replaceRangeWith(r,i,a);return u.setSelection(Oe.create(u.doc,r+3)).scrollIntoView()}));$e(R_,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var D_=fj(t=>({run:(e,n,r)=>{if(r)return e;function i(h){const d=h.childCount,g=h.lastChild?.childCount??0;if(d===0||g===0)return Xi.type(t).create();const y=h.firstChild;if(!(g>0&&y&&y.childCount===0))return h;if(d>=3){const N=h.child(1),T=[];for(let K=0;K<N.childCount;K++){const L=N.child(K);T.push(Qu.type(t).create(L.attrs,L.content,L.marks))}const V=y.type.create(y.attrs,T),F=[];for(let K=2;K<d;K++)F.push(h.child(K));return h.type.create(h.attrs,[V,...F])}const x=Array(g).fill(0).map(()=>Qu.type(t).createAndFill()),k=new q(W.from(x),0,0),w=y.replace(0,0,k);return h.replace(0,y.nodeSize,new q(W.from(w),0,0))}function s(h){const d=oc.type(t),g=[];let y=[],x=!1;function k(){if(y.length===0)return;const w=Tp.type(t).createAndFill(),N=Ps.type(t).create(null,[w,...y]);g.push(i(N)),y=[]}return h.forEach(w=>{w.type===d?(x=!0,y.push(w)):(k(),g.push(w))}),k(),x?W.from(g):h}function a(h){let d=s(h),g=d!==h;const y=[];return d.forEach(x=>{if(x.type===Ps.type(t)){const k=i(x);k!==x&&(g=!0),y.push(k)}else if(x.childCount>0){const k=a(x.content);k!==x.content?(g=!0,y.push(x.copy(k))):y.push(x)}else y.push(x)}),g?W.from(y):h}function u(h){const d=[],g=[];h.forEach(y=>g.push(y));for(let y=0;y<g.length;y++){const x=g[y],k=g[y+1];x.type===Xi.type(t)&&x.content.size===0&&k&&k.type===Ps.type(t)||d.push(x)}return d.length<g.length?W.from(d):h}let c=a(e.content);return c=u(c),new q(W.from(c),e.openStart,e.openEnd)}}));$e(D_,{displayName:"PasteRule<table>",group:"Table"});var $k=Pr("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:t=>{const e=t.get(kt);return()=>e.call(Vk.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:t=>{const e=t.get(kt);return()=>e.call(Fk.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:t=>{const e=t.get(kt);return()=>e.call(Pk.key)}}});$e($k.ctx,{displayName:"KeymapCtx<table>",group:"Table"});$e($k.shortcuts,{displayName:"Keymap<table>",group:"Table"});var I1="footnote_definition",MT="footnoteDefinition",Jk=an("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${I1}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw ts(t);return{label:t.dataset.label}},contentElement:"dd"}],toDOM:t=>{const e=t.attrs.label;return["dl",{"data-label":e,"data-type":I1},["dt",e],["dd",0]]},parseMarkdown:{match:({type:t})=>t===MT,runner:(t,e,n)=>{t.openNode(n,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:t=>t.type.name===I1,runner:(t,e)=>{t.openNode(MT,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));$e(Jk.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});$e(Jk.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var _1="footnote_reference",Uk=an("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${_1}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw ts(t);return{label:t.dataset.label}}}],toDOM:t=>{const e=t.attrs.label;return["sup",{"data-label":e,"data-type":_1},e]},parseMarkdown:{match:({type:t})=>t==="footnoteReference",runner:(t,e,n)=>{t.addNode(n,{label:e.label})}},toMarkdown:{match:t=>t.type.name===_1,runner:(t,e)=>{t.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));$e(Uk.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});$e(Uk.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var Hk=Ks.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 ts(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 a=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:a,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,a=i.attrs.listType,u=i.attrs.spread==="true",c=i.attrs.checked;r.openNode("listItem",void 0,{label:s,listType:a,spread:u,checked:c}),r.next(i.content),r.closeNode()}}}});$e(Hk.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});$e(Hk.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var I_=Ar(()=>new Vr(/^\[(?<checked>\s|x)\]\s$/,(t,e,n,r)=>{const i=t.doc.resolve(n);let s=0,a=i.node(s);for(;a&&a.type.name!=="list_item";)s--,a=i.node(s);if(!a||a.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,{...a.attrs,checked:u}),h}));$e(I_,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var fK=[Bk,$k].flat(),hK=[R_,I_],pK=[g_],dK=[D_],__=_i(()=>MH);$e(__,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var mK=_i(()=>gU({}));$e(mK,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var z_=_i(()=>AU({allowTableNodeSelection:!0}));$e(z_,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var qk=gi("remarkGFM",()=>aK);$e(qk.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});$e(qk.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var gK=new Ln("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function yK(t,e){let n=0;return e.forEach((r,i,s)=>{r===t&&(n=s)}),n}var L_=_i(()=>new ur({key:gK,appendTransaction:(t,e,n)=>{let r;const i=(s,a)=>{if(r||(r=n.tr),s.type.name!=="table_cell")return;const u=n.doc.resolve(a),c=u.node(u.depth),h=u.node(u.depth-1).firstChild;if(!h)return;const d=yK(s,c),g=h.maybeChild(d);if(!g)return;const y=g.attrs.alignment;y!==s.attrs.alignment&&r.setNodeMarkup(a,void 0,{...s.attrs,alignment:y})};return e.doc!==n.doc&&n.doc.descendants(i),r}}));$e(L_,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var xK=[L_,__,qk,z_].flat(),bK=[Hk,Ps,Tp,oc,Qu,Mp,Jk,Uk,Lk,Ap].flat(),SK=[Vk,Fk,Pk,jk,S_,v_,k_,C_,w_,E_,T_,M_,A_,N_,O_,g0],B_=[bK,hK,dK,pK,fK,SK,xK].flat(),Sg=200,fn=function(){};fn.prototype.append=function(e){return e.length?(e=fn.from(e),!this.length&&e||e.length<Sg&&this.leafAppend(e)||this.length<Sg&&e.leafPrepend(this)||this.appendInner(e)):this};fn.prototype.prepend=function(e){return e.length?fn.from(e).append(this):this};fn.prototype.appendInner=function(e){return new vK(this,e)};fn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?fn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};fn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};fn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};fn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,a){return i.push(e(s,a))},n,r),i};fn.from=function(e){return e instanceof fn?e:e&&e.length?new F_(e):fn.empty};var F_=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,a,u){for(var c=s;c<a;c++)if(i(this.values[c],u+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,a,u){for(var c=s-1;c>=a;c--)if(i(this.values[c],u+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Sg)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Sg)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(fn);fn.empty=new F_([]);var vK=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,a){var u=this.left.length;if(i<u&&this.left.forEachInner(r,i,Math.min(s,u),a)===!1||s>u&&this.right.forEachInner(r,Math.max(i-u,0),Math.min(this.length,s)-u,a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,a){var u=this.left.length;if(i>u&&this.right.forEachInvertedInner(r,i-u,Math.max(s,u)-u,a+u)===!1||s<u&&this.left.forEachInvertedInner(r,Math.min(i,u),s,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(fn);const V_=65535,P_=Math.pow(2,16);function kK(t,e){return t+e*P_}function OT(t){return t&V_}function CK(t){return(t-(t&V_))/P_}const j_=1,$_=2,Vm=4,J_=8;class DS{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&J_)>0}get deletedBefore(){return(this.delInfo&(j_|Vm))>0}get deletedAfter(){return(this.delInfo&($_|Vm))>0}get deletedAcross(){return(this.delInfo&Vm)>0}}class zr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&zr.empty)return zr.empty}recover(e){let n=0,r=OT(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+CK(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,a=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],d=this.ranges[u+a],g=c+h;if(e<=g){let y=h?e==c?-1:e==g?1:n:n,x=c+i+(y<0?0:d);if(r)return x;let k=e==(n<0?c:g)?null:kK(u/3,e-c),w=e==c?$_:e==g?j_:Vm;return(n<0?e!=c:e!=g)&&(w|=J_),new DS(x,w,k)}i+=d-h}return r?e+i:new DS(e+i,0,null)}touches(e,n){let r=0,i=OT(n),s=this.inverted?2:1,a=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],d=c+h;if(e<=d&&u==i*3)return!0;r+=this.ranges[u+a]-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 a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+n],d=this.ranges[i+r];e(u,u+h,c,c+d),s+=d-h}}invert(){return new zr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?zr.empty:new zr(e<0?[0,-e,0]:[0,0,e])}}zr.empty=new zr([]);class vg{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 vg(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 vg;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 a=this._maps[s],u=a.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 DS(e,i,null)}}const z1=Object.create(null);class Jn{getMap(){return zr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=z1[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 z1)throw new RangeError("Duplicate use of step JSON ID "+e);return z1[e]=n,n.prototype.jsonID=e,n}}class nn{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new nn(e,null)}static fail(e){return new nn(null,e)}static fromReplace(e,n,r,i){try{return nn.ok(e.replace(n,r,i))}catch(s){if(s instanceof hi)return nn.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 W.fromArray(r)}class Ho extends Jn{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 q(Kk(n.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return nn.fromReplace(e,this.from,this.to,s)}invert(){return new qo(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 Ho(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ho&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ho(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 Ho(n.from,n.to,e.markFromJSON(n.mark))}}Jn.jsonID("addMark",Ho);class qo extends Jn{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 q(Kk(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return nn.fromReplace(e,this.from,this.to,r)}invert(){return new Ho(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 qo(n.pos,r.pos,this.mark)}merge(e){return e instanceof qo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qo(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 qo(n.from,n.to,e.markFromJSON(n.mark))}}Jn.jsonID("removeMark",qo);class Ko extends Jn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return nn.fromReplace(e,this.pos,this.pos+1,new q(W.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 Ko(this.pos,n.marks[i]);return new Ko(this.pos,this.mark)}}return new Wh(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ko(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 Ko(n.pos,e.markFromJSON(n.mark))}}Jn.jsonID("addNodeMark",Ko);class Wh extends Jn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return nn.fromReplace(e,this.pos,this.pos+1,new q(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ko(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Wh(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 Wh(n.pos,e.markFromJSON(n.mark))}}Jn.jsonID("removeNodeMark",Wh);class Ba extends Jn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&IS(e,this.from,this.to)?nn.fail("Structure replace would overwrite content"):nn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new zr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ba(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 Ba(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ba)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ba(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ba(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 Ba(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}}Jn.jsonID("replace",Ba);class kh extends Jn{constructor(e,n,r,i,s,a,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(IS(e,this.from,this.gapFrom)||IS(e,this.gapTo,this.to)))return nn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return nn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?nn.fromReplace(e,this.from,this.to,r):nn.fail("Content does not fit in gap")}getMap(){return new zr([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 kh(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 kh(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 kh(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}}Jn.jsonID("replaceAround",kh);function IS(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 a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}class Ch extends Jn{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 nn.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 nn.fromReplace(e,this.pos,this.pos+1,new q(W.from(i),0,n.isLeaf?0:1))}getMap(){return zr.empty}invert(e){return new Ch(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 Ch(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 Ch(n.pos,n.attr,n.value)}}Jn.jsonID("attr",Ch);class kg extends Jn{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 nn.ok(r)}getMap(){return zr.empty}invert(e){return new kg(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 kg(n.attr,n.value)}}Jn.jsonID("docAttr",kg);let Xh=class extends Error{};Xh=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Xh.prototype=Object.create(Error.prototype);Xh.prototype.constructor=Xh;Xh.prototype.name="TransformError";const wK=500;class Ri{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let a=e.tr,u,c,h=[],d=[];return this.items.forEach((g,y)=>{if(!g.step){i||(i=this.remapping(r,y+1),s=i.maps.length),s--,d.push(g);return}if(i){d.push(new Ui(g.map));let x=g.step.map(i.slice(s)),k;x&&a.maybeStep(x).doc&&(k=a.mapping.maps[a.mapping.maps.length-1],h.push(new Ui(k,void 0,void 0,h.length+d.length))),s--,k&&i.appendMap(k,s)}else a.maybeStep(g.step);if(g.selection)return u=i?g.selection.map(i.slice(s)):g.selection,c=new Ri(this.items.slice(0,r).append(d.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:a,selection:u}}addTransform(e,n,r,i){let s=[],a=this.eventCount,u=this.items,c=!i&&u.length?u.get(u.length-1):null;for(let d=0;d<e.steps.length;d++){let g=e.steps[d].invert(e.docs[d]),y=new Ui(e.mapping.maps[d],g,n),x;(x=c&&c.merge(y))&&(y=x,d?s.pop():u=u.slice(0,u.length-1)),s.push(y),n&&(a++,n=void 0),i||(c=y)}let h=a-r.depth;return h>AK&&(u=EK(u,h),a-=h),new Ri(u.append(s),a)}remapping(e,n){let r=new vg;return this.items.forEach((i,s)=>{let a=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},e,n),r}addMaps(e){return this.eventCount==0?this:new Ri(this.items.append(e.map(n=>new Ui(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,a=e.steps.length,u=this.eventCount;this.items.forEach(y=>{y.selection&&u--},i);let c=n;this.items.forEach(y=>{let x=s.getMirror(--c);if(x==null)return;a=Math.min(a,x);let k=s.maps[x];if(y.step){let w=e.steps[x].invert(e.docs[x]),N=y.selection&&y.selection.map(s.slice(c+1,x));N&&u++,r.push(new Ui(k,w,N))}else r.push(new Ui(k))},i);let h=[];for(let y=n;y<a;y++)h.push(new Ui(s.maps[y]));let d=this.items.slice(0,i).append(h).append(r),g=new Ri(d,u);return g.emptyItemCount()>wK&&(g=g.compress(this.items.length-r.length)),g}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((a,u)=>{if(u>=e)i.push(a),a.selection&&s++;else if(a.step){let c=a.step.map(n.slice(r)),h=c&&c.getMap();if(r--,h&&n.appendMap(h,r),c){let d=a.selection&&a.selection.map(n.slice(r));d&&s++;let g=new Ui(h.invert(),c,d),y,x=i.length-1;(y=i.length&&i[x].merge(g))?i[x]=y:i.push(g)}}else a.map&&r--},this.items.length,0),new Ri(fn.from(i.reverse()),s)}}Ri.empty=new Ri(fn.empty,0);function EK(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Ui{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ui(n.getMap().invert(),n,this.selection)}}}class Fa{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const AK=20;function NK(t,e,n,r){let i=n.getMeta(al),s;if(i)return i.historyState;n.getMeta(OK)&&(t=new Fa(t.done,t.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(a&&a.getMeta(al))return a.getMeta(al).redo?new Fa(t.done.addTransform(n,void 0,r,Pm(e)),t.undone,RT(n.mapping.maps),t.prevTime,t.prevComposition):new Fa(t.done,t.undone.addTransform(n,void 0,r,Pm(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let u=n.getMeta("composition"),c=t.prevTime==0||!a&&t.prevComposition!=u&&(t.prevTime<(n.time||0)-r.newGroupDelay||!TK(n,t.prevRanges)),h=a?L1(t.prevRanges,n.mapping):RT(n.mapping.maps);return new Fa(t.done.addTransform(n,c?e.selection.getBookmark():void 0,r,Pm(e)),Ri.empty,h,n.time,u??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Fa(t.done.rebased(n,s),t.undone.rebased(n,s),L1(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Fa(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),L1(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function TK(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function RT(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,a)=>e.push(s,a));return e}function L1(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function MK(t,e,n){let r=Pm(e),i=al.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let a=s.selection.resolve(s.transform.doc),u=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),c=new Fa(n?u:s.remaining,n?s.remaining:u,null,0,-1);return s.transform.setSelection(a).setMeta(al,{redo:n,historyState:c})}let B1=!1,DT=null;function Pm(t){let e=t.plugins;if(DT!=e){B1=!1,DT=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){B1=!0;break}}return B1}const al=new Ln("history"),OK=new Ln("closeHistory");function RK(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ur({key:al,state:{init(){return new Fa(Ri.empty,Ri.empty,null,0,-1)},apply(e,n,r){return NK(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Gk:r=="historyRedo"?Cg:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function U_(t,e){return(n,r)=>{let i=al.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=MK(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Gk=U_(!1,!0),Cg=U_(!0,!0),Yk=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),H_=new WeakSet,q_=_i(()=>{const t=RK();return H_.add(t),t}),K_=_i(()=>T3({"Mod-z":Gk,"Mod-Shift-z":Cg,...Yk?{}:{"Mod-y":Cg}}));function G_(t){const{plugins:e}=t.state,n=e.filter(r=>!H_.has(r));n.length!==e.length&&t.updateState(t.state.reconfigure({plugins:n}).reconfigure({plugins:e}))}const Wk={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},wg={flex:1,border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 8px",font:"inherit",outline:"none",minWidth:0},Ju={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},DK=Wk,IK=wg,F1=Ju;function _K({initialUrl:t,isEdit:e,onApply:n,onRemove:r,onClose:i}){const[s,a]=ee.useState(t),u=()=>{const c=s.trim();c!==""&&n(c)};return O.jsxs("div",{style:DK,"data-mdx-action":"link",onMouseDown:c=>c.stopPropagation(),children:[O.jsx("input",{style:IK,autoFocus:!0,placeholder:"https://…",value:s,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),u()),c.key==="Escape"&&i()}}),O.jsx("button",{type:"button",style:{...F1,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:c=>c.preventDefault(),onClick:u,children:e?"Update":"Add"}),e&&r?O.jsx("button",{type:"button",style:{...F1,color:"#dc2626"},onMouseDown:c=>c.preventDefault(),onClick:r,children:"Remove"}):null,O.jsx("button",{type:"button",style:F1,onMouseDown:c=>c.preventDefault(),onClick:i,children:"Cancel"})]})}const zK={...Wk,flexWrap:"wrap"},IT={display:"flex",alignItems:"center",gap:6,flex:"1 1 180px",minWidth:0},_T={fontSize:11,color:"#71717a",whiteSpace:"nowrap"},LK={display:"flex",gap:6,marginLeft:"auto"},BK={width:48,height:48,objectFit:"contain",border:"1px solid #e4e4e7",borderRadius:4,background:"#fafafa",flexShrink:0};function zT({mode:t,initialAlt:e,initialCaption:n,previewSrc:r,onReplace:i,onApply:s,onClose:a}){const[u,c]=ee.useState(e),[h,d]=ee.useState(n),g=()=>s(u.trim(),h.trim()),y=x=>{x.key==="Enter"&&(x.preventDefault(),g()),x.key==="Escape"&&a()};return O.jsxs("div",{style:zK,"data-mdx-action":"image",onMouseDown:x=>x.stopPropagation(),children:[r!==""?O.jsx("img",{src:r,alt:"",style:BK,"data-mdx-image-preview":""}):null,i?O.jsx("button",{type:"button",style:Ju,onMouseDown:x=>x.preventDefault(),onClick:i,children:"Replace image"}):null,O.jsxs("label",{style:IT,children:[O.jsx("span",{style:_T,children:"Alt"}),O.jsx("input",{style:wg,autoFocus:!0,placeholder:"Alt text for screen readers",value:u,onChange:x=>c(x.currentTarget.value),onKeyDown:y})]}),O.jsxs("label",{style:IT,children:[O.jsx("span",{style:_T,children:"Caption"}),O.jsx("input",{style:wg,placeholder:"Caption / source (optional)",value:h,onChange:x=>d(x.currentTarget.value),onKeyDown:y})]}),O.jsxs("div",{style:LK,children:[O.jsx("button",{type:"button",style:{...Ju,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:x=>x.preventDefault(),onClick:g,children:t==="insert"?"Insert":"Save"}),O.jsx("button",{type:"button",style:Ju,onMouseDown:x=>x.preventDefault(),onClick:a,children:"Cancel"})]})]})}const FK={display:"flex",gap:16,padding:16,overflowY:"auto"},VK={width:220,height:220,flexShrink:0,objectFit:"contain",border:"1px solid #e4e4e7",borderRadius:8,background:"#fafafa"},PK={display:"flex",flexDirection:"column",gap:8,flex:1,minWidth:0},jK={border:"1px solid #d4d4d8",borderRadius:6,padding:"6px 10px",font:"inherit",outline:"none"},Y_={border:"1px solid #d4d4d8",background:"#fff",borderRadius:6,padding:"6px 12px",font:"inherit",cursor:"pointer",color:"#3f3f46"},$K={...Y_,background:"#2563eb",border:"1px solid #2563eb",color:"#fff"};function JK({item:t,save:e,onSaved:n,onCancel:r}){const[i,s]=ee.useState(t.annotation??""),[a,u]=ee.useState(!1),[c,h]=ee.useState(null),d=async()=>{if(a)return;const g=i.trim();u(!0),h(null);try{const y=await e(g);if(y.success){n(g);return}h(y.error??"Failed to save the alt text")}catch(y){h(y instanceof Error?y.message:"Failed to save the alt text")}u(!1)};return O.jsxs("div",{style:FK,"data-cms-media-annotation":t.id,children:[O.jsx("img",{src:t.thumbnailUrl??t.url,alt:"",style:VK}),O.jsxs("div",{style:PK,children:[O.jsx("strong",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.filename,children:t.filename}),O.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,color:"#52525b"},children:["Default alt text",O.jsx("input",{style:jK,autoFocus:!0,placeholder:"Describe the image for screen readers",value:i,disabled:a,onChange:g=>s(g.currentTarget.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),d()),g.key==="Escape"&&r()}})]}),O.jsx("div",{style:{fontSize:12,color:"#71717a"},children:"Prefilled as the alt text when this image is inserted. Images already in the content keep their own."}),c?O.jsx("div",{style:{fontSize:12,color:"#dc2626"},children:c}):null,O.jsxs("div",{style:{display:"flex",gap:8},children:[O.jsx("button",{type:"button",style:$K,disabled:a,onClick:()=>{d()},children:a?"Saving…":"Save"}),O.jsx("button",{type:"button",style:Y_,disabled:a,onClick:r,children:"Cancel"})]})]})]})}function LT(t){return typeof t!="object"||t===null?!1:"status"in t&&t.status===501||"code"in t&&t.code==="unsupported"}const BT=60,UK=200,HK=200;function FT(t,e){return{folder:t,type:e,cursor:void 0,seen:new Set,pages:0,busy:!1,failed:!1}}function qK(t,e){if(!t.hasMore)return{cursor:void 0,stalled:!1};const n=t.cursor;return n===void 0||e.seen.has(n)||e.pages>=HK?{cursor:void 0,stalled:!0}:(e.seen.add(n),{cursor:n,stalled:!1})}function KK(t,e){if(e.length===0)return t;const n=new Map(t.map(i=>[i.path,i]));let r=!1;for(const i of e)n.has(i.path)||(n.set(i.path,i),r=!0);return r?[...n.values()].sort((i,s)=>i.name.localeCompare(s.name)):t}const GK=[{value:"all",label:"All"},{value:"photo",label:"Photos"},{value:"graphic",label:"Graphics"},{value:"video",label:"Videos"},{value:"document",label:"Documents"}],YK={position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1100},WK={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"},XK={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #ececed"},QK={display:"flex",flexDirection:"column",gap:10,padding:"12px 16px",borderBottom:"1px solid #ececed"},cf={display:"flex",alignItems:"center",gap:8},VT={flex:1,border:"1px solid #d4d4d8",borderRadius:6,padding:"6px 10px",font:"inherit",outline:"none"},Vo={border:"1px solid #d4d4d8",background:"#fff",borderRadius:6,padding:"6px 12px",font:"inherit",cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"},PT={...Vo,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},ZK={display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gridAutoRows:"max-content",gap:10,padding:16,overflowY:"auto"},eG={position:"relative"},jT={position:"relative",width:"100%",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},tG={position:"absolute",top:6,right:6,border:"1px solid #d4d4d8",background:"rgba(255,255,255,0.92)",borderRadius:4,padding:"1px 6px",font:"inherit",fontSize:11,color:"#3f3f46",cursor:"pointer"},$T={padding:32,textAlign:"center",color:"#a1a1aa"},nG={display:"flex",alignItems:"center",justifyContent:"center",gap:8,padding:"8px 16px",borderTop:"1px solid #ececed",fontSize:12,color:"#71717a"},rG={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 W_({media:t,context:e,field:n,accept:r=`image/*,application/pdf,${_M}`,onSelect:i,onClose:s}){const[a,u]=ee.useState([]),[c,h]=ee.useState([]),[d,g]=ee.useState(""),[y,x]=ee.useState(""),[k,w]=ee.useState("all"),[N,T]=ee.useState(!1),[V,F]=ee.useState(!1),[K,L]=ee.useState(!1),[C,_]=ee.useState(!1),[J,$]=ee.useState(!1),[H,ue]=ee.useState(0),[ae,Se]=ee.useState(!1),[Ee,Y]=ee.useState(!1),[X,le]=ee.useState(null),[Ce,_e]=ee.useState(!1),[j,P]=ee.useState(""),[te,z]=ee.useState(null),xe=ee.useRef(null),Te=ee.useRef(FT("","all")),Ae=ee.useRef(!0);ee.useEffect(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]);const qe=ee.useCallback(async(he,je=BT)=>{if(he.busy||Te.current!==he)return;const Dt=he.pages===0;he.busy=!0,he.failed=!1,Dt?T(!0):F(!0),le(null);try{const mt=await t.listMedia({folder:he.folder||void 0,limit:je,cursor:he.cursor,type:he.type});if(!Ae.current||Te.current!==he)return;he.pages+=1,ue(gn=>gn+1),_(mt.appliedType===he.type),$(mt.appliedType===he.type&&mt.items.length<je),h(gn=>KK(gn,mt.folders)),u(gn=>Dt?mt.items:[...gn,...mt.items]);const Be=qK(mt,he);he.cursor=Be.cursor,L(Be.cursor!==void 0),Be.stalled&&le("Stopped loading this folder early — some files are not shown.")}catch(mt){if(!Ae.current||Te.current!==he)return;he.failed=!0,LT(mt)?(Se(!0),L(!1)):le(mt instanceof Error?mt.message:"Failed to load media")}finally{he.busy=!1,Ae.current&&Te.current===he&&(T(!1),F(!1))}},[t]);ee.useEffect(()=>{const he=FT(d,k);Te.current=he,u([]),h([]),L(!1),_(!1),$(!1),qe(he)},[d,k,qe]);const pt=y.trim().toLowerCase(),Ke=pt!==""||k!=="all",Ot=Ke&&(pt!==""||k!=="all"&&!C);ee.useEffect(()=>{if(!Ot&&!J)return;const he=Te.current;he.busy||he.failed||he.cursor===void 0||qe(he,Ot?UK:BT)},[Ot,J,H,qe]);const fr=he=>{x(""),g(he)},hr=async he=>{Y(!0),le(null);try{const je=await t.uploadMedia(he,{...e,field:n,folder:d||void 0});if(je.success&&je.url){if(je.url.startsWith("./")){i(je.url,je.annotation??"",je.annotation);return}const Dt={id:je.id??je.url,url:je.url,filename:je.filename??he.name,annotation:je.annotation,annotationEditable:je.annotationEditable,contentType:he.type||"application/octet-stream",folder:d||void 0};u(mt=>[Dt,...mt])}else le(je.error??"Upload failed")}catch(je){LT(je)?Se(!0):le(je instanceof Error?je.message:"Upload failed")}finally{Y(!1)}},hn=async()=>{const he=j.trim();if(!he||!t.createFolder)return;if(/[/\\:*?"<>|]/.test(he)){le("Invalid folder name");return}const je=d?`${d}/${he}`:he;try{const Dt=await t.createFolder(je);Dt.success?h(mt=>[...mt,{name:he,path:je}].sort((Be,gn)=>Be.name.localeCompare(gn.name))):le(Dt.error??"Failed to create folder")}catch(Dt){le(Dt instanceof Error?Dt.message:"Failed to create folder")}P(""),_e(!1)},pn=t.updateMediaAnnotation?.bind(t),pr=(he,je)=>{u(Dt=>Dt.map(mt=>mt.id===he?{...mt,annotation:je}:mt)),z(null)},dn=ee.useMemo(()=>{const he=wL(a,k);return pt===""?he:he.filter(je=>je.filename.toLowerCase().includes(pt))},[a,k,pt]),mn=ee.useMemo(()=>{if(!d)return[];const he=d.split("/");return he.map((je,Dt)=>({name:je,path:he.slice(0,Dt+1).join("/")}))},[d]),dr=Ke?[]:c;return O.jsx("div",{style:YK,onMouseDown:s,"data-cms-ui":"",children:O.jsxs("div",{style:WK,onMouseDown:he=>he.stopPropagation(),onDrop:he=>{he.preventDefault();const je=he.dataTransfer.files[0];je&&hr(je)},onDragOver:he=>he.preventDefault(),children:[O.jsxs("div",{style:XK,children:[O.jsx("strong",{style:{fontSize:15},children:"Media Library"}),O.jsx("button",{type:"button",style:{...Vo,border:"none",fontSize:18,lineHeight:1,padding:2},onClick:s,"aria-label":"Close",children:"×"})]}),O.jsxs("div",{style:QK,children:[mn.length>0?O.jsxs("div",{style:{...cf,gap:4,fontSize:12,color:"#71717a"},children:[O.jsx("button",{type:"button",style:{...Vo,border:"none",padding:"0 2px"},onClick:()=>fr(""),children:"root"}),mn.map((he,je)=>O.jsxs("span",{style:cf,children:[O.jsx("span",{children:"/"}),je===mn.length-1?O.jsx("span",{style:{color:"#27272a",fontWeight:600},children:he.name}):O.jsx("button",{type:"button",style:{...Vo,border:"none",padding:"0 2px"},onClick:()=>fr(he.path),children:he.name})]},he.path))]}):null,O.jsxs("div",{style:cf,children:[O.jsx("input",{style:VT,placeholder:"Search files…",value:y,onChange:he=>x(he.target.value)}),t.createFolder?O.jsx("button",{type:"button",style:Vo,onClick:()=>_e(he=>!he),children:"New folder"}):null,O.jsx("button",{type:"button",style:PT,disabled:ae||Ee,onClick:()=>xe.current?.click(),children:Ee?"Uploading…":"Upload"}),O.jsx("input",{ref:xe,type:"file",accept:r,style:{display:"none"},onChange:he=>{const je=he.target.files?.[0];je&&hr(je),he.target.value=""}})]}),O.jsx("div",{style:{...cf,gap:4},children:GK.map(he=>O.jsx("button",{type:"button",style:{...Vo,padding:"3px 10px",fontSize:12,...k===he.value?{background:"#2563eb",border:"1px solid #2563eb",color:"#fff"}:{}},onClick:()=>w(he.value),children:he.label},he.value))}),Ce&&t.createFolder?O.jsxs("div",{style:cf,children:[O.jsx("input",{style:VT,autoFocus:!0,placeholder:"Folder name…",value:j,onChange:he=>P(he.target.value),onKeyDown:he=>{he.key==="Enter"&&hn(),he.key==="Escape"&&(_e(!1),P(""))}}),O.jsx("button",{type:"button",style:PT,onClick:()=>{hn()},children:"Create"})]}):null,ae?O.jsx("div",{style:{fontSize:12,color:"#a16207"},children:"Media uploads are not configured for this project."}):null,X?O.jsx("div",{style:{fontSize:12,color:"#dc2626"},children:X}):null]}),te&&pn?O.jsx(JK,{item:te,save:he=>pn(te.id,he),onSaved:he=>pr(te.id,he),onCancel:()=>z(null)}):N?O.jsx("div",{style:$T,children:"Loading…"}):dr.length===0&&dn.length===0?O.jsx("div",{style:$T,children:V?Ke?"Searching…":"Loading…":Ke&&K?"No matches loaded yet.":Ke?"No matching files.":"No files yet. Upload one to get started."}):O.jsxs("div",{style:ZK,children:[dr.map(he=>O.jsxs("button",{type:"button",style:jT,onClick:()=>fr(he.path),title:he.name,"data-cms-media-folder":he.path,children:[O.jsx("span",{style:{fontSize:30},children:"📁"}),O.jsx("span",{style:{fontSize:12,color:"#52525b",maxWidth:"90%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:he.name})]},he.path)),dn.map(he=>O.jsxs("div",{style:eG,children:[O.jsxs("button",{type:"button",style:jT,title:he.filename,"data-cms-media-item":he.id,onClick:()=>i(he.url,he.annotation??(he.filename||"Image"),he.annotation),children:[he.contentType.startsWith("image/")?O.jsx("img",{src:he.thumbnailUrl??he.url,alt:he.annotation||he.filename,style:{width:"100%",height:"100%",objectFit:"contain"}}):he.contentType.startsWith("video/")?O.jsx("video",{src:he.thumbnailUrl??he.url,muted:!0,playsInline:!0,preload:"metadata",style:{width:"100%",height:"100%",objectFit:"contain",background:"#000"}}):O.jsx("span",{style:{fontSize:30},children:he.contentType==="application/pdf"?"📄":"📎"}),O.jsx("span",{style:rG,children:he.filename})]}),he.annotationEditable&&pn&&he.contentType.startsWith("image/")?O.jsx("button",{type:"button",style:tG,title:"Edit the default alt text","data-cms-media-alt":he.id,onClick:()=>z(he),children:"Alt"}):null]},he.id))]}),!N&&!te&&K?O.jsx("div",{style:nG,children:V?O.jsx("span",{children:Ot?`Searching the whole folder… ${a.length} files scanned`:Ke?"Searching…":"Loading…"}):O.jsx("button",{type:"button",style:Vo,onClick:()=>{qe(Te.current)},children:"Load more"})}):null,O.jsxs("div",{style:{padding:"10px 16px",borderTop:"1px solid #ececed",fontSize:12,color:"#a1a1aa",textAlign:"center"},children:["Drag and drop a file here to upload",d?` to ${d}`:"","."]})]})})}const iG=/^(https?:)?\/\/|^data:/i;function _S(t,e,n){if(e==="")return"";if(iG.test(e))return e;if(e.startsWith("/"))return t?.mediaAssetUrl?.(e)??e;const r=n?.collection,i=n?.entry;return r===void 0||i===void 0?"":t?.mediaFileUrl?.(r,i,e)??""}const zS={bold:!1,italic:!1,strikethrough:!1,link:!1,linkHref:null,bulletList:!1,orderedList:!1,listStyle:null,blockquote:!1,heading:null,image:null};function sG(t){const{state:e}=t,{$from:n,from:r,to:i}=e.selection;let s=!1,a=!1,u=!1,c=!1,h=null;const d=e.storedMarks||n.marks();for(const N of d)N.type.name==="strong"&&(s=!0),N.type.name==="emphasis"&&(a=!0),N.type.name==="strike_through"&&(u=!0),N.type.name==="link"&&(c=!0,h=typeof N.attrs.href=="string"?N.attrs.href:null);r!==i&&e.doc.nodesBetween(r,i,N=>{for(const T of N.marks)T.type.name==="strong"&&(s=!0),T.type.name==="emphasis"&&(a=!0),T.type.name==="strike_through"&&(u=!0),T.type.name==="link"&&(c=!0,h=typeof T.attrs.href=="string"?T.attrs.href:null)});let g=!1,y=!1,x=null,k=!1,w=null;for(let N=n.depth;N>0;N--){const T=n.node(N);(T.type.name==="bullet_list"||T.type.name==="ordered_list")&&(T.type.name==="bullet_list"&&(g=!0),T.type.name==="ordered_list"&&(y=!0),x===null&&(x=typeof T.attrs.listStyle=="string"?T.attrs.listStyle:null)),T.type.name==="blockquote"&&(k=!0)}if(n.parent.type.name==="heading"){const N=n.parent.attrs.level;w=typeof N=="number"?N:null}return{bold:s,italic:a,strikethrough:u,link:c,linkHref:h,bulletList:g,orderedList:y,listStyle:x,blockquote:k,heading:w,image:aG(t)}}function aG(t){const{doc:e,selection:n}=t.state,r=e.nodeAt(n.from);return r===null||r.type.name!=="image"||n.to-n.from!==r.nodeSize?null:{pos:n.from,src:jm(r.attrs.src),alt:jm(r.attrs.alt),title:jm(r.attrs.title)}}function jm(t){return typeof t=="string"?t:""}function oG(t,e,n){const r=t.state.doc.nodeAt(e.pos);if(r===null||r.type.name!=="image"||jm(r.attrs.src)!==e.src)return!1;const i=t.state.tr.setNodeAttribute(e.pos,"src",n.src).setNodeAttribute(e.pos,"alt",n.alt).setNodeAttribute(e.pos,"title",n.title);return t.dispatch(i),!0}function lG(t,e){return t===null||e===null?t===e:t.pos===e.pos&&t.src===e.src&&t.alt===e.alt&&t.title===e.title}function uG(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 cG(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,a=s.parent.type.name==="heading"&&s.parent.attrs.level===e,u=a?i:r,c=a?void 0:{level:e},h=s.before(s.depth),d=n.selection.$to.after(n.selection.$to.depth);t.dispatch(n.tr.setBlockType(h,d,u,c)),t.focus()}function fG(t){const{state:e}=t,{$from:n,$to:r}=e.selection;let i=n.depth;for(;i>0&&n.node(i).type.name!=="blockquote";)i--;if(i===0)return!1;const s=r.pos>n.end(i)?e.doc.resolve(n.end(i)):r,a=n.blockRange(s,c=>c===n.node(i)),u=a?zj(a):null;return a&&u!==null&&t.dispatch(e.tr.lift(a,u).scrollIntoView()),t.focus(),!0}function hG(t){const{state:e}=t,{from:n,to:r}=e.selection,i=e.schema.marks.link;if(!i)return;let s=n,a=r;e.doc.nodesBetween(n,n===r?r+1:r,(u,c)=>{if(i.isInSet(u.marks))return s=c,a=c+u.nodeSize,!1}),t.dispatch(e.tr.removeMark(s,a,i))}function pG(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&&lG(t.image,e.image)}function dG(t,e){let n=0,r=zS;const i=()=>{const u=t.ctx.get(Vt),c=sG(u);pG(c,r)||(r=c,e(c))},s=t.ctx.get(Vt),a=s.dispatch.bind(s);return s.dispatch=u=>{a(u),(u.selectionSet||u.docChanged)&&(cancelAnimationFrame(n),n=requestAnimationFrame(i))},i(),()=>{cancelAnimationFrame(n)}}const mG=["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"],JT={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 X_(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=48&&e<=57}function gG(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=102||e>=65&&e<=70||e>=48&&e<=57}function yG(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=122||e>=65&&e<=90}function UT(t){return yG(t)||X_(t)}const xG=["","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 y0(t,e){const n=e||{},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,i=[];let s=0,a=-1,u="",c,h;n.position&&("start"in n.position||"indent"in n.position?(h=n.position.indent,c=n.position.start):c=n.position);let d=(c?c.line:0)||1,g=(c?c.column:0)||1,y=k(),x;for(s--;++s<=t.length;)if(x===10&&(g=(h?h[a]:0)||1),x=t.charCodeAt(s),x===38){const T=t.charCodeAt(s+1);if(T===9||T===10||T===12||T===32||T===38||T===60||Number.isNaN(T)||r&&T===r){u+=String.fromCharCode(x),g++;continue}const V=s+1;let F=V,K=V,L;if(T===35){K=++F;const Se=t.charCodeAt(K);Se===88||Se===120?(L="hexadecimal",K=++F):L="decimal"}else L="named";let C="",_="",J="";const $=L==="named"?UT:L==="decimal"?X_:gG;for(K--;++K<=t.length;){const Se=t.charCodeAt(K);if(!$(Se))break;J+=String.fromCharCode(Se),L==="named"&&mG.includes(J)&&(C=J,_=Th(J))}let H=t.charCodeAt(K)===59;if(H){K++;const Se=L==="named"?Th(J):!1;Se&&(C=J,_=Se)}let ue=1+K-V,ae="";if(!(!H&&n.nonTerminated===!1))if(!J)L!=="named"&&w(4,ue);else if(L==="named"){if(H&&!_)w(5,1);else if(C!==J&&(K=F+C.length,ue=1+K-F,H=!1),!H){const Se=C?1:3;if(n.attribute){const Ee=t.charCodeAt(K);Ee===61?(w(Se,ue),_=""):UT(Ee)?_="":w(Se,ue)}else w(Se,ue)}ae=_}else{H||w(2,ue);let Se=Number.parseInt(J,L==="hexadecimal"?16:10);if(bG(Se))w(7,ue),ae="�";else if(Se in JT)w(6,ue),ae=JT[Se];else{let Ee="";SG(Se)&&w(6,ue),Se>65535&&(Se-=65536,Ee+=String.fromCharCode(Se>>>10|55296),Se=56320|Se&1023),ae=Ee+String.fromCharCode(Se)}}if(ae){N(),y=k(),s=K-1,g+=K-V+1,i.push(ae);const Se=k();Se.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,ae,{start:y,end:Se},t.slice(V-1,K)),y=Se}else J=t.slice(V-1,K),u+=J,g+=J.length,s=K-1}else x===10&&(d++,a++,g=0),Number.isNaN(x)?N():(u+=String.fromCharCode(x),g++);return i.join("");function k(){return{line:d,column:g,offset:s+((c?c.offset:0)||0)}}function w(T,V){let F;n.warning&&(F=k(),F.column+=V,F.offset+=V,n.warning.call(n.warningContext||void 0,xG[T],F,T))}function N(){u&&(i.push(u),n.text&&n.text.call(n.textContext||void 0,u,{start:y,end:k()}),u="")}}function bG(t){return t>=55296&&t<=57343||t>1114111}function SG(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 vG=/["&'<>`]/g,kG=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,CG=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,wG=/[|\\{}()[\]^$+*?.]/g,HT=new WeakMap;function EG(t,e){if(t=t.replace(e.subset?AG(e.subset):vG,r),e.subset||e.escapeOnly)return t;return t.replace(kG,n).replace(CG,r);function n(i,s,a){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,a.charCodeAt(s+2),e)}function r(i,s,a){return e.format(i.charCodeAt(0),a.charCodeAt(s+1),e)}}function AG(t){let e=HT.get(t);return e||(e=NG(t),HT.set(t,e)),e}function NG(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(wG,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function TG(t){return"&#x"+t.toString(16).toUpperCase()+";"}function MG(t,e){return EG(t,Object.assign({format:TG},e))}function OG(){return{canContainEols:["textDirective"],enter:{directiveContainer:RG,directiveContainerAttributes:P1,directiveContainerLabel:_G,directiveLeaf:DG,directiveLeafAttributes:P1,directiveText:IG,directiveTextAttributes:P1},exit:{directiveContainer:q1,directiveContainerAttributeClassValue:$1,directiveContainerAttributeIdValue:j1,directiveContainerAttributeName:U1,directiveContainerAttributeValue:J1,directiveContainerAttributes:H1,directiveContainerLabel:zG,directiveContainerName:V1,directiveLeaf:q1,directiveLeafAttributeClassValue:$1,directiveLeafAttributeIdValue:j1,directiveLeafAttributeName:U1,directiveLeafAttributeValue:J1,directiveLeafAttributes:H1,directiveLeafName:V1,directiveText:q1,directiveTextAttributeClassValue:$1,directiveTextAttributeIdValue:j1,directiveTextAttributeName:U1,directiveTextAttributeValue:J1,directiveTextAttributes:H1,directiveTextName:V1}}}function RG(t){Xk.call(this,"containerDirective",t)}function DG(t){Xk.call(this,"leafDirective",t)}function IG(t){Xk.call(this,"textDirective",t)}function Xk(t,e){this.enter({type:t,name:"",attributes:{},children:[]},e)}function V1(t){const e=this.stack[this.stack.length-1];e.type==="containerDirective"||e.type==="leafDirective"||e.type,e.name=this.sliceSerialize(t)}function _G(t){this.enter({type:"paragraph",data:{directiveLabel:!0},children:[]},t)}function zG(t){this.exit(t)}function P1(){this.data.directiveAttributes=[],this.buffer()}function j1(t){this.data.directiveAttributes.push(["id",y0(this.sliceSerialize(t),{attribute:!0})])}function $1(t){this.data.directiveAttributes.push(["class",y0(this.sliceSerialize(t),{attribute:!0})])}function J1(t){const e=this.data.directiveAttributes;e[e.length-1][1]=y0(this.sliceSerialize(t),{attribute:!0})}function U1(t){this.data.directiveAttributes.push([this.sliceSerialize(t),""])}function H1(){const t=this.data.directiveAttributes,e={};let n=-1;for(;++n<t.length;){const i=t[n];i[0]==="class"&&e.class?e.class+=" "+i[1]:e[i[0]]=i[1]}this.data.directiveAttributes=void 0,this.resume();const r=this.stack[this.stack.length-1];r.type==="containerDirective"||r.type==="leafDirective"||r.type,r.attributes=e}function q1(t){this.exit(t)}function Qk(t,e,n,r,i,s,a,u,c,h,d,g,y,x,k){let w,N;return T;function T(Y){return t.enter(r),t.enter(i),t.consume(Y),t.exit(i),V}function V(Y){return Y===35?(w=a,F(Y)):Y===46?(w=u,F(Y)):Y===58||Y===95||cn(Y)?(t.enter(s),t.enter(c),t.consume(Y),C):k&&Ye(Y)?We(t,V,"whitespace")(Y):!k&&tt(Y)?zs(t,V)(Y):Ee(Y)}function F(Y){const X=w+"Marker";return t.enter(s),t.enter(w),t.enter(X),t.consume(Y),t.exit(X),K}function K(Y){if(Y===null||Y===34||Y===35||Y===39||Y===46||Y===60||Y===61||Y===62||Y===96||Y===125||tt(Y))return n(Y);const X=w+"Value";return t.enter(X),t.consume(Y),L}function L(Y){if(Y===null||Y===34||Y===39||Y===60||Y===61||Y===62||Y===96)return n(Y);if(Y===35||Y===46||Y===125||tt(Y)){const X=w+"Value";return t.exit(X),t.exit(w),t.exit(s),V(Y)}return t.consume(Y),L}function C(Y){return Y===45||Y===46||Y===58||Y===95||Dn(Y)?(t.consume(Y),C):(t.exit(c),k&&Ye(Y)?We(t,_,"whitespace")(Y):!k&&tt(Y)?zs(t,_)(Y):_(Y))}function _(Y){return Y===61?(t.enter(h),t.consume(Y),t.exit(h),J):(t.exit(s),V(Y))}function J(Y){return Y===null||Y===60||Y===61||Y===62||Y===96||Y===125||k&&we(Y)?n(Y):Y===34||Y===39?(t.enter(d),t.enter(y),t.consume(Y),t.exit(y),N=Y,H):k&&Ye(Y)?We(t,J,"whitespace")(Y):!k&&tt(Y)?zs(t,J)(Y):(t.enter(g),t.enter(x),t.consume(Y),N=void 0,$)}function $(Y){return Y===null||Y===34||Y===39||Y===60||Y===61||Y===62||Y===96?n(Y):Y===125||tt(Y)?(t.exit(x),t.exit(g),t.exit(s),V(Y)):(t.consume(Y),$)}function H(Y){return Y===N?(t.enter(y),t.consume(Y),t.exit(y),t.exit(d),t.exit(s),Se):(t.enter(g),ue(Y))}function ue(Y){return Y===N?(t.exit(g),H(Y)):Y===null?n(Y):we(Y)?k?n(Y):zs(t,ue)(Y):(t.enter(x),t.consume(Y),ae)}function ae(Y){return Y===N||Y===null||we(Y)?(t.exit(x),ue(Y)):(t.consume(Y),ae)}function Se(Y){return Y===125||tt(Y)?V(Y):Ee(Y)}function Ee(Y){return Y===125?(t.enter(i),t.consume(Y),t.exit(i),t.exit(r),e):n(Y)}}function Zk(t,e,n,r,i,s,a){let u=0,c=0,h;return d;function d(N){return t.enter(r),t.enter(i),t.consume(N),t.exit(i),g}function g(N){return N===93?(t.enter(i),t.consume(N),t.exit(i),t.exit(r),e):(t.enter(s),y(N))}function y(N){if(N===93&&!c)return w(N);const T=t.enter("chunkText",{contentType:"text",previous:h});return h&&(h.next=T),h=T,x(N)}function x(N){return N===null||u>999||N===91&&++c>32?n(N):N===93&&!c--?(t.exit("chunkText"),w(N)):we(N)?a?n(N):(t.consume(N),t.exit("chunkText"),y):(t.consume(N),N===92?k:x)}function k(N){return N===91||N===92||N===93?(t.consume(N),u++,x):x(N)}function w(N){return t.exit(s),t.enter(i),t.consume(N),t.exit(i),t.exit(r),e}}function eC(t,e,n,r){const i=this;return s;function s(u){return cn(u)?(t.enter(r),t.consume(u),a):n(u)}function a(u){return u===45||u===95||Dn(u)?(t.consume(u),a):(t.exit(r),i.previous===45||i.previous===95?n(u):e(u))}}const LG={tokenize:VG,concrete:!0},BG={tokenize:PG,partial:!0},FG={tokenize:jG,partial:!0},nm={tokenize:$G,partial:!0};function VG(t,e,n){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let a=0,u;return c;function c($){return t.enter("directiveContainer"),t.enter("directiveContainerFence"),t.enter("directiveContainerSequence"),h($)}function h($){return $===58?(t.consume($),a++,h):a<3?n($):(t.exit("directiveContainerSequence"),eC.call(r,t,d,n,"directiveContainerName")($))}function d($){return $===91?t.attempt(BG,g,g)($):g($)}function g($){return $===123?t.attempt(FG,y,y)($):y($)}function y($){return We(t,x,"whitespace")($)}function x($){return t.exit("directiveContainerFence"),$===null?_($):we($)?r.interrupt?e($):t.attempt(nm,k,_)($):n($)}function k($){return $===null?_($):we($)?t.check(nm,F,_)($):(t.enter("directiveContainerContent"),w($))}function w($){return t.attempt({tokenize:J,partial:!0},C,s?We(t,N,"linePrefix",s+1):N)($)}function N($){return $===null?C($):we($)?t.check(nm,V,C)($):V($)}function T($){if($===null){const H=t.exit("chunkDocument");return r.parser.lazy[H.start.line]=!1,C($)}return we($)?t.check(nm,K,L)($):(t.consume($),T)}function V($){const H=t.enter("chunkDocument",{contentType:"document",previous:u});return u&&(u.next=H),u=H,T($)}function F($){return t.enter("directiveContainerContent"),w($)}function K($){t.consume($);const H=t.exit("chunkDocument");return r.parser.lazy[H.start.line]=!1,w}function L($){const H=t.exit("chunkDocument");return r.parser.lazy[H.start.line]=!1,C($)}function C($){return t.exit("directiveContainerContent"),_($)}function _($){return t.exit("directiveContainer"),e($)}function J($,H,ue){let ae=0;return We($,Se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function Se(X){return $.enter("directiveContainerFence"),$.enter("directiveContainerSequence"),Ee(X)}function Ee(X){return X===58?($.consume(X),ae++,Ee):ae<a?ue(X):($.exit("directiveContainerSequence"),We($,Y,"whitespace")(X))}function Y(X){return X===null||we(X)?($.exit("directiveContainerFence"),H(X)):ue(X)}}}function PG(t,e,n){return Zk(t,e,n,"directiveContainerLabel","directiveContainerLabelMarker","directiveContainerLabelString",!0)}function jG(t,e,n){return Qk(t,e,n,"directiveContainerAttributes","directiveContainerAttributesMarker","directiveContainerAttribute","directiveContainerAttributeId","directiveContainerAttributeClass","directiveContainerAttributeName","directiveContainerAttributeInitializerMarker","directiveContainerAttributeValueLiteral","directiveContainerAttributeValue","directiveContainerAttributeValueMarker","directiveContainerAttributeValueData",!0)}function $G(t,e,n){const r=this;return i;function i(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const JG={tokenize:qG},UG={tokenize:KG,partial:!0},HG={tokenize:GG,partial:!0};function qG(t,e,n){const r=this;return i;function i(d){return t.enter("directiveLeaf"),t.enter("directiveLeafSequence"),t.consume(d),s}function s(d){return d===58?(t.consume(d),t.exit("directiveLeafSequence"),eC.call(r,t,a,n,"directiveLeafName")):n(d)}function a(d){return d===91?t.attempt(UG,u,u)(d):u(d)}function u(d){return d===123?t.attempt(HG,c,c)(d):c(d)}function c(d){return We(t,h,"whitespace")(d)}function h(d){return d===null||we(d)?(t.exit("directiveLeaf"),e(d)):n(d)}}function KG(t,e,n){return Zk(t,e,n,"directiveLeafLabel","directiveLeafLabelMarker","directiveLeafLabelString",!0)}function GG(t,e,n){return Qk(t,e,n,"directiveLeafAttributes","directiveLeafAttributesMarker","directiveLeafAttribute","directiveLeafAttributeId","directiveLeafAttributeClass","directiveLeafAttributeName","directiveLeafAttributeInitializerMarker","directiveLeafAttributeValueLiteral","directiveLeafAttributeValue","directiveLeafAttributeValueMarker","directiveLeafAttributeValueData",!0)}const YG={tokenize:ZG,previous:QG},WG={tokenize:eY,partial:!0},XG={tokenize:tY,partial:!0};function QG(t){return t!==58||this.events[this.events.length-1][1].type==="characterEscape"}function ZG(t,e,n){const r=this;return i;function i(c){return t.enter("directiveText"),t.enter("directiveTextMarker"),t.consume(c),t.exit("directiveTextMarker"),eC.call(r,t,s,n,"directiveTextName")}function s(c){return c===58?n(c):c===91?t.attempt(WG,a,a)(c):a(c)}function a(c){return c===123?t.attempt(XG,u,u)(c):u(c)}function u(c){return t.exit("directiveText"),e(c)}}function eY(t,e,n){return Zk(t,e,n,"directiveTextLabel","directiveTextLabelMarker","directiveTextLabelString")}function tY(t,e,n){return Qk(t,e,n,"directiveTextAttributes","directiveTextAttributesMarker","directiveTextAttribute","directiveTextAttributeId","directiveTextAttributeClass","directiveTextAttributeName","directiveTextAttributeInitializerMarker","directiveTextAttributeValueLiteral","directiveTextAttributeValue","directiveTextAttributeValueMarker","directiveTextAttributeValueData")}function nY(){return{text:{58:YG},flow:{58:[LG,JG]}}}const Eg="youtube";function rY(t){if(!t||typeof t!="object")return"";const e=Object.entries(t),n=t.id;if(typeof n=="string"&&n)return n;for(const[r,i]of e)if(i===""||i==null)return r;return""}const Q_=nc("youtube",()=>({group:"block",atom:!0,isolating:!0,selectable:!0,draggable:!1,attrs:{videoId:{default:""}},toDOM:t=>["div",{"data-youtube":t.attrs.videoId,class:"youtube-block"}],parseDOM:[{tag:"div[data-youtube]",getAttrs:t=>({videoId:t.getAttribute("data-youtube")||""})}],parseMarkdown:{match:t=>(t.type==="leafDirective"||t.type==="containerDirective"||t.type==="textDirective")&&t.name===Eg,runner:(t,e,n)=>{const r=rY(e.attributes);t.addNode(n,{videoId:r})}},toMarkdown:{match:t=>t.type.name==="youtube",runner:(t,e)=>{t.addNode("leafDirective",void 0,void 0,{name:Eg,attributes:{id:e.attrs.videoId}})}}}));function iY(t){const e=t.attributes,n=e&&typeof e=="object"?String(e.id??""):"";return`::${Eg}{#${n}}`}const sY=function(){const t=this.data("toMarkdownExtensions")??[],e={handlers:{leafDirective:iY}};t.push(e),this.data("toMarkdownExtensions",t)},aY=gi("remarkYoutubeDirective",()=>sY),Z_=He("insertYoutube",()=>t=>(e,n)=>{if(!t)return!1;const r=e.schema.nodes.youtube;if(!r)return!1;const i=r.create({videoId:t});return n&&n(e.tr.replaceSelectionWith(i).scrollIntoView()),!0}),LS="list",oY=/^[A-Za-z0-9_-]+$/,lY=new Set(["textDirective","leafDirective","containerDirective"]);function Gi(t){if(typeof t!="string")return null;const[e]=t.trim().split(/\s+/);return!e||!oY.test(e)?null:e}function js(t){return Array.isArray(t?.children)?t.children:null}function K1(t){const e=js(t);return e&&e.length>0?e[e.length-1]:void 0}function e6(t){return!t.attributes||typeof t.attributes!="object"||Array.isArray(t.attributes)?null:t.attributes}function uY(t){return Gi(e6(t)?.class)}function t6(t,e){const n=js(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 cY(t){if(!t6(t))return null;const e=js(t)?.[0];return typeof e?.value!="string"?null:/^:::list\{\.([A-Za-z0-9_-]+)\}$/.exec(e.value)?.[1]??null}function qT(t){return t?.type==="list"}function fY(t,e,n){if(t6(e[n],":::"))return e.splice(n,1),!0;const r=K1(t),i=K1(r);if(!i||i.type!=="paragraph")return!1;const s=js(i),a=K1(i);if(!s||a?.type!=="text"||typeof a.value!="string")return!1;if(a.value===":::")s.pop();else if(a.value.endsWith(`
58
+ :::`))a.value=a.value.slice(0,-4);else return!1;return s.length===0&&js(r)?.pop(),!0}function hY(t){return t==="containerDirective"?":::":t==="leafDirective"?"::":":"}function pY(t){if(!t||typeof t!="object"||Array.isArray(t))return"";const e=[];for(const[n,r]of Object.entries(t))if(n==="class"&&typeof r=="string")for(const i of r.split(/\s+/).filter(Boolean))e.push(`.${i}`);else n==="id"&&typeof r=="string"?e.push(`#${r}`):r===""||r==null?e.push(n):e.push(`${n}="${String(r)}"`);return e.length>0?`{${e.join(" ")}}`:""}function ff(t){return{type:"text",value:t}}function dY(t){const e=hY(t.type),n=typeof t.name=="string"?t.name:"",r=js(t)??[],i=pY(t.attributes);if(t.type==="textDirective"){const a=[ff(`${e}${n}`)];return r.length>0&&a.push(ff("["),...r,ff("]")),i&&a.push(ff(i)),a}return[{type:"paragraph",children:[ff(`${e}${n}${i}`)]},...r]}function n6(t){const e=js(t);if(e)for(let n=0;n<e.length;n++){const r=e[n];if(!r)continue;if(r.type==="containerDirective"){const a=r,u=a.name===LS?uY(a):null,c=js(a),h=c?.length===1?c[0]:void 0;if(u&&qT(h)){e[n]={...h,listStyle:u};continue}}const i=cY(r),s=e[n+1];if(i&&qT(s)&&fY(s,e,n+2)){e.splice(n,1),e[n]={...s,listStyle:i};continue}if(n6(r),lY.has(r.type)){if(r.name===Eg)continue;const a=r.type==="containerDirective"&&r.name===LS?js(r)??[]:dY(r);e.splice(n,1,...a),n+=a.length-1}}}function mY(t){return!!(t&&typeof t=="object"&&"containerFlow"in t&&typeof t.containerFlow=="function")}const gY=(t,e,n,r)=>{if(!mY(n))return"";const i=Gi(e6(t)?.class),s=n.containerFlow(t,r);return`:::list${i?`{.${i}}`:""}
59
+ ${s}
60
+ :::`},yY=function(){const t=this.data("toMarkdownExtensions")??[],e={handlers:{containerDirective:gY}};return t.push(e),this.data("toMarkdownExtensions",t),n=>{n6(n)}},xY=gi("remarkListDirective",()=>yY),bY=function(){const t=this.data("micromarkExtensions")??[];t.push(nY()),this.data("micromarkExtensions",t);const e=this.data("fromMarkdownExtensions")??[];e.push(OG()),this.data("fromMarkdownExtensions",e)},SY=gi("remarkDirective",()=>bY);function r6(t){return t&&typeof t=="object"?t:{}}function vY(t){if(t)return{name:LS,attributes:{class:t}}}function i6(t,e,n){const r=Gi(e.attrs.listStyle),i=vY(r);i&&t.openNode("containerDirective",void 0,i),t.openNode("list",void 0,n).next(e.content).closeNode(),i&&t.closeNode()}const kY=Al.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=r6(n.parseDOM?.[0]?.getAttrs?.(r)),s=r instanceof HTMLElement?Gi(r.className):null;return{...i,listStyle:s}}}],toDOM:r=>{const i=Gi(r.attrs.listStyle);return["ul",{...e.get(a0.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:Gi(i.listStyle)}).next(i.children).closeNode()}},toMarkdown:{match:r=>r.type.name==="bullet_list",runner:(r,i)=>{i6(r,i,{ordered:!1,spread:i.attrs.spread===!0})}}}}),CY=Nl.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=r6(n.parseDOM?.[0]?.getAttrs?.(r)),s=r instanceof HTMLElement?Gi(r.className):null;return{...i,listStyle:s}}}],toDOM:r=>{const i=Gi(r.attrs.listStyle);return["ol",{...e.get(l0.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:Gi(i.listStyle)}).next(i.children).closeNode()}},toMarkdown:{match:r=>r.type.name==="ordered_list",runner:(r,i)=>{i6(r,i,{ordered:!0,start:typeof i.attrs.order=="number"?i.attrs.order:1,spread:i.attrs.spread===!0})}}}}),s6=He("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=Gi(t),s=new Map,{from:a,to:u,$from:c}=e.selection;for(let h=c.depth;h>0;h--){const d=c.node(h);if(r.has(d.type)){s.set(c.before(h),d);break}}if(e.doc.nodesBetween(a,u,(h,d)=>{r.has(h.type)&&s.set(d,h)}),s.size===0)return!1;if(n){let h=e.tr;for(const[d,g]of s)h=h.setNodeMarkup(d,void 0,{...g.attrs,listStyle:i});n(h.scrollIntoView())}return!0}),wY=[SY,xY,kY,CY,s6].flat(),EY=/^[A-Za-z0-9_-]{11}$/,AY=/(?:youtu\.be\/|\/(?:embed|shorts|v)\/)([A-Za-z0-9_-]{11})/;function NY(t){const e=t.trim();if(!e)return null;if(EY.test(e))return e;const n=/[?&]v=([A-Za-z0-9_-]{11})/.exec(e);if(n)return n[1]??null;const r=AY.exec(e);return r?r[1]??null:null}const TY={fontSize:11,color:"#dc2626",whiteSpace:"nowrap"};function MY({onApply:t,onClose:e}){const[n,r]=ee.useState(""),[i,s]=ee.useState(!1),a=()=>{const u=NY(n);if(!u){s(!0);return}t(u)};return O.jsxs("div",{style:Wk,"data-mdx-action":"youtube",onMouseDown:u=>u.stopPropagation(),children:[O.jsx("input",{style:wg,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(),a()),u.key==="Escape"&&e()}}),i?O.jsx("span",{style:TY,children:"No video id found"}):null,O.jsx("button",{type:"button",style:{...Ju,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},onMouseDown:u=>u.preventDefault(),onClick:a,children:"Insert"}),O.jsx("button",{type:"button",style:Ju,onMouseDown:u=>u.preventDefault(),onClick:e,children:"Cancel"})]})}function OY(t){const[e,n]=ee.useState(zS);return ee.useEffect(()=>{if(!t){n(zS);return}return dG(t,n)},[t]),e}function G1(t,e){cG(t.ctx.get(Vt),e)}function RY(t){fG(t.ctx.get(Vt))||t.action(Oi(s0.key))}function KT(t,e){const n=t.ctx.get(Vt);n.focus(),e(n.state,n.dispatch)}const DY=Yk?"Undo (⌘Z)":"Undo (Ctrl+Z)",IY=Yk?"Redo (⌘⇧Z)":"Redo (Ctrl+Y)";function GT(t,e){const n=t.ctx.get(Vt);uG(n,e==="bullet"?"bullet_list":"ordered_list")?t.action(Oi(c0.key)):t.action(Oi(e==="bullet"?o0.key:u0.key))}function _Y(t,e){t.ctx.get(Vt).focus(),t.action(Oi(s6.key,e))}function zY(t,e,n,r){t.action(i=>{const s=i.get(Vt),a=s.state.schema.nodes.image;a&&(s.focus(),s.dispatch(s.state.tr.replaceSelectionWith(a.create({src:e,alt:n,title:r})).scrollIntoView()))})}function LY(t,e){t.action(Oi(Z_.key,e))}const BY={flexShrink:0,position:"sticky",top:0,zIndex:1},FY={display:"flex",flexWrap:"wrap",alignItems:"center",gap:3,padding:"4px 6px",borderBottom:"1px solid #ececed",background:"#fafafa"},rm={width:1,height:18,background:"#e4e4e7",margin:"0 3px"},a6={border:"1px solid transparent",background:"transparent",borderRadius:4,padding:"2px 7px",font:"inherit",fontSize:12,lineHeight:1.4,cursor:"pointer",color:"#52525b"},VY={...a6,background:"#2563eb",borderColor:"#2563eb",color:"#fff"},PY={border:"1px solid #d4d4d8",borderRadius:4,background:"#fff",color:"#3f3f46",font:"inherit",fontSize:12,lineHeight:1.4,padding:"2px 6px",maxWidth:150};function Cn({active:t,title:e,onClick:n,style:r,children:i}){return O.jsx("button",{type:"button",title:e,"data-mdx-action":"format",onMouseDown:s=>s.preventDefault(),onClick:n,style:{...t?VY:a6,...r},children:i})}function o6({editor:t,listStyles:e,media:n,mediaContext:r,field:i,allowImageInsert:s=!0,onInsertComponent:a}){const u=OY(t),[c,h]=ee.useState(!1),[d,g]=ee.useState(null),[y,x]=ee.useState(!1),[k,w]=ee.useState(null),[N,T]=ee.useState(null),V=t===null,F=(e?.length??0)>0,K=u.bulletList||u.orderedList,L=u.listStyle&&e?.some(ae=>ae.class===u.listStyle)?u.listStyle:"",C=ae=>{if(h(!1),!t)return;t.ctx.get(Vt).focus(),t.action(Oi(u.link?zv.key:_v.key,{href:ae}))},_=u.image,J=N?.image??null;ee.useEffect(()=>{J!==null&&(_===null||_.pos!==J.pos||_.src!==J.src)&&T(null)},[J,_]);const $=(ae,Se)=>{const Ee=N;if(T(null),!t||!Ee)return;const Y=t.ctx.get(Vt);oG(Y,Ee.image,{src:Ee.src,alt:ae,title:Se}),Y.focus()},H=()=>{T(null),t?.ctx.get(Vt).focus()},ue=()=>{if(h(!1),!t)return;const ae=t.ctx.get(Vt);ae.focus(),hG(ae)};return O.jsxs("div",{style:BY,children:[O.jsxs("div",{style:FY,children:[O.jsx(Cn,{title:DY,onClick:()=>t&&KT(t,Gk),children:"↶"}),O.jsx(Cn,{title:IY,onClick:()=>t&&KT(t,Cg),children:"↷"}),O.jsx("span",{style:rm}),O.jsx(Cn,{active:u.bold,title:"Bold",onClick:()=>t?.action(Oi(n0.key)),style:{fontWeight:700},children:"B"}),O.jsx(Cn,{active:u.italic,title:"Italic",onClick:()=>t?.action(Oi(t0.key)),style:{fontStyle:"italic"},children:"I"}),O.jsx(Cn,{active:u.strikethrough,title:"Strikethrough",onClick:()=>t?.action(Oi(g0.key)),style:{textDecoration:"line-through"},children:"S"}),O.jsx("span",{style:rm}),O.jsx(Cn,{active:u.heading===2,title:"Heading 2",onClick:()=>t&&G1(t,2),children:"H2"}),O.jsx(Cn,{active:u.heading===3,title:"Heading 3",onClick:()=>t&&G1(t,3),children:"H3"}),O.jsx(Cn,{active:u.heading===4,title:"Heading 4",onClick:()=>t&&G1(t,4),children:"H4"}),O.jsx("span",{style:rm}),O.jsx(Cn,{active:u.bulletList,title:"Bullet list",onClick:()=>t&&GT(t,"bullet"),children:"• List"}),O.jsx(Cn,{active:u.orderedList,title:"Numbered list",onClick:()=>t&&GT(t,"ordered"),children:"1. List"}),F?O.jsxs("select",{title:"List style","aria-label":"List style",disabled:V||!K,value:L,onChange:ae=>{t&&_Y(t,ae.currentTarget.value||null)},style:{...PY,opacity:V||!K?.55:1,cursor:V||!K?"not-allowed":"default"},children:[O.jsx("option",{value:"",children:"Default"}),e?.map(ae=>O.jsx("option",{value:ae.class,children:ae.label},ae.class))]}):null,O.jsx(Cn,{active:u.blockquote,title:"Quote",onClick:()=>t&&RY(t),children:"❝"}),O.jsx(Cn,{title:"Insert table",onClick:()=>t?.action(Oi(jk.key,{row:3,col:3})),children:"▦ Table"}),O.jsx(Cn,{active:y,title:"Insert YouTube",onClick:()=>!V&&x(ae=>!ae),children:"YouTube"}),O.jsx("span",{style:rm}),O.jsx(Cn,{active:u.link||c,title:"Link",onClick:()=>!V&&h(ae=>!ae),children:"🔗 Link"}),n&&s?O.jsx(Cn,{title:"Insert image",onClick:()=>!V&&g("insert"),children:"🖼 Image"}):null,_?O.jsx(Cn,{active:N!==null,title:"Edit the alt text, caption or file of the selected image",onClick:()=>T({image:_,src:_.src}),children:"Edit image"}):null,a?O.jsxs(O.Fragment,{children:[O.jsx("span",{style:{flex:1}}),O.jsx(Cn,{title:"Insert component block",onClick:()=>!V&&a(),style:{border:"1px solid #d4d4d8",color:"#3f3f46"},children:"+ Component"})]}):null]}),c?O.jsx("div",{style:{padding:"0 6px"},children:O.jsx(_K,{initialUrl:u.linkHref??"https://",isEdit:u.link,onApply:C,onRemove:u.link?ue:void 0,onClose:()=>h(!1)})}):null,y?O.jsx("div",{style:{padding:"0 6px"},children:O.jsx(MY,{onApply:ae=>{x(!1),t&&LY(t,ae)},onClose:()=>x(!1)})}):null,N?O.jsx("div",{style:{padding:"0 6px"},children:O.jsx(zT,{mode:"edit",initialAlt:N.image.alt,initialCaption:N.image.title,previewSrc:_S(n,N.src,r),onReplace:n?()=>g("replace"):void 0,onApply:$,onClose:H},N.image.pos)}):null,k?O.jsx("div",{style:{padding:"0 6px"},children:O.jsx(zT,{mode:"insert",initialAlt:k.alt,initialCaption:"",previewSrc:_S(n,k.url,r),onApply:(ae,Se)=>{const{url:Ee}=k;w(null),t&&zY(t,Ee,ae,Se)},onClose:()=>w(null)})}):null,d&&n?O.jsx(W_,{media:n,context:r,field:i,accept:"image/*",onSelect:(ae,Se)=>{g(null),d==="replace"?T(Ee=>Ee&&{...Ee,src:ae}):t&&w({url:ae,alt:Se??""})},onClose:()=>g(null)}):null]})}function jY(){return{enter:{mdxFlowExpression:JY,mdxTextExpression:UY},exit:{mdxFlowExpression:YT,mdxFlowExpressionChunk:WT,mdxTextExpression:YT,mdxTextExpressionChunk:WT}}}function $Y(){return{handlers:{mdxFlowExpression:XT,mdxTextExpression:XT},unsafe:[{character:"{",inConstruct:["phrasing"]},{atBreak:!0,character:"{"}]}}function JY(t){this.enter({type:"mdxFlowExpression",value:""},t),this.buffer()}function UY(t){this.enter({type:"mdxTextExpression",value:""},t),this.buffer()}function YT(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 WT(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function XT(t,e,n){const r=t.value||"";return"{"+n.indentLines(r,function(s,a,u){return(a===0||u?"":" ")+s})+"}"}const l6=" ";function HY(){return{canContainEols:["mdxJsxTextElement"],enter:{mdxJsxFlowTag:r,mdxJsxFlowTagClosingMarker:i,mdxJsxFlowTagAttribute:g,mdxJsxFlowTagExpressionAttribute:y,mdxJsxFlowTagAttributeValueLiteral:t,mdxJsxFlowTagAttributeValueExpression:t,mdxJsxFlowTagSelfClosingMarker:a,mdxJsxTextTag:r,mdxJsxTextTagClosingMarker:i,mdxJsxTextTagAttribute:g,mdxJsxTextTagExpressionAttribute:y,mdxJsxTextTagAttributeValueLiteral:t,mdxJsxTextTagAttributeValueExpression:t,mdxJsxTextTagSelfClosingMarker:a},exit:{mdxJsxFlowTagClosingMarker:u,mdxJsxFlowTagNamePrimary:c,mdxJsxFlowTagNameMember:h,mdxJsxFlowTagNameLocal:d,mdxJsxFlowTagExpressionAttribute:x,mdxJsxFlowTagExpressionAttributeValue:n,mdxJsxFlowTagAttributeNamePrimary:k,mdxJsxFlowTagAttributeNameLocal:w,mdxJsxFlowTagAttributeValueLiteral:N,mdxJsxFlowTagAttributeValueLiteralValue:n,mdxJsxFlowTagAttributeValueExpression:T,mdxJsxFlowTagAttributeValueExpressionValue:n,mdxJsxFlowTagSelfClosingMarker:V,mdxJsxFlowTag:F,mdxJsxTextTagClosingMarker:u,mdxJsxTextTagNamePrimary:c,mdxJsxTextTagNameMember:h,mdxJsxTextTagNameLocal:d,mdxJsxTextTagExpressionAttribute:x,mdxJsxTextTagExpressionAttributeValue:n,mdxJsxTextTagAttributeNamePrimary:k,mdxJsxTextTagAttributeNameLocal:w,mdxJsxTextTagAttributeValueLiteral:N,mdxJsxTextTagAttributeValueLiteralValue:n,mdxJsxTextTagAttributeValueExpression:T,mdxJsxTextTagAttributeValueExpressionValue:n,mdxJsxTextTagSelfClosingMarker:V,mdxJsxTextTag:F}};function t(){this.buffer()}function e(_){return{line:_.line,column:_.column,offset:_.offset}}function n(_){this.config.enter.data.call(this,_),this.config.exit.data.call(this,_)}function r(_){const J={name:void 0,attributes:[],close:!1,selfClosing:!1,start:_.start,end:_.end};this.data.mdxJsxTagStack||(this.data.mdxJsxTagStack=[]),this.data.mdxJsxTag=J,this.buffer()}function i(_){if(this.data.mdxJsxTagStack.length===0)throw new bt("Unexpected closing slash `/` in tag, expected an open tag first",{start:_.start,end:_.end},"mdast-util-mdx-jsx:unexpected-closing-slash")}function s(_){if(this.data.mdxJsxTag.close)throw new bt("Unexpected attribute in closing tag, expected the end of the tag",{start:_.start,end:_.end},"mdast-util-mdx-jsx:unexpected-attribute")}function a(_){if(this.data.mdxJsxTag.close)throw new bt("Unexpected self-closing slash `/` in closing tag, expected the end of the tag",{start:_.start,end:_.end},"mdast-util-mdx-jsx:unexpected-self-closing-slash")}function u(){const _=this.data.mdxJsxTag;_.close=!0}function c(_){const J=this.data.mdxJsxTag;J.name=this.sliceSerialize(_)}function h(_){const J=this.data.mdxJsxTag;J.name+="."+this.sliceSerialize(_)}function d(_){const J=this.data.mdxJsxTag;J.name+=":"+this.sliceSerialize(_)}function g(_){const J=this.data.mdxJsxTag;s.call(this,_),J.attributes.push({type:"mdxJsxAttribute",name:"",value:null,position:{start:e(_.start),end:void 0}})}function y(_){const J=this.data.mdxJsxTag;s.call(this,_),J.attributes.push({type:"mdxJsxExpressionAttribute",value:"",position:{start:e(_.start),end:void 0}}),this.buffer()}function x(_){const J=this.data.mdxJsxTag,$=J.attributes[J.attributes.length-1];$.type;const H=_.estree;$.value=this.resume(),$.position,$.position.end=e(_.end),H&&($.data={estree:H})}function k(_){const J=this.data.mdxJsxTag,$=J.attributes[J.attributes.length-1];$.type,$.name=this.sliceSerialize(_),$.position,$.position.end=e(_.end)}function w(_){const J=this.data.mdxJsxTag,$=J.attributes[J.attributes.length-1];$.type,$.name+=":"+this.sliceSerialize(_),$.position,$.position.end=e(_.end)}function N(_){const J=this.data.mdxJsxTag,$=J.attributes[J.attributes.length-1];$.value=y0(this.resume(),{nonTerminated:!1}),$.position,$.position.end=e(_.end)}function T(_){const J=this.data.mdxJsxTag,$=J.attributes[J.attributes.length-1];$.type;const H={type:"mdxJsxAttributeValueExpression",value:this.resume()},ue=_.estree;ue&&(H.data={estree:ue}),$.value=H,$.position,$.position.end=e(_.end)}function V(){const _=this.data.mdxJsxTag;_.selfClosing=!0}function F(_){const J=this.data.mdxJsxTag,$=this.data.mdxJsxTagStack,H=$[$.length-1];if(J.close&&H.name!==J.name)throw new bt("Unexpected closing tag `"+C(J)+"`, expected corresponding closing tag for `"+C(H)+"` ("+Ls(H)+")",{start:_.start,end:_.end},"mdast-util-mdx-jsx:end-tag-mismatch");this.resume(),J.close?$.pop():this.enter({type:_.type==="mdxJsxTextTag"?"mdxJsxTextElement":"mdxJsxFlowElement",name:J.name||null,attributes:J.attributes,children:[]},_,K),J.selfClosing||J.close?this.exit(_,L):$.push(J)}function K(_,J){const $=this.data.mdxJsxTagStack,H=$[$.length-1],ue=_?" before the end of `"+_.type+"`":"",ae=_?{start:_.start,end:_.end}:void 0;throw new bt("Expected a closing tag for `"+C(H)+"` ("+Ls({start:J.start,end:J.end})+")"+ue,ae,"mdast-util-mdx-jsx:end-tag-mismatch")}function L(_,J){const $=this.data.mdxJsxTag;throw new bt("Expected the closing tag `"+C($)+"` either after the end of `"+J.type+"` ("+Ls(J.end)+") or another opening tag after the start of `"+J.type+"` ("+Ls(J.start)+")",{start:_.start,end:_.end},"mdast-util-mdx-jsx:end-tag-mismatch")}function C(_){return"<"+(_.close?"/":"")+(_.name||"")+">"}}function qY(t){const e=t||{},n=e.quote||'"',r=e.quoteSmart||!1,i=e.tightSelfClosing||!1,s=e.printWidth||Number.POSITIVE_INFINITY,a=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize attribute values with `"+n+"` for `options.quote`, expected `\"`, or `'`");return u.peek=GY,{handlers:{mdxJsxFlowElement:u,mdxJsxTextElement:u},unsafe:[{character:"<",inConstruct:["phrasing"]},{atBreak:!0,character:"<"}],fences:!0,resourceLink:!0};function u(c,h,d,g){const y=c.type==="mdxJsxFlowElement",x=c.name?!c.children||c.children.length===0:!1,k=u6(d),w=c6(k),N=d.createTracker(g),T=d.createTracker(g),V=[],F=(y?w:"")+"<"+(c.name||""),K=d.enter(c.type);if(N.move(F),T.move(F),c.attributes&&c.attributes.length>0){if(!c.name)throw new Error("Cannot serialize fragment w/ attributes");let $=-1;for(;++$<c.attributes.length;){const H=c.attributes[$];let ue;if(H.type==="mdxJsxExpressionAttribute")ue="{"+(H.value||"")+"}";else{if(!H.name)throw new Error("Cannot serialize attribute w/o name");const ae=H.value,Se=H.name;let Ee="";if(ae!=null)if(typeof ae=="object")Ee="{"+(ae.value||"")+"}";else{const Y=r&&bg(ae,n)>bg(ae,a)?a:n;Ee=Y+MG(ae,{subset:[Y]})+Y}ue=Se+(Ee?"=":"")+Ee}V.push(ue)}}let L=!1;const C=V.join(" ");y&&(/\r?\n|\r/.test(C)||N.current().now.column+C.length+(x?i?2:3:1)>s)&&(L=!0);let _=N,J=F;if(L){_=T;let $=-1;for(;++$<V.length;)V[$]=w+l6+V[$];J+=_.move(`
61
+ `+V.join(`
62
+ `)+`
63
+ `+w)}else C&&(J+=_.move(" "+C));return x&&(J+=_.move((i||L?"":" ")+"/")),J+=_.move(">"),c.children&&c.children.length>0&&(c.type==="mdxJsxTextElement"?J+=_.move(d.containerPhrasing(c,{..._.current(),before:">",after:"<"})):(_.shift(2),J+=_.move(`
64
+ `),J+=_.move(KY(c,d,_.current())),J+=_.move(`
65
+ `))),x||(J+=_.move((y?w:"")+"</"+(c.name||"")+">")),K(),J}}function KY(t,e,n){const r=e.indexStack,i=t.children,s=e.createTracker(n),a=c6(u6(e)),u=[];let c=-1;for(r.push(-1);++c<i.length;){const h=i[c];r[r.length-1]=c;const d={before:`
66
+ `,after:`
67
+ `,...s.current()},g=e.handle(h,t,e,d),y=h.type==="mdxJsxFlowElement"?g:e.indentLines(g,function(x,k,w){return(w?"":a)+x});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 u6(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 c6(t){return l6.repeat(t)}function GY(){return"<"}function YY(){return{enter:{mdxjsEsm:XY},exit:{mdxjsEsm:QY,mdxjsEsmData:ZY}}}function WY(){return{handlers:{mdxjsEsm:eW}}}function XY(t){this.enter({type:"mdxjsEsm",value:""},t),this.buffer()}function QY(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 ZY(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function eW(t){return t.value||""}function tW(){return[jY(),HY(),YY()]}function nW(t){return{extensions:[$Y(),qY(t),WY()]}}var rW=[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],f6=[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],iW="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",h6="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Y1={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"},W1="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",sW={5:W1,"5module":W1+" export import",6:W1+" const class extends export import super"},aW=/^in(stanceof)?$/,oW=new RegExp("["+h6+"]"),lW=new RegExp("["+h6+iW+"]");function BS(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 es(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&oW.test(String.fromCharCode(t)):e===!1?!1:BS(t,f6)}function eo(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&&lW.test(String.fromCharCode(t)):e===!1?!1:BS(t,f6)||BS(t,rW)}var dt=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 ei(t,e){return new dt(t,{beforeExpr:!0,binop:e})}var ti={beforeExpr:!0},kr={startsExpr:!0},tC={};function ft(t,e){return e===void 0&&(e={}),e.keyword=t,tC[t]=new dt(t,e)}var R={num:new dt("num",kr),regexp:new dt("regexp",kr),string:new dt("string",kr),name:new dt("name",kr),privateId:new dt("privateId",kr),eof:new dt("eof"),bracketL:new dt("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new dt("]"),braceL:new dt("{",{beforeExpr:!0,startsExpr:!0}),braceR:new dt("}"),parenL:new dt("(",{beforeExpr:!0,startsExpr:!0}),parenR:new dt(")"),comma:new dt(",",ti),semi:new dt(";",ti),colon:new dt(":",ti),dot:new dt("."),question:new dt("?",ti),questionDot:new dt("?."),arrow:new dt("=>",ti),template:new dt("template"),invalidTemplate:new dt("invalidTemplate"),ellipsis:new dt("...",ti),backQuote:new dt("`",kr),dollarBraceL:new dt("${",{beforeExpr:!0,startsExpr:!0}),eq:new dt("=",{beforeExpr:!0,isAssign:!0}),assign:new dt("_=",{beforeExpr:!0,isAssign:!0}),incDec:new dt("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new dt("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:ei("||",1),logicalAND:ei("&&",2),bitwiseOR:ei("|",3),bitwiseXOR:ei("^",4),bitwiseAND:ei("&",5),equality:ei("==/!=/===/!==",6),relational:ei("</>/<=/>=",7),bitShift:ei("<</>>/>>>",8),plusMin:new dt("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ei("%",10),star:ei("*",10),slash:ei("/",10),starstar:new dt("**",{beforeExpr:!0}),coalesce:ei("??",1),_break:ft("break"),_case:ft("case",ti),_catch:ft("catch"),_continue:ft("continue"),_debugger:ft("debugger"),_default:ft("default",ti),_do:ft("do",{isLoop:!0,beforeExpr:!0}),_else:ft("else",ti),_finally:ft("finally"),_for:ft("for",{isLoop:!0}),_function:ft("function",kr),_if:ft("if"),_return:ft("return",ti),_switch:ft("switch"),_throw:ft("throw",ti),_try:ft("try"),_var:ft("var"),_const:ft("const"),_while:ft("while",{isLoop:!0}),_with:ft("with"),_new:ft("new",{beforeExpr:!0,startsExpr:!0}),_this:ft("this",kr),_super:ft("super",kr),_class:ft("class",kr),_extends:ft("extends",ti),_export:ft("export"),_import:ft("import",kr),_null:ft("null",kr),_true:ft("true",kr),_false:ft("false",kr),_in:ft("in",{beforeExpr:!0,binop:7}),_instanceof:ft("instanceof",{beforeExpr:!0,binop:7}),_typeof:ft("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:ft("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:ft("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},Er=/\r\n?|\n|\u2028|\u2029/,uW=new RegExp(Er.source,"g");function lc(t){return t===10||t===13||t===8232||t===8233}function p6(t,e,n){n===void 0&&(n=t.length);for(var r=e;r<n;r++){var i=t.charCodeAt(r);if(lc(i))return r<n-1&&i===13&&t.charCodeAt(r+1)===10?r+2:r+1}return-1}var d6=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Rn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,m6=Object.prototype,cW=m6.hasOwnProperty,fW=m6.toString,uc=Object.hasOwn||(function(t,e){return cW.call(t,e)}),QT=Array.isArray||(function(t){return fW.call(t)==="[object Array]"}),ZT=Object.create(null);function Ua(t){return ZT[t]||(ZT[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function Us(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var hW=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Qh=function(e,n){this.line=e,this.column=n};Qh.prototype.offset=function(e){return new Qh(this.line,this.column+e)};var x0=function(e,n,r){this.start=n,this.end=r,e.sourceFile!==null&&(this.source=e.sourceFile)};function g6(t,e){for(var n=1,r=0;;){var i=p6(t,r,e);if(i<0)return new Qh(n,e-r);++n,r=i}}var FS={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},eM=!1;function pW(t){var e={};for(var n in FS)e[n]=t&&uc(t,n)?t[n]:FS[n];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!eM&&typeof console=="object"&&console.warn&&(eM=!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),QT(e.onToken)){var r=e.onToken;e.onToken=function(i){return r.push(i)}}return QT(e.onComment)&&(e.onComment=dW(e,e.onComment)),e}function dW(t,e){return function(n,r,i,s,a,u){var c={type:n?"Block":"Line",value:r,start:i,end:s};t.locations&&(c.loc=new x0(this,a,u)),t.ranges&&(c.range=[i,s]),e.push(c)}}var Zh=1,cc=2,nC=4,y6=8,rC=16,x6=32,b0=64,b6=128,Dl=256,Op=512,S0=Zh|cc|Dl;function iC(t,e){return cc|(t?nC:0)|(e?y6:0)}var Ag=0,sC=1,Xs=2,S6=3,v6=4,k6=5,sn=function(e,n,r){this.options=e=pW(e),this.sourceFile=e.sourceFile,this.keywords=Ua(sW[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var i="";e.allowReserved!==!0&&(i=Y1[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(i+=" await")),this.reservedWords=Ua(i);var s=(i?i+" ":"")+Y1.strict;this.reservedWordsStrict=Ua(s),this.reservedWordsStrictBind=Ua(s+" "+Y1.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(Er).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=R.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(Zh),this.regexpState=null,this.privateNameStack=[]},ss={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}};sn.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};ss.inFunction.get=function(){return(this.currentVarScope().flags&cc)>0};ss.inGenerator.get=function(){return(this.currentVarScope().flags&y6)>0};ss.inAsync.get=function(){return(this.currentVarScope().flags&nC)>0};ss.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(Dl|Op))return!1;if(n&cc)return(n&nC)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};ss.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&b0)>0||this.options.allowSuperOutsideMethod};ss.allowDirectSuper.get=function(){return(this.currentThisScope().flags&b6)>0};ss.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};ss.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(Dl|Op)||n&cc&&!(n&rC))return!0}return!1};ss.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Dl)>0};sn.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};sn.parse=function(e,n){return new this(n,e).parse()};sn.parseExpressionAt=function(e,n,r){var i=new this(r,e,n);return i.nextToken(),i.parseExpression()};sn.tokenizer=function(e,n){return new this(n,e)};Object.defineProperties(sn.prototype,ss);var cr=sn.prototype,mW=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;cr.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){Rn.lastIndex=t,t+=Rn.exec(this.input)[0].length;var e=mW.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){Rn.lastIndex=t+e[0].length;var n=Rn.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===";"||i==="}"||Er.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i==="!"&&this.input.charAt(r+1)==="=")}t+=e[0].length,Rn.lastIndex=t,t+=Rn.exec(this.input)[0].length,this.input[t]===";"&&t++}};cr.eat=function(t){return this.type===t?(this.next(),!0):!1};cr.isContextual=function(t){return this.type===R.name&&this.value===t&&!this.containsEsc};cr.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};cr.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};cr.canInsertSemicolon=function(){return this.type===R.eof||this.type===R.braceR||Er.test(this.input.slice(this.lastTokEnd,this.start))};cr.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};cr.semicolon=function(){!this.eat(R.semi)&&!this.insertSemicolon()&&this.unexpected()};cr.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};cr.expect=function(t){this.eat(t)||this.unexpected()};cr.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var v0=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};cr.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")}};cr.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")};cr.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")};cr.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var De=sn.prototype;De.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==R.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 aC={kind:"loop"},gW={kind:"switch"};De.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;Rn.lastIndex=this.pos;var e=Rn.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(es(r,!0)){for(var i=n+1;eo(r=this.input.charCodeAt(i),!0);)++i;if(r===92||r>55295&&r<56320)return!0;var s=this.input.slice(n,i);if(!aW.test(s))return!0}return!1};De.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;Rn.lastIndex=this.pos;var t=Rn.exec(this.input),e=this.pos+t[0].length,n;return!Er.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(eo(n=this.input.charCodeAt(e+8))||n>55295&&n<56320))};De.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;Rn.lastIndex=this.pos;var n=Rn.exec(this.input),r=this.pos+n[0].length;if(Er.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||eo(s=this.input.charCodeAt(i))||s>55295&&s<56320)return!1;Rn.lastIndex=i;var a=Rn.exec(this.input);if(a&&Er.test(this.input.slice(i,i+a[0].length)))return!1}if(e){var u=r+2,c;if(this.input.slice(r,u)==="of"&&(u===this.input.length||!eo(c=this.input.charCodeAt(u))&&!(c>55295&&c<56320)))return!1}var h=this.input.charCodeAt(r);return es(h,!0)||h===92};De.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)};De.isUsing=function(t){return this.isUsingKeyword(!1,t)};De.parseStatement=function(t,e,n){var r=this.type,i=this.startNode(),s;switch(this.isLet(t)&&(r=R._var,s="let"),r){case R._break:case R._continue:return this.parseBreakContinueStatement(i,r.keyword);case R._debugger:return this.parseDebuggerStatement(i);case R._do:return this.parseDoStatement(i);case R._for:return this.parseForStatement(i);case R._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!t);case R._class:return t&&this.unexpected(),this.parseClass(i,!0);case R._if:return this.parseIfStatement(i);case R._return:return this.parseReturnStatement(i);case R._switch:return this.parseSwitchStatement(i);case R._throw:return this.parseThrowStatement(i);case R._try:return this.parseTryStatement(i);case R._const:case R._var:return s=s||this.value,t&&s!=="var"&&this.unexpected(),this.parseVarStatement(i,s);case R._while:return this.parseWhileStatement(i);case R._with:return this.parseWithStatement(i);case R.braceL:return this.parseBlock(!0,i);case R.semi:return this.parseEmptyStatement(i);case R._export:case R._import:if(this.options.ecmaVersion>10&&r===R._import){Rn.lastIndex=this.pos;var a=Rn.exec(this.input),u=this.pos+a[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===R._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 d=this.value,g=this.parseExpression();return r===R.name&&g.type==="Identifier"&&this.eat(R.colon)?this.parseLabeledStatement(i,d,g,t):this.parseExpressionStatement(i,g)}};De.parseBreakContinueStatement=function(t,e){var n=e==="break";this.next(),this.eat(R.semi)||this.insertSemicolon()?t.label=null:this.type!==R.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")};De.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};De.parseDoStatement=function(t){return this.next(),this.labels.push(aC),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(R._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(R.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};De.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(aC),this.enterScope(0),this.expect(R.parenL),this.type===R.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var n=this.isLet();if(this.type===R._var||this.type===R._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"),a=!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,d=new v0,g=this.start,y=e>-1?this.parseExprSubscripts(d,"await"):this.parseExpression(!0,d);return this.type===R._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===R._in&&this.unexpected(e),t.await=!0):a&&this.options.ecmaVersion>=8&&(y.start===g&&!h&&y.type==="Identifier"&&y.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(t.await=!1)),s&&a&&this.raise(y.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(y,!1,d),this.checkLValPattern(y),this.parseForIn(t,y)):(this.checkExpressionErrors(d,!0),e>-1&&this.unexpected(e),this.parseFor(t,y))};De.parseForAfterInit=function(t,e,n){return(this.type===R._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&e.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===R._in?n>-1&&this.unexpected(n):t.await=n>-1),this.parseForIn(t,e)):(n>-1&&this.unexpected(n),this.parseFor(t,e))};De.parseFunctionStatement=function(t,e,n){return this.next(),this.parseFunction(t,wh|(n?0:VS),!1,e)};De.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(R._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};De.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(R.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};De.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(R.braceL),this.labels.push(gW),this.enterScope(0);for(var e,n=!1;this.type!==R.braceR;)if(this.type===R._case||this.type===R._default){var r=this.type===R._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(R.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")};De.parseThrowStatement=function(t){return this.next(),Er.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 yW=[];De.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?x6:0),this.checkLValPattern(t,e?v6:Xs),this.expect(R.parenR),t};De.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===R._catch){var e=this.startNode();this.next(),this.eat(R.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(R._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};De.parseVarStatement=function(t,e,n){return this.next(),this.parseVar(t,!1,e,n),this.semicolon(),this.finishNode(t,"VariableDeclaration")};De.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(aC),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};De.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")};De.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};De.parseLabeledStatement=function(t,e,n,r){for(var i=0,s=this.labels;i<s.length;i+=1){var a=s[i];a.name===e&&this.raise(n.start,"Label '"+e+"' is already declared")}for(var u=this.type.isLoop?"loop":this.type===R._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")};De.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};De.parseBlock=function(t,e,n){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(R.braceL),t&&this.enterScope(0);this.type!==R.braceR;){var r=this.parseStatement(null);e.body.push(r)}return n&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};De.parseFor=function(t,e){return t.init=e,this.expect(R.semi),t.test=this.type===R.semi?null:this.parseExpression(),this.expect(R.semi),t.update=this.type===R.parenR?null:this.parseExpression(),this.expect(R.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};De.parseForIn=function(t,e){var n=this.type===R._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(R.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,n?"ForInStatement":"ForOfStatement")};De.parseVar=function(t,e,n,r){for(t.declarations=[],t.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(R.eq)?i.init=this.parseMaybeAssign(e):!r&&n==="const"&&!(this.type===R._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&(n==="using"||n==="await using")&&this.options.ecmaVersion>=17&&this.type!==R._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+n+" declaration"):!r&&i.id.type!=="Identifier"&&!(e&&(this.type===R._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(R.comma))break}return t};De.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?sC:Xs,!1)};var wh=1,VS=2,C6=4;De.parseFunction=function(t,e,n,r,i){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===R.star&&e&VS&&this.unexpected(),t.generator=this.eat(R.star)),this.options.ecmaVersion>=8&&(t.async=!!r),e&wh&&(t.id=e&C6&&this.type!==R.name?null:this.parseIdent(),t.id&&!(e&VS)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?sC:Xs:S6));var s=this.yieldPos,a=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(iC(t.async,t.generator)),e&wh||(t.id=this.type===R.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,n,!1,i),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=u,this.finishNode(t,e&wh?"FunctionDeclaration":"FunctionExpression")};De.parseFunctionParams=function(t){this.expect(R.parenL),t.params=this.parseBindingList(R.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};De.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(R.braceL);this.type!==R.braceR;){var a=this.parseClassElement(t.superClass!==null);a&&(i.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(s&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),s=!0):a.key&&a.key.type==="PrivateIdentifier"&&xW(r,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.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")};De.parseClassElement=function(t){if(this.eat(R.semi))return null;var e=this.options.ecmaVersion,n=this.startNode(),r="",i=!1,s=!1,a="method",u=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(R.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===R.star?u=!0:r="static"}if(n.static=u,!r&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===R.star)&&!this.canInsertSemicolon()?s=!0:r="async"),!r&&(e>=9||!s)&&this.eat(R.star)&&(i=!0),!r&&!s&&!i){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=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===R.parenL||a!=="method"||i||s){var h=!n.static&&Ng(n,"constructor"),d=h&&t;h&&a!=="method"&&this.raise(n.key.start,"Constructor can't have get/set modifier"),n.kind=h?"constructor":a,this.parseClassMethod(n,i,s,d)}else this.parseClassField(n);return n};De.isClassElementNameStart=function(){return this.type===R.name||this.type===R.privateId||this.type===R.num||this.type===R.string||this.type===R.bracketL||this.type.keyword};De.parseClassElementName=function(t){this.type===R.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)};De.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&&Ng(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")};De.parseClassField=function(t){return Ng(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&Ng(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(R.eq)?(this.enterScope(Op|b0),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};De.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(Dl|b0);this.type!==R.braceR;){var n=this.parseStatement(null);t.body.push(n)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};De.parseClassId=function(t,e){this.type===R.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,Xs,!1)):(e===!0&&this.unexpected(),t.id=null)};De.parseClassSuper=function(t){t.superClass=this.eat(R._extends)?this.parseExprSubscripts(null,!1):null};De.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};De.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 a=n[s];uc(e,a.name)||(i?i.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}};function xW(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 Ng(t,e){var n=t.computed,r=t.key;return!n&&(r.type==="Identifier"&&r.name===e||r.type==="Literal"&&r.value===e)}De.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!==R.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};De.parseExport=function(t,e){if(this.next(),this.eat(R.star))return this.parseExportAllDeclaration(t,e);if(this.eat(R._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!==R.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")};De.parseExportDeclaration=function(t){return this.parseStatement(null)};De.parseExportDefaultDeclaration=function(){var t;if(this.type===R._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,wh|C6,!1,t)}else if(this.type===R._class){var n=this.startNode();return this.parseClass(n,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};De.checkExport=function(t,e,n){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),uc(t,e)&&this.raiseRecoverable(n,"Duplicate export '"+e+"'"),t[e]=!0)};De.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 a=0,u=e.elements;a<u.length;a+=1){var c=u[a];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)};De.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)}};De.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};De.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")};De.parseExportSpecifiers=function(t){var e=[],n=!0;for(this.expect(R.braceL);!this.eat(R.braceR);){if(n)n=!1;else if(this.expect(R.comma),this.afterTrailingComma(R.braceR))break;e.push(this.parseExportSpecifier(t))}return e};De.parseImport=function(t){return this.next(),this.type===R.string?(t.specifiers=yW,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===R.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};De.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,Xs),this.finishNode(t,"ImportSpecifier")};De.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,Xs),this.finishNode(t,"ImportDefaultSpecifier")};De.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,Xs),this.finishNode(t,"ImportNamespaceSpecifier")};De.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===R.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(R.comma)))return t;if(this.type===R.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(R.braceL);!this.eat(R.braceR);){if(e)e=!1;else if(this.expect(R.comma),this.afterTrailingComma(R.braceR))break;t.push(this.parseImportSpecifier())}return t};De.parseWithClause=function(){var t=[];if(!this.eat(R._with))return t;this.expect(R.braceL);for(var e={},n=!0;!this.eat(R.braceR);){if(n)n=!1;else if(this.expect(R.comma),this.afterTrailingComma(R.braceR))break;var r=this.parseImportAttribute(),i=r.key.type==="Identifier"?r.key.name:r.key.value;uc(e,i)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+i+"'"),e[i]=!0,t.push(r)}return t};De.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===R.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(R.colon),this.type!==R.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")};De.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===R.string){var t=this.parseLiteral(this.value);return hW.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)};De.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)};De.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 xi=sn.prototype;xi.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};xi.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};xi.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};xi.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==R.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};xi.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case R.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(R.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case R.braceL:return this.parseObj(!0)}return this.parseIdent()};xi.parseBindingList=function(t,e,n,r){for(var i=[],s=!0;!this.eat(t);)if(s?s=!1:this.expect(R.comma),e&&this.type===R.comma)i.push(null);else{if(n&&this.afterTrailingComma(t))break;if(this.type===R.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),i.push(a),this.type===R.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};xi.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};xi.parseBindingListItem=function(t){return t};xi.parseMaybeDefault=function(t,e,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(R.eq))return n;var r=this.startNodeAt(t,e);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};xi.checkLValSimple=function(t,e,n){e===void 0&&(e=Ag);var r=e!==Ag;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===Xs&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),n&&(uc(n,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),n[t.name]=!0),e!==k6&&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")}};xi.checkLValPattern=function(t,e,n){switch(e===void 0&&(e=Ag),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 a=0,u=t.elements;a<u.length;a+=1){var c=u[a];c&&this.checkLValInnerPattern(c,e,n)}break;default:this.checkLValSimple(t,e,n)}};xi.checkLValInnerPattern=function(t,e,n){switch(e===void 0&&(e=Ag),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 Mi=function(e,n,r,i,s){this.token=e,this.isExpr=!!n,this.preserveSpace=!!r,this.override=i,this.generator=!!s},Ft={b_stat:new Mi("{",!1),b_expr:new Mi("{",!0),b_tmpl:new Mi("${",!1),p_stat:new Mi("(",!1),p_expr:new Mi("(",!0),q_tmpl:new Mi("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new Mi("function",!1),f_expr:new Mi("function",!0),f_expr_gen:new Mi("function",!0,!1,null,!0),f_gen:new Mi("function",!1,!1,null,!0)},fc=sn.prototype;fc.initialContext=function(){return[Ft.b_stat]};fc.curContext=function(){return this.context[this.context.length-1]};fc.braceIsBlock=function(t){var e=this.curContext();return e===Ft.f_expr||e===Ft.f_stat?!0:t===R.colon&&(e===Ft.b_stat||e===Ft.b_expr)?!e.isExpr:t===R._return||t===R.name&&this.exprAllowed?Er.test(this.input.slice(this.lastTokEnd,this.start)):t===R._else||t===R.semi||t===R.eof||t===R.parenR||t===R.arrow?!0:t===R.braceL?e===Ft.b_stat:t===R._var||t===R._const||t===R.name?!1:!this.exprAllowed};fc.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};fc.updateContext=function(t){var e,n=this.type;n.keyword&&t===R.dot?this.exprAllowed=!1:(e=n.updateContext)?e.call(this,t):this.exprAllowed=n.beforeExpr};fc.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};R.parenR.updateContext=R.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var t=this.context.pop();t===Ft.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};R.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?Ft.b_stat:Ft.b_expr),this.exprAllowed=!0};R.dollarBraceL.updateContext=function(){this.context.push(Ft.b_tmpl),this.exprAllowed=!0};R.parenL.updateContext=function(t){var e=t===R._if||t===R._for||t===R._with||t===R._while;this.context.push(e?Ft.p_stat:Ft.p_expr),this.exprAllowed=!0};R.incDec.updateContext=function(){};R._function.updateContext=R._class.updateContext=function(t){t.beforeExpr&&t!==R._else&&!(t===R.semi&&this.curContext()!==Ft.p_stat)&&!(t===R._return&&Er.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===R.colon||t===R.braceL)&&this.curContext()===Ft.b_stat)?this.context.push(Ft.f_expr):this.context.push(Ft.f_stat),this.exprAllowed=!1};R.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};R.backQuote.updateContext=function(){this.curContext()===Ft.q_tmpl?this.context.pop():this.context.push(Ft.q_tmpl),this.exprAllowed=!1};R.star.updateContext=function(t){if(t===R._function){var e=this.context.length-1;this.context[e]===Ft.f_expr?this.context[e]=Ft.f_expr_gen:this.context[e]=Ft.f_gen}this.exprAllowed=!0};R.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==R.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var Ge=sn.prototype;Ge.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 a=e[i];if(a){var u;s==="init"?u=this.strict&&a.init||a.get||a.set:u=a.init||a[s],u&&this.raiseRecoverable(r.start,"Redefinition of property")}else a=e[i]={init:!1,get:!1,set:!1};a[s]=!0}};Ge.parseExpression=function(t,e){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(t,e);if(this.type===R.comma){var s=this.startNodeAt(n,r);for(s.expressions=[i];this.eat(R.comma);)s.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(s,"SequenceExpression")}return i};Ge.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,a=-1;e?(i=e.parenthesizedAssign,s=e.trailingComma,a=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new v0,r=!0);var u=this.start,c=this.startLoc;(this.type===R.parenL||this.type===R.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 d=this.startNodeAt(u,c);return d.operator=this.value,this.type===R.eq&&(h=this.toAssignable(h,!1,e)),r||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=h.start&&(e.shorthandAssign=-1),this.type===R.eq?this.checkLValPattern(h):this.checkLValSimple(h),d.left=h,this.next(),d.right=this.parseMaybeAssign(t),a>-1&&(e.doubleProto=a),this.finishNode(d,"AssignmentExpression")}else r&&this.checkExpressionErrors(e,!0);return i>-1&&(e.parenthesizedAssign=i),s>-1&&(e.trailingComma=s),h};Ge.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(R.question)){var s=this.startNodeAt(n,r);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(R.colon),s.alternate=this.parseMaybeAssign(t),this.finishNode(s,"ConditionalExpression")}return i};Ge.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)};Ge.parseExprOp=function(t,e,n,r,i){var s=this.type.binop;if(s!=null&&(!i||this.type!==R._in)&&s>r){var a=this.type===R.logicalOR||this.type===R.logicalAND,u=this.type===R.coalesce;u&&(s=R.logicalAND.binop);var c=this.value;this.next();var h=this.start,d=this.startLoc,g=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),h,d,s,i),y=this.buildBinary(e,n,t,g,c,a||u);return(a&&this.type===R.coalesce||u&&(this.type===R.logicalOR||this.type===R.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};Ge.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 a=this.startNodeAt(t,e);return a.left=n,a.operator=i,a.right=r,this.finishNode(a,s?"LogicalExpression":"BinaryExpression")};Ge.parseMaybeUnary=function(t,e,n,r){var i=this.start,s=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(r),e=!0;else if(this.type.prefix){var u=this.startNode(),c=this.type===R.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"&&w6(u.argument)?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&PS(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):e=!0,a=this.finishNode(u,c?"UpdateExpression":"UnaryExpression")}else if(!e&&this.type===R.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==R._in&&this.unexpected();else{if(a=this.parseExprSubscripts(t,r),this.checkExpressionErrors(t))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(i,s);h.operator=this.value,h.prefix=!1,h.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(h,"UpdateExpression")}}if(!n&&this.eat(R.starstar))if(e)this.unexpected(this.lastTokStart);else return this.buildBinary(i,s,a,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return a};function w6(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&w6(t.expression)}function PS(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&PS(t.expression)||t.type==="ParenthesizedExpression"&&PS(t.expression)}Ge.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};Ge.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,a=!1;;){var u=this.parseSubscript(t,e,n,r,s,a,i);if(u.optional&&(a=!0),u===t||u.type==="ArrowFunctionExpression"){if(a){var c=this.startNodeAt(e,n);c.expression=u,u=this.finishNode(c,"ChainExpression")}return u}t=u}};Ge.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(R.arrow)};Ge.parseSubscriptAsyncArrow=function(t,e,n,r){return this.parseArrowExpression(this.startNodeAt(t,e),n,!0,r)};Ge.parseSubscript=function(t,e,n,r,i,s,a){var u=this.options.ecmaVersion>=11,c=u&&this.eat(R.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(R.bracketL);if(h||c&&this.type!==R.parenL&&this.type!==R.backQuote||this.eat(R.dot)){var d=this.startNodeAt(e,n);d.object=t,h?(d.property=this.parseExpression(),this.expect(R.bracketR)):this.type===R.privateId&&t.type!=="Super"?d.property=this.parsePrivateIdent():d.property=this.parseIdent(this.options.allowReserved!=="never"),d.computed=!!h,u&&(d.optional=c),t=this.finishNode(d,"MemberExpression")}else if(!r&&this.eat(R.parenL)){var g=new v0,y=this.yieldPos,x=this.awaitPos,k=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var w=this.parseExprList(R.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=x,this.awaitIdentPos=k,this.parseSubscriptAsyncArrow(e,n,w,a);this.checkExpressionErrors(g,!0),this.yieldPos=y||this.yieldPos,this.awaitPos=x||this.awaitPos,this.awaitIdentPos=k||this.awaitIdentPos;var N=this.startNodeAt(e,n);N.callee=t,N.arguments=w,u&&(N.optional=c),t=this.finishNode(N,"CallExpression")}else if(this.type===R.backQuote){(c||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var T=this.startNodeAt(e,n);T.tag=t,T.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(T,"TaggedTemplateExpression")}return t};Ge.parseExprAtom=function(t,e,n){this.type===R.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case R._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===R.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==R.dot&&this.type!==R.bracketL&&this.type!==R.parenL&&this.unexpected(),this.finishNode(r,"Super");case R._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case R.name:var s=this.start,a=this.startLoc,u=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!u&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(R._function))return this.overrideContext(Ft.f_expr),this.parseFunction(this.startNodeAt(s,a),0,!1,!0,e);if(i&&!this.canInsertSemicolon()){if(this.eat(R.arrow))return this.parseArrowExpression(this.startNodeAt(s,a),[c],!1,e);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===R.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(R.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,a),[c],!0,e)}return c;case R.regexp:var h=this.value;return r=this.parseLiteral(h.value),r.regex={pattern:h.pattern,flags:h.flags},r;case R.num:case R.string:return this.parseLiteral(this.value);case R._null:case R._true:case R._false:return r=this.startNode(),r.value=this.type===R._null?null:this.type===R._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case R.parenL:var d=this.start,g=this.parseParenAndDistinguishExpression(i,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(g)&&(t.parenthesizedAssign=d),t.parenthesizedBind<0&&(t.parenthesizedBind=d)),g;case R.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(R.bracketR,!0,!0,t),this.finishNode(r,"ArrayExpression");case R.braceL:return this.overrideContext(Ft.b_expr),this.parseObj(!1,t);case R._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case R._class:return this.parseClass(this.startNode(),!1);case R._new:return this.parseNew();case R.backQuote:return this.parseTemplate();case R._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}};Ge.parseExprAtomDefault=function(){this.unexpected()};Ge.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===R.parenL&&!t)return this.parseDynamicImport(e);if(this.type===R.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()};Ge.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(R.parenR)?t.options=null:(this.expect(R.comma),this.afterTrailingComma(R.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(R.parenR)||(this.expect(R.comma),this.afterTrailingComma(R.parenR)||this.unexpected())));else if(!this.eat(R.parenR)){var e=this.start;this.eat(R.comma)&&this.eat(R.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};Ge.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")};Ge.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")};Ge.parseParenExpression=function(){this.expect(R.parenL);var t=this.parseExpression();return this.expect(R.parenR),t};Ge.shouldParseArrow=function(t){return!this.canInsertSemicolon()};Ge.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 a=this.start,u=this.startLoc,c=[],h=!0,d=!1,g=new v0,y=this.yieldPos,x=this.awaitPos,k;for(this.yieldPos=0,this.awaitPos=0;this.type!==R.parenR;)if(h?h=!1:this.expect(R.comma),s&&this.afterTrailingComma(R.parenR,!0)){d=!0;break}else if(this.type===R.ellipsis){k=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===R.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,g,this.parseParenItem));var w=this.lastTokEnd,N=this.lastTokEndLoc;if(this.expect(R.parenR),t&&this.shouldParseArrow(c)&&this.eat(R.arrow))return this.checkPatternErrors(g,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=y,this.awaitPos=x,this.parseParenArrowList(n,r,c,e);(!c.length||d)&&this.unexpected(this.lastTokStart),k&&this.unexpected(k),this.checkExpressionErrors(g,!0),this.yieldPos=y||this.yieldPos,this.awaitPos=x||this.awaitPos,c.length>1?(i=this.startNodeAt(a,u),i.expressions=c,this.finishNodeAt(i,"SequenceExpression",w,N)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var T=this.startNodeAt(n,r);return T.expression=i,this.finishNode(T,"ParenthesizedExpression")}else return i};Ge.parseParenItem=function(t){return t};Ge.parseParenArrowList=function(t,e,n,r){return this.parseArrowExpression(this.startNodeAt(t,e),n,!1,r)};var bW=[];Ge.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===R.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(R.parenL)?t.arguments=this.parseExprList(R.parenR,this.options.ecmaVersion>=8,!1):t.arguments=bW,this.finishNode(t,"NewExpression")};Ge.parseTemplateElement=function(t){var e=t.isTagged,n=this.startNode();return this.type===R.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===R.backQuote,this.finishNode(n,"TemplateElement")};Ge.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===R.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(R.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(R.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(n,"TemplateLiteral")};Ge.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===R.name||this.type===R.num||this.type===R.string||this.type===R.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===R.star)&&!Er.test(this.input.slice(this.lastTokEnd,this.start))};Ge.parseObj=function(t,e){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(R.braceR);){if(r)r=!1;else if(this.expect(R.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(R.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")};Ge.parseProperty=function(t,e){var n=this.startNode(),r,i,s,a;if(this.options.ecmaVersion>=9&&this.eat(R.ellipsis))return t?(n.argument=this.parseIdent(!1),this.type===R.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===R.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,a=this.startLoc),t||(r=this.eat(R.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(R.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,t,r,i,s,a,e,u),this.finishNode(n,"Property")};Ge.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")};Ge.parsePropertyValue=function(t,e,n,r,i,s,a,u){(n||r)&&this.type===R.colon&&this.unexpected(),this.eat(R.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),t.kind="init"):this.options.ecmaVersion>=6&&this.type===R.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!==R.comma&&this.type!==R.braceR&&this.type!==R.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===R.eq&&a?(a.shorthandAssign<0&&(a.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()};Ge.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(R.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(R.bracketR),t.key;t.computed=!1}return t.key=this.type===R.num||this.type===R.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};Ge.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};Ge.parseMethod=function(t,e,n){var r=this.startNode(),i=this.yieldPos,s=this.awaitPos,a=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(iC(e,r.generator)|b0|(n?b6:0)),this.expect(R.parenL),r.params=this.parseBindingList(R.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(r,"FunctionExpression")};Ge.parseArrowExpression=function(t,e,n,r){var i=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(iC(n,!1)|rC),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=a,this.finishNode(t,"ArrowFunctionExpression")};Ge.parseFunctionBody=function(t,e,n,r){var i=e&&this.type!==R.braceL,s=this.strict,a=!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)&&(a=this.strictDirective(this.end),a&&u&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(t,!s&&!a&&!e&&!n&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,k6),t.body=this.parseBlock(!1,void 0,a&&!s),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()};Ge.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};Ge.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,sC,e?null:n)}};Ge.parseExprList=function(t,e,n,r){for(var i=[],s=!0;!this.eat(t);){if(s)s=!1;else if(this.expect(R.comma),e&&this.afterTrailingComma(t))break;var a=void 0;n&&this.type===R.comma?a=null:this.type===R.ellipsis?(a=this.parseSpread(r),r&&this.type===R.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):a=this.parseMaybeAssign(!1,r),i.push(a)}return i};Ge.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&S0)&&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"))}};Ge.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};Ge.parseIdentNode=function(){var t=this.startNode();return this.type===R.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=R.name):this.unexpected(),t};Ge.parsePrivateIdent=function(){var t=this.startNode();return this.type===R.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};Ge.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===R.semi||this.canInsertSemicolon()||this.type!==R.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(R.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};Ge.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=sn.prototype;Tg.raise=function(t,e){var n=g6(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 Qh(this.curLine,this.pos-this.lineStart)};var uo=sn.prototype,SW=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};uo.enterScope=function(t){this.scopeStack.push(new SW(t))};uo.exitScope=function(){this.scopeStack.pop()};uo.treatFunctionsAsVarInScope=function(t){return t.flags&cc||!this.inModule&&t.flags&Zh};uo.declareName=function(t,e,n){var r=!1;if(e===Xs){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&Zh&&delete this.undefinedExports[t]}else if(e===v6){var s=this.currentScope();s.lexical.push(t)}else if(e===S6){var a=this.currentScope();this.treatFunctionsAsVar?r=a.lexical.indexOf(t)>-1:r=a.lexical.indexOf(t)>-1||a.var.indexOf(t)>-1,a.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&x6&&c.lexical[0]===t)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(t)>-1){r=!0;break}if(c.var.push(t),this.inModule&&c.flags&Zh&&delete this.undefinedExports[t],c.flags&S0)break}r&&this.raiseRecoverable(n,"Identifier '"+t+"' has already been declared")};uo.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};uo.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};uo.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(S0|Op|Dl))return e}};uo.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(S0|Op|Dl)&&!(e.flags&rC))return e}};var k0=function(e,n,r){this.type="",this.start=n,this.end=0,e.options.locations&&(this.loc=new x0(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[n,0])},Rp=sn.prototype;Rp.startNode=function(){return new k0(this,this.start,this.startLoc)};Rp.startNodeAt=function(t,e){return new k0(this,t,e)};function E6(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}Rp.finishNode=function(t,e){return E6.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};Rp.finishNodeAt=function(t,e,n,r){return E6.call(this,t,e,n,r)};Rp.copyNode=function(t){var e=new k0(this,t.start,this.startLoc);for(var n in t)e[n]=t[n];return e};var vW="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",A6="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",N6=A6+" Extended_Pictographic",T6=N6,M6=T6+" EBase EComp EMod EPres ExtPict",O6=M6,kW=O6,CW={9:A6,10:N6,11:T6,12:M6,13:O6,14:kW},wW="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",EW={9:"",10:"",11:"",12:"",13:"",14:wW},tM="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",R6="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",D6=R6+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",I6=D6+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",_6=I6+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",z6=_6+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",AW=z6+" "+vW,NW={9:R6,10:D6,11:I6,12:_6,13:z6,14:AW},L6={};function TW(t){var e=L6[t]={binary:Ua(CW[t]+" "+tM),binaryOfStrings:Ua(EW[t]),nonBinary:{General_Category:Ua(tM),Script:Ua(NW[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 X1=0,nM=[9,10,11,12,13,14];X1<nM.length;X1+=1){var MW=nM[X1];TW(MW)}var Re=sn.prototype,Mg=function(e,n){this.parent=e,this.base=n||this};Mg.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};Mg.prototype.sibling=function(){return new Mg(this.parent,this.base)};var as=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=L6[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};as.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)};as.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};as.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 a=r.charCodeAt(e+1);return a>=56320&&a<=57343?(s<<10)+a-56613888:s};as.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),a;return!(n||this.switchU)||s<=55295||s>=57344||e+1>=i||(a=r.charCodeAt(e+1))<56320||a>57343?e+1:e+2};as.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)};as.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)};as.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)};as.prototype.eat=function(e,n){return n===void 0&&(n=!1),this.current(n)===e?(this.advance(n),!0):!1};as.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 a=s[i],u=this.at(r,n);if(u===-1||u!==a)return!1;r=this.nextIndex(r,n)}return this.pos=r,!0};Re.validateRegExpFlags=function(t){for(var e=t.validFlags,n=t.flags,r=!1,i=!1,s=0;s<n.length;s++){var a=n.charAt(s);e.indexOf(a)===-1&&this.raise(t.start,"Invalid regular expression flag"),n.indexOf(a,s+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),a==="u"&&(r=!0),a==="v"&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(t.start,"Invalid regular expression flag")};function OW(t){for(var e in t)return!0;return!1}Re.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&OW(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))};Re.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")}};Re.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Mg(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")};Re.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};Re.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};Re.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};Re.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=!1),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),!0):!1};Re.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};Re.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};Re.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)};Re.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1};Re.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 a=this.regexp_eatModifiers(t);!n&&!a&&t.current()===58&&t.raise("Invalid regular expression modifiers");for(var u=0;u<a.length;u++){var c=a.charAt(u);(a.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};Re.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};Re.regexp_eatModifiers=function(t){for(var e="",n=0;(n=t.current())!==-1&&RW(n);)e+=Us(n),t.advance();return e};function RW(t){return t===105||t===109||t===115}Re.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)};Re.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1};Re.regexp_eatSyntaxCharacter=function(t){var e=t.current();return B6(e)?(t.lastIntValue=e,t.advance(),!0):!1};function B6(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}Re.regexp_eatPatternCharacters=function(t){for(var e=t.pos,n=0;(n=t.current())!==-1&&!B6(n);)t.advance();return t.pos!==e};Re.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};Re.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}};Re.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};Re.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=Us(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=Us(t.lastIntValue);return!0}return!1};Re.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),DW(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function DW(t){return es(t,!0)||t===36||t===95}Re.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),IW(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function IW(t){return eo(t,!0)||t===36||t===95||t===8204||t===8205}Re.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)};Re.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};Re.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};Re.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)};Re.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1};Re.regexp_eatZero=function(t){return t.current()===48&&!C0(t.lookahead())?(t.lastIntValue=0,t.advance(),!0):!1};Re.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};Re.regexp_eatControlLetter=function(t){var e=t.current();return F6(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function F6(t){return t>=65&&t<=90||t>=97&&t<=122}Re.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 a=t.lastIntValue;if(a>=56320&&a<=57343)return t.lastIntValue=(i-55296)*1024+(a-56320)+65536,!0}t.pos=s,t.lastIntValue=i}return!0}if(r&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&_W(t.lastIntValue))return!0;r&&t.raise("Invalid unicode escape"),t.pos=n}return!1};function _W(t){return t>=0&&t<=1114111}Re.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};Re.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 V6=0,Hs=1,oi=2;Re.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(zW(e))return t.lastIntValue=-1,t.advance(),Hs;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===oi&&t.raise("Invalid property name"),r;t.raise("Invalid property name")}return V6};function zW(t){return t===100||t===68||t===115||t===83||t===119||t===87}Re.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),Hs}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,i)}return V6};Re.regexp_validateUnicodePropertyNameAndValue=function(t,e,n){uc(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(n)||t.raise("Invalid property value")};Re.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return Hs;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return oi;t.raise("Invalid property name")};Re.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";P6(e=t.current());)t.lastStringValue+=Us(e),t.advance();return t.lastStringValue!==""};function P6(t){return F6(t)||t===95}Re.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";LW(e=t.current());)t.lastStringValue+=Us(e),t.advance();return t.lastStringValue!==""};function LW(t){return P6(t)||C0(t)}Re.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};Re.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===oi&&t.raise("Negated character class may contain strings"),!0}return!1};Re.regexp_classContents=function(t){return t.current()===93?Hs:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),Hs)};Re.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")}}};Re.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||J6(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};Re.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)};Re.regexp_classSetExpression=function(t){var e=Hs,n;if(!this.regexp_eatClassSetRange(t))if(n=this.regexp_eatClassSetOperand(t)){n===oi&&(e=oi);for(var r=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(n=this.regexp_eatClassSetOperand(t))){n!==oi&&(e=Hs);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===oi&&(e=oi)}};Re.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};Re.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?Hs:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};Re.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===oi&&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};Re.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};Re.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===oi&&(e=oi);return e};Re.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?Hs:oi};Re.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()&&BW(n)||FW(n)?!1:(t.advance(),t.lastIntValue=n,!0)};function BW(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 FW(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}Re.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return VW(e)?(t.lastIntValue=e,t.advance(),!0):!1};function VW(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}Re.regexp_eatClassControlLetter=function(t){var e=t.current();return C0(e)||e===95?(t.lastIntValue=e%32,t.advance(),!0):!1};Re.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};Re.regexp_eatDecimalDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;C0(n=t.current());)t.lastIntValue=10*t.lastIntValue+(n-48),t.advance();return t.pos!==e};function C0(t){return t>=48&&t<=57}Re.regexp_eatHexDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;j6(n=t.current());)t.lastIntValue=16*t.lastIntValue+$6(n),t.advance();return t.pos!==e};function j6(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function $6(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}Re.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};Re.regexp_eatOctalDigit=function(t){var e=t.current();return J6(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function J6(t){return t>=48&&t<=55}Re.regexp_eatFixedHexDigits=function(t,e){var n=t.pos;t.lastIntValue=0;for(var r=0;r<e;++r){var i=t.current();if(!j6(i))return t.pos=n,!1;t.lastIntValue=16*t.lastIntValue+$6(i),t.advance()}return!0};var oC=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new x0(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},ut=sn.prototype;ut.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 oC(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};ut.getToken=function(){return this.next(),new oC(this)};typeof Symbol<"u"&&(ut[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===R.eof,value:e}}}});ut.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(R.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};ut.readToken=function(t){return es(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};ut.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};ut.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=p6(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())};ut.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&&!lc(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())};ut.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&&d6.test(String.fromCharCode(t)))++this.pos;else break e}}};ut.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)};ut.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(R.ellipsis)):(++this.pos,this.finishToken(R.dot))};ut.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(R.assign,2):this.finishOp(R.slash,1)};ut.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),n=1,r=t===42?R.star:R.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++n,r=R.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(R.assign,n+1):this.finishOp(r,n)};ut.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(R.assign,3)}return this.finishOp(t===124?R.logicalOR:R.logicalAND,2)}return e===61?this.finishOp(R.assign,2):this.finishOp(t===124?R.bitwiseOR:R.bitwiseAND,1)};ut.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(R.assign,2):this.finishOp(R.bitwiseXOR,1)};ut.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||Er.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(R.incDec,2):e===61?this.finishOp(R.assign,2):this.finishOp(R.plusMin,1)};ut.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(R.assign,n+1):this.finishOp(R.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(R.relational,n))};ut.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(R.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(R.arrow)):this.finishOp(t===61?R.eq:R.prefix,1)};ut.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(R.questionDot,2)}if(e===63){if(t>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(R.assign,3)}return this.finishOp(R.coalesce,2)}}return this.finishOp(R.question,1)};ut.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),es(e,!0)||e===92))return this.finishToken(R.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Us(e)+"'")};ut.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(R.parenL);case 41:return++this.pos,this.finishToken(R.parenR);case 59:return++this.pos,this.finishToken(R.semi);case 44:return++this.pos,this.finishToken(R.comma);case 91:return++this.pos,this.finishToken(R.bracketL);case 93:return++this.pos,this.finishToken(R.bracketR);case 123:return++this.pos,this.finishToken(R.braceL);case 125:return++this.pos,this.finishToken(R.braceR);case 58:return++this.pos,this.finishToken(R.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(R.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(R.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Us(t)+"'")};ut.finishOp=function(t,e){var n=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,n)};ut.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(Er.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,a=this.readWord1();this.containsEsc&&this.unexpected(s);var u=this.regexpState||(this.regexpState=new as(this));u.reset(n,i,a),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var c=null;try{c=new RegExp(i,a)}catch{}return this.finishToken(R.regexp,{pattern:i,flags:a,value:c})};ut.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,a=0,u=0,c=0,h=e??1/0;c<h;++c,++this.pos){var d=this.input.charCodeAt(this.pos),g=void 0;if(r&&d===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=d;continue}if(d>=97?g=d-97+10:d>=65?g=d-65+10:d>=48&&d<=57?g=d-48:g=1/0,g>=t)break;u=d,a=a*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:a};function PW(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function U6(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}ut.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=U6(this.input.slice(e,this.pos)),++this.pos):es(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(R.num,n)};ut.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=U6(this.input.slice(e,this.pos));return++this.pos,es(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(R.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")),es(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=PW(this.input.slice(e,this.pos),n);return this.finishToken(R.num,s)};ut.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};ut.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)):(lc(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(n,this.pos++),this.finishToken(R.string,e)};var H6={};ut.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===H6)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};ut.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw H6;this.raise(t,e)};ut.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===R.template||this.type===R.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(R.dollarBraceL)):(++this.pos,this.finishToken(R.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(R.template,t));if(n===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(lc(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}};ut.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(R.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")};ut.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 Us(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 lc(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}};ut.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n};ut.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(eo(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 a=this.readCodePoint();(e?es:eo)(a,r)||this.invalidStringToken(s,"Invalid Unicode escape"),t+=Us(a),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)};ut.readWord=function(){var t=this.readWord1(),e=R.name;return this.keywords.test(t)&&(e=tC[t]),this.finishToken(e,t)};var jW="8.15.0";sn.acorn={Parser:sn,version:jW,defaultOptions:FS,Position:Qh,SourceLocation:x0,getLineInfo:g6,Node:k0,TokenType:dt,tokTypes:R,keywordTypes:tC,TokContext:Mi,tokContexts:Ft,isIdentifierChar:eo,isIdentifierStart:es,Token:oC,isNewLine:lc,lineBreak:Er,lineBreakG:uW,nonASCIIwhitespace:d6};var Q1={exports:{}},Z1,rM;function $W(){return rM||(rM=1,Z1={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:"♦"}),Z1}var rh={exports:{}},JW=rh.exports,iM;function sM(){return iM||(iM=1,(function(t,e){(function(n,r){r(e)})(JW,(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_・",a="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨ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"},d=/^in(stanceof)?$/,g=new RegExp("["+a+"]"),y=new RegExp("["+a+s+"]");function x(p,S){for(var E=65536,M=0;M<S.length;M+=2){if(E+=S[M],E>p)return!1;if(E+=S[M+1],E>=p)return!0}return!1}function k(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:x(p,i)}function w(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:x(p,i)||x(p,r)}var N=function(S,E){E===void 0&&(E={}),this.label=S,this.keyword=E.keyword,this.beforeExpr=!!E.beforeExpr,this.startsExpr=!!E.startsExpr,this.isLoop=!!E.isLoop,this.isAssign=!!E.isAssign,this.prefix=!!E.prefix,this.postfix=!!E.postfix,this.binop=E.binop||null,this.updateContext=null};function T(p,S){return new N(p,{beforeExpr:!0,binop:S})}var V={beforeExpr:!0},F={startsExpr:!0},K={};function L(p,S){return S===void 0&&(S={}),S.keyword=p,K[p]=new N(p,S)}var C={num:new N("num",F),regexp:new N("regexp",F),string:new N("string",F),name:new N("name",F),privateId:new N("privateId",F),eof:new N("eof"),bracketL:new N("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new N("]"),braceL:new N("{",{beforeExpr:!0,startsExpr:!0}),braceR:new N("}"),parenL:new N("(",{beforeExpr:!0,startsExpr:!0}),parenR:new N(")"),comma:new N(",",V),semi:new N(";",V),colon:new N(":",V),dot:new N("."),question:new N("?",V),questionDot:new N("?."),arrow:new N("=>",V),template:new N("template"),invalidTemplate:new N("invalidTemplate"),ellipsis:new N("...",V),backQuote:new N("`",F),dollarBraceL:new N("${",{beforeExpr:!0,startsExpr:!0}),eq:new N("=",{beforeExpr:!0,isAssign:!0}),assign:new N("_=",{beforeExpr:!0,isAssign:!0}),incDec:new N("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new N("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:T("||",1),logicalAND:T("&&",2),bitwiseOR:T("|",3),bitwiseXOR:T("^",4),bitwiseAND:T("&",5),equality:T("==/!=/===/!==",6),relational:T("</>/<=/>=",7),bitShift:T("<</>>/>>>",8),plusMin:new N("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:T("%",10),star:T("*",10),slash:T("/",10),starstar:new N("**",{beforeExpr:!0}),coalesce:T("??",1),_break:L("break"),_case:L("case",V),_catch:L("catch"),_continue:L("continue"),_debugger:L("debugger"),_default:L("default",V),_do:L("do",{isLoop:!0,beforeExpr:!0}),_else:L("else",V),_finally:L("finally"),_for:L("for",{isLoop:!0}),_function:L("function",F),_if:L("if"),_return:L("return",V),_switch:L("switch"),_throw:L("throw",V),_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",F),_super:L("super",F),_class:L("class",F),_extends:L("extends",V),_export:L("export"),_import:L("import",F),_null:L("null",F),_true:L("true",F),_false:L("false",F),_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})},_=/\r\n?|\n|\u2028|\u2029/,J=new RegExp(_.source,"g");function $(p){return p===10||p===13||p===8232||p===8233}function H(p,S,E){E===void 0&&(E=p.length);for(var M=S;M<E;M++){var B=p.charCodeAt(M);if($(B))return M<E-1&&B===13&&p.charCodeAt(M+1)===10?M+2:M+1}return-1}var ue=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ae=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Se=Object.prototype,Ee=Se.hasOwnProperty,Y=Se.toString,X=Object.hasOwn||(function(p,S){return Ee.call(p,S)}),le=Array.isArray||(function(p){return Y.call(p)==="[object Array]"}),Ce=Object.create(null);function _e(p){return Ce[p]||(Ce[p]=new RegExp("^(?:"+p.replace(/ /g,"|")+")$"))}function j(p){return p<=65535?String.fromCharCode(p):(p-=65536,String.fromCharCode((p>>10)+55296,(p&1023)+56320))}var P=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,te=function(S,E){this.line=S,this.column=E};te.prototype.offset=function(S){return new te(this.line,this.column+S)};var z=function(S,E,M){this.start=E,this.end=M,S.sourceFile!==null&&(this.source=S.sourceFile)};function xe(p,S){for(var E=1,M=0;;){var B=H(p,M,S);if(B<0)return new te(E,S-M);++E,M=B}}var Te={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},Ae=!1;function qe(p){var S={};for(var E in Te)S[E]=p&&X(p,E)?p[E]:Te[E];if(S.ecmaVersion==="latest"?S.ecmaVersion=1e8:S.ecmaVersion==null?(!Ae&&typeof console=="object"&&console.warn&&(Ae=!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),le(S.onToken)){var M=S.onToken;S.onToken=function(B){return M.push(B)}}if(le(S.onComment)&&(S.onComment=pt(S,S.onComment)),S.sourceType==="commonjs"&&S.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return S}function pt(p,S){return function(E,M,B,Z,re,ye){var ve={type:E?"Block":"Line",value:M,start:B,end:Z};p.locations&&(ve.loc=new z(this,re,ye)),p.ranges&&(ve.range=[B,Z]),S.push(ve)}}var Ke=1,Pt=2,Ot=4,fr=8,hr=16,hn=32,pn=64,pr=128,dn=256,mn=512,dr=1024,he=Ke|Pt|dn;function je(p,S){return Pt|(p?Ot:0)|(S?fr:0)}var Dt=0,mt=1,Be=2,gn=3,fe=4,ge=5,I=function(S,E,M){this.options=S=qe(S),this.sourceFile=S.sourceFile,this.keywords=_e(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=_e(B);var Z=(B?B+" ":"")+u.strict;this.reservedWordsStrict=_e(Z),this.reservedWordsStrictBind=_e(Z+" "+u.strictBind),this.input=String(E),this.containsEsc=!1,M?(this.pos=M,this.lineStart=this.input.lastIndexOf(`
79
+ `,M-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(_).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"?Pt:Ke),this.regexpState=null,this.privateNameStack=[]},ze={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}};I.prototype.parse=function(){var S=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(S)},ze.inFunction.get=function(){return(this.currentVarScope().flags&Pt)>0},ze.inGenerator.get=function(){return(this.currentVarScope().flags&fr)>0},ze.inAsync.get=function(){return(this.currentVarScope().flags&Ot)>0},ze.canAwait.get=function(){for(var p=this.scopeStack.length-1;p>=0;p--){var S=this.scopeStack[p],E=S.flags;if(E&(dn|mn))return!1;if(E&Pt)return(E&Ot)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ze.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Ke)},ze.allowSuper.get=function(){var p=this.currentThisScope(),S=p.flags;return(S&pn)>0||this.options.allowSuperOutsideMethod},ze.allowDirectSuper.get=function(){return(this.currentThisScope().flags&pr)>0},ze.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ze.allowNewDotTarget.get=function(){for(var p=this.scopeStack.length-1;p>=0;p--){var S=this.scopeStack[p],E=S.flags;if(E&(dn|mn)||E&Pt&&!(E&hr))return!0}return!1},ze.allowUsing.get=function(){var p=this.currentScope(),S=p.flags;return!(S&dr||!this.inModule&&S&Ke)},ze.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&dn)>0},I.extend=function(){for(var S=[],E=arguments.length;E--;)S[E]=arguments[E];for(var M=this,B=0;B<S.length;B++)M=S[B](M);return M},I.parse=function(S,E){return new this(E,S).parse()},I.parseExpressionAt=function(S,E,M){var B=new this(M,S,E);return B.nextToken(),B.parseExpression()},I.tokenizer=function(S,E){return new this(E,S)},Object.defineProperties(I.prototype,ze);var Je=I.prototype,on=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Je.strictDirective=function(p){if(this.options.ecmaVersion<5)return!1;for(;;){ae.lastIndex=p,p+=ae.exec(this.input)[0].length;var S=on.exec(this.input.slice(p));if(!S)return!1;if((S[1]||S[2])==="use strict"){ae.lastIndex=p+S[0].length;var E=ae.exec(this.input),M=E.index+E[0].length,B=this.input.charAt(M);return B===";"||B==="}"||_.test(E[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(B)||B==="!"&&this.input.charAt(M+1)==="=")}p+=S[0].length,ae.lastIndex=p,p+=ae.exec(this.input)[0].length,this.input[p]===";"&&p++}},Je.eat=function(p){return this.type===p?(this.next(),!0):!1},Je.isContextual=function(p){return this.type===C.name&&this.value===p&&!this.containsEsc},Je.eatContextual=function(p){return this.isContextual(p)?(this.next(),!0):!1},Je.expectContextual=function(p){this.eatContextual(p)||this.unexpected()},Je.canInsertSemicolon=function(){return this.type===C.eof||this.type===C.braceR||_.test(this.input.slice(this.lastTokEnd,this.start))},Je.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Je.semicolon=function(){!this.eat(C.semi)&&!this.insertSemicolon()&&this.unexpected()},Je.afterTrailingComma=function(p,S){if(this.type===p)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),S||this.next(),!0},Je.expect=function(p){this.eat(p)||this.unexpected()},Je.unexpected=function(p){this.raise(p??this.start,"Unexpected token")};var mr=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Je.checkPatternErrors=function(p,S){if(p){p.trailingComma>-1&&this.raiseRecoverable(p.trailingComma,"Comma is not permitted after the rest element");var E=S?p.parenthesizedAssign:p.parenthesizedBind;E>-1&&this.raiseRecoverable(E,S?"Assigning to rvalue":"Parenthesized pattern")}},Je.checkExpressionErrors=function(p,S){if(!p)return!1;var E=p.shorthandAssign,M=p.doubleProto;if(!S)return E>=0||M>=0;E>=0&&this.raise(E,"Shorthand property assignments are valid only in destructuring patterns"),M>=0&&this.raiseRecoverable(M,"Redefinition of __proto__ property")},Je.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")},Je.isSimpleAssignTarget=function(p){return p.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(p.expression):p.type==="Identifier"||p.type==="MemberExpression"};var ke=I.prototype;ke.parseTopLevel=function(p){var S=Object.create(null);for(p.body||(p.body=[]);this.type!==C.eof;){var E=this.parseStatement(null,!0,S);p.body.push(E)}if(this.inModule)for(var M=0,B=Object.keys(this.undefinedExports);M<B.length;M+=1){var Z=B[M];this.raiseRecoverable(this.undefinedExports[Z].start,"Export '"+Z+"' 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 jt={kind:"loop"},Tn={kind:"switch"};ke.isLet=function(p){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ae.lastIndex=this.pos;var S=ae.exec(this.input),E=this.pos+S[0].length,M=this.fullCharCodeAt(E);if(M===91||M===92)return!0;if(p)return!1;if(M===123)return!0;if(k(M)){var B=E;do E+=M<=65535?1:2;while(w(M=this.fullCharCodeAt(E)));if(M===92)return!0;var Z=this.input.slice(B,E);if(!d.test(Z))return!0}return!1},ke.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ae.lastIndex=this.pos;var p=ae.exec(this.input),S=this.pos+p[0].length,E;return!_.test(this.input.slice(this.pos,S))&&this.input.slice(S,S+8)==="function"&&(S+8===this.input.length||!(w(E=this.fullCharCodeAt(S+8))||E===92))},ke.isUsingKeyword=function(p,S){if(this.options.ecmaVersion<17||!this.isContextual(p?"await":"using"))return!1;ae.lastIndex=this.pos;var E=ae.exec(this.input),M=this.pos+E[0].length;if(_.test(this.input.slice(this.pos,M)))return!1;if(p){var B=M+5,Z;if(this.input.slice(M,B)!=="using"||B===this.input.length||w(Z=this.fullCharCodeAt(B))||Z===92)return!1;ae.lastIndex=B;var re=ae.exec(this.input);if(M=B+re[0].length,re&&_.test(this.input.slice(B,M)))return!1}var ye=this.fullCharCodeAt(M);if(!k(ye)&&ye!==92)return!1;var ve=M;do M+=ye<=65535?1:2;while(w(ye=this.fullCharCodeAt(M)));if(ye===92)return!0;var Fe=this.input.slice(ve,M);return!(d.test(Fe)||S&&Fe==="of")},ke.isAwaitUsing=function(p){return this.isUsingKeyword(!0,p)},ke.isUsing=function(p){return this.isUsingKeyword(!1,p)},ke.parseStatement=function(p,S,E){var M=this.type,B=this.startNode(),Z;switch(this.isLet(p)&&(M=C._var,Z="let"),M){case C._break:case C._continue:return this.parseBreakContinueStatement(B,M.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 Z=Z||this.value,p&&Z!=="var"&&this.unexpected(),this.parseVarStatement(B,Z);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&&M===C._import){ae.lastIndex=this.pos;var re=ae.exec(this.input),ye=this.pos+re[0].length,ve=this.input.charCodeAt(ye);if(ve===40||ve===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'")),M===C._import?this.parseImport(B):this.parseExport(B,E);default:if(this.isAsyncFunction())return p&&this.unexpected(),this.next(),this.parseFunctionStatement(B,!0,!p);var Fe=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Fe)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"),Fe==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(B,!1,Fe),this.semicolon(),this.finishNode(B,"VariableDeclaration");var Qe=this.value,vt=this.parseExpression();return M===C.name&&vt.type==="Identifier"&&this.eat(C.colon)?this.parseLabeledStatement(B,Qe,vt,p):this.parseExpressionStatement(B,vt)}},ke.parseBreakContinueStatement=function(p,S){var E=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 M=0;M<this.labels.length;++M){var B=this.labels[M];if((p.label==null||B.name===p.label.name)&&(B.kind!=null&&(E||B.kind==="loop")||p.label&&E))break}return M===this.labels.length&&this.raise(p.start,"Unsyntactic "+S),this.finishNode(p,E?"BreakStatement":"ContinueStatement")},ke.parseDebuggerStatement=function(p){return this.next(),this.semicolon(),this.finishNode(p,"DebuggerStatement")},ke.parseDoStatement=function(p){return this.next(),this.labels.push(jt),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")},ke.parseForStatement=function(p){this.next();var S=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(jt),this.enterScope(0),this.expect(C.parenL),this.type===C.semi)return S>-1&&this.unexpected(S),this.parseFor(p,null);var E=this.isLet();if(this.type===C._var||this.type===C._const||E){var M=this.startNode(),B=E?"let":this.value;return this.next(),this.parseVar(M,!0,B),this.finishNode(M,"VariableDeclaration"),this.parseForAfterInit(p,M,S)}var Z=this.isContextual("let"),re=!1,ye=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(ye){var ve=this.startNode();return this.next(),ye==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(ve,!0,ye),this.finishNode(ve,"VariableDeclaration"),this.parseForAfterInit(p,ve,S)}var Fe=this.containsEsc,Qe=new mr,vt=this.start,Ut=S>-1?this.parseExprSubscripts(Qe,"await"):this.parseExpression(!0,Qe);return this.type===C._in||(re=this.options.ecmaVersion>=6&&this.isContextual("of"))?(S>-1?(this.type===C._in&&this.unexpected(S),p.await=!0):re&&this.options.ecmaVersion>=8&&(Ut.start===vt&&!Fe&&Ut.type==="Identifier"&&Ut.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(p.await=!1)),Z&&re&&this.raise(Ut.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Ut,!1,Qe),this.checkLValPattern(Ut),this.parseForIn(p,Ut)):(this.checkExpressionErrors(Qe,!0),S>-1&&this.unexpected(S),this.parseFor(p,Ut))},ke.parseForAfterInit=function(p,S,E){return(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&S.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===C._in?E>-1&&this.unexpected(E):p.await=E>-1),this.parseForIn(p,S)):(E>-1&&this.unexpected(E),this.parseFor(p,S))},ke.parseFunctionStatement=function(p,S,E){return this.next(),this.parseFunction(p,gr|(E?0:Un),!1,S)},ke.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")},ke.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")},ke.parseSwitchStatement=function(p){this.next(),p.discriminant=this.parseParenExpression(),p.cases=[],this.expect(C.braceL),this.labels.push(Tn),this.enterScope(dr);for(var S,E=!1;this.type!==C.braceR;)if(this.type===C._case||this.type===C._default){var M=this.type===C._case;S&&this.finishNode(S,"SwitchCase"),p.cases.push(S=this.startNode()),S.consequent=[],this.next(),M?S.test=this.parseExpression():(E&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),E=!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")},ke.parseThrowStatement=function(p){return this.next(),_.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 wt=[];ke.parseCatchClauseParam=function(){var p=this.parseBindingAtom(),S=p.type==="Identifier";return this.enterScope(S?hn:0),this.checkLValPattern(p,S?fe:Be),this.expect(C.parenR),p},ke.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")},ke.parseVarStatement=function(p,S,E){return this.next(),this.parseVar(p,!1,S,E),this.semicolon(),this.finishNode(p,"VariableDeclaration")},ke.parseWhileStatement=function(p){return this.next(),p.test=this.parseParenExpression(),this.labels.push(jt),p.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(p,"WhileStatement")},ke.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")},ke.parseEmptyStatement=function(p){return this.next(),this.finishNode(p,"EmptyStatement")},ke.parseLabeledStatement=function(p,S,E,M){for(var B=0,Z=this.labels;B<Z.length;B+=1){var re=Z[B];re.name===S&&this.raise(E.start,"Label '"+S+"' is already declared")}for(var ye=this.type.isLoop?"loop":this.type===C._switch?"switch":null,ve=this.labels.length-1;ve>=0;ve--){var Fe=this.labels[ve];if(Fe.statementStart===p.start)Fe.statementStart=this.start,Fe.kind=ye;else break}return this.labels.push({name:S,kind:ye,statementStart:this.start}),p.body=this.parseStatement(M?M.indexOf("label")===-1?M+"label":M:"label"),this.labels.pop(),p.label=E,this.finishNode(p,"LabeledStatement")},ke.parseExpressionStatement=function(p,S){return p.expression=S,this.semicolon(),this.finishNode(p,"ExpressionStatement")},ke.parseBlock=function(p,S,E){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 M=this.parseStatement(null);S.body.push(M)}return E&&(this.strict=!1),this.next(),p&&this.exitScope(),this.finishNode(S,"BlockStatement")},ke.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")},ke.parseForIn=function(p,S){var E=this.type===C._in;return this.next(),S.type==="VariableDeclaration"&&S.declarations[0].init!=null&&(!E||this.options.ecmaVersion<8||this.strict||S.kind!=="var"||S.declarations[0].id.type!=="Identifier")&&this.raise(S.start,(E?"for-in":"for-of")+" loop variable declaration may not have an initializer"),p.left=S,p.right=E?this.parseExpression():this.parseMaybeAssign(),this.expect(C.parenR),p.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(p,E?"ForInStatement":"ForOfStatement")},ke.parseVar=function(p,S,E,M){for(p.declarations=[],p.kind=E;;){var B=this.startNode();if(this.parseVarId(B,E),this.eat(C.eq)?B.init=this.parseMaybeAssign(S):!M&&E==="const"&&!(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!M&&(E==="using"||E==="await using")&&this.options.ecmaVersion>=17&&this.type!==C._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+E+" declaration"):!M&&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},ke.parseVarId=function(p,S){p.id=S==="using"||S==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(p.id,S==="var"?mt:Be,!1)};var gr=1,Un=2,Dp=4;ke.parseFunction=function(p,S,E,M,B){this.initFunction(p),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!M)&&(this.type===C.star&&S&Un&&this.unexpected(),p.generator=this.eat(C.star)),this.options.ecmaVersion>=8&&(p.async=!!M),S&gr&&(p.id=S&Dp&&this.type!==C.name?null:this.parseIdent(),p.id&&!(S&Un)&&this.checkLValSimple(p.id,this.strict||p.generator||p.async?this.treatFunctionsAsVar?mt:Be:gn));var Z=this.yieldPos,re=this.awaitPos,ye=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(je(p.async,p.generator)),S&gr||(p.id=this.type===C.name?this.parseIdent():null),this.parseFunctionParams(p),this.parseFunctionBody(p,E,!1,B),this.yieldPos=Z,this.awaitPos=re,this.awaitIdentPos=ye,this.finishNode(p,S&gr?"FunctionDeclaration":"FunctionExpression")},ke.parseFunctionParams=function(p){this.expect(C.parenL),p.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},ke.parseClass=function(p,S){this.next();var E=this.strict;this.strict=!0,this.parseClassId(p,S),this.parseClassSuper(p);var M=this.enterClassBody(),B=this.startNode(),Z=!1;for(B.body=[],this.expect(C.braceL);this.type!==C.braceR;){var re=this.parseClassElement(p.superClass!==null);re&&(B.body.push(re),re.type==="MethodDefinition"&&re.kind==="constructor"?(Z&&this.raiseRecoverable(re.start,"Duplicate constructor in the same class"),Z=!0):re.key&&re.key.type==="PrivateIdentifier"&&Il(M,re)&&this.raiseRecoverable(re.key.start,"Identifier '#"+re.key.name+"' has already been declared"))}return this.strict=E,this.next(),p.body=this.finishNode(B,"ClassBody"),this.exitClassBody(),this.finishNode(p,S?"ClassDeclaration":"ClassExpression")},ke.parseClassElement=function(p){if(this.eat(C.semi))return null;var S=this.options.ecmaVersion,E=this.startNode(),M="",B=!1,Z=!1,re="method",ye=!1;if(this.eatContextual("static")){if(S>=13&&this.eat(C.braceL))return this.parseClassStaticBlock(E),E;this.isClassElementNameStart()||this.type===C.star?ye=!0:M="static"}if(E.static=ye,!M&&S>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===C.star)&&!this.canInsertSemicolon()?Z=!0:M="async"),!M&&(S>=9||!Z)&&this.eat(C.star)&&(B=!0),!M&&!Z&&!B){var ve=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?re=ve:M=ve)}if(M?(E.computed=!1,E.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),E.key.name=M,this.finishNode(E.key,"Identifier")):this.parseClassElementName(E),S<13||this.type===C.parenL||re!=="method"||B||Z){var Fe=!E.static&&ls(E,"constructor"),Qe=Fe&&p;Fe&&re!=="method"&&this.raise(E.key.start,"Constructor can't have get/set modifier"),E.kind=Fe?"constructor":re,this.parseClassMethod(E,B,Z,Qe)}else this.parseClassField(E);return E},ke.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},ke.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)},ke.parseClassMethod=function(p,S,E,M){var B=p.key;p.kind==="constructor"?(S&&this.raise(B.start,"Constructor can't be a generator"),E&&this.raise(B.start,"Constructor can't be an async method")):p.static&&ls(p,"prototype")&&this.raise(B.start,"Classes may not have a static property named prototype");var Z=p.value=this.parseMethod(S,E,M);return p.kind==="get"&&Z.params.length!==0&&this.raiseRecoverable(Z.start,"getter should have no params"),p.kind==="set"&&Z.params.length!==1&&this.raiseRecoverable(Z.start,"setter should have exactly one param"),p.kind==="set"&&Z.params[0].type==="RestElement"&&this.raiseRecoverable(Z.params[0].start,"Setter cannot use rest params"),this.finishNode(p,"MethodDefinition")},ke.parseClassField=function(p){return ls(p,"constructor")?this.raise(p.key.start,"Classes can't have a field named 'constructor'"):p.static&&ls(p,"prototype")&&this.raise(p.key.start,"Classes can't have a static field named 'prototype'"),this.eat(C.eq)?(this.enterScope(mn|pn),p.value=this.parseMaybeAssign(),this.exitScope()):p.value=null,this.semicolon(),this.finishNode(p,"PropertyDefinition")},ke.parseClassStaticBlock=function(p){p.body=[];var S=this.labels;for(this.labels=[],this.enterScope(dn|pn);this.type!==C.braceR;){var E=this.parseStatement(null);p.body.push(E)}return this.next(),this.exitScope(),this.labels=S,this.finishNode(p,"StaticBlock")},ke.parseClassId=function(p,S){this.type===C.name?(p.id=this.parseIdent(),S&&this.checkLValSimple(p.id,Be,!1)):(S===!0&&this.unexpected(),p.id=null)},ke.parseClassSuper=function(p){p.superClass=this.eat(C._extends)?this.parseExprSubscripts(null,!1):null},ke.enterClassBody=function(){var p={declared:Object.create(null),used:[]};return this.privateNameStack.push(p),p.declared},ke.exitClassBody=function(){var p=this.privateNameStack.pop(),S=p.declared,E=p.used;if(this.options.checkPrivateFields)for(var M=this.privateNameStack.length,B=M===0?null:this.privateNameStack[M-1],Z=0;Z<E.length;++Z){var re=E[Z];X(S,re.name)||(B?B.used.push(re):this.raiseRecoverable(re.start,"Private field '#"+re.name+"' must be declared in an enclosing class"))}};function Il(p,S){var E=S.key.name,M=p[E],B="true";return S.type==="MethodDefinition"&&(S.kind==="get"||S.kind==="set")&&(B=(S.static?"s":"i")+S.kind),M==="iget"&&B==="iset"||M==="iset"&&B==="iget"||M==="sget"&&B==="sset"||M==="sset"&&B==="sget"?(p[E]="true",!1):M?!0:(p[E]=B,!1)}function ls(p,S){var E=p.computed,M=p.key;return!E&&(M.type==="Identifier"&&M.name===S||M.type==="Literal"&&M.value===S)}ke.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")},ke.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 E=0,M=p.specifiers;E<M.length;E+=1){var B=M[E];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")},ke.parseExportDeclaration=function(p){return this.parseStatement(null)},ke.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,gr|Dp,!1,p)}else if(this.type===C._class){var E=this.startNode();return this.parseClass(E,"nullableID")}else{var M=this.parseMaybeAssign();return this.semicolon(),M}},ke.checkExport=function(p,S,E){p&&(typeof S!="string"&&(S=S.type==="Identifier"?S.name:S.value),X(p,S)&&this.raiseRecoverable(E,"Duplicate export '"+S+"'"),p[S]=!0)},ke.checkPatternExport=function(p,S){var E=S.type;if(E==="Identifier")this.checkExport(p,S,S.start);else if(E==="ObjectPattern")for(var M=0,B=S.properties;M<B.length;M+=1){var Z=B[M];this.checkPatternExport(p,Z)}else if(E==="ArrayPattern")for(var re=0,ye=S.elements;re<ye.length;re+=1){var ve=ye[re];ve&&this.checkPatternExport(p,ve)}else E==="Property"?this.checkPatternExport(p,S.value):E==="AssignmentPattern"?this.checkPatternExport(p,S.left):E==="RestElement"&&this.checkPatternExport(p,S.argument)},ke.checkVariableExport=function(p,S){if(p)for(var E=0,M=S;E<M.length;E+=1){var B=M[E];this.checkPatternExport(p,B.id)}},ke.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},ke.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")},ke.parseExportSpecifiers=function(p){var S=[],E=!0;for(this.expect(C.braceL);!this.eat(C.braceR);){if(E)E=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;S.push(this.parseExportSpecifier(p))}return S},ke.parseImport=function(p){return this.next(),this.type===C.string?(p.specifiers=wt,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")},ke.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,Be),this.finishNode(p,"ImportSpecifier")},ke.parseImportDefaultSpecifier=function(){var p=this.startNode();return p.local=this.parseIdent(),this.checkLValSimple(p.local,Be),this.finishNode(p,"ImportDefaultSpecifier")},ke.parseImportNamespaceSpecifier=function(){var p=this.startNode();return this.next(),this.expectContextual("as"),p.local=this.parseIdent(),this.checkLValSimple(p.local,Be),this.finishNode(p,"ImportNamespaceSpecifier")},ke.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},ke.parseWithClause=function(){var p=[];if(!this.eat(C._with))return p;this.expect(C.braceL);for(var S={},E=!0;!this.eat(C.braceR);){if(E)E=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;var M=this.parseImportAttribute(),B=M.key.type==="Identifier"?M.key.name:M.key.value;X(S,B)&&this.raiseRecoverable(M.key.start,"Duplicate attribute key '"+B+"'"),S[B]=!0,p.push(M)}return p},ke.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")},ke.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===C.string){var p=this.parseLiteral(this.value);return P.test(p.value)&&this.raise(p.start,"An export name cannot include a lone surrogate."),p}return this.parseIdent(!0)},ke.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)},ke.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 yn=I.prototype;yn.toAssignable=function(p,S,E){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",E&&this.checkPatternErrors(E,!0);for(var M=0,B=p.properties;M<B.length;M+=1){var Z=B[M];this.toAssignable(Z,S),Z.type==="RestElement"&&(Z.argument.type==="ArrayPattern"||Z.argument.type==="ObjectPattern")&&this.raise(Z.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",E&&this.checkPatternErrors(E,!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,E);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 E&&this.checkPatternErrors(E,!0);return p},yn.toAssignableList=function(p,S){for(var E=p.length,M=0;M<E;M++){var B=p[M];B&&this.toAssignable(B,S)}if(E){var Z=p[E-1];this.options.ecmaVersion===6&&S&&Z&&Z.type==="RestElement"&&Z.argument.type!=="Identifier"&&this.unexpected(Z.argument.start)}return p},yn.parseSpread=function(p){var S=this.startNode();return this.next(),S.argument=this.parseMaybeAssign(!1,p),this.finishNode(S,"SpreadElement")},yn.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")},yn.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()},yn.parseBindingList=function(p,S,E,M){for(var B=[],Z=!0;!this.eat(p);)if(Z?Z=!1:this.expect(C.comma),S&&this.type===C.comma)B.push(null);else{if(E&&this.afterTrailingComma(p))break;if(this.type===C.ellipsis){var re=this.parseRestBinding();this.parseBindingListItem(re),B.push(re),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(M))}return B},yn.parseAssignableListItem=function(p){var S=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(S),S},yn.parseBindingListItem=function(p){return p},yn.parseMaybeDefault=function(p,S,E){if(E=E||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(C.eq))return E;var M=this.startNodeAt(p,S);return M.left=E,M.right=this.parseMaybeAssign(),this.finishNode(M,"AssignmentPattern")},yn.checkLValSimple=function(p,S,E){S===void 0&&(S=Dt);var M=S!==Dt;switch(p.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(p.name)&&this.raiseRecoverable(p.start,(M?"Binding ":"Assigning to ")+p.name+" in strict mode"),M&&(S===Be&&p.name==="let"&&this.raiseRecoverable(p.start,"let is disallowed as a lexically bound name"),E&&(X(E,p.name)&&this.raiseRecoverable(p.start,"Argument name clash"),E[p.name]=!0),S!==ge&&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":M&&this.raiseRecoverable(p.start,"Binding member expression");break;case"ParenthesizedExpression":return M&&this.raiseRecoverable(p.start,"Binding parenthesized expression"),this.checkLValSimple(p.expression,S,E);default:this.raise(p.start,(M?"Binding":"Assigning to")+" rvalue")}},yn.checkLValPattern=function(p,S,E){switch(S===void 0&&(S=Dt),p.type){case"ObjectPattern":for(var M=0,B=p.properties;M<B.length;M+=1){var Z=B[M];this.checkLValInnerPattern(Z,S,E)}break;case"ArrayPattern":for(var re=0,ye=p.elements;re<ye.length;re+=1){var ve=ye[re];ve&&this.checkLValInnerPattern(ve,S,E)}break;default:this.checkLValSimple(p,S,E)}},yn.checkLValInnerPattern=function(p,S,E){switch(S===void 0&&(S=Dt),p.type){case"Property":this.checkLValInnerPattern(p.value,S,E);break;case"AssignmentPattern":this.checkLValPattern(p.left,S,E);break;case"RestElement":this.checkLValPattern(p.argument,S,E);break;default:this.checkLValPattern(p,S,E)}};var Yt=function(S,E,M,B,Z){this.token=S,this.isExpr=!!E,this.preserveSpace=!!M,this.override=B,this.generator=!!Z},St={b_stat:new Yt("{",!1),b_expr:new Yt("{",!0),b_tmpl:new Yt("${",!1),p_stat:new Yt("(",!1),p_expr:new Yt("(",!0),q_tmpl:new Yt("`",!0,!0,function(p){return p.tryReadTemplateToken()}),f_stat:new Yt("function",!1),f_expr:new Yt("function",!0),f_expr_gen:new Yt("function",!0,!1,null,!0),f_gen:new Yt("function",!1,!1,null,!0)},jr=I.prototype;jr.initialContext=function(){return[St.b_stat]},jr.curContext=function(){return this.context[this.context.length-1]},jr.braceIsBlock=function(p){var S=this.curContext();return S===St.f_expr||S===St.f_stat?!0:p===C.colon&&(S===St.b_stat||S===St.b_expr)?!S.isExpr:p===C._return||p===C.name&&this.exprAllowed?_.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===St.b_stat:p===C._var||p===C._const||p===C.name?!1:!this.exprAllowed},jr.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},jr.updateContext=function(p){var S,E=this.type;E.keyword&&p===C.dot?this.exprAllowed=!1:(S=E.updateContext)?S.call(this,p):this.exprAllowed=E.beforeExpr},jr.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===St.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)?St.b_stat:St.b_expr),this.exprAllowed=!0},C.dollarBraceL.updateContext=function(){this.context.push(St.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?St.p_stat:St.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()!==St.p_stat)&&!(p===C._return&&_.test(this.input.slice(this.lastTokEnd,this.start)))&&!((p===C.colon||p===C.braceL)&&this.curContext()===St.b_stat)?this.context.push(St.f_expr):this.context.push(St.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()===St.q_tmpl?this.context.pop():this.context.push(St.q_tmpl),this.exprAllowed=!1},C.star.updateContext=function(p){if(p===C._function){var S=this.context.length-1;this.context[S]===St.f_expr?this.context[S]=St.f_expr_gen:this.context[S]=St.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 Ue=I.prototype;Ue.checkPropClash=function(p,S,E){if(!(this.options.ecmaVersion>=9&&p.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(p.computed||p.method||p.shorthand))){var M=p.key,B;switch(M.type){case"Identifier":B=M.name;break;case"Literal":B=String(M.value);break;default:return}var Z=p.kind;if(this.options.ecmaVersion>=6){B==="__proto__"&&Z==="init"&&(S.proto&&(E?E.doubleProto<0&&(E.doubleProto=M.start):this.raiseRecoverable(M.start,"Redefinition of __proto__ property")),S.proto=!0);return}B="$"+B;var re=S[B];if(re){var ye;Z==="init"?ye=this.strict&&re.init||re.get||re.set:ye=re.init||re[Z],ye&&this.raiseRecoverable(M.start,"Redefinition of property")}else re=S[B]={init:!1,get:!1,set:!1};re[Z]=!0}},Ue.parseExpression=function(p,S){var E=this.start,M=this.startLoc,B=this.parseMaybeAssign(p,S);if(this.type===C.comma){var Z=this.startNodeAt(E,M);for(Z.expressions=[B];this.eat(C.comma);)Z.expressions.push(this.parseMaybeAssign(p,S));return this.finishNode(Z,"SequenceExpression")}return B},Ue.parseMaybeAssign=function(p,S,E){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(p);this.exprAllowed=!1}var M=!1,B=-1,Z=-1,re=-1;S?(B=S.parenthesizedAssign,Z=S.trailingComma,re=S.doubleProto,S.parenthesizedAssign=S.trailingComma=-1):(S=new mr,M=!0);var ye=this.start,ve=this.startLoc;(this.type===C.parenL||this.type===C.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=p==="await");var Fe=this.parseMaybeConditional(p,S);if(E&&(Fe=E.call(this,Fe,ye,ve)),this.type.isAssign){var Qe=this.startNodeAt(ye,ve);return Qe.operator=this.value,this.type===C.eq&&(Fe=this.toAssignable(Fe,!1,S)),M||(S.parenthesizedAssign=S.trailingComma=S.doubleProto=-1),S.shorthandAssign>=Fe.start&&(S.shorthandAssign=-1),this.type===C.eq?this.checkLValPattern(Fe):this.checkLValSimple(Fe),Qe.left=Fe,this.next(),Qe.right=this.parseMaybeAssign(p),re>-1&&(S.doubleProto=re),this.finishNode(Qe,"AssignmentExpression")}else M&&this.checkExpressionErrors(S,!0);return B>-1&&(S.parenthesizedAssign=B),Z>-1&&(S.trailingComma=Z),Fe},Ue.parseMaybeConditional=function(p,S){var E=this.start,M=this.startLoc,B=this.parseExprOps(p,S);if(this.checkExpressionErrors(S))return B;if(this.eat(C.question)){var Z=this.startNodeAt(E,M);return Z.test=B,Z.consequent=this.parseMaybeAssign(),this.expect(C.colon),Z.alternate=this.parseMaybeAssign(p),this.finishNode(Z,"ConditionalExpression")}return B},Ue.parseExprOps=function(p,S){var E=this.start,M=this.startLoc,B=this.parseMaybeUnary(S,!1,!1,p);return this.checkExpressionErrors(S)||B.start===E&&B.type==="ArrowFunctionExpression"?B:this.parseExprOp(B,E,M,-1,p)},Ue.parseExprOp=function(p,S,E,M,B){var Z=this.type.binop;if(Z!=null&&(!B||this.type!==C._in)&&Z>M){var re=this.type===C.logicalOR||this.type===C.logicalAND,ye=this.type===C.coalesce;ye&&(Z=C.logicalAND.binop);var ve=this.value;this.next();var Fe=this.start,Qe=this.startLoc,vt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,B),Fe,Qe,Z,B),Ut=this.buildBinary(S,E,p,vt,ve,re||ye);return(re&&this.type===C.coalesce||ye&&(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(Ut,S,E,M,B)}return p},Ue.buildBinary=function(p,S,E,M,B,Z){M.type==="PrivateIdentifier"&&this.raise(M.start,"Private identifier can only be left side of binary expression");var re=this.startNodeAt(p,S);return re.left=E,re.operator=B,re.right=M,this.finishNode(re,Z?"LogicalExpression":"BinaryExpression")},Ue.parseMaybeUnary=function(p,S,E,M){var B=this.start,Z=this.startLoc,re;if(this.isContextual("await")&&this.canAwait)re=this.parseAwait(M),S=!0;else if(this.type.prefix){var ye=this.startNode(),ve=this.type===C.incDec;ye.operator=this.value,ye.prefix=!0,this.next(),ye.argument=this.parseMaybeUnary(null,!0,ve,M),this.checkExpressionErrors(p,!0),ve?this.checkLValSimple(ye.argument):this.strict&&ye.operator==="delete"&&hc(ye.argument)?this.raiseRecoverable(ye.start,"Deleting local variable in strict mode"):ye.operator==="delete"&&co(ye.argument)?this.raiseRecoverable(ye.start,"Private fields can not be deleted"):S=!0,re=this.finishNode(ye,ve?"UpdateExpression":"UnaryExpression")}else if(!S&&this.type===C.privateId)(M||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),re=this.parsePrivateIdent(),this.type!==C._in&&this.unexpected();else{if(re=this.parseExprSubscripts(p,M),this.checkExpressionErrors(p))return re;for(;this.type.postfix&&!this.canInsertSemicolon();){var Fe=this.startNodeAt(B,Z);Fe.operator=this.value,Fe.prefix=!1,Fe.argument=re,this.checkLValSimple(re),this.next(),re=this.finishNode(Fe,"UpdateExpression")}}if(!E&&this.eat(C.starstar))if(S)this.unexpected(this.lastTokStart);else return this.buildBinary(B,Z,re,this.parseMaybeUnary(null,!1,!1,M),"**",!1);else return re};function hc(p){return p.type==="Identifier"||p.type==="ParenthesizedExpression"&&hc(p.expression)}function co(p){return p.type==="MemberExpression"&&p.property.type==="PrivateIdentifier"||p.type==="ChainExpression"&&co(p.expression)||p.type==="ParenthesizedExpression"&&co(p.expression)}Ue.parseExprSubscripts=function(p,S){var E=this.start,M=this.startLoc,B=this.parseExprAtom(p,S);if(B.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return B;var Z=this.parseSubscripts(B,E,M,!1,S);return p&&Z.type==="MemberExpression"&&(p.parenthesizedAssign>=Z.start&&(p.parenthesizedAssign=-1),p.parenthesizedBind>=Z.start&&(p.parenthesizedBind=-1),p.trailingComma>=Z.start&&(p.trailingComma=-1)),Z},Ue.parseSubscripts=function(p,S,E,M,B){for(var Z=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,re=!1;;){var ye=this.parseSubscript(p,S,E,M,Z,re,B);if(ye.optional&&(re=!0),ye===p||ye.type==="ArrowFunctionExpression"){if(re){var ve=this.startNodeAt(S,E);ve.expression=ye,ye=this.finishNode(ve,"ChainExpression")}return ye}p=ye}},Ue.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(C.arrow)},Ue.parseSubscriptAsyncArrow=function(p,S,E,M){return this.parseArrowExpression(this.startNodeAt(p,S),E,!0,M)},Ue.parseSubscript=function(p,S,E,M,B,Z,re){var ye=this.options.ecmaVersion>=11,ve=ye&&this.eat(C.questionDot);M&&ve&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Fe=this.eat(C.bracketL);if(Fe||ve&&this.type!==C.parenL&&this.type!==C.backQuote||this.eat(C.dot)){var Qe=this.startNodeAt(S,E);Qe.object=p,Fe?(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=!!Fe,ye&&(Qe.optional=ve),p=this.finishNode(Qe,"MemberExpression")}else if(!M&&this.eat(C.parenL)){var vt=new mr,Ut=this.yieldPos,sa=this.awaitPos,Ht=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Jr=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1,vt);if(B&&!ve&&this.shouldParseAsyncArrow())return this.checkPatternErrors(vt,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=Ut,this.awaitPos=sa,this.awaitIdentPos=Ht,this.parseSubscriptAsyncArrow(S,E,Jr,re);this.checkExpressionErrors(vt,!0),this.yieldPos=Ut||this.yieldPos,this.awaitPos=sa||this.awaitPos,this.awaitIdentPos=Ht||this.awaitIdentPos;var wi=this.startNodeAt(S,E);wi.callee=p,wi.arguments=Jr,ye&&(wi.optional=ve),p=this.finishNode(wi,"CallExpression")}else if(this.type===C.backQuote){(ve||Z)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Ur=this.startNodeAt(S,E);Ur.tag=p,Ur.quasi=this.parseTemplate({isTagged:!0}),p=this.finishNode(Ur,"TaggedTemplateExpression")}return p},Ue.parseExprAtom=function(p,S,E){this.type===C.slash&&this.readRegexp();var M,B=this.potentialArrowAt===this.start;switch(this.type){case C._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),M=this.startNode(),this.next(),this.type===C.parenL&&!this.allowDirectSuper&&this.raise(M.start,"super() call outside constructor of a subclass"),this.type!==C.dot&&this.type!==C.bracketL&&this.type!==C.parenL&&this.unexpected(),this.finishNode(M,"Super");case C._this:return M=this.startNode(),this.next(),this.finishNode(M,"ThisExpression");case C.name:var Z=this.start,re=this.startLoc,ye=this.containsEsc,ve=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!ye&&ve.name==="async"&&!this.canInsertSemicolon()&&this.eat(C._function))return this.overrideContext(St.f_expr),this.parseFunction(this.startNodeAt(Z,re),0,!1,!0,S);if(B&&!this.canInsertSemicolon()){if(this.eat(C.arrow))return this.parseArrowExpression(this.startNodeAt(Z,re),[ve],!1,S);if(this.options.ecmaVersion>=8&&ve.name==="async"&&this.type===C.name&&!ye&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return ve=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(C.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(Z,re),[ve],!0,S)}return ve;case C.regexp:var Fe=this.value;return M=this.parseLiteral(Fe.value),M.regex={pattern:Fe.pattern,flags:Fe.flags},M;case C.num:case C.string:return this.parseLiteral(this.value);case C._null:case C._true:case C._false:return M=this.startNode(),M.value=this.type===C._null?null:this.type===C._true,M.raw=this.type.keyword,this.next(),this.finishNode(M,"Literal");case C.parenL:var Qe=this.start,vt=this.parseParenAndDistinguishExpression(B,S);return p&&(p.parenthesizedAssign<0&&!this.isSimpleAssignTarget(vt)&&(p.parenthesizedAssign=Qe),p.parenthesizedBind<0&&(p.parenthesizedBind=Qe)),vt;case C.bracketL:return M=this.startNode(),this.next(),M.elements=this.parseExprList(C.bracketR,!0,!0,p),this.finishNode(M,"ArrayExpression");case C.braceL:return this.overrideContext(St.b_expr),this.parseObj(!1,p);case C._function:return M=this.startNode(),this.next(),this.parseFunction(M,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(E):this.unexpected();default:return this.parseExprAtomDefault()}},Ue.parseExprAtomDefault=function(){this.unexpected()},Ue.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 E=this.startNodeAt(S.start,S.loc&&S.loc.start);return E.name="import",S.meta=this.finishNode(E,"Identifier"),this.parseImportMeta(S)}else this.unexpected()},Ue.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")},Ue.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")},Ue.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")},Ue.parseParenExpression=function(){this.expect(C.parenL);var p=this.parseExpression();return this.expect(C.parenR),p},Ue.shouldParseArrow=function(p){return!this.canInsertSemicolon()},Ue.parseParenAndDistinguishExpression=function(p,S){var E=this.start,M=this.startLoc,B,Z=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var re=this.start,ye=this.startLoc,ve=[],Fe=!0,Qe=!1,vt=new mr,Ut=this.yieldPos,sa=this.awaitPos,Ht;for(this.yieldPos=0,this.awaitPos=0;this.type!==C.parenR;)if(Fe?Fe=!1:this.expect(C.comma),Z&&this.afterTrailingComma(C.parenR,!0)){Qe=!0;break}else if(this.type===C.ellipsis){Ht=this.start,ve.push(this.parseParenItem(this.parseRestBinding())),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else ve.push(this.parseMaybeAssign(!1,vt,this.parseParenItem));var Jr=this.lastTokEnd,wi=this.lastTokEndLoc;if(this.expect(C.parenR),p&&this.shouldParseArrow(ve)&&this.eat(C.arrow))return this.checkPatternErrors(vt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Ut,this.awaitPos=sa,this.parseParenArrowList(E,M,ve,S);(!ve.length||Qe)&&this.unexpected(this.lastTokStart),Ht&&this.unexpected(Ht),this.checkExpressionErrors(vt,!0),this.yieldPos=Ut||this.yieldPos,this.awaitPos=sa||this.awaitPos,ve.length>1?(B=this.startNodeAt(re,ye),B.expressions=ve,this.finishNodeAt(B,"SequenceExpression",Jr,wi)):B=ve[0]}else B=this.parseParenExpression();if(this.options.preserveParens){var Ur=this.startNodeAt(E,M);return Ur.expression=B,this.finishNode(Ur,"ParenthesizedExpression")}else return B},Ue.parseParenItem=function(p){return p},Ue.parseParenArrowList=function(p,S,E,M){return this.parseArrowExpression(this.startNodeAt(p,S),E,!1,M)};var fo=[];Ue.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 E=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'"),E&&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 M=this.start,B=this.startLoc;return p.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),M,B,!0,!1),this.eat(C.parenL)?p.arguments=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1):p.arguments=fo,this.finishNode(p,"NewExpression")},Ue.parseTemplateElement=function(p){var S=p.isTagged,E=this.startNode();return this.type===C.invalidTemplate?(S||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),E.value={raw:this.value.replace(/\r\n?/g,`
80
+ `),cooked:null}):E.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
81
+ `),cooked:this.value},this.next(),E.tail=this.type===C.backQuote,this.finishNode(E,"TemplateElement")},Ue.parseTemplate=function(p){p===void 0&&(p={});var S=p.isTagged;S===void 0&&(S=!1);var E=this.startNode();this.next(),E.expressions=[];var M=this.parseTemplateElement({isTagged:S});for(E.quasis=[M];!M.tail;)this.type===C.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(C.dollarBraceL),E.expressions.push(this.parseExpression()),this.expect(C.braceR),E.quasis.push(M=this.parseTemplateElement({isTagged:S}));return this.next(),this.finishNode(E,"TemplateLiteral")},Ue.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)&&!_.test(this.input.slice(this.lastTokEnd,this.start))},Ue.parseObj=function(p,S){var E=this.startNode(),M=!0,B={};for(E.properties=[],this.next();!this.eat(C.braceR);){if(M)M=!1;else if(this.expect(C.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(C.braceR))break;var Z=this.parseProperty(p,S);p||this.checkPropClash(Z,B,S),E.properties.push(Z)}return this.finishNode(E,p?"ObjectPattern":"ObjectExpression")},Ue.parseProperty=function(p,S){var E=this.startNode(),M,B,Z,re;if(this.options.ecmaVersion>=9&&this.eat(C.ellipsis))return p?(E.argument=this.parseIdent(!1),this.type===C.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(E,"RestElement")):(E.argument=this.parseMaybeAssign(!1,S),this.type===C.comma&&S&&S.trailingComma<0&&(S.trailingComma=this.start),this.finishNode(E,"SpreadElement"));this.options.ecmaVersion>=6&&(E.method=!1,E.shorthand=!1,(p||S)&&(Z=this.start,re=this.startLoc),p||(M=this.eat(C.star)));var ye=this.containsEsc;return this.parsePropertyName(E),!p&&!ye&&this.options.ecmaVersion>=8&&!M&&this.isAsyncProp(E)?(B=!0,M=this.options.ecmaVersion>=9&&this.eat(C.star),this.parsePropertyName(E)):B=!1,this.parsePropertyValue(E,p,M,B,Z,re,S,ye),this.finishNode(E,"Property")},Ue.parseGetterSetter=function(p){var S=p.key.name;this.parsePropertyName(p),p.value=this.parseMethod(!1),p.kind=S;var E=p.kind==="get"?0:1;if(p.value.params.length!==E){var M=p.value.start;p.kind==="get"?this.raiseRecoverable(M,"getter should have no params"):this.raiseRecoverable(M,"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")},Ue.parsePropertyValue=function(p,S,E,M,B,Z,re,ye){(E||M)&&this.type===C.colon&&this.unexpected(),this.eat(C.colon)?(p.value=S?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,re),p.kind="init"):this.options.ecmaVersion>=6&&this.type===C.parenL?(S&&this.unexpected(),p.method=!0,p.value=this.parseMethod(E,M),p.kind="init"):!S&&!ye&&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?((E||M)&&this.unexpected(),this.parseGetterSetter(p)):this.options.ecmaVersion>=6&&!p.computed&&p.key.type==="Identifier"?((E||M)&&this.unexpected(),this.checkUnreserved(p.key),p.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=B),S?p.value=this.parseMaybeDefault(B,Z,this.copyNode(p.key)):this.type===C.eq&&re?(re.shorthandAssign<0&&(re.shorthandAssign=this.start),p.value=this.parseMaybeDefault(B,Z,this.copyNode(p.key))):p.value=this.copyNode(p.key),p.kind="init",p.shorthand=!0):this.unexpected()},Ue.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")},Ue.initFunction=function(p){p.id=null,this.options.ecmaVersion>=6&&(p.generator=p.expression=!1),this.options.ecmaVersion>=8&&(p.async=!1)},Ue.parseMethod=function(p,S,E){var M=this.startNode(),B=this.yieldPos,Z=this.awaitPos,re=this.awaitIdentPos;return this.initFunction(M),this.options.ecmaVersion>=6&&(M.generator=p),this.options.ecmaVersion>=8&&(M.async=!!S),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(je(S,M.generator)|pn|(E?pr:0)),this.expect(C.parenL),M.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(M,!1,!0,!1),this.yieldPos=B,this.awaitPos=Z,this.awaitIdentPos=re,this.finishNode(M,"FunctionExpression")},Ue.parseArrowExpression=function(p,S,E,M){var B=this.yieldPos,Z=this.awaitPos,re=this.awaitIdentPos;return this.enterScope(je(E,!1)|hr),this.initFunction(p),this.options.ecmaVersion>=8&&(p.async=!!E),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,p.params=this.toAssignableList(S,!0),this.parseFunctionBody(p,!0,!1,M),this.yieldPos=B,this.awaitPos=Z,this.awaitIdentPos=re,this.finishNode(p,"ArrowFunctionExpression")},Ue.parseFunctionBody=function(p,S,E,M){var B=S&&this.type!==C.braceL,Z=this.strict,re=!1;if(B)p.body=this.parseMaybeAssign(M),p.expression=!0,this.checkParams(p,!1);else{var ye=this.options.ecmaVersion>=7&&!this.isSimpleParamList(p.params);(!Z||ye)&&(re=this.strictDirective(this.end),re&&ye&&this.raiseRecoverable(p.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var ve=this.labels;this.labels=[],re&&(this.strict=!0),this.checkParams(p,!Z&&!re&&!S&&!E&&this.isSimpleParamList(p.params)),this.strict&&p.id&&this.checkLValSimple(p.id,ge),p.body=this.parseBlock(!1,void 0,re&&!Z),p.expression=!1,this.adaptDirectivePrologue(p.body.body),this.labels=ve}this.exitScope()},Ue.isSimpleParamList=function(p){for(var S=0,E=p;S<E.length;S+=1){var M=E[S];if(M.type!=="Identifier")return!1}return!0},Ue.checkParams=function(p,S){for(var E=Object.create(null),M=0,B=p.params;M<B.length;M+=1){var Z=B[M];this.checkLValInnerPattern(Z,mt,S?null:E)}},Ue.parseExprList=function(p,S,E,M){for(var B=[],Z=!0;!this.eat(p);){if(Z)Z=!1;else if(this.expect(C.comma),S&&this.afterTrailingComma(p))break;var re=void 0;E&&this.type===C.comma?re=null:this.type===C.ellipsis?(re=this.parseSpread(M),M&&this.type===C.comma&&M.trailingComma<0&&(M.trailingComma=this.start)):re=this.parseMaybeAssign(!1,M),B.push(re)}return B},Ue.checkUnreserved=function(p){var S=p.start,E=p.end,M=p.name;if(this.inGenerator&&M==="yield"&&this.raiseRecoverable(S,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&M==="await"&&this.raiseRecoverable(S,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&he)&&M==="arguments"&&this.raiseRecoverable(S,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(M==="arguments"||M==="await")&&this.raise(S,"Cannot use "+M+" in class static initialization block"),this.keywords.test(M)&&this.raise(S,"Unexpected keyword '"+M+"'"),!(this.options.ecmaVersion<6&&this.input.slice(S,E).indexOf("\\")!==-1)){var B=this.strict?this.reservedWordsStrict:this.reservedWords;B.test(M)&&(!this.inAsync&&M==="await"&&this.raiseRecoverable(S,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(S,"The keyword '"+M+"' is reserved"))}},Ue.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},Ue.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},Ue.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},Ue.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")},Ue.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 _l=I.prototype;_l.raise=function(p,S){var E=xe(this.input,p);S+=" ("+E.line+":"+E.column+")",this.sourceFile&&(S+=" in "+this.sourceFile);var M=new SyntaxError(S);throw M.pos=p,M.loc=E,M.raisedAt=this.pos,M},_l.raiseRecoverable=_l.raise,_l.curPosition=function(){if(this.options.locations)return new te(this.curLine,this.pos-this.lineStart)};var bi=I.prototype,Ip=function(S){this.flags=S,this.var=[],this.lexical=[],this.functions=[]};bi.enterScope=function(p){this.scopeStack.push(new Ip(p))},bi.exitScope=function(){this.scopeStack.pop()},bi.treatFunctionsAsVarInScope=function(p){return p.flags&Pt||!this.inModule&&p.flags&Ke},bi.declareName=function(p,S,E){var M=!1;if(S===Be){var B=this.currentScope();M=B.lexical.indexOf(p)>-1||B.functions.indexOf(p)>-1||B.var.indexOf(p)>-1,B.lexical.push(p),this.inModule&&B.flags&Ke&&delete this.undefinedExports[p]}else if(S===fe){var Z=this.currentScope();Z.lexical.push(p)}else if(S===gn){var re=this.currentScope();this.treatFunctionsAsVar?M=re.lexical.indexOf(p)>-1:M=re.lexical.indexOf(p)>-1||re.var.indexOf(p)>-1,re.functions.push(p)}else for(var ye=this.scopeStack.length-1;ye>=0;--ye){var ve=this.scopeStack[ye];if(ve.lexical.indexOf(p)>-1&&!(ve.flags&hn&&ve.lexical[0]===p)||!this.treatFunctionsAsVarInScope(ve)&&ve.functions.indexOf(p)>-1){M=!0;break}if(ve.var.push(p),this.inModule&&ve.flags&Ke&&delete this.undefinedExports[p],ve.flags&he)break}M&&this.raiseRecoverable(E,"Identifier '"+p+"' has already been declared")},bi.checkLocalExport=function(p){this.scopeStack[0].lexical.indexOf(p.name)===-1&&this.scopeStack[0].var.indexOf(p.name)===-1&&(this.undefinedExports[p.name]=p)},bi.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},bi.currentVarScope=function(){for(var p=this.scopeStack.length-1;;p--){var S=this.scopeStack[p];if(S.flags&(he|mn|dn))return S}},bi.currentThisScope=function(){for(var p=this.scopeStack.length-1;;p--){var S=this.scopeStack[p];if(S.flags&(he|mn|dn)&&!(S.flags&hr))return S}};var Qs=function(S,E,M){this.type="",this.start=E,this.end=0,S.options.locations&&(this.loc=new z(S,M)),S.options.directSourceFile&&(this.sourceFile=S.options.directSourceFile),S.options.ranges&&(this.range=[E,0])},us=I.prototype;us.startNode=function(){return new Qs(this,this.start,this.startLoc)},us.startNodeAt=function(p,S){return new Qs(this,p,S)};function zl(p,S,E,M){return p.type=S,p.end=E,this.options.locations&&(p.loc.end=M),this.options.ranges&&(p.range[1]=E),p}us.finishNode=function(p,S){return zl.call(this,p,S,this.lastTokEnd,this.lastTokEndLoc)},us.finishNodeAt=function(p,S,E,M){return zl.call(this,p,S,E,M)},us.copyNode=function(p){var S=new Qs(this,p.start,this.startLoc);for(var E in p)S[E]=p[E];return S};var _p="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",pc="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",Si=pc+" Extended_Pictographic",Wt=Si,xn=Wt+" EBase EComp EMod EPres ExtPict",cs=xn,dc=cs,E0={9:pc,10:Si,11:Wt,12:xn,13:cs,14:dc},A0="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",zp={9:"",10:"",11:"",12:"",13:"",14:A0},Zs="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",Ll="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",fs=Ll+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",hs=fs+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",ea=hs+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ps=ea+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Xt=ps+" "+_p,Lp={9:Ll,10:fs,11:hs,12:ea,13:ps,14:Xt},mc={};function ds(p){var S=mc[p]={binary:_e(E0[p]+" "+Zs),binaryOfStrings:_e(zp[p]),nonBinary:{General_Category:_e(Zs),Script:_e(Lp[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 Fi=0,Bp=[9,10,11,12,13,14];Fi<Bp.length;Fi+=1){var Fp=Bp[Fi];ds(Fp)}var Ne=I.prototype,Bl=function(S,E){this.parent=S,this.base=E||this};Bl.prototype.separatedFrom=function(S){for(var E=this;E;E=E.parent)for(var M=S;M;M=M.parent)if(E.base===M.base&&E!==M)return!0;return!1},Bl.prototype.sibling=function(){return new Bl(this.parent,this.base)};var Hn=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=mc[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};Hn.prototype.reset=function(S,E,M){var B=M.indexOf("v")!==-1,Z=M.indexOf("u")!==-1;this.start=S|0,this.source=E+"",this.flags=M,B&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=Z&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=Z&&this.parser.options.ecmaVersion>=9)},Hn.prototype.raise=function(S){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+S)},Hn.prototype.at=function(S,E){E===void 0&&(E=!1);var M=this.source,B=M.length;if(S>=B)return-1;var Z=M.charCodeAt(S);if(!(E||this.switchU)||Z<=55295||Z>=57344||S+1>=B)return Z;var re=M.charCodeAt(S+1);return re>=56320&&re<=57343?(Z<<10)+re-56613888:Z},Hn.prototype.nextIndex=function(S,E){E===void 0&&(E=!1);var M=this.source,B=M.length;if(S>=B)return B;var Z=M.charCodeAt(S),re;return!(E||this.switchU)||Z<=55295||Z>=57344||S+1>=B||(re=M.charCodeAt(S+1))<56320||re>57343?S+1:S+2},Hn.prototype.current=function(S){return S===void 0&&(S=!1),this.at(this.pos,S)},Hn.prototype.lookahead=function(S){return S===void 0&&(S=!1),this.at(this.nextIndex(this.pos,S),S)},Hn.prototype.advance=function(S){S===void 0&&(S=!1),this.pos=this.nextIndex(this.pos,S)},Hn.prototype.eat=function(S,E){return E===void 0&&(E=!1),this.current(E)===S?(this.advance(E),!0):!1},Hn.prototype.eatChars=function(S,E){E===void 0&&(E=!1);for(var M=this.pos,B=0,Z=S;B<Z.length;B+=1){var re=Z[B],ye=this.at(M,E);if(ye===-1||ye!==re)return!1;M=this.nextIndex(M,E)}return this.pos=M,!0},Ne.validateRegExpFlags=function(p){for(var S=p.validFlags,E=p.flags,M=!1,B=!1,Z=0;Z<E.length;Z++){var re=E.charAt(Z);S.indexOf(re)===-1&&this.raise(p.start,"Invalid regular expression flag"),E.indexOf(re,Z+1)>-1&&this.raise(p.start,"Duplicate regular expression flag"),re==="u"&&(M=!0),re==="v"&&(B=!0)}this.options.ecmaVersion>=15&&M&&B&&this.raise(p.start,"Invalid regular expression flag")};function Fl(p){for(var S in p)return!0;return!1}Ne.validateRegExpPattern=function(p){this.regexp_pattern(p),!p.switchN&&this.options.ecmaVersion>=9&&Fl(p.groupNames)&&(p.switchN=!0,this.regexp_pattern(p))},Ne.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,E=p.backReferenceNames;S<E.length;S+=1){var M=E[S];p.groupNames[M]||p.raise("Invalid named capture referenced")}},Ne.regexp_disjunction=function(p){var S=this.options.ecmaVersion>=16;for(S&&(p.branchID=new Bl(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")},Ne.regexp_alternative=function(p){for(;p.pos<p.source.length&&this.regexp_eatTerm(p););},Ne.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},Ne.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 E=!1;if(this.options.ecmaVersion>=9&&(E=p.eat(60)),p.eat(61)||p.eat(33))return this.regexp_disjunction(p),p.eat(41)||p.raise("Unterminated group"),p.lastAssertionIsQuantifiable=!E,!0}return p.pos=S,!1},Ne.regexp_eatQuantifier=function(p,S){return S===void 0&&(S=!1),this.regexp_eatQuantifierPrefix(p,S)?(p.eat(63),!0):!1},Ne.regexp_eatQuantifierPrefix=function(p,S){return p.eat(42)||p.eat(43)||p.eat(63)||this.regexp_eatBracedQuantifier(p,S)},Ne.regexp_eatBracedQuantifier=function(p,S){var E=p.pos;if(p.eat(123)){var M=0,B=-1;if(this.regexp_eatDecimalDigits(p)&&(M=p.lastIntValue,p.eat(44)&&this.regexp_eatDecimalDigits(p)&&(B=p.lastIntValue),p.eat(125)))return B!==-1&&B<M&&!S&&p.raise("numbers out of order in {} quantifier"),!0;p.switchU&&!S&&p.raise("Incomplete quantifier"),p.pos=E}return!1},Ne.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)},Ne.regexp_eatReverseSolidusAtomEscape=function(p){var S=p.pos;if(p.eat(92)){if(this.regexp_eatAtomEscape(p))return!0;p.pos=S}return!1},Ne.regexp_eatUncapturingGroup=function(p){var S=p.pos;if(p.eat(40)){if(p.eat(63)){if(this.options.ecmaVersion>=16){var E=this.regexp_eatModifiers(p),M=p.eat(45);if(E||M){for(var B=0;B<E.length;B++){var Z=E.charAt(B);E.indexOf(Z,B+1)>-1&&p.raise("Duplicate regular expression modifiers")}if(M){var re=this.regexp_eatModifiers(p);!E&&!re&&p.current()===58&&p.raise("Invalid regular expression modifiers");for(var ye=0;ye<re.length;ye++){var ve=re.charAt(ye);(re.indexOf(ve,ye+1)>-1||E.indexOf(ve)>-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},Ne.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},Ne.regexp_eatModifiers=function(p){for(var S="",E=0;(E=p.current())!==-1&&vi(E);)S+=j(E),p.advance();return S};function vi(p){return p===105||p===109||p===115}Ne.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)},Ne.regexp_eatInvalidBracedQuantifier=function(p){return this.regexp_eatBracedQuantifier(p,!0)&&p.raise("Nothing to repeat"),!1},Ne.regexp_eatSyntaxCharacter=function(p){var S=p.current();return qn(S)?(p.lastIntValue=S,p.advance(),!0):!1};function qn(p){return p===36||p>=40&&p<=43||p===46||p===63||p>=91&&p<=94||p>=123&&p<=125}Ne.regexp_eatPatternCharacters=function(p){for(var S=p.pos,E=0;(E=p.current())!==-1&&!qn(E);)p.advance();return p.pos!==S},Ne.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},Ne.regexp_groupSpecifier=function(p){if(p.eat(63)){this.regexp_eatGroupName(p)||p.raise("Invalid group");var S=this.options.ecmaVersion>=16,E=p.groupNames[p.lastStringValue];if(E)if(S)for(var M=0,B=E;M<B.length;M+=1){var Z=B[M];Z.separatedFrom(p.branchID)||p.raise("Duplicate capture group name")}else p.raise("Duplicate capture group name");S?(E||(p.groupNames[p.lastStringValue]=[])).push(p.branchID):p.groupNames[p.lastStringValue]=!0}},Ne.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},Ne.regexp_eatRegExpIdentifierName=function(p){if(p.lastStringValue="",this.regexp_eatRegExpIdentifierStart(p)){for(p.lastStringValue+=j(p.lastIntValue);this.regexp_eatRegExpIdentifierPart(p);)p.lastStringValue+=j(p.lastIntValue);return!0}return!1},Ne.regexp_eatRegExpIdentifierStart=function(p){var S=p.pos,E=this.options.ecmaVersion>=11,M=p.current(E);return p.advance(E),M===92&&this.regexp_eatRegExpUnicodeEscapeSequence(p,E)&&(M=p.lastIntValue),Vp(M)?(p.lastIntValue=M,!0):(p.pos=S,!1)};function Vp(p){return k(p,!0)||p===36||p===95}Ne.regexp_eatRegExpIdentifierPart=function(p){var S=p.pos,E=this.options.ecmaVersion>=11,M=p.current(E);return p.advance(E),M===92&&this.regexp_eatRegExpUnicodeEscapeSequence(p,E)&&(M=p.lastIntValue),N0(M)?(p.lastIntValue=M,!0):(p.pos=S,!1)};function N0(p){return w(p,!0)||p===36||p===95||p===8204||p===8205}Ne.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)},Ne.regexp_eatBackReference=function(p){var S=p.pos;if(this.regexp_eatDecimalEscape(p)){var E=p.lastIntValue;if(p.switchU)return E>p.maxBackReference&&(p.maxBackReference=E),!0;if(E<=p.numCapturingParens)return!0;p.pos=S}return!1},Ne.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},Ne.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)},Ne.regexp_eatCControlLetter=function(p){var S=p.pos;if(p.eat(99)){if(this.regexp_eatControlLetter(p))return!0;p.pos=S}return!1},Ne.regexp_eatZero=function(p){return p.current()===48&&!Ci(p.lookahead())?(p.lastIntValue=0,p.advance(),!0):!1},Ne.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},Ne.regexp_eatControlLetter=function(p){var S=p.current();return Vl(S)?(p.lastIntValue=S%32,p.advance(),!0):!1};function Vl(p){return p>=65&&p<=90||p>=97&&p<=122}Ne.regexp_eatRegExpUnicodeEscapeSequence=function(p,S){S===void 0&&(S=!1);var E=p.pos,M=S||p.switchU;if(p.eat(117)){if(this.regexp_eatFixedHexDigits(p,4)){var B=p.lastIntValue;if(M&&B>=55296&&B<=56319){var Z=p.pos;if(p.eat(92)&&p.eat(117)&&this.regexp_eatFixedHexDigits(p,4)){var re=p.lastIntValue;if(re>=56320&&re<=57343)return p.lastIntValue=(B-55296)*1024+(re-56320)+65536,!0}p.pos=Z,p.lastIntValue=B}return!0}if(M&&p.eat(123)&&this.regexp_eatHexDigits(p)&&p.eat(125)&&Pp(p.lastIntValue))return!0;M&&p.raise("Invalid unicode escape"),p.pos=E}return!1};function Pp(p){return p>=0&&p<=1114111}Ne.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},Ne.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 ho=0,ki=1,It=2;Ne.regexp_eatCharacterClassEscape=function(p){var S=p.current();if(gc(S))return p.lastIntValue=-1,p.advance(),ki;var E=!1;if(p.switchU&&this.options.ecmaVersion>=9&&((E=S===80)||S===112)){p.lastIntValue=-1,p.advance();var M;if(p.eat(123)&&(M=this.regexp_eatUnicodePropertyValueExpression(p))&&p.eat(125))return E&&M===It&&p.raise("Invalid property name"),M;p.raise("Invalid property name")}return ho};function gc(p){return p===100||p===68||p===115||p===83||p===119||p===87}Ne.regexp_eatUnicodePropertyValueExpression=function(p){var S=p.pos;if(this.regexp_eatUnicodePropertyName(p)&&p.eat(61)){var E=p.lastStringValue;if(this.regexp_eatUnicodePropertyValue(p)){var M=p.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(p,E,M),ki}}if(p.pos=S,this.regexp_eatLoneUnicodePropertyNameOrValue(p)){var B=p.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(p,B)}return ho},Ne.regexp_validateUnicodePropertyNameAndValue=function(p,S,E){X(p.unicodeProperties.nonBinary,S)||p.raise("Invalid property name"),p.unicodeProperties.nonBinary[S].test(E)||p.raise("Invalid property value")},Ne.regexp_validateUnicodePropertyNameOrValue=function(p,S){if(p.unicodeProperties.binary.test(S))return ki;if(p.switchV&&p.unicodeProperties.binaryOfStrings.test(S))return It;p.raise("Invalid property name")},Ne.regexp_eatUnicodePropertyName=function(p){var S=0;for(p.lastStringValue="";yc(S=p.current());)p.lastStringValue+=j(S),p.advance();return p.lastStringValue!==""};function yc(p){return Vl(p)||p===95}Ne.regexp_eatUnicodePropertyValue=function(p){var S=0;for(p.lastStringValue="";xc(S=p.current());)p.lastStringValue+=j(S),p.advance();return p.lastStringValue!==""};function xc(p){return yc(p)||Ci(p)}Ne.regexp_eatLoneUnicodePropertyNameOrValue=function(p){return this.regexp_eatUnicodePropertyValue(p)},Ne.regexp_eatCharacterClass=function(p){if(p.eat(91)){var S=p.eat(94),E=this.regexp_classContents(p);return p.eat(93)||p.raise("Unterminated character class"),S&&E===It&&p.raise("Negated character class may contain strings"),!0}return!1},Ne.regexp_classContents=function(p){return p.current()===93?ki:p.switchV?this.regexp_classSetExpression(p):(this.regexp_nonEmptyClassRanges(p),ki)},Ne.regexp_nonEmptyClassRanges=function(p){for(;this.regexp_eatClassAtom(p);){var S=p.lastIntValue;if(p.eat(45)&&this.regexp_eatClassAtom(p)){var E=p.lastIntValue;p.switchU&&(S===-1||E===-1)&&p.raise("Invalid character class"),S!==-1&&E!==-1&&S>E&&p.raise("Range out of order in character class")}}},Ne.regexp_eatClassAtom=function(p){var S=p.pos;if(p.eat(92)){if(this.regexp_eatClassEscape(p))return!0;if(p.switchU){var E=p.current();(E===99||Sc(E))&&p.raise("Invalid class escape"),p.raise("Invalid escape")}p.pos=S}var M=p.current();return M!==93?(p.lastIntValue=M,p.advance(),!0):!1},Ne.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)},Ne.regexp_classSetExpression=function(p){var S=ki,E;if(!this.regexp_eatClassSetRange(p))if(E=this.regexp_eatClassSetOperand(p)){E===It&&(S=It);for(var M=p.pos;p.eatChars([38,38]);){if(p.current()!==38&&(E=this.regexp_eatClassSetOperand(p))){E!==It&&(S=ki);continue}p.raise("Invalid character in character class")}if(M!==p.pos)return S;for(;p.eatChars([45,45]);)this.regexp_eatClassSetOperand(p)||p.raise("Invalid character in character class");if(M!==p.pos)return S}else p.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(p)){if(E=this.regexp_eatClassSetOperand(p),!E)return S;E===It&&(S=It)}},Ne.regexp_eatClassSetRange=function(p){var S=p.pos;if(this.regexp_eatClassSetCharacter(p)){var E=p.lastIntValue;if(p.eat(45)&&this.regexp_eatClassSetCharacter(p)){var M=p.lastIntValue;return E!==-1&&M!==-1&&E>M&&p.raise("Range out of order in character class"),!0}p.pos=S}return!1},Ne.regexp_eatClassSetOperand=function(p){return this.regexp_eatClassSetCharacter(p)?ki:this.regexp_eatClassStringDisjunction(p)||this.regexp_eatNestedClass(p)},Ne.regexp_eatNestedClass=function(p){var S=p.pos;if(p.eat(91)){var E=p.eat(94),M=this.regexp_classContents(p);if(p.eat(93))return E&&M===It&&p.raise("Negated character class may contain strings"),M;p.pos=S}if(p.eat(92)){var B=this.regexp_eatCharacterClassEscape(p);if(B)return B;p.pos=S}return null},Ne.regexp_eatClassStringDisjunction=function(p){var S=p.pos;if(p.eatChars([92,113])){if(p.eat(123)){var E=this.regexp_classStringDisjunctionContents(p);if(p.eat(125))return E}else p.raise("Invalid escape");p.pos=S}return null},Ne.regexp_classStringDisjunctionContents=function(p){for(var S=this.regexp_classString(p);p.eat(124);)this.regexp_classString(p)===It&&(S=It);return S},Ne.regexp_classString=function(p){for(var S=0;this.regexp_eatClassSetCharacter(p);)S++;return S===1?ki:It},Ne.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 E=p.current();return E<0||E===p.lookahead()&&ta(E)||jp(E)?!1:(p.advance(),p.lastIntValue=E,!0)};function ta(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 jp(p){return p===40||p===41||p===45||p===47||p>=91&&p<=93||p>=123&&p<=125}Ne.regexp_eatClassSetReservedPunctuator=function(p){var S=p.current();return $p(S)?(p.lastIntValue=S,p.advance(),!0):!1};function $p(p){return p===33||p===35||p===37||p===38||p===44||p===45||p>=58&&p<=62||p===64||p===96||p===126}Ne.regexp_eatClassControlLetter=function(p){var S=p.current();return Ci(S)||S===95?(p.lastIntValue=S%32,p.advance(),!0):!1},Ne.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},Ne.regexp_eatDecimalDigits=function(p){var S=p.pos,E=0;for(p.lastIntValue=0;Ci(E=p.current());)p.lastIntValue=10*p.lastIntValue+(E-48),p.advance();return p.pos!==S};function Ci(p){return p>=48&&p<=57}Ne.regexp_eatHexDigits=function(p){var S=p.pos,E=0;for(p.lastIntValue=0;Jp(E=p.current());)p.lastIntValue=16*p.lastIntValue+bc(E),p.advance();return p.pos!==S};function Jp(p){return p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102}function bc(p){return p>=65&&p<=70?10+(p-65):p>=97&&p<=102?10+(p-97):p-48}Ne.regexp_eatLegacyOctalEscapeSequence=function(p){if(this.regexp_eatOctalDigit(p)){var S=p.lastIntValue;if(this.regexp_eatOctalDigit(p)){var E=p.lastIntValue;S<=3&&this.regexp_eatOctalDigit(p)?p.lastIntValue=S*64+E*8+p.lastIntValue:p.lastIntValue=S*8+E}else p.lastIntValue=S;return!0}return!1},Ne.regexp_eatOctalDigit=function(p){var S=p.current();return Sc(S)?(p.lastIntValue=S-48,p.advance(),!0):(p.lastIntValue=0,!1)};function Sc(p){return p>=48&&p<=55}Ne.regexp_eatFixedHexDigits=function(p,S){var E=p.pos;p.lastIntValue=0;for(var M=0;M<S;++M){var B=p.current();if(!Jp(B))return p.pos=E,!1;p.lastIntValue=16*p.lastIntValue+bc(B),p.advance()}return!0};var na=function(S){this.type=S.type,this.value=S.value,this.start=S.start,this.end=S.end,S.options.locations&&(this.loc=new z(S,S.startLoc,S.endLoc)),S.options.ranges&&(this.range=[S.start,S.end])},nt=I.prototype;nt.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 na(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},nt.getToken=function(){return this.next(),new na(this)},typeof Symbol<"u"&&(nt[Symbol.iterator]=function(){var p=this;return{next:function(){var S=p.getToken();return{done:S.type===C.eof,value:S}}}}),nt.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())},nt.readToken=function(p){return k(p,this.options.ecmaVersion>=6)||p===92?this.readWord():this.getTokenFromCode(p)},nt.fullCharCodeAt=function(p){var S=this.input.charCodeAt(p);if(S<=55295||S>=56320)return S;var E=this.input.charCodeAt(p+1);return E<=56319||E>=57344?S:(S<<10)+E-56613888},nt.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},nt.skipBlockComment=function(){var p=this.options.onComment&&this.curPosition(),S=this.pos,E=this.input.indexOf("*/",this.pos+=2);if(E===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=E+2,this.options.locations)for(var M=void 0,B=S;(M=H(this.input,B,this.pos))>-1;)++this.curLine,B=this.lineStart=M;this.options.onComment&&this.options.onComment(!0,this.input.slice(S+2,E),S,this.pos,p,this.curPosition())},nt.skipLineComment=function(p){for(var S=this.pos,E=this.options.onComment&&this.curPosition(),M=this.input.charCodeAt(this.pos+=p);this.pos<this.input.length&&!$(M);)M=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(S+p,this.pos),S,this.pos,E,this.curPosition())},nt.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&&ue.test(String.fromCharCode(p)))++this.pos;else break e}}},nt.finishToken=function(p,S){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var E=this.type;this.type=p,this.value=S,this.updateContext(E)},nt.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))},nt.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)},nt.readToken_mult_modulo_exp=function(p){var S=this.input.charCodeAt(this.pos+1),E=1,M=p===42?C.star:C.modulo;return this.options.ecmaVersion>=7&&p===42&&S===42&&(++E,M=C.starstar,S=this.input.charCodeAt(this.pos+2)),S===61?this.finishOp(C.assign,E+1):this.finishOp(M,E)},nt.readToken_pipe_amp=function(p){var S=this.input.charCodeAt(this.pos+1);if(S===p){if(this.options.ecmaVersion>=12){var E=this.input.charCodeAt(this.pos+2);if(E===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)},nt.readToken_caret=function(){var p=this.input.charCodeAt(this.pos+1);return p===61?this.finishOp(C.assign,2):this.finishOp(C.bitwiseXOR,1)},nt.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||_.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)},nt.readToken_lt_gt=function(p){var S=this.input.charCodeAt(this.pos+1),E=1;return S===p?(E=p===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+E)===61?this.finishOp(C.assign,E+1):this.finishOp(C.bitShift,E)):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&&(E=2),this.finishOp(C.relational,E))},nt.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)},nt.readToken_question=function(){var p=this.options.ecmaVersion;if(p>=11){var S=this.input.charCodeAt(this.pos+1);if(S===46){var E=this.input.charCodeAt(this.pos+2);if(E<48||E>57)return this.finishOp(C.questionDot,2)}if(S===63){if(p>=12){var M=this.input.charCodeAt(this.pos+2);if(M===61)return this.finishOp(C.assign,3)}return this.finishOp(C.coalesce,2)}}return this.finishOp(C.question,1)},nt.readToken_numberSign=function(){var p=this.options.ecmaVersion,S=35;if(p>=13&&(++this.pos,S=this.fullCharCodeAtPos(),k(S,!0)||S===92))return this.finishToken(C.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+j(S)+"'")},nt.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 '"+j(p)+"'")},nt.finishOp=function(p,S){var E=this.input.slice(this.pos,this.pos+S);return this.pos+=S,this.finishToken(p,E)},nt.readRegexp=function(){for(var p,S,E=this.pos;;){this.pos>=this.input.length&&this.raise(E,"Unterminated regular expression");var M=this.input.charAt(this.pos);if(_.test(M)&&this.raise(E,"Unterminated regular expression"),p)p=!1;else{if(M==="[")S=!0;else if(M==="]"&&S)S=!1;else if(M==="/"&&!S)break;p=M==="\\"}++this.pos}var B=this.input.slice(E,this.pos);++this.pos;var Z=this.pos,re=this.readWord1();this.containsEsc&&this.unexpected(Z);var ye=this.regexpState||(this.regexpState=new Hn(this));ye.reset(E,B,re),this.validateRegExpFlags(ye),this.validateRegExpPattern(ye);var ve=null;try{ve=new RegExp(B,re)}catch{}return this.finishToken(C.regexp,{pattern:B,flags:re,value:ve})},nt.readInt=function(p,S,E){for(var M=this.options.ecmaVersion>=12&&S===void 0,B=E&&this.input.charCodeAt(this.pos)===48,Z=this.pos,re=0,ye=0,ve=0,Fe=S??1/0;ve<Fe;++ve,++this.pos){var Qe=this.input.charCodeAt(this.pos),vt=void 0;if(M&&Qe===95){B&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),ye===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),ve===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),ye=Qe;continue}if(Qe>=97?vt=Qe-97+10:Qe>=65?vt=Qe-65+10:Qe>=48&&Qe<=57?vt=Qe-48:vt=1/0,vt>=p)break;ye=Qe,re=re*p+vt}return M&&ye===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===Z||S!=null&&this.pos-Z!==S?null:re};function T0(p,S){return S?parseInt(p,8):parseFloat(p.replace(/_/g,""))}function po(p){return typeof BigInt!="function"?null:BigInt(p.replace(/_/g,""))}nt.readRadixNumber=function(p){var S=this.pos;this.pos+=2;var E=this.readInt(p);return E==null&&this.raise(this.start+2,"Expected number in radix "+p),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(E=po(this.input.slice(S,this.pos)),++this.pos):k(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(C.num,E)},nt.readNumber=function(p){var S=this.pos;!p&&this.readInt(10,void 0,!0)===null&&this.raise(S,"Invalid number");var E=this.pos-S>=2&&this.input.charCodeAt(S)===48;E&&this.strict&&this.raise(S,"Invalid number");var M=this.input.charCodeAt(this.pos);if(!E&&!p&&this.options.ecmaVersion>=11&&M===110){var B=po(this.input.slice(S,this.pos));return++this.pos,k(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(C.num,B)}E&&/[89]/.test(this.input.slice(S,this.pos))&&(E=!1),M===46&&!E&&(++this.pos,this.readInt(10),M=this.input.charCodeAt(this.pos)),(M===69||M===101)&&!E&&(M=this.input.charCodeAt(++this.pos),(M===43||M===45)&&++this.pos,this.readInt(10)===null&&this.raise(S,"Invalid number")),k(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var Z=T0(this.input.slice(S,this.pos),E);return this.finishToken(C.num,Z)},nt.readCodePoint=function(){var p=this.input.charCodeAt(this.pos),S;if(p===123){this.options.ecmaVersion<6&&this.unexpected();var E=++this.pos;S=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,S>1114111&&this.invalidStringToken(E,"Code point out of bounds")}else S=this.readHexChar(4);return S},nt.readString=function(p){for(var S="",E=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var M=this.input.charCodeAt(this.pos);if(M===p)break;M===92?(S+=this.input.slice(E,this.pos),S+=this.readEscapedChar(!1),E=this.pos):M===8232||M===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):($(M)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return S+=this.input.slice(E,this.pos++),this.finishToken(C.string,S)};var $r={};nt.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(p){if(p===$r)this.readInvalidTemplateToken();else throw p}this.inTemplateElement=!1},nt.invalidStringToken=function(p,S){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw $r;this.raise(p,S)},nt.readTmplToken=function(){for(var p="",S=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var E=this.input.charCodeAt(this.pos);if(E===96||E===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===C.template||this.type===C.invalidTemplate)?E===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(E===92)p+=this.input.slice(S,this.pos),p+=this.readEscapedChar(!0),S=this.pos;else if($(E)){switch(p+=this.input.slice(S,this.pos),++this.pos,E){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:p+=`
82
+ `;break;default:p+=String.fromCharCode(E);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),S=this.pos}else++this.pos}},nt.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")},nt.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 j(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 E=this.pos-1;this.invalidStringToken(E,"Invalid escape sequence in template string")}default:if(S>=48&&S<=55){var M=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],B=parseInt(M,8);return B>255&&(M=M.slice(0,-1),B=parseInt(M,8)),this.pos+=M.length-1,S=this.input.charCodeAt(this.pos),(M!=="0"||S===56||S===57)&&(this.strict||p)&&this.invalidStringToken(this.pos-1-M.length,p?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(B)}return $(S)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(S)}},nt.readHexChar=function(p){var S=this.pos,E=this.readInt(16,p);return E===null&&this.invalidStringToken(S,"Bad character escape sequence"),E},nt.readWord1=function(){this.containsEsc=!1;for(var p="",S=!0,E=this.pos,M=this.options.ecmaVersion>=6;this.pos<this.input.length;){var B=this.fullCharCodeAtPos();if(w(B,M))this.pos+=B<=65535?1:2;else if(B===92){this.containsEsc=!0,p+=this.input.slice(E,this.pos);var Z=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var re=this.readCodePoint();(S?k:w)(re,M)||this.invalidStringToken(Z,"Invalid Unicode escape"),p+=j(re),E=this.pos}else break;S=!1}return p+this.input.slice(E,this.pos)},nt.readWord=function(){var p=this.readWord1(),S=C.name;return this.keywords.test(p)&&(S=K[p]),this.finishToken(S,p)};var Pl="8.16.0";I.acorn={Parser:I,version:Pl,defaultOptions:Te,Position:te,SourceLocation:z,getLineInfo:xe,Node:Qs,TokenType:N,tokTypes:C,keywordTypes:K,TokContext:Yt,tokContexts:St,isIdentifierChar:w,isIdentifierStart:k,Token:na,isNewLine:$,lineBreak:_,lineBreakG:J,nonASCIIwhitespace:ue};function vc(p,S){return I.parse(p,S)}function ra(p,S,E){return I.parseExpressionAt(p,S,E)}function ia(p,S){return I.tokenizer(p,S)}n.Node=Qs,n.Parser=I,n.Position=te,n.SourceLocation=z,n.TokContext=Yt,n.Token=na,n.TokenType=N,n.defaultOptions=Te,n.getLineInfo=xe,n.isIdentifierChar=w,n.isIdentifierStart=k,n.isNewLine=$,n.keywordTypes=K,n.lineBreak=_,n.lineBreakG=J,n.nonASCIIwhitespace=ue,n.parse=vc,n.parseExpressionAt=ra,n.tokContexts=St,n.tokTypes=C,n.tokenizer=ia,n.version=Pl}))})(rh,rh.exports)),rh.exports}var aM;function UW(){return aM||(aM=1,(function(t){const e=$W(),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 d=c.tokTypes,g=c.TokContext,y=c.TokenType,x=new g("<tag",!1),k=new g("</tag",!1),w=new g("<tag>...</tag>",!0,!0),N={tc_oTag:x,tc_cTag:k,tc_expr:w},T={jsxName:new y("jsxName"),jsxText:new y("jsxText",{beforeExpr:!0}),jsxTagStart:new y("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new y("jsxTagEnd")};T.jsxTagStart.updateContext=function(){this.context.push(w),this.context.push(x),this.exprAllowed=!1},T.jsxTagEnd.updateContext=function(V){let F=this.context.pop();F===x&&V===d.slash||F===k?(this.context.pop(),this.exprAllowed=this.curContext()===w):this.exprAllowed=!0},h={tokContexts:N,tokTypes:T},i.set(c,h)}return h}function a(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 a(c.object)+"."+a(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(sM()).tokTypes},configurable:!0,enumerable:!0});function u(c,h){const d=h.acorn||sM(),g=s(d),y=d.tokTypes,x=g.tokTypes,k=d.tokContexts,w=g.tokContexts.tc_oTag,N=g.tokContexts.tc_cTag,T=g.tokContexts.tc_expr,V=d.isNewLine,F=d.isIdentifierStart,K=d.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 _=this.input.charCodeAt(this.pos);switch(_){case 60:case 123:return this.pos===this.start?_===60&&this.exprAllowed?(++this.pos,this.finishToken(x.jsxTagStart)):this.getTokenFromCode(_):(L+=this.input.slice(C,this.pos),this.finishToken(x.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 `"+(_===62?"&gt;":"&rbrace;")+'` or `{"'+this.input[this.pos]+'"}`?');default:V(_)?(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),_;return++this.pos,C===13&&this.input.charCodeAt(this.pos)===10?(++this.pos,_=L?`
86
+ `:`\r
87
+ `):_=String.fromCharCode(C),this.options.locations&&(++this.curLine,this.lineStart=this.pos),_}jsx_readString(L){let C="",_=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let J=this.input.charCodeAt(this.pos);if(J===L)break;J===38?(C+=this.input.slice(_,this.pos),C+=this.jsx_readEntity(),_=this.pos):V(J)?(C+=this.input.slice(_,this.pos),C+=this.jsx_readNewLine(!1),_=this.pos):++this.pos}return C+=this.input.slice(_,this.pos++),this.finishToken(y.string,C)}jsx_readEntity(){let L="",C=0,_,J=this.input[this.pos];J!=="&"&&this.raise(this.pos,"Entity must start with an ampersand");let $=++this.pos;for(;this.pos<this.input.length&&C++<10;){if(J=this.input[this.pos++],J===";"){L[0]==="#"?L[1]==="x"?(L=L.substr(2),n.test(L)&&(_=String.fromCharCode(parseInt(L,16)))):(L=L.substr(1),r.test(L)&&(_=String.fromCharCode(parseInt(L,10)))):_=e[L];break}L+=J}return _||(this.pos=$,"&")}jsx_readWord(){let L,C=this.pos;do L=this.input.charCodeAt(++this.pos);while(K(L)||L===45);return this.finishToken(x.jsxName,this.input.slice(C,this.pos))}jsx_parseIdentifier(){let L=this.startNode();return this.type===x.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,_=this.jsx_parseIdentifier();if(!c.allowNamespaces||!this.eat(y.colon))return _;var J=this.startNodeAt(L,C);return J.namespace=_,J.name=this.jsx_parseIdentifier(),this.finishNode(J,"JSXNamespacedName")}jsx_parseElementName(){if(this.type===x.jsxTagEnd)return"";let L=this.start,C=this.startLoc,_=this.jsx_parseNamespacedName();for(this.type===y.dot&&_.type==="JSXNamespacedName"&&!c.allowNamespacedObjects&&this.unexpected();this.eat(y.dot);){let J=this.startNodeAt(L,C);J.object=_,J.property=this.jsx_parseIdentifier(),_=this.finishNode(J,"JSXMemberExpression")}return _}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 x.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 _=this.startNodeAt(L,C);_.attributes=[];let J=this.jsx_parseElementName();for(J&&(_.name=J);this.type!==y.slash&&this.type!==x.jsxTagEnd;)_.attributes.push(this.jsx_parseAttribute());return _.selfClosing=this.eat(y.slash),this.expect(x.jsxTagEnd),this.finishNode(_,J?"JSXOpeningElement":"JSXOpeningFragment")}jsx_parseClosingElementAt(L,C){let _=this.startNodeAt(L,C),J=this.jsx_parseElementName();return J&&(_.name=J),this.expect(x.jsxTagEnd),this.finishNode(_,J?"JSXClosingElement":"JSXClosingFragment")}jsx_parseElementAt(L,C){let _=this.startNodeAt(L,C),J=[],$=this.jsx_parseOpeningElementAt(L,C),H=null;if(!$.selfClosing){e:for(;;)switch(this.type){case x.jsxTagStart:if(L=this.start,C=this.startLoc,this.next(),this.eat(y.slash)){H=this.jsx_parseClosingElementAt(L,C);break e}J.push(this.jsx_parseElementAt(L,C));break;case x.jsxText:J.push(this.parseExprAtom());break;case y.braceL:J.push(this.jsx_parseExpressionContainer());break;default:this.unexpected()}a(H.name)!==a($.name)&&this.raise(H.start,"Expected corresponding JSX closing tag for <"+a($.name)+">")}let ue=$.name?"Element":"Fragment";return _["opening"+ue]=$,_["closing"+ue]=H,_.children=J,this.type===y.relational&&this.value==="<"&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(_,"JSX"+ue)}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===x.jsxText?this.jsx_parseText():this.type===x.jsxTagStart?this.jsx_parseElement():super.parseExprAtom(L)}readToken(L){let C=this.curContext();if(C===T)return this.jsx_readToken();if(C===w||C===N){if(F(L))return this.jsx_readWord();if(L==62)return++this.pos,this.finishToken(x.jsxTagEnd);if((L===34||L===39)&&C==w)return this.jsx_readString(L)}return L===60&&this.exprAllowed&&this.input.charCodeAt(this.pos+1)!==33?(++this.pos,this.finishToken(x.jsxTagStart)):super.readToken(L)}updateContext(L){if(this.type==y.braceL){var C=this.curContext();C==w?this.context.push(k.b_expr):C==T?this.context.push(k.b_tmpl):super.updateContext(L),this.exprAllowed=!0}else if(this.type===y.slash&&L===x.jsxTagStart)this.context.length-=2,this.context.push(N),this.exprAllowed=!1;else return super.updateContext(L)}}}})(Q1)),Q1.exports}var HW=UW();const qW=DM(HW);const KW={}.hasOwnProperty,GW=Symbol("continue"),eb=Symbol("exit"),YW=Symbol("skip");function WW(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,a,u,c){return tb(s)&&(h.displayName="node ("+s.type+")"),h;function h(){const d=n?oM(n(s,a,u,c)):[];if(d[0]===eb)return d;if(d[0]!==YW){let g;for(g in s)if(KW.call(s,g)&&s[g]&&typeof s[g]=="object"&&g!=="data"&&g!=="position"){const y=c.concat(s),x=s[g];if(Array.isArray(x)){const k=x;let w=0;for(;w>-1&&w<k.length;){const N=k[w];if(tb(N)){const T=i(N,g,w,y)();if(T[0]===eb)return T;w=typeof T[1]=="number"?T[1]:w+1}else w++}}else if(tb(x)){const k=i(x,g,void 0,y)();if(k[0]===eb)return k}}}return r?oM(r(s,a,u,c)):d}}}function oM(t){return Array.isArray(t)?t:typeof t=="number"?[GW,t]:[t]}function tb(t){return!!(t&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.length>0)}function q6(t,e){const n=e.prefix||"",r=e.suffix||"",i=Object.assign({},e.acornOptions),s=[],a=[],u=i.onComment,c=i.onToken;let h=!1,d,g;const y=Object.assign({},i,{onComment:s,preserveParens:!0});c&&(y.onToken=a);const x=XW(t,e.tokenTypes),k=x.value,w=n+k+r,N=e.expression&&lM(k);if(N&&!e.allowEmpty)throw new bt("Unexpected empty expression",{place:V(0),ruleId:"unexpected-empty-expression",source:"micromark-extension-mdx-expression"});try{d=e.expression&&!N?e.acorn.parseExpressionAt(w,0,y):e.acorn.parse(w,y)}catch(F){const K=F,L=V(K.pos);K.message=String(K.message).replace(/ \(\d+:\d+\)$/,""),K.pos=L.offset,K.loc={line:L.line,column:L.column-1},g=K,h=K.raisedAt>=n.length+k.length||K.message==="Unterminated comment"}if(d&&e.expression&&!N)if(lM(w.slice(d.end,w.length-r.length)))d={type:"Program",start:0,end:n.length+k.length,body:[{type:"ExpressionStatement",expression:d,start:0,end:n.length+k.length}],sourceType:"module",comments:[]};else{const F=V(d.end),K=new Error("Unexpected content after expression");K.pos=F.offset,K.loc={line:F.line,column:F.column-1},g=K,d=void 0}if(d){if(d.comments=s,WW(d,function(F,K,L,C){let _=C[C.length-1],J=K;F.type==="ParenthesizedExpression"&&_&&J&&(typeof L=="number"&&(_=_[J],J=L),_[J]=F.expression),T(F)}),Array.isArray(u))u.push(...s);else if(typeof u=="function")for(const F of s)u(F.type==="Block",F.value,F.start,F.end,F.loc.start,F.loc.end);for(const F of a)F.end<=n.length||F.start-n.length>=k.length||(T(F),Array.isArray(c)?c.push(F):c(F))}return{estree:d,error:g,swallow:h};function T(F){const K=V(F.start),L=V(F.end);F.start=K.offset,F.end=L.offset,F.loc={start:{line:K.line,column:K.column-1,offset:K.offset},end:{line:L.line,column:L.column-1,offset:L.offset}},F.range=[F.start,F.end]}function V(F){let K=F-n.length;K<0?K=0:K>k.length&&(K=k.length);let L=QW(x.stops,K);return L||(L={line:e.start.line,column:e.start.column,offset:e.start.offset}),L}}function lM(t){return/^\s*$/.test(t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\r\n]*(\r\n|\n|\r)/g,""))}function XW(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 a=i[2].sliceStream(i[1]);for(;a.length>0&&a[0]===-1;)a.shift();const u=ZW(a);n.stops.push([n.value.length,i[1].start]),n.value+=u,n.stops.push([n.value.length,i[1].end])}}}return n}function QW(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 ZW(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 $m(t){const e=t||{},n=e.loc||{},r=e.range||[void 0,void 0],i=uM(n.start,r[0]||e.start),s=uM(n.end,r[1]||e.end);if(i&&s)return{start:i,end:s}}function uM(t,e){if(t&&typeof t=="object"){const n="line"in t?nb(t.line):void 0,r="column"in t?nb(t.column):void 0;if(n&&r!==void 0)return{line:n,column:r+1,offset:nb(e)}}}function nb(t){return typeof t=="number"&&t>-1?t:void 0}const eX=2,Fu="https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression",tX="#unexpected-end-of-file-in-expression-expected-a-corresponding-closing-brace-for-",nX="#unexpected-lazy-line-in-expression-in-container-expected-line-to-be-prefixed",cM="#unexpected-type-in-code-expected-an-object-spread-spread",rX="#unexpected-extra-content-in-spread-only-a-single-spread-is-supported",iX="#could-not-parse-expression-with-acorn";function Og(t,e,n,r,i,s,a,u,c,h,d){const g=this,y=this.events.length+3;let x=0,k,w;return N;function N(K){return t.enter(n),t.enter(r),t.consume(K),t.exit(r),k=g.now(),T}function T(K){if(K===null){if(w)throw w;const L=new bt("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=Fu+tX,L}if(we(K))return t.enter("lineEnding"),t.consume(K),t.exit("lineEnding"),F;if(K===125&&x===0){const L=s?sX.call(g,s,a,i,y,k,h||!1,c||!1):{type:"ok",estree:void 0};if(L.type==="ok"){t.enter(r),t.consume(K),t.exit(r);const C=t.exit(n);return u&&L.estree&&Object.assign(C,{estree:L.estree}),e}return w=L.message,t.enter(i),t.consume(K),V}return t.enter(i),V(K)}function V(K){return K===125&&x===0||K===null||we(K)?(t.exit(i),T(K)):(K===123&&!s?x+=1:K===125&&(x-=1),t.consume(K),V)}function F(K){const L=g.now();if(L.line!==k.line&&!d&&g.parser.lazy[L.line]){const C=new bt("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=Fu+nX,C}return Ye(K)?We(t,T,"linePrefix",eX+1)(K):T(K)}}function sX(t,e,n,r,i,s,a){const u=q6(this.events.slice(r),{acorn:t,tokenTypes:[n],acornOptions:e,start:i,expression:!0,allowEmpty:s,prefix:a?"({":"",suffix:a?"})":""}),c=u.estree;if(a&&c){const h=c.body[0];if(h.type!=="ExpressionStatement"||h.expression.type!=="ObjectExpression"){const d=$m(h),g=new bt("Unexpected `"+h.type+"` in code: expected an object spread (`{...spread}`)",{place:d.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw g.url=Fu+cM,g}if(h.expression.properties[1]){const d=$m(h.expression.properties[1]),g=new bt("Unexpected extra content in spread: only a single spread is supported",{place:d.start,ruleId:"spread-extra",source:"micromark-extension-mdx-expression"});throw g.url=Fu+rX,g}if(h.expression.properties[0]&&h.expression.properties[0].type!=="SpreadElement"){const d=$m(h.expression.properties[0]),g=new bt("Unexpected `"+h.expression.properties[0].type+"` in code: only spread elements are supported",{place:d.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw g.url=Fu+cM,g}}if(u.error){const h=new bt("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=Fu+iX,{type:"nok",message:h}}return{type:"ok",estree:c}}function aX(t){const e=t||{},n=e.addResult,r=e.acorn,i=e.spread;let s=e.allowEmpty,a;if(s==null&&(s=!0),r){if(!r.parseExpressionAt)throw new Error("Expected a proper `acorn` instance passed in as `options.acorn`");a=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,d,g){const y=this;return x;function x(T){return k(T)}function k(T){return Og.call(y,h,w,"mdxFlowExpression","mdxFlowExpressionMarker","mdxFlowExpressionChunk",r,a,n,i,s)(T)}function w(T){return Ye(T)?We(h,N,"whitespace")(T):N(T)}function N(T){const V=y.parser.constructs.flow[60],K=(Array.isArray(V)?V:V?[V]:[]).find(function(L){return L.name==="mdxJsxFlowTag"});return T===60&&K?h.attempt(K,N,g)(T):T===null||we(T)?d(T):g(T)}}function c(h,d){const g=this;return y;function y(x){return Og.call(g,h,d,"mdxTextExpression","mdxTextExpressionMarker","mdxTextExpressionChunk",r,a,n,i,s,!0)(x)}}}const oX=/[$_\p{ID_Start}]/u,lX=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,uX=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,cX={};function Ti(t){return t?oX.test(String.fromCodePoint(t)):!1}function hf(t,e){const r=(e||cX).jsx?uX:lX;return t?r.test(String.fromCodePoint(t)):!1}const fM="https://github.com/micromark/micromark-extension-mdx-jsx";function K6(t,e,n,r,i,s,a,u,c,h,d,g,y,x,k,w,N,T,V,F,K,L,C,_,J,$,H,ue,ae,Se,Ee,Y){const X=this;let le,Ce;return _e;function _e(I){return t.enter(u),t.enter(c),t.consume(I),t.exit(c),j}function j(I){return tt(I)?n(I):(le=P,Be(I))}function P(I){if(I===47)return t.enter(h),t.consume(I),t.exit(h),le=te,Be;if(I===62)return mt(I);if(I!==null&&I>=0&&Ti(I))return t.enter(g),t.enter(y),t.consume(I),z;ge(I,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(I===33?" (note: to create a comment in MDX, use `{/* text */}`)":""))}function te(I){if(I===62)return mt(I);if(I!==null&&I>=0&&Ti(I))return t.enter(g),t.enter(y),t.consume(I),z;ge(I,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(I===42||I===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function z(I){if(I!==null&&I>=0&&hf(I,{jsx:!0}))return t.consume(I),z;if(I===46||I===47||I===58||I===62||I===123||tt(I)||Wn(I))return t.exit(y),le=xe,Be(I);ge(I,"in name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(I===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function xe(I){if(I===46)return t.enter(x),t.consume(I),t.exit(x),le=Te,Be;if(I===58)return t.enter(w),t.consume(I),t.exit(w),le=pt,Be;if(I===47||I===62||I===123||I!==null&&I>=0&&Ti(I))return t.exit(g),Ot(I);ge(I,"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 Te(I){if(I!==null&&I>=0&&Ti(I))return t.enter(k),t.consume(I),Ae;ge(I,"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 Ae(I){if(I!==null&&I>=0&&hf(I,{jsx:!0}))return t.consume(I),Ae;if(I===46||I===47||I===62||I===123||tt(I)||Wn(I))return t.exit(k),le=qe,Be(I);ge(I,"in member name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(I===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function qe(I){if(I===46)return t.enter(x),t.consume(I),t.exit(x),le=Te,Be;if(I===47||I===62||I===123||I!==null&&I>=0&&Ti(I))return t.exit(g),Ot(I);ge(I,"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 pt(I){if(I!==null&&I>=0&&Ti(I))return t.enter(N),t.consume(I),Ke;ge(I,"before local name","a character that can start a name, such as a letter, `$`, or `_`"+(I===43||I!==null&&I>46&&I<58?" (note: to create a link in MDX, use `[text](url)`)":""))}function Ke(I){if(I!==null&&I>=0&&hf(I,{jsx:!0}))return t.consume(I),Ke;if(I===47||I===62||I===123||tt(I)||Wn(I))return t.exit(N),le=Pt,Be(I);ge(I,"in local name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Pt(I){if(I===47||I===62||I===123||I!==null&&I>=0&&Ti(I))return t.exit(g),Ot(I);ge(I,"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 Ot(I){if(I===47)return t.enter(d),t.consume(I),t.exit(d),le=Dt,Be;if(I===62)return mt(I);if(I===123)return Og.call(X,t,fr,T,V,F,r,i,s,!0,!1,a)(I);if(I!==null&&I>=0&&Ti(I))return t.enter(K),t.enter(L),t.enter(C),t.consume(I),hr;ge(I,"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 fr(I){return le=Ot,Be(I)}function hr(I){if(I!==null&&I>=0&&hf(I,{jsx:!0}))return t.consume(I),hr;if(I===47||I===58||I===61||I===62||I===123||tt(I)||Wn(I))return t.exit(C),le=hn,Be(I);ge(I,"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 hn(I){if(I===58)return t.enter(_),t.consume(I),t.exit(_),le=pn,Be;if(I===61)return t.exit(L),t.enter($),t.consume(I),t.exit($),le=mn,Be;if(I===47||I===62||I===123||tt(I)||Wn(I)||I!==null&&I>=0&&Ti(I))return t.exit(L),t.exit(K),le=Ot,Be(I);ge(I,"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 pn(I){if(I!==null&&I>=0&&Ti(I))return t.enter(J),t.consume(I),pr;ge(I,"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 pr(I){if(I!==null&&I>=0&&hf(I,{jsx:!0}))return t.consume(I),pr;if(I===47||I===61||I===62||I===123||tt(I)||Wn(I))return t.exit(J),t.exit(L),le=dn,Be(I);ge(I,"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 dn(I){if(I===61)return t.enter($),t.consume(I),t.exit($),le=mn,Be;if(I===47||I===62||I===123||I!==null&&I>=0&&Ti(I))return t.exit(K),Ot(I);ge(I,"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 mn(I){if(I===34||I===39)return t.enter(H),t.enter(ue),t.consume(I),t.exit(ue),Ce=I,he;if(I===123)return Og.call(X,t,dr,Se,Ee,Y,r,i,s,!1,!1,a)(I);ge(I,"before attribute value","a character that can start an attribute value, such as `\"`, `'`, or `{`"+(I===60?" (note: to use an element or fragment as a prop value in MDX, use `{<element />}`)":""))}function dr(I){return t.exit(K),le=Ot,Be(I)}function he(I){return I===null&&ge(I,"in attribute value","a corresponding closing quote `"+String.fromCodePoint(Ce)+"`"),I===Ce?(t.enter(ue),t.consume(I),t.exit(ue),t.exit(H),t.exit(K),Ce=void 0,le=Ot,Be):we(I)?(le=he,Be(I)):(t.enter(ae),je(I))}function je(I){return I===null||I===Ce||we(I)?(t.exit(ae),he(I)):(t.consume(I),je)}function Dt(I){if(I===62)return mt(I);ge(I,"after self-closing slash","`>` to end the tag"+(I===42||I===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function mt(I){return t.enter(c),t.consume(I),t.exit(c),t.exit(u),e}function Be(I){return we(I)?(t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),fe):Ye(I)||Wn(I)?(t.enter("esWhitespace"),gn(I)):le(I)}function gn(I){return we(I)?(t.exit("esWhitespace"),Be(I)):Ye(I)||Wn(I)?(t.consume(I),gn):(t.exit("esWhitespace"),le(I))}function fe(I){if(!a&&X.parser.lazy[X.now().line]){const ze=new bt("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 ze.url=fM+"#unexpected-lazy-line-in-container-expected-line-to-be",ze}return Be(I)}function ge(I,ze,Je){const on=new bt("Unexpected "+(I===null?"end of file":"character `"+(I===96?"` ` `":String.fromCodePoint(I))+"` ("+fX(I)+")")+" "+ze+", expected "+Je,X.now(),"micromark-extension-mdx-jsx:unexpected-"+(I===null?"eof":"character"));throw on.url=fM+(I===null?"#unexpected-end-of-file-at-expected-expect":"#unexpected-character-at-expected-expect"),on}}function fX(t){return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function hX(t,e){return{name:"mdxJsxTextTag",tokenize:n};function n(r,i,s){return K6.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 pX(t,e){return{concrete:!0,name:"mdxJsxFlowTag",tokenize:n};function n(r,i,s){const a=this;return u;function u(g){return c(g)}function c(g){return K6.call(a,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 Ye(g)?We(r,d,"whitespace")(g):d(g)}function d(g){const y=a.parser.constructs.flow[123],x=Array.isArray(y)?y:y?[y]:[];let k;for(const w of x)if(w.name==="mdxFlowExpression"){k=w;break}return g===60?u(g):g===123&&k?r.attempt(k,d,s)(g):g===null||we(g)?i(g):s(g)}}}function dX(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:pX(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})},text:{60:hX(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})}}}function mX(){return{disable:{null:["autolink","codeIndented","htmlFlow","htmlText"]}}}const gX={tokenize:bX,partial:!0},hM="https://github.com/micromark/micromark-extension-mdxjs-esm",yX=new Set(["ExportAllDeclaration","ExportDefaultDeclaration","ExportNamedDeclaration","ImportDeclaration"]);function xX(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,a,u){const c=this,h=c.parser.definedModuleSpecifiers||(c.parser.definedModuleSpecifiers=[]),d=this.events.length+1;let g="";return c.interrupt?u:y;function y(V){return c.now().column>1?u(V):(s.enter("mdxjsEsm"),s.enter("mdxjsEsmData"),s.consume(V),g+=String.fromCharCode(V),x)}function x(V){return cn(V)?(s.consume(V),g+=String.fromCharCode(V),x):(g==="import"||g==="export")&&V===32?(s.consume(V),k):u(V)}function k(V){return V===null||we(V)?(s.exit("mdxjsEsmData"),w(V)):(s.consume(V),k)}function w(V){return V===null?T(V):we(V)?s.check(gX,T,N)(V):(s.enter("mdxjsEsmData"),k(V))}function N(V){return s.enter("lineEnding"),s.consume(V),s.exit("lineEnding"),w}function T(V){const F=q6(c.events.slice(d),{acorn:n,acornOptions:r,tokenTypes:["mdxjsEsmData"],prefix:h.length>0?"var "+h.join(",")+`
90
+ `:""});if(F.error){if(V!==null&&F.swallow)return N(V);const L=new bt("Could not parse import/exports with acorn",{cause:F.error,place:{line:F.error.loc.line,column:F.error.loc.column+1,offset:F.error.pos},ruleId:"acorn",source:"micromark-extension-mdxjs-esm"});throw L.url=hM+"#could-not-parse-importexports-with-acorn",L}h.length>0&&F.estree.body.shift();let K=-1;for(;++K<F.estree.body.length;){const L=F.estree.body[K];if(!yX.has(L.type)){const C=new bt("Unexpected `"+L.type+"` in code: only import/exports are supported",{place:$m(L),ruleId:"non-esm",source:"micromark-extension-mdxjs-esm"});throw C.url=hM+"#unexpected-type-in-code-only-importexports-are-supported",C}if(L.type==="ImportDeclaration"&&!c.interrupt){let C=-1;for(;++C<L.specifiers.length;){const _=L.specifiers[C];h.push(_.local.name)}}}return Object.assign(s.exit("mdxjsEsm"),t.addResult?{estree:F.estree}:void 0),a(V)}}}function bX(t,e,n){return r;function r(i){return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),t.attempt(Zu,e,n)}}function SX(t){const e=Object.assign({acorn:sn.extend(qW()),acornOptions:{ecmaVersion:2024,sourceType:"module"},addResult:!0},t);return HS([xX(e),aX(e),dX(e),mX()])}const vX={};function kX(t){const e=this,n=t||vX,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(SX(n)),s.push(tW()),a.push(nW(n))}const ep="__mdx_expr__:",CX=new Set(["br","hr","img","input","meta","link","area","base","col","embed","source","track","wbr"]),wX=Gm().use(qm),EX=gi("remarkMdx",()=>kX);function AX(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]=`${ep}${r.value.value}`,n=!0)),r.type==="mdxJsxExpressionAttribute"&&(n=!0);return{props:e,hasExpressions:n}}function NX(t){const e=[];for(const[n,r]of Object.entries(t))r.startsWith(ep)?e.push({type:"mdxJsxAttribute",name:n,value:{type:"mdxJsxAttributeValueExpression",value:r.slice(ep.length)}}):e.push({type:"mdxJsxAttribute",name:n,value:r});return e}function G6(t){if(!t||t.length===0)return"";const e=[];for(const n of t)if(n.type==="paragraph"){const r=Jm(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(a=>{if(a.type==="mdxJsxAttribute"&&a.name){if(typeof a.value=="string")return`${a.name}="${a.value}"`;if(a.value?.type==="mdxJsxAttributeValueExpression")return`${a.name}={${a.value.value}}`}return""}).filter(Boolean).join(" "),s=G6(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 Jm(t){return t.map(e=>e.type==="text"?e.value??"":e.type==="strong"?`**${Jm(e.children??[])}**`:e.type==="emphasis"?`*${Jm(e.children??[])}*`:e.type==="inlineCode"?`\`${e.value??""}\``:e.type==="link"?`[${Jm(e.children??[])}](${e.url??""})`:e.value??"").join("")}const Y6=nc("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||CX.has(r.toLowerCase()))return;const{props:i,hasExpressions:s}=AX(e.attributes),a=G6(e.children??[]);t.addNode(n,{componentName:r,props:JSON.stringify(i),hasExpressions:s,children:a})}},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=NX(r);if(i.trim()){const a=wX.parse(i);t.addNode("mdxJsxFlowElement",void 0,void 0,{name:n,attributes:s,children:a.children})}else t.addNode("mdxJsxFlowElement",void 0,void 0,{name:n,attributes:s,children:[]})}}})),pM=He("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,a=e.tr.insert(s,i);n(a)}return!0}),TX=nc("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 MX=typeof global=="object"&&global&&global.Object===Object&&global,OX=typeof self=="object"&&self&&self.Object===Object&&self,W6=MX||OX||Function("return this")(),Rg=W6.Symbol,X6=Object.prototype,RX=X6.hasOwnProperty,DX=X6.toString,pf=Rg?Rg.toStringTag:void 0;function IX(t){var e=RX.call(t,pf),n=t[pf];try{t[pf]=void 0;var r=!0}catch{}var i=DX.call(t);return r&&(e?t[pf]=n:delete t[pf]),i}var _X=Object.prototype,zX=_X.toString;function LX(t){return zX.call(t)}var BX="[object Null]",FX="[object Undefined]",dM=Rg?Rg.toStringTag:void 0;function VX(t){return t==null?t===void 0?FX:BX:dM&&dM in Object(t)?IX(t):LX(t)}function PX(t){return t!=null&&typeof t=="object"}var jX="[object Symbol]";function $X(t){return typeof t=="symbol"||PX(t)&&VX(t)==jX}var JX=/\s/;function UX(t){for(var e=t.length;e--&&JX.test(t.charAt(e)););return e}var HX=/^\s+/;function qX(t){return t&&t.slice(0,UX(t)+1).replace(HX,"")}function jS(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var mM=NaN,KX=/^[-+]0x[0-9a-f]+$/i,GX=/^0b[01]+$/i,YX=/^0o[0-7]+$/i,WX=parseInt;function gM(t){if(typeof t=="number")return t;if($X(t))return mM;if(jS(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=jS(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=qX(t);var n=GX.test(t);return n||YX.test(t)?WX(t.slice(2),n?2:8):KX.test(t)?mM:+t}var rb=function(){return W6.Date.now()},XX="Expected a function",QX=Math.max,ZX=Math.min;function eQ(t,e,n){var r,i,s,a,u,c,h=0,d=!1,g=!1,y=!0;if(typeof t!="function")throw new TypeError(XX);e=gM(e)||0,jS(n)&&(d=!!n.leading,g="maxWait"in n,s=g?QX(gM(n.maxWait)||0,e):s,y="trailing"in n?!!n.trailing:y);function x(C){var _=r,J=i;return r=i=void 0,h=C,a=t.apply(J,_),a}function k(C){return h=C,u=setTimeout(T,e),d?x(C):a}function w(C){var _=C-c,J=C-h,$=e-_;return g?ZX($,s-J):$}function N(C){var _=C-c,J=C-h;return c===void 0||_>=e||_<0||g&&J>=s}function T(){var C=rb();if(N(C))return V(C);u=setTimeout(T,w(C))}function V(C){return u=void 0,y&&r?x(C):(r=i=void 0,a)}function F(){u!==void 0&&clearTimeout(u),h=0,r=c=i=u=void 0}function K(){return u===void 0?a:V(rb())}function L(){var C=rb(),_=N(C);if(r=arguments,i=this,c=C,_){if(u===void 0)return k(c);if(g)return clearTimeout(u),u=setTimeout(T,e),x(c)}return u===void 0&&(u=setTimeout(T,e)),a}return L.cancel=F,L.flush=K,L}var Q6=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}},Dg=lt(new Q6,"listener"),tQ=new Ln("MILKDOWN_LISTENER"),lC=t=>(t.inject(Dg,new Q6),async()=>{await t.wait(el);const{listeners:e}=t.get(Dg);e.beforeMount.forEach(h=>h(t)),await t.wait(mh);const n=t.get(gh);let r=null,i=null,s=null,a=null;const u=eQ(()=>{if(!a)return;const{doc:h}=a;if(e.updated.length>0&&r&&!r.eq(h)&&e.updated.forEach(d=>{d(t,h,r)}),e.markdownUpdated.length>0&&r&&!r.eq(h)){const d=n(h);e.markdownUpdated.forEach(g=>{g(t,d,i)}),i=d}r=h,a=null},200),c=new ur({key:tQ,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,d)=>{r=d.doc,i=n(d.doc)},apply:h=>{const d=h.selection;(!s&&d||s&&!d.eq(s))&&(e.selectionUpdated.forEach(g=>{g(t,d,s)}),s=d),!(!(h.docChanged||h.storedMarksSet)||h.getMeta("addToHistory")===!1)&&(a=h,u())}}});t.update(Js,h=>h.concat(c)),await t.wait(wm),e.mounted.forEach(h=>h(t))});lC.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};const nQ=new Set(["strong","emphasis","delete"]),rQ=/^[^\S\r\n]+/,iQ=/[^\S\r\n]+$/,sQ=/^[ \t]+/;function yM(t,e){let n=t.children??[],r="";for(;;){const i=e==="start"?0:n.length-1,s=n[i];if(s?.type!=="text"||typeof s.value!="string")break;const a=s.value.match(e==="start"?rQ:iQ)?.[0]??"",u=e==="start"?s.value.slice(a.length):s.value.slice(0,s.value.length-a.length);if(u&&!a||(r=e==="start"?r+a:a+r,n=[...n.slice(0,i),...u?[{...s,value:u}]:[],...n.slice(i+1)],u))break}return n.length===0?[void 0,r]:[n===t.children?t:{...t,children:n},r]}const xM=t=>t?[{type:"text",value:t}]:[];function Z6(t){if(!t.children)return t;const e=t.children.flatMap((n,r)=>{const i=Z6(n);if(!nQ.has(i.type))return[i];const[s,a]=yM(i,"start"),[u,c]=s?yM(s,"end"):[void 0,""],h=t.type==="paragraph"&&r===0;return[...xM(h?a.replace(sQ,""):a),...u?[u]:[],...xM(c)]});return{...t,children:e}}const aQ=function(){const t=this.compiler;t&&(this.compiler=(e,n)=>t(Z6(e),n))},e4=gi("remarkMarkWhitespace",()=>aQ),oQ={border:"1px solid #e4e4e7",borderRadius:6,background:"#fff"},lQ={padding:"6px 10px",minHeight:60,fontSize:13,lineHeight:1.5,outline:"none"};function uQ({value:t,onChange:e,media:n,mediaContext:r}){const i=ee.useRef(null),s=ee.useRef(null),[a,u]=ee.useState(null),c=ee.useRef(t),h=ee.useRef(!1),d=ee.useRef(e);return d.current=e,ee.useEffect(()=>{const g=i.current;if(!g)return;let y=!1;return(async()=>{const k=await FR.make().config(w=>{w.set(xh,g),w.set(yh,c.current),w.get(Dg).markdownUpdated((N,T)=>{c.current=T})}).use(AD).use(B_).use(e4).use(lC).use(q_).use(K_).create();if(y){k.destroy();return}s.current=k,u(k)})(),()=>{y=!0,s.current?.destroy(),s.current=null,u(null)}},[]),ee.useEffect(()=>{!s.current||h.current||t!==c.current&&(s.current.action(jR(t)),G_(s.current.ctx.get(Vt)),c.current=t)}),O.jsxs("div",{style:oQ,children:[O.jsx(o6,{editor:a,media:n,mediaContext:r,field:"children",allowImageInsert:!1}),O.jsx("div",{ref:i,style:lQ,onFocusCapture:()=>{h.current=!0},onBlurCapture:()=>{h.current=!1,s.current&&(c.current=s.current.action(dj())),c.current!==t&&d.current(c.current)}})]})}const cQ={number:"number",url:"url",date:"date",datetime:"datetime-local",time:"time",email:"email",tel:"tel"},fQ={border:"1px solid #d4d4d8",borderRadius:8,background:"#fafafa",margin:"8px 0",fontSize:13},hQ={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"6px 10px",borderBottom:"1px solid #ececed",background:"#f1f1f3",borderTopLeftRadius:8,borderTopRightRadius:8},pQ={fontWeight:600,fontFamily:"ui-monospace, monospace",color:"#3f3f46"},dQ={padding:"8px 10px",display:"flex",flexDirection:"column",gap:8},bM={fontSize:11,color:"#71717a",marginBottom:2},Um={width:"100%",boxSizing:"border-box",border:"1px solid #d4d4d8",borderRadius:4,padding:"4px 6px",font:"inherit",background:"#fff"},Eh={...Um,background:"#f4f4f5",color:"#71717a"},SM={fontSize:10,color:"#a16207",background:"#fef9c3",borderRadius:3,padding:"0 4px",marginLeft:6},mQ={border:"none",background:"transparent",color:"#a1a1aa",cursor:"pointer",fontSize:16,lineHeight:1,padding:2},gQ={border:"1px solid #d4d4d8",background:"#fff",borderRadius:4,padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer",color:"#3f3f46",whiteSpace:"nowrap"};function yQ({name:t,value:e,propType:n,editable:r,hasMedia:i,previewSrc:s,onChange:a,onBrowse:u}){if(n==="boolean")return O.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6},children:[O.jsx("input",{type:"checkbox",checked:e==="true",disabled:!r,onChange:h=>a(h.target.checked?"true":"false")}),O.jsx("span",{style:{color:"#52525b"},children:e==="true"?"Yes":"No"})]});if(n==="image")return O.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[s!==""?O.jsx("img",{src:s,alt:"",style:{maxHeight:96,maxWidth:"100%",objectFit:"contain",borderRadius:4,alignSelf:"flex-start"}}):null,O.jsxs("div",{style:{display:"flex",gap:6},children:[O.jsx("input",{style:r?Um:Eh,value:e,readOnly:!r,placeholder:"Image URL or path",onChange:r?h=>a(h.target.value):void 0}),r&&i?O.jsx("button",{type:"button",style:gQ,"data-mdx-action":"props",onClick:u,children:"Browse"}):null]})]});if(n==="color")return O.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[O.jsx("input",{type:"color",value:e||"#000000",disabled:!r,onChange:h=>a(h.target.value),style:{width:30,height:28,padding:0,border:"1px solid #d4d4d8",borderRadius:4,background:"transparent",cursor:r?"pointer":"default"}}),O.jsx("input",{style:r?Um:Eh,value:e,readOnly:!r,placeholder:"#000000",onChange:r?h=>a(h.target.value):void 0})]});const c=cQ[n]??"text";return O.jsx("input",{type:c,style:r?Um:Eh,value:e,readOnly:!r,placeholder:`Enter ${t}…`,onChange:r?h=>a(h.target.value):void 0})}function xQ({componentName:t,props:e,hasExpressions:n,slotContent:r,definition:i,media:s,mediaContext:a,onRemove:u,onSlotContentChange:c,onPropsChange:h}){const d=i?.slots?.includes("default")??!!c,g=Object.entries(e),[y,x]=ee.useState(null),k=ee.useMemo(()=>{const N=new Map;for(const T of i?.props??[])N.set(T.name,T);return N},[i]),w=(N,T)=>{h&&h({...e,[N]:T})};return O.jsxs("div",{style:fQ,"data-cms-ui":"",contentEditable:!1,children:[O.jsxs("div",{style:hQ,children:[O.jsxs("span",{style:pQ,children:[`<${t} />`,n?O.jsx("span",{style:SM,children:"expr · read-only"}):null]}),O.jsx("button",{type:"button",style:mQ,title:"Remove block","data-mdx-action":"remove",onClick:u,children:"×"})]}),O.jsxs("div",{style:dQ,children:[d?O.jsxs("div",{"data-mdx-action":"children",children:[O.jsx("div",{style:bM,children:"Content"}),c?O.jsx(uQ,{value:r,onChange:c,media:s,mediaContext:a}):O.jsx("div",{style:{...Eh,whiteSpace:"pre-wrap",minHeight:40},children:r})]}):null,g.length===0&&!d?O.jsx("div",{style:{color:"#a1a1aa",fontSize:12},children:"No props"}):null,g.map(([N,T])=>{const V=T.startsWith(ep),F=!!h&&!V,K=k.get(N),L=(K?.type??"").toLowerCase();return O.jsxs("div",{style:{display:"block"},"data-mdx-action":"props",children:[O.jsxs("div",{style:bM,children:[N,K?.required?O.jsx("span",{style:{color:"#dc2626"},children:"*"}):null,V?O.jsx("span",{style:SM,children:"expression"}):null]}),V?O.jsx("input",{style:Eh,value:`{${T.slice(ep.length)}}`,readOnly:!0}):O.jsx(yQ,{name:N,value:T,propType:L,editable:F,hasMedia:!!s,previewSrc:L==="image"?_S(s,T,a):"",onChange:C=>w(N,C),onBrowse:()=>x(N)})]},N)})]}),y!==null&&s?O.jsx(W_,{media:s,context:a,field:y,accept:"image/*",onSelect:N=>{w(y,N),x(null)},onClose:()=>x(null)}):null]})}var ib={exports:{}},df={},sb={exports:{}},ab={};var vM;function bQ(){return vM||(vM=1,(function(t){function e(X,le){var Ce=X.length;X.push(le);e:for(;0<Ce;){var _e=Ce-1>>>1,j=X[_e];if(0<i(j,le))X[_e]=le,X[Ce]=j,Ce=_e;else break e}}function n(X){return X.length===0?null:X[0]}function r(X){if(X.length===0)return null;var le=X[0],Ce=X.pop();if(Ce!==le){X[0]=Ce;e:for(var _e=0,j=X.length,P=j>>>1;_e<P;){var te=2*(_e+1)-1,z=X[te],xe=te+1,Te=X[xe];if(0>i(z,Ce))xe<j&&0>i(Te,z)?(X[_e]=Te,X[xe]=Ce,_e=xe):(X[_e]=z,X[te]=Ce,_e=te);else if(xe<j&&0>i(Te,Ce))X[_e]=Te,X[xe]=Ce,_e=xe;else break e}}return le}function i(X,le){var Ce=X.sortIndex-le.sortIndex;return Ce!==0?Ce:X.id-le.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 a=Date,u=a.now();t.unstable_now=function(){return a.now()-u}}var c=[],h=[],d=1,g=null,y=3,x=!1,k=!1,w=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function K(X){for(var le=n(h);le!==null;){if(le.callback===null)r(h);else if(le.startTime<=X)r(h),le.sortIndex=le.expirationTime,e(c,le);else break;le=n(h)}}function L(X){if(w=!1,K(X),!k)if(n(c)!==null)k=!0,C||(C=!0,ae());else{var le=n(h);le!==null&&Y(L,le.startTime-X)}}var C=!1,_=-1,J=5,$=-1;function H(){return N?!0:!(t.unstable_now()-$<J)}function ue(){if(N=!1,C){var X=t.unstable_now();$=X;var le=!0;try{e:{k=!1,w&&(w=!1,V(_),_=-1),x=!0;var Ce=y;try{t:{for(K(X),g=n(c);g!==null&&!(g.expirationTime>X&&H());){var _e=g.callback;if(typeof _e=="function"){g.callback=null,y=g.priorityLevel;var j=_e(g.expirationTime<=X);if(X=t.unstable_now(),typeof j=="function"){g.callback=j,K(X),le=!0;break t}g===n(c)&&r(c),K(X)}else r(c);g=n(c)}if(g!==null)le=!0;else{var P=n(h);P!==null&&Y(L,P.startTime-X),le=!1}}break e}finally{g=null,y=Ce,x=!1}le=void 0}}finally{le?ae():C=!1}}}var ae;if(typeof F=="function")ae=function(){F(ue)};else if(typeof MessageChannel<"u"){var Se=new MessageChannel,Ee=Se.port2;Se.port1.onmessage=ue,ae=function(){Ee.postMessage(null)}}else ae=function(){T(ue,0)};function Y(X,le){_=T(function(){X(t.unstable_now())},le)}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"):J=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 le=3;break;default:le=y}var Ce=y;y=le;try{return X()}finally{y=Ce}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(X,le){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var Ce=y;y=X;try{return le()}finally{y=Ce}},t.unstable_scheduleCallback=function(X,le,Ce){var _e=t.unstable_now();switch(typeof Ce=="object"&&Ce!==null?(Ce=Ce.delay,Ce=typeof Ce=="number"&&0<Ce?_e+Ce:_e):Ce=_e,X){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=Ce+j,X={id:d++,callback:le,priorityLevel:X,startTime:Ce,expirationTime:j,sortIndex:-1},Ce>_e?(X.sortIndex=Ce,e(h,X),n(c)===null&&X===n(h)&&(w?(V(_),_=-1):w=!0,Y(L,Ce-_e))):(X.sortIndex=j,e(c,X),k||x||(k=!0,C||(C=!0,ae()))),X},t.unstable_shouldYield=H,t.unstable_wrapCallback=function(X){var le=y;return function(){var Ce=y;y=le;try{return X.apply(this,arguments)}finally{y=Ce}}}})(ab)),ab}var kM;function SQ(){return kM||(kM=1,sb.exports=bQ()),sb.exports}var ob={exports:{}},Mn={};var CM;function vQ(){if(CM)return Mn;CM=1;var t=JS();function e(c){var h="https://react.dev/errors/"+c;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)h+="&args[]="+encodeURIComponent(arguments[d])}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,d){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:d}}var a=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 Mn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Mn.createPortal=function(c,h){var d=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,d)},Mn.flushSync=function(c){var h=a.T,d=r.p;try{if(a.T=null,r.p=2,c)return c()}finally{a.T=h,r.p=d,r.d.f()}},Mn.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))},Mn.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},Mn.preinit=function(c,h){if(typeof c=="string"&&h&&typeof h.as=="string"){var d=h.as,g=u(d,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,x=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;d==="style"?r.d.S(c,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:x}):d==="script"&&r.d.X(c,{crossOrigin:g,integrity:y,fetchPriority:x,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Mn.preinitModule=function(c,h){if(typeof c=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var d=u(h.as,h.crossOrigin);r.d.M(c,{crossOrigin:d,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)},Mn.preload=function(c,h){if(typeof c=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var d=h.as,g=u(d,h.crossOrigin);r.d.L(c,d,{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})}},Mn.preloadModule=function(c,h){if(typeof c=="string")if(h){var d=u(h.as,h.crossOrigin);r.d.m(c,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:d,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(c)},Mn.requestFormReset=function(c){r.d.r(c)},Mn.unstable_batchedUpdates=function(c,h){return c(h)},Mn.useFormState=function(c,h,d){return a.H.useFormState(c,h,d)},Mn.useFormStatus=function(){return a.H.useHostTransitionStatus()},Mn.version="19.2.7",Mn}var wM;function kQ(){if(wM)return ob.exports;wM=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(),ob.exports=vQ(),ob.exports}var EM;function CQ(){if(EM)return df;EM=1;var t=SQ(),e=JS(),n=kQ();function r(o){var l="https://react.dev/errors/"+o;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 #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var l=o,f=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,(l.flags&4098)!==0&&(f=l.return),o=l.return;while(o)}return l.tag===3?f:null}function a(o){if(o.tag===13){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function u(o){if(o.tag===31){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function c(o){if(s(o)!==o)throw Error(r(188))}function h(o){var l=o.alternate;if(!l){if(l=s(o),l===null)throw Error(r(188));return l!==o?null:o}for(var f=o,m=l;;){var b=f.return;if(b===null)break;var v=b.alternate;if(v===null){if(m=b.return,m!==null){f=m;continue}break}if(b.child===v.child){for(v=b.child;v;){if(v===f)return c(b),o;if(v===m)return c(b),l;v=v.sibling}throw Error(r(188))}if(f.return!==m.return)f=b,m=v;else{for(var A=!1,D=b.child;D;){if(D===f){A=!0,f=b,m=v;break}if(D===m){A=!0,m=b,f=v;break}D=D.sibling}if(!A){for(D=v.child;D;){if(D===f){A=!0,f=v,m=b;break}if(D===m){A=!0,m=v,f=b;break}D=D.sibling}if(!A)throw Error(r(189))}}if(f.alternate!==m)throw Error(r(190))}if(f.tag!==3)throw Error(r(188));return f.stateNode.current===f?o:l}function d(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o;for(o=o.child;o!==null;){if(l=d(o),l!==null)return l;o=o.sibling}return null}var g=Object.assign,y=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),F=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function ae(o){return o===null||typeof o!="object"?null:(o=ue&&o[ue]||o["@@iterator"],typeof o=="function"?o:null)}var Se=Symbol.for("react.client.reference");function Ee(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===Se?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case w:return"Fragment";case T:return"Profiler";case N:return"StrictMode";case L:return"Suspense";case C:return"SuspenseList";case $:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case k:return"Portal";case F:return o.displayName||"Context";case V:return(o._context.displayName||"Context")+".Consumer";case K:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case _:return l=o.displayName||null,l!==null?l:Ee(o.type)||"Memo";case J:l=o._payload,o=o._init;try{return Ee(o(l))}catch{}}return null}var Y=Array.isArray,X=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ce={pending:!1,data:null,method:null,action:null},_e=[],j=-1;function P(o){return{current:o}}function te(o){0>j||(o.current=_e[j],_e[j]=null,j--)}function z(o,l){j++,_e[j]=o.current,o.current=l}var xe=P(null),Te=P(null),Ae=P(null),qe=P(null);function pt(o,l){switch(z(Ae,l),z(Te,o),z(xe,null),l.nodeType){case 9:case 11:o=(o=l.documentElement)&&(o=o.namespaceURI)?oE(o):0;break;default:if(o=l.tagName,l=l.namespaceURI)l=oE(l),o=lE(l,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}te(xe),z(xe,o)}function Ke(){te(xe),te(Te),te(Ae)}function Pt(o){o.memoizedState!==null&&z(qe,o);var l=xe.current,f=lE(l,o.type);l!==f&&(z(Te,o),z(xe,f))}function Ot(o){Te.current===o&&(te(xe),te(Te)),qe.current===o&&(te(qe),nf._currentValue=Ce)}var fr,hr;function hn(o){if(fr===void 0)try{throw Error()}catch(f){var l=f.stack.trim().match(/\n( *(at )?)/);fr=l&&l[1]||"",hr=-1<f.stack.indexOf(`
93
+ at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
94
+ `+fr+o+hr}var pn=!1;function pr(o,l){if(!o||pn)return"";pn=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(oe){var se=oe}Reflect.construct(o,[],me)}else{try{me.call()}catch(oe){se=oe}o.call(me.prototype)}}else{try{throw Error()}catch(oe){se=oe}(me=o())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(oe){if(oe&&se&&typeof oe.stack=="string")return[oe.stack,se.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=m.DetermineComponentFrameRoot(),A=v[0],D=v[1];if(A&&D){var U=A.split(`
95
+ `),ie=D.split(`
96
+ `);for(b=m=0;m<U.length&&!U[m].includes("DetermineComponentFrameRoot");)m++;for(;b<ie.length&&!ie[b].includes("DetermineComponentFrameRoot");)b++;if(m===U.length||b===ie.length)for(m=U.length-1,b=ie.length-1;1<=m&&0<=b&&U[m]!==ie[b];)b--;for(;1<=m&&0<=b;m--,b--)if(U[m]!==ie[b]){if(m!==1||b!==1)do if(m--,b--,0>b||U[m]!==ie[b]){var ce=`
97
+ `+U[m].replace(" at new "," at ");return o.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",o.displayName)),ce}while(1<=m&&0<=b);break}}}finally{pn=!1,Error.prepareStackTrace=f}return(f=o?o.displayName||o.name:"")?hn(f):""}function dn(o,l){switch(o.tag){case 26:case 27:case 5:return hn(o.type);case 16:return hn("Lazy");case 13:return o.child!==l&&l!==null?hn("Suspense Fallback"):hn("Suspense");case 19:return hn("SuspenseList");case 0:case 15:return pr(o.type,!1);case 11:return pr(o.type.render,!1);case 1:return pr(o.type,!0);case 31:return hn("Activity");default:return""}}function mn(o){try{var l="",f=null;do l+=dn(o,f),f=o,o=o.return;while(o);return l}catch(m){return`
98
+ Error generating stack: `+m.message+`
99
+ `+m.stack}}var dr=Object.prototype.hasOwnProperty,he=t.unstable_scheduleCallback,je=t.unstable_cancelCallback,Dt=t.unstable_shouldYield,mt=t.unstable_requestPaint,Be=t.unstable_now,gn=t.unstable_getCurrentPriorityLevel,fe=t.unstable_ImmediatePriority,ge=t.unstable_UserBlockingPriority,I=t.unstable_NormalPriority,ze=t.unstable_LowPriority,Je=t.unstable_IdlePriority,on=t.log,mr=t.unstable_setDisableYieldValue,ke=null,jt=null;function Tn(o){if(typeof on=="function"&&mr(o),jt&&typeof jt.setStrictMode=="function")try{jt.setStrictMode(ke,o)}catch{}}var wt=Math.clz32?Math.clz32:Dp,gr=Math.log,Un=Math.LN2;function Dp(o){return o>>>=0,o===0?32:31-(gr(o)/Un|0)|0}var Il=256,ls=262144,yn=4194304;function Yt(o){var l=o&42;if(l!==0)return l;switch(o&-o){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 o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function St(o,l,f){var m=o.pendingLanes;if(m===0)return 0;var b=0,v=o.suspendedLanes,A=o.pingedLanes;o=o.warmLanes;var D=m&134217727;return D!==0?(m=D&~v,m!==0?b=Yt(m):(A&=D,A!==0?b=Yt(A):f||(f=D&~o,f!==0&&(b=Yt(f))))):(D=m&~v,D!==0?b=Yt(D):A!==0?b=Yt(A):f||(f=m&~o,f!==0&&(b=Yt(f)))),b===0?0:l!==0&&l!==b&&(l&v)===0&&(v=b&-b,f=l&-l,v>=f||v===32&&(f&4194048)!==0)?l:b}function jr(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function Ue(o,l){switch(o){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 hc(){var o=yn;return yn<<=1,(yn&62914560)===0&&(yn=4194304),o}function co(o){for(var l=[],f=0;31>f;f++)l.push(o);return l}function fo(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function _l(o,l,f,m,b,v){var A=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var D=o.entanglements,U=o.expirationTimes,ie=o.hiddenUpdates;for(f=A&~f;0<f;){var ce=31-wt(f),me=1<<ce;D[ce]=0,U[ce]=-1;var se=ie[ce];if(se!==null)for(ie[ce]=null,ce=0;ce<se.length;ce++){var oe=se[ce];oe!==null&&(oe.lane&=-536870913)}f&=~me}m!==0&&bi(o,m,0),v!==0&&b===0&&o.tag!==0&&(o.suspendedLanes|=v&~(A&~l))}function bi(o,l,f){o.pendingLanes|=l,o.suspendedLanes&=~l;var m=31-wt(l);o.entangledLanes|=l,o.entanglements[m]=o.entanglements[m]|1073741824|f&261930}function Ip(o,l){var f=o.entangledLanes|=l;for(o=o.entanglements;f;){var m=31-wt(f),b=1<<m;b&l|o[m]&l&&(o[m]|=l),f&=~b}}function Qs(o,l){var f=l&-l;return f=(f&42)!==0?1:us(f),(f&(o.suspendedLanes|l))!==0?0:f}function us(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function zl(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function _p(){var o=le.p;return o!==0?o:(o=window.event,o===void 0?32:RE(o.type))}function pc(o,l){var f=le.p;try{return le.p=o,l()}finally{le.p=f}}var Si=Math.random().toString(36).slice(2),Wt="__reactFiber$"+Si,xn="__reactProps$"+Si,cs="__reactContainer$"+Si,dc="__reactEvents$"+Si,E0="__reactListeners$"+Si,A0="__reactHandles$"+Si,zp="__reactResources$"+Si,Zs="__reactMarker$"+Si;function Ll(o){delete o[Wt],delete o[xn],delete o[dc],delete o[E0],delete o[A0]}function fs(o){var l=o[Wt];if(l)return l;for(var f=o.parentNode;f;){if(l=f[cs]||f[Wt]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(o=mE(o);o!==null;){if(f=o[Wt])return f;o=mE(o)}return l}o=f,f=o.parentNode}return null}function hs(o){if(o=o[Wt]||o[cs]){var l=o.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return o}return null}function ea(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o.stateNode;throw Error(r(33))}function ps(o){var l=o[zp];return l||(l=o[zp]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Xt(o){o[Zs]=!0}var Lp=new Set,mc={};function ds(o,l){Fi(o,l),Fi(o+"Capture",l)}function Fi(o,l){for(mc[o]=l,o=0;o<l.length;o++)Lp.add(l[o])}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]*$"),Fp={},Ne={};function Bl(o){return dr.call(Ne,o)?!0:dr.call(Fp,o)?!1:Bp.test(o)?Ne[o]=!0:(Fp[o]=!0,!1)}function Hn(o,l,f){if(Bl(l))if(f===null)o.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":o.removeAttribute(l);return;case"boolean":var m=l.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){o.removeAttribute(l);return}}o.setAttribute(l,""+f)}}function Fl(o,l,f){if(f===null)o.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(l);return}o.setAttribute(l,""+f)}}function vi(o,l,f,m){if(m===null)o.removeAttribute(f);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(f);return}o.setAttributeNS(l,f,""+m)}}function qn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Vp(o){var l=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function N0(o,l,f){var m=Object.getOwnPropertyDescriptor(o.constructor.prototype,l);if(!o.hasOwnProperty(l)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var b=m.get,v=m.set;return Object.defineProperty(o,l,{configurable:!0,get:function(){return b.call(this)},set:function(A){f=""+A,v.call(this,A)}}),Object.defineProperty(o,l,{enumerable:m.enumerable}),{getValue:function(){return f},setValue:function(A){f=""+A},stopTracking:function(){o._valueTracker=null,delete o[l]}}}}function Vl(o){if(!o._valueTracker){var l=Vp(o)?"checked":"value";o._valueTracker=N0(o,l,""+o[l])}}function Pp(o){if(!o)return!1;var l=o._valueTracker;if(!l)return!0;var f=l.getValue(),m="";return o&&(m=Vp(o)?o.checked?"true":"false":o.value),o=m,o!==f?(l.setValue(o),!0):!1}function ho(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var ki=/[\n"\\]/g;function It(o){return o.replace(ki,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function gc(o,l,f,m,b,v,A,D){o.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?o.type=A:o.removeAttribute("type"),l!=null?A==="number"?(l===0&&o.value===""||o.value!=l)&&(o.value=""+qn(l)):o.value!==""+qn(l)&&(o.value=""+qn(l)):A!=="submit"&&A!=="reset"||o.removeAttribute("value"),l!=null?xc(o,A,qn(l)):f!=null?xc(o,A,qn(f)):m!=null&&o.removeAttribute("value"),b==null&&v!=null&&(o.defaultChecked=!!v),b!=null&&(o.checked=b&&typeof b!="function"&&typeof b!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?o.name=""+qn(D):o.removeAttribute("name")}function yc(o,l,f,m,b,v,A,D){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(o.type=v),l!=null||f!=null){if(!(v!=="submit"&&v!=="reset"||l!=null)){Vl(o);return}f=f!=null?""+qn(f):"",l=l!=null?""+qn(l):f,D||l===o.value||(o.value=l),o.defaultValue=l}m=m??b,m=typeof m!="function"&&typeof m!="symbol"&&!!m,o.checked=D?o.checked:!!m,o.defaultChecked=!!m,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(o.name=A),Vl(o)}function xc(o,l,f){l==="number"&&ho(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function ta(o,l,f,m){if(o=o.options,l){l={};for(var b=0;b<f.length;b++)l["$"+f[b]]=!0;for(f=0;f<o.length;f++)b=l.hasOwnProperty("$"+o[f].value),o[f].selected!==b&&(o[f].selected=b),b&&m&&(o[f].defaultSelected=!0)}else{for(f=""+qn(f),l=null,b=0;b<o.length;b++){if(o[b].value===f){o[b].selected=!0,m&&(o[b].defaultSelected=!0);return}l!==null||o[b].disabled||(l=o[b])}l!==null&&(l.selected=!0)}}function jp(o,l,f){if(l!=null&&(l=""+qn(l),l!==o.value&&(o.value=l),f==null)){o.defaultValue!==l&&(o.defaultValue=l);return}o.defaultValue=f!=null?""+qn(f):""}function $p(o,l,f,m){if(l==null){if(m!=null){if(f!=null)throw Error(r(92));if(Y(m)){if(1<m.length)throw Error(r(93));m=m[0]}f=m}f==null&&(f=""),l=f}f=qn(l),o.defaultValue=f,m=o.textContent,m===f&&m!==""&&m!==null&&(o.value=m),Vl(o)}function Ci(o,l){if(l){var f=o.firstChild;if(f&&f===o.lastChild&&f.nodeType===3){f.nodeValue=l;return}}o.textContent=l}var Jp=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 bc(o,l,f){var m=l.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?m?o.setProperty(l,""):l==="float"?o.cssFloat="":o[l]="":m?o.setProperty(l,f):typeof f!="number"||f===0||Jp.has(l)?l==="float"?o.cssFloat=f:o[l]=(""+f).trim():o[l]=f+"px"}function Sc(o,l,f){if(l!=null&&typeof l!="object")throw Error(r(62));if(o=o.style,f!=null){for(var m in f)!f.hasOwnProperty(m)||l!=null&&l.hasOwnProperty(m)||(m.indexOf("--")===0?o.setProperty(m,""):m==="float"?o.cssFloat="":o[m]="");for(var b in l)m=l[b],l.hasOwnProperty(b)&&f[b]!==m&&bc(o,b,m)}else for(var v in l)l.hasOwnProperty(v)&&bc(o,v,l[v])}function na(o){if(o.indexOf("-")===-1)return!1;switch(o){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 nt=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"]]),T0=/^[\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 po(o){return T0.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function $r(){}var Pl=null;function vc(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var ra=null,ia=null;function p(o){var l=hs(o);if(l&&(o=l.stateNode)){var f=o[xn]||null;e:switch(o=l.stateNode,l.type){case"input":if(gc(o,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name),l=f.name,f.type==="radio"&&l!=null){for(f=o;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll('input[name="'+It(""+l)+'"][type="radio"]'),l=0;l<f.length;l++){var m=f[l];if(m!==o&&m.form===o.form){var b=m[xn]||null;if(!b)throw Error(r(90));gc(m,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(l=0;l<f.length;l++)m=f[l],m.form===o.form&&Pp(m)}break e;case"textarea":jp(o,f.value,f.defaultValue);break e;case"select":l=f.value,l!=null&&ta(o,!!f.multiple,l,!1)}}}var S=!1;function E(o,l,f){if(S)return o(l,f);S=!0;try{var m=o(l);return m}finally{if(S=!1,(ra!==null||ia!==null)&&(Ad(),ra&&(l=ra,o=ia,ia=ra=null,p(l),o)))for(l=0;l<o.length;l++)p(o[l])}}function M(o,l){var f=o.stateNode;if(f===null)return null;var m=f[xn]||null;if(m===null)return null;f=m[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":(m=!m.disabled)||(o=o.type,m=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!m;break e;default:o=!1}if(o)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"),Z=!1;if(B)try{var re={};Object.defineProperty(re,"passive",{get:function(){Z=!0}}),window.addEventListener("test",re,re),window.removeEventListener("test",re,re)}catch{Z=!1}var ye=null,ve=null,Fe=null;function Qe(){if(Fe)return Fe;var o,l=ve,f=l.length,m,b="value"in ye?ye.value:ye.textContent,v=b.length;for(o=0;o<f&&l[o]===b[o];o++);var A=f-o;for(m=1;m<=A&&l[f-m]===b[v-m];m++);return Fe=b.slice(o,1<m?1-m:void 0)}function vt(o){var l=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&l===13&&(o=13)):o=l,o===10&&(o=13),32<=o||o===13?o:0}function Ut(){return!0}function sa(){return!1}function Ht(o){function l(f,m,b,v,A){this._reactName=f,this._targetInst=b,this.type=m,this.nativeEvent=v,this.target=A,this.currentTarget=null;for(var D in o)o.hasOwnProperty(D)&&(f=o[D],this[D]=f?f(v):v[D]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Ut:sa,this.isPropagationStopped=sa,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=Ut)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=Ut)},persist:function(){},isPersistent:Ut}),l}var Jr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wi=Ht(Jr),Ur=g({},Jr,{view:0,detail:0}),a4=Ht(Ur),M0,O0,kc,Up=g({},Ur,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:D0,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==kc&&(kc&&o.type==="mousemove"?(M0=o.screenX-kc.screenX,O0=o.screenY-kc.screenY):O0=M0=0,kc=o),M0)},movementY:function(o){return"movementY"in o?o.movementY:O0}}),cC=Ht(Up),o4=g({},Up,{dataTransfer:0}),l4=Ht(o4),u4=g({},Ur,{relatedTarget:0}),R0=Ht(u4),c4=g({},Jr,{animationName:0,elapsedTime:0,pseudoElement:0}),f4=Ht(c4),h4=g({},Jr,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),p4=Ht(h4),d4=g({},Jr,{data:0}),fC=Ht(d4),m4={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},g4={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"},y4={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function x4(o){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(o):(o=y4[o])?!!l[o]:!1}function D0(){return x4}var b4=g({},Ur,{key:function(o){if(o.key){var l=m4[o.key]||o.key;if(l!=="Unidentified")return l}return o.type==="keypress"?(o=vt(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?g4[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:D0,charCode:function(o){return o.type==="keypress"?vt(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?vt(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),S4=Ht(b4),v4=g({},Up,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hC=Ht(v4),k4=g({},Ur,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:D0}),C4=Ht(k4),w4=g({},Jr,{propertyName:0,elapsedTime:0,pseudoElement:0}),E4=Ht(w4),A4=g({},Up,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),N4=Ht(A4),T4=g({},Jr,{newState:0,oldState:0}),M4=Ht(T4),O4=[9,13,27,32],I0=B&&"CompositionEvent"in window,Cc=null;B&&"documentMode"in document&&(Cc=document.documentMode);var R4=B&&"TextEvent"in window&&!Cc,pC=B&&(!I0||Cc&&8<Cc&&11>=Cc),dC=" ",mC=!1;function gC(o,l){switch(o){case"keyup":return O4.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yC(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var jl=!1;function D4(o,l){switch(o){case"compositionend":return yC(l);case"keypress":return l.which!==32?null:(mC=!0,dC);case"textInput":return o=l.data,o===dC&&mC?null:o;default:return null}}function I4(o,l){if(jl)return o==="compositionend"||!I0&&gC(o,l)?(o=Qe(),Fe=ve=ye=null,jl=!1,o):null;switch(o){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 pC&&l.locale!=="ko"?null:l.data;default:return null}}var _4={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 xC(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l==="input"?!!_4[o.type]:l==="textarea"}function bC(o,l,f,m){ra?ia?ia.push(m):ia=[m]:ra=m,l=Id(l,"onChange"),0<l.length&&(f=new wi("onChange","change",null,f,m),o.push({event:f,listeners:l}))}var wc=null,Ec=null;function z4(o){tE(o,0)}function Hp(o){var l=ea(o);if(Pp(l))return o}function SC(o,l){if(o==="change")return l}var vC=!1;if(B){var _0;if(B){var z0="oninput"in document;if(!z0){var kC=document.createElement("div");kC.setAttribute("oninput","return;"),z0=typeof kC.oninput=="function"}_0=z0}else _0=!1;vC=_0&&(!document.documentMode||9<document.documentMode)}function CC(){wc&&(wc.detachEvent("onpropertychange",wC),Ec=wc=null)}function wC(o){if(o.propertyName==="value"&&Hp(Ec)){var l=[];bC(l,Ec,o,vc(o)),E(z4,l)}}function L4(o,l,f){o==="focusin"?(CC(),wc=l,Ec=f,wc.attachEvent("onpropertychange",wC)):o==="focusout"&&CC()}function B4(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Hp(Ec)}function F4(o,l){if(o==="click")return Hp(l)}function V4(o,l){if(o==="input"||o==="change")return Hp(l)}function P4(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var Nr=typeof Object.is=="function"?Object.is:P4;function Ac(o,l){if(Nr(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var f=Object.keys(o),m=Object.keys(l);if(f.length!==m.length)return!1;for(m=0;m<f.length;m++){var b=f[m];if(!dr.call(l,b)||!Nr(o[b],l[b]))return!1}return!0}function EC(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function AC(o,l){var f=EC(o);o=0;for(var m;f;){if(f.nodeType===3){if(m=o+f.textContent.length,o<=l&&m>=l)return{node:f,offset:l-o};o=m}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=EC(f)}}function NC(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?NC(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function TC(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var l=ho(o.document);l instanceof o.HTMLIFrameElement;){try{var f=typeof l.contentWindow.location.href=="string"}catch{f=!1}if(f)o=l.contentWindow;else break;l=ho(o.document)}return l}function L0(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}var j4=B&&"documentMode"in document&&11>=document.documentMode,$l=null,B0=null,Nc=null,F0=!1;function MC(o,l,f){var m=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;F0||$l==null||$l!==ho(m)||(m=$l,"selectionStart"in m&&L0(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Nc&&Ac(Nc,m)||(Nc=m,m=Id(B0,"onSelect"),0<m.length&&(l=new wi("onSelect","select",null,l,f),o.push({event:l,listeners:m}),l.target=$l)))}function mo(o,l){var f={};return f[o.toLowerCase()]=l.toLowerCase(),f["Webkit"+o]="webkit"+l,f["Moz"+o]="moz"+l,f}var Jl={animationend:mo("Animation","AnimationEnd"),animationiteration:mo("Animation","AnimationIteration"),animationstart:mo("Animation","AnimationStart"),transitionrun:mo("Transition","TransitionRun"),transitionstart:mo("Transition","TransitionStart"),transitioncancel:mo("Transition","TransitionCancel"),transitionend:mo("Transition","TransitionEnd")},V0={},OC={};B&&(OC=document.createElement("div").style,"AnimationEvent"in window||(delete Jl.animationend.animation,delete Jl.animationiteration.animation,delete Jl.animationstart.animation),"TransitionEvent"in window||delete Jl.transitionend.transition);function go(o){if(V0[o])return V0[o];if(!Jl[o])return o;var l=Jl[o],f;for(f in l)if(l.hasOwnProperty(f)&&f in OC)return V0[o]=l[f];return o}var RC=go("animationend"),DC=go("animationiteration"),IC=go("animationstart"),$4=go("transitionrun"),J4=go("transitionstart"),U4=go("transitioncancel"),_C=go("transitionend"),zC=new Map,P0="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(" ");P0.push("scrollEnd");function Ei(o,l){zC.set(o,l),ds(l,[o])}var qp=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Hr=[],Ul=0,j0=0;function Kp(){for(var o=Ul,l=j0=Ul=0;l<o;){var f=Hr[l];Hr[l++]=null;var m=Hr[l];Hr[l++]=null;var b=Hr[l];Hr[l++]=null;var v=Hr[l];if(Hr[l++]=null,m!==null&&b!==null){var A=m.pending;A===null?b.next=b:(b.next=A.next,A.next=b),m.pending=b}v!==0&&LC(f,b,v)}}function Gp(o,l,f,m){Hr[Ul++]=o,Hr[Ul++]=l,Hr[Ul++]=f,Hr[Ul++]=m,j0|=m,o.lanes|=m,o=o.alternate,o!==null&&(o.lanes|=m)}function $0(o,l,f,m){return Gp(o,l,f,m),Yp(o)}function yo(o,l){return Gp(o,null,null,l),Yp(o)}function LC(o,l,f){o.lanes|=f;var m=o.alternate;m!==null&&(m.lanes|=f);for(var b=!1,v=o.return;v!==null;)v.childLanes|=f,m=v.alternate,m!==null&&(m.childLanes|=f),v.tag===22&&(o=v.stateNode,o===null||o._visibility&1||(b=!0)),o=v,v=v.return;return o.tag===3?(v=o.stateNode,b&&l!==null&&(b=31-wt(f),o=v.hiddenUpdates,m=o[b],m===null?o[b]=[l]:m.push(l),l.lane=f|536870912),v):null}function Yp(o){if(50<Yc)throw Yc=0,Xy=null,Error(r(185));for(var l=o.return;l!==null;)o=l,l=o.return;return o.tag===3?o.stateNode:null}var Hl={};function H4(o,l,f,m){this.tag=o,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=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tr(o,l,f,m){return new H4(o,l,f,m)}function J0(o){return o=o.prototype,!(!o||!o.isReactComponent)}function ms(o,l){var f=o.alternate;return f===null?(f=Tr(o.tag,l,o.key,o.mode),f.elementType=o.elementType,f.type=o.type,f.stateNode=o.stateNode,f.alternate=o,o.alternate=f):(f.pendingProps=l,f.type=o.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=o.flags&65011712,f.childLanes=o.childLanes,f.lanes=o.lanes,f.child=o.child,f.memoizedProps=o.memoizedProps,f.memoizedState=o.memoizedState,f.updateQueue=o.updateQueue,l=o.dependencies,f.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},f.sibling=o.sibling,f.index=o.index,f.ref=o.ref,f.refCleanup=o.refCleanup,f}function BC(o,l){o.flags&=65011714;var f=o.alternate;return f===null?(o.childLanes=0,o.lanes=l,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=f.childLanes,o.lanes=f.lanes,o.child=f.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=f.memoizedProps,o.memoizedState=f.memoizedState,o.updateQueue=f.updateQueue,o.type=f.type,l=f.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),o}function Wp(o,l,f,m,b,v){var A=0;if(m=o,typeof o=="function")J0(o)&&(A=1);else if(typeof o=="string")A=Wz(o,f,xe.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case $:return o=Tr(31,f,l,b),o.elementType=$,o.lanes=v,o;case w:return xo(f.children,b,v,l);case N:A=8,b|=24;break;case T:return o=Tr(12,f,l,b|2),o.elementType=T,o.lanes=v,o;case L:return o=Tr(13,f,l,b),o.elementType=L,o.lanes=v,o;case C:return o=Tr(19,f,l,b),o.elementType=C,o.lanes=v,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case F:A=10;break e;case V:A=9;break e;case K:A=11;break e;case _:A=14;break e;case J:A=16,m=null;break e}A=29,f=Error(r(130,o===null?"null":typeof o,"")),m=null}return l=Tr(A,f,l,b),l.elementType=o,l.type=m,l.lanes=v,l}function xo(o,l,f,m){return o=Tr(7,o,m,l),o.lanes=f,o}function U0(o,l,f){return o=Tr(6,o,null,l),o.lanes=f,o}function FC(o){var l=Tr(18,null,null,0);return l.stateNode=o,l}function H0(o,l,f){return l=Tr(4,o.children!==null?o.children:[],o.key,l),l.lanes=f,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}var VC=new WeakMap;function qr(o,l){if(typeof o=="object"&&o!==null){var f=VC.get(o);return f!==void 0?f:(l={value:o,source:l,stack:mn(l)},VC.set(o,l),l)}return{value:o,source:l,stack:mn(l)}}var ql=[],Kl=0,Xp=null,Tc=0,Kr=[],Gr=0,aa=null,Vi=1,Pi="";function gs(o,l){ql[Kl++]=Tc,ql[Kl++]=Xp,Xp=o,Tc=l}function PC(o,l,f){Kr[Gr++]=Vi,Kr[Gr++]=Pi,Kr[Gr++]=aa,aa=o;var m=Vi;o=Pi;var b=32-wt(m)-1;m&=~(1<<b),f+=1;var v=32-wt(l)+b;if(30<v){var A=b-b%5;v=(m&(1<<A)-1).toString(32),m>>=A,b-=A,Vi=1<<32-wt(l)+b|f<<b|m,Pi=v+o}else Vi=1<<v|f<<b|m,Pi=o}function q0(o){o.return!==null&&(gs(o,1),PC(o,1,0))}function K0(o){for(;o===Xp;)Xp=ql[--Kl],ql[Kl]=null,Tc=ql[--Kl],ql[Kl]=null;for(;o===aa;)aa=Kr[--Gr],Kr[Gr]=null,Pi=Kr[--Gr],Kr[Gr]=null,Vi=Kr[--Gr],Kr[Gr]=null}function jC(o,l){Kr[Gr++]=Vi,Kr[Gr++]=Pi,Kr[Gr++]=aa,Vi=l.id,Pi=l.overflow,aa=o}var bn=null,_t=null,ct=!1,oa=null,Yr=!1,G0=Error(r(519));function la(o){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Mc(qr(l,o)),G0}function $C(o){var l=o.stateNode,f=o.type,m=o.memoizedProps;switch(l[Wt]=o,l[xn]=m,f){case"dialog":st("cancel",l),st("close",l);break;case"iframe":case"object":case"embed":st("load",l);break;case"video":case"audio":for(f=0;f<Xc.length;f++)st(Xc[f],l);break;case"source":st("error",l);break;case"img":case"image":case"link":st("error",l),st("load",l);break;case"details":st("toggle",l);break;case"input":st("invalid",l),yc(l,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":st("invalid",l);break;case"textarea":st("invalid",l),$p(l,m.value,m.defaultValue,m.children)}f=m.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||l.textContent===""+f||m.suppressHydrationWarning===!0||sE(l.textContent,f)?(m.popover!=null&&(st("beforetoggle",l),st("toggle",l)),m.onScroll!=null&&st("scroll",l),m.onScrollEnd!=null&&st("scrollend",l),m.onClick!=null&&(l.onclick=$r),l=!0):l=!1,l||la(o,!0)}function JC(o){for(bn=o.return;bn;)switch(bn.tag){case 5:case 31:case 13:Yr=!1;return;case 27:case 3:Yr=!0;return;default:bn=bn.return}}function Gl(o){if(o!==bn)return!1;if(!ct)return JC(o),ct=!0,!1;var l=o.tag,f;if((f=l!==3&&l!==27)&&((f=l===5)&&(f=o.type,f=!(f!=="form"&&f!=="button")||hx(o.type,o.memoizedProps)),f=!f),f&&_t&&la(o),JC(o),l===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));_t=dE(o)}else if(l===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));_t=dE(o)}else l===27?(l=_t,ka(o.type)?(o=yx,yx=null,_t=o):_t=l):_t=bn?Xr(o.stateNode.nextSibling):null;return!0}function bo(){_t=bn=null,ct=!1}function Y0(){var o=oa;return o!==null&&(Sr===null?Sr=o:Sr.push.apply(Sr,o),oa=null),o}function Mc(o){oa===null?oa=[o]:oa.push(o)}var W0=P(null),So=null,ys=null;function ua(o,l,f){z(W0,l._currentValue),l._currentValue=f}function xs(o){o._currentValue=W0.current,te(W0)}function X0(o,l,f){for(;o!==null;){var m=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,m!==null&&(m.childLanes|=l)):m!==null&&(m.childLanes&l)!==l&&(m.childLanes|=l),o===f)break;o=o.return}}function Q0(o,l,f,m){var b=o.child;for(b!==null&&(b.return=o);b!==null;){var v=b.dependencies;if(v!==null){var A=b.child;v=v.firstContext;e:for(;v!==null;){var D=v;v=b;for(var U=0;U<l.length;U++)if(D.context===l[U]){v.lanes|=f,D=v.alternate,D!==null&&(D.lanes|=f),X0(v.return,f,o),m||(A=null);break e}v=D.next}}else if(b.tag===18){if(A=b.return,A===null)throw Error(r(341));A.lanes|=f,v=A.alternate,v!==null&&(v.lanes|=f),X0(A,f,o),A=null}else A=b.child;if(A!==null)A.return=b;else for(A=b;A!==null;){if(A===o){A=null;break}if(b=A.sibling,b!==null){b.return=A.return,A=b;break}A=A.return}b=A}}function Yl(o,l,f,m){o=null;for(var b=l,v=!1;b!==null;){if(!v){if((b.flags&524288)!==0)v=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var A=b.alternate;if(A===null)throw Error(r(387));if(A=A.memoizedProps,A!==null){var D=b.type;Nr(b.pendingProps.value,A.value)||(o!==null?o.push(D):o=[D])}}else if(b===qe.current){if(A=b.alternate,A===null)throw Error(r(387));A.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(o!==null?o.push(nf):o=[nf])}b=b.return}o!==null&&Q0(l,o,f,m),l.flags|=262144}function Qp(o){for(o=o.firstContext;o!==null;){if(!Nr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function vo(o){So=o,ys=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Sn(o){return UC(So,o)}function Zp(o,l){return So===null&&vo(o),UC(o,l)}function UC(o,l){var f=l._currentValue;if(l={context:l,memoizedValue:f,next:null},ys===null){if(o===null)throw Error(r(308));ys=l,o.dependencies={lanes:0,firstContext:l},o.flags|=524288}else ys=ys.next=l;return f}var q4=typeof AbortController<"u"?AbortController:function(){var o=[],l=this.signal={aborted:!1,addEventListener:function(f,m){o.push(m)}};this.abort=function(){l.aborted=!0,o.forEach(function(f){return f()})}},K4=t.unstable_scheduleCallback,G4=t.unstable_NormalPriority,Qt={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Z0(){return{controller:new q4,data:new Map,refCount:0}}function Oc(o){o.refCount--,o.refCount===0&&K4(G4,function(){o.controller.abort()})}var Rc=null,ey=0,Wl=0,Xl=null;function Y4(o,l){if(Rc===null){var f=Rc=[];ey=0,Wl=rx(),Xl={status:"pending",value:void 0,then:function(m){f.push(m)}}}return ey++,l.then(HC,HC),l}function HC(){if(--ey===0&&Rc!==null){Xl!==null&&(Xl.status="fulfilled");var o=Rc;Rc=null,Wl=0,Xl=null;for(var l=0;l<o.length;l++)(0,o[l])()}}function W4(o,l){var f=[],m={status:"pending",value:null,reason:null,then:function(b){f.push(b)}};return o.then(function(){m.status="fulfilled",m.value=l;for(var b=0;b<f.length;b++)(0,f[b])(l)},function(b){for(m.status="rejected",m.reason=b,b=0;b<f.length;b++)(0,f[b])(void 0)}),m}var qC=X.S;X.S=function(o,l){M2=Be(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&Y4(o,l),qC!==null&&qC(o,l)};var ko=P(null);function ty(){var o=ko.current;return o!==null?o:Rt.pooledCache}function ed(o,l){l===null?z(ko,ko.current):z(ko,l.pool)}function KC(){var o=ty();return o===null?null:{parent:Qt._currentValue,pool:o}}var Ql=Error(r(460)),ny=Error(r(474)),td=Error(r(542)),nd={then:function(){}};function GC(o){return o=o.status,o==="fulfilled"||o==="rejected"}function YC(o,l,f){switch(f=o[f],f===void 0?o.push(l):f!==l&&(l.then($r,$r),l=f),l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,XC(o),o;default:if(typeof l.status=="string")l.then($r,$r);else{if(o=Rt,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=l,o.status="pending",o.then(function(m){if(l.status==="pending"){var b=l;b.status="fulfilled",b.value=m}},function(m){if(l.status==="pending"){var b=l;b.status="rejected",b.reason=m}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,XC(o),o}throw wo=l,Ql}}function Co(o){try{var l=o._init;return l(o._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(wo=f,Ql):f}}var wo=null;function WC(){if(wo===null)throw Error(r(459));var o=wo;return wo=null,o}function XC(o){if(o===Ql||o===td)throw Error(r(483))}var Zl=null,Dc=0;function rd(o){var l=Dc;return Dc+=1,Zl===null&&(Zl=[]),YC(Zl,o,l)}function Ic(o,l){l=l.props.ref,o.ref=l!==void 0?l:null}function id(o,l){throw l.$$typeof===y?Error(r(525)):(o=Object.prototype.toString.call(l),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o)))}function QC(o){function l(Q,G){if(o){var ne=Q.deletions;ne===null?(Q.deletions=[G],Q.flags|=16):ne.push(G)}}function f(Q,G){if(!o)return null;for(;G!==null;)l(Q,G),G=G.sibling;return null}function m(Q){for(var G=new Map;Q!==null;)Q.key!==null?G.set(Q.key,Q):G.set(Q.index,Q),Q=Q.sibling;return G}function b(Q,G){return Q=ms(Q,G),Q.index=0,Q.sibling=null,Q}function v(Q,G,ne){return Q.index=ne,o?(ne=Q.alternate,ne!==null?(ne=ne.index,ne<G?(Q.flags|=67108866,G):ne):(Q.flags|=67108866,G)):(Q.flags|=1048576,G)}function A(Q){return o&&Q.alternate===null&&(Q.flags|=67108866),Q}function D(Q,G,ne,pe){return G===null||G.tag!==6?(G=U0(ne,Q.mode,pe),G.return=Q,G):(G=b(G,ne),G.return=Q,G)}function U(Q,G,ne,pe){var Le=ne.type;return Le===w?ce(Q,G,ne.props.children,pe,ne.key):G!==null&&(G.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===J&&Co(Le)===G.type)?(G=b(G,ne.props),Ic(G,ne),G.return=Q,G):(G=Wp(ne.type,ne.key,ne.props,null,Q.mode,pe),Ic(G,ne),G.return=Q,G)}function ie(Q,G,ne,pe){return G===null||G.tag!==4||G.stateNode.containerInfo!==ne.containerInfo||G.stateNode.implementation!==ne.implementation?(G=H0(ne,Q.mode,pe),G.return=Q,G):(G=b(G,ne.children||[]),G.return=Q,G)}function ce(Q,G,ne,pe,Le){return G===null||G.tag!==7?(G=xo(ne,Q.mode,pe,Le),G.return=Q,G):(G=b(G,ne),G.return=Q,G)}function me(Q,G,ne){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=U0(""+G,Q.mode,ne),G.return=Q,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case x:return ne=Wp(G.type,G.key,G.props,null,Q.mode,ne),Ic(ne,G),ne.return=Q,ne;case k:return G=H0(G,Q.mode,ne),G.return=Q,G;case J:return G=Co(G),me(Q,G,ne)}if(Y(G)||ae(G))return G=xo(G,Q.mode,ne,null),G.return=Q,G;if(typeof G.then=="function")return me(Q,rd(G),ne);if(G.$$typeof===F)return me(Q,Zp(Q,G),ne);id(Q,G)}return null}function se(Q,G,ne,pe){var Le=G!==null?G.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Le!==null?null:D(Q,G,""+ne,pe);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:return ne.key===Le?U(Q,G,ne,pe):null;case k:return ne.key===Le?ie(Q,G,ne,pe):null;case J:return ne=Co(ne),se(Q,G,ne,pe)}if(Y(ne)||ae(ne))return Le!==null?null:ce(Q,G,ne,pe,null);if(typeof ne.then=="function")return se(Q,G,rd(ne),pe);if(ne.$$typeof===F)return se(Q,G,Zp(Q,ne),pe);id(Q,ne)}return null}function oe(Q,G,ne,pe,Le){if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return Q=Q.get(ne)||null,D(G,Q,""+pe,Le);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case x:return Q=Q.get(pe.key===null?ne:pe.key)||null,U(G,Q,pe,Le);case k:return Q=Q.get(pe.key===null?ne:pe.key)||null,ie(G,Q,pe,Le);case J:return pe=Co(pe),oe(Q,G,ne,pe,Le)}if(Y(pe)||ae(pe))return Q=Q.get(ne)||null,ce(G,Q,pe,Le,null);if(typeof pe.then=="function")return oe(Q,G,ne,rd(pe),Le);if(pe.$$typeof===F)return oe(Q,G,ne,Zp(G,pe),Le);id(G,pe)}return null}function Me(Q,G,ne,pe){for(var Le=null,gt=null,Ie=G,et=G=0,ot=null;Ie!==null&&et<ne.length;et++){Ie.index>et?(ot=Ie,Ie=null):ot=Ie.sibling;var yt=se(Q,Ie,ne[et],pe);if(yt===null){Ie===null&&(Ie=ot);break}o&&Ie&&yt.alternate===null&&l(Q,Ie),G=v(yt,G,et),gt===null?Le=yt:gt.sibling=yt,gt=yt,Ie=ot}if(et===ne.length)return f(Q,Ie),ct&&gs(Q,et),Le;if(Ie===null){for(;et<ne.length;et++)Ie=me(Q,ne[et],pe),Ie!==null&&(G=v(Ie,G,et),gt===null?Le=Ie:gt.sibling=Ie,gt=Ie);return ct&&gs(Q,et),Le}for(Ie=m(Ie);et<ne.length;et++)ot=oe(Ie,Q,et,ne[et],pe),ot!==null&&(o&&ot.alternate!==null&&Ie.delete(ot.key===null?et:ot.key),G=v(ot,G,et),gt===null?Le=ot:gt.sibling=ot,gt=ot);return o&&Ie.forEach(function(Na){return l(Q,Na)}),ct&&gs(Q,et),Le}function Ve(Q,G,ne,pe){if(ne==null)throw Error(r(151));for(var Le=null,gt=null,Ie=G,et=G=0,ot=null,yt=ne.next();Ie!==null&&!yt.done;et++,yt=ne.next()){Ie.index>et?(ot=Ie,Ie=null):ot=Ie.sibling;var Na=se(Q,Ie,yt.value,pe);if(Na===null){Ie===null&&(Ie=ot);break}o&&Ie&&Na.alternate===null&&l(Q,Ie),G=v(Na,G,et),gt===null?Le=Na:gt.sibling=Na,gt=Na,Ie=ot}if(yt.done)return f(Q,Ie),ct&&gs(Q,et),Le;if(Ie===null){for(;!yt.done;et++,yt=ne.next())yt=me(Q,yt.value,pe),yt!==null&&(G=v(yt,G,et),gt===null?Le=yt:gt.sibling=yt,gt=yt);return ct&&gs(Q,et),Le}for(Ie=m(Ie);!yt.done;et++,yt=ne.next())yt=oe(Ie,Q,et,yt.value,pe),yt!==null&&(o&&yt.alternate!==null&&Ie.delete(yt.key===null?et:yt.key),G=v(yt,G,et),gt===null?Le=yt:gt.sibling=yt,gt=yt);return o&&Ie.forEach(function(oL){return l(Q,oL)}),ct&&gs(Q,et),Le}function Mt(Q,G,ne,pe){if(typeof ne=="object"&&ne!==null&&ne.type===w&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:e:{for(var Le=ne.key;G!==null;){if(G.key===Le){if(Le=ne.type,Le===w){if(G.tag===7){f(Q,G.sibling),pe=b(G,ne.props.children),pe.return=Q,Q=pe;break e}}else if(G.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===J&&Co(Le)===G.type){f(Q,G.sibling),pe=b(G,ne.props),Ic(pe,ne),pe.return=Q,Q=pe;break e}f(Q,G);break}else l(Q,G);G=G.sibling}ne.type===w?(pe=xo(ne.props.children,Q.mode,pe,ne.key),pe.return=Q,Q=pe):(pe=Wp(ne.type,ne.key,ne.props,null,Q.mode,pe),Ic(pe,ne),pe.return=Q,Q=pe)}return A(Q);case k:e:{for(Le=ne.key;G!==null;){if(G.key===Le)if(G.tag===4&&G.stateNode.containerInfo===ne.containerInfo&&G.stateNode.implementation===ne.implementation){f(Q,G.sibling),pe=b(G,ne.children||[]),pe.return=Q,Q=pe;break e}else{f(Q,G);break}else l(Q,G);G=G.sibling}pe=H0(ne,Q.mode,pe),pe.return=Q,Q=pe}return A(Q);case J:return ne=Co(ne),Mt(Q,G,ne,pe)}if(Y(ne))return Me(Q,G,ne,pe);if(ae(ne)){if(Le=ae(ne),typeof Le!="function")throw Error(r(150));return ne=Le.call(ne),Ve(Q,G,ne,pe)}if(typeof ne.then=="function")return Mt(Q,G,rd(ne),pe);if(ne.$$typeof===F)return Mt(Q,G,Zp(Q,ne),pe);id(Q,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,G!==null&&G.tag===6?(f(Q,G.sibling),pe=b(G,ne),pe.return=Q,Q=pe):(f(Q,G),pe=U0(ne,Q.mode,pe),pe.return=Q,Q=pe),A(Q)):f(Q,G)}return function(Q,G,ne,pe){try{Dc=0;var Le=Mt(Q,G,ne,pe);return Zl=null,Le}catch(Ie){if(Ie===Ql||Ie===td)throw Ie;var gt=Tr(29,Ie,null,Q.mode);return gt.lanes=pe,gt.return=Q,gt}}}var Eo=QC(!0),ZC=QC(!1),ca=!1;function ry(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function iy(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function fa(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function ha(o,l,f){var m=o.updateQueue;if(m===null)return null;if(m=m.shared,(xt&2)!==0){var b=m.pending;return b===null?l.next=l:(l.next=b.next,b.next=l),m.pending=l,l=Yp(o),LC(o,null,f),l}return Gp(o,m,l,f),Yp(o)}function _c(o,l,f){if(l=l.updateQueue,l!==null&&(l=l.shared,(f&4194048)!==0)){var m=l.lanes;m&=o.pendingLanes,f|=m,l.lanes=f,Ip(o,f)}}function sy(o,l){var f=o.updateQueue,m=o.alternate;if(m!==null&&(m=m.updateQueue,f===m)){var b=null,v=null;if(f=f.firstBaseUpdate,f!==null){do{var A={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};v===null?b=v=A:v=v.next=A,f=f.next}while(f!==null);v===null?b=v=l:v=v.next=l}else b=v=l;f={baseState:m.baseState,firstBaseUpdate:b,lastBaseUpdate:v,shared:m.shared,callbacks:m.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=l:o.next=l,f.lastBaseUpdate=l}var ay=!1;function zc(){if(ay){var o=Xl;if(o!==null)throw o}}function Lc(o,l,f,m){ay=!1;var b=o.updateQueue;ca=!1;var v=b.firstBaseUpdate,A=b.lastBaseUpdate,D=b.shared.pending;if(D!==null){b.shared.pending=null;var U=D,ie=U.next;U.next=null,A===null?v=ie:A.next=ie,A=U;var ce=o.alternate;ce!==null&&(ce=ce.updateQueue,D=ce.lastBaseUpdate,D!==A&&(D===null?ce.firstBaseUpdate=ie:D.next=ie,ce.lastBaseUpdate=U))}if(v!==null){var me=b.baseState;A=0,ce=ie=U=null,D=v;do{var se=D.lane&-536870913,oe=se!==D.lane;if(oe?(at&se)===se:(m&se)===se){se!==0&&se===Wl&&(ay=!0),ce!==null&&(ce=ce.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var Me=o,Ve=D;se=l;var Mt=f;switch(Ve.tag){case 1:if(Me=Ve.payload,typeof Me=="function"){me=Me.call(Mt,me,se);break e}me=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Ve.payload,se=typeof Me=="function"?Me.call(Mt,me,se):Me,se==null)break e;me=g({},me,se);break e;case 2:ca=!0}}se=D.callback,se!==null&&(o.flags|=64,oe&&(o.flags|=8192),oe=b.callbacks,oe===null?b.callbacks=[se]:oe.push(se))}else oe={lane:se,tag:D.tag,payload:D.payload,callback:D.callback,next:null},ce===null?(ie=ce=oe,U=me):ce=ce.next=oe,A|=se;if(D=D.next,D===null){if(D=b.shared.pending,D===null)break;oe=D,D=oe.next,oe.next=null,b.lastBaseUpdate=oe,b.shared.pending=null}}while(!0);ce===null&&(U=me),b.baseState=U,b.firstBaseUpdate=ie,b.lastBaseUpdate=ce,v===null&&(b.shared.lanes=0),ya|=A,o.lanes=A,o.memoizedState=me}}function ew(o,l){if(typeof o!="function")throw Error(r(191,o));o.call(l)}function tw(o,l){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;o<f.length;o++)ew(f[o],l)}var eu=P(null),sd=P(0);function nw(o,l){o=Ns,z(sd,o),z(eu,l),Ns=o|l.baseLanes}function oy(){z(sd,Ns),z(eu,eu.current)}function ly(){Ns=sd.current,te(eu),te(sd)}var Mr=P(null),Wr=null;function pa(o){var l=o.alternate;z(qt,qt.current&1),z(Mr,o),Wr===null&&(l===null||eu.current!==null||l.memoizedState!==null)&&(Wr=o)}function uy(o){z(qt,qt.current),z(Mr,o),Wr===null&&(Wr=o)}function rw(o){o.tag===22?(z(qt,qt.current),z(Mr,o),Wr===null&&(Wr=o)):da()}function da(){z(qt,qt.current),z(Mr,Mr.current)}function Or(o){te(Mr),Wr===o&&(Wr=null),te(qt)}var qt=P(0);function ad(o){for(var l=o;l!==null;){if(l.tag===13){var f=l.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||mx(f)||gx(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===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var bs=0,Ze=null,Nt=null,Zt=null,od=!1,tu=!1,Ao=!1,ld=0,Bc=0,nu=null,X4=0;function $t(){throw Error(r(321))}function cy(o,l){if(l===null)return!1;for(var f=0;f<l.length&&f<o.length;f++)if(!Nr(o[f],l[f]))return!1;return!0}function fy(o,l,f,m,b,v){return bs=v,Ze=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,X.H=o===null||o.memoizedState===null?Pw:Ay,Ao=!1,v=f(m,b),Ao=!1,tu&&(v=sw(l,f,m,b)),iw(o),v}function iw(o){X.H=Pc;var l=Nt!==null&&Nt.next!==null;if(bs=0,Zt=Nt=Ze=null,od=!1,Bc=0,nu=null,l)throw Error(r(300));o===null||en||(o=o.dependencies,o!==null&&Qp(o)&&(en=!0))}function sw(o,l,f,m){Ze=o;var b=0;do{if(tu&&(nu=null),Bc=0,tu=!1,25<=b)throw Error(r(301));if(b+=1,Zt=Nt=null,o.updateQueue!=null){var v=o.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}X.H=jw,v=l(f,m)}while(tu);return v}function Q4(){var o=X.H,l=o.useState()[0];return l=typeof l.then=="function"?Fc(l):l,o=o.useState()[0],(Nt!==null?Nt.memoizedState:null)!==o&&(Ze.flags|=1024),l}function hy(){var o=ld!==0;return ld=0,o}function py(o,l,f){l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~f}function dy(o){if(od){for(o=o.memoizedState;o!==null;){var l=o.queue;l!==null&&(l.pending=null),o=o.next}od=!1}bs=0,Zt=Nt=Ze=null,tu=!1,Bc=ld=0,nu=null}function Kn(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?Ze.memoizedState=Zt=o:Zt=Zt.next=o,Zt}function Kt(){if(Nt===null){var o=Ze.alternate;o=o!==null?o.memoizedState:null}else o=Nt.next;var l=Zt===null?Ze.memoizedState:Zt.next;if(l!==null)Zt=l,Nt=o;else{if(o===null)throw Ze.alternate===null?Error(r(467)):Error(r(310));Nt=o,o={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},Zt===null?Ze.memoizedState=Zt=o:Zt=Zt.next=o}return Zt}function ud(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fc(o){var l=Bc;return Bc+=1,nu===null&&(nu=[]),o=YC(nu,o,l),l=Ze,(Zt===null?l.memoizedState:Zt.next)===null&&(l=l.alternate,X.H=l===null||l.memoizedState===null?Pw:Ay),o}function cd(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Fc(o);if(o.$$typeof===F)return Sn(o)}throw Error(r(438,String(o)))}function my(o){var l=null,f=Ze.updateQueue;if(f!==null&&(l=f.memoCache),l==null){var m=Ze.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(l={data:m.data.map(function(b){return b.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),f===null&&(f=ud(),Ze.updateQueue=f),f.memoCache=l,f=l.data[l.index],f===void 0)for(f=l.data[l.index]=Array(o),m=0;m<o;m++)f[m]=H;return l.index++,f}function Ss(o,l){return typeof l=="function"?l(o):l}function fd(o){var l=Kt();return gy(l,Nt,o)}function gy(o,l,f){var m=o.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=f;var b=o.baseQueue,v=m.pending;if(v!==null){if(b!==null){var A=b.next;b.next=v.next,v.next=A}l.baseQueue=b=v,m.pending=null}if(v=o.baseState,b===null)o.memoizedState=v;else{l=b.next;var D=A=null,U=null,ie=l,ce=!1;do{var me=ie.lane&-536870913;if(me!==ie.lane?(at&me)===me:(bs&me)===me){var se=ie.revertLane;if(se===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),me===Wl&&(ce=!0);else if((bs&se)===se){ie=ie.next,se===Wl&&(ce=!0);continue}else me={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},U===null?(D=U=me,A=v):U=U.next=me,Ze.lanes|=se,ya|=se;me=ie.action,Ao&&f(v,me),v=ie.hasEagerState?ie.eagerState:f(v,me)}else se={lane:me,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},U===null?(D=U=se,A=v):U=U.next=se,Ze.lanes|=me,ya|=me;ie=ie.next}while(ie!==null&&ie!==l);if(U===null?A=v:U.next=D,!Nr(v,o.memoizedState)&&(en=!0,ce&&(f=Xl,f!==null)))throw f;o.memoizedState=v,o.baseState=A,o.baseQueue=U,m.lastRenderedState=v}return b===null&&(m.lanes=0),[o.memoizedState,m.dispatch]}function yy(o){var l=Kt(),f=l.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=o;var m=f.dispatch,b=f.pending,v=l.memoizedState;if(b!==null){f.pending=null;var A=b=b.next;do v=o(v,A.action),A=A.next;while(A!==b);Nr(v,l.memoizedState)||(en=!0),l.memoizedState=v,l.baseQueue===null&&(l.baseState=v),f.lastRenderedState=v}return[v,m]}function aw(o,l,f){var m=Ze,b=Kt(),v=ct;if(v){if(f===void 0)throw Error(r(407));f=f()}else f=l();var A=!Nr((Nt||b).memoizedState,f);if(A&&(b.memoizedState=f,en=!0),b=b.queue,Sy(uw.bind(null,m,b,o),[o]),b.getSnapshot!==l||A||Zt!==null&&Zt.memoizedState.tag&1){if(m.flags|=2048,ru(9,{destroy:void 0},lw.bind(null,m,b,f,l),null),Rt===null)throw Error(r(349));v||(bs&127)!==0||ow(m,l,f)}return f}function ow(o,l,f){o.flags|=16384,o={getSnapshot:l,value:f},l=Ze.updateQueue,l===null?(l=ud(),Ze.updateQueue=l,l.stores=[o]):(f=l.stores,f===null?l.stores=[o]:f.push(o))}function lw(o,l,f,m){l.value=f,l.getSnapshot=m,cw(l)&&fw(o)}function uw(o,l,f){return f(function(){cw(l)&&fw(o)})}function cw(o){var l=o.getSnapshot;o=o.value;try{var f=l();return!Nr(o,f)}catch{return!0}}function fw(o){var l=yo(o,2);l!==null&&vr(l,o,2)}function xy(o){var l=Kn();if(typeof o=="function"){var f=o;if(o=f(),Ao){Tn(!0);try{f()}finally{Tn(!1)}}}return l.memoizedState=l.baseState=o,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:o},l}function hw(o,l,f,m){return o.baseState=f,gy(o,Nt,typeof m=="function"?m:Ss)}function Z4(o,l,f,m,b){if(dd(o))throw Error(r(485));if(o=l.action,o!==null){var v={payload:b,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){v.listeners.push(A)}};X.T!==null?f(!0):v.isTransition=!1,m(v),f=l.pending,f===null?(v.next=l.pending=v,pw(l,v)):(v.next=f.next,l.pending=f.next=v)}}function pw(o,l){var f=l.action,m=l.payload,b=o.state;if(l.isTransition){var v=X.T,A={};X.T=A;try{var D=f(b,m),U=X.S;U!==null&&U(A,D),dw(o,l,D)}catch(ie){by(o,l,ie)}finally{v!==null&&A.types!==null&&(v.types=A.types),X.T=v}}else try{v=f(b,m),dw(o,l,v)}catch(ie){by(o,l,ie)}}function dw(o,l,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(m){mw(o,l,m)},function(m){return by(o,l,m)}):mw(o,l,f)}function mw(o,l,f){l.status="fulfilled",l.value=f,gw(l),o.state=f,l=o.pending,l!==null&&(f=l.next,f===l?o.pending=null:(f=f.next,l.next=f,pw(o,f)))}function by(o,l,f){var m=o.pending;if(o.pending=null,m!==null){m=m.next;do l.status="rejected",l.reason=f,gw(l),l=l.next;while(l!==m)}o.action=null}function gw(o){o=o.listeners;for(var l=0;l<o.length;l++)(0,o[l])()}function yw(o,l){return l}function xw(o,l){if(ct){var f=Rt.formState;if(f!==null){e:{var m=Ze;if(ct){if(_t){t:{for(var b=_t,v=Yr;b.nodeType!==8;){if(!v){b=null;break t}if(b=Xr(b.nextSibling),b===null){b=null;break t}}v=b.data,b=v==="F!"||v==="F"?b:null}if(b){_t=Xr(b.nextSibling),m=b.data==="F!";break e}}la(m)}m=!1}m&&(l=f[0])}}return f=Kn(),f.memoizedState=f.baseState=l,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yw,lastRenderedState:l},f.queue=m,f=Bw.bind(null,Ze,m),m.dispatch=f,m=xy(!1),v=Ey.bind(null,Ze,!1,m.queue),m=Kn(),b={state:l,dispatch:null,action:o,pending:null},m.queue=b,f=Z4.bind(null,Ze,b,v,f),b.dispatch=f,m.memoizedState=o,[l,f,!1]}function bw(o){var l=Kt();return Sw(l,Nt,o)}function Sw(o,l,f){if(l=gy(o,l,yw)[0],o=fd(Ss)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var m=Fc(l)}catch(A){throw A===Ql?td:A}else m=l;l=Kt();var b=l.queue,v=b.dispatch;return f!==l.memoizedState&&(Ze.flags|=2048,ru(9,{destroy:void 0},ez.bind(null,b,f),null)),[m,v,o]}function ez(o,l){o.action=l}function vw(o){var l=Kt(),f=Nt;if(f!==null)return Sw(l,f,o);Kt(),l=l.memoizedState,f=Kt();var m=f.queue.dispatch;return f.memoizedState=o,[l,m,!1]}function ru(o,l,f,m){return o={tag:o,create:f,deps:m,inst:l,next:null},l=Ze.updateQueue,l===null&&(l=ud(),Ze.updateQueue=l),f=l.lastEffect,f===null?l.lastEffect=o.next=o:(m=f.next,f.next=o,o.next=m,l.lastEffect=o),o}function kw(){return Kt().memoizedState}function hd(o,l,f,m){var b=Kn();Ze.flags|=o,b.memoizedState=ru(1|l,{destroy:void 0},f,m===void 0?null:m)}function pd(o,l,f,m){var b=Kt();m=m===void 0?null:m;var v=b.memoizedState.inst;Nt!==null&&m!==null&&cy(m,Nt.memoizedState.deps)?b.memoizedState=ru(l,v,f,m):(Ze.flags|=o,b.memoizedState=ru(1|l,v,f,m))}function Cw(o,l){hd(8390656,8,o,l)}function Sy(o,l){pd(2048,8,o,l)}function tz(o){Ze.flags|=4;var l=Ze.updateQueue;if(l===null)l=ud(),Ze.updateQueue=l,l.events=[o];else{var f=l.events;f===null?l.events=[o]:f.push(o)}}function ww(o){var l=Kt().memoizedState;return tz({ref:l,nextImpl:o}),function(){if((xt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function Ew(o,l){return pd(4,2,o,l)}function Aw(o,l){return pd(4,4,o,l)}function Nw(o,l){if(typeof l=="function"){o=o();var f=l(o);return function(){typeof f=="function"?f():l(null)}}if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function Tw(o,l,f){f=f!=null?f.concat([o]):null,pd(4,4,Nw.bind(null,l,o),f)}function vy(){}function Mw(o,l){var f=Kt();l=l===void 0?null:l;var m=f.memoizedState;return l!==null&&cy(l,m[1])?m[0]:(f.memoizedState=[o,l],o)}function Ow(o,l){var f=Kt();l=l===void 0?null:l;var m=f.memoizedState;if(l!==null&&cy(l,m[1]))return m[0];if(m=o(),Ao){Tn(!0);try{o()}finally{Tn(!1)}}return f.memoizedState=[m,l],m}function ky(o,l,f){return f===void 0||(bs&1073741824)!==0&&(at&261930)===0?o.memoizedState=l:(o.memoizedState=f,o=R2(),Ze.lanes|=o,ya|=o,f)}function Rw(o,l,f,m){return Nr(f,l)?f:eu.current!==null?(o=ky(o,f,m),Nr(o,l)||(en=!0),o):(bs&42)===0||(bs&1073741824)!==0&&(at&261930)===0?(en=!0,o.memoizedState=f):(o=R2(),Ze.lanes|=o,ya|=o,l)}function Dw(o,l,f,m,b){var v=le.p;le.p=v!==0&&8>v?v:8;var A=X.T,D={};X.T=D,Ey(o,!1,l,f);try{var U=b(),ie=X.S;if(ie!==null&&ie(D,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ce=W4(U,m);Vc(o,l,ce,Ir(o))}else Vc(o,l,m,Ir(o))}catch(me){Vc(o,l,{then:function(){},status:"rejected",reason:me},Ir())}finally{le.p=v,A!==null&&D.types!==null&&(A.types=D.types),X.T=A}}function nz(){}function Cy(o,l,f,m){if(o.tag!==5)throw Error(r(476));var b=Iw(o).queue;Dw(o,b,l,Ce,f===null?nz:function(){return _w(o),f(m)})}function Iw(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:Ce,baseState:Ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:Ce},next:null};var f={};return l.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:f},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function _w(o){var l=Iw(o);l.next===null&&(l=o.alternate.memoizedState),Vc(o,l.next.queue,{},Ir())}function wy(){return Sn(nf)}function zw(){return Kt().memoizedState}function Lw(){return Kt().memoizedState}function rz(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var f=Ir();o=fa(f);var m=ha(l,o,f);m!==null&&(vr(m,l,f),_c(m,l,f)),l={cache:Z0()},o.payload=l;return}l=l.return}}function iz(o,l,f){var m=Ir();f={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},dd(o)?Fw(l,f):(f=$0(o,l,f,m),f!==null&&(vr(f,o,m),Vw(f,l,m)))}function Bw(o,l,f){var m=Ir();Vc(o,l,f,m)}function Vc(o,l,f,m){var b={lane:m,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(dd(o))Fw(l,b);else{var v=o.alternate;if(o.lanes===0&&(v===null||v.lanes===0)&&(v=l.lastRenderedReducer,v!==null))try{var A=l.lastRenderedState,D=v(A,f);if(b.hasEagerState=!0,b.eagerState=D,Nr(D,A))return Gp(o,l,b,0),Rt===null&&Kp(),!1}catch{}if(f=$0(o,l,b,m),f!==null)return vr(f,o,m),Vw(f,l,m),!0}return!1}function Ey(o,l,f,m){if(m={lane:2,revertLane:rx(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},dd(o)){if(l)throw Error(r(479))}else l=$0(o,f,m,2),l!==null&&vr(l,o,2)}function dd(o){var l=o.alternate;return o===Ze||l!==null&&l===Ze}function Fw(o,l){tu=od=!0;var f=o.pending;f===null?l.next=l:(l.next=f.next,f.next=l),o.pending=l}function Vw(o,l,f){if((f&4194048)!==0){var m=l.lanes;m&=o.pendingLanes,f|=m,l.lanes=f,Ip(o,f)}}var Pc={readContext:Sn,use:cd,useCallback:$t,useContext:$t,useEffect:$t,useImperativeHandle:$t,useLayoutEffect:$t,useInsertionEffect:$t,useMemo:$t,useReducer:$t,useRef:$t,useState:$t,useDebugValue:$t,useDeferredValue:$t,useTransition:$t,useSyncExternalStore:$t,useId:$t,useHostTransitionStatus:$t,useFormState:$t,useActionState:$t,useOptimistic:$t,useMemoCache:$t,useCacheRefresh:$t};Pc.useEffectEvent=$t;var Pw={readContext:Sn,use:cd,useCallback:function(o,l){return Kn().memoizedState=[o,l===void 0?null:l],o},useContext:Sn,useEffect:Cw,useImperativeHandle:function(o,l,f){f=f!=null?f.concat([o]):null,hd(4194308,4,Nw.bind(null,l,o),f)},useLayoutEffect:function(o,l){return hd(4194308,4,o,l)},useInsertionEffect:function(o,l){hd(4,2,o,l)},useMemo:function(o,l){var f=Kn();l=l===void 0?null:l;var m=o();if(Ao){Tn(!0);try{o()}finally{Tn(!1)}}return f.memoizedState=[m,l],m},useReducer:function(o,l,f){var m=Kn();if(f!==void 0){var b=f(l);if(Ao){Tn(!0);try{f(l)}finally{Tn(!1)}}}else b=l;return m.memoizedState=m.baseState=b,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:b},m.queue=o,o=o.dispatch=iz.bind(null,Ze,o),[m.memoizedState,o]},useRef:function(o){var l=Kn();return o={current:o},l.memoizedState=o},useState:function(o){o=xy(o);var l=o.queue,f=Bw.bind(null,Ze,l);return l.dispatch=f,[o.memoizedState,f]},useDebugValue:vy,useDeferredValue:function(o,l){var f=Kn();return ky(f,o,l)},useTransition:function(){var o=xy(!1);return o=Dw.bind(null,Ze,o.queue,!0,!1),Kn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,f){var m=Ze,b=Kn();if(ct){if(f===void 0)throw Error(r(407));f=f()}else{if(f=l(),Rt===null)throw Error(r(349));(at&127)!==0||ow(m,l,f)}b.memoizedState=f;var v={value:f,getSnapshot:l};return b.queue=v,Cw(uw.bind(null,m,v,o),[o]),m.flags|=2048,ru(9,{destroy:void 0},lw.bind(null,m,v,f,l),null),f},useId:function(){var o=Kn(),l=Rt.identifierPrefix;if(ct){var f=Pi,m=Vi;f=(m&~(1<<32-wt(m)-1)).toString(32)+f,l="_"+l+"R_"+f,f=ld++,0<f&&(l+="H"+f.toString(32)),l+="_"}else f=X4++,l="_"+l+"r_"+f.toString(32)+"_";return o.memoizedState=l},useHostTransitionStatus:wy,useFormState:xw,useActionState:xw,useOptimistic:function(o){var l=Kn();l.memoizedState=l.baseState=o;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=f,l=Ey.bind(null,Ze,!0,f),f.dispatch=l,[o,l]},useMemoCache:my,useCacheRefresh:function(){return Kn().memoizedState=rz.bind(null,Ze)},useEffectEvent:function(o){var l=Kn(),f={impl:o};return l.memoizedState=f,function(){if((xt&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}},Ay={readContext:Sn,use:cd,useCallback:Mw,useContext:Sn,useEffect:Sy,useImperativeHandle:Tw,useInsertionEffect:Ew,useLayoutEffect:Aw,useMemo:Ow,useReducer:fd,useRef:kw,useState:function(){return fd(Ss)},useDebugValue:vy,useDeferredValue:function(o,l){var f=Kt();return Rw(f,Nt.memoizedState,o,l)},useTransition:function(){var o=fd(Ss)[0],l=Kt().memoizedState;return[typeof o=="boolean"?o:Fc(o),l]},useSyncExternalStore:aw,useId:zw,useHostTransitionStatus:wy,useFormState:bw,useActionState:bw,useOptimistic:function(o,l){var f=Kt();return hw(f,Nt,o,l)},useMemoCache:my,useCacheRefresh:Lw};Ay.useEffectEvent=ww;var jw={readContext:Sn,use:cd,useCallback:Mw,useContext:Sn,useEffect:Sy,useImperativeHandle:Tw,useInsertionEffect:Ew,useLayoutEffect:Aw,useMemo:Ow,useReducer:yy,useRef:kw,useState:function(){return yy(Ss)},useDebugValue:vy,useDeferredValue:function(o,l){var f=Kt();return Nt===null?ky(f,o,l):Rw(f,Nt.memoizedState,o,l)},useTransition:function(){var o=yy(Ss)[0],l=Kt().memoizedState;return[typeof o=="boolean"?o:Fc(o),l]},useSyncExternalStore:aw,useId:zw,useHostTransitionStatus:wy,useFormState:vw,useActionState:vw,useOptimistic:function(o,l){var f=Kt();return Nt!==null?hw(f,Nt,o,l):(f.baseState=o,[o,f.queue.dispatch])},useMemoCache:my,useCacheRefresh:Lw};jw.useEffectEvent=ww;function Ny(o,l,f,m){l=o.memoizedState,f=f(m,l),f=f==null?l:g({},l,f),o.memoizedState=f,o.lanes===0&&(o.updateQueue.baseState=f)}var Ty={enqueueSetState:function(o,l,f){o=o._reactInternals;var m=Ir(),b=fa(m);b.payload=l,f!=null&&(b.callback=f),l=ha(o,b,m),l!==null&&(vr(l,o,m),_c(l,o,m))},enqueueReplaceState:function(o,l,f){o=o._reactInternals;var m=Ir(),b=fa(m);b.tag=1,b.payload=l,f!=null&&(b.callback=f),l=ha(o,b,m),l!==null&&(vr(l,o,m),_c(l,o,m))},enqueueForceUpdate:function(o,l){o=o._reactInternals;var f=Ir(),m=fa(f);m.tag=2,l!=null&&(m.callback=l),l=ha(o,m,f),l!==null&&(vr(l,o,f),_c(l,o,f))}};function $w(o,l,f,m,b,v,A){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(m,v,A):l.prototype&&l.prototype.isPureReactComponent?!Ac(f,m)||!Ac(b,v):!0}function Jw(o,l,f,m){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(f,m),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(f,m),l.state!==o&&Ty.enqueueReplaceState(l,l.state,null)}function No(o,l){var f=l;if("ref"in l){f={};for(var m in l)m!=="ref"&&(f[m]=l[m])}if(o=o.defaultProps){f===l&&(f=g({},f));for(var b in o)f[b]===void 0&&(f[b]=o[b])}return f}function Uw(o){qp(o)}function Hw(o){console.error(o)}function qw(o){qp(o)}function md(o,l){try{var f=o.onUncaughtError;f(l.value,{componentStack:l.stack})}catch(m){setTimeout(function(){throw m})}}function Kw(o,l,f){try{var m=o.onCaughtError;m(f.value,{componentStack:f.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function My(o,l,f){return f=fa(f),f.tag=3,f.payload={element:null},f.callback=function(){md(o,l)},f}function Gw(o){return o=fa(o),o.tag=3,o}function Yw(o,l,f,m){var b=f.type.getDerivedStateFromError;if(typeof b=="function"){var v=m.value;o.payload=function(){return b(v)},o.callback=function(){Kw(l,f,m)}}var A=f.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(o.callback=function(){Kw(l,f,m),typeof b!="function"&&(xa===null?xa=new Set([this]):xa.add(this));var D=m.stack;this.componentDidCatch(m.value,{componentStack:D!==null?D:""})})}function sz(o,l,f,m,b){if(f.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(l=f.alternate,l!==null&&Yl(l,f,b,!0),f=Mr.current,f!==null){switch(f.tag){case 31:case 13:return Wr===null?Nd():f.alternate===null&&Jt===0&&(Jt=3),f.flags&=-257,f.flags|=65536,f.lanes=b,m===nd?f.flags|=16384:(l=f.updateQueue,l===null?f.updateQueue=new Set([m]):l.add(m),ex(o,m,b)),!1;case 22:return f.flags|=65536,m===nd?f.flags|=16384:(l=f.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([m])},f.updateQueue=l):(f=l.retryQueue,f===null?l.retryQueue=new Set([m]):f.add(m)),ex(o,m,b)),!1}throw Error(r(435,f.tag))}return ex(o,m,b),Nd(),!1}if(ct)return l=Mr.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=b,m!==G0&&(o=Error(r(422),{cause:m}),Mc(qr(o,f)))):(m!==G0&&(l=Error(r(423),{cause:m}),Mc(qr(l,f))),o=o.current.alternate,o.flags|=65536,b&=-b,o.lanes|=b,m=qr(m,f),b=My(o.stateNode,m,b),sy(o,b),Jt!==4&&(Jt=2)),!1;var v=Error(r(520),{cause:m});if(v=qr(v,f),Gc===null?Gc=[v]:Gc.push(v),Jt!==4&&(Jt=2),l===null)return!0;m=qr(m,f),f=l;do{switch(f.tag){case 3:return f.flags|=65536,o=b&-b,f.lanes|=o,o=My(f.stateNode,m,o),sy(f,o),!1;case 1:if(l=f.type,v=f.stateNode,(f.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(xa===null||!xa.has(v))))return f.flags|=65536,b&=-b,f.lanes|=b,b=Gw(b),Yw(b,o,f,m),sy(f,b),!1}f=f.return}while(f!==null);return!1}var Oy=Error(r(461)),en=!1;function vn(o,l,f,m){l.child=o===null?ZC(l,null,f,m):Eo(l,o.child,f,m)}function Ww(o,l,f,m,b){f=f.render;var v=l.ref;if("ref"in m){var A={};for(var D in m)D!=="ref"&&(A[D]=m[D])}else A=m;return vo(l),m=fy(o,l,f,A,v,b),D=hy(),o!==null&&!en?(py(o,l,b),vs(o,l,b)):(ct&&D&&q0(l),l.flags|=1,vn(o,l,m,b),l.child)}function Xw(o,l,f,m,b){if(o===null){var v=f.type;return typeof v=="function"&&!J0(v)&&v.defaultProps===void 0&&f.compare===null?(l.tag=15,l.type=v,Qw(o,l,v,m,b)):(o=Wp(f.type,null,m,l,l.mode,b),o.ref=l.ref,o.return=l,l.child=o)}if(v=o.child,!Fy(o,b)){var A=v.memoizedProps;if(f=f.compare,f=f!==null?f:Ac,f(A,m)&&o.ref===l.ref)return vs(o,l,b)}return l.flags|=1,o=ms(v,m),o.ref=l.ref,o.return=l,l.child=o}function Qw(o,l,f,m,b){if(o!==null){var v=o.memoizedProps;if(Ac(v,m)&&o.ref===l.ref)if(en=!1,l.pendingProps=m=v,Fy(o,b))(o.flags&131072)!==0&&(en=!0);else return l.lanes=o.lanes,vs(o,l,b)}return Ry(o,l,f,m,b)}function Zw(o,l,f,m){var b=m.children,v=o!==null?o.memoizedState:null;if(o===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((l.flags&128)!==0){if(v=v!==null?v.baseLanes|f:f,o!==null){for(m=l.child=o.child,b=0;m!==null;)b=b|m.lanes|m.childLanes,m=m.sibling;m=b&~v}else m=0,l.child=null;return e2(o,l,v,f,m)}if((f&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},o!==null&&ed(l,v!==null?v.cachePool:null),v!==null?nw(l,v):oy(),rw(l);else return m=l.lanes=536870912,e2(o,l,v!==null?v.baseLanes|f:f,f,m)}else v!==null?(ed(l,v.cachePool),nw(l,v),da(),l.memoizedState=null):(o!==null&&ed(l,null),oy(),da());return vn(o,l,b,f),l.child}function jc(o,l){return o!==null&&o.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function e2(o,l,f,m,b){var v=ty();return v=v===null?null:{parent:Qt._currentValue,pool:v},l.memoizedState={baseLanes:f,cachePool:v},o!==null&&ed(l,null),oy(),rw(l),o!==null&&Yl(o,l,m,!0),l.childLanes=b,null}function gd(o,l){return l=xd({mode:l.mode,children:l.children},o.mode),l.ref=o.ref,o.child=l,l.return=o,l}function t2(o,l,f){return Eo(l,o.child,null,f),o=gd(l,l.pendingProps),o.flags|=2,Or(l),l.memoizedState=null,o}function az(o,l,f){var m=l.pendingProps,b=(l.flags&128)!==0;if(l.flags&=-129,o===null){if(ct){if(m.mode==="hidden")return o=gd(l,m),l.lanes=536870912,jc(null,o);if(uy(l),(o=_t)?(o=pE(o,Yr),o=o!==null&&o.data==="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:aa!==null?{id:Vi,overflow:Pi}:null,retryLane:536870912,hydrationErrors:null},f=FC(o),f.return=l,l.child=f,bn=l,_t=null)):o=null,o===null)throw la(l);return l.lanes=536870912,null}return gd(l,m)}var v=o.memoizedState;if(v!==null){var A=v.dehydrated;if(uy(l),b)if(l.flags&256)l.flags&=-257,l=t2(o,l,f);else if(l.memoizedState!==null)l.child=o.child,l.flags|=128,l=null;else throw Error(r(558));else if(en||Yl(o,l,f,!1),b=(f&o.childLanes)!==0,en||b){if(m=Rt,m!==null&&(A=Qs(m,f),A!==0&&A!==v.retryLane))throw v.retryLane=A,yo(o,A),vr(m,o,A),Oy;Nd(),l=t2(o,l,f)}else o=v.treeContext,_t=Xr(A.nextSibling),bn=l,ct=!0,oa=null,Yr=!1,o!==null&&jC(l,o),l=gd(l,m),l.flags|=4096;return l}return o=ms(o.child,{mode:m.mode,children:m.children}),o.ref=l.ref,l.child=o,o.return=l,o}function yd(o,l){var f=l.ref;if(f===null)o!==null&&o.ref!==null&&(l.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(r(284));(o===null||o.ref!==f)&&(l.flags|=4194816)}}function Ry(o,l,f,m,b){return vo(l),f=fy(o,l,f,m,void 0,b),m=hy(),o!==null&&!en?(py(o,l,b),vs(o,l,b)):(ct&&m&&q0(l),l.flags|=1,vn(o,l,f,b),l.child)}function n2(o,l,f,m,b,v){return vo(l),l.updateQueue=null,f=sw(l,m,f,b),iw(o),m=hy(),o!==null&&!en?(py(o,l,v),vs(o,l,v)):(ct&&m&&q0(l),l.flags|=1,vn(o,l,f,v),l.child)}function r2(o,l,f,m,b){if(vo(l),l.stateNode===null){var v=Hl,A=f.contextType;typeof A=="object"&&A!==null&&(v=Sn(A)),v=new f(m,v),l.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Ty,l.stateNode=v,v._reactInternals=l,v=l.stateNode,v.props=m,v.state=l.memoizedState,v.refs={},ry(l),A=f.contextType,v.context=typeof A=="object"&&A!==null?Sn(A):Hl,v.state=l.memoizedState,A=f.getDerivedStateFromProps,typeof A=="function"&&(Ny(l,f,A,m),v.state=l.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(A=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),A!==v.state&&Ty.enqueueReplaceState(v,v.state,null),Lc(l,m,v,b),zc(),v.state=l.memoizedState),typeof v.componentDidMount=="function"&&(l.flags|=4194308),m=!0}else if(o===null){v=l.stateNode;var D=l.memoizedProps,U=No(f,D);v.props=U;var ie=v.context,ce=f.contextType;A=Hl,typeof ce=="object"&&ce!==null&&(A=Sn(ce));var me=f.getDerivedStateFromProps;ce=typeof me=="function"||typeof v.getSnapshotBeforeUpdate=="function",D=l.pendingProps!==D,ce||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(D||ie!==A)&&Jw(l,v,m,A),ca=!1;var se=l.memoizedState;v.state=se,Lc(l,m,v,b),zc(),ie=l.memoizedState,D||se!==ie||ca?(typeof me=="function"&&(Ny(l,f,me,m),ie=l.memoizedState),(U=ca||$w(l,f,U,m,se,ie,A))?(ce||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(l.flags|=4194308)):(typeof v.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=m,l.memoizedState=ie),v.props=m,v.state=ie,v.context=A,m=U):(typeof v.componentDidMount=="function"&&(l.flags|=4194308),m=!1)}else{v=l.stateNode,iy(o,l),A=l.memoizedProps,ce=No(f,A),v.props=ce,me=l.pendingProps,se=v.context,ie=f.contextType,U=Hl,typeof ie=="object"&&ie!==null&&(U=Sn(ie)),D=f.getDerivedStateFromProps,(ie=typeof D=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A!==me||se!==U)&&Jw(l,v,m,U),ca=!1,se=l.memoizedState,v.state=se,Lc(l,m,v,b),zc();var oe=l.memoizedState;A!==me||se!==oe||ca||o!==null&&o.dependencies!==null&&Qp(o.dependencies)?(typeof D=="function"&&(Ny(l,f,D,m),oe=l.memoizedState),(ce=ca||$w(l,f,ce,m,se,oe,U)||o!==null&&o.dependencies!==null&&Qp(o.dependencies))?(ie||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(m,oe,U),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(m,oe,U)),typeof v.componentDidUpdate=="function"&&(l.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof v.componentDidUpdate!="function"||A===o.memoizedProps&&se===o.memoizedState||(l.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||A===o.memoizedProps&&se===o.memoizedState||(l.flags|=1024),l.memoizedProps=m,l.memoizedState=oe),v.props=m,v.state=oe,v.context=U,m=ce):(typeof v.componentDidUpdate!="function"||A===o.memoizedProps&&se===o.memoizedState||(l.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||A===o.memoizedProps&&se===o.memoizedState||(l.flags|=1024),m=!1)}return v=m,yd(o,l),m=(l.flags&128)!==0,v||m?(v=l.stateNode,f=m&&typeof f.getDerivedStateFromError!="function"?null:v.render(),l.flags|=1,o!==null&&m?(l.child=Eo(l,o.child,null,b),l.child=Eo(l,null,f,b)):vn(o,l,f,b),l.memoizedState=v.state,o=l.child):o=vs(o,l,b),o}function i2(o,l,f,m){return bo(),l.flags|=256,vn(o,l,f,m),l.child}var Dy={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Iy(o){return{baseLanes:o,cachePool:KC()}}function _y(o,l,f){return o=o!==null?o.childLanes&~f:0,l&&(o|=Dr),o}function s2(o,l,f){var m=l.pendingProps,b=!1,v=(l.flags&128)!==0,A;if((A=v)||(A=o!==null&&o.memoizedState===null?!1:(qt.current&2)!==0),A&&(b=!0,l.flags&=-129),A=(l.flags&32)!==0,l.flags&=-33,o===null){if(ct){if(b?pa(l):da(),(o=_t)?(o=pE(o,Yr),o=o!==null&&o.data!=="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:aa!==null?{id:Vi,overflow:Pi}:null,retryLane:536870912,hydrationErrors:null},f=FC(o),f.return=l,l.child=f,bn=l,_t=null)):o=null,o===null)throw la(l);return gx(o)?l.lanes=32:l.lanes=536870912,null}var D=m.children;return m=m.fallback,b?(da(),b=l.mode,D=xd({mode:"hidden",children:D},b),m=xo(m,b,f,null),D.return=l,m.return=l,D.sibling=m,l.child=D,m=l.child,m.memoizedState=Iy(f),m.childLanes=_y(o,A,f),l.memoizedState=Dy,jc(null,m)):(pa(l),zy(l,D))}var U=o.memoizedState;if(U!==null&&(D=U.dehydrated,D!==null)){if(v)l.flags&256?(pa(l),l.flags&=-257,l=Ly(o,l,f)):l.memoizedState!==null?(da(),l.child=o.child,l.flags|=128,l=null):(da(),D=m.fallback,b=l.mode,m=xd({mode:"visible",children:m.children},b),D=xo(D,b,f,null),D.flags|=2,m.return=l,D.return=l,m.sibling=D,l.child=m,Eo(l,o.child,null,f),m=l.child,m.memoizedState=Iy(f),m.childLanes=_y(o,A,f),l.memoizedState=Dy,l=jc(null,m));else if(pa(l),gx(D)){if(A=D.nextSibling&&D.nextSibling.dataset,A)var ie=A.dgst;A=ie,m=Error(r(419)),m.stack="",m.digest=A,Mc({value:m,source:null,stack:null}),l=Ly(o,l,f)}else if(en||Yl(o,l,f,!1),A=(f&o.childLanes)!==0,en||A){if(A=Rt,A!==null&&(m=Qs(A,f),m!==0&&m!==U.retryLane))throw U.retryLane=m,yo(o,m),vr(A,o,m),Oy;mx(D)||Nd(),l=Ly(o,l,f)}else mx(D)?(l.flags|=192,l.child=o.child,l=null):(o=U.treeContext,_t=Xr(D.nextSibling),bn=l,ct=!0,oa=null,Yr=!1,o!==null&&jC(l,o),l=zy(l,m.children),l.flags|=4096);return l}return b?(da(),D=m.fallback,b=l.mode,U=o.child,ie=U.sibling,m=ms(U,{mode:"hidden",children:m.children}),m.subtreeFlags=U.subtreeFlags&65011712,ie!==null?D=ms(ie,D):(D=xo(D,b,f,null),D.flags|=2),D.return=l,m.return=l,m.sibling=D,l.child=m,jc(null,m),m=l.child,D=o.child.memoizedState,D===null?D=Iy(f):(b=D.cachePool,b!==null?(U=Qt._currentValue,b=b.parent!==U?{parent:U,pool:U}:b):b=KC(),D={baseLanes:D.baseLanes|f,cachePool:b}),m.memoizedState=D,m.childLanes=_y(o,A,f),l.memoizedState=Dy,jc(o.child,m)):(pa(l),f=o.child,o=f.sibling,f=ms(f,{mode:"visible",children:m.children}),f.return=l,f.sibling=null,o!==null&&(A=l.deletions,A===null?(l.deletions=[o],l.flags|=16):A.push(o)),l.child=f,l.memoizedState=null,f)}function zy(o,l){return l=xd({mode:"visible",children:l},o.mode),l.return=o,o.child=l}function xd(o,l){return o=Tr(22,o,null,l),o.lanes=0,o}function Ly(o,l,f){return Eo(l,o.child,null,f),o=zy(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function a2(o,l,f){o.lanes|=l;var m=o.alternate;m!==null&&(m.lanes|=l),X0(o.return,l,f)}function By(o,l,f,m,b,v){var A=o.memoizedState;A===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:m,tail:f,tailMode:b,treeForkCount:v}:(A.isBackwards=l,A.rendering=null,A.renderingStartTime=0,A.last=m,A.tail=f,A.tailMode=b,A.treeForkCount=v)}function o2(o,l,f){var m=l.pendingProps,b=m.revealOrder,v=m.tail;m=m.children;var A=qt.current,D=(A&2)!==0;if(D?(A=A&1|2,l.flags|=128):A&=1,z(qt,A),vn(o,l,m,f),m=ct?Tc:0,!D&&o!==null&&(o.flags&128)!==0)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&a2(o,f,l);else if(o.tag===19)a2(o,f,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(b){case"forwards":for(f=l.child,b=null;f!==null;)o=f.alternate,o!==null&&ad(o)===null&&(b=f),f=f.sibling;f=b,f===null?(b=l.child,l.child=null):(b=f.sibling,f.sibling=null),By(l,!1,b,f,v,m);break;case"backwards":case"unstable_legacy-backwards":for(f=null,b=l.child,l.child=null;b!==null;){if(o=b.alternate,o!==null&&ad(o)===null){l.child=b;break}o=b.sibling,b.sibling=f,f=b,b=o}By(l,!0,f,null,v,m);break;case"together":By(l,!1,null,null,void 0,m);break;default:l.memoizedState=null}return l.child}function vs(o,l,f){if(o!==null&&(l.dependencies=o.dependencies),ya|=l.lanes,(f&l.childLanes)===0)if(o!==null){if(Yl(o,l,f,!1),(f&l.childLanes)===0)return null}else return null;if(o!==null&&l.child!==o.child)throw Error(r(153));if(l.child!==null){for(o=l.child,f=ms(o,o.pendingProps),l.child=f,f.return=l;o.sibling!==null;)o=o.sibling,f=f.sibling=ms(o,o.pendingProps),f.return=l;f.sibling=null}return l.child}function Fy(o,l){return(o.lanes&l)!==0?!0:(o=o.dependencies,!!(o!==null&&Qp(o)))}function oz(o,l,f){switch(l.tag){case 3:pt(l,l.stateNode.containerInfo),ua(l,Qt,o.memoizedState.cache),bo();break;case 27:case 5:Pt(l);break;case 4:pt(l,l.stateNode.containerInfo);break;case 10:ua(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,uy(l),null;break;case 13:var m=l.memoizedState;if(m!==null)return m.dehydrated!==null?(pa(l),l.flags|=128,null):(f&l.child.childLanes)!==0?s2(o,l,f):(pa(l),o=vs(o,l,f),o!==null?o.sibling:null);pa(l);break;case 19:var b=(o.flags&128)!==0;if(m=(f&l.childLanes)!==0,m||(Yl(o,l,f,!1),m=(f&l.childLanes)!==0),b){if(m)return o2(o,l,f);l.flags|=128}if(b=l.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),z(qt,qt.current),m)break;return null;case 22:return l.lanes=0,Zw(o,l,f,l.pendingProps);case 24:ua(l,Qt,o.memoizedState.cache)}return vs(o,l,f)}function l2(o,l,f){if(o!==null)if(o.memoizedProps!==l.pendingProps)en=!0;else{if(!Fy(o,f)&&(l.flags&128)===0)return en=!1,oz(o,l,f);en=(o.flags&131072)!==0}else en=!1,ct&&(l.flags&1048576)!==0&&PC(l,Tc,l.index);switch(l.lanes=0,l.tag){case 16:e:{var m=l.pendingProps;if(o=Co(l.elementType),l.type=o,typeof o=="function")J0(o)?(m=No(o,m),l.tag=1,l=r2(null,l,o,m,f)):(l.tag=0,l=Ry(null,l,o,m,f));else{if(o!=null){var b=o.$$typeof;if(b===K){l.tag=11,l=Ww(null,l,o,m,f);break e}else if(b===_){l.tag=14,l=Xw(null,l,o,m,f);break e}}throw l=Ee(o)||o,Error(r(306,l,""))}}return l;case 0:return Ry(o,l,l.type,l.pendingProps,f);case 1:return m=l.type,b=No(m,l.pendingProps),r2(o,l,m,b,f);case 3:e:{if(pt(l,l.stateNode.containerInfo),o===null)throw Error(r(387));m=l.pendingProps;var v=l.memoizedState;b=v.element,iy(o,l),Lc(l,m,null,f);var A=l.memoizedState;if(m=A.cache,ua(l,Qt,m),m!==v.cache&&Q0(l,[Qt],f,!0),zc(),m=A.element,v.isDehydrated)if(v={element:m,isDehydrated:!1,cache:A.cache},l.updateQueue.baseState=v,l.memoizedState=v,l.flags&256){l=i2(o,l,m,f);break e}else if(m!==b){b=qr(Error(r(424)),l),Mc(b),l=i2(o,l,m,f);break e}else for(o=l.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,_t=Xr(o.firstChild),bn=l,ct=!0,oa=null,Yr=!0,f=ZC(l,null,m,f),l.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(bo(),m===b){l=vs(o,l,f);break e}vn(o,l,m,f)}l=l.child}return l;case 26:return yd(o,l),o===null?(f=bE(l.type,null,l.pendingProps,null))?l.memoizedState=f:ct||(f=l.type,o=l.pendingProps,m=_d(Ae.current).createElement(f),m[Wt]=l,m[xn]=o,kn(m,f,o),Xt(m),l.stateNode=m):l.memoizedState=bE(l.type,o.memoizedProps,l.pendingProps,o.memoizedState),null;case 27:return Pt(l),o===null&&ct&&(m=l.stateNode=gE(l.type,l.pendingProps,Ae.current),bn=l,Yr=!0,b=_t,ka(l.type)?(yx=b,_t=Xr(m.firstChild)):_t=b),vn(o,l,l.pendingProps.children,f),yd(o,l),o===null&&(l.flags|=4194304),l.child;case 5:return o===null&&ct&&((b=m=_t)&&(m=Bz(m,l.type,l.pendingProps,Yr),m!==null?(l.stateNode=m,bn=l,_t=Xr(m.firstChild),Yr=!1,b=!0):b=!1),b||la(l)),Pt(l),b=l.type,v=l.pendingProps,A=o!==null?o.memoizedProps:null,m=v.children,hx(b,v)?m=null:A!==null&&hx(b,A)&&(l.flags|=32),l.memoizedState!==null&&(b=fy(o,l,Q4,null,null,f),nf._currentValue=b),yd(o,l),vn(o,l,m,f),l.child;case 6:return o===null&&ct&&((o=f=_t)&&(f=Fz(f,l.pendingProps,Yr),f!==null?(l.stateNode=f,bn=l,_t=null,o=!0):o=!1),o||la(l)),null;case 13:return s2(o,l,f);case 4:return pt(l,l.stateNode.containerInfo),m=l.pendingProps,o===null?l.child=Eo(l,null,m,f):vn(o,l,m,f),l.child;case 11:return Ww(o,l,l.type,l.pendingProps,f);case 7:return vn(o,l,l.pendingProps,f),l.child;case 8:return vn(o,l,l.pendingProps.children,f),l.child;case 12:return vn(o,l,l.pendingProps.children,f),l.child;case 10:return m=l.pendingProps,ua(l,l.type,m.value),vn(o,l,m.children,f),l.child;case 9:return b=l.type._context,m=l.pendingProps.children,vo(l),b=Sn(b),m=m(b),l.flags|=1,vn(o,l,m,f),l.child;case 14:return Xw(o,l,l.type,l.pendingProps,f);case 15:return Qw(o,l,l.type,l.pendingProps,f);case 19:return o2(o,l,f);case 31:return az(o,l,f);case 22:return Zw(o,l,f,l.pendingProps);case 24:return vo(l),m=Sn(Qt),o===null?(b=ty(),b===null&&(b=Rt,v=Z0(),b.pooledCache=v,v.refCount++,v!==null&&(b.pooledCacheLanes|=f),b=v),l.memoizedState={parent:m,cache:b},ry(l),ua(l,Qt,b)):((o.lanes&f)!==0&&(iy(o,l),Lc(l,null,null,f),zc()),b=o.memoizedState,v=l.memoizedState,b.parent!==m?(b={parent:m,cache:m},l.memoizedState=b,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=b),ua(l,Qt,m)):(m=v.cache,ua(l,Qt,m),m!==b.cache&&Q0(l,[Qt],f,!0))),vn(o,l,l.pendingProps.children,f),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function ks(o){o.flags|=4}function Vy(o,l,f,m,b){if((l=(o.mode&32)!==0)&&(l=!1),l){if(o.flags|=16777216,(b&335544128)===b)if(o.stateNode.complete)o.flags|=8192;else if(z2())o.flags|=8192;else throw wo=nd,ny}else o.flags&=-16777217}function u2(o,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!wE(l))if(z2())o.flags|=8192;else throw wo=nd,ny}function bd(o,l){l!==null&&(o.flags|=4),o.flags&16384&&(l=o.tag!==22?hc():536870912,o.lanes|=l,ou|=l)}function $c(o,l){if(!ct)switch(o.tailMode){case"hidden":l=o.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?o.tail=null:f.sibling=null;break;case"collapsed":f=o.tail;for(var m=null;f!==null;)f.alternate!==null&&(m=f),f=f.sibling;m===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:m.sibling=null}}function zt(o){var l=o.alternate!==null&&o.alternate.child===o.child,f=0,m=0;if(l)for(var b=o.child;b!==null;)f|=b.lanes|b.childLanes,m|=b.subtreeFlags&65011712,m|=b.flags&65011712,b.return=o,b=b.sibling;else for(b=o.child;b!==null;)f|=b.lanes|b.childLanes,m|=b.subtreeFlags,m|=b.flags,b.return=o,b=b.sibling;return o.subtreeFlags|=m,o.childLanes=f,l}function lz(o,l,f){var m=l.pendingProps;switch(K0(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zt(l),null;case 1:return zt(l),null;case 3:return f=l.stateNode,m=null,o!==null&&(m=o.memoizedState.cache),l.memoizedState.cache!==m&&(l.flags|=2048),xs(Qt),Ke(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(o===null||o.child===null)&&(Gl(l)?ks(l):o===null||o.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Y0())),zt(l),null;case 26:var b=l.type,v=l.memoizedState;return o===null?(ks(l),v!==null?(zt(l),u2(l,v)):(zt(l),Vy(l,b,null,m,f))):v?v!==o.memoizedState?(ks(l),zt(l),u2(l,v)):(zt(l),l.flags&=-16777217):(o=o.memoizedProps,o!==m&&ks(l),zt(l),Vy(l,b,o,m,f)),null;case 27:if(Ot(l),f=Ae.current,b=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==m&&ks(l);else{if(!m){if(l.stateNode===null)throw Error(r(166));return zt(l),null}o=xe.current,Gl(l)?$C(l):(o=gE(b,m,f),l.stateNode=o,ks(l))}return zt(l),null;case 5:if(Ot(l),b=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==m&&ks(l);else{if(!m){if(l.stateNode===null)throw Error(r(166));return zt(l),null}if(v=xe.current,Gl(l))$C(l);else{var A=_d(Ae.current);switch(v){case 1:v=A.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:v=A.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":v=A.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":v=A.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":v=A.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof m.is=="string"?A.createElement("select",{is:m.is}):A.createElement("select"),m.multiple?v.multiple=!0:m.size&&(v.size=m.size);break;default:v=typeof m.is=="string"?A.createElement(b,{is:m.is}):A.createElement(b)}}v[Wt]=l,v[xn]=m;e:for(A=l.child;A!==null;){if(A.tag===5||A.tag===6)v.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&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}l.stateNode=v;e:switch(kn(v,b,m),b){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&ks(l)}}return zt(l),Vy(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,f),null;case 6:if(o&&l.stateNode!=null)o.memoizedProps!==m&&ks(l);else{if(typeof m!="string"&&l.stateNode===null)throw Error(r(166));if(o=Ae.current,Gl(l)){if(o=l.stateNode,f=l.memoizedProps,m=null,b=bn,b!==null)switch(b.tag){case 27:case 5:m=b.memoizedProps}o[Wt]=l,o=!!(o.nodeValue===f||m!==null&&m.suppressHydrationWarning===!0||sE(o.nodeValue,f)),o||la(l,!0)}else o=_d(o).createTextNode(m),o[Wt]=l,l.stateNode=o}return zt(l),null;case 31:if(f=l.memoizedState,o===null||o.memoizedState!==null){if(m=Gl(l),f!==null){if(o===null){if(!m)throw Error(r(318));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Wt]=l}else bo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;zt(l),o=!1}else f=Y0(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return l.flags&256?(Or(l),l):(Or(l),null);if((l.flags&128)!==0)throw Error(r(558))}return zt(l),null;case 13:if(m=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(b=Gl(l),m!==null&&m.dehydrated!==null){if(o===null){if(!b)throw Error(r(318));if(b=l.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(r(317));b[Wt]=l}else bo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;zt(l),b=!1}else b=Y0(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=b),b=!0;if(!b)return l.flags&256?(Or(l),l):(Or(l),null)}return Or(l),(l.flags&128)!==0?(l.lanes=f,l):(f=m!==null,o=o!==null&&o.memoizedState!==null,f&&(m=l.child,b=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(b=m.alternate.memoizedState.cachePool.pool),v=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(v=m.memoizedState.cachePool.pool),v!==b&&(m.flags|=2048)),f!==o&&f&&(l.child.flags|=8192),bd(l,l.updateQueue),zt(l),null);case 4:return Ke(),o===null&&ox(l.stateNode.containerInfo),zt(l),null;case 10:return xs(l.type),zt(l),null;case 19:if(te(qt),m=l.memoizedState,m===null)return zt(l),null;if(b=(l.flags&128)!==0,v=m.rendering,v===null)if(b)$c(m,!1);else{if(Jt!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(v=ad(o),v!==null){for(l.flags|=128,$c(m,!1),o=v.updateQueue,l.updateQueue=o,bd(l,o),l.subtreeFlags=0,o=f,f=l.child;f!==null;)BC(f,o),f=f.sibling;return z(qt,qt.current&1|2),ct&&gs(l,m.treeForkCount),l.child}o=o.sibling}m.tail!==null&&Be()>wd&&(l.flags|=128,b=!0,$c(m,!1),l.lanes=4194304)}else{if(!b)if(o=ad(v),o!==null){if(l.flags|=128,b=!0,o=o.updateQueue,l.updateQueue=o,bd(l,o),$c(m,!0),m.tail===null&&m.tailMode==="hidden"&&!v.alternate&&!ct)return zt(l),null}else 2*Be()-m.renderingStartTime>wd&&f!==536870912&&(l.flags|=128,b=!0,$c(m,!1),l.lanes=4194304);m.isBackwards?(v.sibling=l.child,l.child=v):(o=m.last,o!==null?o.sibling=v:l.child=v,m.last=v)}return m.tail!==null?(o=m.tail,m.rendering=o,m.tail=o.sibling,m.renderingStartTime=Be(),o.sibling=null,f=qt.current,z(qt,b?f&1|2:f&1),ct&&gs(l,m.treeForkCount),o):(zt(l),null);case 22:case 23:return Or(l),ly(),m=l.memoizedState!==null,o!==null?o.memoizedState!==null!==m&&(l.flags|=8192):m&&(l.flags|=8192),m?(f&536870912)!==0&&(l.flags&128)===0&&(zt(l),l.subtreeFlags&6&&(l.flags|=8192)):zt(l),f=l.updateQueue,f!==null&&bd(l,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048),o!==null&&te(ko),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),xs(Qt),zt(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function uz(o,l){switch(K0(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return xs(Qt),Ke(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return Ot(l),null;case 31:if(l.memoizedState!==null){if(Or(l),l.alternate===null)throw Error(r(340));bo()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(Or(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(r(340));bo()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return te(qt),null;case 4:return Ke(),null;case 10:return xs(l.type),null;case 22:case 23:return Or(l),ly(),o!==null&&te(ko),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return xs(Qt),null;case 25:return null;default:return null}}function c2(o,l){switch(K0(l),l.tag){case 3:xs(Qt),Ke();break;case 26:case 27:case 5:Ot(l);break;case 4:Ke();break;case 31:l.memoizedState!==null&&Or(l);break;case 13:Or(l);break;case 19:te(qt);break;case 10:xs(l.type);break;case 22:case 23:Or(l),ly(),o!==null&&te(ko);break;case 24:xs(Qt)}}function Jc(o,l){try{var f=l.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var b=m.next;f=b;do{if((f.tag&o)===o){m=void 0;var v=f.create,A=f.inst;m=v(),A.destroy=m}f=f.next}while(f!==b)}}catch(D){At(l,l.return,D)}}function ma(o,l,f){try{var m=l.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var v=b.next;m=v;do{if((m.tag&o)===o){var A=m.inst,D=A.destroy;if(D!==void 0){A.destroy=void 0,b=l;var U=f,ie=D;try{ie()}catch(ce){At(b,U,ce)}}}m=m.next}while(m!==v)}}catch(ce){At(l,l.return,ce)}}function f2(o){var l=o.updateQueue;if(l!==null){var f=o.stateNode;try{tw(l,f)}catch(m){At(o,o.return,m)}}}function h2(o,l,f){f.props=No(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(m){At(o,l,m)}}function Uc(o,l){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var m=o.stateNode;break;case 30:m=o.stateNode;break;default:m=o.stateNode}typeof f=="function"?o.refCleanup=f(m):f.current=m}}catch(b){At(o,l,b)}}function ji(o,l){var f=o.ref,m=o.refCleanup;if(f!==null)if(typeof m=="function")try{m()}catch(b){At(o,l,b)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(b){At(o,l,b)}else f.current=null}function p2(o){var l=o.type,f=o.memoizedProps,m=o.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":f.autoFocus&&m.focus();break e;case"img":f.src?m.src=f.src:f.srcSet&&(m.srcset=f.srcSet)}}catch(b){At(o,o.return,b)}}function Py(o,l,f){try{var m=o.stateNode;Rz(m,o.type,f,l),m[xn]=l}catch(b){At(o,o.return,b)}}function d2(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&ka(o.type)||o.tag===4}function jy(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||d2(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&ka(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function $y(o,l,f){var m=o.tag;if(m===5||m===6)o=o.stateNode,l?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,l):(l=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,l.appendChild(o),f=f._reactRootContainer,f!=null||l.onclick!==null||(l.onclick=$r));else if(m!==4&&(m===27&&ka(o.type)&&(f=o.stateNode,l=null),o=o.child,o!==null))for($y(o,l,f),o=o.sibling;o!==null;)$y(o,l,f),o=o.sibling}function Sd(o,l,f){var m=o.tag;if(m===5||m===6)o=o.stateNode,l?f.insertBefore(o,l):f.appendChild(o);else if(m!==4&&(m===27&&ka(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(Sd(o,l,f),o=o.sibling;o!==null;)Sd(o,l,f),o=o.sibling}function m2(o){var l=o.stateNode,f=o.memoizedProps;try{for(var m=o.type,b=l.attributes;b.length;)l.removeAttributeNode(b[0]);kn(l,m,f),l[Wt]=o,l[xn]=f}catch(v){At(o,o.return,v)}}var Cs=!1,tn=!1,Jy=!1,g2=typeof WeakSet=="function"?WeakSet:Set,ln=null;function cz(o,l){if(o=o.containerInfo,cx=jd,o=TC(o),L0(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var m=f.getSelection&&f.getSelection();if(m&&m.rangeCount!==0){f=m.anchorNode;var b=m.anchorOffset,v=m.focusNode;m=m.focusOffset;try{f.nodeType,v.nodeType}catch{f=null;break e}var A=0,D=-1,U=-1,ie=0,ce=0,me=o,se=null;t:for(;;){for(var oe;me!==f||b!==0&&me.nodeType!==3||(D=A+b),me!==v||m!==0&&me.nodeType!==3||(U=A+m),me.nodeType===3&&(A+=me.nodeValue.length),(oe=me.firstChild)!==null;)se=me,me=oe;for(;;){if(me===o)break t;if(se===f&&++ie===b&&(D=A),se===v&&++ce===m&&(U=A),(oe=me.nextSibling)!==null)break;me=se,se=me.parentNode}me=oe}f=D===-1||U===-1?null:{start:D,end:U}}else f=null}f=f||{start:0,end:0}}else f=null;for(fx={focusedElem:o,selectionRange:f},jd=!1,ln=l;ln!==null;)if(l=ln,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,ln=o;else for(;ln!==null;){switch(l=ln,v=l.alternate,o=l.flags,l.tag){case 0:if((o&4)!==0&&(o=l.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f<o.length;f++)b=o[f],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&v!==null){o=void 0,f=l,b=v.memoizedProps,v=v.memoizedState,m=f.stateNode;try{var Me=No(f.type,b);o=m.getSnapshotBeforeUpdate(Me,v),m.__reactInternalSnapshotBeforeUpdate=o}catch(Ve){At(f,f.return,Ve)}}break;case 3:if((o&1024)!==0){if(o=l.stateNode.containerInfo,f=o.nodeType,f===9)dx(o);else if(f===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":dx(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=l.sibling,o!==null){o.return=l.return,ln=o;break}ln=l.return}}function y2(o,l,f){var m=f.flags;switch(f.tag){case 0:case 11:case 15:Es(o,f),m&4&&Jc(5,f);break;case 1:if(Es(o,f),m&4)if(o=f.stateNode,l===null)try{o.componentDidMount()}catch(A){At(f,f.return,A)}else{var b=No(f.type,l.memoizedProps);l=l.memoizedState;try{o.componentDidUpdate(b,l,o.__reactInternalSnapshotBeforeUpdate)}catch(A){At(f,f.return,A)}}m&64&&f2(f),m&512&&Uc(f,f.return);break;case 3:if(Es(o,f),m&64&&(o=f.updateQueue,o!==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{tw(o,l)}catch(A){At(f,f.return,A)}}break;case 27:l===null&&m&4&&m2(f);case 26:case 5:Es(o,f),l===null&&m&4&&p2(f),m&512&&Uc(f,f.return);break;case 12:Es(o,f);break;case 31:Es(o,f),m&4&&S2(o,f);break;case 13:Es(o,f),m&4&&v2(o,f),m&64&&(o=f.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(f=bz.bind(null,f),Vz(o,f))));break;case 22:if(m=f.memoizedState!==null||Cs,!m){l=l!==null&&l.memoizedState!==null||tn,b=Cs;var v=tn;Cs=m,(tn=l)&&!v?As(o,f,(f.subtreeFlags&8772)!==0):Es(o,f),Cs=b,tn=v}break;case 30:break;default:Es(o,f)}}function x2(o){var l=o.alternate;l!==null&&(o.alternate=null,x2(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&Ll(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Bt=null,yr=!1;function ws(o,l,f){for(f=f.child;f!==null;)b2(o,l,f),f=f.sibling}function b2(o,l,f){if(jt&&typeof jt.onCommitFiberUnmount=="function")try{jt.onCommitFiberUnmount(ke,f)}catch{}switch(f.tag){case 26:tn||ji(f,l),ws(o,l,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:tn||ji(f,l);var m=Bt,b=yr;ka(f.type)&&(Bt=f.stateNode,yr=!1),ws(o,l,f),Zc(f.stateNode),Bt=m,yr=b;break;case 5:tn||ji(f,l);case 6:if(m=Bt,b=yr,Bt=null,ws(o,l,f),Bt=m,yr=b,Bt!==null)if(yr)try{(Bt.nodeType===9?Bt.body:Bt.nodeName==="HTML"?Bt.ownerDocument.body:Bt).removeChild(f.stateNode)}catch(v){At(f,l,v)}else try{Bt.removeChild(f.stateNode)}catch(v){At(f,l,v)}break;case 18:Bt!==null&&(yr?(o=Bt,fE(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,f.stateNode),mu(o)):fE(Bt,f.stateNode));break;case 4:m=Bt,b=yr,Bt=f.stateNode.containerInfo,yr=!0,ws(o,l,f),Bt=m,yr=b;break;case 0:case 11:case 14:case 15:ma(2,f,l),tn||ma(4,f,l),ws(o,l,f);break;case 1:tn||(ji(f,l),m=f.stateNode,typeof m.componentWillUnmount=="function"&&h2(f,l,m)),ws(o,l,f);break;case 21:ws(o,l,f);break;case 22:tn=(m=tn)||f.memoizedState!==null,ws(o,l,f),tn=m;break;default:ws(o,l,f)}}function S2(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{mu(o)}catch(f){At(l,l.return,f)}}}function v2(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{mu(o)}catch(f){At(l,l.return,f)}}function fz(o){switch(o.tag){case 31:case 13:case 19:var l=o.stateNode;return l===null&&(l=o.stateNode=new g2),l;case 22:return o=o.stateNode,l=o._retryCache,l===null&&(l=o._retryCache=new g2),l;default:throw Error(r(435,o.tag))}}function vd(o,l){var f=fz(o);l.forEach(function(m){if(!f.has(m)){f.add(m);var b=Sz.bind(null,o,m);m.then(b,b)}})}function xr(o,l){var f=l.deletions;if(f!==null)for(var m=0;m<f.length;m++){var b=f[m],v=o,A=l,D=A;e:for(;D!==null;){switch(D.tag){case 27:if(ka(D.type)){Bt=D.stateNode,yr=!1;break e}break;case 5:Bt=D.stateNode,yr=!1;break e;case 3:case 4:Bt=D.stateNode.containerInfo,yr=!0;break e}D=D.return}if(Bt===null)throw Error(r(160));b2(v,A,b),Bt=null,yr=!1,v=b.alternate,v!==null&&(v.return=null),b.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)k2(l,o),l=l.sibling}var Ai=null;function k2(o,l){var f=o.alternate,m=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:xr(l,o),br(o),m&4&&(ma(3,o,o.return),Jc(3,o),ma(5,o,o.return));break;case 1:xr(l,o),br(o),m&512&&(tn||f===null||ji(f,f.return)),m&64&&Cs&&(o=o.updateQueue,o!==null&&(m=o.callbacks,m!==null&&(f=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=f===null?m:f.concat(m))));break;case 26:var b=Ai;if(xr(l,o),br(o),m&512&&(tn||f===null||ji(f,f.return)),m&4){var v=f!==null?f.memoizedState:null;if(m=o.memoizedState,f===null)if(m===null)if(o.stateNode===null){e:{m=o.type,f=o.memoizedProps,b=b.ownerDocument||b;t:switch(m){case"title":v=b.getElementsByTagName("title")[0],(!v||v[Zs]||v[Wt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=b.createElement(m),b.head.insertBefore(v,b.querySelector("head > title"))),kn(v,m,f),v[Wt]=o,Xt(v),m=v;break e;case"link":var A=kE("link","href",b).get(m+(f.href||""));if(A){for(var D=0;D<A.length;D++)if(v=A[D],v.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&v.getAttribute("rel")===(f.rel==null?null:f.rel)&&v.getAttribute("title")===(f.title==null?null:f.title)&&v.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){A.splice(D,1);break t}}v=b.createElement(m),kn(v,m,f),b.head.appendChild(v);break;case"meta":if(A=kE("meta","content",b).get(m+(f.content||""))){for(D=0;D<A.length;D++)if(v=A[D],v.getAttribute("content")===(f.content==null?null:""+f.content)&&v.getAttribute("name")===(f.name==null?null:f.name)&&v.getAttribute("property")===(f.property==null?null:f.property)&&v.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&v.getAttribute("charset")===(f.charSet==null?null:f.charSet)){A.splice(D,1);break t}}v=b.createElement(m),kn(v,m,f),b.head.appendChild(v);break;default:throw Error(r(468,m))}v[Wt]=o,Xt(v),m=v}o.stateNode=m}else CE(b,o.type,o.stateNode);else o.stateNode=vE(b,m,o.memoizedProps);else v!==m?(v===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):v.count--,m===null?CE(b,o.type,o.stateNode):vE(b,m,o.memoizedProps)):m===null&&o.stateNode!==null&&Py(o,o.memoizedProps,f.memoizedProps)}break;case 27:xr(l,o),br(o),m&512&&(tn||f===null||ji(f,f.return)),f!==null&&m&4&&Py(o,o.memoizedProps,f.memoizedProps);break;case 5:if(xr(l,o),br(o),m&512&&(tn||f===null||ji(f,f.return)),o.flags&32){b=o.stateNode;try{Ci(b,"")}catch(Me){At(o,o.return,Me)}}m&4&&o.stateNode!=null&&(b=o.memoizedProps,Py(o,b,f!==null?f.memoizedProps:b)),m&1024&&(Jy=!0);break;case 6:if(xr(l,o),br(o),m&4){if(o.stateNode===null)throw Error(r(162));m=o.memoizedProps,f=o.stateNode;try{f.nodeValue=m}catch(Me){At(o,o.return,Me)}}break;case 3:if(Bd=null,b=Ai,Ai=zd(l.containerInfo),xr(l,o),Ai=b,br(o),m&4&&f!==null&&f.memoizedState.isDehydrated)try{mu(l.containerInfo)}catch(Me){At(o,o.return,Me)}Jy&&(Jy=!1,C2(o));break;case 4:m=Ai,Ai=zd(o.stateNode.containerInfo),xr(l,o),br(o),Ai=m;break;case 12:xr(l,o),br(o);break;case 31:xr(l,o),br(o),m&4&&(m=o.updateQueue,m!==null&&(o.updateQueue=null,vd(o,m)));break;case 13:xr(l,o),br(o),o.child.flags&8192&&o.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(Cd=Be()),m&4&&(m=o.updateQueue,m!==null&&(o.updateQueue=null,vd(o,m)));break;case 22:b=o.memoizedState!==null;var U=f!==null&&f.memoizedState!==null,ie=Cs,ce=tn;if(Cs=ie||b,tn=ce||U,xr(l,o),tn=ce,Cs=ie,br(o),m&8192)e:for(l=o.stateNode,l._visibility=b?l._visibility&-2:l._visibility|1,b&&(f===null||U||Cs||tn||To(o)),f=null,l=o;;){if(l.tag===5||l.tag===26){if(f===null){U=f=l;try{if(v=U.stateNode,b)A=v.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{D=U.stateNode;var me=U.memoizedProps.style,se=me!=null&&me.hasOwnProperty("display")?me.display:null;D.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Me){At(U,U.return,Me)}}}else if(l.tag===6){if(f===null){U=l;try{U.stateNode.nodeValue=b?"":U.memoizedProps}catch(Me){At(U,U.return,Me)}}}else if(l.tag===18){if(f===null){U=l;try{var oe=U.stateNode;b?hE(oe,!0):hE(U.stateNode,!1)}catch(Me){At(U,U.return,Me)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===o)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break e;for(;l.sibling===null;){if(l.return===null||l.return===o)break e;f===l&&(f=null),l=l.return}f===l&&(f=null),l.sibling.return=l.return,l=l.sibling}m&4&&(m=o.updateQueue,m!==null&&(f=m.retryQueue,f!==null&&(m.retryQueue=null,vd(o,f))));break;case 19:xr(l,o),br(o),m&4&&(m=o.updateQueue,m!==null&&(o.updateQueue=null,vd(o,m)));break;case 30:break;case 21:break;default:xr(l,o),br(o)}}function br(o){var l=o.flags;if(l&2){try{for(var f,m=o.return;m!==null;){if(d2(m)){f=m;break}m=m.return}if(f==null)throw Error(r(160));switch(f.tag){case 27:var b=f.stateNode,v=jy(o);Sd(o,v,b);break;case 5:var A=f.stateNode;f.flags&32&&(Ci(A,""),f.flags&=-33);var D=jy(o);Sd(o,D,A);break;case 3:case 4:var U=f.stateNode.containerInfo,ie=jy(o);$y(o,ie,U);break;default:throw Error(r(161))}}catch(ce){At(o,o.return,ce)}o.flags&=-3}l&4096&&(o.flags&=-4097)}function C2(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var l=o;C2(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),o=o.sibling}}function Es(o,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)y2(o,l.alternate,l),l=l.sibling}function To(o){for(o=o.child;o!==null;){var l=o;switch(l.tag){case 0:case 11:case 14:case 15:ma(4,l,l.return),To(l);break;case 1:ji(l,l.return);var f=l.stateNode;typeof f.componentWillUnmount=="function"&&h2(l,l.return,f),To(l);break;case 27:Zc(l.stateNode);case 26:case 5:ji(l,l.return),To(l);break;case 22:l.memoizedState===null&&To(l);break;case 30:To(l);break;default:To(l)}o=o.sibling}}function As(o,l,f){for(f=f&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var m=l.alternate,b=o,v=l,A=v.flags;switch(v.tag){case 0:case 11:case 15:As(b,v,f),Jc(4,v);break;case 1:if(As(b,v,f),m=v,b=m.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(ie){At(m,m.return,ie)}if(m=v,b=m.updateQueue,b!==null){var D=m.stateNode;try{var U=b.shared.hiddenCallbacks;if(U!==null)for(b.shared.hiddenCallbacks=null,b=0;b<U.length;b++)ew(U[b],D)}catch(ie){At(m,m.return,ie)}}f&&A&64&&f2(v),Uc(v,v.return);break;case 27:m2(v);case 26:case 5:As(b,v,f),f&&m===null&&A&4&&p2(v),Uc(v,v.return);break;case 12:As(b,v,f);break;case 31:As(b,v,f),f&&A&4&&S2(b,v);break;case 13:As(b,v,f),f&&A&4&&v2(b,v);break;case 22:v.memoizedState===null&&As(b,v,f),Uc(v,v.return);break;case 30:break;default:As(b,v,f)}l=l.sibling}}function Uy(o,l){var f=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==f&&(o!=null&&o.refCount++,f!=null&&Oc(f))}function Hy(o,l){o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Oc(o))}function Ni(o,l,f,m){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)w2(o,l,f,m),l=l.sibling}function w2(o,l,f,m){var b=l.flags;switch(l.tag){case 0:case 11:case 15:Ni(o,l,f,m),b&2048&&Jc(9,l);break;case 1:Ni(o,l,f,m);break;case 3:Ni(o,l,f,m),b&2048&&(o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Oc(o)));break;case 12:if(b&2048){Ni(o,l,f,m),o=l.stateNode;try{var v=l.memoizedProps,A=v.id,D=v.onPostCommit;typeof D=="function"&&D(A,l.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(U){At(l,l.return,U)}}else Ni(o,l,f,m);break;case 31:Ni(o,l,f,m);break;case 13:Ni(o,l,f,m);break;case 23:break;case 22:v=l.stateNode,A=l.alternate,l.memoizedState!==null?v._visibility&2?Ni(o,l,f,m):Hc(o,l):v._visibility&2?Ni(o,l,f,m):(v._visibility|=2,iu(o,l,f,m,(l.subtreeFlags&10256)!==0||!1)),b&2048&&Uy(A,l);break;case 24:Ni(o,l,f,m),b&2048&&Hy(l.alternate,l);break;default:Ni(o,l,f,m)}}function iu(o,l,f,m,b){for(b=b&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var v=o,A=l,D=f,U=m,ie=A.flags;switch(A.tag){case 0:case 11:case 15:iu(v,A,D,U,b),Jc(8,A);break;case 23:break;case 22:var ce=A.stateNode;A.memoizedState!==null?ce._visibility&2?iu(v,A,D,U,b):Hc(v,A):(ce._visibility|=2,iu(v,A,D,U,b)),b&&ie&2048&&Uy(A.alternate,A);break;case 24:iu(v,A,D,U,b),b&&ie&2048&&Hy(A.alternate,A);break;default:iu(v,A,D,U,b)}l=l.sibling}}function Hc(o,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var f=o,m=l,b=m.flags;switch(m.tag){case 22:Hc(f,m),b&2048&&Uy(m.alternate,m);break;case 24:Hc(f,m),b&2048&&Hy(m.alternate,m);break;default:Hc(f,m)}l=l.sibling}}var qc=8192;function su(o,l,f){if(o.subtreeFlags&qc)for(o=o.child;o!==null;)E2(o,l,f),o=o.sibling}function E2(o,l,f){switch(o.tag){case 26:su(o,l,f),o.flags&qc&&o.memoizedState!==null&&Xz(f,Ai,o.memoizedState,o.memoizedProps);break;case 5:su(o,l,f);break;case 3:case 4:var m=Ai;Ai=zd(o.stateNode.containerInfo),su(o,l,f),Ai=m;break;case 22:o.memoizedState===null&&(m=o.alternate,m!==null&&m.memoizedState!==null?(m=qc,qc=16777216,su(o,l,f),qc=m):su(o,l,f));break;default:su(o,l,f)}}function A2(o){var l=o.alternate;if(l!==null&&(o=l.child,o!==null)){l.child=null;do l=o.sibling,o.sibling=null,o=l;while(o!==null)}}function Kc(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var m=l[f];ln=m,T2(m,o)}A2(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)N2(o),o=o.sibling}function N2(o){switch(o.tag){case 0:case 11:case 15:Kc(o),o.flags&2048&&ma(9,o,o.return);break;case 3:Kc(o);break;case 12:Kc(o);break;case 22:var l=o.stateNode;o.memoizedState!==null&&l._visibility&2&&(o.return===null||o.return.tag!==13)?(l._visibility&=-3,kd(o)):Kc(o);break;default:Kc(o)}}function kd(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var f=0;f<l.length;f++){var m=l[f];ln=m,T2(m,o)}A2(o)}for(o=o.child;o!==null;){switch(l=o,l.tag){case 0:case 11:case 15:ma(8,l,l.return),kd(l);break;case 22:f=l.stateNode,f._visibility&2&&(f._visibility&=-3,kd(l));break;default:kd(l)}o=o.sibling}}function T2(o,l){for(;ln!==null;){var f=ln;switch(f.tag){case 0:case 11:case 15:ma(8,f,l);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var m=f.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:Oc(f.memoizedState.cache)}if(m=f.child,m!==null)m.return=f,ln=m;else e:for(f=o;ln!==null;){m=ln;var b=m.sibling,v=m.return;if(x2(m),m===f){ln=null;break e}if(b!==null){b.return=v,ln=b;break e}ln=v}}}var hz={getCacheForType:function(o){var l=Sn(Qt),f=l.data.get(o);return f===void 0&&(f=o(),l.data.set(o,f)),f},cacheSignal:function(){return Sn(Qt).controller.signal}},pz=typeof WeakMap=="function"?WeakMap:Map,xt=0,Rt=null,it=null,at=0,Et=0,Rr=null,ga=!1,au=!1,qy=!1,Ns=0,Jt=0,ya=0,Mo=0,Ky=0,Dr=0,ou=0,Gc=null,Sr=null,Gy=!1,Cd=0,M2=0,wd=1/0,Ed=null,xa=null,rn=0,ba=null,lu=null,Ts=0,Yy=0,Wy=null,O2=null,Yc=0,Xy=null;function Ir(){return(xt&2)!==0&&at!==0?at&-at:X.T!==null?rx():_p()}function R2(){if(Dr===0)if((at&536870912)===0||ct){var o=ls;ls<<=1,(ls&3932160)===0&&(ls=262144),Dr=o}else Dr=536870912;return o=Mr.current,o!==null&&(o.flags|=32),Dr}function vr(o,l,f){(o===Rt&&(Et===2||Et===9)||o.cancelPendingCommit!==null)&&(uu(o,0),Sa(o,at,Dr,!1)),fo(o,f),((xt&2)===0||o!==Rt)&&(o===Rt&&((xt&2)===0&&(Mo|=f),Jt===4&&Sa(o,at,Dr,!1)),$i(o))}function D2(o,l,f){if((xt&6)!==0)throw Error(r(327));var m=!f&&(l&127)===0&&(l&o.expiredLanes)===0||jr(o,l),b=m?gz(o,l):Zy(o,l,!0),v=m;do{if(b===0){au&&!m&&Sa(o,l,0,!1);break}else{if(f=o.current.alternate,v&&!dz(f)){b=Zy(o,l,!1),v=!1;continue}if(b===2){if(v=l,o.errorRecoveryDisabledLanes&v)var A=0;else A=o.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){l=A;e:{var D=o;b=Gc;var U=D.current.memoizedState.isDehydrated;if(U&&(uu(D,A).flags|=256),A=Zy(D,A,!1),A!==2){if(qy&&!U){D.errorRecoveryDisabledLanes|=v,Mo|=v,b=4;break e}v=Sr,Sr=b,v!==null&&(Sr===null?Sr=v:Sr.push.apply(Sr,v))}b=A}if(v=!1,b!==2)continue}}if(b===1){uu(o,0),Sa(o,l,0,!0);break}e:{switch(m=o,v=b,v){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:Sa(m,l,Dr,!ga);break e;case 2:Sr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(b=Cd+300-Be(),10<b)){if(Sa(m,l,Dr,!ga),St(m,0,!0)!==0)break e;Ts=l,m.timeoutHandle=uE(I2.bind(null,m,f,Sr,Ed,Gy,l,Dr,Mo,ou,ga,v,"Throttled",-0,0),b);break e}I2(m,f,Sr,Ed,Gy,l,Dr,Mo,ou,ga,v,null,-0,0)}}break}while(!0);$i(o)}function I2(o,l,f,m,b,v,A,D,U,ie,ce,me,se,oe){if(o.timeoutHandle=-1,me=l.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$r},E2(l,v,me);var Me=(v&62914560)===v?Cd-Be():(v&4194048)===v?M2-Be():0;if(Me=Qz(me,Me),Me!==null){Ts=v,o.cancelPendingCommit=Me(j2.bind(null,o,l,v,f,m,b,A,D,U,ce,me,null,se,oe)),Sa(o,v,A,!ie);return}}j2(o,l,v,f,m,b,A,D,U)}function dz(o){for(var l=o;;){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 m=0;m<f.length;m++){var b=f[m],v=b.getSnapshot;b=b.value;try{if(!Nr(v(),b))return!1}catch{return!1}}if(f=l.child,l.subtreeFlags&16384&&f!==null)f.return=l,l=f;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Sa(o,l,f,m){l&=~Ky,l&=~Mo,o.suspendedLanes|=l,o.pingedLanes&=~l,m&&(o.warmLanes|=l),m=o.expirationTimes;for(var b=l;0<b;){var v=31-wt(b),A=1<<v;m[v]=-1,b&=~A}f!==0&&bi(o,f,l)}function Ad(){return(xt&6)===0?(Wc(0),!1):!0}function Qy(){if(it!==null){if(Et===0)var o=it.return;else o=it,ys=So=null,dy(o),Zl=null,Dc=0,o=it;for(;o!==null;)c2(o.alternate,o),o=o.return;it=null}}function uu(o,l){var f=o.timeoutHandle;f!==-1&&(o.timeoutHandle=-1,_z(f)),f=o.cancelPendingCommit,f!==null&&(o.cancelPendingCommit=null,f()),Ts=0,Qy(),Rt=o,it=f=ms(o.current,null),at=l,Et=0,Rr=null,ga=!1,au=jr(o,l),qy=!1,ou=Dr=Ky=Mo=ya=Jt=0,Sr=Gc=null,Gy=!1,(l&8)!==0&&(l|=l&32);var m=o.entangledLanes;if(m!==0)for(o=o.entanglements,m&=l;0<m;){var b=31-wt(m),v=1<<b;l|=o[b],m&=~v}return Ns=l,Kp(),f}function _2(o,l){Ze=null,X.H=Pc,l===Ql||l===td?(l=WC(),Et=3):l===ny?(l=WC(),Et=4):Et=l===Oy?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Rr=l,it===null&&(Jt=1,md(o,qr(l,o.current)))}function z2(){var o=Mr.current;return o===null?!0:(at&4194048)===at?Wr===null:(at&62914560)===at||(at&536870912)!==0?o===Wr:!1}function L2(){var o=X.H;return X.H=Pc,o===null?Pc:o}function B2(){var o=X.A;return X.A=hz,o}function Nd(){Jt=4,ga||(at&4194048)!==at&&Mr.current!==null||(au=!0),(ya&134217727)===0&&(Mo&134217727)===0||Rt===null||Sa(Rt,at,Dr,!1)}function Zy(o,l,f){var m=xt;xt|=2;var b=L2(),v=B2();(Rt!==o||at!==l)&&(Ed=null,uu(o,l)),l=!1;var A=Jt;e:do try{if(Et!==0&&it!==null){var D=it,U=Rr;switch(Et){case 8:Qy(),A=6;break e;case 3:case 2:case 9:case 6:Mr.current===null&&(l=!0);var ie=Et;if(Et=0,Rr=null,cu(o,D,U,ie),f&&au){A=0;break e}break;default:ie=Et,Et=0,Rr=null,cu(o,D,U,ie)}}mz(),A=Jt;break}catch(ce){_2(o,ce)}while(!0);return l&&o.shellSuspendCounter++,ys=So=null,xt=m,X.H=b,X.A=v,it===null&&(Rt=null,at=0,Kp()),A}function mz(){for(;it!==null;)F2(it)}function gz(o,l){var f=xt;xt|=2;var m=L2(),b=B2();Rt!==o||at!==l?(Ed=null,wd=Be()+500,uu(o,l)):au=jr(o,l);e:do try{if(Et!==0&&it!==null){l=it;var v=Rr;t:switch(Et){case 1:Et=0,Rr=null,cu(o,l,v,1);break;case 2:case 9:if(GC(v)){Et=0,Rr=null,V2(l);break}l=function(){Et!==2&&Et!==9||Rt!==o||(Et=7),$i(o)},v.then(l,l);break e;case 3:Et=7;break e;case 4:Et=5;break e;case 7:GC(v)?(Et=0,Rr=null,V2(l)):(Et=0,Rr=null,cu(o,l,v,7));break;case 5:var A=null;switch(it.tag){case 26:A=it.memoizedState;case 5:case 27:var D=it;if(A?wE(A):D.stateNode.complete){Et=0,Rr=null;var U=D.sibling;if(U!==null)it=U;else{var ie=D.return;ie!==null?(it=ie,Td(ie)):it=null}break t}}Et=0,Rr=null,cu(o,l,v,5);break;case 6:Et=0,Rr=null,cu(o,l,v,6);break;case 8:Qy(),Jt=6;break e;default:throw Error(r(462))}}yz();break}catch(ce){_2(o,ce)}while(!0);return ys=So=null,X.H=m,X.A=b,xt=f,it!==null?0:(Rt=null,at=0,Kp(),Jt)}function yz(){for(;it!==null&&!Dt();)F2(it)}function F2(o){var l=l2(o.alternate,o,Ns);o.memoizedProps=o.pendingProps,l===null?Td(o):it=l}function V2(o){var l=o,f=l.alternate;switch(l.tag){case 15:case 0:l=n2(f,l,l.pendingProps,l.type,void 0,at);break;case 11:l=n2(f,l,l.pendingProps,l.type.render,l.ref,at);break;case 5:dy(l);default:c2(f,l),l=it=BC(l,Ns),l=l2(f,l,Ns)}o.memoizedProps=o.pendingProps,l===null?Td(o):it=l}function cu(o,l,f,m){ys=So=null,dy(l),Zl=null,Dc=0;var b=l.return;try{if(sz(o,b,l,f,at)){Jt=1,md(o,qr(f,o.current)),it=null;return}}catch(v){if(b!==null)throw it=b,v;Jt=1,md(o,qr(f,o.current)),it=null;return}l.flags&32768?(ct||m===1?o=!0:au||(at&536870912)!==0?o=!1:(ga=o=!0,(m===2||m===9||m===3||m===6)&&(m=Mr.current,m!==null&&m.tag===13&&(m.flags|=16384))),P2(l,o)):Td(l)}function Td(o){var l=o;do{if((l.flags&32768)!==0){P2(l,ga);return}o=l.return;var f=lz(l.alternate,l,Ns);if(f!==null){it=f;return}if(l=l.sibling,l!==null){it=l;return}it=l=o}while(l!==null);Jt===0&&(Jt=5)}function P2(o,l){do{var f=uz(o.alternate,o);if(f!==null){f.flags&=32767,it=f;return}if(f=o.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!l&&(o=o.sibling,o!==null)){it=o;return}it=o=f}while(o!==null);Jt=6,it=null}function j2(o,l,f,m,b,v,A,D,U){o.cancelPendingCommit=null;do Md();while(rn!==0);if((xt&6)!==0)throw Error(r(327));if(l!==null){if(l===o.current)throw Error(r(177));if(v=l.lanes|l.childLanes,v|=j0,_l(o,f,v,A,D,U),o===Rt&&(it=Rt=null,at=0),lu=l,ba=o,Ts=f,Yy=v,Wy=b,O2=m,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,vz(I,function(){return q2(),null})):(o.callbackNode=null,o.callbackPriority=0),m=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||m){m=X.T,X.T=null,b=le.p,le.p=2,A=xt,xt|=4;try{cz(o,l,f)}finally{xt=A,le.p=b,X.T=m}}rn=1,$2(),J2(),U2()}}function $2(){if(rn===1){rn=0;var o=ba,l=lu,f=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||f){f=X.T,X.T=null;var m=le.p;le.p=2;var b=xt;xt|=4;try{k2(l,o);var v=fx,A=TC(o.containerInfo),D=v.focusedElem,U=v.selectionRange;if(A!==D&&D&&D.ownerDocument&&NC(D.ownerDocument.documentElement,D)){if(U!==null&&L0(D)){var ie=U.start,ce=U.end;if(ce===void 0&&(ce=ie),"selectionStart"in D)D.selectionStart=ie,D.selectionEnd=Math.min(ce,D.value.length);else{var me=D.ownerDocument||document,se=me&&me.defaultView||window;if(se.getSelection){var oe=se.getSelection(),Me=D.textContent.length,Ve=Math.min(U.start,Me),Mt=U.end===void 0?Ve:Math.min(U.end,Me);!oe.extend&&Ve>Mt&&(A=Mt,Mt=Ve,Ve=A);var Q=AC(D,Ve),G=AC(D,Mt);if(Q&&G&&(oe.rangeCount!==1||oe.anchorNode!==Q.node||oe.anchorOffset!==Q.offset||oe.focusNode!==G.node||oe.focusOffset!==G.offset)){var ne=me.createRange();ne.setStart(Q.node,Q.offset),oe.removeAllRanges(),Ve>Mt?(oe.addRange(ne),oe.extend(G.node,G.offset)):(ne.setEnd(G.node,G.offset),oe.addRange(ne))}}}}for(me=[],oe=D;oe=oe.parentNode;)oe.nodeType===1&&me.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;D<me.length;D++){var pe=me[D];pe.element.scrollLeft=pe.left,pe.element.scrollTop=pe.top}}jd=!!cx,fx=cx=null}finally{xt=b,le.p=m,X.T=f}}o.current=l,rn=2}}function J2(){if(rn===2){rn=0;var o=ba,l=lu,f=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||f){f=X.T,X.T=null;var m=le.p;le.p=2;var b=xt;xt|=4;try{y2(o,l.alternate,l)}finally{xt=b,le.p=m,X.T=f}}rn=3}}function U2(){if(rn===4||rn===3){rn=0,mt();var o=ba,l=lu,f=Ts,m=O2;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?rn=5:(rn=0,lu=ba=null,H2(o,o.pendingLanes));var b=o.pendingLanes;if(b===0&&(xa=null),zl(f),l=l.stateNode,jt&&typeof jt.onCommitFiberRoot=="function")try{jt.onCommitFiberRoot(ke,l,void 0,(l.current.flags&128)===128)}catch{}if(m!==null){l=X.T,b=le.p,le.p=2,X.T=null;try{for(var v=o.onRecoverableError,A=0;A<m.length;A++){var D=m[A];v(D.value,{componentStack:D.stack})}}finally{X.T=l,le.p=b}}(Ts&3)!==0&&Md(),$i(o),b=o.pendingLanes,(f&261930)!==0&&(b&42)!==0?o===Xy?Yc++:(Yc=0,Xy=o):Yc=0,Wc(0)}}function H2(o,l){(o.pooledCacheLanes&=l)===0&&(l=o.pooledCache,l!=null&&(o.pooledCache=null,Oc(l)))}function Md(){return $2(),J2(),U2(),q2()}function q2(){if(rn!==5)return!1;var o=ba,l=Yy;Yy=0;var f=zl(Ts),m=X.T,b=le.p;try{le.p=32>f?32:f,X.T=null,f=Wy,Wy=null;var v=ba,A=Ts;if(rn=0,lu=ba=null,Ts=0,(xt&6)!==0)throw Error(r(331));var D=xt;if(xt|=4,N2(v.current),w2(v,v.current,A,f),xt=D,Wc(0,!1),jt&&typeof jt.onPostCommitFiberRoot=="function")try{jt.onPostCommitFiberRoot(ke,v)}catch{}return!0}finally{le.p=b,X.T=m,H2(o,l)}}function K2(o,l,f){l=qr(f,l),l=My(o.stateNode,l,2),o=ha(o,l,2),o!==null&&(fo(o,2),$i(o))}function At(o,l,f){if(o.tag===3)K2(o,o,f);else for(;l!==null;){if(l.tag===3){K2(l,o,f);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(xa===null||!xa.has(m))){o=qr(f,o),f=Gw(2),m=ha(l,f,2),m!==null&&(Yw(f,m,l,o),fo(m,2),$i(m));break}}l=l.return}}function ex(o,l,f){var m=o.pingCache;if(m===null){m=o.pingCache=new pz;var b=new Set;m.set(l,b)}else b=m.get(l),b===void 0&&(b=new Set,m.set(l,b));b.has(f)||(qy=!0,b.add(f),o=xz.bind(null,o,l,f),l.then(o,o))}function xz(o,l,f){var m=o.pingCache;m!==null&&m.delete(l),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,Rt===o&&(at&f)===f&&(Jt===4||Jt===3&&(at&62914560)===at&&300>Be()-Cd?(xt&2)===0&&uu(o,0):Ky|=f,ou===at&&(ou=0)),$i(o)}function G2(o,l){l===0&&(l=hc()),o=yo(o,l),o!==null&&(fo(o,l),$i(o))}function bz(o){var l=o.memoizedState,f=0;l!==null&&(f=l.retryLane),G2(o,f)}function Sz(o,l){var f=0;switch(o.tag){case 31:case 13:var m=o.stateNode,b=o.memoizedState;b!==null&&(f=b.retryLane);break;case 19:m=o.stateNode;break;case 22:m=o.stateNode._retryCache;break;default:throw Error(r(314))}m!==null&&m.delete(l),G2(o,f)}function vz(o,l){return he(o,l)}var Od=null,fu=null,tx=!1,Rd=!1,nx=!1,va=0;function $i(o){o!==fu&&o.next===null&&(fu===null?Od=fu=o:fu=fu.next=o),Rd=!0,tx||(tx=!0,Cz())}function Wc(o,l){if(!nx&&Rd){nx=!0;do for(var f=!1,m=Od;m!==null;){if(o!==0){var b=m.pendingLanes;if(b===0)var v=0;else{var A=m.suspendedLanes,D=m.pingedLanes;v=(1<<31-wt(42|o)+1)-1,v&=b&~(A&~D),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(f=!0,Q2(m,v))}else v=at,v=St(m,m===Rt?v:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(v&3)===0||jr(m,v)||(f=!0,Q2(m,v));m=m.next}while(f);nx=!1}}function kz(){Y2()}function Y2(){Rd=tx=!1;var o=0;va!==0&&Iz()&&(o=va);for(var l=Be(),f=null,m=Od;m!==null;){var b=m.next,v=W2(m,l);v===0?(m.next=null,f===null?Od=b:f.next=b,b===null&&(fu=f)):(f=m,(o!==0||(v&3)!==0)&&(Rd=!0)),m=b}rn!==0&&rn!==5||Wc(o),va!==0&&(va=0)}function W2(o,l){for(var f=o.suspendedLanes,m=o.pingedLanes,b=o.expirationTimes,v=o.pendingLanes&-62914561;0<v;){var A=31-wt(v),D=1<<A,U=b[A];U===-1?((D&f)===0||(D&m)!==0)&&(b[A]=Ue(D,l)):U<=l&&(o.expiredLanes|=D),v&=~D}if(l=Rt,f=at,f=St(o,o===l?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),m=o.callbackNode,f===0||o===l&&(Et===2||Et===9)||o.cancelPendingCommit!==null)return m!==null&&m!==null&&je(m),o.callbackNode=null,o.callbackPriority=0;if((f&3)===0||jr(o,f)){if(l=f&-f,l===o.callbackPriority)return l;switch(m!==null&&je(m),zl(f)){case 2:case 8:f=ge;break;case 32:f=I;break;case 268435456:f=Je;break;default:f=I}return m=X2.bind(null,o),f=he(f,m),o.callbackPriority=l,o.callbackNode=f,l}return m!==null&&m!==null&&je(m),o.callbackPriority=2,o.callbackNode=null,2}function X2(o,l){if(rn!==0&&rn!==5)return o.callbackNode=null,o.callbackPriority=0,null;var f=o.callbackNode;if(Md()&&o.callbackNode!==f)return null;var m=at;return m=St(o,o===Rt?m:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),m===0?null:(D2(o,m,l),W2(o,Be()),o.callbackNode!=null&&o.callbackNode===f?X2.bind(null,o):null)}function Q2(o,l){if(Md())return null;D2(o,l,!0)}function Cz(){zz(function(){(xt&6)!==0?he(fe,kz):Y2()})}function rx(){if(va===0){var o=Wl;o===0&&(o=Il,Il<<=1,(Il&261888)===0&&(Il=256)),va=o}return va}function Z2(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:po(""+o)}function eE(o,l){var f=l.ownerDocument.createElement("input");return f.name=l.name,f.value=l.value,o.id&&f.setAttribute("form",o.id),l.parentNode.insertBefore(f,l),o=new FormData(o),f.parentNode.removeChild(f),o}function wz(o,l,f,m,b){if(l==="submit"&&f&&f.stateNode===b){var v=Z2((b[xn]||null).action),A=m.submitter;A&&(l=(l=A[xn]||null)?Z2(l.formAction):A.getAttribute("formAction"),l!==null&&(v=l,A=null));var D=new wi("action","action",null,m,b);o.push({event:D,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(va!==0){var U=A?eE(b,A):new FormData(b);Cy(f,{pending:!0,data:U,method:b.method,action:v},null,U)}}else typeof v=="function"&&(D.preventDefault(),U=A?eE(b,A):new FormData(b),Cy(f,{pending:!0,data:U,method:b.method,action:v},v,U))},currentTarget:b}]})}}for(var ix=0;ix<P0.length;ix++){var sx=P0[ix],Ez=sx.toLowerCase(),Az=sx[0].toUpperCase()+sx.slice(1);Ei(Ez,"on"+Az)}Ei(RC,"onAnimationEnd"),Ei(DC,"onAnimationIteration"),Ei(IC,"onAnimationStart"),Ei("dblclick","onDoubleClick"),Ei("focusin","onFocus"),Ei("focusout","onBlur"),Ei($4,"onTransitionRun"),Ei(J4,"onTransitionStart"),Ei(U4,"onTransitionCancel"),Ei(_C,"onTransitionEnd"),Fi("onMouseEnter",["mouseout","mouseover"]),Fi("onMouseLeave",["mouseout","mouseover"]),Fi("onPointerEnter",["pointerout","pointerover"]),Fi("onPointerLeave",["pointerout","pointerover"]),ds("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ds("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ds("onBeforeInput",["compositionend","keypress","textInput","paste"]),ds("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ds("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ds("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xc="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(" "),Nz=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xc));function tE(o,l){l=(l&4)!==0;for(var f=0;f<o.length;f++){var m=o[f],b=m.event;m=m.listeners;e:{var v=void 0;if(l)for(var A=m.length-1;0<=A;A--){var D=m[A],U=D.instance,ie=D.currentTarget;if(D=D.listener,U!==v&&b.isPropagationStopped())break e;v=D,b.currentTarget=ie;try{v(b)}catch(ce){qp(ce)}b.currentTarget=null,v=U}else for(A=0;A<m.length;A++){if(D=m[A],U=D.instance,ie=D.currentTarget,D=D.listener,U!==v&&b.isPropagationStopped())break e;v=D,b.currentTarget=ie;try{v(b)}catch(ce){qp(ce)}b.currentTarget=null,v=U}}}}function st(o,l){var f=l[dc];f===void 0&&(f=l[dc]=new Set);var m=o+"__bubble";f.has(m)||(nE(l,o,2,!1),f.add(m))}function ax(o,l,f){var m=0;l&&(m|=4),nE(f,o,m,l)}var Dd="_reactListening"+Math.random().toString(36).slice(2);function ox(o){if(!o[Dd]){o[Dd]=!0,Lp.forEach(function(f){f!=="selectionchange"&&(Nz.has(f)||ax(f,!1,o),ax(f,!0,o))});var l=o.nodeType===9?o:o.ownerDocument;l===null||l[Dd]||(l[Dd]=!0,ax("selectionchange",!1,l))}}function nE(o,l,f,m){switch(RE(l)){case 2:var b=tL;break;case 8:b=nL;break;default:b=kx}f=b.bind(null,l,f,o),b=void 0,!Z||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(b=!0),m?b!==void 0?o.addEventListener(l,f,{capture:!0,passive:b}):o.addEventListener(l,f,!0):b!==void 0?o.addEventListener(l,f,{passive:b}):o.addEventListener(l,f,!1)}function lx(o,l,f,m,b){var v=m;if((l&1)===0&&(l&2)===0&&m!==null)e:for(;;){if(m===null)return;var A=m.tag;if(A===3||A===4){var D=m.stateNode.containerInfo;if(D===b)break;if(A===4)for(A=m.return;A!==null;){var U=A.tag;if((U===3||U===4)&&A.stateNode.containerInfo===b)return;A=A.return}for(;D!==null;){if(A=fs(D),A===null)return;if(U=A.tag,U===5||U===6||U===26||U===27){m=v=A;continue e}D=D.parentNode}}m=m.return}E(function(){var ie=v,ce=vc(f),me=[];e:{var se=zC.get(o);if(se!==void 0){var oe=wi,Me=o;switch(o){case"keypress":if(vt(f)===0)break e;case"keydown":case"keyup":oe=S4;break;case"focusin":Me="focus",oe=R0;break;case"focusout":Me="blur",oe=R0;break;case"beforeblur":case"afterblur":oe=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":oe=cC;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=l4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=C4;break;case RC:case DC:case IC:oe=f4;break;case _C:oe=E4;break;case"scroll":case"scrollend":oe=a4;break;case"wheel":oe=N4;break;case"copy":case"cut":case"paste":oe=p4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=hC;break;case"toggle":case"beforetoggle":oe=M4}var Ve=(l&4)!==0,Mt=!Ve&&(o==="scroll"||o==="scrollend"),Q=Ve?se!==null?se+"Capture":null:se;Ve=[];for(var G=ie,ne;G!==null;){var pe=G;if(ne=pe.stateNode,pe=pe.tag,pe!==5&&pe!==26&&pe!==27||ne===null||Q===null||(pe=M(G,Q),pe!=null&&Ve.push(Qc(G,pe,ne))),Mt)break;G=G.return}0<Ve.length&&(se=new oe(se,Me,null,f,ce),me.push({event:se,listeners:Ve}))}}if((l&7)===0){e:{if(se=o==="mouseover"||o==="pointerover",oe=o==="mouseout"||o==="pointerout",se&&f!==Pl&&(Me=f.relatedTarget||f.fromElement)&&(fs(Me)||Me[cs]))break e;if((oe||se)&&(se=ce.window===ce?ce:(se=ce.ownerDocument)?se.defaultView||se.parentWindow:window,oe?(Me=f.relatedTarget||f.toElement,oe=ie,Me=Me?fs(Me):null,Me!==null&&(Mt=s(Me),Ve=Me.tag,Me!==Mt||Ve!==5&&Ve!==27&&Ve!==6)&&(Me=null)):(oe=null,Me=ie),oe!==Me)){if(Ve=cC,pe="onMouseLeave",Q="onMouseEnter",G="mouse",(o==="pointerout"||o==="pointerover")&&(Ve=hC,pe="onPointerLeave",Q="onPointerEnter",G="pointer"),Mt=oe==null?se:ea(oe),ne=Me==null?se:ea(Me),se=new Ve(pe,G+"leave",oe,f,ce),se.target=Mt,se.relatedTarget=ne,pe=null,fs(ce)===ie&&(Ve=new Ve(Q,G+"enter",Me,f,ce),Ve.target=ne,Ve.relatedTarget=Mt,pe=Ve),Mt=pe,oe&&Me)t:{for(Ve=Tz,Q=oe,G=Me,ne=0,pe=Q;pe;pe=Ve(pe))ne++;pe=0;for(var Le=G;Le;Le=Ve(Le))pe++;for(;0<ne-pe;)Q=Ve(Q),ne--;for(;0<pe-ne;)G=Ve(G),pe--;for(;ne--;){if(Q===G||G!==null&&Q===G.alternate){Ve=Q;break t}Q=Ve(Q),G=Ve(G)}Ve=null}else Ve=null;oe!==null&&rE(me,se,oe,Ve,!1),Me!==null&&Mt!==null&&rE(me,Mt,Me,Ve,!0)}}e:{if(se=ie?ea(ie):window,oe=se.nodeName&&se.nodeName.toLowerCase(),oe==="select"||oe==="input"&&se.type==="file")var gt=SC;else if(xC(se))if(vC)gt=V4;else{gt=B4;var Ie=L4}else oe=se.nodeName,!oe||oe.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ie&&na(ie.elementType)&&(gt=SC):gt=F4;if(gt&&(gt=gt(o,ie))){bC(me,gt,f,ce);break e}Ie&&Ie(o,se,ie),o==="focusout"&&ie&&se.type==="number"&&ie.memoizedProps.value!=null&&xc(se,"number",se.value)}switch(Ie=ie?ea(ie):window,o){case"focusin":(xC(Ie)||Ie.contentEditable==="true")&&($l=Ie,B0=ie,Nc=null);break;case"focusout":Nc=B0=$l=null;break;case"mousedown":F0=!0;break;case"contextmenu":case"mouseup":case"dragend":F0=!1,MC(me,f,ce);break;case"selectionchange":if(j4)break;case"keydown":case"keyup":MC(me,f,ce)}var et;if(I0)e:{switch(o){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else jl?gC(o,f)&&(ot="onCompositionEnd"):o==="keydown"&&f.keyCode===229&&(ot="onCompositionStart");ot&&(pC&&f.locale!=="ko"&&(jl||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&jl&&(et=Qe()):(ye=ce,ve="value"in ye?ye.value:ye.textContent,jl=!0)),Ie=Id(ie,ot),0<Ie.length&&(ot=new fC(ot,o,null,f,ce),me.push({event:ot,listeners:Ie}),et?ot.data=et:(et=yC(f),et!==null&&(ot.data=et)))),(et=R4?D4(o,f):I4(o,f))&&(ot=Id(ie,"onBeforeInput"),0<ot.length&&(Ie=new fC("onBeforeInput","beforeinput",null,f,ce),me.push({event:Ie,listeners:ot}),Ie.data=et)),wz(me,o,ie,f,ce)}tE(me,l)})}function Qc(o,l,f){return{instance:o,listener:l,currentTarget:f}}function Id(o,l){for(var f=l+"Capture",m=[];o!==null;){var b=o,v=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||v===null||(b=M(o,f),b!=null&&m.unshift(Qc(o,b,v)),b=M(o,l),b!=null&&m.push(Qc(o,b,v))),o.tag===3)return m;o=o.return}return[]}function Tz(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function rE(o,l,f,m,b){for(var v=l._reactName,A=[];f!==null&&f!==m;){var D=f,U=D.alternate,ie=D.stateNode;if(D=D.tag,U!==null&&U===m)break;D!==5&&D!==26&&D!==27||ie===null||(U=ie,b?(ie=M(f,v),ie!=null&&A.unshift(Qc(f,ie,U))):b||(ie=M(f,v),ie!=null&&A.push(Qc(f,ie,U)))),f=f.return}A.length!==0&&o.push({event:l,listeners:A})}var Mz=/\r\n?/g,Oz=/\u0000|\uFFFD/g;function iE(o){return(typeof o=="string"?o:""+o).replace(Mz,`
100
+ `).replace(Oz,"")}function sE(o,l){return l=iE(l),iE(o)===l}function Tt(o,l,f,m,b,v){switch(f){case"children":typeof m=="string"?l==="body"||l==="textarea"&&m===""||Ci(o,m):(typeof m=="number"||typeof m=="bigint")&&l!=="body"&&Ci(o,""+m);break;case"className":Fl(o,"class",m);break;case"tabIndex":Fl(o,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Fl(o,f,m);break;case"style":Sc(o,m,v);break;case"data":if(l!=="object"){Fl(o,"data",m);break}case"src":case"href":if(m===""&&(l!=="a"||f!=="href")){o.removeAttribute(f);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){o.removeAttribute(f);break}m=po(""+m),o.setAttribute(f,m);break;case"action":case"formAction":if(typeof m=="function"){o.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 v=="function"&&(f==="formAction"?(l!=="input"&&Tt(o,l,"name",b.name,b,null),Tt(o,l,"formEncType",b.formEncType,b,null),Tt(o,l,"formMethod",b.formMethod,b,null),Tt(o,l,"formTarget",b.formTarget,b,null)):(Tt(o,l,"encType",b.encType,b,null),Tt(o,l,"method",b.method,b,null),Tt(o,l,"target",b.target,b,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){o.removeAttribute(f);break}m=po(""+m),o.setAttribute(f,m);break;case"onClick":m!=null&&(o.onclick=$r);break;case"onScroll":m!=null&&st("scroll",o);break;case"onScrollEnd":m!=null&&st("scrollend",o);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(f=m.__html,f!=null){if(b.children!=null)throw Error(r(60));o.innerHTML=f}}break;case"multiple":o.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":o.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){o.removeAttribute("xlink:href");break}f=po(""+m),o.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":m!=null&&typeof m!="function"&&typeof m!="symbol"?o.setAttribute(f,""+m):o.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":m&&typeof m!="function"&&typeof m!="symbol"?o.setAttribute(f,""):o.removeAttribute(f);break;case"capture":case"download":m===!0?o.setAttribute(f,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?o.setAttribute(f,m):o.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?o.setAttribute(f,m):o.removeAttribute(f);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?o.removeAttribute(f):o.setAttribute(f,m);break;case"popover":st("beforetoggle",o),st("toggle",o),Hn(o,"popover",m);break;case"xlinkActuate":vi(o,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":vi(o,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":vi(o,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":vi(o,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":vi(o,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":vi(o,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":vi(o,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":vi(o,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":vi(o,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Hn(o,"is",m);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=nt.get(f)||f,Hn(o,f,m))}}function ux(o,l,f,m,b,v){switch(f){case"style":Sc(o,m,v);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(r(61));if(f=m.__html,f!=null){if(b.children!=null)throw Error(r(60));o.innerHTML=f}}break;case"children":typeof m=="string"?Ci(o,m):(typeof m=="number"||typeof m=="bigint")&&Ci(o,""+m);break;case"onScroll":m!=null&&st("scroll",o);break;case"onScrollEnd":m!=null&&st("scrollend",o);break;case"onClick":m!=null&&(o.onclick=$r);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!mc.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(b=f.endsWith("Capture"),l=f.slice(2,b?f.length-7:void 0),v=o[xn]||null,v=v!=null?v[f]:null,typeof v=="function"&&o.removeEventListener(l,v,b),typeof m=="function")){typeof v!="function"&&v!==null&&(f in o?o[f]=null:o.hasAttribute(f)&&o.removeAttribute(f)),o.addEventListener(l,m,b);break e}f in o?o[f]=m:m===!0?o.setAttribute(f,""):Hn(o,f,m)}}}function kn(o,l,f){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",o),st("load",o);var m=!1,b=!1,v;for(v in f)if(f.hasOwnProperty(v)){var A=f[v];if(A!=null)switch(v){case"src":m=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Tt(o,l,v,A,f,null)}}b&&Tt(o,l,"srcSet",f.srcSet,f,null),m&&Tt(o,l,"src",f.src,f,null);return;case"input":st("invalid",o);var D=v=A=b=null,U=null,ie=null;for(m in f)if(f.hasOwnProperty(m)){var ce=f[m];if(ce!=null)switch(m){case"name":b=ce;break;case"type":A=ce;break;case"checked":U=ce;break;case"defaultChecked":ie=ce;break;case"value":v=ce;break;case"defaultValue":D=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(r(137,l));break;default:Tt(o,l,m,ce,f,null)}}yc(o,v,D,U,ie,A,b,!1);return;case"select":st("invalid",o),m=A=v=null;for(b in f)if(f.hasOwnProperty(b)&&(D=f[b],D!=null))switch(b){case"value":v=D;break;case"defaultValue":A=D;break;case"multiple":m=D;default:Tt(o,l,b,D,f,null)}l=v,f=A,o.multiple=!!m,l!=null?ta(o,!!m,l,!1):f!=null&&ta(o,!!m,f,!0);return;case"textarea":st("invalid",o),v=b=m=null;for(A in f)if(f.hasOwnProperty(A)&&(D=f[A],D!=null))switch(A){case"value":m=D;break;case"defaultValue":b=D;break;case"children":v=D;break;case"dangerouslySetInnerHTML":if(D!=null)throw Error(r(91));break;default:Tt(o,l,A,D,f,null)}$p(o,m,b,v);return;case"option":for(U in f)f.hasOwnProperty(U)&&(m=f[U],m!=null)&&(U==="selected"?o.selected=m&&typeof m!="function"&&typeof m!="symbol":Tt(o,l,U,m,f,null));return;case"dialog":st("beforetoggle",o),st("toggle",o),st("cancel",o),st("close",o);break;case"iframe":case"object":st("load",o);break;case"video":case"audio":for(m=0;m<Xc.length;m++)st(Xc[m],o);break;case"image":st("error",o),st("load",o);break;case"details":st("toggle",o);break;case"embed":case"source":case"link":st("error",o),st("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in f)if(f.hasOwnProperty(ie)&&(m=f[ie],m!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Tt(o,l,ie,m,f,null)}return;default:if(na(l)){for(ce in f)f.hasOwnProperty(ce)&&(m=f[ce],m!==void 0&&ux(o,l,ce,m,f,void 0));return}}for(D in f)f.hasOwnProperty(D)&&(m=f[D],m!=null&&Tt(o,l,D,m,f,null))}function Rz(o,l,f,m){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,v=null,A=null,D=null,U=null,ie=null,ce=null;for(oe in f){var me=f[oe];if(f.hasOwnProperty(oe)&&me!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":U=me;default:m.hasOwnProperty(oe)||Tt(o,l,oe,null,m,me)}}for(var se in m){var oe=m[se];if(me=f[se],m.hasOwnProperty(se)&&(oe!=null||me!=null))switch(se){case"type":v=oe;break;case"name":b=oe;break;case"checked":ie=oe;break;case"defaultChecked":ce=oe;break;case"value":A=oe;break;case"defaultValue":D=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(r(137,l));break;default:oe!==me&&Tt(o,l,se,oe,m,me)}}gc(o,A,D,U,ie,ce,v,b);return;case"select":oe=A=D=se=null;for(v in f)if(U=f[v],f.hasOwnProperty(v)&&U!=null)switch(v){case"value":break;case"multiple":oe=U;default:m.hasOwnProperty(v)||Tt(o,l,v,null,m,U)}for(b in m)if(v=m[b],U=f[b],m.hasOwnProperty(b)&&(v!=null||U!=null))switch(b){case"value":se=v;break;case"defaultValue":D=v;break;case"multiple":A=v;default:v!==U&&Tt(o,l,b,v,m,U)}l=D,f=A,m=oe,se!=null?ta(o,!!f,se,!1):!!m!=!!f&&(l!=null?ta(o,!!f,l,!0):ta(o,!!f,f?[]:"",!1));return;case"textarea":oe=se=null;for(D in f)if(b=f[D],f.hasOwnProperty(D)&&b!=null&&!m.hasOwnProperty(D))switch(D){case"value":break;case"children":break;default:Tt(o,l,D,null,m,b)}for(A in m)if(b=m[A],v=f[A],m.hasOwnProperty(A)&&(b!=null||v!=null))switch(A){case"value":se=b;break;case"defaultValue":oe=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:b!==v&&Tt(o,l,A,b,m,v)}jp(o,se,oe);return;case"option":for(var Me in f)se=f[Me],f.hasOwnProperty(Me)&&se!=null&&!m.hasOwnProperty(Me)&&(Me==="selected"?o.selected=!1:Tt(o,l,Me,null,m,se));for(U in m)se=m[U],oe=f[U],m.hasOwnProperty(U)&&se!==oe&&(se!=null||oe!=null)&&(U==="selected"?o.selected=se&&typeof se!="function"&&typeof se!="symbol":Tt(o,l,U,se,m,oe));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 Ve in f)se=f[Ve],f.hasOwnProperty(Ve)&&se!=null&&!m.hasOwnProperty(Ve)&&Tt(o,l,Ve,null,m,se);for(ie in m)if(se=m[ie],oe=f[ie],m.hasOwnProperty(ie)&&se!==oe&&(se!=null||oe!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,l));break;default:Tt(o,l,ie,se,m,oe)}return;default:if(na(l)){for(var Mt in f)se=f[Mt],f.hasOwnProperty(Mt)&&se!==void 0&&!m.hasOwnProperty(Mt)&&ux(o,l,Mt,void 0,m,se);for(ce in m)se=m[ce],oe=f[ce],!m.hasOwnProperty(ce)||se===oe||se===void 0&&oe===void 0||ux(o,l,ce,se,m,oe);return}}for(var Q in f)se=f[Q],f.hasOwnProperty(Q)&&se!=null&&!m.hasOwnProperty(Q)&&Tt(o,l,Q,null,m,se);for(me in m)se=m[me],oe=f[me],!m.hasOwnProperty(me)||se===oe||se==null&&oe==null||Tt(o,l,me,se,m,oe)}function aE(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Dz(){if(typeof performance.getEntriesByType=="function"){for(var o=0,l=0,f=performance.getEntriesByType("resource"),m=0;m<f.length;m++){var b=f[m],v=b.transferSize,A=b.initiatorType,D=b.duration;if(v&&D&&aE(A)){for(A=0,D=b.responseEnd,m+=1;m<f.length;m++){var U=f[m],ie=U.startTime;if(ie>D)break;var ce=U.transferSize,me=U.initiatorType;ce&&aE(me)&&(U=U.responseEnd,A+=ce*(U<D?1:(D-ie)/(U-ie)))}if(--m,l+=8*(v+A)/(b.duration/1e3),o++,10<o)break}}if(0<o)return l/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var cx=null,fx=null;function _d(o){return o.nodeType===9?o:o.ownerDocument}function oE(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lE(o,l){if(o===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&l==="foreignObject"?0:o}function hx(o,l){return o==="textarea"||o==="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 px=null;function Iz(){var o=window.event;return o&&o.type==="popstate"?o===px?!1:(px=o,!0):(px=null,!1)}var uE=typeof setTimeout=="function"?setTimeout:void 0,_z=typeof clearTimeout=="function"?clearTimeout:void 0,cE=typeof Promise=="function"?Promise:void 0,zz=typeof queueMicrotask=="function"?queueMicrotask:typeof cE<"u"?function(o){return cE.resolve(null).then(o).catch(Lz)}:uE;function Lz(o){setTimeout(function(){throw o})}function ka(o){return o==="head"}function fE(o,l){var f=l,m=0;do{var b=f.nextSibling;if(o.removeChild(f),b&&b.nodeType===8)if(f=b.data,f==="/$"||f==="/&"){if(m===0){o.removeChild(b),mu(l);return}m--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")m++;else if(f==="html")Zc(o.ownerDocument.documentElement);else if(f==="head"){f=o.ownerDocument.head,Zc(f);for(var v=f.firstChild;v;){var A=v.nextSibling,D=v.nodeName;v[Zs]||D==="SCRIPT"||D==="STYLE"||D==="LINK"&&v.rel.toLowerCase()==="stylesheet"||f.removeChild(v),v=A}}else f==="body"&&Zc(o.ownerDocument.body);f=b}while(f);mu(l)}function hE(o,l){var f=o;o=0;do{var m=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||""),m&&m.nodeType===8)if(f=m.data,f==="/$"){if(o===0)break;o--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||o++;f=m}while(f)}function dx(o){var l=o.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":dx(f),Ll(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}o.removeChild(f)}}function Bz(o,l,f,m){for(;o.nodeType===1;){var b=f;if(o.nodeName.toLowerCase()!==l.toLowerCase()){if(!m&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(m){if(!o[Zs])switch(l){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(v=o.getAttribute("rel"),v==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(v!==b.rel||o.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||o.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||o.getAttribute("title")!==(b.title==null?null:b.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(v=o.getAttribute("src"),(v!==(b.src==null?null:b.src)||o.getAttribute("type")!==(b.type==null?null:b.type)||o.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&v&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(l==="input"&&o.type==="hidden"){var v=b.name==null?null:""+b.name;if(b.type==="hidden"&&o.getAttribute("name")===v)return o}else return o;if(o=Xr(o.nextSibling),o===null)break}return null}function Fz(o,l,f){if(l==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!f||(o=Xr(o.nextSibling),o===null))return null;return o}function pE(o,l){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!l||(o=Xr(o.nextSibling),o===null))return null;return o}function mx(o){return o.data==="$?"||o.data==="$~"}function gx(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function Vz(o,l){var f=o.ownerDocument;if(o.data==="$~")o._reactRetry=l;else if(o.data!=="$?"||f.readyState!=="loading")l();else{var m=function(){l(),f.removeEventListener("DOMContentLoaded",m)};f.addEventListener("DOMContentLoaded",m),o._reactRetry=m}}function Xr(o){for(;o!=null;o=o.nextSibling){var l=o.nodeType;if(l===1||l===3)break;if(l===8){if(l=o.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return o}var yx=null;function dE(o){o=o.nextSibling;for(var l=0;o;){if(o.nodeType===8){var f=o.data;if(f==="/$"||f==="/&"){if(l===0)return Xr(o.nextSibling);l--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||l++}o=o.nextSibling}return null}function mE(o){o=o.previousSibling;for(var l=0;o;){if(o.nodeType===8){var f=o.data;if(f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"){if(l===0)return o;l--}else f!=="/$"&&f!=="/&"||l++}o=o.previousSibling}return null}function gE(o,l,f){switch(l=_d(f),o){case"html":if(o=l.documentElement,!o)throw Error(r(452));return o;case"head":if(o=l.head,!o)throw Error(r(453));return o;case"body":if(o=l.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function Zc(o){for(var l=o.attributes;l.length;)o.removeAttributeNode(l[0]);Ll(o)}var Qr=new Map,yE=new Set;function zd(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Ms=le.d;le.d={f:Pz,r:jz,D:$z,C:Jz,L:Uz,m:Hz,X:Kz,S:qz,M:Gz};function Pz(){var o=Ms.f(),l=Ad();return o||l}function jz(o){var l=hs(o);l!==null&&l.tag===5&&l.type==="form"?_w(l):Ms.r(o)}var hu=typeof document>"u"?null:document;function xE(o,l,f){var m=hu;if(m&&typeof l=="string"&&l){var b=It(l);b='link[rel="'+o+'"][href="'+b+'"]',typeof f=="string"&&(b+='[crossorigin="'+f+'"]'),yE.has(b)||(yE.add(b),o={rel:o,crossOrigin:f,href:l},m.querySelector(b)===null&&(l=m.createElement("link"),kn(l,"link",o),Xt(l),m.head.appendChild(l)))}}function $z(o){Ms.D(o),xE("dns-prefetch",o,null)}function Jz(o,l){Ms.C(o,l),xE("preconnect",o,l)}function Uz(o,l,f){Ms.L(o,l,f);var m=hu;if(m&&o&&l){var b='link[rel="preload"][as="'+It(l)+'"]';l==="image"&&f&&f.imageSrcSet?(b+='[imagesrcset="'+It(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(b+='[imagesizes="'+It(f.imageSizes)+'"]')):b+='[href="'+It(o)+'"]';var v=b;switch(l){case"style":v=pu(o);break;case"script":v=du(o)}Qr.has(v)||(o=g({rel:"preload",href:l==="image"&&f&&f.imageSrcSet?void 0:o,as:l},f),Qr.set(v,o),m.querySelector(b)!==null||l==="style"&&m.querySelector(ef(v))||l==="script"&&m.querySelector(tf(v))||(l=m.createElement("link"),kn(l,"link",o),Xt(l),m.head.appendChild(l)))}}function Hz(o,l){Ms.m(o,l);var f=hu;if(f&&o){var m=l&&typeof l.as=="string"?l.as:"script",b='link[rel="modulepreload"][as="'+It(m)+'"][href="'+It(o)+'"]',v=b;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=du(o)}if(!Qr.has(v)&&(o=g({rel:"modulepreload",href:o},l),Qr.set(v,o),f.querySelector(b)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(tf(v)))return}m=f.createElement("link"),kn(m,"link",o),Xt(m),f.head.appendChild(m)}}}function qz(o,l,f){Ms.S(o,l,f);var m=hu;if(m&&o){var b=ps(m).hoistableStyles,v=pu(o);l=l||"default";var A=b.get(v);if(!A){var D={loading:0,preload:null};if(A=m.querySelector(ef(v)))D.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":l},f),(f=Qr.get(v))&&xx(o,f);var U=A=m.createElement("link");Xt(U),kn(U,"link",o),U._p=new Promise(function(ie,ce){U.onload=ie,U.onerror=ce}),U.addEventListener("load",function(){D.loading|=1}),U.addEventListener("error",function(){D.loading|=2}),D.loading|=4,Ld(A,l,m)}A={type:"stylesheet",instance:A,count:1,state:D},b.set(v,A)}}}function Kz(o,l){Ms.X(o,l);var f=hu;if(f&&o){var m=ps(f).hoistableScripts,b=du(o),v=m.get(b);v||(v=f.querySelector(tf(b)),v||(o=g({src:o,async:!0},l),(l=Qr.get(b))&&bx(o,l),v=f.createElement("script"),Xt(v),kn(v,"link",o),f.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},m.set(b,v))}}function Gz(o,l){Ms.M(o,l);var f=hu;if(f&&o){var m=ps(f).hoistableScripts,b=du(o),v=m.get(b);v||(v=f.querySelector(tf(b)),v||(o=g({src:o,async:!0,type:"module"},l),(l=Qr.get(b))&&bx(o,l),v=f.createElement("script"),Xt(v),kn(v,"link",o),f.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},m.set(b,v))}}function bE(o,l,f,m){var b=(b=Ae.current)?zd(b):null;if(!b)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(l=pu(f.href),f=ps(b).hoistableStyles,m=f.get(l),m||(m={type:"style",instance:null,count:0,state:null},f.set(l,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=pu(f.href);var v=ps(b).hoistableStyles,A=v.get(o);if(A||(b=b.ownerDocument||b,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(o,A),(v=b.querySelector(ef(o)))&&!v._p&&(A.instance=v,A.state.loading=5),Qr.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},Qr.set(o,f),v||Yz(b,o,f,A.state))),l&&m===null)throw Error(r(528,""));return A}if(l&&m!==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=du(f),f=ps(b).hoistableScripts,m=f.get(l),m||(m={type:"script",instance:null,count:0,state:null},f.set(l,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function pu(o){return'href="'+It(o)+'"'}function ef(o){return'link[rel="stylesheet"]['+o+"]"}function SE(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function Yz(o,l,f,m){o.querySelector('link[rel="preload"][as="style"]['+l+"]")?m.loading=1:(l=o.createElement("link"),m.preload=l,l.addEventListener("load",function(){return m.loading|=1}),l.addEventListener("error",function(){return m.loading|=2}),kn(l,"link",f),Xt(l),o.head.appendChild(l))}function du(o){return'[src="'+It(o)+'"]'}function tf(o){return"script[async]"+o}function vE(o,l,f){if(l.count++,l.instance===null)switch(l.type){case"style":var m=o.querySelector('style[data-href~="'+It(f.href)+'"]');if(m)return l.instance=m,Xt(m),m;var b=g({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return m=(o.ownerDocument||o).createElement("style"),Xt(m),kn(m,"style",b),Ld(m,f.precedence,o),l.instance=m;case"stylesheet":b=pu(f.href);var v=o.querySelector(ef(b));if(v)return l.state.loading|=4,l.instance=v,Xt(v),v;m=SE(f),(b=Qr.get(b))&&xx(m,b),v=(o.ownerDocument||o).createElement("link"),Xt(v);var A=v;return A._p=new Promise(function(D,U){A.onload=D,A.onerror=U}),kn(v,"link",m),l.state.loading|=4,Ld(v,f.precedence,o),l.instance=v;case"script":return v=du(f.src),(b=o.querySelector(tf(v)))?(l.instance=b,Xt(b),b):(m=f,(b=Qr.get(v))&&(m=g({},f),bx(m,b)),o=o.ownerDocument||o,b=o.createElement("script"),Xt(b),kn(b,"link",m),o.head.appendChild(b),l.instance=b);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(m=l.instance,l.state.loading|=4,Ld(m,f.precedence,o));return l.instance}function Ld(o,l,f){for(var m=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=m.length?m[m.length-1]:null,v=b,A=0;A<m.length;A++){var D=m[A];if(D.dataset.precedence===l)v=D;else if(v!==b)break}v?v.parentNode.insertBefore(o,v.nextSibling):(l=f.nodeType===9?f.head:f,l.insertBefore(o,l.firstChild))}function xx(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.title==null&&(o.title=l.title)}function bx(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.integrity==null&&(o.integrity=l.integrity)}var Bd=null;function kE(o,l,f){if(Bd===null){var m=new Map,b=Bd=new Map;b.set(f,m)}else b=Bd,m=b.get(f),m||(m=new Map,b.set(f,m));if(m.has(o))return m;for(m.set(o,null),f=f.getElementsByTagName(o),b=0;b<f.length;b++){var v=f[b];if(!(v[Zs]||v[Wt]||o==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var A=v.getAttribute(l)||"";A=o+A;var D=m.get(A);D?D.push(v):m.set(A,[v])}}return m}function CE(o,l,f){o=o.ownerDocument||o,o.head.insertBefore(f,l==="title"?o.querySelector("head > title"):null)}function Wz(o,l,f){if(f===1||l.itemProp!=null)return!1;switch(o){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"?(o=l.disabled,typeof l.precedence=="string"&&o==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 wE(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function Xz(o,l,f,m){if(f.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var b=pu(m.href),v=l.querySelector(ef(b));if(v){l=v._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(o.count++,o=Fd.bind(o),l.then(o,o)),f.state.loading|=4,f.instance=v,Xt(v);return}v=l.ownerDocument||l,m=SE(m),(b=Qr.get(b))&&xx(m,b),v=v.createElement("link"),Xt(v);var A=v;A._p=new Promise(function(D,U){A.onload=D,A.onerror=U}),kn(v,"link",m),f.instance=v}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,l),(l=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Fd.bind(o),l.addEventListener("load",f),l.addEventListener("error",f))}}var Sx=0;function Qz(o,l){return o.stylesheets&&o.count===0&&Pd(o,o.stylesheets),0<o.count||0<o.imgCount?function(f){var m=setTimeout(function(){if(o.stylesheets&&Pd(o,o.stylesheets),o.unsuspend){var v=o.unsuspend;o.unsuspend=null,v()}},6e4+l);0<o.imgBytes&&Sx===0&&(Sx=62500*Dz());var b=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Pd(o,o.stylesheets),o.unsuspend)){var v=o.unsuspend;o.unsuspend=null,v()}},(o.imgBytes>Sx?50:800)+l);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(m),clearTimeout(b)}}:null}function Fd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Pd(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Vd=null;function Pd(o,l){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Vd=new Map,l.forEach(Zz,o),Vd=null,Fd.call(o))}function Zz(o,l){if(!(l.state.loading&4)){var f=Vd.get(o);if(f)var m=f.get(null);else{f=new Map,Vd.set(o,f);for(var b=o.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<b.length;v++){var A=b[v];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(f.set(A.dataset.precedence,A),m=A)}m&&f.set(null,m)}b=l.instance,A=b.getAttribute("data-precedence"),v=f.get(A)||m,v===m&&f.set(null,b),f.set(A,b),this.count++,m=Fd.bind(this),b.addEventListener("load",m),b.addEventListener("error",m),v?v.parentNode.insertBefore(b,v.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(b,o.firstChild)),l.state.loading|=4}}var nf={$$typeof:F,Provider:null,Consumer:null,_currentValue:Ce,_currentValue2:Ce,_threadCount:0};function eL(o,l,f,m,b,v,A,D,U){this.tag=1,this.containerInfo=o,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=co(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=co(0),this.hiddenUpdates=co(null),this.identifierPrefix=m,this.onUncaughtError=b,this.onCaughtError=v,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function EE(o,l,f,m,b,v,A,D,U,ie,ce,me){return o=new eL(o,l,f,A,U,ie,ce,me,D),l=1,v===!0&&(l|=24),v=Tr(3,null,null,l),o.current=v,v.stateNode=o,l=Z0(),l.refCount++,o.pooledCache=l,l.refCount++,v.memoizedState={element:m,isDehydrated:f,cache:l},ry(v),o}function AE(o){return o?(o=Hl,o):Hl}function NE(o,l,f,m,b,v){b=AE(b),m.context===null?m.context=b:m.pendingContext=b,m=fa(l),m.payload={element:f},v=v===void 0?null:v,v!==null&&(m.callback=v),f=ha(o,m,l),f!==null&&(vr(f,o,l),_c(f,o,l))}function TE(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var f=o.retryLane;o.retryLane=f!==0&&f<l?f:l}}function vx(o,l){TE(o,l),(o=o.alternate)&&TE(o,l)}function ME(o){if(o.tag===13||o.tag===31){var l=yo(o,67108864);l!==null&&vr(l,o,67108864),vx(o,67108864)}}function OE(o){if(o.tag===13||o.tag===31){var l=Ir();l=us(l);var f=yo(o,l);f!==null&&vr(f,o,l),vx(o,l)}}var jd=!0;function tL(o,l,f,m){var b=X.T;X.T=null;var v=le.p;try{le.p=2,kx(o,l,f,m)}finally{le.p=v,X.T=b}}function nL(o,l,f,m){var b=X.T;X.T=null;var v=le.p;try{le.p=8,kx(o,l,f,m)}finally{le.p=v,X.T=b}}function kx(o,l,f,m){if(jd){var b=Cx(m);if(b===null)lx(o,l,m,$d,f),DE(o,m);else if(iL(b,o,l,f,m))m.stopPropagation();else if(DE(o,m),l&4&&-1<rL.indexOf(o)){for(;b!==null;){var v=hs(b);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var A=Yt(v.pendingLanes);if(A!==0){var D=v;for(D.pendingLanes|=2,D.entangledLanes|=2;A;){var U=1<<31-wt(A);D.entanglements[1]|=U,A&=~U}$i(v),(xt&6)===0&&(wd=Be()+500,Wc(0))}}break;case 31:case 13:D=yo(v,2),D!==null&&vr(D,v,2),Ad(),vx(v,2)}if(v=Cx(m),v===null&&lx(o,l,m,$d,f),v===b)break;b=v}b!==null&&m.stopPropagation()}else lx(o,l,m,null,f)}}function Cx(o){return o=vc(o),wx(o)}var $d=null;function wx(o){if($d=null,o=fs(o),o!==null){var l=s(o);if(l===null)o=null;else{var f=l.tag;if(f===13){if(o=a(l),o!==null)return o;o=null}else if(f===31){if(o=u(l),o!==null)return o;o=null}else if(f===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;o=null}else l!==o&&(o=null)}}return $d=o,null}function RE(o){switch(o){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(gn()){case fe:return 2;case ge:return 8;case I:case ze:return 32;case Je:return 268435456;default:return 32}default:return 32}}var Ex=!1,Ca=null,wa=null,Ea=null,rf=new Map,sf=new Map,Aa=[],rL="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 DE(o,l){switch(o){case"focusin":case"focusout":Ca=null;break;case"dragenter":case"dragleave":wa=null;break;case"mouseover":case"mouseout":Ea=null;break;case"pointerover":case"pointerout":rf.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":sf.delete(l.pointerId)}}function af(o,l,f,m,b,v){return o===null||o.nativeEvent!==v?(o={blockedOn:l,domEventName:f,eventSystemFlags:m,nativeEvent:v,targetContainers:[b]},l!==null&&(l=hs(l),l!==null&&ME(l)),o):(o.eventSystemFlags|=m,l=o.targetContainers,b!==null&&l.indexOf(b)===-1&&l.push(b),o)}function iL(o,l,f,m,b){switch(l){case"focusin":return Ca=af(Ca,o,l,f,m,b),!0;case"dragenter":return wa=af(wa,o,l,f,m,b),!0;case"mouseover":return Ea=af(Ea,o,l,f,m,b),!0;case"pointerover":var v=b.pointerId;return rf.set(v,af(rf.get(v)||null,o,l,f,m,b)),!0;case"gotpointercapture":return v=b.pointerId,sf.set(v,af(sf.get(v)||null,o,l,f,m,b)),!0}return!1}function IE(o){var l=fs(o.target);if(l!==null){var f=s(l);if(f!==null){if(l=f.tag,l===13){if(l=a(f),l!==null){o.blockedOn=l,pc(o.priority,function(){OE(f)});return}}else if(l===31){if(l=u(f),l!==null){o.blockedOn=l,pc(o.priority,function(){OE(f)});return}}else if(l===3&&f.stateNode.current.memoizedState.isDehydrated){o.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Jd(o){if(o.blockedOn!==null)return!1;for(var l=o.targetContainers;0<l.length;){var f=Cx(o.nativeEvent);if(f===null){f=o.nativeEvent;var m=new f.constructor(f.type,f);Pl=m,f.target.dispatchEvent(m),Pl=null}else return l=hs(f),l!==null&&ME(l),o.blockedOn=f,!1;l.shift()}return!0}function _E(o,l,f){Jd(o)&&f.delete(l)}function sL(){Ex=!1,Ca!==null&&Jd(Ca)&&(Ca=null),wa!==null&&Jd(wa)&&(wa=null),Ea!==null&&Jd(Ea)&&(Ea=null),rf.forEach(_E),sf.forEach(_E)}function Ud(o,l){o.blockedOn===l&&(o.blockedOn=null,Ex||(Ex=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,sL)))}var Hd=null;function zE(o){Hd!==o&&(Hd=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Hd===o&&(Hd=null);for(var l=0;l<o.length;l+=3){var f=o[l],m=o[l+1],b=o[l+2];if(typeof m!="function"){if(wx(m||f)===null)continue;break}var v=hs(f);v!==null&&(o.splice(l,3),l-=3,Cy(v,{pending:!0,data:b,method:f.method,action:m},m,b))}}))}function mu(o){function l(U){return Ud(U,o)}Ca!==null&&Ud(Ca,o),wa!==null&&Ud(wa,o),Ea!==null&&Ud(Ea,o),rf.forEach(l),sf.forEach(l);for(var f=0;f<Aa.length;f++){var m=Aa[f];m.blockedOn===o&&(m.blockedOn=null)}for(;0<Aa.length&&(f=Aa[0],f.blockedOn===null);)IE(f),f.blockedOn===null&&Aa.shift();if(f=(o.ownerDocument||o).$$reactFormReplay,f!=null)for(m=0;m<f.length;m+=3){var b=f[m],v=f[m+1],A=b[xn]||null;if(typeof v=="function")A||zE(f);else if(A){var D=null;if(v&&v.hasAttribute("formAction")){if(b=v,A=v[xn]||null)D=A.formAction;else if(wx(b)!==null)continue}else D=A.action;typeof D=="function"?f[m+1]=D:(f.splice(m,3),m-=3),zE(f)}}}function LE(){function o(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(A){return b=A})},focusReset:"manual",scroll:"manual"})}function l(){b!==null&&(b(),b=null),m||setTimeout(f,20)}function f(){if(!m&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,b=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(f,100),function(){m=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),b!==null&&(b(),b=null)}}}function Ax(o){this._internalRoot=o}qd.prototype.render=Ax.prototype.render=function(o){var l=this._internalRoot;if(l===null)throw Error(r(409));var f=l.current,m=Ir();NE(f,m,o,l,null,null)},qd.prototype.unmount=Ax.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var l=o.containerInfo;NE(o.current,2,null,o,null,null),Ad(),l[cs]=null}};function qd(o){this._internalRoot=o}qd.prototype.unstable_scheduleHydration=function(o){if(o){var l=_p();o={blockedOn:null,target:o,priority:l};for(var f=0;f<Aa.length&&l!==0&&l<Aa[f].priority;f++);Aa.splice(f,0,o),f===0&&IE(o)}};var BE=e.version;if(BE!=="19.2.7")throw Error(r(527,BE,"19.2.7"));le.findDOMNode=function(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=h(l),o=o!==null?d(o):null,o=o===null?null:o.stateNode,o};var aL={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:X,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kd.isDisabled&&Kd.supportsFiber)try{ke=Kd.inject(aL),jt=Kd}catch{}}return df.createRoot=function(o,l){if(!i(o))throw Error(r(299));var f=!1,m="",b=Uw,v=Hw,A=qw;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(b=l.onUncaughtError),l.onCaughtError!==void 0&&(v=l.onCaughtError),l.onRecoverableError!==void 0&&(A=l.onRecoverableError)),l=EE(o,1,!1,null,null,f,m,null,b,v,A,LE),o[cs]=l.current,ox(o),new Ax(l)},df.hydrateRoot=function(o,l,f){if(!i(o))throw Error(r(299));var m=!1,b="",v=Uw,A=Hw,D=qw,U=null;return f!=null&&(f.unstable_strictMode===!0&&(m=!0),f.identifierPrefix!==void 0&&(b=f.identifierPrefix),f.onUncaughtError!==void 0&&(v=f.onUncaughtError),f.onCaughtError!==void 0&&(A=f.onCaughtError),f.onRecoverableError!==void 0&&(D=f.onRecoverableError),f.formState!==void 0&&(U=f.formState)),l=EE(o,1,!0,l,f??null,m,b,U,v,A,D,LE),l.context=AE(null),f=l.current,m=Ir(),m=us(m),b=fa(m),b.callback=null,ha(f,b,m),f=m,l.current.lanes=f,fo(l,f),$i(l),o[cs]=l.current,ox(o),new qd(l)},df.version="19.2.7",df}var AM;function wQ(){if(AM)return ib.exports;AM=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(),ib.exports=CQ(),ib.exports}var uC=wQ();function EQ(t,e,n){return PR(Y6,()=>(r,i,s)=>{const a=document.createElement("div");a.className="mdx-block-card-wrapper",a.setAttribute("data-cms-ui",""),a.contentEditable="false";const u=uC.createRoot(a);let c=null;const h=y=>{const x=typeof s=="function"?s():null;if(x==null)return;const k=i.state.doc.nodeAt(x);if(!k)return;const w=i.state.tr.setNodeMarkup(x,void 0,{...k.attrs,...y});i.dispatch(w)},d=()=>{const y=typeof s=="function"?s():null;if(y==null)return;const x=i.state.doc.nodeAt(y);x&&i.dispatch(i.state.tr.delete(y,y+x.nodeSize))},g=y=>{const x=y.attrs.componentName,k=y.attrs.props,w=y.attrs.hasExpressions,N=y.attrs.children||"";a.setAttribute("data-mdx-component",x),a.setAttribute("data-mdx-props",k),a.setAttribute("data-mdx-children",N);const T=JSON.parse(k),V=t(x),F=(V?.slots?.includes("default")??!1)||N.trim()!=="";c={componentName:x,props:k,hasExpressions:w,children:N},u.render(ee.createElement(xQ,{componentName:x,props:T,hasExpressions:w,slotContent:N,definition:V,media:e,mediaContext:n,onRemove:d,onSlotContentChange:F?K=>h({children:K}):void 0,onPropsChange:w?void 0:K=>h({props:JSON.stringify(K)})}))};return g(r),{dom:a,stopEvent:y=>{const x=y.target;return!!(x.tagName==="TEXTAREA"||x.tagName==="INPUT"||x.isContentEditable||x.closest("[contenteditable]")||x.closest("[data-mdx-action]")||(y.type==="mousedown"||y.type==="click")&&(x.closest("button")||x.closest("[data-mdx-action]")))},ignoreMutation:()=>!0,update:y=>{if(y.type.name!=="mdx_component")return!1;const x=y.attrs;return c&&x.componentName===c.componentName&&x.props===c.props&&x.hasExpressions===c.hasExpressions&&x.children===c.children||g(y),!0},destroy:()=>{queueMicrotask(()=>u.unmount())}}})}const $S={position:"relative",width:"100%",maxWidth:560,aspectRatio:"16 / 9",margin:"0.5rem 0",borderRadius:8,overflow:"hidden",background:"#000",border:"1px solid rgba(0,0,0,0.1)"},AQ={position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",cursor:"pointer"},NQ={position:"absolute",inset:0,margin:"auto",width:68,height:48,border:"none",borderRadius:12,background:"rgba(0,0,0,0.7)",color:"#fff",fontSize:22,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},TQ={position:"absolute",top:6,right:6,zIndex:2,width:24,height:24,border:"none",borderRadius:6,background:"rgba(0,0,0,0.6)",color:"#fff",cursor:"pointer",lineHeight:"24px"},MQ={position:"absolute",inset:0,width:"100%",height:"100%",border:"none"},OQ={...$S,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:13};function RQ({videoId:t,onRemove:e}){const[n,r]=ee.useState(!1);if(!t)return ee.createElement("div",{style:OQ,"data-cms-ui":""},"YouTube: missing video id");const i=ee.createElement("button",{type:"button",style:TQ,title:"Remove","data-mdx-action":"youtube-remove",onClick:e},"✕");return n?ee.createElement("div",{style:$S,"data-cms-ui":""},i,ee.createElement("iframe",{style:MQ,src:`https://www.youtube-nocookie.com/embed/${t}?autoplay=1`,title:"YouTube video",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})):ee.createElement("div",{style:$S,"data-cms-ui":""},i,ee.createElement("img",{style:AQ,src:`https://i.ytimg.com/vi/${t}/hqdefault.jpg`,alt:"YouTube thumbnail",loading:"lazy",onClick:()=>r(!0)}),ee.createElement("button",{type:"button",style:NQ,title:"Play","data-mdx-action":"youtube-play",onClick:()=>r(!0)},"▶"))}function DQ(){return PR(Q_,()=>(t,e,n)=>{const r=document.createElement("div");r.setAttribute("data-cms-ui",""),r.contentEditable="false";const i=uC.createRoot(r);let s=null;const a=()=>{const c=typeof n=="function"?n():null;if(c==null)return;const h=e.state.doc.nodeAt(c);h&&e.dispatch(e.state.tr.delete(c,c+h.nodeSize))},u=c=>{const h=c.attrs.videoId;r.setAttribute("data-youtube",h),s=h,i.render(ee.createElement(RQ,{videoId:h,onRemove:a}))};return u(t),{dom:r,stopEvent:c=>{const h=c.target;return h.closest("[data-mdx-action]")||h.tagName==="IFRAME"||h.tagName==="IMG"?!0:c.type==="mousedown"||c.type==="click"?!!h.closest("button"):!1},ignoreMutation:()=>!0,update:c=>c.type.name!=="youtube"?!1:(s===c.attrs.videoId||u(c),!0),destroy:()=>{queueMicrotask(()=>i.unmount())}}})}const IQ={border:"1px solid #d4d4d8",borderRadius:6,background:"#fff",display:"flex",flexDirection:"column",minHeight:240,maxHeight:"max(70vh, 320px)",overflow:"hidden"},_Q={padding:"8px 12px",flex:1,minHeight:0,overflowY:"auto",outline:"none"},NM="nua-mdx-editor-styles",zQ=`
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
+ /* tables (GFM) — PM/prosemirror-tables ship no usable styles; without these the
122
+ cells collapse to 0 width and the table is invisible & uneditable */
123
+ .nua-mdx-editor .ProseMirror .tableWrapper { overflow-x: auto; margin: 0.8em 0; }
124
+ .nua-mdx-editor .ProseMirror table { border-collapse: collapse; table-layout: fixed; width: 100%; margin: 0.8em 0; overflow: hidden; }
125
+ .nua-mdx-editor .ProseMirror th, .nua-mdx-editor .ProseMirror td { border: 1px solid #d4d4d8; padding: 0.4em 0.6em; vertical-align: top; box-sizing: border-box; position: relative; min-width: 5em; }
126
+ .nua-mdx-editor .ProseMirror th { background: #f4f4f5; font-weight: 600; text-align: left; }
127
+ .nua-mdx-editor .ProseMirror th > p, .nua-mdx-editor .ProseMirror td > p { margin: 0; }
128
+ .nua-mdx-editor .ProseMirror .column-resize-handle { position: absolute; right: -2px; top: 0; bottom: 0; width: 4px; z-index: 20; background-color: #93c5fd; pointer-events: none; }
129
+ .nua-mdx-editor .ProseMirror .selectedCell:after { content: ''; position: absolute; inset: 0; z-index: 2; background: rgba(200,200,255,0.4); pointer-events: none; }
130
+ `;function LQ(){ee.useEffect(()=>{if(typeof document>"u"||document.getElementById(NM))return;const t=document.createElement("style");t.id=NM,t.textContent=zQ,document.head.appendChild(t)},[])}function t4({value:t,onChange:e,components:n,listStyles:r,media:i,mediaContext:s,allowComponents:a=!0}){LQ();const u=ee.useRef(null),c=ee.useRef(null),h=ee.useRef(t),d=ee.useRef(!1),g=ee.useRef(!1),y=ee.useRef(e);y.current=e;const x=ee.useRef(new Map);ee.useEffect(()=>{x.current=new Map((n??[]).map(L=>[L.name,L]))},[n]);const k=ee.useRef(i);k.current=i;const w=ee.useRef(s);w.current=s;const[N,T]=ee.useState(!1),[V,F]=ee.useState(null);ee.useEffect(()=>{const L=u.current;if(!L)return;let C=!1;const _=$=>x.current.get($);return(async()=>{const $=await FR.make().config(H=>{H.set(xh,L),H.set(yh,h.current),H.get(Dg).markdownUpdated((ue,ae)=>{h.current=ae,d.current&&!g.current&&y.current(ae)})}).use(AD).use(wY).use(B_).use(e4).use(lC).use(q_).use(K_).use(EX).use(TX).use(Y6).use(EQ(_,k.current,w.current)).use(pM).use(aY).use(Q_).use(DQ()).use(Z_).create();if(C){$.destroy();return}c.current=$,F($),queueMicrotask(()=>{d.current=!0})})(),()=>{C=!0,d.current=!1,c.current?.destroy(),c.current=null,F(null)}},[]),ee.useEffect(()=>{!c.current||!d.current||t!==h.current&&(g.current=!0,c.current.action(jR(t)),G_(c.current.ctx.get(Vt)),h.current=t,queueMicrotask(()=>{g.current=!1}))},[t]);const K=(L,C,_)=>{c.current?.action(Oi(pM.key,{componentName:L,props:C,children:_}))};return O.jsxs("div",{className:"nua-mdx-editor",style:IQ,children:[O.jsx(o6,{editor:V,listStyles:r,media:i,mediaContext:s,field:"body",onInsertComponent:a?()=>T(!0):void 0}),O.jsx("div",{ref:u,style:_Q}),a?O.jsx(f5,{open:N,components:n??[],onInsert:K,onClose:()=>T(!1)}):null]})}const BQ={image:"Image URL or path",file:"File URL or path",video:"Video URL or path"};function FQ({client:t,value:e,collection:n,entry:r,field:i,fieldType:s,accept:a,onChange:u}){const[c,h]=ee.useState({kind:"probing"}),d=ee.useRef(null);ee.useEffect(()=>{let k=!0;return t.listMedia({limit:1}).then(()=>{k&&h({kind:"ready"})},w=>{k&&h(UE(w)?{kind:"unavailable"}:{kind:"ready"})}),()=>{k=!1}},[t]);const g=async k=>{h({kind:"uploading"});try{const w=await t.uploadMedia(k,{collection:n,entry:r,field:i});w.success&&w.url?(u(w.url),h({kind:"ready"})):h({kind:"error",message:w.error??"Upload failed"})}catch(w){if(UE(w)){h({kind:"unavailable"});return}h({kind:"error",message:w instanceof Error?w.message:"Upload failed"})}},y=c.kind==="ready"||c.kind==="error",x=n5(t,e,n,r);return O.jsxs("div",{className:"nua-cadmin-media",children:[O.jsx(VQ,{src:x,value:e,fieldType:s}),O.jsxs("div",{className:"nua-cadmin-media-row",children:[O.jsx("input",{type:"text",className:"nua-cadmin-input",value:e,placeholder:BQ[s],onChange:k=>u(k.target.value)}),e!==""?O.jsx("button",{type:"button",className:"nua-cadmin-icon-btn","aria-label":"Clear",onClick:()=>u(""),children:"×"}):null]}),c.kind==="uploading"?O.jsx("div",{className:"nua-cadmin-field-loading",children:"Uploading…"}):null,c.kind==="unavailable"?O.jsx("div",{className:"nua-cadmin-media-hint",children:"Media uploads unavailable — paste a URL or path instead."}):null,c.kind==="error"?O.jsx("div",{className:"nua-cadmin-media-error",children:c.message}):null,y||c.kind==="probing"?O.jsxs(O.Fragment,{children:[O.jsx("input",{ref:d,type:"file",accept:a??(s==="video"?_M:void 0),className:"nua-cadmin-file-input",disabled:!y,onChange:k=>{const w=k.target.files?.[0];w&&g(w),k.target.value=""}}),O.jsx("button",{type:"button",className:"nua-cadmin-add-btn",disabled:!y,onClick:()=>d.current?.click(),children:"Upload file"})]}):null]})}function VQ({src:t,value:e,fieldType:n}){return t===""?null:n==="video"||i5(e)?O.jsx("video",{className:"nua-cadmin-img",src:t,muted:!0,playsInline:!0,controls:!0,preload:"metadata"}):r5(e)?O.jsx("img",{className:"nua-cadmin-img",src:t,alt:""}):null}const PQ=[],jQ={url:"url",email:"email",tel:"tel"},$Q={date:"date",datetime:"datetime-local",time:"time",month:"month"};function JQ({field:t,value:e,onChange:n}){const r=t.hints;return O.jsx("input",{type:jQ[t.type]??"text",className:"nua-cadmin-input",value:to(e),placeholder:r?.placeholder,maxLength:r?.maxLength,minLength:r?.minLength,onChange:i=>n(cl(t.type,i.target.value))})}function UQ({value:t,rows:e,placeholder:n,maxLength:r,onChange:i}){const s=ee.useRef(null);return ee.useEffect(()=>{const a=s.current;a&&(a.style.height="auto",a.style.height=`${a.scrollHeight}px`)},[t]),O.jsx("textarea",{ref:s,className:"nua-cadmin-textarea nua-cadmin-textarea-autosize",value:t,rows:e,placeholder:n,maxLength:r,onChange:a=>i(a.target.value)})}function HQ({field:t,value:e,onChange:n}){return O.jsx(UQ,{value:to(e),rows:t.hints?.rows??4,placeholder:t.hints?.placeholder,maxLength:t.hints?.maxLength,onChange:n})}function qQ({value:t,onChange:e,ctx:n}){const r=ee.useMemo(()=>({collection:n.collection,entry:n.slug}),[n.collection,n.slug]),[i,s]=ee.useState([]);return ee.useEffect(()=>{let a=!0;return n.client.getConfig().then(u=>{a&&s(u.listStyles??[])},()=>{a&&s([])}),()=>{a=!1}},[n.client]),O.jsx(t4,{value:to(t),onChange:e,components:PQ,listStyles:i,media:n.client,mediaContext:r})}function KQ({field:t,value:e,onChange:n}){return O.jsx("input",{type:"number",className:"nua-cadmin-input",value:to(e),min:t.hints?.min,max:t.hints?.max,step:t.hints?.step,placeholder:t.hints?.placeholder,onChange:r=>n(cl("number",r.target.value))})}function GQ({value:t,onChange:e}){return O.jsx("input",{type:"number",className:"nua-cadmin-input",value:to(t),min:1e3,max:9999,step:1,onChange:n=>e(cl("year",n.target.value))})}function YQ({field:t,value:e,onChange:n}){return O.jsx("input",{type:$Q[t.type]??"date",className:"nua-cadmin-input",value:BL(e,t.type),onChange:r=>n(cl(t.type,r.target.value))})}function WQ({field:t,value:e,onChange:n}){const r=FL(e),i=t.role==="publish-toggle";return O.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:[O.jsx("span",{className:"nua-cadmin-toggle-knob"}),O.jsx("span",{className:"nua-cadmin-toggle-label",children:r?"On":"Off"})]})}function XQ({field:t,value:e,onChange:n}){const r=t.options??[],i=to(e);return O.jsxs("select",{className:"nua-cadmin-input",value:i,onChange:s=>n(cl("select",s.target.value)),children:[t.required?i===""?O.jsx("option",{value:"",disabled:!0,children:"— select —"}):null:O.jsx("option",{value:"",children:"— none —"}),r.map(s=>O.jsx("option",{value:s,children:s},s)),i!==""&&!r.includes(i)?O.jsxs("option",{value:i,children:[i," (current)"]}):null]})}const QQ=2e4,ZQ=100,n4={options:[],loading:!0,paging:!1,truncated:!1,failed:!1};function eZ(t){const e={slug:t.slug,search:`${t.title??""} ${t.slug}`.toLowerCase()};return t.title!==void 0&&(e.title=t.title),e}function tZ(t,e){let n=n4,r=!1;const i=new Set,s=u=>{n={...n,...u};for(const c of i)c()},a=async()=>{if(r)return;r=!0;const u=n.options.length>0,c=[];try{const h=await RL(t,e,"slug,title",QQ,(d,g)=>{for(const y of d)c.push(eZ(y));u||s({options:[...c],loading:!1,paging:g,truncated:!1,failed:!1})});s({options:c,loading:!1,paging:!1,truncated:h.truncated,failed:!1})}catch{s({loading:!1,paging:!1,truncated:!u&&c.length>0,failed:n.options.length===0})}finally{r=!1}};return{getSnapshot:()=>n,subscribe(u){const c=i.size===0;return i.add(u),c&&!r&&a(),()=>{i.delete(u)}}}}const TM=new WeakMap;function nZ(t,e){let n=TM.get(t);n||(n=new Map,TM.set(t,n));const r=n.get(e);if(r)return r;const i=tZ(t,e);return n.set(e,i),i}function rZ(t,e){const n=e===void 0||e===""?null:nZ(t,e),r=ee.useCallback(s=>n?.subscribe(s)??(()=>{}),[n]),i=ee.useCallback(()=>n?.getSnapshot()??n4,[n]);return ee.useSyncExternalStore(r,i,i)}function MM(t){const e=t.title?.trim();return e===void 0||e===""?t.slug:e}function iZ(t,e){let n=0;for(const i of e){const s=t.search.indexOf(i);if(s<0)return null;n+=s}const r=e[0]??"";return t.slug.toLowerCase().startsWith(r)?n:n+1e3}function sZ(t,e){const n=e.toLowerCase().split(/\s+/).filter(i=>i!=="");if(n.length===0)return t;const r=[];for(const i of t){const s=iZ(i,n);s!==null&&r.push({option:i,score:s})}return r.sort((i,s)=>i.score-s.score),r.map(i=>i.option)}function aZ({target:t,snapshot:e,value:n,onChange:r}){const{options:i,paging:s,truncated:a}=e,[u,c]=ee.useState(!1),[h,d]=ee.useState(""),[g,y]=ee.useState(0),x=ee.useRef(null),k=ee.useRef(null),w=ee.useId(),N=i.find(J=>J.slug===n),T=ee.useMemo(()=>{const J=sZ(i,h);return N===void 0||h.trim()!==""?J:[N,...J.filter($=>$!==N)]},[i,h,N]),V=T.slice(0,ZQ),F=T.length-V.length;ee.useEffect(()=>{if(!u)return;const J=$=>{x.current?.contains($.target)||c(!1)};return document.addEventListener("pointerdown",J),()=>document.removeEventListener("pointerdown",J)},[u]),ee.useEffect(()=>{u&&k.current?.querySelector('[data-active="true"]')?.scrollIntoView({block:"nearest"})},[g,u]);const K=J=>{r(J),d(""),y(0),c(!1)},L=()=>{y(0),d(""),c(!0)},C=J=>{if(J.key==="ArrowDown"||J.key==="ArrowUp"){if(J.preventDefault(),!u){L();return}const $=V.length-1;y(H=>J.key==="ArrowDown"?Math.min(H+1,$):Math.max(H-1,0));return}if(J.key==="Enter"&&u){const $=V[g];$&&(J.preventDefault(),K($.slug));return}J.key==="Escape"&&u&&(J.stopPropagation(),d(""),c(!1))},_=n!==""&&N===void 0&&!s;return O.jsxs("div",{className:"nua-cadmin-combobox",ref:x,children:[O.jsxs("div",{className:"nua-cadmin-combobox-control",children:[O.jsx("input",{type:"text",className:"nua-cadmin-input nua-cadmin-combobox-input",role:"combobox","aria-expanded":u,"aria-controls":w,"aria-autocomplete":"list","aria-activedescendant":u&&V[g]!==void 0?`${w}-${g}`:void 0,autoComplete:"off",value:u?h:N?MM(N):n,placeholder:`Search ${t}…`,onFocus:L,onMouseDown:()=>{u||L()},onChange:J=>{d(J.target.value),y(0),c(!0)},onKeyDown:C}),n!==""?O.jsx("button",{type:"button",className:"nua-cadmin-combobox-clear",title:"Clear reference","aria-label":"Clear reference",onClick:()=>K(""),children:"×"}):null]}),u?O.jsxs("ul",{className:"nua-cadmin-combobox-list",id:w,role:"listbox",ref:k,children:[V.length===0&&!s?O.jsxs("li",{className:"nua-cadmin-combobox-empty",children:["No entry matches “",h,"”"]}):null,V.map((J,$)=>{const H=MM(J);return O.jsxs("li",{id:`${w}-${$}`,role:"option","aria-selected":J.slug===n,"data-active":$===g,className:`nua-cadmin-combobox-option${$===g?" is-active":""}`,onMouseDown:ue=>{ue.preventDefault(),K(J.slug)},onMouseEnter:()=>y($),children:[O.jsx("span",{className:"nua-cadmin-combobox-option-label",children:H}),H===J.slug?null:O.jsx("span",{className:"nua-cadmin-combobox-option-slug",children:J.slug})]},J.slug)}),F>0?O.jsxs("li",{className:"nua-cadmin-combobox-more",children:["+",F," more — keep typing to narrow"]}):null,s?O.jsx("li",{className:"nua-cadmin-combobox-more",children:"Loading more entries…"}):null]}):null,_?O.jsxs("div",{className:"nua-cadmin-combobox-hint",children:["“",n,"” is not an entry of ",t]}):null,a?O.jsxs("div",{className:"nua-cadmin-combobox-hint",children:["Showing the first ",i.length," ",i.length===1?"entry":"entries"," of ",t]}):null]})}function oZ({field:t,value:e,onChange:n,ctx:r}){const i=t.collection,s=rZ(r.client,i),a=to(e);return i===void 0||i===""||s.failed?O.jsx("input",{type:"text",className:"nua-cadmin-input",value:a,placeholder:"entry slug",onChange:u=>n(cl("reference",u.target.value))}):s.loading?O.jsxs("div",{className:"nua-cadmin-field-loading",children:["Loading ",i,"…"]}):O.jsx(aZ,{target:i,snapshot:s,value:a,onChange:u=>n(cl("reference",u))})}function lZ({field:t,value:e,onChange:n,ctx:r}){const i=VL(e),s=t.itemType??"text",a={name:t.name,type:s,required:!1,fields:t.fields,options:t.options,collection:t.collection},u=ee.useCallback((d,g)=>{const y=i.slice();y[d]=g,n(y)},[i,n]),c=ee.useCallback(d=>{n(i.filter((g,y)=>y!==d))},[i,n]),h=ee.useCallback(()=>{const d=s==="object"&&t.fields?hL(t.fields):zL(s);n([...i,d])},[i,s,t.fields,n]);return O.jsxs("div",{className:"nua-cadmin-array",children:[i.length===0?O.jsx("div",{className:"nua-cadmin-field-empty",children:"No items."}):null,i.map((d,g)=>O.jsxs("div",{className:"nua-cadmin-array-item",children:[O.jsx("div",{className:"nua-cadmin-array-item-body",children:O.jsx(w0,{field:a,value:d,onChange:y=>u(g,y),ctx:r})}),O.jsx("button",{type:"button",className:"nua-cadmin-icon-btn","aria-label":"Remove item",onClick:()=>c(g),children:"×"})]},g)),O.jsx("button",{type:"button",className:"nua-cadmin-add-btn",onClick:h,children:"+ Add item"})]})}function uZ({field:t,value:e,onChange:n,ctx:r}){const i=PL(e),s=t.fields??[],a=ee.useCallback((u,c)=>{n({...i,[u]:c})},[i,n]);return s.length===0?O.jsx("div",{className:"nua-cadmin-field-empty",children:"No nested fields."}):O.jsx("div",{className:"nua-cadmin-object",children:s.map(u=>O.jsxs("div",{className:"nua-cadmin-object-field",children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:u.name}),O.jsx("span",{className:"nua-cadmin-field-type",children:u.type})]}),O.jsx(w0,{field:u,value:i[u.name],onChange:c=>a(u.name,c),ctx:r})]},u.name))})}function w0({field:t,value:e,onChange:n,ctx:r}){switch(t.type){case"text":case"url":case"email":case"tel":case"color":return O.jsx(JQ,{field:t,value:e,onChange:n});case"textarea":return O.jsx(HQ,{field:t,value:e,onChange:n});case"markdown":return O.jsx(qQ,{value:e,onChange:n,ctx:r});case"number":return O.jsx(KQ,{field:t,value:e,onChange:n});case"year":return O.jsx(GQ,{value:e,onChange:n});case"date":case"datetime":case"time":case"month":return O.jsx(YQ,{field:t,value:e,onChange:n});case"boolean":return O.jsx(WQ,{field:t,value:e,onChange:n});case"select":return O.jsx(XQ,{field:t,value:e,onChange:n});case"image":case"file":case"video":return O.jsx(FQ,{client:r.client,value:to(e),collection:r.collection,entry:r.slug,field:t.name,fieldType:t.type,accept:t.hints?.accept,onChange:i=>n(i)});case"reference":return O.jsx(oZ,{field:t,value:e,onChange:n,ctx:r});case"array":return O.jsx(lZ,{field:t,value:e,onChange:n,ctx:r});case"object":return O.jsx(uZ,{field:t,value:e,onChange:n,ctx:r})}}function cZ({client:t,definition:e,collection:n,onCreated:r,onCancel:i}){const s=ee.useMemo(()=>e?.fields??[],[e]),[a,u]=ee.useState(""),[c,h]=ee.useState(()=>_L(s)),[d,g]=ee.useState(!1),[y,x]=ee.useState(null),{title:k,header:w,sidebar:N,sections:T}=ee.useMemo(()=>PM(s,e?.layout),[s,e?.layout]),V=ee.useMemo(()=>[...k?[{heading:void 0,fields:[k,...w]}]:w.length>0?[{heading:void 0,fields:w}]:[],...T.map($=>({heading:$.title,fields:$.fields})),...N.length>0?[{heading:void 0,fields:N}]:[]],[k,w,T,N]),F=ee.useMemo(()=>vL(a),[a]),K=ee.useMemo(()=>yL(s,c.frontmatter,F),[s,c.frontmatter,F]),L=ee.useMemo(()=>({client:t,collection:n}),[t,n]),C=ee.useCallback(($,H)=>{h(ue=>LM(ue,$,H))},[]),_=ee.useCallback(async()=>{if(F===""){x("A slug is required.");return}const $=BM(s,K);if($.length>0){x(FM($));return}g(!0),x(null);try{const H=await t.createEntry(n,{slug:F,frontmatter:K,body:c.body,fileExtension:e?.fileExtension});H.success?r(F):x(H.error??"Could not create the entry.")}catch(H){x(H instanceof Di?H.message:"Could not create the entry.")}finally{g(!1)}},[t,n,e,c.body,K,s,F,r]),J=e?.type==="data";return O.jsxs("div",{className:"nua-cadmin-editor",children:[O.jsxs("div",{className:"nua-cadmin-field",children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:"slug"}),O.jsx("span",{className:"nua-cadmin-field-type",children:"text · required"})]}),O.jsx("input",{type:"text",className:"nua-cadmin-input",value:a,placeholder:"my-new-entry",onChange:$=>u($.target.value)})]}),V.map(($,H)=>O.jsxs(ee.Fragment,{children:[$.heading?O.jsx("div",{className:"nua-cadmin-form-heading",children:$.heading}):null,$.fields.map(ue=>O.jsxs("div",{className:`nua-cadmin-field${ue.role?` nua-cadmin-field-${ue.role}`:""}`,children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:VM(ue)}),O.jsxs("span",{className:"nua-cadmin-field-type",children:[ue.type,ue.required?" · required":""]})]}),O.jsx(w0,{field:ue,value:c.frontmatter[ue.name],onChange:ae=>C(ue.name,ae),ctx:L})]},ue.name))]},`block-${H}`)),J?null:O.jsxs("div",{className:"nua-cadmin-field",children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:"Body"}),O.jsx("span",{className:"nua-cadmin-field-type",children:"markdown"})]}),O.jsx("textarea",{className:"nua-cadmin-body-editor",value:c.body,rows:10,onChange:$=>h(H=>({...H,body:$.target.value}))})]}),y?O.jsx("div",{className:"nua-cadmin-media-error",children:y}):null,O.jsxs("div",{className:"nua-cadmin-editor-toolbar",children:[O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",disabled:d,onClick:i,children:"Cancel"}),O.jsx("span",{className:"nua-cadmin-spacer"}),O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",disabled:d,onClick:()=>{_()},children:d?"Creating…":"Create entry"})]})]})}const fZ=700;function hZ({field:t,draft:e,onField:n,ctx:r}){return O.jsxs("div",{className:`nua-cadmin-field${t.width==="half"?" nua-cadmin-field-half":""}${t.role?` nua-cadmin-field-${t.role}`:""}`,children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:VM(t)}),O.jsxs("span",{className:"nua-cadmin-field-type",children:[t.type,t.required?" · required":""]})]}),t.help?O.jsx("div",{className:"nua-cadmin-field-help",children:t.help}):null,O.jsx(w0,{field:t,value:e.frontmatter[t.name],onChange:i=>n(t.name,i),ctx:r})]})}function Ah({fields:t,draft:e,onField:n,ctx:r}){return O.jsx("div",{className:"nua-cadmin-field-grid",children:t.map(i=>O.jsx(hZ,{field:i,draft:e,onField:n,ctx:r},i.name))})}function pZ({sections:t,display:e,draft:n,onField:r,ctx:i}){const[s,a]=ee.useState(0);if(e==="tabs"){const u=t[Math.min(s,t.length-1)];return O.jsxs("div",{className:"nua-cadmin-tabs",children:[O.jsx("div",{className:"nua-cadmin-tabbar",role:"tablist",children:t.map((c,h)=>O.jsx("button",{type:"button",role:"tab","aria-selected":h===s,className:`nua-cadmin-tab${h===s?" is-active":""}`,onClick:()=>a(h),children:c.title??"General"},`section-${h}`))}),u?O.jsx(Ah,{fields:u.fields,draft:n,onField:r,ctx:i}):null]})}return O.jsx(O.Fragment,{children:t.map((u,c)=>u.title===void 0?O.jsx(Ah,{fields:u.fields,draft:n,onField:r,ctx:i},`section-${c}`):O.jsxs("details",{className:"nua-cadmin-section",open:!u.collapsed,children:[O.jsx("summary",{className:"nua-cadmin-section-summary",children:u.title}),O.jsx("div",{className:"nua-cadmin-section-body",children:O.jsx(Ah,{fields:u.fields,draft:n,onField:r,ctx:i})})]},`section-${c}`))})}function dZ({onUseServer:t,onUseOurs:e,onDismiss:n}){return O.jsx("div",{className:"nua-cadmin-dialog-backdrop",role:"dialog","aria-modal":"true","aria-label":"Edit conflict",children:O.jsxs("div",{className:"nua-cadmin-dialog",children:[O.jsx("div",{className:"nua-cadmin-dialog-title",children:"This entry changed elsewhere"}),O.jsx("div",{className:"nua-cadmin-dialog-body",children:"Someone (or the agent) edited this entry after you opened it. Choose which version to keep."}),O.jsxs("div",{className:"nua-cadmin-dialog-actions",children:[O.jsx("button",{type:"button",className:"nua-cadmin-btn",onClick:t,children:"Use server version"}),O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",onClick:e,children:"Keep my changes"}),O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",onClick:n,children:"Keep editing"})]})]})})}function mZ({status:t}){switch(t.kind){case"saving":return O.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-saving",children:"Saving…"});case"saved":return O.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-saved",children:"Saved"});case"conflict":return O.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-conflict",children:"Conflict"});case"error":return O.jsx("span",{className:"nua-cadmin-status nua-cadmin-status-error",children:t.message});default:return null}}function gZ({client:t,definition:e,collection:n,slug:r,onDeleted:i,onRenamed:s}){const a=ee.useMemo(()=>e?.fields??[],[e]),u=e?.fileExtension==="mdx",[c,h]=ee.useState(null),[d,g]=ee.useState(null),[y,x]=ee.useState({kind:"idle"}),[k,w]=ee.useState([]),[N,T]=ee.useState([]),V=ee.useMemo(()=>$L(t,n,r),[t,n,r]),F=ee.useRef(null);F.current=c;const K=ee.useRef(null),L=ee.useMemo(()=>({client:t,collection:n,slug:r}),[t,n,r]),C=ee.useMemo(()=>({collection:n,entry:r}),[n,r]);ee.useEffect(()=>{let P=!0;return V.reset(),h(null),g(null),x({kind:"idle"}),t.getEntry(n,r).then(te=>{P&&h(IL(te,a))},te=>{P&&g(te instanceof Error?te:new Error(String(te)))}),()=>{P=!1,K.current&&clearTimeout(K.current)}},[t,n,r,a,V]),ee.useEffect(()=>{if(!u)return;let P=!0;return t.getComponents().then(te=>{P&&w(te)},()=>{P&&w([])}),()=>{P=!1}},[t,u]),ee.useEffect(()=>{if(!u)return;let P=!0;return t.getConfig().then(te=>{P&&T(te.listStyles??[])},()=>{P&&T([])}),()=>{P=!1}},[t,u]);const _=ee.useCallback(async(P,te)=>{const z=BM(a,P.frontmatter);if(z.length>0){x({kind:"error",message:`Not saved — ${FM(z)}`});return}x({kind:"saving"});const xe=await te(P);xe.status==="conflict"?x({kind:"conflict",conflict:xe.conflict}):xe.status==="error"?x({kind:"error",message:xe.message}):x({kind:"saved"})},[a]),J=ee.useCallback(P=>{K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{_(P,V.save)},fZ)},[_,V]),$=ee.useCallback((P,te)=>{h(z=>{if(!z)return z;const xe=LM(z,P,te);return J(xe),xe})},[J]),H=ee.useCallback(P=>{h(te=>{if(!te)return te;const z={...te,body:P};return J(z),z})},[J]),ue=ee.useCallback(()=>{y.kind==="conflict"&&(h(V.adoptServer(y.conflict,a)),x({kind:"saved"}))},[y,a,V]),ae=ee.useCallback(()=>{if(y.kind!=="conflict")return;const P=F.current,{conflict:te}=y;P&&_(P,z=>V.overwrite(z,te))},[y,_,V]),Se=ee.useCallback(()=>{y.kind==="conflict"&&x({kind:"idle"})},[y]),Ee=ee.useCallback(async()=>{if(!(typeof window<"u"&&!window.confirm(`Delete entry "${r}"? This cannot be undone.`)))try{await t.deleteEntry(n,r),i()}catch(P){x({kind:"error",message:P instanceof Di?P.message:"Delete failed"})}},[t,n,r,i]),Y=ee.useCallback(async()=>{if(typeof window>"u")return;const P=window.prompt("Rename entry to (new slug):",r);if(!(P===null||P.trim()===""||P===r))try{await t.renameEntry(n,r,P.trim()),s(P.trim())}catch(te){x({kind:"error",message:te instanceof Di?te.message:"Rename failed"})}},[t,n,r,s]);if(d)return O.jsxs("div",{className:"nua-cadmin-error",children:[O.jsx("div",{className:"nua-cadmin-error-title",children:"Could not load entry"}),O.jsx("div",{children:d.message})]});if(!c)return O.jsxs("div",{className:"nua-cadmin-state",children:[O.jsx("div",{className:"nua-cadmin-spinner"}),O.jsx("div",{children:"Loading entry…"})]});const{title:X,header:le,sidebar:Ce,sections:_e,display:j}=PM(a,e?.layout);return O.jsxs("div",{className:"nua-cadmin-editor",children:[O.jsxs("div",{className:"nua-cadmin-editor-toolbar",children:[O.jsx(mZ,{status:y}),O.jsx("span",{className:"nua-cadmin-spacer"}),O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-ghost",onClick:()=>{Y()},children:"Rename"}),O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-danger",onClick:()=>{Ee()},children:"Delete"})]}),X||le.length>0?O.jsx("div",{className:"nua-cadmin-editor-header-fields",children:O.jsx(Ah,{fields:X?[X,...le]:le,draft:c,onField:$,ctx:L})}):null,O.jsxs("div",{className:"nua-cadmin-editor-grid",children:[O.jsxs("div",{className:"nua-cadmin-editor-main",children:[O.jsx(pZ,{sections:_e,display:j,draft:c,onField:$,ctx:L}),e?.type!=="data"?O.jsxs("div",{className:"nua-cadmin-field",children:[O.jsxs("div",{className:"nua-cadmin-field-label",children:[O.jsx("span",{children:"Body"}),O.jsx("span",{className:"nua-cadmin-field-type",children:u?"mdx":"markdown"})]}),u?O.jsx(t4,{value:c.body,onChange:H,components:k,listStyles:N,media:t,mediaContext:C}):O.jsx("textarea",{className:"nua-cadmin-body-editor",value:c.body,rows:16,onChange:P=>H(P.target.value)})]}):null]}),Ce.length>0?O.jsx("div",{className:"nua-cadmin-editor-sidebar",children:O.jsx(Ah,{fields:Ce,draft:c,onField:$,ctx:L})}):null]}),y.kind==="conflict"?O.jsx(dZ,{onUseServer:ue,onUseOurs:ae,onDismiss:Se}):null]})}function OM(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 yZ(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 RM(t,e){const[n,r]=ee.useState({data:null,error:null,loading:!0,settled:!1}),[i,s]=ee.useState(0),a=ee.useRef(t);a.current=t;const u=[...e,i],c=ee.useRef(null);ee.useEffect(()=>{let d=!0;const g=c.current,y=g!==null&&g.length===e.length&&g.every((x,k)=>Object.is(x,e[k]));return c.current=e,r(x=>({data:null,error:null,loading:!0,settled:y&&x.settled})),a.current().then(x=>{d&&r({data:x,error:null,loading:!1,settled:!0})},x=>{d&&r({data:null,error:x instanceof Error?x:new Error(String(x)),loading:!1,settled:!0})}),()=>{d=!1}},u);const h=ee.useCallback(()=>s(d=>d+1),[]);return{...n,reload:h}}function xZ({label:t}){return O.jsxs("div",{className:"nua-cadmin-state",children:[O.jsx("div",{className:"nua-cadmin-spinner"}),O.jsx("div",{children:t})]})}function r4({error:t,onRetry:e}){const n=t instanceof Di&&t.isUnauthorized?"Session expired":t instanceof Di&&t.isForbidden?"No access":"Something went wrong";return O.jsxs("div",{className:"nua-cadmin-error",children:[O.jsx("div",{className:"nua-cadmin-error-title",children:n}),O.jsx("div",{children:t.message}),e?O.jsx("button",{type:"button",className:"nua-cadmin-retry",onClick:e,children:"Try again"}):null]})}function i4({label:t}){return O.jsx("div",{className:"nua-cadmin-state",children:t})}function bZ({collections:t,locale:e,loading:n,error:r,activeCollection:i,onSelect:s,onReload:a,onClose:u}){const c=SL(t,{locale:e}),h=(d,g)=>O.jsxs("button",{type:"button",className:`nua-cadmin-nav-item${d.name===i?" is-active":""}`,style:g>0?{paddingLeft:12+g*14}:void 0,onClick:()=>s(d.name),title:d.name,children:[O.jsx("span",{className:"nua-cadmin-nav-label",children:d.label||d.name}),O.jsx("span",{className:"nua-cadmin-nav-count",children:d.entryCount})]},d.name);return O.jsxs("aside",{className:"nua-cadmin-sidebar",children:[O.jsxs("div",{className:"nua-cadmin-sidebar-head",children:[O.jsx("span",{className:"nua-cadmin-brand",children:"Collections"}),u?O.jsx("button",{type:"button",className:"nua-cadmin-close","aria-label":"Close",onClick:u,children:"×"}):null]}),O.jsxs("nav",{className:"nua-cadmin-nav",children:[n?O.jsx("div",{className:"nua-cadmin-nav-state",children:"Loading…"}):null,r?O.jsx("button",{type:"button",className:"nua-cadmin-nav-state nua-cadmin-nav-error",onClick:a,children:"Failed to load — retry"}):null,!n&&!r&&c.length===0?O.jsx("div",{className:"nua-cadmin-nav-state",children:"No content types"}):null,!n&&!r?c.flatMap(d=>[d.group?O.jsx("div",{className:"nua-cadmin-nav-group",children:d.group},`group:${d.group}`):null,...d.items.flatMap(({collection:g,children:y})=>[h(g,0),...y.map(x=>h(x,1))])]):null]})]})}const SZ=50,vZ="slug,title,draft,pathname";function kZ({client:t,collection:e,onOpen:n,onCreate:r,onRetry:i}){const[s,a]=ee.useState([]),[u,c]=ee.useState(void 0),[h,d]=ee.useState(!1),[g,y]=ee.useState(null),[x,k]=ee.useState(!0),[w,N]=ee.useState(!1),T=ee.useCallback(async(F,K)=>{K?N(!0):k(!0),y(null);try{const L=await t.getEntries(e,{fields:vZ,draft:"all",limit:SZ,cursor:F});a(C=>K?[...C,...L.entries]:L.entries),c(L.cursor),d(L.hasMore)}catch(L){y(L instanceof Error?L:new Error(String(L)))}finally{k(!1),N(!1)}},[t,e]);if(ee.useEffect(()=>{a([]),c(void 0),d(!1),T(void 0,!1)},[T]),x)return O.jsx(xZ,{label:"Loading entries…"});if(g)return O.jsx(r4,{error:g,onRetry:()=>{i(),T(void 0,!1)}});const V=O.jsx("div",{className:"nua-cadmin-entries-toolbar",children:O.jsx("button",{type:"button",className:"nua-cadmin-btn nua-cadmin-btn-primary",onClick:r,children:"+ New entry"})});return s.length===0?O.jsxs("div",{children:[V,O.jsx(i4,{label:"This collection has no entries."})]}):O.jsxs("div",{children:[V,O.jsxs("table",{className:"nua-cadmin-table",children:[O.jsx("thead",{children:O.jsxs("tr",{children:[O.jsx("th",{children:"Slug"}),O.jsx("th",{children:"Title"}),O.jsx("th",{children:"Draft"}),O.jsx("th",{children:"Pathname"})]})}),O.jsx("tbody",{children:s.map(F=>O.jsxs("tr",{className:"nua-cadmin-row",onClick:()=>n(F.slug),children:[O.jsx("td",{className:"nua-cadmin-cell-mono",children:F.slug}),O.jsx("td",{children:F.title??O.jsx("span",{className:"nua-cadmin-field-empty",children:"—"})}),O.jsx("td",{children:F.draft?O.jsx("span",{className:"nua-cadmin-badge nua-cadmin-badge-draft",children:"draft"}):""}),O.jsx("td",{className:"nua-cadmin-cell-mono",children:F.pathname??"—"})]},F.slug))})]}),h?O.jsx("button",{type:"button",className:"nua-cadmin-load-more",disabled:w,onClick:()=>{T(u,!0)},children:w?"Loading…":"Load more"}):null]})}function CZ({apiBase:t,onClose:e}){const n=ee.useMemo(()=>ML(t),[t]),[r,i]=ee.useState(()=>typeof window<"u"?OM(window.location.hash):{view:"list"});ee.useEffect(()=>{const T=()=>i(OM(window.location.hash));return window.addEventListener("hashchange",T),T(),()=>window.removeEventListener("hashchange",T)},[]);const s=ee.useCallback(T=>{const V=yZ(T);typeof window<"u"&&window.location.hash!==V?window.location.hash=V:i(T)},[]),a=RM(()=>n.getCollections(),[n]),u=a.data??[],c=RM(()=>n.getConfig(),[n]),h=ee.useCallback(()=>{c.data||c.reload()},[c.data,c.reload]),d=ee.useCallback(()=>{a.reload(),h()},[a.reload,h]),g=r.view!=="list"?r.collection:void 0,y=g?u.find(T=>T.name===g):void 0,x=y?y.label||y.name:g??"",k=ee.useCallback(T=>s({view:"entries",collection:T}),[s]),w=ee.useCallback((T,V)=>s({view:"detail",collection:T,slug:V}),[s]),N=ee.useCallback(T=>s({view:"create",collection:T}),[s]);return O.jsxs("div",{className:"nua-cadmin",children:[O.jsx(bZ,{collections:u,locale:c.data?.locale,loading:a.loading||!c.settled,error:a.error,activeCollection:g,onSelect:k,onReload:d,onClose:e}),O.jsxs("main",{className:"nua-cadmin-main",children:[O.jsxs("div",{className:"nua-cadmin-header",children:[r.view==="detail"||r.view==="create"?O.jsxs("button",{type:"button",className:"nua-cadmin-back",onClick:()=>k(r.collection),children:["← ",x]}):null,O.jsxs("h2",{className:"nua-cadmin-title",children:[r.view==="list"?"Content":x,r.view==="detail"?O.jsxs("span",{className:"nua-cadmin-crumb",children:["/ ",r.slug]}):null,r.view==="create"?O.jsx("span",{className:"nua-cadmin-crumb",children:"/ new entry"}):null]}),O.jsx("span",{className:"nua-cadmin-spacer"})]}),O.jsxs("div",{className:"nua-cadmin-body",children:[r.view==="list"?a.error?O.jsx(r4,{error:a.error,onRetry:d}):O.jsx(i4,{label:"Pick a content type from the left to browse its entries."}):null,r.view==="entries"?O.jsx(kZ,{client:n,collection:r.collection,onOpen:T=>w(r.collection,T),onCreate:()=>N(r.collection),onRetry:h}):null,r.view==="detail"?O.jsx(gZ,{client:n,definition:y,collection:r.collection,slug:r.slug,onDeleted:()=>k(r.collection),onRenamed:T=>w(r.collection,T)},`${r.collection}/${r.slug}`):null,r.view==="create"?O.jsx(cZ,{client:n,definition:y,collection:r.collection,onCreated:T=>w(r.collection,T),onCancel:()=>k(r.collection)}):null]})]})]})}const s4=document.getElementById("nua-studio-root");if(!s4)throw new Error("[cms-studio] #nua-studio-root container is missing");uC.createRoot(s4).render(O.jsx(ee.StrictMode,{children:O.jsx(CZ,{apiBase:"/cms/v1"})}));